:root {
  --bg: #121110;
  --surface: #1C1B19;
  --line: #242220;
  --border: #2E2C29;
  --border-strong: #3A3834;
  --text: #EDEBE6;
  --sub: #BDBAB3;
  --muted: #A19E97;
  --radius: 3px;
  --sans: 'Geist', system-ui, -apple-system, sans-serif;
  --mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--sans); -webkit-font-smoothing: antialiased; }
body { min-height: 100vh; min-height: 100dvh; }
a { color: var(--text); }
a:hover { color: #fff; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .5; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- Layout ---------- */
.shell { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.topbar { height: 64px; padding: 0 20px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 17px; text-decoration: none; }
.logo span { letter-spacing: -0.04em; }
.topnav { display: flex; gap: 24px; align-items: center; font-family: var(--mono); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; }
.topnav a { text-decoration: none; color: var(--sub); padding: 8px 0; position: relative; }
.topnav a[aria-current="page"] { color: var(--text); }
.topnav a[aria-current="page"]::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: var(--text); }
.count { font-family: var(--mono); font-size: 11px; background: var(--text); color: var(--bg); border-radius: var(--radius); padding: 1px 5px; margin-left: 6px; }
.main { flex: 1; width: 100%; max-width: 560px; margin: 0 auto; padding: 32px 20px 120px; display: flex; flex-direction: column; gap: 18px; }
.bottomnav { display: none; }
@media (max-width: 640px) {
  .topnav { display: none; }
  .topbar { border-bottom: 0; }
  .main { padding-top: 8px; }
  .bottomnav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); position: fixed; left: 0; right: 0; bottom: 0; background: var(--bg); border-top: 1px solid var(--line); padding: 10px 0 calc(14px + env(safe-area-inset-bottom)); z-index: 5; }
  .bottomnav a { text-decoration: none; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11px; min-height: 44px; position: relative; }
  .bottomnav a[aria-current="page"] { color: var(--text); }
  .bottomnav .dot { position: absolute; top: 0; left: calc(50% + 8px); width: 8px; height: 8px; border-radius: 50%; background: var(--text); }
}

