/* Ported verbatim from mockups/evidence-binder/evidence-binder.html (v24). */
/* base.css: tokens, shell and shared components. index.html loads every page stylesheet too. */

:root{
  --bg:#EEF1F4; --surface:#FFFFFF; --surface-2:#E6E9EE; --surface-3:#DBE0E6;
  --ink:#1B2430; --muted:#505967; --faint:#5F6876;
  --hair:rgba(27,36,48,.13); --hair-strong:rgba(27,36,48,.22);
  --accent:#2B5E68; --accent-ink:#FFFFFF; --accent-soft:rgba(43,94,104,.10); --accent-soft-strong:rgba(43,94,104,.18);
  --shadow:0 1px 2px rgba(20,30,40,.06); --shadow-lg:0 18px 44px rgba(20,30,40,.16);

  --good:#1C7D2C; --warning:#8C5807; --serious:#A2481A; --critical:#b3282f;
  --good-bg:rgba(28,125,44,.10); --warning-bg:rgba(140,88,7,.10); --serious-bg:rgba(162,72,26,.10); --critical-bg:rgba(179,40,47,.10);

  --signal:#3463B5; --email:#9C5419; --sms:#177A5A; --event:#6B4FA6;
  --signal-bg:rgba(52,99,181,.11); --email-bg:rgba(156,84,25,.11); --sms-bg:rgba(23,122,90,.11); --event-bg:rgba(107,79,166,.11);

  --whatsapp:#6B4FA6; --photo:#B3346E; --audio:#A8850F; --video:#0A87A8;
  --whatsapp-bg:color-mix(in srgb, var(--whatsapp) 11%, transparent);
  --photo-bg:color-mix(in srgb, var(--photo) 11%, transparent);
  --audio-bg:color-mix(in srgb, var(--audio) 11%, transparent);
  --video-bg:color-mix(in srgb, var(--video) 11%, transparent);

  /* Titles: Space Grotesk, but its quirky "y" and "g" are swapped for Schibsted Grotesk's plainer ones (that font is loaded with text=yg only). */
  --font-title:'Schibsted Grotesk', 'Space Grotesk', var(--font-body);
  --font-display:'Source Serif 4', Georgia, 'Times New Roman', serif;
  --font-body:'Public Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --radius-s:5px; --radius-m:8px; --radius-l:12px;
  --ease:cubic-bezier(.22,.61,.36,1);
  --rail-w:264px;
  /* Binder additions: native controls follow the theme; chevron for styled selects. */
  color-scheme:light;
  --select-chevron:url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 24 24%27 fill=%27none%27 stroke=%27%23505967%27 stroke-width=%272%27 stroke-linecap=%27round%27 stroke-linejoin=%27round%27%3E%3Cpath d=%27m7 10 5 5 5-5%27/%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    --bg:#10141A; --surface:#171C24; --surface-2:#1E242E; --surface-3:#262E3A;
    --ink:#E7EAEE; --muted:#9AA3AE; --faint:#868E9A;
    --hair:rgba(255,255,255,.10); --hair-strong:rgba(255,255,255,.18);
    --accent:#5AAEB8; --accent-ink:#0A1418; --accent-soft:rgba(90,174,184,.14); --accent-soft-strong:rgba(90,174,184,.24);
    --shadow:0 1px 2px rgba(0,0,0,.4); --shadow-lg:0 24px 60px rgba(0,0,0,.55);

    --good:#3fc23f; --warning:#e0a53d; --serious:#e2864f; --critical:#EA7077;
    --good-bg:rgba(63,194,63,.13); --warning-bg:rgba(224,165,61,.13); --serious-bg:rgba(226,134,79,.13); --critical-bg:rgba(234,112,119,.13);

    --signal:#6E9BE0; --email:#D98A55; --sms:#4DB592; --event:#A894E0;
    --signal-bg:rgba(110,155,224,.16); --email-bg:rgba(217,138,85,.16); --sms-bg:rgba(77,181,146,.16); --event-bg:rgba(168,148,224,.16);

    --whatsapp:#9B85D6; --photo:#D14E93; --audio:#B78A22; --video:#3B9DC2;
    --whatsapp-bg:color-mix(in srgb, var(--whatsapp) 16%, transparent);
    --photo-bg:color-mix(in srgb, var(--photo) 16%, transparent);
    --audio-bg:color-mix(in srgb, var(--audio) 16%, transparent);
    --video-bg:color-mix(in srgb, var(--video) 16%, transparent);
    color-scheme:dark;
    --select-chevron:url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 24 24%27 fill=%27none%27 stroke=%27%239AA3AE%27 stroke-width=%272%27 stroke-linecap=%27round%27 stroke-linejoin=%27round%27%3E%3Cpath d=%27m7 10 5 5 5-5%27/%3E%3C/svg%3E");
  }
}
:root[data-theme="dark"]{
  --bg:#10141A; --surface:#171C24; --surface-2:#1E242E; --surface-3:#262E3A;
  --ink:#E7EAEE; --muted:#9AA3AE; --faint:#868E9A;
  --hair:rgba(255,255,255,.10); --hair-strong:rgba(255,255,255,.18);
  --accent:#5AAEB8; --accent-ink:#0A1418; --accent-soft:rgba(90,174,184,.14); --accent-soft-strong:rgba(90,174,184,.24);
  --shadow:0 1px 2px rgba(0,0,0,.4); --shadow-lg:0 24px 60px rgba(0,0,0,.55);

  --good:#3fc23f; --warning:#e0a53d; --serious:#e2864f; --critical:#EA7077;
  --good-bg:rgba(63,194,63,.13); --warning-bg:rgba(224,165,61,.13); --serious-bg:rgba(226,134,79,.13); --critical-bg:rgba(234,112,119,.13);

  --signal:#6E9BE0; --email:#D98A55; --sms:#4DB592; --event:#A894E0;
  --signal-bg:rgba(110,155,224,.16); --email-bg:rgba(217,138,85,.16); --sms-bg:rgba(77,181,146,.16); --event-bg:rgba(168,148,224,.16);

  --whatsapp:#9B85D6; --photo:#D14E93; --audio:#B78A22; --video:#3B9DC2;
  --whatsapp-bg:color-mix(in srgb, var(--whatsapp) 16%, transparent);
  --photo-bg:color-mix(in srgb, var(--photo) 16%, transparent);
  --audio-bg:color-mix(in srgb, var(--audio) 16%, transparent);
  --video-bg:color-mix(in srgb, var(--video) 16%, transparent);
  color-scheme:dark;
  --select-chevron:url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 24 24%27 fill=%27none%27 stroke=%27%239AA3AE%27 stroke-width=%272%27 stroke-linecap=%27round%27 stroke-linejoin=%27round%27%3E%3Cpath d=%27m7 10 5 5 5-5%27/%3E%3C/svg%3E");
}

