/* Notalic. The look borrows from the paperwork it replaces: a duplicate book on a desk.
   Graphite text on paper, ballpoint blue for what you do, stamp red only for what blocks you,
   the yellow of a carbon copy for "check this", ledger green for done. */

@font-face { font-family: "Readex Pro"; font-weight: 160 700; font-display: swap;
  src: url(/static/fonts/readex-pro-latin-wght-normal.woff2) format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Readex Pro"; font-weight: 160 700; font-display: swap;
  src: url(/static/fonts/readex-pro-latin-ext-wght-normal.woff2) format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Readex Pro"; font-weight: 160 700; font-display: swap;
  src: url(/static/fonts/readex-pro-arabic-wght-normal.woff2) format("woff2-variations");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "Figures"; font-weight: 400; font-display: swap; src: url(/static/fonts/barlow-semi-condensed-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Figures"; font-weight: 500; font-display: swap; src: url(/static/fonts/barlow-semi-condensed-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Figures"; font-weight: 600; font-display: swap; src: url(/static/fonts/barlow-semi-condensed-latin-600-normal.woff2) format("woff2"); }

:root {
  --desk: #edefea;
  --paper: #fdfdfb;
  --paper-2: #f6f7f3;
  --ink: #23272b;
  --pencil: #5f666d;
  --rule: #d8dbd3;
  --rule-strong: #b9bdb4;
  --pen: #2340a8;
  --pen-hover: #1b3288;
  --pen-ink: #ffffff;
  --pen-wash: #e6ebfa;
  --stamp: #b3261e;
  --stamp-wash: #fbe9e7;
  --carbon: #f5e6a3;
  --carbon-ink: #5e4800;
  --ledger: #2f6b4f;
  --ledger-wash: #e2efe6;
  --focus: #2340a8;
  --shadow: 0 1px 0 rgba(35, 39, 43, .06), 0 8px 24px -12px rgba(35, 39, 43, .18);

  --text: "Readex Pro", "Segoe UI", system-ui, sans-serif;
  --figures: "Figures", "Readex Pro", system-ui, sans-serif;
  --s-12: 12px; --s-13: 13px; --s-14: 14px; --s-16: 16px; --s-20: 20px; --s-26: 26px;
  --r-sm: 4px; --r-md: 7px;
  --rail: 216px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --desk: #121416; --paper: #1a1d20; --paper-2: #202428; --ink: #e6e7e3; --pencil: #9ba1a6;
    --rule: #2d3135; --rule-strong: #434950; --pen: #9db0ff; --pen-hover: #b8c6ff; --pen-ink: #0e173d;
    --pen-wash: #1f2849; --stamp: #ff8f80; --stamp-wash: #3a1d1a; --carbon: #3d3517; --carbon-ink: #f0d77a;
    --ledger: #86c9a5; --ledger-wash: #183027; --focus: #9db0ff; --shadow: 0 1px 0 rgba(0,0,0,.3), 0 10px 30px -12px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --desk: #121416; --paper: #1a1d20; --paper-2: #202428; --ink: #e6e7e3; --pencil: #9ba1a6;
  --rule: #2d3135; --rule-strong: #434950; --pen: #9db0ff; --pen-hover: #b8c6ff; --pen-ink: #0e173d;
  --pen-wash: #1f2849; --stamp: #ff8f80; --stamp-wash: #3a1d1a; --carbon: #3d3517; --carbon-ink: #f0d77a;
  --ledger: #86c9a5; --ledger-wash: #183027; --focus: #9db0ff; --shadow: 0 1px 0 rgba(0,0,0,.3), 0 10px 30px -12px rgba(0,0,0,.6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--desk); color: var(--ink); font: 380 var(--s-14)/1.45 var(--text); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { margin: 0; font-weight: 540; letter-spacing: -.005em; }
h1 { font-size: var(--s-20); }
h2 { font-size: var(--s-16); }
h3 { font-size: var(--s-14); }
p { margin: 0; }
a { color: var(--pen); text-underline-offset: 2px; }
strong, b { font-weight: 560; }
.num, .code { font-family: var(--figures); font-variant-numeric: tabular-nums; font-weight: 500; letter-spacing: .01em; }
.num { font-size: 15px; }
.code { font-size: 14.5px; }
.muted { color: var(--pencil); }
.small { font-size: var(--s-12); }
.right { text-align: right; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -40px; z-index: 50; padding: 8px 12px; background: var(--paper); color: var(--pen); border: 1px solid var(--rule); border-radius: var(--r-sm, 6px); }
.skip:focus { top: 8px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* --- shell ------------------------------------------------------------------- */
.shell { display: grid; grid-template-columns: var(--rail) 1fr; min-height: 100vh; }
.rail { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 2px; padding: 18px 12px; border-right: 1px solid var(--rule); background: var(--desk); }
.brand { display: flex; align-items: baseline; gap: 8px; padding: 0 10px 18px; }
.brand b { font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.brand span { font-size: var(--s-12); color: var(--pencil); }
.navlink { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-md); color: var(--ink); text-decoration: none; font-weight: 420; }
.navlink svg { width: 18px; height: 18px; flex: none; color: var(--pencil); }
.navlink:hover { background: var(--paper-2); }
.navlink[aria-current="page"] { background: var(--paper); box-shadow: inset 3px 0 0 var(--pen), 0 0 0 1px var(--rule); font-weight: 520; }
.navlink[aria-current="page"] svg { color: var(--pen); }
.navlink .count { margin-left: auto; font-family: var(--figures); font-weight: 600; font-size: 13px; min-width: 22px; text-align: center; padding: 0 6px; border-radius: 10px; background: var(--paper); color: var(--pencil); box-shadow: 0 0 0 1px var(--rule); }
.navlink .count.hot { background: var(--stamp); color: #fff; box-shadow: none; }
.rail .spacer { flex: 1; }
.rail .system { padding: 10px; font-size: var(--s-12); color: var(--pencil); border-top: 1px solid var(--rule); }
.rail .system b { color: var(--ink); font-weight: 520; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--ledger); margin-right: 6px; vertical-align: 1px; }
.dot.off { background: var(--stamp); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 14px; min-height: 60px; padding: 10px 28px; background: color-mix(in srgb, var(--desk) 88%, transparent); backdrop-filter: blur(6px); border-bottom: 1px solid var(--rule); }
.topbar h1 { font-size: var(--s-20); }
.topbar .crumb { color: var(--pencil); text-decoration: none; font-weight: 420; }
.topbar .crumb:hover { color: var(--pen); }
.topbar .grow { flex: 1; }
.page { padding: 22px 28px 64px; max-width: 1480px; width: 100%; }
.page.wide { max-width: none; }

/* --- controls ------------------------------------------------------------------ */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 36px; padding: 0 14px; border: 1px solid var(--rule-strong); border-radius: var(--r-md); background: var(--paper); color: var(--ink); font: 480 var(--s-14)/1 var(--text); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--pencil); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--pen); border-color: var(--pen); color: var(--pen-ink); font-weight: 520; }
.btn.primary:hover { background: var(--pen-hover); }
.btn.danger { color: var(--stamp); border-color: color-mix(in srgb, var(--stamp) 45%, var(--rule)); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--pen); }
.btn.ghost:hover { background: var(--pen-wash); }
.btn.small { min-height: 30px; padding: 0 10px; font-size: var(--s-13); }
.btn svg { width: 16px; height: 16px; }
kbd { font: 500 11.5px/1 var(--figures); padding: 2px 5px; border: 1px solid var(--rule-strong); border-bottom-width: 2px; border-radius: 4px; color: var(--pencil); background: var(--paper); }
.btn.primary kbd { color: var(--pen-ink); background: transparent; border-color: color-mix(in srgb, var(--pen-ink) 50%, transparent); }

