/* ═══════════════════════════════════════════════════════════════════
   SCHOLARSNODE · admin — printed in Treu's back-office language (sure-escrow-contracts/backend/Treu.Api/
   wwwroot/admin/admin.css), minus the stamps. Tokens, spacing, dividers, the rail, the dropdown,
   the modal and the gate mirror it; states are typewriter tags instead of stamps. No frameworks.
   ═══════════════════════════════════════════════════════════════════ */
/* The app's palette — "the drafting set" (app/frontend/global.css, rn-stylefn.config.js, design/NOTES.md):
   vellum surfaces, graphite text and edges, rule hairlines, one semantic red. Chrome invents no hue — actions
   are graphite; no accent hue. Dark = slate. Treu's structure stays. */
:root {
  --paper-page: #EEF0EA; --paper-doc: #FFFFFF;
  --ink: #212428; --ink-soft: #626970; --ink-faint: #9AA19B;
  --biro: #212428; --carbon: #DFE3DA; --active: #CDD3C8; --muted: #E6E9E2; --rule: #C3C9BE;
  --red: #C7382B; --green: #1E6E45; --hold: #8A6D1A; --dot: #24345C;
  --wm: rgba(33, 36, 40, 0.05); --scrim: rgba(33, 36, 40, 0.42);
  --ease-stamp: cubic-bezier(0.16, 1, 0.3, 1);
  /* aliases the charts use */
  --graphite: var(--ink); --graphite-soft: var(--ink-soft); --graphite-faint: var(--ink-faint); --live: var(--red); --ok: var(--green); --vellum-deep: #DFE3DA;
  --archivo: "Archivo", "Archivo Narrow", Impact, sans-serif; --font: "Public Sans", system-ui, sans-serif; --mono: "Courier Prime", "Courier New", monospace;
}
/* Scheme: the app drives dark/light manually (Menu → Theme); the admin does the same from the rail foot
   (light · dark · system, localStorage ink.admin.theme → <html data-theme>). System = the OS setting. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper-page: #262A2D; --paper-doc: #30353A;
    --ink: #ECEEE8; --ink-soft: #A2A9A3; --ink-faint: #6B726C;
    --biro: #ECEEE8; --carbon: #3A4046; --active: #454B52; --muted: #2B2F33; --rule: #3D4348;
    --red: #E0503F; --green: #4FB57C; --hold: #D0AC55; --dot: #8FA3D6;
    --wm: rgba(236, 238, 232, 0.06); --scrim: rgba(15, 17, 19, 0.6); --vellum-deep: #3A4046;
  }
}:root[data-theme="dark"] {
    --paper-page: #262A2D; --paper-doc: #30353A;
    --ink: #ECEEE8; --ink-soft: #A2A9A3; --ink-faint: #6B726C;
    --biro: #ECEEE8; --carbon: #3A4046; --active: #454B52; --muted: #2B2F33; --rule: #3D4348;
    --red: #E0503F; --green: #4FB57C; --hold: #D0AC55; --dot: #8FA3D6;
    --wm: rgba(236, 238, 232, 0.06); --scrim: rgba(15, 17, 19, 0.6); --vellum-deep: #3A4046;
  }


* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { background: var(--paper-page); -webkit-font-smoothing: antialiased; }
body { background: var(--paper-page); color: var(--ink); font-family: var(--font); font-size: 14px; line-height: 1.5; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
b { font-weight: 700; }
::selection { background: var(--active); }

/* ── type roles ── */
.mono, .tnum, .code, .serial { font-family: var(--mono); }
.small { font-size: 12px; }
.soft, .muted { color: var(--ink-soft); }
.center { text-align: center; }
.label { font-size: 10px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-soft); }
.serial { font-size: 12px; letter-spacing: 0.06em; color: var(--ink-soft); }
.serial.faint { color: var(--ink-faint); }
.meta { font-family: var(--mono); font-size: 12px; color: var(--ink-soft); }
.kicker { font-size: 12px; letter-spacing: 0.12em; color: var(--ink-soft); text-transform: uppercase; font-weight: 600; }
.h1, .page-head h1 { font-family: var(--archivo); font-variation-settings: "wdth" 82, "wght" 800; font-size: clamp(28px, 4vw, 40px); line-height: 1.05; text-transform: uppercase; padding: 8px 0 4px; }
.h1-sub { font-family: var(--mono); font-size: 12.5px; color: var(--ink-soft); text-transform: none; letter-spacing: 0.04em; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.gap8 { gap: 8px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.code { font-weight: 700; letter-spacing: 0.22em; font-size: 15px; }
.err, .note-err { font-family: var(--mono); font-size: 12px; color: var(--red); }
.err:empty { display: none; }
.note-ok { font-family: var(--mono); font-size: 12px; color: var(--green); }

/* ── the masthead (gate + rail brand) ── */
.masthead { font-family: var(--archivo); font-variation-settings: "wdth" 76, "wght" 900; font-size: clamp(36px, 6.4vw, 56px); line-height: 0.92; text-transform: uppercase; letter-spacing: 0.02em; user-select: none; }
.masthead .dot { color: var(--dot); }
.masthead-letter { display: inline-block; transform: translateY(0.35em); opacity: 0; animation: letter-land 560ms var(--ease-stamp) forwards; }
.masthead-letter:nth-child(2) { animation-delay: 70ms; }
.masthead-letter:nth-child(3) { animation-delay: 140ms; }
.masthead-letter:nth-child(4) { animation-delay: 210ms; }
.masthead-letter:nth-child(5) { animation-delay: 280ms; }
@keyframes letter-land { to { transform: translateY(0); opacity: 1; } }
.masthead-rule { height: 3px; background: var(--ink); margin-top: 12px; transform-origin: left; animation: rule-draw 700ms 300ms var(--ease-stamp) backwards; }
@keyframes rule-draw { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.masthead-sub { display: flex; justify-content: space-between; padding-top: 8px; }

/* ── the gate: one document on the desk ── */
#gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.gate-hero { width: 480px; max-width: 94vw; }
.gate-doc-wrap { margin-top: 26px; filter: drop-shadow(0 10px 22px rgba(25, 25, 23, 0.10)); }
.gate-doc { background: var(--paper-doc); border: 1px solid var(--rule); border-bottom: none; padding: 26px 28px 22px; position: relative; overflow: hidden; }
.gate-doc .watermark { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.gate-doc .watermark span { font-family: var(--archivo); font-variation-settings: "wdth" 90, "wght" 900; font-size: 54px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--wm); transform: rotate(-18deg); white-space: nowrap; }
.gate-title { font-family: var(--archivo); font-variation-settings: "wdth" 82, "wght" 800; font-size: 18px; letter-spacing: 0.04em; text-transform: uppercase; text-align: center; padding-bottom: 6px; position: relative; }
.gate-copy { font-size: 13.5px; color: var(--ink-soft); text-align: center; margin: 0 auto 18px; max-width: 42ch; position: relative; }
.gate-form { display: flex; flex-direction: column; gap: 10px; position: relative; }
.gate-form .btn { width: 100%; padding: 13px 16px; font-size: 13px; margin-top: 4px; }
.gate-err { font-family: var(--mono); font-size: 12px; color: var(--red); text-align: center; padding-top: 10px; position: relative; }
.gate-err:empty { display: none; }
.gate-dev { margin-top: 18px; border-top: 1px solid var(--rule); padding-top: 12px; position: relative; }
.gate-dev summary { color: var(--ink-soft); cursor: pointer; font-size: 11.5px; list-style: none; font-family: var(--mono); }
.gate-dev summary::-webkit-details-marker { display: none; }
.gate-dev summary:hover { color: var(--biro); }
.gate-dev .row { margin-top: 10px; flex-wrap: nowrap; }
.doc-tear { display: block; width: 100%; height: 14px; margin-top: -1px; overflow: visible; }

/* ── the office shell: the vertical rail ── */
#office { display: grid; grid-template-columns: 224px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; padding: 26px 20px 20px; border-right: 1px solid var(--rule); background: color-mix(in srgb, var(--paper-page) 92%, transparent); }
.side-brand { font-family: var(--archivo); font-variation-settings: "wdth" 76, "wght" 900; font-size: 22px; text-transform: uppercase; letter-spacing: 0.04em; line-height: 1; }
.side-brand .dot { color: var(--dot); padding: 0 1px; }
.side-brand-rule { height: 3px; background: var(--ink); margin-top: 8px; transform-origin: left; animation: rule-draw 700ms 150ms var(--ease-stamp) backwards; }
.sidenav { position: relative; margin-top: 18px; display: flex; flex-direction: column; }
.sidenav .group { font-size: 9.5px; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-faint); padding: 12px 12px 3px; }
.sidenav .group:first-child { padding-top: 0; }
.sidenav a { position: relative; font-family: var(--archivo); font-variation-settings: "wdth" 82, "wght" 700; font-size: 12.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-soft); padding: 7px 12px; transition: color 200ms, transform 200ms var(--ease-stamp); }
.sidenav a:hover { color: var(--ink); transform: translateX(3px); }
.sidenav a.on { color: var(--ink); font-variation-settings: "wdth" 82, "wght" 800; transform: translateX(6px); }
/* the marker: one biro bar that SLIDES to the active drawer */
.nav-marker { position: absolute; left: 0; width: 3px; height: 20px; background: var(--biro); border-radius: 1px; opacity: 0; transition: transform 380ms var(--ease-stamp), height 380ms var(--ease-stamp), opacity 200ms; }
.nav-marker.set { opacity: 1; }
.badge { font-family: var(--mono); font-size: 10px; font-weight: 700; color: var(--paper-doc); background: var(--red); border-radius: 8px; padding: 1px 6px; margin-left: 6px; vertical-align: 2px; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding-top: 14px; border-top: 1px solid var(--rule); }
.copy-tag { font-family: var(--archivo); font-variation-settings: "wdth" 75, "wght" 700; font-size: 9.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--biro); border: 1.5px solid var(--biro); padding: 3px 8px; border-radius: 2px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lock-link { font-family: var(--mono); font-size: 11.5px; color: var(--ink-soft); cursor: pointer; border: none; background: none; padding: 0; }
.side-foot .tabs { margin: 0; }
.side-foot .tabs a { cursor: pointer; }
.lock-link:hover { color: var(--red); }
/* width:100% matters: a grid item with auto margins otherwise SHRINKS to fit its content */
.main { width: 100%; max-width: 1180px; margin: 0 auto; padding: clamp(28px, 5vh, 48px) clamp(18px, 4vw, 48px) 80px; }
/* view reveals: paper rises onto the desk */
.reveal { opacity: 0; transform: translateY(22px); animation: rise 520ms var(--ease-stamp) forwards; }
@keyframes rise { to { opacity: 1; transform: translateY(0); } }
@media (max-width: 900px) {
  #office { grid-template-columns: 1fr; }
  .side { position: static; height: auto; overflow: visible; border-right: 0; border-bottom: 1px solid var(--rule); padding: 18px 16px; }
  .sidenav { flex-direction: row; flex-wrap: wrap; gap: 0 4px; margin-top: 12px; }
  .sidenav .group, .nav-marker, .side-foot { display: none; }
  .sidenav a.on, .sidenav a:hover { transform: none; }
}

/* ── page head: kicker · Archivo display · mono serial ── */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; padding: 0 0 6px; }
.page-head .crumbs { font-family: var(--mono); font-size: 12.5px; color: var(--ink-soft); letter-spacing: 0.04em; }
.page-head .crumbs a { border-bottom: 1.5px solid transparent; }
.page-head .crumbs a:hover { color: var(--biro); border-color: var(--biro); }
.page-head .h1-sub { display: block; padding-top: 2px; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }

/* ── the record strip: stat tiles under a 2px rule ── */
.grid { display: grid; gap: 22px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid + .card, .grid + .grid, .card + .grid, .card + .card, .card + .tabs, .grid + .tabs, .page-head + .card, .tabs + .card, .card + .two-col, .two-col + .card { margin-top: 18px; }
.grid > .card, .grid > .grid, .two-col > .card { margin-top: 0; }
.page-head + .grid:has(> .kpi) { margin-top: 16px; }
@media (max-width: 1000px) { .grid.c3, .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.grid:has(> .kpi) { display: grid; gap: 14px 22px; grid-template-columns: repeat(4, 1fr); margin: 22px 0 26px; }
.grid:has(> .kpi) + .grid:has(> .kpi) { margin-top: 0; }
@media (max-width: 1100px) { .grid:has(> .kpi) { grid-template-columns: repeat(2, 1fr); } }
.kpi { padding: 16px 0 14px; border-top: 2px solid var(--ink); display: grid; gap: 4px; }
.kpi .big { font-size: clamp(26px, 3vw, 38px); font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; font-family: var(--font); }
.kpi.mono .big { font-family: var(--mono); }
.kpi.blue { border-top-color: var(--biro); } .kpi.blue .big { color: var(--biro); }
.kpi.green { border-top-color: var(--green); } .kpi.green .big { color: var(--green); }
.kpi.red { border-top-color: var(--red); } .kpi.red .big { color: var(--red); }
.kpi.hold { border-top-color: var(--hold); } .kpi.hold .big { color: var(--hold); }
.card .grid:has(> .kpi) { margin: 0 0 14px; }
.dialog .grid:has(> .kpi) { margin: 0; }

/* ── sheets (documents on the desk) ── */
.card { background: var(--paper-doc); border: 1px solid var(--rule); box-shadow: 0 6px 18px rgba(25, 25, 23, 0.07); padding: 18px 20px; position: relative; }
.card > h2 { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-family: var(--font); font-size: 10px; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-soft); padding-bottom: 8px; margin-bottom: 12px; border-bottom: 1px solid var(--rule); min-height: 30px; }
.card > h2 .meta { text-transform: none; letter-spacing: 0.04em; font-weight: 400; }
.card > h2 .btn { flex: none; }
.card > .label { margin-bottom: 8px; }
.card.blue { border-top: 2px solid var(--biro); }
.card.hold { border-top: 2px solid var(--hold); }
/* the section label: small caps with a rule running to the edge */
.section-label { font-size: 10px; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-soft); margin: 26px 0 10px; display: flex; align-items: center; gap: 12px; }
.section-label::after { content: ""; flex: 1; border-bottom: 1px solid var(--rule); }
.rule { height: 1px; background: var(--rule); margin: 14px 0; }
/* the statement — typewritten, carbon behind */
.statement { font-family: var(--mono); font-size: 13.5px; line-height: 1.65; white-space: pre-wrap; background: var(--carbon); padding: 14px 16px; border-left: 3px solid var(--biro); }
/* the bench — a carbon section between two ink rules, for the actions that move things */
.bench { background: var(--carbon); border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink); padding: 20px 24px; margin-top: 26px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: start; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }
.queue-links { display: grid; gap: 10px; margin-top: 4px; }
.queue-links a { font-family: var(--mono); font-size: 13.5px; color: var(--ink); border-bottom: 1px solid var(--rule); padding-bottom: 8px; transition: color 140ms; }
.queue-links a:hover { color: var(--biro); }