*{box-sizing:border-box}
html{scroll-behavior:auto}
body{margin:0; background:var(--bg); color:var(--ink); font-family:var(--font-body); line-height:1.5; -webkit-font-smoothing:antialiased}
h1,h2,h3{font-family:var(--font-display); text-wrap:balance; margin:0}
::selection{background:var(--accent-soft-strong)}
a{color:inherit}
button{font:inherit; color:inherit}
.mono{font-family:var(--font-mono)}
.tabular{font-variant-numeric:tabular-nums}

@media (prefers-reduced-motion: reduce){
  *{animation-duration:0.001ms !important; transition-duration:0.001ms !important}
}

/* ---------- shell ---------- */
.shell{display:flex; min-height:100vh}
.rail{width:var(--rail-w); flex:0 0 auto; background:var(--surface-2); border-right:1px solid var(--hair);
  display:flex; flex-direction:column; position:sticky; top:0; height:100vh; overflow-y:auto}
.brand{display:flex; align-items:center; gap:12px; padding:18px 18px 14px}
.brand-mark{width:40px; height:40px; border-radius:var(--radius-m); overflow:hidden; flex:0 0 auto}
.brand-mark svg{display:block; width:100%; height:100%}
.brand-word{font-family:var(--font-title); font-weight:600; font-size:20px; letter-spacing:-.02em; white-space:nowrap}

.case-card{position:relative; margin:2px 14px 16px; padding:14px 14px 15px; background:var(--surface); border:1px solid var(--hair);
  border-radius:var(--radius-m); box-shadow:var(--shadow)}
.case-card .matter{font-family:var(--font-title); font-weight:600; font-size:15.5px; letter-spacing:-.01em; line-height:1.3; margin-bottom:3px; padding-right:22px}
.case-card .sub{font-size:11.5px; color:var(--muted); margin-bottom:10px}
.case-card .sub input{font:inherit; font-size:11.5px; width:auto; min-width:200px; max-width:100%;
  background:var(--surface-2); border:1px solid var(--hair-strong); border-radius:4px; padding:1px 5px; color:var(--ink)}
.case-card .sub input:focus{outline:2px solid var(--accent); outline-offset:1px}
.case-meta{display:grid; grid-template-columns:auto 1fr; gap:4px 10px; font-size:11.5px}
.case-meta dt{color:var(--faint); font-weight:500}
.case-meta dd{margin:0; font-family:var(--font-mono); color:var(--ink); text-align:right}
.case-meta dd input{font:inherit; font-family:var(--font-mono); font-size:11.5px; width:100%; text-align:right;
  background:var(--surface-2); border:1px solid var(--hair-strong); border-radius:4px; padding:2px 5px; color:var(--ink)}
.case-meta dd input:focus{outline:2px solid var(--accent); outline-offset:1px}
.nh-past{display:inline-block; margin-left:6px; font-family:var(--font-body); font-style:italic; font-weight:600;
  font-size:9.5px; color:var(--critical); text-align:left}
.nh-past[hidden]{display:none}

.cc-edit{position:absolute; top:8px; right:8px; width:24px; height:24px; border:0; background:transparent; color:var(--faint);
  border-radius:6px; cursor:pointer; display:grid; place-items:center}
.cc-edit:hover, .cc-edit:focus-visible{background:var(--surface-2); color:var(--accent)}
.cc-edit svg{width:13px; height:13px}
.cc-edit.on{color:var(--accent); background:var(--accent-soft)}
.cc-edit .cc-edit-tip{position:absolute; top:50%; right:calc(100% + 8px); transform:translateY(-50%); white-space:nowrap;
  background:var(--ink); color:var(--bg); font-family:var(--font-body); font-size:11px; font-weight:600; padding:4px 8px;
  border-radius:6px; opacity:0; pointer-events:none; transition:opacity .12s var(--ease); z-index:5}
.cc-edit:hover .cc-edit-tip, .cc-edit:focus-visible .cc-edit-tip{opacity:1}

.nav{display:flex; flex-direction:column; gap:1px; padding:0 10px; flex:1}
.navitem{display:flex; align-items:center; gap:11px; padding:9px 10px; border-radius:var(--radius-s);
  background:transparent; border:0; text-align:left; cursor:pointer; color:var(--muted); font-size:13.5px; font-weight:500;
  transition:background .15s var(--ease), color .15s var(--ease)}
.navitem svg{width:17px; height:17px; flex:0 0 auto}
.navitem:hover{background:var(--surface-3); color:var(--ink)}
.navitem.on{background:var(--accent-soft); color:var(--accent); font-weight:600}
.navitem .count{margin-left:auto; font-family:var(--font-mono); font-size:11px; color:var(--faint)}
.navitem.on .count{color:var(--accent)}
.navitem:focus-visible{outline:2px solid var(--accent); outline-offset:-2px}