/* ---------- Type ---------- */
h1 { margin: 0; font-size: 32px; font-weight: 500; letter-spacing: -0.04em; line-height: 1.1; }
.eyebrow { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.lede { margin: 0; font-size: 16px; line-height: 1.5; color: var(--muted); }
.small { font-size: 13px; color: var(--muted); line-height: 1.5; }
.mono { font-family: var(--mono); }

/* ---------- Controls ---------- */
.btn { height: 50px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 500; font-size: 15px; padding: 0 18px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; }
.btn:hover:not(:disabled) { border-color: var(--border-strong); }
.btn-primary { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn-primary:hover:not(:disabled) { background: #fff; border-color: #fff; }
.btn-big { height: 56px; font-size: 17px; }
.btn-sm { height: 36px; font-size: 13px; padding: 0 14px; background: transparent; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover:not(:disabled) { color: var(--text); border-color: transparent; }
.btn-block { width: 100%; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field label { font-size: 13px; color: var(--muted); }
.input { height: 52px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); padding: 0 16px; font-size: 16px; width: 100%; }
.input:focus { outline: none; border-color: var(--text); }
.input.code { font-family: var(--mono); font-size: 24px; letter-spacing: .4em; text-align: center; }
.error { font-size: 14px; color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 10px 12px; background: var(--surface); }
.row { display: flex; gap: 12px; align-items: center; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chip { border: 1px solid var(--border); border-radius: var(--radius); padding: 7px 12px; font-size: 13px; }
.chip.no { color: var(--muted); text-decoration: line-through; }
.filters { display: flex; gap: 8px; }
.filters button { border: 1px solid var(--border); background: transparent; padding: 8px 14px; border-radius: var(--radius); font-size: 13px; font-weight: 500; }
.filters button[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }

/* ---------- Onboarding ---------- */
.onboard { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.onboard .main { justify-content: center; padding-bottom: 64px; gap: 22px; max-width: 440px; }
.onboard h1 { font-size: 44px; letter-spacing: -0.05em; }
.steps { display: flex; gap: 6px; }
.steps i { height: 2px; flex: 1; background: var(--border); }
.steps i.on { background: var(--text); }
.points { display: flex; flex-direction: column; gap: 12px; border-top: 1px solid var(--line); padding-top: 20px; font-size: 15px; }
.points div { display: flex; gap: 14px; }
.points span { font-family: var(--mono); color: var(--muted); width: 22px; flex-shrink: 0; }
.passcard { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 18px; display: flex; flex-direction: column; gap: 6px; }
.passcard .who { font-size: 20px; font-weight: 500; letter-spacing: -0.02em; }

/* ---------- Lists ---------- */
.list { display: flex; flex-direction: column; }
.item { display: flex; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); align-items: center; text-decoration: none; color: var(--text); }
.item:last-child { border-bottom: 0; }
a.item:hover .title { text-decoration: underline; text-underline-offset: 3px; }
.item .body { flex: 1; min-width: 0; }
.item .title { font-size: 15px; }
.item .sub { font-size: 13px; color: var(--muted); }
.item .time { font-family: var(--mono); font-size: 12px; color: var(--muted); flex-shrink: 0; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--text); color: var(--bg); display: grid; place-items: center; font-size: 13px; font-weight: 600; flex-shrink: 0; }
.avatar.dim { background: var(--border); color: var(--text); }
.avatar.ring { background: transparent; border: 1px solid var(--text); color: var(--text); }
.avatar.unknown { background: transparent; border: 1px dashed var(--border-strong); color: var(--muted); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.card-head { display: flex; gap: 14px; align-items: center; }
.site-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.site-row .sub { font-size: 13px; color: var(--muted); }
.empty { border: 1px dashed var(--border-strong); border-radius: var(--radius); padding: 32px 20px; text-align: center; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.empty .title { font-size: 17px; font-weight: 500; }

/* ---------- Approval ---------- */
.approve { display: flex; flex-direction: column; align-items: center; gap: 26px; flex: 1; }
.approve-head { align-self: stretch; display: flex; justify-content: space-between; align-items: center; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.approve-head a { color: var(--muted); text-decoration: none; }
.approve-head a:hover { color: var(--text); }
.presence { position: relative; width: 220px; height: 220px; display: grid; place-items: center; }
.presence i { position: absolute; border-radius: 50%; border: 1px solid rgba(255,255,255,.08); }
.presence i:nth-child(1) { inset: 0; }
.presence i:nth-child(2) { inset: 26px; border-color: rgba(255,255,255,.14); }
.presence i:nth-child(3) { inset: 52px; border-color: rgba(255,255,255,.5); animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.06); opacity: .5; } }
@media (prefers-reduced-motion: reduce) { .presence i:nth-child(3) { animation: none; } }
.presence .big { width: 96px; height: 96px; border-radius: 50%; background: var(--text); color: var(--bg); display: grid; place-items: center; font-size: 32px; font-weight: 600; letter-spacing: -0.03em; }
.presence .me { position: absolute; right: 28px; bottom: 30px; width: 38px; height: 38px; border-radius: 50%; background: var(--surface); border: 2px solid var(--bg); display: grid; place-items: center; font-size: 14px; font-weight: 600; }
.approve h1 { font-size: 28px; letter-spacing: -0.03em; line-height: 1.15; text-align: center; }
.approve .meta { text-align: center; display: flex; flex-direction: column; gap: 10px; }
.quote { border-left: 0; border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; font-size: 14px; color: var(--sub); text-align: center; max-width: 100%; }
.actions { align-self: stretch; display: flex; flex-direction: column; gap: 12px; margin-top: auto; }
.done { text-align: center; display: flex; flex-direction: column; gap: 10px; align-items: center; }

/* ---------- Toast ---------- */
#toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 96px; background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: var(--radius); font-size: 14px; font-weight: 500; z-index: 10; max-width: calc(100% - 32px); }
@media (min-width: 641px) { #toast { bottom: 32px; } }

/* ---------- Phone overrides (kept last so they win) ---------- */
@media (max-width: 640px) {
  .main.focused { padding-bottom: calc(24px + env(safe-area-inset-bottom)); min-height: calc(100dvh - 64px); }
  .approve { gap: 20px; }
  .presence { width: 180px; height: 180px; }
  .presence .big { width: 80px; height: 80px; font-size: 27px; }
  .presence .me { right: 20px; bottom: 22px; }
  #toast { top: 16px; bottom: auto; }
}
