:root {
  --navy: #0e1a45; --ink: #1c2541; --muted: #5a6582; --line: #e2e8f3; --line-strong: #c9d3e6;
  --blue: #2a5bd7; --blue-dark: #1f47b0; --blue-soft: #eaf1ff; --sky: #38bdf8;
  --gold: #c98d24; --gold-2: #e3a83b; --gold-soft: #fbf3e2; --bg: #f4f7fc; --card: #fff;
  color-scheme: light;
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(800px 400px at 100% 0%, rgba(56, 189, 248, .10), transparent 60%), var(--bg);
  color: var(--ink); line-height: 1.6; -webkit-font-smoothing: antialiased; }

/* Brand header */
.site-header { background: rgba(255, 255, 255, .9); border-bottom: 1px solid var(--line); padding: 14px max(20px, calc((100vw - 1320px) / 2)); }
.logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.logo-mark { width: 34px; height: 34px; flex: none; }
.wordmark { font-size: 21px; font-weight: 800; letter-spacing: -.035em; line-height: 1; }
.wm-editor { color: var(--navy); }
.wm-lm { background: linear-gradient(180deg, var(--gold-2), var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* Card */
main { width: min(100% - 32px, 620px); margin: 40px auto 56px; background: var(--card); border: 1px solid var(--line); border-radius: 20px;
  padding: 40px 44px; box-shadow: 0 18px 50px rgba(20, 38, 90, .08); }
main.wide { width: min(100% - 32px, 1320px); min-width: 0; }
h1 { font-size: clamp(26px, 4.5vw, 32px); line-height: 1.2; letter-spacing: -.025em; color: var(--navy); margin: 0 0 10px; }
h2 { margin: 36px 0 14px; font-size: 19px; color: var(--navy); letter-spacing: -.01em; overflow-wrap: anywhere; }
p { line-height: 1.65; color: var(--muted); margin: 0 0 20px; }
p.lead { font-size: 16.5px; margin-bottom: 28px; }
a:not(.button):not(.logo) { color: var(--blue); font-weight: 600; text-underline-offset: 3px; }
a:not(.button):not(.logo):hover { color: var(--blue-dark); }
strong { color: var(--ink); }

/* Buttons */
button, .button { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; font: inherit; font-weight: 700;
  border: 1.5px solid transparent; border-radius: 11px; padding: 0 24px; min-height: 46px; background: var(--navy); color: #fff; cursor: pointer;
  transition: background .15s ease, box-shadow .15s ease, transform .15s ease; }
button:hover, .button:hover { background: #1b2c6b; box-shadow: 0 8px 20px rgba(14, 26, 69, .18); }
button:focus-visible, .button:focus-visible, summary:focus-visible, a:focus-visible { outline: 3px solid var(--sky); outline-offset: 3px; }
.button[aria-disabled="true"] { opacity: .55; cursor: default; box-shadow: none; }
.secondary { background: #fff; border-color: var(--line-strong); color: var(--navy); font-size: 14.5px; min-height: 40px; padding: 0 16px; }
.secondary:hover { background: var(--bg); border-color: var(--navy); box-shadow: none; }
.danger { background: #b42318; }
.danger:hover { background: #912018; }

/* Account summary and plan */
.account-summary { margin-block-end: 24px; }
.account-summary p { margin-block-end: 6px; }
.account-plan { position: relative; background: linear-gradient(135deg, var(--gold-soft), #fff 70%); border: 1px solid #f0dcb2; border-radius: 16px; padding: 20px 22px; margin-block: 8px 20px; }
.account-plan h2 { margin: 0 0 6px; font-size: 20px; }
.account-plan p { margin: 0 0 4px; color: var(--ink); }
.account-plan p:first-of-type { display: inline-block; font-size: 13px; font-weight: 700; color: #1f7a45; background: #e5f6ec; padding: 2px 10px; border-radius: 999px; margin-bottom: 8px; }

/* Balances */
.balances { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 20px 0 8px; }
.balances > div { background: var(--bg); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.balances > div:first-child { background: linear-gradient(160deg, var(--navy), #1d3480); border-color: transparent; }
.balances > div:first-child dt { color: #c4cff0; }
.balances > div:first-child dd { color: #fff; }
.balances dt { font-size: 13px; font-weight: 600; color: var(--muted); }
.balances dd { margin: 6px 0 0; font-size: 24px; font-weight: 800; color: var(--navy); text-align: start; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.dashboard-counters dd { font-size: 22px; }
.small { font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }

/* Lists */
.history { padding: 0; margin: 0 0 20px; list-style: none; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.history:empty { display: none; }
.history li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 14px; padding: 14px 18px; border-block-end: 1px solid var(--line); }
.history li:last-child { border-block-end: 0; }
.history li:nth-child(even) { background: #fafbfe; }
.history span { overflow-wrap: anywhere; }
.history time { grid-column: 1 / -1; font-size: 12.5px; color: var(--muted); }
.usage-history .usage-basis, .usage-history details { grid-column: 1 / -1; font-size: 14px; color: var(--muted); }
.usage-history strong { text-align: end; overflow-wrap: anywhere; color: var(--navy); }
.usage-history summary { cursor: pointer; padding-block: 6px; color: var(--blue); font-weight: 600; }
.usage-history details p { margin-block: 8px; }

/* Bottom navigation */
nav { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 22px; margin-block-start: 32px; padding-block-start: 22px; border-block-start: 1px solid var(--line); }
nav form { margin-inline-start: auto; }
.admin-nav { margin-block: 0 24px; padding-block-start: 0; border: 0; }

/* Forms */
label { display: block; margin-block: 16px 6px; font-size: 14px; font-weight: 650; color: var(--ink); }
input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]), select, textarea { width: 100%; font: inherit; padding: 11px 13px; border: 1px solid var(--line-strong);
  border-radius: 10px; background: #fff; color: var(--ink); margin-block-end: 14px; transition: border-color .15s ease, box-shadow .15s ease; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px var(--blue-soft); }
.check { display: flex; align-items: flex-start; gap: 10px; line-height: 1.5; margin-block-end: 20px; }
.check input { margin-block-start: 5px; accent-color: var(--navy); }
form + p { margin-block-start: 24px; }
fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; margin: 8px 0 16px; }
legend { font-weight: 700; color: var(--navy); padding-inline: 6px; }
fieldset label { display: flex; align-items: center; gap: 8px; margin: 6px 0; font-weight: 500; }
details { border: 1px solid var(--line); border-radius: 14px; padding: 0 18px; margin-block: 12px; background: #fff; }
details[open] { box-shadow: 0 8px 24px rgba(20, 38, 90, .06); padding-block-end: 18px; }
details > summary { cursor: pointer; font-weight: 700; color: var(--navy); padding-block: 14px; }
.usage-history details { border: 0; padding: 0; margin: 0; background: transparent; box-shadow: none; }
.usage-history details > summary { padding-block: 6px; color: var(--blue); font-weight: 600; }
dl:not(.balances) dt { font-size: 13px; font-weight: 650; color: var(--muted); margin-block-start: 10px; }
dl:not(.balances) dd { margin: 2px 0 0; color: var(--ink); overflow-wrap: anywhere; }
.cf-turnstile { margin-block: 4px 20px; }
bdi { overflow-wrap: anywhere; }
option { background: #fff; color: var(--ink); }

/* Sign-in handoff */
.match-number { font-size: 40px; font-weight: 800; letter-spacing: .18em; color: var(--navy); text-align: center; background: var(--bg); border: 1px solid var(--line);
  border-radius: 14px; padding: 16px; margin-block-end: 28px; }
#handoff-status { margin-block: 24px 0; font-size: 14px; }

/* MFA */
.mfa-qr { display: block; width: min(100%, 240px); height: auto; margin-inline: auto; margin-block-end: 24px; background: #fff; padding: 12px; border: 1px solid var(--line); border-radius: 12px; }
.mfa-secret { display: block; overflow-wrap: anywhere; padding: 12px; background: var(--bg); border-radius: 10px; font-family: Consolas, monospace; }

/* Administrator dashboard */
.dashboard-counters { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-block: 8px; }
.dashboard-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0 16px; align-items: end; margin-block: 24px 8px; }
.dashboard-filters .check { margin-block: 16px 14px; }
.dashboard-filters .check label { margin: 0; }
.dashboard-filters button { margin-block-end: 14px; }
.table-wrap { overflow-x: auto; margin-block: 8px 24px; border: 1px solid var(--line); border-radius: 14px; }
table.users { border-collapse: collapse; width: 100%; font-size: 13.5px; }
table.users th, table.users td { padding: 10px 12px; text-align: start; vertical-align: top; border-block-end: 1px solid var(--line); white-space: nowrap; }
table.users th { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--bg); position: sticky; top: 0; }
table.users td:first-child { white-space: normal; min-width: 180px; overflow-wrap: anywhere; }
table.users td.num { text-align: end; font-variant-numeric: tabular-nums; }
table.users tbody tr:hover { background: #f7f9fd; }
.tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--blue-soft); color: var(--blue-dark); margin-inline-start: 4px; }
.tag.warn { background: #fdf0dc; color: #8a4b00; }

@media (max-width: 560px) {
  main { padding: 28px 22px; margin-block: 20px 32px; }
  button, .button { width: 100%; }
  nav form { margin-inline-start: 0; width: 100%; }
}