.rail-foot{padding:12px 14px 16px; border-top:1px solid var(--hair); margin-top:8px}
.theme-toggle{width:100%; display:flex; align-items:center; gap:9px; padding:8px 10px; border-radius:var(--radius-s);
  border:1px solid var(--hair); background:var(--surface); cursor:pointer; font-size:12.5px; color:var(--muted)}
.theme-toggle:hover{border-color:var(--hair-strong); color:var(--ink)}
.theme-toggle svg{width:15px; height:15px}
.theme-toggle:focus-visible{outline:2px solid var(--accent); outline-offset:1px}

/* ---------- main ---------- */
.main{flex:1; min-width:0; display:flex; flex-direction:column}
.topstrip{position:sticky; top:0; z-index:10; display:flex; align-items:baseline; gap:14px; flex-wrap:wrap;
  padding:16px 28px; background:color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter:blur(14px); -webkit-backdrop-filter:blur(14px); border-bottom:1px solid var(--hair)}
.topstrip h1{font-family:var(--font-title); font-weight:600; font-size:21px; letter-spacing:-.02em}
.topstrip .desc{font-size:12.5px; color:var(--muted); margin-left:2px}
.topstrip .strip-actions{margin-left:auto; display:flex; align-items:center; gap:8px}

.searchbox{display:inline-flex; align-items:center; gap:7px; background:var(--surface-2); border:1px solid var(--hair);
  border-radius:var(--radius-m); padding:0 10px; height:34px; min-width:200px}
.searchbox svg{width:14px; height:14px; color:var(--faint); flex:0 0 auto}
.searchbox input{border:0; background:transparent; font:inherit; font-size:13px; color:var(--ink); outline:none; width:100%}
.searchbox:focus-within{outline:2px solid var(--accent); outline-offset:1px}

.btn{display:inline-flex; align-items:center; gap:7px; height:34px; padding:0 13px; border-radius:var(--radius-m);
  border:1px solid var(--hair); background:var(--surface); cursor:pointer; font-size:12.5px; font-weight:600; color:var(--muted);
  transition:background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease)}
.btn:hover{color:var(--ink); border-color:var(--hair-strong)}
.btn.primary{background:var(--accent); color:var(--accent-ink); border-color:transparent}
.btn.primary:hover{filter:brightness(1.06); color:var(--accent-ink)}
.btn:focus-visible{outline:2px solid var(--accent); outline-offset:2px}
.btn:disabled{opacity:.45; cursor:default; filter:none}
.btn:disabled:hover{color:var(--muted); border-color:var(--hair)}
.btn.primary:disabled:hover{color:var(--accent-ink)}
.btn svg{width:14px; height:14px}

.page{padding:22px 28px 64px; max-width:1080px}
.page[hidden]{display:none}

/* ---------- stat tiles ---------- */
.stats{display:grid; grid-template-columns:repeat(auto-fit, minmax(150px,1fr)); gap:12px; margin-bottom:22px}
.stat{background:var(--surface); border:1px solid var(--hair); border-radius:var(--radius-m); padding:14px 16px; box-shadow:var(--shadow)}
.stat .n{font-family:var(--font-mono); font-size:26px; font-weight:500; line-height:1}
.stat .l{font-size:12px; color:var(--muted); margin-top:6px}
.stat.critical .n{color:var(--critical)}
.stat.warning .n{color:var(--warning)}
.stat.good .n{color:var(--good)}

/* ---------- timeline / dossier cards ---------- */
.daygroup{margin-bottom:22px; scroll-margin-top:96px}
.dayhead{display:flex; align-items:baseline; gap:10px; margin-bottom:10px}
.dayhead .d{font-family:var(--font-display); font-weight:600; font-size:15.5px}
.dayhead .n{font-size:11.5px; color:var(--faint)}
.dossier{background:var(--surface); border:1px solid var(--hair); border-radius:var(--radius-l); box-shadow:var(--shadow); overflow:hidden}
.exhibit{padding:14px 18px; border-bottom:1px solid var(--hair)}
.exhibit:last-child{border-bottom:0}
.exhibit-head{display:flex; align-items:center; gap:9px; margin-bottom:9px; flex-wrap:wrap}
.src-tag{display:inline-flex; align-items:center; gap:5px; font-size:11px; font-weight:600; padding:3px 8px; border-radius:999px}
.src-tag .dot{width:6px; height:6px; border-radius:50%}
.src-tag.signal{background:var(--signal-bg); color:var(--signal)}
.src-tag.signal .dot{background:var(--signal)}
.src-tag.sms{background:var(--sms-bg); color:var(--sms)}
.src-tag.sms .dot{background:var(--sms)}
.src-tag.email{background:var(--email-bg); color:var(--email)}
.src-tag.email .dot{background:var(--email)}
.src-tag.event{background:var(--event-bg); color:var(--event)}
.src-tag.event .dot{background:var(--event)}
.exhibit-time{font-family:var(--font-mono); font-size:11px; color:var(--faint)}
.flag{display:inline-flex; align-items:center; gap:5px; font-size:10.5px; font-weight:700; letter-spacing:.02em; text-transform:uppercase;
  padding:3px 8px; border-radius:999px; margin-left:auto}
.flag svg{width:11px; height:11px}
.flag.threat{background:var(--critical-bg); color:var(--critical)}
.flag.gaslight{background:var(--warning-bg); color:var(--warning)}

.msgs{display:flex; flex-direction:column; gap:7px}
.msg{max-width:74%; padding:8px 12px; border-radius:14px; font-size:13.5px; line-height:1.42}
.msg.them{background:var(--surface-2); border-bottom-left-radius:4px; align-self:flex-start}
.msg.me{background:var(--accent-soft); border-bottom-right-radius:4px; align-self:flex-end; text-align:right}
.msg .who{font-size:10.5px; color:var(--faint); margin-bottom:2px; font-weight:600}
.msg.flagged{outline:1.5px solid var(--warning); outline-offset:-1.5px}