.field { display: grid; gap: 4px; min-width: 0; align-content: start; }
.field > label, .label { font-size: var(--s-12); color: var(--pencil); font-weight: 440; }
.input, select.input, textarea.input { width: 100%; min-height: 36px; padding: 6px 10px; border: 1px solid var(--rule-strong); border-radius: var(--r-sm); background: var(--paper); color: var(--ink); font: 400 var(--s-14)/1.3 var(--text); }
textarea.input { min-height: 64px; resize: vertical; line-height: 1.45; }
.input:hover { border-color: var(--pencil); }
.input:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; border-color: var(--focus); }
.input:disabled { background: var(--paper-2); color: var(--ink); border-style: dashed; }
.input.check { background: var(--carbon); border-color: color-mix(in srgb, var(--carbon-ink) 40%, var(--rule)); }
.input.num { text-align: right; }
.hint { font-size: var(--s-12); color: var(--pencil); }
.hint.warn { color: var(--carbon-ink); }
.hint.bad { color: var(--stamp); }
.hint.good { color: var(--ledger); }
.check-row { display: flex; align-items: center; gap: 8px; }
.check-row input { width: 16px; height: 16px; accent-color: var(--pen); }

.segmented { display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--r-md); background: var(--paper-2); box-shadow: inset 0 0 0 1px var(--rule); }
.segmented button { border: 0; background: transparent; color: var(--pencil); font: 460 var(--s-13)/1 var(--text); padding: 8px 12px; border-radius: 5px; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.segmented button[aria-pressed="true"] { background: var(--paper); color: var(--ink); box-shadow: 0 0 0 1px var(--rule), 0 1px 2px rgba(0,0,0,.06); }
.segmented .n { font-family: var(--figures); font-weight: 600; }

/* --- notices ------------------------------------------------------------------ */
.notice { display: grid; grid-template-columns: 18px 1fr; gap: 10px; padding: 11px 14px; border-radius: var(--r-md); border: 1px solid var(--rule); background: var(--paper); }
.notice svg { width: 18px; height: 18px; margin-top: 1px; }
.notice.block { border-color: color-mix(in srgb, var(--stamp) 40%, var(--rule)); background: var(--stamp-wash); }
.notice.block svg { color: var(--stamp); }
.notice.check { border-color: color-mix(in srgb, var(--carbon-ink) 30%, var(--rule)); background: color-mix(in srgb, var(--carbon) 55%, var(--paper)); }
.notice.check svg { color: var(--carbon-ink); }
.notice.done { border-color: color-mix(in srgb, var(--ledger) 35%, var(--rule)); background: var(--ledger-wash); }
.notice.done svg { color: var(--ledger); }
.notice ul { margin: 4px 0 0; padding-left: 18px; }
.notice li + li { margin-top: 2px; }
.stack { display: grid; gap: 10px; }

/* --- status: the rubber stamp ------------------------------------------------- */
.stamp { display: inline-flex; align-items: center; gap: 5px; padding: 1px 7px; border: 2.5px double currentColor; border-radius: 3px; font: 600 var(--s-12)/1.5 var(--text); white-space: nowrap; }
.stamp.needs_review, .stamp.not_delivered, .stamp.failed { color: var(--stamp); }
.stamp.ready, .stamp.scheduled, .stamp.approved { color: var(--pen); }
.stamp.posted, .stamp.delivered { color: var(--ledger); border-style: solid; border-width: 1.5px; }
.stamp.completed { color: var(--ledger); background: var(--ledger-wash); }
.stamp.rejected, .stamp.not_confirmed { color: var(--pencil); }
.state { display: inline-flex; align-items: center; gap: 7px; font-size: var(--s-13); white-space: nowrap; }
.state i { width: 8px; height: 8px; border-radius: 50%; background: var(--pencil); }
.state.needs_review i { background: var(--stamp); }
.state.ready i { background: var(--pen); }
.state.approved i, .state.posted i { background: var(--ledger); }
.state.rejected { color: var(--pencil); }

/* --- tables -------------------------------------------------------------------- */
.sheet { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r-md); box-shadow: var(--shadow); overflow: hidden; }
.sheet + .sheet { margin-top: 18px; }
.sheet-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--rule); }
.sheet-head .grow { flex: 1; }
.sheet-body { padding: 16px; }
.table-wrap { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; }
table.grid th { text-align: left; font-weight: 460; font-size: var(--s-12); color: var(--pencil); padding: 9px 12px; border-bottom: 1px solid var(--rule); background: var(--paper-2); white-space: nowrap; }
table.grid td { padding: 10px 12px; border-bottom: 1px solid var(--rule); vertical-align: top; }
table.grid tr:last-child td { border-bottom: 0; }
table.grid th.right, table.grid td.right { text-align: right; }
table.grid tbody tr.row-link { cursor: pointer; }
table.grid tbody tr.row-link:hover td { background: var(--paper-2); }
table.grid tbody tr[aria-selected="true"] td { background: var(--pen-wash); }
table.grid tbody tr[aria-selected="true"] td:first-child { box-shadow: inset 3px 0 0 var(--pen); }
.cell-title { font-weight: 480; }
.cell-sub { font-size: var(--s-12); color: var(--pencil); margin-top: 1px; }