/* ── controls: Archivo uppercase, biro actions ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; text-decoration: none; font-family: var(--archivo); font-variation-settings: "wdth" 85, "wght" 700; font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; line-height: 1.2; padding: 9px 14px; border-radius: 3px; border: 2px solid var(--biro); color: var(--biro); background: transparent; white-space: nowrap; transition: transform 140ms var(--ease-stamp), box-shadow 140ms, background 140ms, border-color 140ms, color 140ms; }
.btn:hover { background: var(--carbon); transform: translateY(-2px); }
.btn:active { transform: translateY(1px) scale(0.99); }
.btn.primary { background: var(--biro); color: var(--paper-doc); }
.btn.primary:hover { background: var(--biro); box-shadow: 0 6px 18px rgba(33, 36, 40, 0.22); }
.btn.ghost, .btn.quiet { border-color: var(--rule); color: var(--ink-soft); }
.btn.ghost:hover, .btn.quiet:hover { background: transparent; border-color: var(--ink); color: var(--ink); }
.btn.danger { color: var(--red); border-color: var(--red); }
.btn.danger:hover { background: var(--red); color: var(--paper-doc); }
.btn.ok { color: var(--green); border-color: var(--green); }
.btn.ok:hover { background: var(--green); color: var(--paper-doc); }
.btn.sm { font-size: 10.5px; letter-spacing: 0.08em; padding: 5px 10px; border-width: 1.5px; }
.btn:disabled, .btn[disabled] { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }
.grid > .btn, .kvs + .btn { justify-self: start; }
.btn:focus-visible, .tsel-btn:focus-visible, .input:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.input, textarea.input, select.input { font-family: var(--font); font-size: 13.5px; color: var(--ink); border: 1.5px solid var(--rule); background: var(--paper-doc); border-radius: 3px; padding: 10px 12px; width: 100%; transition: border-color 140ms; }
.input::placeholder { color: var(--ink-faint); }
.input:focus, textarea.input:focus { outline: none; border-color: var(--biro); }
.input[readonly], .input:disabled { color: var(--ink-soft); background: var(--paper-page); }
.input.mono, .input[type=number] { font-family: var(--mono); }
textarea.input { resize: vertical; min-height: 72px; line-height: 1.5; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 10px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-soft); }
.field .hint { font-size: 11.5px; color: var(--ink-faint); }
/* typewriter tick rows: [x] picked, [ ] not */
.check { display: flex; align-items: center; gap: 10px; font-family: var(--mono); font-size: 14px; padding: 9px 2px; cursor: pointer; }
.check:has(+ .check) { border-bottom: 1px solid var(--rule); }
.check input { position: absolute; opacity: 0; width: 0; height: 0; }
.check .box { font-weight: 700; color: var(--ink-soft); }
.check .box::before { content: "[ ]"; }
.check:has(input:checked) .box { color: var(--biro); }
.check:has(input:checked) .box::before { content: "[x]"; }
.check:has(input:checked) .opt { font-weight: 700; }
/* tags: typewriter states — never stamps */
.chip { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border: 1.5px solid var(--rule); border-radius: 2px; font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft); background: var(--paper-doc); white-space: nowrap; }
.chip.ok { color: var(--green); border-color: var(--green); }
.chip.bad { color: var(--red); border-color: var(--red); }
.chip.ink, .chip.on { color: var(--ink); border-color: var(--ink); background: var(--carbon); }
.chip.faint { color: var(--ink-faint); border-style: dashed; }
.filter-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 0 0 16px; }
/* tabs: the app's tab list — a muted track with the active pill wash (ui/base/Tabs.tsx: track pad 4, radius 4; pill radius 2; trigger 14×6, 13px/500) */
.tabs { display: flex; width: max-content; max-width: 100%; align-items: center; gap: 2px; background: var(--muted); padding: 4px; border-radius: 4px; margin-bottom: 18px; overflow-x: auto; }
.tabs a { display: inline-flex; align-items: center; min-height: 28px; padding: 6px 14px; border-radius: 2px; font-family: var(--font); font-size: 13px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--ink-soft); white-space: nowrap; transition: background 200ms var(--ease-stamp), color 160ms; }
.tabs a:hover { color: var(--ink); }
.tabs a.on { background: var(--active); color: var(--ink); }
.tabs.sub { padding: 2px; margin-bottom: 14px; }
.tabs.sub a { min-height: 24px; padding: 4px 10px; font-size: 12px; }