.evtline{display:flex; align-items:center; gap:10px; font-size:13px; color:var(--muted)}
.evtline svg{width:15px; height:15px; color:var(--event); flex:0 0 auto}

.emailcard{display:flex; flex-direction:column; gap:3px}
.emailcard .esub{font-weight:600; font-size:13.5px}
.emailcard .emeta{font-size:11.5px; color:var(--muted)}
.emailcard .esnip{font-size:12.5px; color:var(--muted); margin-top:3px}

.empty-note{font-size:12.5px; color:var(--faint); text-align:center; padding:20px 0}

@keyframes evflash{0%{box-shadow:0 0 0 3px var(--accent-soft-strong)} 100%{box-shadow:0 0 0 0 transparent}}

/* ---------- add-event dialog ---------- */
dialog.eventdialog{border:0; border-radius:var(--radius-l); padding:0; background:var(--surface); color:var(--ink);
  box-shadow:var(--shadow-lg); width:min(440px,92vw)}
dialog.eventdialog::backdrop{background:rgba(10,14,18,.5); backdrop-filter:blur(2px)}
.dlg-head{display:flex; align-items:center; justify-content:space-between; padding:16px 18px; border-bottom:1px solid var(--hair)}
.dlg-head h2{font-family:var(--font-title); font-weight:600; font-size:17px; letter-spacing:-.015em}
.dlg-close{background:transparent; border:0; color:var(--muted); cursor:pointer; width:28px; height:28px;
  display:grid; place-items:center; border-radius:6px}
