:root {
  color-scheme: dark;
  --bg: #0d0d0c;
  --panel: #171715;
  --raise: #22221e;
  --line: #2e2e29;
  --text: #f2efe6;
  --muted: #a39f93;
  --faint: #6f6b62;
  --accent: #ff5a1f;
  --accent-soft: rgba(255, 90, 31, .14);
  --ok: #57c48a;
  --err: #ff7a6b;
  --display: "Archivo Black", "Arial Black", system-ui, sans-serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --row: 68px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); overflow-x: clip; }
body { font-family: var(--body); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--bg); }
button, input, select { font: inherit; color: inherit; }
a { color: var(--text); text-decoration-color: var(--accent); text-underline-offset: 3px; }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }

/* Brand mark (same radar as the favicon) */
.mark { display: inline-block; width: 22px; height: 22px; border-radius: 50%; border: 4px solid var(--accent); position: relative; flex: none; }
.mark::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--accent); }
.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--display); font-size: 18px; text-decoration: none; color: var(--text); }
.pulse { width: 44px; height: 44px; border-width: 6px; animation: pulse 1.2s ease-in-out infinite; }
.pulse::after { inset: 7px; }
@keyframes pulse { 50% { opacity: .4; transform: scale(.92); } }

/* Simple pages */
.view.center { min-height: 100dvh; display: grid; place-content: center; justify-items: center; gap: 12px; }
.view.narrow { max-width: 440px; margin: 0 auto; padding: calc(28px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 48px max(16px, env(safe-area-inset-left, 0px)); }
.narrow h1 { font-family: var(--display); font-weight: 400; font-size: 34px; line-height: 1.05; letter-spacing: -.01em; margin: 36px 0 10px; }
.lead { color: var(--muted); font-size: 16px; margin: 0 0 22px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.btn { height: 50px; border-radius: 14px; font-weight: 700; font-size: 15px; cursor: pointer; border: 1px solid var(--line); background: var(--panel); padding: 0 16px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn:disabled { opacity: .5; cursor: default; }
.btn:focus-visible, .link:focus-visible, .chip:focus-visible, .iconbtn:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.btn.google { width: 100%; display: flex; align-items: center; justify-content: center; gap: 12px; background: var(--text); color: #1b1b19; border-color: var(--text); }
.btn.google svg { width: 20px; height: 20px; }
.link { border: 0; background: none; padding: 0; color: var(--text); text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; cursor: pointer; font-size: inherit; }
.or { display: flex; align-items: center; gap: 12px; margin: 22px 0; color: var(--faint); font-size: 13px; }
.or::before, .or::after { content: ""; height: 1px; background: var(--line); flex: 1; }
form { display: grid; gap: 10px; }
label { font-size: 13.5px; font-weight: 600; color: var(--muted); }
input[type=email] { height: 50px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel); padding: 0 14px; font-size: 16px; }
input[type=email]:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.error { color: var(--err); font-size: 14px; margin: 4px 0 0; }

/* Upload */
.drop { margin-top: 18px; display: grid; justify-items: center; gap: 6px; padding: 34px 16px; border: 2px dashed var(--line); border-radius: 18px; background: var(--panel); cursor: pointer; text-align: center; color: var(--text); font-weight: 400; transition: border-color .15s, background .15s; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop strong { font-size: 16px; }
.drop-icon { width: 44px; height: 44px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.review { margin-top: 22px; padding: 20px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); display: grid; gap: 14px; }
.review h2 { margin: 0; font-size: 19px; }
.facts { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; color: var(--muted); }
.facts strong { color: var(--text); font-variant-numeric: tabular-nums; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; color: var(--text); font-size: 14.5px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); margin: 1px 0 0; flex: none; }
.review .link { justify-self: center; font-size: 14px; color: var(--muted); }

/* My records (from the approved prototype) */
.app { max-width: 560px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 0 120px; }
header { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: var(--bg); padding-block: 14px 10px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.titlebar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.app h1 { font-family: var(--display); font-weight: 400; font-size: 26px; letter-spacing: -.01em; margin: 0; }
.sub { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; margin-top: -6px; }
.menu { position: relative; }
.iconbtn { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); display: grid; place-items: center; cursor: pointer; }
.iconbtn svg { width: 20px; height: 20px; fill: var(--text); }
.menu-list { position: absolute; right: 0; top: 46px; z-index: 40; min-width: 210px; background: var(--raise); border: 1px solid var(--line); border-radius: 14px; padding: 6px; box-shadow: 0 14px 40px rgba(0,0,0,.5); display: grid; }
.menu-list button { border: 0; background: none; text-align: left; padding: 12px; border-radius: 10px; cursor: pointer; font-weight: 500; }
.menu-list button:hover, .menu-list button:focus-visible { background: var(--panel); outline: none; }
.meter { display: grid; gap: 6px; }
.meter-top { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }
.meter-top strong { color: var(--text); font-variant-numeric: tabular-nums; }
.bar { height: 6px; background: var(--raise); border-radius: 6px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--accent); border-radius: 6px; transition: width .2s ease; }
.search { position: relative; }
.search input { width: 100%; height: 46px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); padding: 0 40px 0 42px; font-size: 16px; }
.search input::placeholder { color: var(--faint); }
.search input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; stroke: var(--faint); }
.clear { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border: 0; border-radius: 50%; background: none; color: var(--muted); cursor: pointer; font-size: 18px; }
.tools { display: flex; gap: 8px; align-items: center; }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; height: 34px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap; }
.chip[aria-pressed="true"] { border-color: var(--text); color: var(--text); background: var(--raise); }
.chip .n { color: var(--accent); margin-left: 4px; }
.sort { flex: none; height: 34px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); padding: 0 10px; font-size: 13px; font-weight: 600; color: var(--muted); }
.bulk { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.bulk button { border: 0; background: none; color: var(--accent); font-weight: 600; font-size: 13px; cursor: pointer; padding: 4px 0; }
.hint { margin-top: 4px; padding: 14px 16px; border-radius: 14px; background: var(--accent-soft); color: var(--text); font-size: 14px; line-height: 1.45; }
.hint strong { display: block; margin-bottom: 2px; }

.list { list-style: none; margin: 6px 0 0; padding: 0; }
.row { content-visibility: auto; contain-intrinsic-size: auto var(--row); }
.row button { width: 100%; min-height: var(--row); display: grid; grid-template-columns: 44px minmax(0, 1fr) 30px; gap: 12px; align-items: center; border: 0; border-bottom: 1px solid var(--line); background: none; padding: 10px 0; text-align: left; cursor: pointer; transition: opacity .15s; }
.row button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 8px; }
.tile { width: 44px; height: 44px; border-radius: 8px; display: grid; place-items: center; font-family: var(--mono); font-size: 13px; font-weight: 500; color: rgba(255,255,255,.92); }
.meta { min-width: 0; }
.t1 { display: block; font-weight: 600; font-size: 15px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t1 .ttl { color: var(--muted); font-weight: 500; }
.t2 { display: block; margin-top: 3px; font-size: 12.5px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag { display: inline-block; font-family: var(--mono); font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--bg); background: var(--accent); border-radius: 4px; padding: 1px 5px; margin-right: 6px; vertical-align: 1px; }
.tag.off { background: var(--raise); color: var(--muted); }
.tick { width: 28px; height: 28px; border-radius: 50%; border: 2px solid #4a4a43; display: grid; place-items: center; transition: background .15s, border-color .15s; }
.tick svg { width: 14px; height: 14px; stroke: var(--bg); stroke-width: 3.2; opacity: 0; transition: opacity .1s; }
.row button[aria-checked="true"] .tick { background: var(--accent); border-color: var(--accent); }
.row button[aria-checked="true"] .tick svg { opacity: 1; }
.full .row button[aria-checked="false"] { opacity: .38; }
.empty { padding: 40px 0; text-align: center; color: var(--muted); }
.letter { padding: 14px 0 4px; font-family: var(--mono); font-size: 12px; letter-spacing: .1em; color: var(--accent); border-bottom: 1px solid var(--line); }

.az { position: fixed; right: max(2px, env(safe-area-inset-right, 0px)); top: 50%; transform: translateY(-40%); z-index: 15; display: flex; flex-direction: column; align-items: center; padding: 6px 2px; border-radius: 12px; touch-action: none; user-select: none; }
.az span { font-family: var(--mono); font-size: 10.5px; line-height: 16px; width: 18px; text-align: center; color: var(--muted); cursor: pointer; }
.az span.on { color: var(--accent); font-weight: 700; }
@media (min-width: 640px) { .az { right: calc(50% - 300px); } }

.actions { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px); border-top: 1px solid var(--line); padding: 12px max(16px, env(safe-area-inset-right, 0px)) calc(12px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
.actions-in { max-width: 528px; margin: 0 auto; display: flex; gap: 10px; }
.actions .btn.primary { flex: 1; }
.btn[aria-pressed="true"] { border-color: var(--text); background: var(--raise); }

.toast { position: fixed; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 20px); width: min(520px, calc(100% - 32px)); background: var(--text); color: var(--bg); border-radius: 14px; padding: 14px 16px; font-size: 14px; line-height: 1.4; box-shadow: 0 14px 40px rgba(0,0,0,.5); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 50; }
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
.actions .btn.primary:disabled { background: var(--panel); border-color: var(--line); color: var(--muted); opacity: 1; }
.loaderr { max-width: 360px; padding: 0 16px; display: grid; gap: 14px; justify-items: center; text-align: center; }
.loaderr .btn { width: 100%; }
