/* Dvořák Transport · Dokumenty — "Tachograf" design system, shared with the public site. */
:root {
  --paper: #f2efe8;
  --paper-shade: #e7e3d9;
  --paper-deep: #dcd7cb;
  --surface: #ffffff;
  --ink: #141414;
  --ink-soft: #3b3b3d;
  --ink-muted: #55565a;
  --rule: #141414;
  --rule-soft: rgba(20, 20, 20, .16);
  --red: #ed1c24;
  --red-ink: #c4121a;
  --red-tint: rgba(237, 28, 36, .08);
  --good: #1f6b45;
  --good-tint: rgba(31, 107, 69, .1);
  --warn: #8a5a00;
  --warn-tint: rgba(196, 140, 0, .14);
  --inverse: #141414;
  --inverse-ink: #f2efe8;
  --focus: 0 0 0 3px rgba(237, 28, 36, .28);
  --ease: cubic-bezier(.16, 1, .3, 1);
  --display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --text: "Barlow", "Segoe UI", sans-serif;
  --gutter: clamp(16px, 3vw, 40px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #151515; --paper-shade: #1d1d1d; --paper-deep: #262626; --surface: #1b1b1b;
    --ink: #ece8df; --ink-soft: #c9c5bc; --ink-muted: #9d9a93; --rule: #ece8df; --rule-soft: rgba(236, 232, 223, .14);
    --red: #ff3b41; --red-ink: #ff6b6f; --red-tint: rgba(255, 59, 65, .12); --good: #5fc08c; --good-tint: rgba(95, 192, 140, .12);
    --warn: #e0b04a; --warn-tint: rgba(224, 176, 74, .14); --inverse: #ece8df; --inverse-ink: #141414; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #151515; --paper-shade: #1d1d1d; --paper-deep: #262626; --surface: #1b1b1b;
  --ink: #ece8df; --ink-soft: #c9c5bc; --ink-muted: #9d9a93; --rule: #ece8df; --rule-soft: rgba(236, 232, 223, .14);
  --red: #ff3b41; --red-ink: #ff6b6f; --red-tint: rgba(255, 59, 65, .12); --good: #5fc08c; --good-tint: rgba(95, 192, 140, .12);
  --warn: #e0b04a; --warn-tint: rgba(224, 176, 74, .14); --inverse: #ece8df; --inverse-ink: #141414; color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink); font: 400 1rem/1.5 var(--text);
  font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased;
}
::selection { background: var(--red); color: #fff; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--red-ink); }
img, svg { display: block; max-width: 100%; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
h1, h2, h3, h4 { font-family: var(--display); text-transform: uppercase; margin: 0; line-height: .95; letter-spacing: -.005em; }
p { margin: 0; }

/* ------------------------------------------------------------ type */
.label { font: 600 .8125rem/1.15 var(--display); letter-spacing: .07em; text-transform: uppercase; color: var(--ink-muted); }
.figure { font: 800 2.5rem/1 var(--display); font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-muted); }
.small { font-size: .875rem; }
.red { color: var(--red-ink); }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .8125rem; }

/* ------------------------------------------------------------ buttons */
.btn {
  --b: var(--ink); --f: var(--paper);
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 44px; padding: 0 18px;
  border: 1px solid var(--b); background: var(--b); color: var(--f); font: 700 1.0625rem/1 var(--display);
  letter-spacing: .04em; text-transform: uppercase; text-decoration: none; cursor: pointer; border-radius: 0;
  transition: background .25s var(--ease), color .25s var(--ease), border-color .25s var(--ease);
  white-space: nowrap;
}
.btn:hover { background: var(--red); border-color: var(--red); color: #fff; }
.btn svg { width: 18px; height: 18px; flex: none; transition: transform .35s var(--ease); }
.btn:hover svg.arrow { transform: translateX(4px); }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn.red { --b: var(--red); --f: #fff; }
.btn.red:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn.good { --b: var(--good); --f: #fff; }
.btn.good:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn.danger { color: var(--red-ink); border-color: var(--red-ink); }
.btn.danger:hover { background: var(--red-ink); border-color: var(--red-ink); color: #fff; }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: .9375rem; gap: 8px; }
.btn.sm svg { width: 16px; height: 16px; }
.btn.block { width: 100%; }
.btn[disabled], .btn.is-busy { opacity: .5; cursor: not-allowed; pointer-events: none; }
.linkbtn { background: none; border: 0; padding: 0; color: inherit; font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.linkbtn:hover { color: var(--red-ink); }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border: 1px solid var(--rule-soft); background: transparent; color: var(--ink); cursor: pointer; }
.icon-btn:hover { border-color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; }

/* ------------------------------------------------------------ forms */
.field { display: grid; gap: 6px; }
.field > span, .field > label { font: 600 .8125rem/1.15 var(--display); letter-spacing: .07em; text-transform: uppercase; color: var(--ink-muted); }
.field .hint { font-size: .8125rem; color: var(--ink-muted); }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=search], input[type=number], select, textarea {
  width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid var(--rule); border-radius: 0; background: var(--surface);
  color: var(--ink); font: 400 1rem/1.4 var(--text); caret-color: var(--red); transition: border-color .2s, box-shadow .2s;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--red); box-shadow: var(--focus); }
select {
  appearance: none; padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none' stroke='%23777' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; }
.grid2 .span2 { grid-column: 1 / -1; }
.segmented { display: flex; flex-wrap: wrap; border: 1px solid var(--rule); width: max-content; max-width: 100%; }
.segmented label { position: relative; cursor: pointer; }
.segmented label + label { border-left: 1px solid var(--rule); }
.segmented input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.segmented span { display: block; padding: 10px 16px; font: 700 .9375rem/1 var(--display); letter-spacing: .05em; text-transform: uppercase; }
.segmented input:checked + span { background: var(--ink); color: var(--paper); }
.segmented input:focus-visible + span { box-shadow: inset 0 0 0 2px var(--red); }
.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--red); }
.form-error { border: 1px solid var(--red-ink); color: var(--red-ink); padding: 10px 12px; font-weight: 500; background: var(--red-tint); }

/* ------------------------------------------------------------ app shell */
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 28px; height: 64px; padding: 0 var(--gutter);
  background: var(--paper); border-bottom: 1px solid var(--rule);
}
.lockup { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--ink); flex: none; }
.lockup .logo { width: 118px; height: auto; }
.lockup .logo.on-dark { display: none; }
.lockup .rule { width: 2px; height: 30px; background: var(--red); }
.lockup b { font: 700 1.125rem/1 var(--display); letter-spacing: .08em; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .lockup .logo.on-light { display: none; } :root:not([data-theme="light"]) .lockup .logo.on-dark { display: block; } }
:root[data-theme="dark"] .lockup .logo.on-light { display: none; }
:root[data-theme="dark"] .lockup .logo.on-dark { display: block; }
.mainnav { display: flex; gap: 22px; height: 100%; }
.mainnav a {
  display: flex; align-items: center; gap: 8px; height: 100%; border-bottom: 2px solid transparent; text-decoration: none;
  font: 600 1rem/1 var(--display); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft); padding-top: 2px;
}
.mainnav a:hover { color: var(--ink); border-color: var(--red); }
.mainnav a[aria-current=page] { color: var(--ink); border-color: var(--ink); }
.mainnav .pill { min-width: 20px; height: 20px; padding: 0 6px; display: inline-grid; place-items: center; background: var(--red); color: #fff; font: 700 .8125rem/1 var(--display); }
.topbar .spacer { flex: 1; }
.usermenu { position: relative; }
.usermenu summary { list-style: none; display: flex; align-items: center; gap: 10px; cursor: pointer; font: 600 .9375rem/1 var(--display); letter-spacing: .05em; text-transform: uppercase; }
.usermenu summary::-webkit-details-marker { display: none; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--ink); color: var(--paper); font: 700 .875rem/1 var(--display); letter-spacing: .04em; }
.usermenu .menu { position: absolute; right: 0; top: calc(100% + 12px); min-width: 230px; background: var(--surface); border: 1px solid var(--rule); z-index: 40; }
.usermenu .menu a, .usermenu .menu button { display: block; width: 100%; padding: 12px 16px; text-align: left; text-decoration: none; border: 0; background: none; color: var(--ink); font: 500 .9375rem/1.2 var(--text); cursor: pointer; }
.usermenu .menu a + a, .usermenu .menu form, .usermenu .menu .sep { border-top: 1px solid var(--rule-soft); }
.usermenu .menu a:hover, .usermenu .menu button:hover { background: var(--paper-shade); color: var(--ink); }
.usermenu .menu .who { padding: 12px 16px; font-size: .8125rem; color: var(--ink-muted); }
.navtoggle { display: none; }