.dlg-close:hover{background:var(--surface-2); color:var(--ink)}
.dlg-close svg{width:16px; height:16px}
#eventForm, #reportExportForm, #evidenceForm, #hearingForm{display:flex; flex-direction:column; gap:14px; padding:20px 24px 22px}
/* The header sits inside the padded form but still spans the full width of the box. */
:is(#eventForm, #reportExportForm, #evidenceForm, #hearingForm) > .dlg-head{margin:-20px -24px 2px; padding:16px 24px}
.frow{display:flex; flex-direction:column; gap:5px}
.frow[hidden]{display:none}
.frow label{font-size:12px; font-weight:600; color:var(--muted)}
.frow input,.frow select,.frow textarea{font:inherit; font-size:13.5px; padding:8px 10px; border:1px solid var(--hair);
  border-radius:var(--radius-s); background:var(--surface-2); color:var(--ink)}
.frow textarea{resize:vertical; min-height:64px}
.frow input:focus,.frow select:focus,.frow textarea:focus{outline:2px solid var(--accent); outline-offset:1px}
.two{display:grid; grid-template-columns:1fr 1fr; gap:12px}
.dlg-foot{display:flex; justify-content:flex-end; gap:8px; padding-top:4px}

.lf-toast{position:fixed; left:50%; bottom:22px; transform:translateX(-50%); z-index:50; display:flex; align-items:center; gap:12px;
  max-width:calc(100vw - 32px); padding:10px 12px 10px 16px; border-radius:var(--radius-m); background:var(--ink); color:var(--surface);
  box-shadow:var(--shadow-lg); font-size:13px}
.lf-toast[hidden]{display:none}
.lf-toast button{background:none; border:0; color:inherit; font:inherit; font-weight:700; text-decoration:underline; cursor:pointer; white-space:nowrap}

/* ---------- responsive: collapse rail ---------- */
@media (max-width:860px){
  .rail{position:fixed; left:0; top:0; bottom:0; width:230px; z-index:30; transform:translateX(-100%);
    transition:transform .2s var(--ease); box-shadow:var(--shadow-lg)}
  .rail.open{transform:translateX(0)}
  .brand-mark{width:34px; height:34px} .brand-word{font-size:18px}
  .railtoggle{display:inline-flex !important}
  .topstrip{padding-left:16px}
}
.railtoggle{display:none; align-items:center; justify-content:center; width:34px; height:34px; border-radius:var(--radius-m);
  border:1px solid var(--hair); background:var(--surface); cursor:pointer; margin-right:2px}
.railtoggle svg{width:17px; height:17px}
.railscrim{display:none}
@media (max-width:860px){ .railscrim.on{display:block; position:fixed; inset:0; background:rgba(0,0,0,.35); z-index:25} }

@media (max-width:560px){
  .page{padding:18px 16px 48px}
  .topstrip{padding:14px 16px}
  .msg{max-width:88%}
}

/* =====================================================================
   Binder additions (not in the mockup): case picker, page states,
   sign-out, login page. Keep mockup styles above this line verbatim.
   ===================================================================== */

/* ---------- case picker (the case card opens a menu of cases) ---------- */
.case-picker{cursor:pointer}
.case-picker:hover{border-color:var(--hair-strong)}
.case-picker.open{border-color:var(--accent); box-shadow:0 0 0 1px var(--accent), var(--shadow)}
.case-picker .cc-sample{opacity:.7}
.case-menu{position:absolute; left:-1px; right:-1px; top:calc(100% + 6px); z-index:20; background:var(--surface);
  border:1px solid var(--hair-strong); border-radius:var(--radius-m); box-shadow:var(--shadow-lg); padding:5px; cursor:default}
.case-menu[hidden]{display:none}
.case-option{display:flex; flex-direction:column; align-items:flex-start; gap:1px; width:100%; text-align:left; padding:8px 10px;
  border:0; border-radius:var(--radius-s); background:transparent; cursor:pointer}
.case-option:hover, .case-option:focus-visible{background:var(--surface-2); outline:none}
.case-option.on{background:var(--accent-soft)}
.case-option .co-title{display:flex; align-items:center; gap:7px; width:100%; font-family:var(--font-title); font-weight:600;
  font-size:13.5px; letter-spacing:-.01em; color:var(--ink)}
.case-option.on .co-title{color:var(--accent)}
.case-option .co-sub{font-size:11.5px; color:var(--muted)}
.case-option .co-tag{margin-left:auto; font-family:var(--font-body); font-size:9.5px; font-weight:700; text-transform:uppercase;
  letter-spacing:.03em; padding:2px 7px; border-radius:999px; background:var(--surface-3); color:var(--muted)}
.case-option .co-tag.live{background:var(--good-bg); color:var(--good)}

a.btn{text-decoration:none}

/* ---------- nav count when empty ---------- */
.navitem .count:empty{display:none}

/* ---------- sign out ---------- */
.rail-foot{display:flex; flex-direction:column; gap:6px}
.signout-user{color:var(--faint)}

/* ---------- page states: loading, sample case, todo, error, placeholder ---------- */
.state-panel{background:var(--surface); border:1px dashed var(--hair-strong); border-radius:var(--radius-l);
  padding:40px 24px; text-align:center; color:var(--muted); max-width:620px; margin:12px auto 0}
.state-panel .state-icon{width:44px; height:44px; margin:0 auto 14px; border-radius:var(--radius-m); display:grid; place-items:center;
  background:var(--accent-soft); color:var(--accent)}
.state-panel .state-icon svg{width:22px; height:22px}
.state-panel.todo .state-icon{background:var(--warning-bg); color:var(--warning)}
.state-panel.error .state-icon{background:var(--critical-bg); color:var(--critical)}
.state-panel h2{font-family:var(--font-title); font-weight:600; font-size:18px; letter-spacing:-.015em; color:var(--ink); margin-bottom:6px}
.state-panel p{margin:0 auto; font-size:13px; line-height:1.6; max-width:460px}
.state-panel .state-kicker{display:inline-block; font-size:10.5px; font-weight:700; text-transform:uppercase; letter-spacing:.04em;
  padding:2px 9px; border-radius:999px; background:var(--surface-3); color:var(--muted); margin-bottom:10px}
.state-panel.todo .state-kicker{background:var(--warning-bg); color:var(--warning)}
.state-panel .state-actions{display:flex; gap:8px; justify-content:center; flex-wrap:wrap; margin-top:18px}
.state-loading{padding:40px 0; text-align:center; color:var(--faint); font-size:12.5px}

.placeholder-note{display:flex; gap:10px; align-items:flex-start; background:var(--accent-soft);
  border:1px solid color-mix(in srgb, var(--accent) 35%, var(--hair)); border-radius:var(--radius-m);
  padding:12px 15px; font-size:12.5px; line-height:1.55; color:var(--ink)}
.placeholder-note svg{width:16px; height:16px; color:var(--accent); flex:0 0 auto; margin-top:1px}

/* ---------- login page ---------- */
.login-shell{min-height:100vh; display:grid; place-items:center; padding:24px 16px}
.login-card{width:min(400px,100%); background:var(--surface); border:1px solid var(--hair); border-radius:var(--radius-l);
  box-shadow:var(--shadow-lg); overflow:hidden}
.login-card .brand{padding:22px 24px 4px}
.login-card form{display:flex; flex-direction:column; gap:14px; padding:12px 24px 24px}
.login-card h1{font-family:var(--font-title); font-weight:600; font-size:21px; letter-spacing:-.02em}
.login-card .login-sub{font-size:12.5px; color:var(--muted); margin:-8px 0 2px}
.login-card .btn.primary{justify-content:center; height:38px; font-size:13.5px}
.login-error{display:flex; gap:8px; align-items:flex-start; background:var(--critical-bg); color:var(--critical);
  border:1px solid color-mix(in srgb, var(--critical) 40%, var(--hair)); border-radius:var(--radius-s);
  padding:9px 12px; font-size:12.5px; font-weight:600}
.login-error[hidden]{display:none}
.login-foot{font-size:11.5px; color:var(--faint); text-align:center; padding:0 24px 18px}

/* =====================================================================
   Polish (job 4d): refinements layered over the styles above. Overrides
   only: no class or token is renamed or removed, so page CSS keeps working.
   ===================================================================== */

/* ---------- browser surfaces: scrollbars, focus, links ---------- */
html{scrollbar-color:var(--hair-strong) transparent}
.rail, .case-menu{scrollbar-width:thin}
:where(a, button, summary, select, input, textarea, [tabindex]):focus-visible{outline:2px solid var(--accent); outline-offset:2px}
a:where(:not(.btn)){text-underline-offset:2px}

/* ---------- form fields: quiet hover, soft focus ring, themed select ---------- */
.frow input, .frow select, .frow textarea{transition:border-color .15s var(--ease), box-shadow .15s var(--ease)}
.frow input:hover, .frow select:hover, .frow textarea:hover{border-color:var(--hair-strong)}
.frow input:focus, .frow select:focus, .frow textarea:focus{outline:none; border-color:var(--accent);
  box-shadow:0 0 0 3px var(--accent-soft-strong)}
.frow select{appearance:none; -webkit-appearance:none; background-image:var(--select-chevron); background-repeat:no-repeat;
  background-position:right 9px center; background-size:16px; padding-right:32px}
.frow input::placeholder, .frow textarea::placeholder{color:var(--faint)}

/* ---------- buttons: hover and pressed states ---------- */
.btn{transition:background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease), filter .15s var(--ease), transform .08s}
.btn:not(.primary):not(:disabled):hover{background:color-mix(in srgb, var(--surface-2) 60%, var(--surface))}
.btn:not(:disabled):active{transform:translateY(.5px)}
.btn:not(.primary):not(:disabled):active{background:var(--surface-2)}
.btn.primary:not(:disabled):active{filter:brightness(.94)}

/* ---------- case card ---------- */
.case-card{padding:14px 14px 13px; transition:border-color .15s var(--ease), box-shadow .15s var(--ease)}
.case-card .sub{line-height:1.45}
.case-meta{row-gap:5px; align-items:baseline}
.case-meta dt{white-space:nowrap}
.case-meta{column-gap:8px}
.case-meta dd{font-size:11px; letter-spacing:-.02em; white-space:nowrap; min-width:0}
.case-meta dt{font-size:11px}
.case-meta .cc-status{display:inline-flex; align-items:center; justify-content:flex-end; gap:6px; font-family:var(--font-body);
  font-weight:600; text-transform:capitalize}