/* ── the select, in house style — no OS chrome ── */
.tsel { position: relative; width: 100%; min-width: 0; }
.tsel-btn { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; text-align: left; cursor: pointer; font-family: var(--font); font-size: 13.5px; color: var(--ink); border: 1.5px solid var(--rule); background: var(--paper-doc); border-radius: 3px; padding: 10px 12px; transition: border-color 140ms; }
.tsel-btn:hover, .tsel.open .tsel-btn { border-color: var(--biro); }
.tsel-val { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tsel-ch { font-family: var(--mono); font-size: 11px; color: var(--ink-soft); transition: transform 240ms var(--ease-stamp); flex: none; }
.tsel.open .tsel-ch { transform: rotate(180deg); color: var(--biro); }
.tsel-menu { position: absolute; top: calc(100% + 6px); left: 0; right: 0; min-width: 160px; z-index: 30; background: var(--paper-doc); border: 1px solid var(--rule); border-top: 2px solid var(--ink); filter: drop-shadow(0 14px 30px rgba(25, 25, 23, 0.16)); transform-origin: top; transform: scaleY(0.85) translateY(-6px); opacity: 0; pointer-events: none; transition: transform 240ms var(--ease-stamp), opacity 160ms; max-height: 280px; overflow-y: auto; }
.tsel.open .tsel-menu { transform: none; opacity: 1; pointer-events: auto; }
.tsel-opt { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 10px 12px; font-size: 13px; cursor: pointer; border-bottom: 1px solid var(--rule); transition: background 120ms, padding-left 160ms var(--ease-stamp); }
.tsel-opt:last-child { border-bottom: none; }
.tsel-opt:hover { background: var(--carbon); padding-left: 16px; }
.tsel-opt.sel { color: var(--biro); font-weight: 600; }
.tsel-opt.sel::after { content: "✓"; font-family: var(--mono); font-weight: 700; }
.tsel.sm .tsel-btn { padding: 4px 8px; font-size: 12px; }
.tsel.sm .tsel-opt { padding: 7px 10px; font-size: 12px; }
.tsel.up .tsel-menu { top: auto; bottom: calc(100% + 6px); transform-origin: bottom; }

/* ── ledgers ── */
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-family: var(--font); font-size: 10px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-soft); padding: 11px 14px; border-bottom: 2px solid var(--ink); }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.tbl th:first-child, .tbl td:first-child { padding-left: 4px; }
.tbl th:last-child, .tbl td:last-child { padding-right: 4px; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.clickable { cursor: pointer; }
.tbl tr.clickable:hover td { background: var(--carbon); }
.tbl td.num, .tbl th.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl .actions { justify-content: flex-end; }
.tbl .ellipsis { max-width: 440px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbl b { font-weight: 700; }
.tbl td a:not(.btn) { border-bottom: 1px solid var(--rule); }
.tbl td a:not(.btn):hover { border-color: var(--ink); }
.tbl .tsel { min-width: 120px; }
.empty { font-family: var(--mono); font-size: 13px; color: var(--ink-soft); text-align: center; padding: 34px 0; }
/* pager */
.pager { display: flex; align-items: center; gap: 12px; justify-content: flex-end; margin-top: 14px; font-family: var(--mono); font-size: 12.5px; color: var(--ink-soft); }
.pager button { font-family: var(--mono); font-size: 14px; border: 1.5px solid var(--rule); background: var(--paper-doc); padding: 3px 12px; cursor: pointer; border-radius: 3px; transition: border-color 140ms, color 140ms; color: var(--ink); }
.pager button:hover { border-color: var(--biro); color: var(--biro); }
.pager button[disabled] { opacity: 0.35; cursor: default; }

/* ── record sheets: key → value on dotted rules ── */
.kvs { display: block; }
.kv { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; padding: 9px 0; border-bottom: 1px dotted var(--ink-soft); font-size: 13.5px; }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--ink-soft); font-weight: 600; font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; flex: none; }
.kv .v { text-align: right; font-family: var(--mono); word-break: break-word; min-width: 0; }
.kv .v pre { text-align: left; }
.code-block { margin: 0; font-family: var(--mono); font-size: 11.5px; white-space: pre-wrap; background: var(--carbon); border-left: 3px solid var(--biro); padding: 8px 10px; max-height: 220px; overflow: auto; }
.req-group { border: 1px solid var(--rule); padding: 10px 12px 12px; background: var(--paper-page); }
.face { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--rule); padding: 10px; background: var(--paper-doc); }
.thumb { width: 72px; height: 72px; object-fit: cover; border: 1px solid var(--rule); flex: none; background: var(--paper-page); }
.empty-thumb { display: grid; place-items: center; font-family: var(--mono); font-size: 10px; color: var(--ink-faint); }

