:root {
  color-scheme: dark;
  --bg: #080d18;
  --surface: #101827;
  --surface-raised: #152136;
  --line: #29364d;
  --text: #f4f7fb;
  --muted: #aab6ca;
  --accent: #88b6ff;
  --accent-strong: #b8d2ff;
  --accent-ink: #07101f;
  --focus: #ffd17a;
  --danger: #ff9aa7;
  --success: #8ee6bd;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 10% 0%, rgba(65, 115, 200, .24), transparent 34rem),
    var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.55;
}

a { color: var(--accent-strong); }
a:focus-visible, button:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: .65rem; font-size: clamp(2.1rem, 5vw, 3.6rem); line-height: 1.02; letter-spacing: -.045em; }
h2 { margin-bottom: .4rem; font-size: 1.55rem; letter-spacing: -.02em; }
h3 { margin-bottom: .35rem; font-size: 1.3rem; }

.site-header {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .8rem clamp(1rem, 4vw, 3rem);
  border-bottom: 1px solid var(--line);
  background: rgba(8, 13, 24, .9);
}

.site-header nav { display: flex; align-items: center; gap: 1.2rem; }
.site-header nav form { margin: 0; }
.site-header a, .link-button { color: var(--muted); text-decoration: none; font: inherit; font-weight: 700; }
.site-header a:hover, .link-button:hover { color: var(--text); }
.brand { color: var(--text) !important; font-size: 1.05rem; letter-spacing: -.01em; }
.link-button { border: 0; padding: 0; background: none; cursor: pointer; }

.page-shell { width: min(1120px, calc(100% - 2rem)); margin: 0 auto; padding: clamp(3rem, 8vw, 6.5rem) 0; }
.narrow-shell { width: min(760px, calc(100% - 2rem)); }
.hero { max-width: 760px; margin-bottom: clamp(3.2rem, 7vw, 5rem); }
.hero > p:last-child, .lede { color: var(--muted); font-size: 1.1rem; }
.compact-hero { margin-bottom: 2rem; }
.eyebrow { margin-bottom: .55rem; color: var(--accent); font-size: .76rem; font-weight: 850; letter-spacing: .14em; text-transform: uppercase; }