.case-meta .cc-status::before{content:""; width:6px; height:6px; border-radius:50%; background:var(--faint); flex:0 0 auto}
.case-meta .cc-status[data-status="active"]::before{background:var(--good)}
/* The "Switch case" tip sits above the button, clear of the case title, after a short hover. */
.cc-edit .cc-edit-tip{top:auto; bottom:calc(100% + 6px); right:-2px; transform:translateY(3px);
  transition:opacity .12s var(--ease), transform .12s var(--ease)}
.cc-edit:hover .cc-edit-tip, .cc-edit:focus-visible .cc-edit-tip{transform:none; transition-delay:.25s}
.case-picker.open .cc-edit .cc-edit-tip{opacity:0}
.cc-edit:focus-visible{outline:2px solid var(--accent); outline-offset:1px}

/* ---------- case picker menu ---------- */
.case-menu{padding:4px; animation:binder-pop .14s var(--ease)}
.case-option{gap:2px; padding:9px 10px; transition:background .12s var(--ease)}
.case-option + .case-option{margin-top:1px}
.case-option:focus-visible{box-shadow:inset 0 0 0 2px var(--accent)}
.case-option .co-title{align-items:flex-start; line-height:1.3}
.case-option .co-tag{flex:0 0 auto; margin-top:1px}
.case-option .co-sub{line-height:1.45}
.case-option .co-num{font-family:var(--font-mono); font-size:11px; white-space:nowrap}
@keyframes binder-pop{from{opacity:0; transform:translateY(-4px)} to{opacity:1; transform:none}}

/* ---------- nav and rail foot ---------- */
.navitem:active{background:var(--surface-3)}
.rail-foot{gap:2px; padding:10px 10px 14px}
.theme-toggle{gap:11px; padding:8px 9px; border-color:transparent; background:transparent; font-size:13px; font-weight:500;
  transition:background .15s var(--ease), color .15s var(--ease)}
.theme-toggle:hover{background:var(--surface-3); border-color:transparent}
.theme-toggle svg{width:17px; height:17px; flex:0 0 auto}
.theme-toggle .signout-user{font-weight:400}

/* ---------- title strip ---------- */
.topstrip{row-gap:2px; min-height:65px; align-items:center}
.topstrip h1{line-height:1.25}
.topstrip .desc{line-height:1.4}
.railtoggle{color:var(--muted); transition:color .15s var(--ease), border-color .15s var(--ease)}
.railtoggle:hover{color:var(--ink); border-color:var(--hair-strong)}
@media (max-width:860px){
  .rail{width:min(280px, 86vw)}
}
@media (max-width:560px){
  .topstrip{min-height:0}
  .topstrip .desc{flex-basis:100%; margin-left:50px; font-size:12px}
  .topstrip .strip-actions{flex-basis:100%; margin-left:0}
}

/* ---------- page states ---------- */
.state-panel{border-style:solid; border-color:var(--hair); box-shadow:var(--shadow); padding:40px 32px 36px}
.state-panel h2{font-size:19px; line-height:1.3; margin-bottom:8px}
.state-panel p{color:var(--muted)}
.state-panel .state-icon{margin-bottom:16px}
.state-plan{list-style:none; margin:22px auto 0; padding:16px 18px; max-width:460px; text-align:left; display:flex; flex-direction:column;
  gap:10px; background:var(--surface-2); border-radius:var(--radius-m)}
.state-plan li{display:flex; align-items:flex-start; gap:10px; font-size:13px; line-height:1.5; color:var(--ink)}
.state-plan li svg{width:15px; height:15px; flex:0 0 auto; margin-top:2px; color:var(--accent)}
.state-note{display:block; margin-top:16px; font-size:11.5px; color:var(--faint)}
.state-loading{display:flex; align-items:center; justify-content:center; gap:10px; padding:48px 0}
.state-loading::before{content:""; width:14px; height:14px; border-radius:50%; border:2px solid var(--hair-strong);
  border-top-color:var(--accent); animation:binder-spin .8s linear infinite}
@keyframes binder-spin{to{transform:rotate(360deg)}}
@media (max-width:560px){ .state-panel{padding:32px 20px 28px} }

/* ---------- login ---------- */
.login-shell{background:radial-gradient(1200px 520px at 50% -10%, var(--accent-soft), transparent 70%), var(--bg)}
.login-card{box-shadow:0 1px 2px rgba(20,30,40,.05), 0 12px 32px rgba(20,30,40,.10)}
.login-card .brand{padding:26px 28px 6px}
.login-card form{gap:16px; padding:14px 28px 26px}
.login-card .login-sub{margin:-10px 0 0}
.login-card .frow input{height:40px; font-size:14px}
.login-card .btn.primary{height:40px; margin-top:4px}
.login-card .btn.primary:disabled{opacity:.7}
.login-error{font-weight:500}
.login-foot{border-top:1px solid var(--hair); padding:14px 28px 16px; margin:0}
@media (max-width:420px){
  .login-card .brand{padding:22px 20px 4px}
  .login-card form{padding:12px 20px 22px}
  .login-foot{padding:12px 20px 14px}
}

/* =====================================================================
   Motion and layout (job 6b): view transitions between pages and views,
   pages that use the whole width, the shared search-then-filters panel,
   the case picker as a panel of cards. Overrides and additions only.
   ===================================================================== */

/* ---------- pages use the full width; pages cap their own text columns ---------- */
:root{--motion-duration:280ms; --motion-exit:170ms; --motion-ease:cubic-bezier(.22,.61,.36,1); --strip-h:65px}
.page{max-width:none}
@media (min-width:1800px){ .page{padding-left:36px; padding-right:36px} }
/* The title strip is opaque: content scrolled under it (a sticky day heading, a gallery title)
   used to show through the 86% background as ghost text beside the page title. */