.empty { padding: 48px 24px; text-align: center; color: var(--pencil); }
.empty h2 { color: var(--ink); margin-bottom: 6px; }
.empty .btn { margin-top: 14px; }

/* --- toolbar ------------------------------------------------------------------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin-bottom: 14px; }
.toolbar .grow { flex: 1; }
.search { position: relative; min-width: 240px; }
.search svg { position: absolute; left: 10px; top: 10px; width: 16px; height: 16px; color: var(--pencil); }
.search .input { padding-left: 32px; }

/* --- review: the translation sheet ------------------------------------------- */
.review { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
.review.with-original { grid-template-columns: minmax(0, 1fr) minmax(380px, 38%); align-items: start; }
.original { position: sticky; top: 78px; height: calc(100vh - 96px); background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r-md); overflow: hidden; display: flex; flex-direction: column; }
.original header { display: flex; align-items: center; gap: 8px; padding: 8px 10px 8px 14px; border-bottom: 1px solid var(--rule); font-size: var(--s-13); }
.original header .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.original iframe, .original img { flex: 1; width: 100%; border: 0; object-fit: contain; background: var(--paper-2); }

.order-head { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px 16px; }
.order-head .wide { grid-column: span 2; }

.translate { width: 100%; border-collapse: separate; border-spacing: 0; }
.translate th { font-weight: 460; font-size: var(--s-12); color: var(--pencil); text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--rule); background: var(--paper-2); white-space: nowrap; }
.translate th.theirs-h { border-right: 0; }
.translate td { padding: 12px 10px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.translate tr:last-child td { border-bottom: 0; }
.translate .theirs { background: color-mix(in srgb, var(--paper-2) 70%, var(--paper)); width: 36%; }
.translate tr.flag .theirs { background: color-mix(in srgb, var(--carbon) 70%, var(--paper)); }
.translate .theirs .desc { font-weight: 460; }
.translate .theirs .meta { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 4px; font-size: var(--s-12); color: var(--pencil); }
.translate .gutter { width: 74px; padding-left: 0; padding-right: 0; text-align: center; border-left: 1px dashed var(--rule-strong); border-right: 1px dashed var(--rule-strong); }
.glyph { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; border: 1.5px solid currentColor; font: 600 14px/1 var(--figures); }
.glyph.exact { color: var(--ledger); }
.glyph.fuzzy { color: var(--carbon-ink); }
.glyph.none { color: var(--stamp); border-style: dashed; }
.factor { display: block; margin-top: 6px; font: 600 13px/1 var(--figures); color: var(--pen); }
.ours { display: grid; grid-template-columns: minmax(200px, 1fr) 92px 84px 104px; gap: 8px; align-items: start; }
.ours .field > label { font-size: 11.5px; }
.line-notes { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.lineno { font: 600 13px/1 var(--figures); color: var(--pencil); width: 26px; }

.totals { display: flex; justify-content: flex-end; gap: 26px; padding: 12px 16px; border-top: 1px solid var(--rule); background: var(--paper-2); }
.totals div { text-align: right; }
.totals .label { display: block; }

.decision { position: sticky; bottom: 0; z-index: 4; display: flex; align-items: center; gap: 10px; padding: 12px 16px; margin-top: 18px; border: 1px solid var(--rule); border-radius: var(--r-md); background: color-mix(in srgb, var(--paper) 94%, transparent); backdrop-filter: blur(6px); box-shadow: var(--shadow); }
.decision .grow { flex: 1; }

/* --- combobox ------------------------------------------------------------------ */
.combo { position: relative; }
.combo .list { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); max-height: 300px; overflow: auto; margin: 0; padding: 4px; list-style: none; background: var(--paper); border: 1px solid var(--rule-strong); border-radius: var(--r-md); box-shadow: var(--shadow); min-width: 320px; }
.combo .opt { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: baseline; padding: 7px 8px; border-radius: 5px; cursor: pointer; }
.combo .opt[aria-selected="true"] { background: var(--pen-wash); }
.combo .opt .code { color: var(--ink); }
.combo .opt .score { font: 600 12px/1 var(--figures); color: var(--ledger); }
.combo .group { padding: 8px 8px 4px; font-size: var(--s-12); color: var(--pencil); }

/* --- documents after approval ------------------------------------------------- */
.docs-list { display: grid; }
.doc-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--rule); }
.doc-row:first-child { border-top: 0; }
.doc-row .actions { display: flex; gap: 8px; }
.sendform { grid-column: 1 / -1; display: grid; gap: 10px; padding: 12px; border-radius: var(--r-md); background: var(--paper-2); }
.history { margin: 0; padding: 12px 16px 14px 34px; border-top: 1px solid var(--rule); font-size: var(--s-13); color: var(--pencil); }
.history li + li { margin-top: 4px; }
.history .bad { color: var(--stamp); }

