html,
body {
  min-height: 100%;
  background-color: #050505 !important;
}

:root {
  color-scheme: dark;
  --app-bg: #050505;
  --app-surface: #101113;
  --app-surface-2: #17191d;
  --app-border: #2a2e35;
  --app-text: #f4f4f5;
  --app-muted: #a1a1aa;
  --app-green: #22c55e;
  --app-green-2: #16a34a;
  --bs-body-bg: var(--app-bg);
  --bs-body-color: var(--app-text);
  --bs-border-color: var(--app-border);
  --bs-success: var(--app-green-2);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  background: #050505 !important;
  color: var(--app-text) !important;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
}

.app-container,
.app-main {
  width: min(1180px, calc(100% - 32px));
  margin-inline: auto;
}

.app-main {
  padding: 32px 0 56px;
  background: #050505 !important;
}

.auth-main {
  width: 100%;
  min-height: 100vh;
  background: #050505 !important;
}

.app-navbar {
  background: #050505 !important;
  border-bottom: 1px solid var(--app-border);
  backdrop-filter: blur(14px);
}

.navbar-brand {
  letter-spacing: 0;
}

.nav-link {
  color: var(--app-muted);
}

.nav-link.active,
.nav-link:hover {
  color: var(--app-text);
}

.btn {
  border-radius: 6px;
  font-weight: 700;
}

.btn-success {
  --bs-btn-bg: var(--app-green-2);
  --bs-btn-border-color: var(--app-green-2);
  --bs-btn-hover-bg: var(--app-green);
  --bs-btn-hover-border-color: var(--app-green);
}

.btn-outline-light {
  --bs-btn-color: var(--app-text);
  --bs-btn-border-color: var(--app-border);
  --bs-btn-hover-bg: var(--app-surface-2);
  --bs-btn-hover-border-color: var(--app-muted);
}

.auth-body {
  overflow-x: hidden;
}

.auth-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 32px 16px;
}

.auth-card {
  width: min(440px, 100%);
  background: linear-gradient(180deg, rgb(23 25 29 / 96%), rgb(12 13 15 / 96%));
  border: 1px solid var(--app-border);
  border-radius: 8px;
  box-shadow: 0 24px 80px rgb(0 0 0 / 48%);
  padding: 28px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgb(34 197 94 / 42%);
  border-radius: 8px;
  background: rgb(34 197 94 / 10%);
  color: var(--app-green);
  font-weight: 800;
}

.eyebrow {
  display: block;
  margin-bottom: 6px;
  color: var(--app-green);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.05;
  letter-spacing: 0;
}

h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 750;
}

p {
  color: var(--app-muted);
  line-height: 1.6;
}

.auth-card h1 {
  font-size: 1.9rem;
}

.form-label {
  color: var(--app-text);
  font-weight: 700;
}

.form-control {
  min-height: 48px;
  background-color: #090a0c;
  border-color: var(--app-border);
  border-radius: 6px;
  color: var(--app-text);
}

.form-select {
  background-color: #090a0c;
  border-color: var(--app-border);
  color: var(--app-text);
}

.form-control:focus {
  background-color: #090a0c;
  border-color: var(--app-green);
  box-shadow: 0 0 0 0.2rem rgb(34 197 94 / 18%);
  color: var(--app-text);
}

.alert {
  border-radius: 6px;
}

.turnstile-wrap {
  min-height: 65px;
  margin: 8px 0 18px;
}

.dashboard {
  display: grid;
  gap: 24px;
  background: #050505;
}

.dashboard-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 8px 0 4px;
}

.dashboard-header p {
  max-width: 720px;
  margin: 12px 0 0;
}

.feature-card h2 {
  margin-bottom: 10px;
  font-size: 1.35rem;
}

.feature-card p {
  min-height: 52px;
  margin-bottom: 18px;
}

.empty-features .card-body {
  min-height: 260px;
  display: grid;
  align-content: center;
}

.empty-features h2 {
  margin-bottom: 10px;
  font-size: 1.5rem;
}

.app-card {
  background: rgb(16 17 19 / 92%);
  border: 1px solid var(--app-border);
  border-radius: 8px;
  box-shadow: 0 16px 48px rgb(0 0 0 / 22%);
}

.app-card .card-header {
  background: transparent;
  border-bottom: 1px solid var(--app-border);
  padding: 16px 18px;
}

.app-card .card-body {
  padding: 18px;
}

.metric-label {
  display: block;
  margin-bottom: 8px;
  color: var(--app-muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.metric-value {
  display: block;
  color: var(--app-text);
  font-size: 1.3rem;
  line-height: 1.2;
}

.module-list .list-group-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: transparent;
  border-color: var(--app-border);
  color: var(--app-text);
  padding: 18px;
}

.module-list strong,
.security-stack strong {
  display: block;
  color: var(--app-text);
}

.module-list span:not(.status-dot) {
  display: block;
  margin-top: 4px;
  color: var(--app-muted);
}

.status-dot {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--app-green);
  box-shadow: 0 0 0 4px rgb(34 197 94 / 12%);
}

.security-stack {
  display: grid;
  gap: 18px;
}

.security-stack > div {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--app-border);
}

.security-stack > div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.dropdown-menu {
  border-color: var(--app-border);
  background-color: var(--app-surface);
}

.admin-table {
  --bs-table-bg: transparent;
  --bs-table-border-color: var(--app-border);
}

.admin-table th {
  color: var(--app-muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.admin-table td {
  min-width: 160px;
}

.admin-table td strong,
.admin-table td span {
  display: block;
}

.admin-table td span:not(.badge) {
  margin-top: 4px;
  color: var(--app-muted);
}

.stacked-checks {
  display: grid;
  gap: 8px;
}

.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  margin: 0;
  color: var(--app-text);
}

.form-check-input {
  margin: 0;
  border-color: var(--app-border);
  background-color: #090a0c;
}

.form-check-input:checked {
  background-color: var(--app-green-2);
  border-color: var(--app-green-2);
}

.inline-admin-form {
  display: grid;
  min-width: 220px;
  gap: 12px;
}

.compact-inline-form {
  min-width: 160px;
}

.compact-checks {
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

.role-stack {
  display: grid;
  gap: 16px;
}

.role-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.role-card-header span:not(.badge) {
  display: block;
  margin-top: 4px;
  color: var(--app-muted);
}

.permission-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.permission-item {
  display: flex;
  gap: 10px;
  min-height: 74px;
  border: 1px solid var(--app-border);
  border-radius: 8px;
  background: rgb(9 10 12 / 70%);
  padding: 12px;
}

.permission-item strong,
.permission-item small {
  display: block;
}

.permission-item small {
  margin-top: 4px;
  color: var(--app-muted);
}

.field-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.field-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--app-border);
  border-radius: 999px;
  background: #090a0c;
  color: var(--app-text);
  font-size: 0.85rem;
  padding: 6px 10px;
}

.field-chip small {
  display: inline-grid;
  min-width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 50%;
  background: rgb(34 197 94 / 16%);
  color: var(--app-green);
  font-weight: 800;
}

.field-editor {
  display: grid;
  gap: 16px;
}

.field-editor textarea {
  min-height: 96px;
}

@media (max-width: 768px) {
  .app-container,
  .app-main {
    width: min(100% - 24px, 1180px);
  }

  .app-main {
    padding-top: 24px;
  }

  .dashboard-header {
    display: grid;
  }

  .auth-card {
    padding: 22px;
  }
}