.topstrip{background:var(--surface); backdrop-filter:none; -webkit-backdrop-filter:none}

/* ---------- page and view transitions (js/motion.js) ----------
   During one of the app's transitions <html> has .binder-vt and data-motion. The rail and the
   title strip get their own names so they stay still (their contents cross-fade); the rest of
   the screen (root) leaves and arrives in the direction data-motion names. Transform and opacity
   only. The overlay passes pointer events through, so a click mid-transition reaches the page. */
html.binder-vt .rail{view-transition-name:binder-rail}
html.binder-vt .topstrip{view-transition-name:binder-strip}
html.binder-vt[data-motion^="view-"] .view-stable{view-transition-name:binder-view-stable}
::view-transition{pointer-events:none}
html.binder-vt:not([data-motion="theme"])::view-transition{background:var(--bg)}
html.binder-vt::view-transition-group(*){animation-duration:var(--motion-duration); animation-timing-function:var(--motion-ease)}
/* A page's stable header (e.g. Reports' chooser) may have scrolled away: draw it where it lands, don't fly it in. */
html.binder-vt::view-transition-group(binder-view-stable){animation:none}
html.binder-vt::view-transition-old(binder-rail), html.binder-vt::view-transition-new(binder-rail),
html.binder-vt::view-transition-old(binder-strip), html.binder-vt::view-transition-new(binder-strip),
html.binder-vt::view-transition-old(binder-view-stable), html.binder-vt::view-transition-new(binder-view-stable){animation-duration:200ms}
html.binder-vt:not([data-motion="theme"])::view-transition-old(root){animation:binder-out-fade var(--motion-exit) var(--motion-ease) both; mix-blend-mode:normal}
html.binder-vt:not([data-motion="theme"])::view-transition-new(root){animation:binder-in-fade var(--motion-duration) var(--motion-ease) both; mix-blend-mode:normal}
html.binder-vt[data-motion$="down"]::view-transition-old(root){animation-name:binder-out-up}
html.binder-vt[data-motion$="down"]::view-transition-new(root){animation-name:binder-in-from-below}
html.binder-vt[data-motion$="up"]::view-transition-old(root){animation-name:binder-out-down}
html.binder-vt[data-motion$="up"]::view-transition-new(root){animation-name:binder-in-from-above}
html.binder-vt[data-motion$="forward"]::view-transition-old(root){animation-name:binder-out-left}
html.binder-vt[data-motion$="forward"]::view-transition-new(root){animation-name:binder-in-from-right}
html.binder-vt[data-motion$="back"]::view-transition-old(root){animation-name:binder-out-right}
html.binder-vt[data-motion$="back"]::view-transition-new(root){animation-name:binder-in-from-left}
html.binder-vt[data-motion="theme"]::view-transition-old(*), html.binder-vt[data-motion="theme"]::view-transition-new(*){animation-duration:320ms}
@keyframes binder-out-fade{to{opacity:0}}
@keyframes binder-in-fade{from{opacity:0}}
@keyframes binder-out-up{to{opacity:0; transform:translateY(-12px)}}
@keyframes binder-out-down{to{opacity:0; transform:translateY(12px)}}
@keyframes binder-in-from-below{from{opacity:0; transform:translateY(20px)}}
@keyframes binder-in-from-above{from{opacity:0; transform:translateY(-20px)}}
@keyframes binder-out-left{to{opacity:0; transform:translateX(-28px)}}
@keyframes binder-out-right{to{opacity:0; transform:translateX(28px)}}
@keyframes binder-in-from-right{from{opacity:0; transform:translateX(36px)}}
@keyframes binder-in-from-left{from{opacity:0; transform:translateX(-36px)}}
/* Sign-in → app and sign-out: the two documents cross-fade (browsers with cross-document view transitions). */
@view-transition{navigation:auto}
@media (prefers-reduced-motion: reduce){
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*){animation:none !important}
}

/* ---------- shared: search first, filters below, pinned while the results scroll ----------
   .filter-panel is a card; .filter-search is its full-width search box; .filter-group / -h label
   each set of options; .filter-pinned keeps the panel in view just under the title strip. */
.filter-panel{background:var(--surface); border:1px solid var(--hair); border-radius:var(--radius-l); box-shadow:var(--shadow);
  padding:14px; display:flex; flex-direction:column; gap:16px; min-width:0}
.filter-search{display:flex; width:100%; min-width:0; height:38px; background:var(--surface-2);
  transition:border-color .15s var(--ease), box-shadow .15s var(--ease), background .15s var(--ease)}
.filter-search input{font-size:13.5px}
.filter-search:focus-within{outline:none; border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-soft-strong); background:var(--surface)}
.filter-group{display:flex; flex-direction:column; gap:7px; min-width:0}
.filter-group-h{display:flex; align-items:baseline; justify-content:space-between; gap:8px; font-size:10.5px; font-weight:700;
  text-transform:uppercase; letter-spacing:.04em; color:var(--faint)}
.filter-pinned{position:sticky; top:calc(var(--strip-h) + 16px); max-height:calc(100vh - var(--strip-h) - 32px); overflow-y:auto;
  overscroll-behavior:contain; scrollbar-width:thin}

/* ---------- case picker: a panel of case cards beside the rail on wide screens ----------
   The rail is sticky (its own stacking context), so it is lifted above the page for the panel. */
@media (min-width:861px){ .rail{z-index:20} }
.case-menu-head{display:none}
.case-option .co-court, .case-option .co-meta{display:none}
.case-menu.as-panel{position:fixed; right:auto; z-index:40; padding:14px; border-radius:var(--radius-l); animation:binder-panel-in .2s var(--motion-ease)}
.case-menu.as-panel .case-menu-head{display:flex; align-items:baseline; justify-content:space-between; padding:0 4px 10px;
  font-family:var(--font-title); font-weight:600; font-size:15px; letter-spacing:-.01em}
