/* One-screen phone app: title pinned top, list scrolls, tab bar pinned bottom.
   Dark by default; html.light switches the tokens. */
@font-face { font-family: "Archivo"; font-weight: 400; font-display: swap; src: url("/fonts/archivo-400.woff2") format("woff2"); }
@font-face { font-family: "Archivo"; font-weight: 500; font-display: swap; src: url("/fonts/archivo-500.woff2") format("woff2"); }
@font-face { font-family: "Archivo"; font-weight: 600; font-display: swap; src: url("/fonts/archivo-600.woff2") format("woff2"); }
@font-face { font-family: "Archivo"; font-weight: 800; font-display: swap; src: url("/fonts/archivo-800.woff2") format("woff2"); }

:root {
  --bg: #0c0a0a;
  --surface: #161212;
  --line: #2a2323;
  --fg: #f3efee;
  --muted: #8c8281;
  --red: #e3262e;
  --on-red: #ffffff;
  --font: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}
html.light {
  --bg: #f6f4f3;
  --surface: #ffffff;
  --line: #e0d9d8;
  --fg: #121010;
  --muted: #6c6362;
  --red: #d61f27;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--fg); font-family: var(--font); font-size: 15px; -webkit-tap-highlight-color: transparent; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
[hidden] { display: none !important; }

.app { height: 100%; max-width: 480px; margin: 0 auto; display: flex; flex-direction: column; position: relative; overflow: hidden; }
@media (min-width: 481px) { .app { border-inline: 1px solid var(--line); } }
.gut { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }

header { padding-top: calc(14px + env(safe-area-inset-top, 0px)); padding-bottom: 12px; display: flex; flex-direction: column; gap: 10px; border-bottom: 1px solid var(--line); }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wordmark { margin: 0; font-weight: 800; font-size: 20px; letter-spacing: -0.02em; text-transform: uppercase; white-space: nowrap; }
.wordmark .l { color: var(--red); }
.wordmark .z { color: var(--bg); background: var(--fg); padding: 1px 6px 0; }
html.light .wordmark .z { color: var(--fg); background: none; padding: 0; }
.opts-btn { height: 44px; padding: 0 14px 0 12px; display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; border: 1px solid var(--line); color: var(--muted); position: relative; }
.opts-btn:hover { color: var(--fg); }
.opts-btn svg { width: 18px; height: 18px; }
.opts-btn .dot { position: absolute; top: -4px; right: -4px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); }
.about { margin: 0; font-size: 12px; line-height: 1.5; color: var(--muted); max-width: 60ch; }
.about a { color: var(--fg); text-underline-offset: 2px; }

main { flex: 1; overflow-y: auto; overscroll-behavior: contain; }
.meta { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; color: var(--muted); padding-block: 10px 6px; gap: 12px; }
.meta b { color: var(--fg); font-weight: 600; font-variant-numeric: tabular-nums; }
.meta .act { color: var(--fg); text-align: right; }
.bar { height: 2px; background: var(--line); }
.bar i { display: block; height: 100%; background: var(--red); transition: width .25s; }

.search { position: relative; margin-top: 10px; }
.search svg { position: absolute; left: 12px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input { width: 100%; height: 44px; padding: 0 12px 0 38px; color: var(--fg); background: var(--surface); border: 1px solid var(--line); border-radius: 0; font-size: 16px; -webkit-appearance: none; appearance: none; }
.search input:focus { border-color: var(--fg); outline: none; }
.search input::placeholder { color: var(--muted); }
.list { list-style: none; margin: 0; padding: 0; }
.row { display: flex; align-items: center; gap: 12px; padding-block: 12px; border-bottom: 1px solid var(--line); }
.row.done .name { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--red); }
.av { width: 34px; height: 34px; flex: none; display: grid; place-items: center; font-size: 12px; font-weight: 600; background: var(--surface); border: 1px solid var(--line); color: var(--muted); }
.av.person { border-radius: 50%; }
.who { flex: 1; min-width: 0; }
.name { font-weight: 600; overflow-wrap: anywhere; }
.kind { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin-top: 2px; }
.pf { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; max-width: 60%; }
.p { width: 42px; height: 42px; border: 1px solid var(--line); color: var(--fg); display: grid; place-items: center; position: relative; flex: none; text-decoration: none; }
.p svg { width: 20px; height: 20px; fill: currentColor; }
.p:hover { border-color: var(--fg); }
.p .badge { position: absolute; top: -6px; right: -6px; width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; font-size: 10px; font-weight: 800; line-height: 1; }
.p.blocked { background: var(--red); border-color: var(--red); color: var(--on-red); }
.p.blocked .badge { background: var(--fg); color: var(--red); }
.p.have { color: var(--muted); cursor: default; }
.p.have:hover { border-color: var(--line); }
.p.miss { border-style: dashed; color: var(--muted); opacity: .7; }
.p.miss .badge { background: var(--bg); border: 1px dashed var(--muted); color: var(--fg); font-size: 11px; }
.p.miss:hover { opacity: 1; color: var(--fg); border-color: var(--fg); }
.srow { display: flex; flex-direction: column; gap: 10px; padding-block: 12px; border-bottom: 1px solid var(--line); }
.srow .head { display: flex; align-items: center; gap: 12px; }
.srow .pf { max-width: none; display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.srow .p { width: auto; }

.empty { padding: 48px 0; text-align: center; color: var(--muted); font-size: 14px; line-height: 1.5; }
.empty strong { display: block; color: var(--fg); font-size: 16px; margin-bottom: 4px; }
.add { margin-block: 12px 4px; width: 100%; min-height: 48px; background: var(--red); color: var(--on-red); font-weight: 600; letter-spacing: .02em; }
.hint { font-size: 12px; color: var(--muted); padding-block: 8px 16px; line-height: 1.5; margin: 0; }

nav { display: flex; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); background: var(--bg); }
nav button { flex: 1; min-height: 60px; font-size: 14px; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); position: relative; }
nav button[aria-selected="true"] { color: var(--fg); }
nav button[aria-selected="true"]::before { content: ""; position: absolute; top: -1px; left: 30%; right: 30%; height: 2px; background: var(--red); }