/* --- dispatch ------------------------------------------------------------------ */
.daygroup td { background: var(--paper-2); font-weight: 520; padding-top: 8px; padding-bottom: 8px; }
.daygroup .num { font-size: 14px; }
.remark { min-width: 200px; }
.driver { min-width: 150px; }
.card .driver .input { min-height: 40px; }
.remark .input { min-height: 32px; font-size: var(--s-13); }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; }

.cards { display: none; }
@media (max-width: 760px) {
  .cards { display: grid; gap: 10px; }
  .dispatch-table { display: none; }
  .card { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r-md); padding: 14px; display: grid; gap: 10px; }
  .card .top { display: flex; justify-content: space-between; gap: 10px; align-items: start; }
  .card .row-actions .btn { flex: 1; min-height: 42px; }
}

/* --- rules --------------------------------------------------------------------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px 18px; }
.section { padding: 18px 16px; border-top: 1px solid var(--rule); display: grid; grid-template-columns: 220px 1fr; gap: 18px; }
.section:first-child { border-top: 0; }
.section > * { min-width: 0; } /* a wide table scrolls in its own box instead of stretching the column past a clipped sheet */
.section > header h2 { font-size: var(--s-14); }
.section > header p { margin-top: 4px; font-size: var(--s-13); color: var(--pencil); }
.days { display: flex; flex-wrap: wrap; gap: 6px; }
.days label { display: inline-flex; align-items: center; justify-content: center; width: 46px; height: 34px; border: 1px solid var(--rule-strong); border-radius: var(--r-sm); cursor: pointer; font-weight: 460; user-select: none; }
.days input { position: absolute; opacity: 0; pointer-events: none; }
.days label:has(input:checked) { background: var(--pen); border-color: var(--pen); color: var(--pen-ink); }
.days label:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.mail-doc { border: 1px solid var(--rule); border-radius: var(--r-md); padding: 12px; display: grid; gap: 10px; }
.mail-doc + .mail-doc { margin-top: 10px; }
.mail-doc .line { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.inherit { font-size: var(--s-12); color: var(--pencil); }

/* --- schedule strip ------------------------------------------------------------ */
.strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.day { border: 1px solid var(--rule); border-radius: var(--r-md); padding: 10px; background: var(--paper); min-height: 74px; }
.day.off { background: transparent; border-style: dashed; color: var(--pencil); }
.day.full { border-color: color-mix(in srgb, var(--stamp) 45%, var(--rule)); }
.day .d { display: flex; justify-content: space-between; font-size: var(--s-12); color: var(--pencil); }
.day .load { margin-top: 6px; font: 600 22px/1 var(--figures); }
.day .bar { margin-top: 8px; height: 4px; border-radius: 2px; background: var(--paper-2); overflow: hidden; }
.day .bar i { display: block; height: 100%; background: var(--pen); }
.day.full .bar i { background: var(--stamp); }

/* --- dialog, toast, drop ------------------------------------------------------- */
dialog { border: 1px solid var(--rule); border-radius: 10px; padding: 0; background: var(--paper); color: var(--ink); box-shadow: 0 30px 80px -20px rgba(0,0,0,.45); width: min(520px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(18, 20, 22, .45); }
dialog form { display: grid; gap: 14px; padding: 20px; }
dialog .body { color: var(--ink); }
dialog .body ul { margin: 6px 0 0; padding-left: 18px; }
dialog .buttons { display: flex; justify-content: flex-end; gap: 10px; }

.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 50; display: grid; gap: 8px; width: min(420px, calc(100vw - 36px)); }
.toast { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: start; padding: 12px 14px; border-radius: var(--r-md); background: var(--ink); color: var(--paper); box-shadow: var(--shadow); animation: rise .18s ease-out; }
.toast.bad { background: var(--stamp); color: #fff; }
.toast button { border: 0; background: transparent; color: inherit; cursor: pointer; font-size: 18px; line-height: 1; opacity: .8; }
@keyframes rise { from { transform: translateY(6px); opacity: 0; } }

.dropzone { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: color-mix(in srgb, var(--pen) 18%, transparent); border: 3px dashed var(--pen); font-size: var(--s-20); font-weight: 520; color: var(--pen); pointer-events: none; }

.skeleton { height: 14px; border-radius: 4px; background: linear-gradient(90deg, var(--paper-2), var(--rule), var(--paper-2)); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* --- small screens ------------------------------------------------------------- */
@media (max-width: 1100px) {
  .review.with-original { grid-template-columns: 1fr; }
  .original { position: static; height: 70vh; }
  .ours { grid-template-columns: 1fr 1fr; }
  .ours .field.sku { grid-column: 1 / -1; }
}
@media (max-width: 900px) {
  .section { grid-template-columns: 1fr; gap: 10px; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: fixed; z-index: 30; top: auto; bottom: 0; left: 0; right: 0; height: auto; flex-direction: row; justify-content: space-around; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--rule); background: var(--paper); }
  .rail .brand, .rail .spacer, .rail .system { display: none; }
  .navlink { flex-direction: column; gap: 3px; padding: 6px 4px; font-size: 11px; flex: 1; text-align: center; position: relative; }
  .navlink[aria-current="page"] { box-shadow: inset 0 3px 0 var(--pen); background: transparent; }
  .navlink .count { position: absolute; top: 0; right: 14%; margin: 0; min-width: 18px; font-size: 11px; padding: 0 4px; }
  .topbar { padding: 10px 16px; }
  .page { padding: 16px 16px 96px; }
  .translate thead { display: none; }
  .translate, .translate tbody, .translate tr, .translate td { display: block; width: 100%; }
  .translate tr { border-bottom: 1px solid var(--rule); }
  .translate td { border: 0; }
  .translate .theirs { width: 100%; }
  .translate .gutter { width: 100%; border: 0; text-align: left; padding: 4px 10px; display: flex; align-items: center; gap: 8px; }
  .translate .gutter .factor { margin: 0; }
  .ours { grid-template-columns: 1fr 1fr; }
  .decision { margin: 18px -16px 0; border-radius: 0; bottom: 62px; flex-wrap: wrap; }
  .decision .keys { display: none; }
  .totals { flex-wrap: wrap; gap: 12px 20px; }
  .toasts { bottom: 76px; }
  .hide-phone { display: none; }
}

/* --- phone fit ------------------------------------------------------------------ */
@media (max-width: 760px) {
  .segmented { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .segmented::-webkit-scrollbar { display: none; }
  .segmented button { flex: none; white-space: nowrap; }
  .toolbar .search { flex: 1 1 100%; min-width: 0; }
  .topbar { min-width: 0; }
  .topbar > * { min-width: 0; }
  .topbar select, .topbar .input { max-width: 56vw; text-overflow: ellipsis; }
}
input[type="date"].input, input[type="time"].input { min-width: 0; width: 100%; }

/* --- headline numbers, avatars, brand mark -------------------------------------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { display: grid; gap: 2px; align-content: start; text-align: left; padding: 14px 16px; border: 1px solid var(--rule); border-radius: var(--r-md); background: var(--paper); color: var(--ink); font: inherit; box-shadow: var(--shadow); position: relative; overflow: hidden; }
button.stat { cursor: pointer; }
button.stat:hover { border-color: var(--rule-strong); }
.stat[aria-pressed="true"] { border-color: var(--pen); box-shadow: 0 0 0 1px var(--pen), var(--shadow); }
.stat::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--rule-strong); }
.stat.hot::before { background: var(--stamp); }
.stat.go::before { background: var(--pen); }
.stat.warn::before { background: var(--carbon-ink); }
.stat.done::before { background: var(--ledger); }
.stat-label { font-size: var(--s-12); color: var(--pencil); font-weight: 460; }
.stat-value { font-size: 28px; line-height: 1.15; font-weight: 600; letter-spacing: -.01em; }
.stat-sub { font-size: var(--s-12); color: var(--pencil); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 760px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; } .stat { padding: 10px 12px; } .stat-value { font-size: 22px; } }

.avatar { flex: none; display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; font: 600 11.5px/1 var(--text); letter-spacing: .02em;
  color: hsl(var(--h) 45% 28%); background: hsl(var(--h) 55% 90%); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .avatar { color: hsl(var(--h) 60% 82%); background: hsl(var(--h) 30% 22%); } }
:root[data-theme="dark"] .avatar { color: hsl(var(--h) 60% 82%); background: hsl(var(--h) 30% 22%); }
.who { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.who.top { align-items: flex-start; }
.brand { align-items: center; }
.brand .mark { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--pen); color: var(--pen-ink); }
.brand .mark svg { width: 20px; height: 20px; }

.btn.big { min-height: 44px; font-size: var(--s-16); }
.rail .me { display: grid; gap: 2px; margin-top: 10px; }
.rail .me span { font-size: var(--s-12); }
.rail .me .btn { justify-self: start; margin-top: 6px; padding: 0; min-height: 24px; }
.invite-row { display: grid; grid-template-columns: minmax(200px, 1fr) minmax(180px, 260px) auto; gap: 14px; align-items: start; }
.invite-row > .btn { margin-top: 20px; }
.copy-row { display: flex; gap: 8px; margin-top: 8px; }
@media (max-width: 760px) { .invite-row { grid-template-columns: 1fr; } .invite-row > .btn { margin-top: 0; } }

/* --- onboarding ---------------------------------------------------------------------- */
.onboard { min-height: 100vh; display: flex; flex-direction: column; }
.onboard-head { display: flex; align-items: center; padding: 16px 28px; }
.onboard-head .brand { padding: 0; }
.onboard-head .grow, .onboard-actions .grow { flex: 1; }
.onboard-main { flex: 1; display: grid; grid-template-columns: 220px minmax(0, 680px); gap: 40px; justify-content: center; padding: 24px 28px 64px; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; align-content: start; position: sticky; top: 24px; }
.steps li { display: flex; align-items: center; gap: 10px; padding: 8px 4px; color: var(--pencil); }
.steps .step-dot { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--rule-strong); font: 600 12px/1 var(--figures); flex: none; }
.steps .step-dot svg { width: 14px; height: 14px; }
.steps li.now { color: var(--ink); font-weight: 560; }
.steps li.now .step-dot { border-color: var(--pen); background: var(--pen); color: var(--pen-ink); }
.steps li.done .step-dot { border-color: var(--ledger); color: var(--ledger); }
.onboard-card { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r-md); box-shadow: var(--shadow); padding: 28px 32px; display: grid; gap: 16px; align-content: start; }
.onboard-card h1 { font-size: 26px; }
.onboard-card .lead { color: var(--pencil); max-width: 60ch; }
.onboard-card .onboard-sub { font-size: 17px; margin-top: 8px; }
.onboard-block { display: grid; gap: 12px; }
.onboard-block > .btn { justify-self: start; }
.onboard-actions { display: flex; gap: 10px; align-items: center; padding-top: 12px; border-top: 1px solid var(--rule); margin-top: 6px; }
.sys-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.sys-card { display: grid; gap: 6px; text-align: left; padding: 16px; border: 1.5px solid var(--rule); border-radius: var(--r-md); background: var(--paper); color: var(--ink); font: inherit; cursor: pointer; }
.sys-card:hover:not(:disabled) { border-color: var(--pen); }
.sys-card.chosen { border-color: var(--pen); box-shadow: 0 0 0 1px var(--pen); }
.sys-card:disabled { cursor: not-allowed; opacity: .7; }
.sys-name { font-weight: 600; font-size: var(--s-16); }
.sys-blurb { color: var(--pencil); font-size: var(--s-13); }
.soon { font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 999px; background: var(--carbon); color: var(--carbon-ink); vertical-align: 2px; }
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; }
.checklist svg { width: 20px; height: 20px; flex: none; }
.checklist .ok svg { color: var(--ledger); }
.checklist .todo svg { color: var(--carbon-ink); }
@media (max-width: 760px) {
  .onboard-main { grid-template-columns: 1fr; gap: 16px; padding: 8px 16px 48px; }
  .steps { position: static; display: flex; flex-wrap: wrap; gap: 8px 12px; }
  .steps li span:last-child { font-size: var(--s-13); }
  .steps li > span:last-child { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; } /* the heading says which step; screen readers still hear the names */
  .onboard-card { padding: 20px 16px; }
  .sys-grid { grid-template-columns: 1fr; }
  .onboard-actions { flex-wrap: wrap; }
}