.case-menu.as-panel .case-menu-n{font-family:var(--font-body); font-size:11.5px; font-weight:500; color:var(--faint)}
.case-menu.as-panel .case-menu-grid{display:grid; grid-template-columns:repeat(auto-fill, minmax(220px, 1fr)); gap:10px}
.case-menu.as-panel .case-option{height:100%; gap:4px; padding:12px 13px; margin:0; border:1px solid var(--hair); background:var(--surface);
  border-radius:var(--radius-m); transition:border-color .15s var(--ease), background .15s var(--ease), box-shadow .15s var(--ease)}
.case-menu.as-panel .case-option:hover{border-color:var(--hair-strong); background:var(--surface); box-shadow:var(--shadow)}
.case-menu.as-panel .case-option.on{border-color:var(--accent); background:var(--accent-soft); box-shadow:inset 0 0 0 1px var(--accent)}
.case-menu.as-panel .co-title{font-size:14.5px}
.case-menu.as-panel .co-court{display:block; font-size:11.5px; color:var(--muted); line-height:1.45}
.case-menu.as-panel .co-meta{display:flex; flex-direction:column; gap:3px; margin-top:auto; padding-top:8px; border-top:1px solid var(--hair);
  width:100%; font-size:11.5px; color:var(--muted)}
.case-menu.as-panel .co-meta b{font-weight:500; color:var(--ink)}
.co-status{display:inline-flex; align-items:center; gap:6px; font-weight:600; text-transform:capitalize; color:var(--ink)}
.co-status::before{content:""; width:6px; height:6px; border-radius:50%; background:var(--faint)}
.co-status[data-status="active"]::before{background:var(--good)}
@keyframes binder-panel-in{from{opacity:0; transform:translateX(-8px)} to{opacity:1; transform:none}}

/* ---------- placeholder (TODO) pages: a wider card on wide screens, plans side by side ---------- */
@media (min-width:1280px){
  .state-panel.todo{max-width:980px; margin-top:28px; padding:48px 48px 40px}
  .state-panel.todo .state-plan{max-width:none; display:grid; grid-template-columns:repeat(3, minmax(0,1fr)); gap:12px; background:none; padding:0}
  .state-panel.todo .state-plan li{flex-direction:column; gap:10px; padding:16px 18px; background:var(--surface-2); border-radius:var(--radius-m)}
}

/* ---------- small entrances used inside pages ---------- */
@keyframes binder-rise-in{from{opacity:0; transform:translateY(8px)}}
@keyframes binder-fade-in{from{opacity:0}}

/* =====================================================================
   Polish 2 (job 7e): overrides and additions only. No class or token is
   renamed or removed; binder/jobs/polish-2.md lists what pages inherit.
   ===================================================================== */

/* ---------- off-canvas rail (phones and small tablets) ----------
   Closed, it is hidden: out of the tab order, and its shadow no longer bleeds in at the left
   edge of every page. It slides in with its shadow while the scrim fades. */
@media (max-width:860px){
  .rail{visibility:hidden; box-shadow:none; transition:transform .24s var(--motion-ease), box-shadow .24s var(--motion-ease), visibility 0s linear .24s}
  .rail.open{visibility:visible; box-shadow:var(--shadow-lg); transition:transform .24s var(--motion-ease), box-shadow .24s var(--motion-ease), visibility 0s}
  .railscrim{display:block; position:fixed; inset:0; z-index:25; background:rgba(8,12,18,.42); opacity:0; pointer-events:none;
    transition:opacity .24s var(--motion-ease)}
  .railscrim.on{opacity:1; pointer-events:auto}
  .railtoggle{width:40px; height:40px}
}
@media (max-width:560px){ .topstrip .desc{margin-left:56px} }

/* ---------- skip link: the first Tab on every page ---------- */
.skip-link{position:fixed; left:12px; top:12px; z-index:60; padding:9px 14px; border:0; border-radius:var(--radius-m); background:var(--ink);
  color:var(--surface); font:600 13px/1 var(--font-body); box-shadow:var(--shadow-lg); cursor:pointer; transform:translateY(-200%)}
.skip-link:focus-visible{transform:none; outline:2px solid var(--accent); outline-offset:2px}
#pageRoot:focus{outline:none}

/* =====================================================================
   Blank install (job 9a): the sign-up form on the login card, field hints and errors, and the shell
   before there is a case. The Welcome and Create your case pages are in newcase.css.
   ===================================================================== */
.login-card form[hidden]{display:none}
.login-switch{align-self:center; background:none; border:0; padding:4px 6px; font:inherit; font-size:12.5px; font-weight:600;
  color:var(--accent); cursor:pointer; text-decoration:underline; text-underline-offset:2px; text-decoration-color:transparent;
  transition:text-decoration-color .15s var(--ease)}
.login-switch:hover{text-decoration-color:currentColor}
.login-switch:focus-visible{outline:2px solid var(--accent); outline-offset:2px; border-radius:var(--radius-s)}
.login-switch[hidden]{display:none}
.login-note{font-size:12px; color:var(--muted); text-align:center}
.login-note[hidden]{display:none}
.field-hint{font-size:11.5px; line-height:1.45; color:var(--faint)}
.frow [aria-invalid="true"]{border-color:var(--critical)}
.frow input[aria-invalid="true"]:focus, .frow select[aria-invalid="true"]:focus{border-color:var(--critical);
  box-shadow:0 0 0 3px var(--critical-bg)}
/* No case yet: nothing to pick and no pages to visit, so the rail keeps only the brand, theme and sign out. */
body.no-cases .case-card, body.no-cases .rail .nav{display:none}
body.no-cases .rail-foot{margin-top:auto}
/* A blank install has no samples to try (the Import page's list stays empty). */
.imp-samples:has(.imp-sample-list:empty){display:none}
