/* THE DOCUMENT PAGE (#2477). Design of record: screen `docpage` in docs/design/platform/email-platform-mock.html
   (approved 26 Sep 2026). The first three blocks are that prototype's canonical token head, verbatim; the
   component rules are the prototype's, with each of its inline style="…" attributes turned into a class,
   because the CSP (staticwebapp.config.json) allows no inline style. */

/* Tokens mirrored from stoktake/apps/web/_shared/styles/_global.scss. Three theme states:
   bare :root is light, [data-theme="dark"] is the explicit choice, and the media query
   covers the un-stamped default. No literal colour is defined only inside a dark block. */
:root{
  --primary-500:#ec6c3f; --primary-600:#dd5228; --primary-700:#b83e1f; --primary-800:#933220;
  --success-600:#16a34a; --success-700:#15803d;
  --warning-600:#d97706; --warning-700:#b45309;
  --danger-600:#dc2626; --danger-700:#b91c1c;
  --neutral-50:#fafaf9; --neutral-100:#f5f5f4; --neutral-200:#e7e5e4; --neutral-300:#d6d3d1;
  --neutral-400:#a8a29e; --neutral-500:#78716c; --neutral-600:#57534e; --neutral-700:#44403c;
  --neutral-800:#292524; --neutral-900:#1c1917; --neutral-950:#0c0a09;
  --bg-canvas:#ffffff; --bg-surface:#ffffff; --bg-sunken:var(--neutral-50);
  --bg-hover:var(--neutral-100); --bg-active:var(--neutral-200);
  --text-heading:var(--neutral-900); --text-body:var(--neutral-700);
  --text-muted:var(--neutral-500); --text-subtle:var(--neutral-400);
  --border-default:var(--neutral-200); --border-faint:var(--neutral-100);
  --border-strong:var(--neutral-300);
  --accent:var(--primary-600);
  --bad-bg:#fee2e2; --bad-fg:var(--danger-700); --bad-edge:#fca5a5;
  --warn-bg:#fef3c7; --warn-fg:var(--warning-700); --warn-edge:#fcd34d;
  --ok-bg:#dcfce7; --ok-fg:var(--success-700); --ok-edge:#86efac;
}
:root[data-theme="dark"]{
  --bg-canvas:var(--neutral-950); --bg-surface:var(--neutral-900); --bg-sunken:var(--neutral-950);
  --bg-hover:var(--neutral-800); --bg-active:var(--neutral-700);
  --text-heading:#ffffff; --text-body:var(--neutral-300);
  --text-muted:var(--neutral-400); --text-subtle:var(--neutral-500);
  --border-default:rgba(255,255,255,.09); --border-faint:rgba(255,255,255,.05);
  --border-strong:rgba(255,255,255,.16);
  --accent:#f48f44;
  --bad-bg:rgba(127,29,29,.4); --bad-fg:#fca5a5; --bad-edge:rgba(248,113,113,.45);
  --warn-bg:rgba(120,53,15,.4); --warn-fg:#fcd34d; --warn-edge:rgba(252,211,77,.4);
  --ok-bg:rgba(20,83,45,.4); --ok-fg:#86efac; --ok-edge:rgba(134,239,172,.4);
}
@media (prefers-color-scheme:dark){
  :root:not([data-theme="light"]){
    --bg-canvas:var(--neutral-950); --bg-surface:var(--neutral-900); --bg-sunken:var(--neutral-950);
    --bg-hover:var(--neutral-800); --bg-active:var(--neutral-700);
    --text-heading:#ffffff; --text-body:var(--neutral-300);
    --text-muted:var(--neutral-400); --text-subtle:var(--neutral-500);
    --border-default:rgba(255,255,255,.09); --border-faint:rgba(255,255,255,.05);
    --border-strong:rgba(255,255,255,.16);
    --accent:#f48f44;
    --bad-bg:rgba(127,29,29,.4); --bad-fg:#fca5a5; --bad-edge:rgba(248,113,113,.45);
    --warn-bg:rgba(120,53,15,.4); --warn-fg:#fcd34d; --warn-edge:rgba(252,211,77,.4);
    --ok-bg:rgba(20,83,45,.4); --ok-fg:#86efac; --ok-edge:rgba(134,239,172,.4);
  }
}