/* ── charts ── */
.chart { display: block; width: 100%; height: auto; }
.legend { display: flex; gap: 12px; font-family: var(--mono); font-size: 11px; color: var(--ink-soft); align-items: center; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 1px; margin-right: 5px; vertical-align: -1px; }
.bar { height: 6px; background: var(--vellum-deep); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--ink); }
.bar.thin { height: 3px; }
.bar.thin > i { background: var(--ink-faint); }

/* ── toasts + the modal (a document docked centre, 2px rule on top) ── */
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 6px; z-index: 50; }
.toast { background: var(--ink); color: var(--paper-doc); padding: 9px 14px; border-radius: 2px; font-family: var(--mono); font-size: 12.5px; max-width: 380px; }
.toast.bad { background: var(--red); color: #fff; }
.dialog { border: 1px solid var(--rule); border-top: 2px solid var(--ink); border-radius: 0; background: var(--paper-doc); color: var(--ink); padding: 0; width: min(460px, 92vw); filter: drop-shadow(0 18px 44px rgba(25, 25, 23, 0.18)); }
.dialog::backdrop { background: var(--scrim); }
.dialog .dlg-body { padding: 24px 26px; display: flex; flex-direction: column; gap: 12px; }
.dialog h3 { font-family: var(--archivo); font-variation-settings: "wdth" 80, "wght" 900; font-size: 20px; letter-spacing: 0.02em; text-transform: uppercase; line-height: 1.1; }
.dialog .dlg-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 8px; }
.dialog.wide { width: min(900px, 94vw); }
.dialog .card { box-shadow: none; }

/* motion respect + print */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .reveal { opacity: 1; transform: none; }
}
@media print { .side, .no-print { display: none !important; } #office { display: block !important; } .main { max-width: none; padding: 0; } body { background: #fff; } .card { box-shadow: none; } }
