
/* Dark-first: black · white · red. Light variant keeps the same roles. */
:root{
  --bg:#0A0A0B; --surface:#141416; --surface2:#1E1E22; --ink:#F5F5F6; --muted:#8B8B93; --line:#26262B; --line2:#333338;
  --accent:#E5232E; --on-accent:#FFFFFF; --warn:#F0A030;
  --accent-soft:color-mix(in srgb,var(--accent) 16%,var(--surface));
  --warn-soft:color-mix(in srgb,var(--warn) 16%,var(--surface));
  --ink-soft:color-mix(in srgb,var(--ink) 8%,var(--surface));
  --shadow:0 1px 0 rgba(255,255,255,.03) inset,0 8px 24px rgba(0,0,0,.35);
  --r:14px; --display:'Barlow Condensed',Impact,'Arial Narrow',sans-serif; --body:'Barlow','Helvetica Neue',Arial,sans-serif;
  color-scheme:dark;
}
@media (prefers-color-scheme:light){
  :root:not([data-theme="dark"]){
    --bg:#FFFFFF; --surface:#F6F6F7; --surface2:#ECECEE; --ink:#0A0A0B; --muted:#6E6E76; --line:#E3E3E7; --line2:#D2D2D8;
    --shadow:0 1px 2px rgba(0,0,0,.05),0 6px 18px rgba(0,0,0,.05); color-scheme:light;
  }
}
:root[data-theme="light"]{
  --bg:#FFFFFF; --surface:#F6F6F7; --surface2:#ECECEE; --ink:#0A0A0B; --muted:#6E6E76; --line:#E3E3E7; --line2:#D2D2D8;
  --shadow:0 1px 2px rgba(0,0,0,.05),0 6px 18px rgba(0,0,0,.05); color-scheme:light;
}
html{scroll-behavior:auto}
body{margin:0;-webkit-tap-highlight-color:transparent;background:var(--bg);color:var(--ink);font-family:var(--body);font-size:15px;line-height:1.4;-webkit-font-smoothing:antialiased}
*{box-sizing:border-box}
[hidden]{display:none!important}
button,input,textarea,select{font:inherit;color:inherit;touch-action:manipulation}
button{cursor:pointer;border:0;background:none;padding:0;color:inherit}
:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
h1,h2,h3{margin:0;font-family:var(--display);font-weight:700;line-height:1.05;text-wrap:balance;letter-spacing:.01em}
h1{font-size:32px;text-transform:uppercase} h2{font-size:24px} h3{font-size:19px}
.num{font-family:var(--display);font-variant-numeric:tabular-nums}
.muted{color:var(--muted)} .small{font-size:13px}
.eyebrow{font-size:11px;font-weight:600;letter-spacing:.12em;text-transform:uppercase;color:var(--muted)}
.red{color:var(--accent)}
a{color:var(--ink)}

