/* Seshat Link Dash: the owners' web app. Same palette as seshatlink.com (navy, gold
   arc, teal nodes); text pairs meet WCAG 2.2 AA; gold is never text on light. */
:root {
  color-scheme: light dark;
  --navy: #121c40; --gold: #ffc93c; --teal: #52d9cc;
  --canvas: #f5f6fa; --surface: #ffffff; --inset: #eceff5; --line: #dde2ec;
  --text: #0f1733; --muted: #4f5874; --accent: #00756a; --accent-soft: #dcf2ee;
  --btn: #121c40; --on-btn: #ffffff; --danger: #b42318; --warn-soft: #fff4d6; --warn: #7a5300;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --radius: 16px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --canvas: #070c1c; --surface: #111a3a; --inset: #1a2550; --line: #263364;
    --text: #f2f4fa; --muted: #a9b2cb; --accent: #52d9cc; --accent-soft: #0f3640;
    --btn: #ffc93c; --on-btn: #121c40; --danger: #ff8a80; --warn-soft: #3a2f0f; --warn: #ffd978;
  }
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--text); font: 400 16px/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
h1, h2, h3, p { margin: 0; }
a { color: var(--accent); text-underline-offset: 3px; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 8px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 12px; top: 12px; background: var(--surface); padding: 8px 12px; z-index: 9; }
.loading { padding: 40vh 0 0; text-align: center; color: var(--muted); }
.hidden { display: none !important; }

/* Sign-in pages */
.gate { min-height: 100vh; display: grid; place-items: center; padding: max(24px, env(safe-area-inset-top)) 16px 32px; }
.gate .card { width: min(420px, 100%); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; text-decoration: none; color: inherit; }
.brand img { width: 34px; height: 34px; border-radius: 9px; }
.brand small { display: block; font-weight: 600; font-size: 12px; color: var(--muted); letter-spacing: .02em; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.card > * + * { margin-top: 16px; }
.card h1 { font-size: 22px; line-height: 1.25; letter-spacing: -.01em; }
.card h2 { font-size: 17px; }
.lead { color: var(--muted); }
.bar { height: 4px; width: 48px; border-radius: 4px; background: var(--gold); }

label { display: grid; gap: 6px; font-weight: 600; font-size: 14px; }
input, select { width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--canvas); font-weight: 400; font-size: 16px; }
input:focus { border-color: var(--accent); }
.hint { font-weight: 400; color: var(--muted); font-size: 13px; }
.code-input { font: 600 24px/1 var(--mono); letter-spacing: .3em; text-align: center; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; cursor: pointer; text-decoration: none; color: var(--text); }
.btn.primary { background: var(--btn); color: var(--on-btn); border-color: transparent; }
.btn.danger { color: var(--danger); }
.btn.small { min-height: 36px; padding: 6px 14px; font-size: 14px; }
.btn.full { width: 100%; }
.btn:disabled { opacity: .55; cursor: default; }
.link { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-size: 14px; }
.error { color: var(--danger); font-size: 14px; min-height: 1em; }
.ok { color: var(--accent); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

/* App */
header.top { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--canvas) 88%, transparent);
  backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); padding: max(10px, env(safe-area-inset-top)) 0 10px; }
header.top .inner { max-width: 1100px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; gap: 12px; }
header.top .grow { flex: 1; }
header.top select { width: auto; min-height: 38px; padding: 6px 10px; font-weight: 600; }
nav.tabs { max-width: 1100px; margin: 0 auto; display: flex; gap: 4px; overflow-x: auto; padding: 10px 16px 0; }
nav.tabs button { border: 0; background: none; padding: 8px 14px; border-radius: 999px; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap; }
nav.tabs button[aria-current="page"] { background: var(--surface); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
main { max-width: 1100px; margin: 0 auto; padding: 16px 16px 48px; }
main > * + * { margin-top: 16px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stat b { display: block; font-size: 28px; line-height: 1.1; letter-spacing: -.02em; }
.stat span { color: var(--muted); font-size: 14px; }

.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.list .item { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.list .item:first-child { border-top: 0; }
.list .item .main { flex: 1 1 220px; min-width: 0; }
.list .item .main b { display: block; }
.list .item .sub { color: var(--muted); font-size: 14px; }
.list .empty { padding: 24px 16px; color: var(--muted); text-align: center; }
.mono { font-family: var(--mono); }

.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--inset); color: var(--muted); }
.pill.on { background: var(--accent-soft); color: var(--accent); }
.pill.gold { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }

.prices { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.price { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.price s { color: var(--muted); }
.price b { font-size: 26px; letter-spacing: -.02em; }
.price.best { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }

dialog { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text); padding: 0; width: min(460px, calc(100% - 32px)); }
dialog::backdrop { background: rgb(7 12 28 / .55); }
dialog form, dialog .body { padding: 22px; display: grid; gap: 14px; }
.key { font: 700 20px/1.3 var(--mono); letter-spacing: .02em; word-break: break-all; padding: 14px; border-radius: 12px;
  background: var(--inset); border: 1px solid var(--gold); text-align: center; }
.qr { width: 180px; height: 180px; margin: 0 auto; background: #fff; border-radius: 12px; padding: 8px; }

#toast { position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 20;
  background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 999px; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .2s; }
#toast.show { opacity: 1; }
@media (prefers-color-scheme: dark) { #toast { background: var(--gold); color: var(--navy); } }

/* The printable key card (Get key → Print) */
.print-card { display: none; }
@media print {
  body > *:not(.print-card) { display: none !important; }
  .print-card { display: block; width: 148mm; padding: 10mm; border: 1px solid #121c40; border-radius: 4mm; color: #121c40; background: #fff; font-family: var(--sans); }
  .print-card h1 { font-size: 16pt; }
  .print-card .key { font-size: 16pt; background: #fff; border: 1pt solid #121c40; }
}
.key.small { font-size: 13px; font-weight: 600; }
form { display: grid; gap: 14px; }
.error:empty { display: none; }
.brand span { white-space: nowrap; }
header.top .pill, header.top select { max-width: 52vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.price { display: grid; gap: 6px; align-content: start; }
.price .term { font-weight: 700; }
.price .amount { display: flex; align-items: baseline; gap: 8px; }
.price .per { color: var(--muted); font-size: 13px; }
.price .perks { margin: 4px 0 0; padding: 0; list-style: none; display: grid; gap: 4px; font-size: 14px; }
.price .perks li::before { content: "✓"; color: var(--accent); font-weight: 700; margin-right: 6px; }
input[readonly] { color: var(--muted); background: var(--inset); }