.page { padding: 28px var(--gutter) 64px; max-width: 1680px; margin: 0 auto; }
.pagehead { display: flex; align-items: end; justify-content: space-between; gap: 24px; padding-bottom: 20px; border-bottom: 1px solid var(--rule); flex-wrap: wrap; }
.pagehead h1 { font-size: clamp(2.25rem, 4vw, 3.5rem); font-weight: 800; }
.pagehead .sub { margin-top: 8px; color: var(--ink-muted); font: 600 .9375rem/1.2 var(--display); letter-spacing: .06em; text-transform: uppercase; }
.pagehead .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.section-title { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 18px 0 10px; }
.section-title h2 { font-size: 1.375rem; font-weight: 700; }

/* ------------------------------------------------------------ counters (fact band) */
.band { display: grid; grid-template-columns: repeat(5, 1fr); border-bottom: 1px solid var(--rule); }
.band a { display: grid; gap: 10px; padding: 16px 18px 18px; text-decoration: none; color: var(--ink); border-right: 1px solid var(--rule-soft); position: relative; transition: background .2s; }
.band a:last-child { border-right: 0; }
.band a:hover { background: var(--paper-shade); color: var(--ink); }
.band a[aria-current=true]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; background: var(--ink); }
.band .figure { font-size: clamp(2rem, 3vw, 2.75rem); }
.band .tick { display: flex; gap: 3px; height: 8px; align-items: end; }
.band .tick i { width: 2px; height: 6px; background: var(--rule-soft); }
.band .tick i:nth-child(4n+1) { height: 8px; background: var(--ink-muted); }
.band a.hot .figure { color: var(--red-ink); }