/* ── the prototype's own tokens this page uses: defined here first, then in both dark blocks ── */
:root{
  --mono:ui-monospace,"Cascadia Mono",Consolas,monospace;
  --p-wash:color-mix(in srgb,var(--accent) 8%,var(--bg-surface));
  --on-accent:#ffffff;
  --sw-orange:#dd5228;
}
:root[data-theme="dark"]{
  color-scheme:dark;
  --p-wash:color-mix(in srgb,var(--accent) 10%,var(--bg-surface));
  --on-accent:#ffffff;
  --sw-orange:#dd5228;
}
@media (prefers-color-scheme:dark){
  :root:not([data-theme="light"]){
    color-scheme:dark;
    --p-wash:color-mix(in srgb,var(--accent) 10%,var(--bg-surface));
    --on-accent:#ffffff;
    --sw-orange:#dd5228;
  }
}

/* ── base ── */
*{box-sizing:border-box}
html,body{margin:0;padding:0}
/* The page is the prototype's browser window: its content sits on the surface colour, 14px/1.5 as in .app. */
body{background:var(--bg-surface);color:var(--text-body);
  font:14px/1.5 ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
  -webkit-font-smoothing:antialiased;min-height:100vh}
button{font:inherit;color:inherit;margin:0;cursor:pointer}
button:disabled{cursor:not-allowed;opacity:.5}
:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
[tabindex="-1"]:focus{outline:none}
[hidden]{display:none !important}
h1,h2,h3,p,ul{margin:0}
ul{padding:0;list-style:none}
.mono{font-family:var(--mono)}
.hint{font-size:12px;color:var(--text-muted);line-height:1.5}
.eyebrow{display:block;font-size:11px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;color:var(--text-subtle)}
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
@media (prefers-reduced-motion:reduce){*,*::before,*::after{animation:none !important;transition:none !important}}

/* ── buttons (a download is a link styled as one) ── */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;border:1px solid var(--border-strong);background:var(--bg-surface);color:var(--text-heading);border-radius:7px;padding:5px 12px;font-size:13px;font-weight:500;white-space:nowrap;line-height:1.4;min-height:32px;text-decoration:none}
.btn:hover:not(:disabled){background:var(--bg-hover)}
.btn.pri{background:var(--accent);border-color:var(--accent);color:var(--on-accent);font-weight:600}
.btn.pri:hover:not(:disabled){filter:brightness(.94);background:var(--accent)}
.btn.sm{padding:3px 9px;font-size:12.5px;min-height:26px;border-radius:6px}