.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.section-heading .eyebrow { margin-bottom: .2rem; }
.count-badge, .role-badge { border: 1px solid var(--line); border-radius: 999px; background: #0d1626; color: var(--accent-strong); font-weight: 800; }
.count-badge { min-width: 2.2rem; padding: .25rem .7rem; text-align: center; }
.role-badge { display: inline-block; margin-bottom: 1.5rem; padding: .25rem .65rem; font-size: .72rem; letter-spacing: .05em; text-transform: uppercase; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }
.range-card, .settings-card, .empty-state, .auth-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(21, 33, 54, .96), rgba(14, 23, 39, .98));
  box-shadow: 0 24px 70px rgba(0, 0, 0, .22);
}
.range-card { min-height: 265px; display: flex; flex-direction: column; justify-content: space-between; gap: 2rem; padding: 1.35rem; }
.range-card p, .settings-card p, .empty-state p { color: var(--muted); }
.primary-button, .disabled-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  border: 1px solid transparent;
  border-radius: 11px;
  padding: .7rem 1rem;
  font-weight: 850;
  text-decoration: none;
}
.primary-button { background: var(--accent); color: var(--accent-ink); cursor: pointer; }
.primary-button:hover { background: var(--accent-strong); }
.disabled-button { border-color: var(--line); color: #75839a; }
.empty-state { padding: 2rem; }

.settings-card { margin-bottom: 1rem; padding: 1.5rem; }
.muted-card { background: rgba(16, 24, 39, .72); }
.detail-list { margin: 1.2rem 0 0; }
.detail-list > div { display: grid; grid-template-columns: minmax(130px, .55fr) 1fr; gap: 1rem; padding: .9rem 0; border-top: 1px solid var(--line); }
.detail-list dt { color: var(--muted); }
.detail-list dd { margin: 0; overflow-wrap: anywhere; font-weight: 700; }

.centered-page { display: grid; place-items: center; padding: 1rem; }
.auth-card { width: min(490px, 100%); padding: clamp(1.5rem, 6vw, 2.5rem); }
.auth-card h1 { font-size: clamp(2rem, 8vw, 3rem); }
.brand-mark { width: 46px; height: 46px; display: grid; place-items: center; margin-bottom: 2rem; border-radius: 13px; background: var(--accent); color: var(--accent-ink); font-size: 1.3rem; font-weight: 900; }
.notice { display: grid; gap: .3rem; margin: 1.7rem 0; padding: 1rem; border: 1px solid var(--line); border-radius: 12px; background: rgba(7, 16, 31, .62); }
.notice span, .fine-print { color: var(--muted); }
.stack { display: grid; gap: .8rem; }
.stack label { color: var(--muted); font-size: .86rem; font-weight: 800; }
.stack input { width: 100%; min-height: 46px; border: 1px solid var(--line); border-radius: 11px; padding: .7rem .85rem; background: #091321; color: var(--text); font: inherit; }
.stack .primary-button { width: 100%; font: inherit; font-weight: 850; }
.compact-form { max-width: 440px; margin-top: 1.2rem; }
.full-width { width: 100%; font: inherit; }
.divider { display: flex; align-items: center; gap: .8rem; margin: 1.4rem 0; color: var(--muted); font-size: .78rem; text-transform: uppercase; }
.divider::before, .divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.status-line { min-height: 1.5rem; margin: .9rem 0 0; color: var(--muted); }
.error-text { color: #ffabb5; }
button:disabled { cursor: not-allowed; opacity: .55; }
.fine-print { margin: 1rem 0 0; font-size: .82rem; }

.admin-shell { max-width: 1320px; }
.flash { margin: 0 0 1rem; border: 1px solid var(--line); border-radius: 12px; padding: .85rem 1rem; font-weight: 700; }
.flash-success { border-color: rgba(142, 230, 189, .45); background: rgba(35, 109, 77, .2); color: var(--success); }
.flash-error { border-color: rgba(255, 154, 167, .45); background: rgba(125, 37, 52, .2); color: var(--danger); }
.admin-form-grid, .inline-admin-form { display: grid; gap: .9rem; }
.admin-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: end; }
.admin-form-grid label, .inline-admin-form label { display: grid; gap: .35rem; color: var(--muted); font-size: .82rem; font-weight: 800; }
.admin-form-grid input:not([type="checkbox"]), .admin-form-grid select,
.inline-admin-form input, .inline-admin-form select {
  width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: 10px;
  padding: .65rem .75rem; background: #091321; color: var(--text); font: inherit;
}
.checkbox-label { grid-template-columns: auto 1fr !important; align-items: center; align-self: center; }
.checkbox-label input { width: 1.1rem; height: 1.1rem; }
.admin-account-list { display: grid; gap: 1rem; }
.admin-section-heading { margin-top: 3rem; }
.admin-account-card { margin: 0; }
.admin-account-heading { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, .65fr); gap: 1.5rem; }
.badge-row { display: flex; flex-wrap: wrap; gap: .45rem; margin-bottom: .8rem; }
.badge-row .role-badge { margin: 0; }
.account-email { overflow-wrap: anywhere; font-weight: 750; }
.compact-detail-list { margin: 0; }
.compact-detail-list > div { display: grid; grid-template-columns: 100px 1fr; gap: .7rem; padding: .35rem 0; }
.compact-detail-list dt { color: var(--muted); }
.compact-detail-list dd { margin: 0; text-align: right; }
.admin-actions { display: flex; flex-wrap: wrap; gap: .65rem; margin: 1.4rem 0; padding: 1rem 0; border-block: 1px solid var(--line); }
.admin-actions form { margin: 0; }
.secondary-button, .danger-button {
  min-height: 42px; border: 1px solid var(--line); border-radius: 10px; padding: .62rem .85rem;
  background: #0d1727; color: var(--text); font: inherit; font-weight: 800; cursor: pointer;
}
.secondary-button:hover { border-color: var(--accent); }
.danger-button { border-color: rgba(255, 154, 167, .45); color: var(--danger); }
.danger-button:hover { background: rgba(125, 37, 52, .22); }
.small-button { min-height: 34px; padding: .35rem .65rem; font-size: .78rem; }
.membership-panel h4 { margin: 0 0 .75rem; }
.membership-list { display: grid; gap: .55rem; margin-bottom: 1rem; }
.membership-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; border: 1px solid var(--line); border-radius: 10px; padding: .7rem .8rem; background: rgba(7, 16, 31, .45); }
.membership-row span { display: block; color: var(--muted); font-size: .85rem; }
.inline-admin-form { grid-template-columns: 1fr 1fr 1fr auto; align-items: end; }
.audit-card { margin-top: 3rem; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .86rem; }
th, td { padding: .7rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); }
td { overflow-wrap: anywhere; }

@media (max-width: 560px) {
  .site-header { align-items: flex-start; }
  .site-header nav { gap: .8rem; }
  .detail-list > div { grid-template-columns: 1fr; gap: .2rem; }
}

@media (max-width: 900px) {
  .admin-account-heading, .admin-form-grid { grid-template-columns: 1fr; }
  .inline-admin-form { grid-template-columns: 1fr 1fr; }
  .compact-detail-list dd { text-align: left; }
}

@media (max-width: 560px) {
  .inline-admin-form { grid-template-columns: 1fr; }
  .membership-row { align-items: flex-start; flex-direction: column; }
}