/* ------------------------------------------------------------ workspace */
.workspace { display: grid; grid-template-columns: minmax(380px, 5fr) 7fr; gap: 0; border-left: 1px solid var(--rule-soft); border-right: 1px solid var(--rule-soft); min-height: calc(100vh - 260px); }
.queuecol { border-right: 1px solid var(--rule); min-width: 0; }
.queuetools { display: flex; gap: 10px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--rule-soft); position: sticky; top: 64px; background: var(--paper); z-index: 5; }
.search { position: relative; flex: 1; }
.search svg { position: absolute; left: 12px; top: 50%; translate: 0 -50%; width: 18px; height: 18px; color: var(--ink-muted); pointer-events: none; }
.search input { padding-left: 40px; min-height: 42px; }
.search kbd { position: absolute; right: 10px; top: 50%; translate: 0 -50%; }
kbd { font: 600 .75rem/1 var(--display); border: 1px solid var(--rule-soft); padding: 3px 6px; color: var(--ink-muted); letter-spacing: .04em; background: var(--surface); }

.queue { list-style: none; margin: 0; padding: 0; }
.qrow {
  display: grid; grid-template-columns: 4px 1fr auto; gap: 0 14px; padding: 14px 16px 14px 0; border-bottom: 1px solid var(--rule-soft);
  cursor: pointer; text-decoration: none; color: inherit; position: relative; transition: background .15s;
}
.qrow:hover { background: var(--paper-shade); color: inherit; }
.qrow[aria-selected=true] { background: var(--surface); }
.qrow[aria-selected=true]::before { content: ""; position: absolute; right: -1px; top: 0; bottom: 0; width: 1px; background: var(--surface); }
.qrow .mark { grid-row: 1 / span 2; background: transparent; }
.qrow[data-tone=act] .mark, .qrow[data-tone=late] .mark { background: var(--red); }
.qrow[data-tone=good] .mark { background: var(--good); }
.qrow[data-tone=warn] .mark { background: var(--warn); }
.qrow .order { font: 700 1.3125rem/1.1 var(--display); letter-spacing: .01em; }
.qrow .cust { color: var(--ink-soft); font-size: .9375rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qrow .meta { display: flex; align-items: center; gap: 12px; margin-top: 8px; grid-column: 2 / -1; flex-wrap: wrap; }
.qrow .right { text-align: right; display: grid; gap: 4px; align-content: start; }
.qrow .due { font: 700 1rem/1 var(--display); letter-spacing: .03em; }
.qrow .due.late { color: var(--red-ink); }
.qrow .rel { font-size: .8125rem; color: var(--ink-muted); }

.pips { display: inline-flex; gap: 4px; }
.pip { width: 12px; height: 12px; border: 1.5px solid var(--ink); display: inline-block; }
.pip.schvaleno { background: var(--ink); }
.pip.ke_kontrole { background: repeating-linear-gradient(135deg, var(--ink) 0 2px, transparent 2px 4px); }
.pip.vraceno { border-color: var(--red); background: linear-gradient(135deg, var(--red) 50%, transparent 50%); }
.pip.chybi { border-color: var(--ink-muted); border-style: dashed; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; font: 700 .8125rem/1 var(--display); letter-spacing: .06em; text-transform: uppercase; border: 1px solid currentColor; white-space: nowrap; }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip.act, .chip.late { color: var(--red-ink); }
.chip.good, .chip.done { color: var(--good); }
.chip.warn { color: var(--warn); }
.chip.wait, .chip.muted { color: var(--ink-muted); }
.chip.plain::before { display: none; }

.empty { padding: 48px 24px; text-align: center; color: var(--ink-muted); }
.empty h3 { font-size: 1.5rem; color: var(--ink); margin-bottom: 8px; }

/* ------------------------------------------------------------ request panel */
.panelcol { min-width: 0; background: var(--surface); }
.panel { position: sticky; top: 64px; max-height: calc(100vh - 64px); overflow: auto; }
.panel-empty { display: grid; place-items: center; min-height: 420px; padding: 40px; text-align: center; color: var(--ink-muted); }
.panel-empty .disc { width: 180px; height: 180px; margin: 0 auto 18px; }
.phead { padding: 22px 28px 18px; border-bottom: 1px solid var(--rule); display: grid; gap: 14px; position: sticky; top: 0; background: var(--surface); z-index: 4; }
.phead .top { display: flex; justify-content: space-between; gap: 16px; align-items: start; }
.phead h2 { font-size: clamp(2rem, 3vw, 2.75rem); font-weight: 800; }
.phead .who { margin-top: 6px; color: var(--ink-soft); }
.phead .facts { display: flex; gap: 0; flex-wrap: wrap; border-top: 1px solid var(--rule-soft); }
.phead .facts > div { padding: 10px 18px 0 0; margin-right: 18px; border-right: 1px solid var(--rule-soft); }
.phead .facts > div:last-child { border-right: 0; }
.phead .facts b { display: block; font: 700 1.125rem/1.1 var(--display); letter-spacing: .02em; margin-top: 4px; }
.phead .toolbar { display: flex; gap: 8px; flex-wrap: wrap; }
.psec { padding: 20px 28px; border-bottom: 1px solid var(--rule-soft); }
.psec > .label { display: flex; justify-content: space-between; margin-bottom: 12px; }
.closebtn { display: none; }

.callout { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; padding: 14px 16px; border: 1px solid var(--good); background: var(--good-tint); }
.callout.red { border-color: var(--red-ink); background: var(--red-tint); }
.callout .t { font: 700 1.125rem/1.1 var(--display); text-transform: uppercase; letter-spacing: .03em; }

.doc { border: 1px solid var(--rule); background: var(--surface); }
.doc + .doc { margin-top: 12px; }
.doc .dhead { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; padding: 12px 14px; }
.doc .dname { font: 700 1.25rem/1 var(--display); text-transform: uppercase; letter-spacing: .02em; display: flex; align-items: center; gap: 10px; }
.doc .dmeta { font-size: .8125rem; color: var(--ink-muted); margin-top: 4px; }
.doc .preview { border-top: 1px solid var(--rule-soft); background: var(--paper-deep); }
.doc .preview iframe, .doc .preview img { width: 100%; height: 520px; border: 0; display: block; background: var(--paper-deep); object-fit: contain; }
.doc .dactions { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 14px; border-top: 1px solid var(--rule-soft); align-items: center; }
.doc .dactions .spacer { flex: 1; }
.doc details.return { padding: 0 14px 14px; }
.doc details.return summary { list-style: none; }
.doc details.return[open] { border-top: 1px solid var(--rule-soft); padding-top: 14px; }
.doc .reasons { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 10px; }
.doc .reasons button { border: 1px solid var(--rule-soft); background: var(--paper); color: var(--ink); padding: 6px 10px; font: 500 .8125rem/1.2 var(--text); cursor: pointer; text-align: left; }
.doc .reasons button:hover { border-color: var(--ink); }
.doc .versions { padding: 10px 14px; border-top: 1px solid var(--rule-soft); font-size: .8125rem; color: var(--ink-muted); }
.doc .versions li { margin: 2px 0; }
.doc .missing { padding: 14px; border-top: 1px dashed var(--rule-soft); color: var(--ink-muted); font-size: .9375rem; }
.doc .returned-note { padding: 10px 14px; border-top: 1px solid var(--rule-soft); background: var(--red-tint); font-size: .9375rem; }

.ai { border-top: 1px solid var(--rule-soft); padding: 12px 14px; display: grid; gap: 8px; font-size: .9375rem; }
.ai .aihead { display: flex; align-items: center; gap: 10px; }
.ai .aihead .label { color: var(--ink); }
.ai ul { margin: 0; padding-left: 18px; }
.ai dl { display: grid; grid-template-columns: max-content 1fr; gap: 2px 14px; margin: 0; font-size: .8125rem; }
.ai dt { color: var(--ink-muted); }
.ai dd { margin: 0; }
.ai.ok { background: var(--good-tint); }
.ai.upozorneni { background: var(--warn-tint); }
.ai.problem { background: var(--red-tint); }
.spinner { width: 14px; height: 14px; border: 2px solid var(--rule-soft); border-top-color: var(--red); border-radius: 50%; animation: spin 0.9s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.linkbox { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.linkbox input { font-family: ui-monospace, Consolas, monospace; font-size: .8125rem; background: var(--paper); }

/* tachograph trace timeline */
.trace { list-style: none; margin: 0; padding: 0 0 0 22px; position: relative; }
.trace::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 1px; background: var(--rule); }
.trace li { position: relative; padding: 0 0 14px; }
.trace li::before { content: ""; position: absolute; left: -21px; top: 6px; width: 11px; height: 11px; border: 1.5px solid var(--ink); background: var(--surface); border-radius: 50%; }
.trace li:first-child::before { background: var(--red); border-color: var(--red); box-shadow: 0 0 0 4px var(--red-tint); }
.trace li[data-actor=customer]::before { border-radius: 0; }
.trace li[data-actor=ai]::before { border-style: dashed; }
.trace .when { font: 600 .8125rem/1 var(--display); letter-spacing: .05em; color: var(--ink-muted); text-transform: uppercase; }
.trace .what { font-weight: 600; margin-top: 3px; }
.trace .det { font-size: .875rem; color: var(--ink-soft); word-break: break-word; }

.ship { display: grid; gap: 8px; }
.ship .row { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 10px 12px; border: 1px solid var(--rule-soft); }

/* ------------------------------------------------------------ tables / ledger */
.ledger { width: 100%; border-collapse: collapse; background: var(--surface); }
.ledger th { text-align: left; padding: 12px 14px; font: 600 .8125rem/1.1 var(--display); letter-spacing: .07em; text-transform: uppercase; color: var(--ink-muted); border-bottom: 1px solid var(--rule); white-space: nowrap; }
.ledger td { padding: 12px 14px; border-bottom: 1px solid var(--rule-soft); vertical-align: top; }
.ledger tr:hover td { background: var(--paper); }
.ledger .strong { font: 700 1.125rem/1.1 var(--display); letter-spacing: .02em; text-transform: uppercase; }
.ledger .num { text-align: right; }
.table-wrap { overflow-x: auto; border: 1px solid var(--rule); }
.toolbar-row { display: flex; gap: 10px; align-items: center; padding: 16px 0; flex-wrap: wrap; }

/* ------------------------------------------------------------ overview */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--rule); background: var(--surface); }
.kpis > div { padding: 18px 20px; border-right: 1px solid var(--rule-soft); display: grid; gap: 8px; }
.kpis > div:last-child { border-right: 0; }
.kpis .figure { font-size: clamp(2.25rem, 4vw, 3.25rem); }
.kpis .figure small { font-size: 1.125rem; font-weight: 700; margin-left: 4px; }
.chart { border: 1px solid var(--rule); background: var(--surface); padding: 18px 20px 12px; }
.chart svg { width: 100%; height: auto; overflow: visible; }
.chart .bar-done { fill: var(--ink); }
.chart .bar-new { fill: none; stroke: var(--red); stroke-width: 1.5; }
.chart .axis { stroke: var(--rule); stroke-width: 1; }
.chart .grid { stroke: var(--rule-soft); stroke-width: 1; }
.chart text { fill: var(--ink-muted); font: 600 11px var(--display); letter-spacing: .04em; }
.chart text.val { fill: var(--ink); font-weight: 700; font-size: 12px; }
.legend { display: flex; gap: 18px; font-size: .8125rem; color: var(--ink-muted); margin-top: 6px; }
.legend i { display: inline-block; width: 12px; height: 12px; margin-right: 6px; vertical-align: -2px; }
.legend .l-done { background: var(--ink); }
.legend .l-new { border: 1.5px solid var(--red); }
.cols2 { display: grid; grid-template-columns: 1.3fr 1fr; gap: 24px; margin-top: 24px; }