/* ── cards, notes, files ── */
.card{border:1px solid var(--border-default);border-radius:10px;background:var(--bg-surface);overflow:hidden}
.card+.card{margin-top:14px}
.card-h{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:9px 14px;border-bottom:1px solid var(--border-faint);flex-wrap:wrap}
.card-h h2{font-size:13.5px;font-weight:600;color:var(--text-heading)}
.card-h .hint{font-size:12px}
.card-b{padding:12px 14px}
.note{border-left:3px solid var(--border-strong);background:var(--bg-sunken);padding:9px 12px;border-radius:0 8px 8px 0;font-size:13px;line-height:1.5}
.note:empty{display:none}
.note b{color:var(--text-heading)}
.note.warn{border-left-color:var(--warn-edge);background:var(--warn-bg);color:var(--warn-fg)}.note.warn b{color:inherit}
.note.bad{border-left-color:var(--bad-edge);background:var(--bad-bg);color:var(--bad-fg)}.note.bad b{color:inherit}
.note.ok{border-left-color:var(--ok-edge);background:var(--ok-bg);color:var(--ok-fg)}.note.ok b{color:inherit}
.files{border:1px solid var(--border-default);border-radius:10px;overflow:hidden;background:var(--bg-surface)}
.card .files{border:0;border-radius:0}
.file{display:flex;align-items:center;gap:10px;padding:8px 10px;border-top:1px solid var(--border-faint);flex-wrap:wrap}
.file:first-child{border-top:0}
.plate{width:34px;height:34px;border-radius:7px;background:var(--bg-hover);display:grid;place-items:center;font-size:9.5px;font-weight:700;color:var(--text-muted);flex:none}
.plate.pdf{background:var(--p-wash);color:var(--accent)}
.fmeta{min-width:0;flex:1 1 160px}
.fname{font-size:13px;color:var(--text-heading);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.fsub{font-size:11.5px;color:var(--text-muted)}

/* ── the document page ── */
.docpage{max-width:720px;margin:0 auto;padding:28px 20px 40px}
.doc-brand{display:flex;align-items:center;gap:12px;margin-bottom:18px}
.doc-brand b{display:block;font-size:15px;color:var(--text-heading)}
.doc-brand div span{font-size:12px;color:var(--text-muted)}
.mail-logo{width:40px;height:40px;border-radius:9px;background:var(--sw-orange);color:var(--on-accent);display:grid;place-items:center;font-weight:800;font-size:15px;letter-spacing:.02em;flex:none}
.doc-main{padding:18px}
.doc-title{font-size:24px;font-weight:700;color:var(--text-heading);letter-spacing:-.01em;line-height:1.3;overflow-wrap:anywhere}
.doc-dl{margin-top:16px;white-space:normal;text-align:center}
.doc-none{margin-top:10px}
/* The summary's figures (#2494): the prototype's .doc-kpis boxes, as a <dl> — dt is its label span, dd its
   value. The amount due is marked with a class rather than :first-child, so a summary without one never
   paints its due date in the accent. */
.doc-kpis{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:12px;margin:14px 0 16px}
.doc-kpis div{background:var(--bg-sunken);border:1px solid var(--border-faint);border-radius:8px;padding:10px 12px;min-width:0}
.doc-kpis dt{display:block;font-size:11px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:var(--text-subtle)}
.doc-kpis dd{margin:0;font-size:18px;font-weight:700;color:var(--text-heading);font-variant-numeric:tabular-nums;letter-spacing:-.01em;overflow-wrap:anywhere}
.doc-kpis .is-due dd{color:var(--accent);font-size:22px}
.doc-kpis+.doc-dl,.doc-kpis+.doc-none{margin-top:0}
/* A voided document (#2502): the prototype's .note in its warn tone holds the page's heading above the
   document card — the cancelled screen's calm words, not an error — and a short History card lists what
   happened, one line per date. Nothing in it is a call to action. */
.doc-void{margin-bottom:14px;padding:12px 14px}
.doc-void h1{font-size:15px;font-weight:700;line-height:1.35;margin-bottom:4px;color:inherit}
.doc-void p{color:inherit}
.doc-history{margin:0;padding:4px 14px 8px;list-style:none}
.doc-history li{display:flex;align-items:baseline;justify-content:space-between;gap:12px;padding:7px 0;border-top:1px solid var(--border-faint);font-size:13px;color:var(--text-heading)}
.doc-history span{min-width:0;overflow-wrap:anywhere}
.doc-history li:first-child{border-top:0}
.doc-history time{color:var(--text-muted);font-variant-numeric:tabular-nums;white-space:nowrap}
.doc-history li.is-voided span{color:var(--warn-fg);font-weight:600}
.doc-foot{margin-top:14px}
.doc-foot .subtle{margin-top:6px;color:var(--text-subtle)}
.doc-center{text-align:center;padding:36px 20px}
.doc-center h1{font-size:20px;font-weight:700;color:var(--text-heading);margin-bottom:8px;line-height:1.3}
.doc-center h1.is-loading{color:var(--text-muted);font-weight:600;margin-bottom:0}
.doc-center p{max-width:46ch;margin:0 auto 16px;color:var(--text-muted);line-height:1.55}
.doc-center .note{margin-top:16px;text-align:left}
@media (max-width:720px){.docpage{padding:18px 14px 28px}}