/* Customer and item lists from CSV */
.upload-rows { display: grid; gap: 10px; }
.upload-row { display: flex; gap: 14px; align-items: flex-start; justify-content: space-between; padding: 12px 14px; border: 1px solid var(--rule); border-radius: 10px; }
.upload-row > div { min-width: 0; }
.upload-row .hint { margin-top: 2px; overflow-wrap: anywhere; }
@media (max-width: 560px) { .upload-row { flex-direction: column; } }

/* Billing */
.billing .gap { margin-bottom: 12px; }
.billing .progress.big { height: 10px; margin-top: 0; }
.billing .h-sec { font-size: var(--s-16); margin: 22px 0 4px; }
.daily { margin: 0; }
.daily svg { width: 100%; height: 130px; display: block; color: var(--pen); }
.daily .bar { fill: currentColor; opacity: .85; }
.daily .bar.none { opacity: .15; }
.daily .axis { display: flex; justify-content: space-between; margin-top: 4px; font-size: var(--s-12); color: var(--pencil); }
.daily figcaption { margin-top: 6px; }
.plan-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.plan-card { display: flex; flex-direction: column; gap: 10px; padding: 18px; border: 1px solid var(--rule); border-radius: var(--r-lg, var(--r-md)); background: var(--paper); box-shadow: var(--shadow); }
.plan-card.current { border-color: var(--pen); box-shadow: 0 0 0 1px var(--pen), var(--shadow); }
.plan-card h3 { font-size: var(--s-16); }
.plan-price b { font-size: 26px; font-weight: 650; }
.plan-price span { color: var(--pencil); font-size: var(--s-13); }
.plan-card ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: var(--s-13); }
.plan-card li { display: grid; grid-template-columns: 16px 1fr; gap: 8px; }
.plan-card li svg { width: 16px; height: 16px; color: var(--ledger); margin-top: 1px; }
.plan-action { margin-top: auto; padding-top: 6px; }
.plan-action .btn { width: 100%; }
.pill { display: inline-block; padding: 4px 10px; border-radius: 999px; background: var(--pen-wash); color: var(--pen); font-size: var(--s-13); font-weight: 560; }
.danger-zone .sheet-body { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
@media (max-width: 900px) { .plan-grid { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .danger-zone .sheet-body { flex-direction: column; align-items: stretch; } }

/* Plan choice on sign-up, and the payment note back in onboarding */
.plan-pick { border: 0; margin: 4px 0 0; padding: 0; display: grid; gap: 8px; }
.plan-pick legend { font-weight: 600; font-size: 14px; margin-bottom: 6px; padding: 0; }
.plan-opt { display: grid; grid-template-columns: auto 1fr auto; column-gap: 10px; row-gap: 2px; align-items: center; padding: 10px 12px;
  border: 1px solid var(--rule-strong); border-radius: 10px; background: var(--paper); cursor: pointer; }
.plan-opt input { grid-row: span 2; width: 18px; height: 18px; margin: 0; accent-color: var(--pen); }
.plan-opt-name { font-weight: 600; }
.plan-opt-price { font-weight: 600; font-feature-settings: "tnum"; text-align: right; }
.plan-opt-sub { grid-column: 2 / 4; color: var(--pencil); font-size: 13px; }
.plan-opt.on { border-color: var(--pen); background: var(--pen-wash); box-shadow: 0 0 0 1px var(--pen) inset; }
.plan-opt:focus-within { outline: 2px solid var(--pen); outline-offset: 2px; }
.onboard-note { grid-column: 1 / -1; }