#app{min-height:100vh;min-height:100dvh;display:flex;flex-direction:column;max-width:960px;margin:0 auto;background:var(--bg)}
header.top{position:sticky;top:env(safe-area-inset-top,0px);z-index:5;background:var(--bg);padding:12px 16px 10px;display:flex;align-items:center;gap:10px;border-bottom:1px solid var(--line)}
.brand{display:flex;align-items:center;gap:9px;font-family:var(--display);font-size:22px;font-weight:700;letter-spacing:.06em;text-transform:uppercase}
.brand .mark{width:8px;height:22px;background:var(--accent);border-radius:2px}
.seg{margin-left:auto;display:flex;background:var(--surface2);border-radius:999px;padding:3px}
.seg button{padding:6px 12px;border-radius:999px;font-size:13px;font-weight:600;color:var(--muted)}
.seg button.on{background:var(--ink);color:var(--bg)}
main{flex:1;padding:16px 16px 28px;display:flex;flex-direction:column;gap:14px}
nav.tabs{position:sticky;bottom:0;background:var(--bg);border-top:1px solid var(--line);display:flex;padding:6px 8px calc(6px + env(safe-area-inset-bottom,0px))}
nav.tabs button{flex:1;display:flex;flex-direction:column;align-items:center;gap:3px;padding:6px 1px;border-radius:10px;font-size:10.5px;font-weight:600;color:var(--muted);position:relative}
nav.tabs button svg{width:22px;height:22px;stroke:currentColor;fill:none;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
nav.tabs button.on{color:var(--ink)}
nav.tabs button.on::after{content:"";position:absolute;top:0;width:18px;height:2px;background:var(--accent);border-radius:2px}
nav.tabs .badge{position:absolute;top:4px;left:calc(50% + 8px);width:8px;height:8px;border-radius:50%;background:var(--accent)}

.card{background:var(--surface);border-radius:var(--r);border:1px solid var(--line);padding:14px}
.row{display:flex;align-items:center;gap:10px} .between{justify-content:space-between} .wrap{flex-wrap:wrap}
.stack{display:flex;flex-direction:column;gap:8px}
.grid3{display:grid;grid-template-columns:repeat(3,1fr);gap:10px}
.stat{background:var(--surface);border:1px solid var(--line);border-radius:12px;padding:10px 12px}
.stat .v{font-family:var(--display);font-size:30px;font-weight:700;line-height:1}
.stat .l{font-size:12px;color:var(--muted);margin-top:2px}
.chip{display:inline-flex;align-items:center;gap:5px;padding:3px 9px;border-radius:999px;font-size:12px;font-weight:600;background:var(--surface2);color:var(--muted);white-space:nowrap}
.chip.red{background:var(--accent-soft);color:var(--accent)} .chip.white{background:var(--ink);color:var(--bg)} .chip.warn{background:var(--warn-soft);color:var(--warn)}
.chip.line{background:transparent;border:1px solid var(--line2)}
.pulse{width:8px;height:8px;border-radius:50%;background:currentColor;animation:pulse 1.4s ease-in-out infinite}
@keyframes pulse{0%,100%{opacity:1;transform:scale(1)}50%{opacity:.35;transform:scale(.7)}}
.avatar{width:42px;height:42px;border-radius:12px;display:grid;place-items:center;font-family:var(--display);font-size:18px;font-weight:700;color:var(--bg);background:var(--ink);flex-shrink:0}
.avatar.red{background:var(--accent);color:#fff}
.list{display:flex;flex-direction:column;gap:8px}
.item{display:flex;align-items:center;gap:12px;background:var(--surface);border:1px solid var(--line);border-radius:var(--r);padding:12px 14px;text-align:left;width:100%}
.item .t{font-weight:600} .item .s{font-size:13px;color:var(--muted)}
.item .end{margin-left:auto;text-align:right;display:flex;flex-direction:column;align-items:flex-end;gap:4px;flex-shrink:0}
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;padding:10px 16px;border-radius:12px;font-weight:600;font-size:14px;background:var(--surface2);color:var(--ink);text-decoration:none}
.btn.primary{background:var(--accent);color:var(--on-accent)}
.btn.white{background:var(--ink);color:var(--bg)}
.btn.ghost{background:transparent;border:1px solid var(--line2)}
.btn.sm{padding:7px 12px;font-size:13px;border-radius:10px} .btn.block{width:100%}
.btn:disabled{opacity:.5;cursor:default}
.field{display:flex;flex-direction:column;gap:4px}
.field label{font-size:12px;font-weight:600;color:var(--muted)}
input.in,textarea.in,select.in{width:100%;padding:10px 12px;border-radius:10px;border:1px solid var(--line2);background:var(--bg);min-width:0}
textarea.in{resize:vertical;min-height:64px}
.link{color:var(--accent);font-weight:600}
.divider{height:1px;background:var(--line)}
.back{display:flex;align-items:center;gap:8px;color:var(--ink);font-weight:600;font-size:15px;padding:10px 12px 10px 6px;margin:-4px 0 -2px -6px;border-radius:12px;min-height:44px;width:fit-content;max-width:100%}
.back:active{background:var(--surface2)}
.back svg{width:22px;height:22px;stroke:var(--accent);fill:none;stroke-width:2.5;stroke-linecap:round;stroke-linejoin:round;flex-shrink:0}
.back span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.empty{padding:28px 16px;text-align:center;color:var(--muted);display:flex;flex-direction:column;gap:10px;align-items:center}
.alert{background:var(--accent-soft);border:1px solid var(--accent);border-radius:var(--r);padding:12px 14px;display:flex;gap:10px;align-items:center;flex-wrap:wrap}
.alert b{color:var(--accent)}
.toggle{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:10px 0;border-top:1px solid var(--line)}
.toggle:first-of-type{border-top:0}
.sw{width:44px;height:26px;border-radius:999px;background:var(--surface2);position:relative;flex-shrink:0;transition:background .15s}
.sw::after{content:"";position:absolute;top:3px;left:3px;width:20px;height:20px;border-radius:50%;background:var(--ink);transition:transform .15s}
.sw.on{background:var(--accent)} .sw.on::after{transform:translateX(18px);background:#fff}
.swatches{display:flex;gap:8px;flex-wrap:wrap;align-items:center}
.swatch{width:30px;height:30px;border-radius:50%;border:2px solid transparent}
.swatch.on{border-color:var(--ink)}
input[type=color]{width:30px;height:30px;border:0;padding:0;background:none;border-radius:50%;overflow:hidden}
.subseg{display:flex;gap:6px}
.subseg button{padding:7px 14px;border-radius:999px;font-weight:600;font-size:13px;border:1px solid var(--line2);color:var(--muted)}
.subseg button.on{background:var(--ink);color:var(--bg);border-color:var(--ink)}

.due{display:flex;align-items:center;gap:10px;padding:10px 0;border-top:1px solid var(--line)}
.due:first-of-type{border-top:0}
.toast{position:fixed;left:50%;bottom:calc(84px + env(safe-area-inset-bottom,0px));transform:translateX(-50%);background:var(--ink);color:var(--bg);padding:9px 14px;border-radius:999px;font-size:13px;font-weight:600;z-index:20;opacity:0;transition:opacity .2s;pointer-events:none;max-width:90%;text-align:center}
.toast.show{opacity:1}
.sheet-bg{position:fixed;inset:0;background:rgba(0,0,0,.6);z-index:10;display:flex;align-items:flex-end;justify-content:center}
.sheet{background:var(--surface);border-top:1px solid var(--line2);width:100%;max-width:960px;border-radius:18px 18px 0 0;padding:16px 16px calc(20px + env(safe-area-inset-bottom,0px));display:flex;flex-direction:column;gap:12px;max-height:88%;overflow-y:auto}
.snav{display:flex;gap:6px;overflow-x:auto;padding-bottom:2px;-webkit-overflow-scrolling:touch}
.snav a{white-space:nowrap;padding:7px 12px;border-radius:999px;border:1px solid var(--line2);color:var(--muted);text-decoration:none;font-weight:600;font-size:13px}
.snav a:hover{color:var(--ink)}
.snav a.on{background:var(--ink);color:var(--bg);border-color:var(--ink)}
.two{display:grid;grid-template-columns:1fr;gap:10px}
.presence{display:flex;align-items:center;gap:6px;font-size:12px;color:var(--muted)}
.presence .dot{width:7px;height:7px;border-radius:50%;background:var(--accent)} .presence .dot.off{background:var(--muted)}
.link{color:var(--accent);font-weight:600}