/* ------------------------------------------------------------ dialog */
dialog.modal { border: 1px solid var(--rule); padding: 0; width: min(720px, calc(100vw - 24px)); max-height: calc(100vh - 32px); background: var(--surface); color: var(--ink); border-radius: 0; }
dialog.modal::backdrop { background: rgba(10, 10, 10, .55); }
.mhead { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 18px 22px; border-bottom: 1px solid var(--rule); position: sticky; top: 0; background: var(--surface); z-index: 2; }
.mhead h2 { font-size: 1.75rem; font-weight: 800; }
.mbody { padding: 20px 22px; display: grid; gap: 16px; }
.mfoot { display: flex; justify-content: space-between; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--rule); flex-wrap: wrap; align-items: center; position: sticky; bottom: 0; background: var(--surface); }
.mfoot .right { display: flex; gap: 10px; margin-left: auto; }

/* ------------------------------------------------------------ toasts */
#toasts { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: grid; gap: 10px; width: min(420px, calc(100vw - 40px)); }
.toast { background: var(--inverse); color: var(--inverse-ink); padding: 14px 16px 14px 18px; border-left: 4px solid var(--good); font-weight: 500; animation: toast-in .35s var(--ease); display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: start; }
.toast.error { border-left-color: var(--red); }
.toast.warn { border-left-color: var(--warn); }
.toast button { background: none; border: 0; color: inherit; cursor: pointer; font-size: 1.25rem; line-height: 1; opacity: .7; }
.toast.out { animation: toast-out .3s var(--ease) forwards; }
@keyframes toast-in { from { transform: translateY(12px); opacity: 0; } }
@keyframes toast-out { to { transform: translateY(12px); opacity: 0; } }