.seg { display: flex; border: 1px solid var(--line); }
.seg button { flex: 1; min-height: 46px; font-size: 14px; font-weight: 500; color: var(--muted); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--fg); color: var(--bg); }

.scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, .55); display: flex; align-items: flex-end; z-index: 10; }
.sheet { width: 100%; background: var(--surface); border-top: 2px solid var(--red); padding-top: 18px; padding-bottom: max(18px, env(safe-area-inset-bottom, 0px)); max-height: 90%; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.sheet h2 { margin: 0; font-size: 18px; font-weight: 800; letter-spacing: -0.01em; text-wrap: balance; }
.sheet p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.sec { display: flex; flex-direction: column; gap: 8px; }
.sec h3 { margin: 0; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.opt { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 0 12px; border: 1px solid var(--line); font-size: 14px; text-align: left; }
.opt .box { width: 16px; height: 16px; border: 1px solid var(--muted); flex: none; display: grid; place-items: center; font-size: 11px; }
.opt[aria-checked="true"] { border-color: var(--fg); }
.opt[aria-checked="true"] .box { background: var(--red); border-color: var(--red); color: var(--on-red); }
label.f { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
input[type=text] { width: 100%; color: var(--fg); background: var(--bg); border: 1px solid var(--line); padding: 11px 12px; font-size: 16px; text-transform: none; letter-spacing: 0; border-radius: 0; }
input[type=text]:focus { border-color: var(--fg); outline: none; }
input.bad { border-color: var(--red); }
.hrows { display: flex; flex-direction: column; gap: 6px; }
.hrow { display: grid; grid-template-columns: 32px 1fr; align-items: center; gap: 8px; }
.hrow span { color: var(--muted); display: grid; place-items: center; }
.hrow svg { width: 20px; height: 20px; fill: currentColor; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.ts { min-height: 65px; display: flex; align-items: center; }
.ts-wait { font-size: 13px; color: var(--muted); }
.note { margin: -6px 0 0; font-size: 13px; line-height: 1.5; color: var(--fg); border-left: 2px solid var(--red); padding-left: 10px; }
.sheet:focus { outline: none; }
.err, .sheet .err { color: var(--red); font-size: 13px; margin: 0; }
.actions { display: flex; gap: 8px; }
.actions button { flex: 1; min-height: 48px; font-weight: 600; border: 1px solid var(--line); }
.actions .primary { background: var(--red); border-color: var(--red); color: var(--on-red); }
.actions .primary:disabled { opacity: .4; cursor: not-allowed; }

@keyframes fade-in { from { opacity: 0; } }
@keyframes sheet-up { from { transform: translateY(100%); } }
.scrim { animation: fade-in .2s ease-out; }
.scrim .sheet { animation: sheet-up .24s cubic-bezier(.2, .8, .2, 1); }
.scrim.out { pointer-events: none; animation: fade-in .18s ease-in reverse forwards; }
.scrim.out .sheet { animation: sheet-up .18s ease-in reverse forwards; }
.toast { position: absolute; left: 16px; right: 16px; bottom: calc(72px + env(safe-area-inset-bottom, 0px)); background: var(--fg); color: var(--bg); padding: 12px 14px; font-size: 14px; font-weight: 500; z-index: 20; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
