/* ============================================================
   Kreiss Document AI — shared design system (plain CSS, no build step)
   DDD shared kernel: every page links this file and stays lean.
   Brand tokens live between BRAND:START/END. scripts/apply_brand.py
   rewrites only that block, so never hand-edit colours elsewhere.
   Order: state defaults → BRAND (may override states when the brand
   colour clashes) → components → FEEL (hand-tuned, end of file).
   ============================================================ */
/* state palette defaults (apply_brand.py may override --bad* inside BRAND) */
:root{
  --ok:#6FA043; --okbg:#E7F1D8; --okink:#3D5A22;
  --warn:#C2872F; --warnbg:#F5E7CD; --warnink:#7A5414;
  --bad:#BB553C; --badbg:#F6E0D8; --badink:#7E3322;
  --info:#4F8295; --infobg:#DCE9ED; --infoink:#2C5360;
  --plan:#7A5B86; --planbg:#ECE2F0; --planink:#4D3357;
  --sb-w:264px;
  --label-case:uppercase;   /* FEEL: none for sentence-case brands */
  --ink-strong:#1d1c1d; --paper2:#EEF0F2;
}

/* BRAND:START */
/* source: https://www.kreiss.lv/ */
:root{
  --font-display:'Open Sans',system-ui,sans-serif;
  --font-body:'Open Sans',system-ui,sans-serif;
  --font-mono:'DM Mono',ui-monospace,monospace;
  --paper:#f9fafb;
  --cream:#FCFCFD;
  --card:#FFFFFF;
  --ink:#474647;
  --ink2:#504F50;
  --ink3:#747374;
  --line:#E2E3E4;
  --line2:#EDEDEE;
  --brand50:#FDF0F0;
  --brand100:#FADCDC;
  --brand200:#F5BAB9;
  --brand300:#F09292;
  --brand400:#EA6B6B;
  --brand500:#E54746;
  --brand600:#E02625;
  --brand700:#B31E1E;
  --brand900:#651111;
  --accent:#143852;
  --on-brand:#FFFFFF;
  --sb-bg1:#7B1514;
  --sb-bg2:#550E0E;
  --sb-ink:#FDEEEE;
  --radius:.25rem;
}
/* state overrides: doubled selector wins over a later plain :root in older themes */
:root:root{ --bad:#7A1F72; --badbg:#F3E3F1; --badink:#4F1049; }
/* BRAND:END */


*{ box-sizing:border-box; }
html{ scroll-behavior:smooth; }
body{ margin:0; background:var(--paper); color:var(--ink); font-family:var(--font-body); -webkit-font-smoothing:antialiased; }
.font-display{ font-family:var(--font-display); }
.font-mono{ font-family:var(--font-mono); }
a{ color:inherit; text-decoration:none; }
h1,h2,h3{ font-family:var(--font-display); font-weight:600; }

/* atmosphere */
.atmos{ background:
  radial-gradient(120% 90% at 12% -10%, color-mix(in srgb,var(--brand400) 30%,transparent), transparent 55%),
  radial-gradient(110% 80% at 100% 0%, color-mix(in srgb,var(--info) 16%,transparent), transparent 50%),
  radial-gradient(90% 90% at 50% 120%, color-mix(in srgb,var(--accent) 14%,transparent), transparent 55%),
  var(--paper); }

/* app shell */
.app{ display:flex; min-height:100vh; }
.sidebar{ width:var(--sb-w); flex:0 0 var(--sb-w); position:sticky; top:0; height:100vh;
  background:linear-gradient(178deg,var(--sb-bg1),var(--sb-bg2)); color:var(--sb-ink);
  display:flex; flex-direction:column; overflow-y:auto; z-index:30; }
.brand{ display:flex; align-items:center; gap:.65rem; padding:1.15rem 1.2rem; border-bottom:1px solid rgba(255,255,255,.08); }
.brand .mark{ display:grid; place-items:center; width:38px; height:38px; border-radius:12px; background:var(--brand600); color:var(--on-brand); overflow:hidden; }
.brand .mark img{ width:100%; height:100%; object-fit:contain; background:#fff; }
.brand .mark.wide{ width:auto; max-width:132px; padding:0 .45rem; background:#fff; }
.brand .mark.wide img{ width:auto; max-width:120px; height:26px; }
.nav-group{ padding:.85rem 0 .25rem; }
.nav-group h4{ margin:0; padding:.2rem 1.25rem .45rem; font-size:10px; letter-spacing:.18em; text-transform:var(--label-case); opacity:.45; font-weight:600; }
.nav-link{ display:flex; align-items:center; gap:.7rem; margin:1px .6rem; padding:.55rem .7rem; border-radius:12px; font-size:14px; opacity:.82; transition:background .18s,opacity .18s; position:relative; }
.nav-link svg{ flex:0 0 18px; opacity:.75; }
.nav-link:hover{ background:rgba(255,255,255,.07); opacity:1; }
.nav-link.active{ background:rgba(255,255,255,.14); opacity:1; }
.nav-link.active::before{ content:""; position:absolute; left:-6px; top:18%; bottom:18%; width:3px; border-radius:3px; background:var(--accent); }
.main{ flex:1; min-width:0; display:flex; flex-direction:column; }
.topbar{ position:sticky; top:0; z-index:20; display:flex; align-items:center; justify-content:space-between; gap:1rem;
  padding:.7rem 1.5rem; background:color-mix(in srgb,var(--paper) 86%,transparent); backdrop-filter:blur(10px); border-bottom:1px solid var(--line); }
.crumb{ display:flex; align-items:center; gap:.5rem; font-size:13px; color:var(--ink3); }
.crumb b{ color:var(--ink); font-weight:600; }
.content{ padding:1.6rem 1.6rem 3rem; max-width:1320px; width:100%; margin:0 auto; }
#proto-burger{ display:none; }
.sb-scrim{ display:none; }
/* tablet and phone: the sidebar becomes a drawer opened by the burger; a scrim behind it closes it */
@media(max-width:860px){
  .sidebar{ position:fixed; left:0; width:min(290px,86vw); flex:none; transform:translateX(-105%); transition:transform .25s ease; }
  .sidebar.open{ transform:none; box-shadow:0 0 60px rgba(0,0,0,.4); }
  .sidebar.open ~ .sb-scrim{ display:block; position:fixed; inset:0; z-index:29; background:rgba(8,14,20,.45); }
  #proto-burger{ display:inline-flex; }
  .topbar{ justify-content:flex-start; } .tb-actions{ margin-left:auto; }
  .tb-lbl{ display:none !important; }
  .persona{ padding:.2rem; }
  .content{ padding:1.1rem; }
}
@media (prefers-reduced-motion: reduce){ .sidebar{ transition:none; } }
/* phone: the page title band names the page, so the crumb hides; menus open full width under the topbar */
@media(max-width:640px){
  .topbar{ padding:.55rem .75rem; gap:.5rem; }
  .crumb{ display:none; }
  .tb-opt, .tb-lbl{ display:none !important; }
  .tb-actions{ gap:.4rem !important; flex:0 0 auto; margin-left:auto; }
  .persona{ padding:.2rem; }
  .topbar .menu{ position:fixed; left:8px; right:8px; top:calc(var(--tb-h,60px) + 4px); width:auto !important; max-width:none;
    max-height:calc(100vh - var(--tb-h,60px) - 16px); overflow:auto; }
  .content{ padding:1rem .9rem 2.5rem; }
  /* iOS zooms into any field under 16px and stays zoomed */
  html .field, html input, html select, html textarea{ font-size:16px; }
}
@media (pointer:coarse){ .pill-group button{ min-width:32px; height:32px; } }

/* persona / role switcher */
.persona{ display:flex; align-items:center; gap:.6rem; padding:.3rem .5rem .3rem .35rem; border-radius:99px; border:1px solid var(--line); background:var(--card); cursor:pointer; }
.avatar{ display:grid; place-items:center; width:32px; height:32px; border-radius:99px; font-size:12px; font-weight:600; color:#fff; background:var(--brand600); }
.menu{ position:absolute; right:0; top:calc(100% + 8px); width:300px; background:var(--card); border:1px solid var(--line); border-radius:18px; box-shadow:0 24px 48px -20px rgba(0,0,0,.3); padding:.5rem; z-index:60; }
.menu-opt{ display:flex; align-items:center; gap:.7rem; padding:.6rem .65rem; border-radius:12px; cursor:pointer; }
.menu-opt:hover{ background:var(--brand50); }
.menu-opt.sel{ background:var(--brand100); }
#proto-tourmenu{ width:340px; }
#proto-tourmenu .menu-opt{ align-items:flex-start; }
#proto-tourmenu .menu-opt > svg{ flex:0 0 auto; margin-top:3px; }
.pill-group{ display:inline-flex; align-items:center; gap:2px; padding:3px; border:1px solid var(--line); background:var(--card); border-radius:99px; }
.pill-group button{ display:inline-flex; align-items:center; justify-content:center; gap:.3rem; white-space:nowrap; min-width:27px; height:27px; padding:0 .45rem; border:none; background:transparent; border-radius:99px; cursor:pointer; color:var(--ink3); font:600 12px var(--font-body); }
.pill-group button:hover{ color:var(--ink); background:var(--brand50); }
.pill-group button.on{ background:var(--brand600); color:var(--on-brand); }

/* surfaces & components */
.surface{ background:var(--card); border:1px solid var(--line); border-radius:var(--radius); box-shadow:0 1px 2px rgba(0,0,0,.04),0 8px 24px -12px rgba(0,0,0,.12); }
.surface-soft{ background:var(--cream); border:1px solid var(--line); border-radius:var(--radius); }
.pad{ padding:1.25rem; }
.section-head{ display:flex; align-items:flex-end; justify-content:space-between; gap:1rem; margin-bottom:.9rem; flex-wrap:wrap; }
.eyebrow{ font-size:11px; letter-spacing:.14em; text-transform:var(--label-case); color:var(--ink3); margin:0; }
.h3{ font-family:var(--font-display); font-size:1.3rem; font-weight:600; margin:.15rem 0 0; }
.chip{ display:inline-flex; align-items:center; gap:.4rem; border-radius:99px; border:1px solid var(--line); padding:.25rem .7rem; font-size:12px; font-weight:500; }
.dot{ width:7px; height:7px; border-radius:99px; display:inline-block; }
.btn,.btn-primary,.btn-ghost,.btn-disabled{ display:inline-flex; align-items:center; justify-content:center; gap:.5rem; border-radius:14px; padding:0 1.15rem; min-height:2.7rem; line-height:1;
  font:500 14px var(--font-body); cursor:pointer; user-select:none; border:1px solid transparent; transition:all .18s; }
.btn-primary{ background:var(--brand600); color:var(--on-brand); }
.btn-primary:hover{ background:var(--brand700); }
.btn-ghost{ background:var(--card); color:var(--ink); border-color:var(--line); }
.btn-ghost:hover{ background:var(--brand50); }
.btn-disabled{ background:var(--line2); color:var(--ink3); cursor:not-allowed; }
.btn-sm{ min-height:2.1rem; font-size:13px; padding:0 .8rem; border-radius:11px; }
.btn-lg{ min-height:3.3rem; font-size:16px; padding:0 1.5rem; border-radius:16px; }
.field{ border-radius:14px; border:1px solid var(--line); background:var(--cream); padding:.65rem .9rem; color:var(--ink); font:14px var(--font-body); width:100%; }
.field:focus{ outline:none; box-shadow:0 0 0 3px var(--brand200); }

/* status pills */
.st{ display:inline-flex; align-items:center; gap:.4rem; border-radius:99px; padding:.18rem .6rem; font-size:11.5px; font-weight:600; border:1px solid transparent; white-space:nowrap; }
.st-ok{ background:var(--okbg); color:var(--okink); }
.st-run{ background:var(--brand50); color:var(--brand700); border-color:var(--brand300); }
.st-warn{ background:var(--warnbg); color:var(--warnink); }
.st-bad{ background:var(--badbg); color:var(--badink); }
.st-info{ background:var(--infobg); color:var(--infoink); }
.st-plan{ background:var(--planbg); color:var(--planink); }
.st-new{ background:var(--cream); color:var(--ink2); border-color:var(--line); }

/* KPI */
.kpi{ background:var(--card); border:1px solid var(--line); border-radius:1.2rem; padding:1.05rem 1.1rem; position:relative; overflow:hidden; }
.kpi .lbl{ font-size:11px; letter-spacing:.12em; text-transform:var(--label-case); color:var(--ink3); margin:0; }
.kpi .val{ font-family:var(--font-display); font-weight:600; font-size:1.9rem; line-height:1.05; margin:.25rem 0 0; }
.kpi .sub{ font-size:12.5px; color:var(--ink2); margin:.2rem 0 0; }
.kpi .glow{ position:absolute; right:-30px; top:-30px; width:120px; height:120px; border-radius:99px; opacity:.16; filter:blur(6px); }
.bar{ height:8px; border-radius:99px; background:var(--line); overflow:hidden; }
.bar > i{ display:block; height:100%; border-radius:99px; background:var(--brand500); }

/* tables */
table.grid{ width:100%; border-collapse:separate; border-spacing:0; font-size:13.5px; }
table.grid th{ text-align:left; font-weight:600; color:var(--ink3); font-size:11.5px; letter-spacing:.04em; text-transform:var(--label-case); padding:.5rem .7rem; border-bottom:1px solid var(--line); }
table.grid td{ padding:.62rem .7rem; border-bottom:1px solid var(--line2); }
table.grid tbody tr:hover{ background:var(--cream); }

/* heatmap levels */
.hm-cell{ border-radius:7px; padding:.42rem 0; text-align:center; font:500 11px var(--font-mono); color:#fff; }
.lv-ok{ background:color-mix(in srgb,var(--ok) 85%,transparent); }
.lv-tight{ background:color-mix(in srgb,var(--accent) 90%,transparent); color:#3a2a08; }
.lv-over{ background:var(--bad); }
.lv-empty{ background:var(--line2); color:var(--ink3); }

/* audit timeline (event log) */
.timeline{ position:relative; }
.timeline::before{ content:""; position:absolute; left:15px; top:6px; bottom:6px; width:2px; background:linear-gradient(var(--brand200),var(--line)); }
.tl-item{ position:relative; padding:0 0 .9rem 2.4rem; }
.tl-dot{ position:absolute; left:2px; top:1px; display:grid; place-items:center; width:28px; height:28px; border-radius:99px; font-size:10px; font-weight:600; background:var(--brand100); color:var(--brand700); box-shadow:0 0 0 4px var(--card); }

/* device frame (tablet / phone flows) */
.device{ background:linear-gradient(160deg,var(--sb-bg1),var(--sb-bg2)); padding:14px; border-radius:34px; }
.device-screen{ border-radius:22px; overflow:hidden; background:var(--cream); }

/* spec-coverage badges (toggled from topbar; elements carry data-req="ID") */
.req-badge{ display:none; position:absolute; z-index:5; top:-9px; right:-6px; font:600 10px var(--font-mono); background:var(--plan); color:#fff; padding:2px 6px; border-radius:6px; pointer-events:none; }
body.show-reqs .req-badge{ display:inline-block; }
body.show-reqs [data-req]{ outline:1.5px dashed color-mix(in srgb,var(--plan) 60%,transparent); outline-offset:3px; }

/* guided tour (tour.js) */
.tour-spot{ position:fixed; z-index:80; border-radius:14px; box-shadow:0 0 0 9999px rgba(10,14,8,.45),0 0 0 3px var(--accent); pointer-events:none; }
.tour-card{ position:fixed; z-index:81; width:340px; max-width:calc(100vw - 32px); background:var(--card); border:1px solid var(--line); border-radius:18px; padding:1rem 1.1rem; box-shadow:0 30px 60px -20px rgba(0,0,0,.45); }
.tour-card .step{ font:600 11.5px var(--font-body); color:var(--ink3); }
.tour-card h4{ font-family:var(--font-display); font-size:1.15rem; margin:.3rem 0 .35rem; }
.tour-card p{ margin:0 0 .8rem; font-size:14px; color:var(--ink2); line-height:1.5; }

/* in-page walkthrough (Proto.walkthrough) */
.wt-tabs{ display:flex; gap:.35rem; flex-wrap:wrap; border-bottom:1px solid var(--line); margin-bottom:.8rem; }
.wt-tab{ border:none; background:none; padding:.55rem .8rem; font:500 13.5px var(--font-body); color:var(--ink3); cursor:pointer; border-bottom:2px solid transparent; }
.wt-tab.on{ color:var(--ink); border-bottom-color:var(--brand600); }
.wt-step{ display:flex; align-items:center; justify-content:flex-start; gap:.6rem; width:100%; text-align:left; margin:.3rem 0; }
.wt-step.done{ opacity:.55; }
.wt-step .n{ display:grid; place-items:center; width:24px; height:24px; border-radius:99px; background:var(--brand100); color:var(--brand700); font:600 11px var(--font-mono); flex:0 0 24px; }
.state-panel dl{ display:grid; grid-template-columns:auto 1fr; gap:.35rem .9rem; margin:0; font-size:13.5px; }
.state-panel dt{ color:var(--ink3); }
.state-panel dd{ margin:0; font-weight:500; }
.changed{ animation:flash 1.2s ease; border-radius:6px; }
@keyframes flash{ 0%{ background:color-mix(in srgb,var(--accent) 45%,transparent); } 100%{ background:transparent; } }

/* variant switcher (variants.js) */
.variant-bar{ position:fixed; z-index:85; bottom:18px; left:50%; transform:translateX(-50%); display:flex; align-items:center; gap:.4rem; padding:.35rem; border-radius:99px; background:#111; color:#fff; box-shadow:0 18px 40px -12px rgba(0,0,0,.6); font:500 13px system-ui,sans-serif; }
.variant-bar button{ border:none; background:rgba(255,255,255,.12); color:#fff; width:30px; height:30px; border-radius:99px; cursor:pointer; }
.variant-bar span{ padding:0 .6rem; white-space:nowrap; }

/* animations */
@keyframes rise{ from{opacity:0; transform:translateY(14px);} to{opacity:1; transform:none;} }
.rise{ animation:rise .55s cubic-bezier(.2,.7,.2,1) both; }
@keyframes evt{ from{opacity:0; transform:translateX(-10px);} to{opacity:1; transform:none;} }
.evt-in{ animation:evt .45s cubic-bezier(.2,.8,.2,1) both; }
.d1{ animation-delay:.06s; } .d2{ animation-delay:.12s; } .d3{ animation-delay:.18s; } .d4{ animation-delay:.24s; } .d5{ animation-delay:.3s; } .d6{ animation-delay:.36s; }
@media (prefers-reduced-motion: reduce){ .rise,.evt-in,.changed{ animation:none; } }

/* layout helpers */
.row{ display:flex; gap:1rem; } .col{ display:flex; flex-direction:column; gap:1rem; } .wrap{ flex-wrap:wrap; }
.grid2{ display:grid; grid-template-columns:repeat(2,1fr); gap:1rem; }
.grid3{ display:grid; grid-template-columns:repeat(3,1fr); gap:1rem; }
.grid4{ display:grid; grid-template-columns:repeat(4,1fr); gap:1rem; }
.split{ display:grid; grid-template-columns:1.5fr 1fr; gap:1.2rem; }
@media(max-width:1100px){ .grid4,.grid3{ grid-template-columns:repeat(2,1fr); } }
@media(max-width:980px){ .split{ grid-template-columns:1fr; } }
@media(max-width:680px){ .grid2,.grid3,.grid4{ grid-template-columns:1fr; } }
/* no horizontal page scroll: grid children may shrink, wide tables scroll inside their card */
.split > *, .grid2 > *, .grid3 > *, .grid4 > *{ min-width:0; }
div:has(> table.grid){ overflow-x:auto; }
/* phone and tablet: each table row becomes a small card, the column name in front of each value (shell.js copies it into data-label) */
@media(max-width:860px){
  table.grid thead{ display:none; }
  table.grid, table.grid tbody, table.grid tr{ display:block; width:auto; }
  table.grid tr{ padding:.55rem 0; border-bottom:1px solid var(--line); }
  table.grid td{ display:block; position:relative; min-height:1.7em; padding:.22rem 0 .22rem 40%; border:0; text-align:left !important; min-width:0 !important; overflow-wrap:anywhere; }
  table.grid td::before{ content:attr(data-label); position:absolute; left:0; top:.22rem; width:37%; color:var(--ink3); font-size:12px; font-weight:600; }
  table.grid td[colspan]{ padding-left:0; }
  table.grid tbody tr:hover{ background:none; }
}
.muted{ color:var(--ink3); }
.nowrap{ white-space:nowrap; }

/* FEEL:START — Kreiss (kreiss.lv screenshot 2026-11-23):
   white header, black title bands with heavy white Open Sans, near-square red buttons,
   navy as the calm second colour. Actor coding: code = steel grey, AI = navy, person = Kreiss red. */
:root{ --label-case:none; --sb-bg1:#143852; --sb-bg2:#0E2A3E; --sb-ink:#EEF3F7; --black:#000;
  --act-code:#6B6A6B; --act-codebg:#EFEFF0; --act-ai:#143852; --act-aibg:#E3EAF0; --act-person:#E02625; --act-personbg:#FDECEC; }
.atmos{ background:var(--paper); }
.nav-link.active::before{ background:var(--brand600); }
.nav-link{ border-radius:4px; }
.brand .mark{ border-radius:4px; }
.btn,.btn-primary,.btn-ghost,.btn-disabled,.btn-sm,.btn-lg{ border-radius:4px; font-weight:600; }
.field{ border-radius:4px; }
.surface{ box-shadow:0 1px 2px rgba(0,0,0,.05); }
.kpi{ border-radius:6px; }
.menu,.tour-card{ border-radius:8px; }
.tour-spot{ border-radius:6px; box-shadow:0 0 0 9999px rgba(0,0,0,.5),0 0 0 3px var(--brand600); }
.eyebrow{ letter-spacing:0; font-weight:600; font-size:12px; }
.kpi .lbl{ letter-spacing:0; font-weight:600; font-size:12px; }
table.grid th{ letter-spacing:0; font-size:12px; }
h1,h2,h3,.h3{ font-weight:700; color:var(--ink-strong); }
/* black title band, as on the kreiss.lv hero */
.band{ display:inline-block; background:var(--black); color:#fff; font-family:var(--font-display); font-weight:800; line-height:1.1;
  padding:.35em .5em .4em; margin:0; letter-spacing:-.01em; }
.band.red{ background:var(--brand600); }
.page-title{ font-size:clamp(1.5rem,2.6vw,2.1rem); }
.lede{ font-size:15.5px; line-height:1.6; color:var(--ink2); max-width:68ch; margin:.7rem 0 0; }
/* actor chips: who does a step */
.act{ display:inline-flex; align-items:center; gap:.35rem; border-radius:3px; padding:.16rem .5rem; font-size:11.5px; font-weight:700; white-space:nowrap; }
.act::before{ content:""; width:7px; height:7px; border-radius:99px; background:currentColor; }
.act-code{ background:var(--act-codebg); color:var(--act-code); }
.act-ai{ background:var(--act-aibg); color:var(--act-ai); }
.act-person{ background:var(--act-personbg); color:var(--brand700); }
.lang-switch button{ min-width:30px; }
.st{ border-radius:3px; }
.chip{ border-radius:3px; }
.quote{ font-family:var(--font-body); background:#FFF8D6; border-left:3px solid #E5B800; padding:.15rem .45rem; font-size:12.5px; color:#3b3200; }
:focus-visible{ outline:2px solid var(--accent); outline-offset:2px; }
.sidebar .brand{ flex-direction:column; align-items:flex-start; gap:.55rem; }
.sidebar .brand .mark,.sidebar .brand .mark.wide{ width:auto; max-width:170px; height:38px; padding:0 .6rem; background:#fff; }
.sidebar .brand .mark img,.sidebar .brand .mark.wide img{ width:auto; height:24px; max-width:150px; }
.nav-group h4{ letter-spacing:.02em; font-size:11px; }
/* Night theme: the kreiss.lv hero look (black ground, white type, brand red) carried into the app.
   Toggle: data-theme="dark" on <html>, saved as proto.theme (ProtoTheme in data.js). */
:root[data-theme="dark"]{ color-scheme:dark;
  --paper:#0B1620; --paper2:#0F1D29; --cream:#0F1D29; --card:#132331;
  --ink:#D5DCE2; --ink2:#C2CBD3; --ink3:#93A0AC; --ink-strong:#F4F6F8;
  --line:#26394A; --line2:#1C2D3B;
  --brand50:#2A1517; --brand100:#3D191B; --brand200:#5C2022; --brand700:#FF6B6A;
  --accent:#6E9CC2; --black:#000;
  --sb-bg1:#0E2A3E; --sb-bg2:#081A27;
  --ok:#8DC163; --okbg:#1B2C16; --okink:#B6DA93;
  --warn:#E2AA4E; --warnbg:#382A12; --warnink:#F1CF8E;
  --info:#6FA9BE; --infobg:#12303B; --infoink:#A8D3E2;
  --plan:#B193BE; --planbg:#2C2134; --planink:#D8C5E0;
  --act-code:#A9B0B6; --act-codebg:#1F2C37; --act-ai:#8DB7DA; --act-aibg:#15324A; --act-person:#FF6B6A; --act-personbg:#3D191B; }
:root:root[data-theme="dark"]{ --bad:#D27BC8; --badbg:#36182F; --badink:#EDB9E6; }
[data-theme="dark"] .surface,[data-theme="dark"] .menu,[data-theme="dark"] .tour-card{ box-shadow:0 1px 2px rgba(0,0,0,.4),0 16px 40px -20px rgba(0,0,0,.7); }
[data-theme="dark"] .band{ box-shadow:0 0 0 1px #2E4153; }
[data-theme="dark"] .quote{ background:#3A3310; border-left-color:#E5B800; color:#F6E7A1; }
[data-theme="dark"] .tour-spot{ box-shadow:0 0 0 9999px rgba(0,0,0,.68),0 0 0 3px var(--brand600); }
/* supplier documents stay printed paper: day tokens inside */
[data-theme="dark"] .paper{ --ink:#474647; --ink2:#504F50; --ink3:#747374; --ink-strong:#1d1c1d; --line:#E2E3E4; --line2:#EDEDEE; --card:#fff; --paper:#f9fafb; color:var(--ink); }
[data-theme="dark"] img#logo{ background:#fff; padding:4px 8px; border-radius:3px; }
.theme-btn svg{ display:block; }
/* Attention: bell with count, nav badges, settings menu. Motion only while something is urgent. */
.bell-badge[hidden],.nav-badge[hidden]{ display:none; }
.bell-badge.calm{ background:var(--ink3); animation:none; }
.icon-btn{ position:relative; width:34px; padding:0; justify-content:center; }
.bell-badge,.nav-badge{ font-style:normal; display:inline-grid; place-items:center; min-width:18px; height:18px; padding:0 5px; border-radius:99px; font:700 11px/1 var(--font-body); }
.bell-badge{ position:absolute; top:-7px; right:-7px; background:var(--brand600); color:#fff; box-shadow:0 0 0 2px var(--card); animation:attn-jump 2.6s ease-in-out infinite; }
.has-urgent > svg{ transform-origin:50% 8%; animation:attn-ring 2.6s ease-in-out infinite; }
#proto-burger.has-urgent{ position:relative; }
#proto-burger.has-urgent::after{ content:""; position:absolute; top:3px; right:3px; width:9px; height:9px; border-radius:99px; background:var(--brand600); box-shadow:0 0 0 2px var(--card); animation:attn-jump 2.6s ease-in-out infinite; }
.nav-link .nav-badge{ margin-left:auto; background:rgba(255,255,255,.2); color:var(--sb-ink); }
.nav-link .nav-badge.urgent{ background:var(--brand600); color:#fff; animation:attn-jump 2.6s ease-in-out infinite, attn-pulse 2.6s ease-out infinite; }
@keyframes attn-jump{ 0%,22%,100%{ transform:translateY(0); } 7%{ transform:translateY(-6px); } 13%{ transform:translateY(0); } 17%{ transform:translateY(-2px); } }
@keyframes attn-ring{ 0%,24%,100%{ transform:rotate(0); } 4%{ transform:rotate(16deg); } 8%{ transform:rotate(-14deg); } 12%{ transform:rotate(10deg); } 16%{ transform:rotate(-6deg); } 20%{ transform:rotate(3deg); } }
@keyframes attn-pulse{ 0%{ box-shadow:0 0 0 0 color-mix(in srgb,var(--brand600) 70%,transparent); } 40%,100%{ box-shadow:0 0 0 8px transparent; } }
@media (prefers-reduced-motion: reduce){ .bell-badge,.has-urgent > svg,.nav-link .nav-badge.urgent,#proto-burger.has-urgent::after{ animation:none; } }
.attn-menu{ width:380px; max-width:calc(100vw - 24px); }
.attn-h{ margin:.5rem .65rem .2rem; font-size:11.5px; font-weight:700; color:var(--ink3); }
.attn-item{ display:flex; align-items:flex-start; gap:.65rem; padding:.6rem .65rem; border-radius:6px; border-left:3px solid transparent; }
.attn-item:hover{ background:var(--brand50); }
.attn-item.urgent{ border-left-color:var(--brand600); }
.attn-ic{ flex:0 0 auto; margin-top:2px; color:var(--ink3); }
.attn-item.urgent .attn-ic{ color:var(--brand600); }
.attn-tx{ flex:1; min-width:0; line-height:1.3; }
.attn-tx b{ display:block; font-size:14px; color:var(--ink-strong); }
.attn-tx span{ display:block; font-size:12px; color:var(--ink3); margin-top:.15rem; }
.attn-go{ flex:0 0 auto; align-self:center; font-size:12px; font-weight:700; color:var(--brand700); }
.attn-empty{ display:flex; align-items:center; gap:.5rem; margin:.3rem .65rem .6rem; font-size:14px; color:var(--ink2); }
.set-menu{ width:280px; }
.set-row{ display:flex; align-items:center; justify-content:space-between; gap:.8rem; padding:.5rem .65rem; font-size:13.5px; }
/* Tour narration: speaker toggle and progress line in the coach card */
.tour-head{ display:flex; align-items:flex-start; justify-content:space-between; gap:.6rem; }
.tour-voice{ flex:0 0 auto; display:grid; place-items:center; width:30px; height:30px; margin:-4px -4px 0 0; border:1px solid var(--line); border-radius:99px; background:var(--card); color:var(--ink3); cursor:pointer; }
.tour-voice.on{ color:var(--brand600); border-color:color-mix(in srgb,var(--brand600) 40%,var(--line)); }
.tour-voice.blocked{ color:#fff; background:var(--brand600); border-color:var(--brand600); animation:attn-jump 2.6s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce){ .tour-voice.blocked{ animation:none; } }
.tour-voice-bar{ height:2px; margin:.45rem 0 .1rem; background:var(--line2); border-radius:2px; overflow:hidden; }
.tour-voice-bar i{ display:block; height:100%; width:0; background:var(--brand600); transition:width .25s linear; }
/* FEEL:END */

/* ---- attachment viewer (original PDF page, full screen) ---- */
.att-open, .att-open body{ overflow:hidden; }
.att-lb{ position:fixed; inset:0; z-index:1000; display:flex; flex-direction:column; background:#0B1219; color:#fff; }
.att-bar{ display:flex; align-items:center; gap:.6rem; padding:.7rem 1rem; border-bottom:1px solid rgba(255,255,255,.12); }
.att-meta{ flex:1; min-width:0; display:flex; flex-direction:column; gap:.1rem; }
.att-meta b{ font-size:14px; }
.att-meta span{ font-size:12.5px; color:rgba(255,255,255,.7); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.att-x{ display:grid; place-items:center; width:38px; height:38px; border:1px solid rgba(255,255,255,.25); background:transparent; color:#fff; border-radius:4px; cursor:pointer; }
.att-x:hover, .att-x:focus-visible{ background:rgba(255,255,255,.12); }
.att-stage{ position:relative; flex:1; min-height:0; overflow:hidden; display:flex; align-items:center; justify-content:center; padding:1rem; touch-action:none; }
.att-stage img{ max-width:100%; max-height:100%; width:auto; height:auto; object-fit:contain; background:#fff; box-shadow:0 20px 60px rgba(0,0,0,.5); transform-origin:center; user-select:none; transition:transform .12s ease-out; }
.att-foot{ display:flex; flex-wrap:wrap; align-items:center; justify-content:center; gap:.8rem; padding:.6rem 1rem .8rem; font-size:12.5px; color:rgba(255,255,255,.65); }
.att-link{ display:inline-flex; align-items:center; gap:.35rem; border:0; background:none; padding:0; font:inherit; color:var(--brand700); font-weight:600; text-decoration:underline; text-underline-offset:2px; cursor:pointer; }
.att-thumb{ display:block; width:100%; padding:0; border:1px solid var(--line2); background:#fff; cursor:zoom-in; box-shadow:0 14px 34px -18px rgba(0,0,0,.45); }
.att-thumb img{ display:block; width:100%; height:auto; }
.att-thumb:focus-visible{ outline:3px solid var(--brand600); outline-offset:3px; }
@media (max-width:640px){ .att-bar{ flex-wrap:wrap; } .att-meta{ flex-basis:100%; } }
@media (prefers-reduced-motion:reduce){ .att-stage img{ transition:none; } }

/* ---- document side panel (slides in from the right) ---- */
.dp-open, .dp-open body{ overflow:hidden; }
.dp-wrap{ position:fixed; inset:0; z-index:900; }
.dp-back{ position:absolute; inset:0; background:rgba(8,14,20,.45); opacity:0; transition:opacity .25s ease; }
.dp{ position:absolute; top:0; right:0; bottom:0; width:min(620px, 100vw); display:flex; flex-direction:column; background:var(--card); color:var(--ink); box-shadow:-24px 0 60px -20px rgba(0,0,0,.45);
  transform:translateX(100%); transition:transform .26s cubic-bezier(.2,.8,.2,1); }
.dp-wrap.in .dp-back{ opacity:1; }
.dp-wrap.in .dp{ transform:none; }
.dp-head{ display:flex; align-items:flex-start; gap:.8rem; padding:1rem 1.2rem; border-bottom:1px solid var(--line); }
.dp-head > div{ flex:1; min-width:0; display:flex; flex-direction:column; gap:.15rem; }
.dp-head b{ font-size:16px; color:var(--ink-strong); }
.dp-head span{ font-size:13px; color:var(--ink3); }
.dp-x{ display:grid; place-items:center; width:38px; height:38px; flex:none; border:1px solid var(--line); background:var(--card); color:var(--ink); border-radius:4px; cursor:pointer; }
.dp-x:hover, .dp-x:focus-visible{ background:var(--brand50); }
.dp-body{ flex:1; overflow:auto; padding:1.1rem 1.2rem 1.6rem; }
.dp-facts{ display:grid; grid-template-columns:repeat(auto-fit, minmax(120px,1fr)); gap:.7rem 1rem; margin:0 0 1rem; }
.dp-facts dt{ font-size:12px; color:var(--ink3); }
.dp-facts dd{ margin:.1rem 0 0; font-weight:600; font-size:14px; }
.dp-page img{ aspect-ratio:210/160; object-fit:cover; object-position:top; }
.dp-cap{ font-size:12.5px; color:var(--ink3); margin:.45rem 0 0; }
.dp-mail{ background:var(--cream, var(--paper2)); border:1px solid var(--line2); padding:.8rem 1rem; font-size:13.5px; line-height:1.55; }
.dp-mail p{ margin:.3rem 0; }
.dp-h{ font-size:14px; margin:1.3rem 0 .5rem; color:var(--ink-strong); }
.dp-t{ width:100%; border-collapse:collapse; font-size:13px; }
.dp-t th{ text-align:left; font-size:11.5px; color:var(--ink3); font-weight:600; padding:.35rem .4rem; border-bottom:1px solid var(--line); }
.dp-t td{ padding:.5rem .4rem; border-bottom:1px solid var(--line2); vertical-align:top; }
.dp-t td .quote{ display:block; margin-top:.3rem; width:fit-content; }
.dp-t .r{ text-align:right; white-space:nowrap; }
.dp-t tr.hl td, .dp-mail p.hl{ background:#FFF8D6; }
[data-theme="dark"] .dp-t tr.hl td, [data-theme="dark"] .dp-mail p.hl{ background:#3A3310; }

@media (prefers-reduced-motion:reduce){ .dp, .dp-back{ transition:none; } }
.dp-wrap.no-anim .dp, .dp-wrap.no-anim .dp-back{ transition:none; }
.dp-links{ display:flex; flex-wrap:wrap; gap:.6rem 1.2rem; margin-top:1.1rem; }
.dp-links a{ display:inline-flex; align-items:center; gap:.35rem; font-size:13px; font-weight:600; color:var(--brand700); text-decoration:underline; text-underline-offset:2px; }
.dp-ai{ display:flex; flex-wrap:wrap; align-items:center; gap:.45rem; font-size:13px; margin:0 0 1rem; }
.dp-body-text{ white-space:pre-wrap; font-size:13.5px; line-height:1.6; background:var(--paper2); border:1px solid var(--line2); padding:.9rem 1rem; overflow-wrap:anywhere; }