.htmx-request .busy-hide { opacity: .4; }
.loading-bar { position: fixed; top: 0; left: 0; height: 2px; background: var(--red); width: 0; z-index: 200; transition: width .4s var(--ease), opacity .3s; opacity: 0; }
.htmx-request.loading-bar, body.htmx-request .loading-bar { width: 70%; opacity: 1; }

/* ------------------------------------------------------------ auth pages */
.authwrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.authart { background: #141414; color: #f2efe8; padding: 48px; display: grid; align-content: space-between; position: relative; overflow: hidden; }
.authart .logo { width: 170px; }
.authart h1 { font-size: clamp(3rem, 6vw, 5.5rem); font-weight: 800; line-height: .9; }
.authart h1 span { color: #ed1c24; }
.authart p { color: rgba(242, 239, 232, .7); max-width: 40ch; margin-top: 16px; font-size: 1.0625rem; }
.authart .disc { position: absolute; right: -130px; top: -130px; width: 480px; opacity: .85; }
.authart > * { position: relative; z-index: 1; }
.authart > .disc { position: absolute; z-index: 0; }
.authform { display: grid; place-items: center; padding: 40px var(--gutter); }
.authform form { width: min(420px, 100%); display: grid; gap: 18px; }
.authform h2 { font-size: 2.25rem; font-weight: 800; }
.authform .lead { color: var(--ink-muted); }

/* ------------------------------------------------------------ disc illustration */
.disc .face { fill: var(--paper); stroke: var(--ink); stroke-width: 1.5; }
.disc .ring { fill: none; stroke: var(--ink); stroke-opacity: .22; }
.disc .tick { stroke: var(--ink); }
.disc .sector { fill: none; stroke: var(--red); stroke-opacity: .28; stroke-width: 9; }
.disc .stylus { stroke: var(--red); stroke-width: 2.6; stroke-linecap: round; }
.disc .hub { fill: var(--ink); }
.authart .disc .face { fill: #1d1d1d; stroke: #f2efe8; }
.authart .disc .ring, .authart .disc .tick { stroke: #f2efe8; }
.authart .disc .hub { fill: #f2efe8; }

.error-page { min-height: 70vh; display: grid; place-items: center; text-align: center; padding: 40px; }
.error-page .code { font: 800 6rem/1 var(--display); color: var(--red); }
.error-page h1 { font-size: 2.5rem; margin: 8px 0 12px; }

/* ------------------------------------------------------------ responsive */
@media (max-width: 1180px) {
  .band { grid-template-columns: repeat(3, 1fr); }
  .band a:nth-child(n+4) { border-top: 1px solid var(--rule-soft); }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .kpis > div:nth-child(n+3) { border-top: 1px solid var(--rule-soft); }
  .cols2 { grid-template-columns: 1fr; }
}
@media (max-width: 960px) {
  .workspace { grid-template-columns: 1fr; }
  .queuecol { border-right: 0; }
  .panelcol { position: fixed; inset: 64px 0 0 0; z-index: 25; transform: translateX(100%); transition: transform .35s var(--ease); }
  .panelcol.open { transform: none; }
  .panel { position: static; max-height: none; height: 100%; }
  .closebtn { display: inline-grid; }
  .mainnav { display: none; position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; gap: 0; height: auto; background: var(--paper); border-bottom: 1px solid var(--rule); }
  .mainnav.open { display: flex; }
  .mainnav a { padding: 16px var(--gutter); border-bottom: 1px solid var(--rule-soft); }
  .navtoggle { display: inline-grid; }
  .authwrap { grid-template-columns: 1fr; }
  .authart { min-height: 260px; padding: 28px var(--gutter); }
  .authart .disc { width: 280px; right: -90px; top: -90px; }
}
@media (max-width: 640px) {
  .band { grid-template-columns: repeat(2, 1fr); }
  .band a:nth-child(n+3) { border-top: 1px solid var(--rule-soft); }
  .grid2 { grid-template-columns: 1fr; }
  .lockup .logo { width: 92px; }
  .lockup b { font-size: 1rem; }
  .phead, .psec { padding-left: 16px; padding-right: 16px; }
  .doc .preview iframe, .doc .preview img { height: 420px; }
  .usermenu summary .name { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ------------------------------------------------------------ utilities */
.mt { margin-top: 20px; } .mt8 { margin-top: 8px; } .mt24 { margin-top: 24px; }
.nowrap { white-space: nowrap; }
.tright { display: flex; align-items: center; gap: 10px; }
.narrow { max-width: 520px; display: grid; gap: 18px; padding-top: 24px; }
.inline-form { display: inline-flex; gap: 8px; align-items: center; }
.inline-form input[type=month] { min-height: 36px; width: auto; }
.search.wide { max-width: 420px; flex: 1 1 280px; }
.dactions.bare { border-top: 0; padding: 4px 0 0; }
.doc form.return { padding: 0 14px 14px; border-top: 1px solid var(--rule-soft); padding-top: 14px; display: grid; gap: 10px; }
.doc .inline-upload { display: inline; margin-left: 6px; }
.mono.big { font-size: 1.25rem; letter-spacing: .06em; }
.tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--rule-soft); margin: 4px 0 20px; }
.tabs a { padding: 14px 0 12px; text-decoration: none; font: 600 1rem/1 var(--display); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-muted); border-bottom: 2px solid transparent; }
.tabs a[aria-current=page] { color: var(--ink); border-color: var(--ink); }
.tabs a:hover { color: var(--ink); border-color: var(--red); }
.card-form { border: 1px solid var(--rule); background: var(--surface); padding: 22px; display: grid; gap: 16px; }
.card-form h2 { font-size: 1.75rem; font-weight: 800; }
tr.muted td { color: var(--ink-muted); }
.panel-empty h3 { font-size: 1.75rem; color: var(--ink); margin-bottom: 8px; }
.queuetools select { width: auto; flex: none; min-height: 42px; }
.queuetools .search { min-width: 0; }
.dname svg { width: 20px; height: 20px; }
.callout > svg { width: 24px; height: 24px; }
.ai .aihead svg { width: 18px; height: 18px; }
.qrow[aria-selected=true] { background: var(--surface); box-shadow: inset -3px 0 0 var(--red); }
.ledger th.num { text-align: right; }
.ledger .strong .small, .ledger .strong div { font: 400 .8125rem/1.4 var(--text); text-transform: none; letter-spacing: 0; }
