@font-face { font-family: "Manrope"; font-weight: 400; font-display: swap; src: url(fonts/manrope-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Manrope"; font-weight: 500; font-display: swap; src: url(fonts/manrope-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Manrope"; font-weight: 600; font-display: swap; src: url(fonts/manrope-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Manrope"; font-weight: 700; font-display: swap; src: url(fonts/manrope-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Saira Stencil One"; font-weight: 400; font-display: swap; src: url(fonts/saira-stencil-one-latin-400-normal.woff2) format("woff2"); }

:root {
  --kraft: #b98f5a; --kraft-deep: #a57b48; --kraft-pale: #f3ebdf;
  --ink: #16130f; --muted: #5f574c; --sheet: #fff; --tint: #f7f5f1; --hover: #ebe5da; --s2s: #e9f1fb; --s2s-hover: #d3e3f5; --kazang: #e8f5eb; --kazang-hover: #cfe9d6;
  --line: #e4dfd7; --rule: #efece7; --control: #a89f92;
  --blue: #0b5ea8; --blue-soft: #e3eef8;
  --good: #1e6f43; --good-soft: #dff3e5; --warn: #8a4b08; --warn-soft: #fdf0d5; --bad: #b3261e; --bad-soft: #fde7e4;
  --bar: 44px; --tex: url(kraft.png);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { font-size: 14px; color-scheme: light; scrollbar-color: var(--control) transparent; }
body { margin: 0; background: var(--kraft) var(--tex); color: var(--ink); font-family: "Manrope", "Segoe UI", system-ui, sans-serif; font-size: 15px; line-height: 1.3; caret-color: var(--blue); }
::selection { background: var(--blue); color: #fff; }
h1 { font-size: 20px; font-weight: 700; margin: 0; white-space: nowrap; }
h2 { font-size: 15px; font-weight: 600; margin: 0 0 8px; }
h3 { font-size: 13px; font-weight: 600; margin: 12px 0 6px; }
p { margin: 6px 0; }
a { color: var(--ink); text-underline-offset: 2px; }
.stencil { font-family: "Saira Stencil One", "Manrope", sans-serif; font-weight: 400; letter-spacing: .02em; }

/* Frame: the kraft bar, and one white sheet below it */
.bar { position: sticky; top: 0; z-index: 20; height: var(--bar); display: flex; align-items: center; gap: 4px; padding: 0 8px; background: var(--kraft) var(--tex); }
.bar .mark { font: 27px/1 "Saira Stencil One", sans-serif; color: var(--ink); text-decoration: none; padding: 0 10px 0 6px; letter-spacing: .02em; }
.bar a.navlink { color: var(--ink); text-decoration: none; font-weight: 600; font-size: 15px; padding: 5px 11px; border-radius: 4px; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; transition: background-color .12s; }
.bar a.navlink:hover { background: var(--kraft-deep); }
/* The page you're on is a tab of the white sheet. */
.bar nav { align-self: stretch; }
.bar a.navlink.on, .bar a.navlink.on:hover { background: var(--sheet); border-radius: 6px 6px 0 0; padding: 9px 11px 11px; align-self: flex-end; }
.bar > a.navlink.on { align-self: flex-end; }
.bar a.new { background: var(--ink); color: #fff; font-weight: 700; padding: 6px 13px; border-radius: 4px; text-decoration: none; white-space: nowrap; margin-right: 8px; transition: background-color .12s; }
.bar a.new:hover { background: #3a342c; }
.bar a.new.on { background: var(--sheet); color: var(--ink); border-radius: 6px 6px 0 0; align-self: flex-end; padding: 9px 13px 11px; }
.bar .count { background: var(--bad); color: #fff; font-size: 13px; font-weight: 700; min-width: 19px; height: 19px; line-height: 19px; text-align: center; border-radius: 10px; padding: 0 5px; font-variant-numeric: tabular-nums; }
.bar .sp { flex: 1; min-width: 8px; }
.find { position: relative; width: 340px; }
.find input { min-height: 30px; height: 30px; margin: 0; border-color: var(--kraft-deep); background: #fff; }
.find .results { width: 460px; left: auto; right: 0; }
.results .group { padding: 6px 10px 2px; font-size: 13px; color: var(--muted); font-weight: 600; }
.bar .who { display: flex; align-items: center; gap: 8px; margin-left: 6px; font-weight: 600; white-space: nowrap; }
.bar .who button { background: transparent; border-color: var(--ink); color: var(--ink); min-height: 28px; padding: 2px 10px; }
.bar .who button:hover { background: var(--kraft-deep); }
main { background: var(--sheet); margin: 0 8px 8px; border-radius: 8px; padding: 12px 20px 24px; min-height: calc(100vh - var(--bar) - 8px); min-width: 0; }

/* Page title row: title, sub tabs and actions share one line */
.head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 6px 24px; border-bottom: 1px solid var(--line); padding-bottom: 8px; margin-bottom: 12px; min-height: 42px; }
.head .muted { font-size: 13px; }
.head .acts { margin-left: auto; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.head:has(.subtabs) { padding-bottom: 0; }
.head:has(.subtabs) .acts { padding-bottom: 6px; }
.head:has(.subtabs) h1 { padding-bottom: 6px; }
.subtabs { display: flex; flex-wrap: wrap; gap: 18px; }
.subtabs a { padding: 4px 1px 7px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: 15px; border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.subtabs a:hover { color: var(--ink); }
.subtabs a.on { color: var(--ink); border-bottom-color: var(--blue); }
.tools { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-bottom: 10px; }
.tools input[type=search], .tools .q { width: 340px; margin: 0; }
.tools input[type=date] { width: 150px; margin: 0; }
.tools .end { margin-left: auto; color: var(--muted); }

.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.grow { flex: 1; min-width: 0; }
.panel { border: 1px solid var(--line); border-radius: 4px; padding: 12px; margin-bottom: 12px; background: var(--sheet); }
.panel.table-wrap { border: 0; padding: 0; }
.tinted { background: var(--tint); border-color: var(--line); }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.sticky { position: sticky; top: calc(var(--bar) + 8px); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Tables: rules and alignment, header stays in view */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; color: var(--muted); font-size: 13px; font-weight: 500; border-bottom: 1px solid var(--control); padding: 4px 8px; white-space: nowrap; background: var(--sheet); }
th.num { text-align: right; }
td { border-bottom: 1px solid var(--rule); padding: 4px 8px; vertical-align: middle; }
main td, dialog td { font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }
tr.click, table.compact tbody tr { cursor: pointer; }
/* The row under the mouse, or picked with the arrow keys, is greyed so it's clear which one you're on. */
main tbody tr:hover td, dialog tbody tr:hover td { background: var(--hover); }
main tbody tr { scroll-margin: calc(var(--bar) + 40px) 0 24px; }
main tbody tr.kb td { background: var(--hover); }
main tbody tr.kb td:first-child { box-shadow: inset 3px 0 0 var(--blue); }
main tbody tr.src-shop2shop td { background: var(--s2s); }
main tbody tr.src-kazang td { background: var(--kazang); }
main tbody tr.src-shop2shop:hover td, main tbody tr.src-shop2shop.kb td { background: var(--s2s-hover); }
main tbody tr.src-kazang:hover td, main tbody tr.src-kazang.kb td { background: var(--kazang-hover); }
.link-list button:hover, .link-list button:focus-visible { background: var(--hover); }
/* Book customers as account cards: a stripe for where they stand, the balance large, the age of the debt as a bar. */
.accts { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.acct { display: flex; flex-direction: column; gap: 4px; min-height: 196px; padding: 14px 14px 12px; background: var(--sheet); border: 1px solid var(--line); border-top: 6px solid var(--control); border-radius: 6px; color: var(--ink); text-decoration: none; transition: border-color .12s, box-shadow .12s, transform .12s; }
.acct:hover, .acct:focus-visible { border-color: var(--ink-lift, #3a342c); box-shadow: 0 6px 16px #0002; transform: translateY(-1px); }
.acct.owes { border-top-color: var(--warn); }
.acct.late { border-top-color: var(--bad); }
.acct.credit { border-top-color: var(--good); }
.acct-name { font-weight: 700; font-size: 15px; text-transform: uppercase; letter-spacing: .02em; line-height: 1.2; min-height: 2.4em; }
.acct-label { font-size: 13px; color: var(--muted); margin-top: 4px; }
.acct.late .acct-label { color: var(--bad); font-weight: 600; }
.acct.credit .acct-label { color: var(--good); font-weight: 600; }
.acct-bal { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.acct.settled .acct-bal { color: var(--muted); }
.age-bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--rule); margin-top: 8px; }
.age-bar i { display: block; }
.age-bar .current { background: var(--ink); }
.age-bar .d31 { background: var(--warn); }
.age-bar .d61 { background: #c96a1b; }
.age-bar .d91 { background: var(--bad); }
.age-key { display: flex; flex-direction: column; gap: 1px; font-size: 13px; color: var(--muted); min-height: 1.3em; }
.age-key .late { color: var(--bad); font-weight: 600; }
.acct-foot { margin-top: auto; padding-top: 8px; border-top: 1px solid var(--rule); display: flex; flex-direction: column; gap: 1px; font-size: 13px; color: var(--muted); }
/* A customer's book as running math: before, plus or minus, after, ending on the balance now. */
.ledger { margin-top: 16px; }
.ledger-rows { display: grid; }
.ledger-row { display: grid; grid-template-columns: minmax(180px, 1.4fr) 1fr 1fr 1fr; gap: 12px; align-items: baseline; padding: 8px 4px; border-bottom: 1px solid var(--rule); font-size: 20px; font-variant-numeric: tabular-nums; }
.ledger-row.head { font-size: 13px; color: var(--muted); font-weight: 500; border-bottom: 1px solid var(--control); padding-top: 0; }
.ledger-row .num { text-align: right; }
.ledger-what { display: flex; flex-direction: column; font-size: 17px; font-weight: 600; }
.ledger-what small { font-size: 13px; font-weight: 400; color: var(--muted); }
.ledger-row.add .ledger-change { color: var(--ink); font-weight: 700; }
.ledger-row.less .ledger-change { color: var(--good); font-weight: 700; }
.ledger-row:hover { background: var(--hover); }
.ledger-row.head:hover, .ledger-row.total:hover { background: none; }
.ledger-row.total { border-top: 2px solid var(--ink); border-bottom: 0; font-size: 28px; font-weight: 700; padding-top: 12px; }
.ledger-row.total span:first-child { font-size: 17px; align-self: center; }
/* Money in the Payments lists, larger so amounts read at a glance. */
td .amt { font-size: 18px; font-weight: 700; }
tfoot td { font-weight: 700; border-top: 2px solid var(--ink); border-bottom: 0; }
main td.name, main td > b:first-child { font-weight: 600; }
main td.name, td.nowrap { white-space: nowrap; }
main th.wide { width: 40%; }
.acts-cell { white-space: nowrap; text-align: right; }
.acts-cell button + button { margin-left: 10px; }

/* Controls */
button, .btn { font: inherit; font-weight: 500; padding: 4px 12px; min-height: 32px; border-radius: 4px; border: 1px solid var(--control); background: #fff; color: var(--ink); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; white-space: nowrap; transition: background-color .12s, border-color .12s; }
button:hover, .btn:hover { background: var(--tint); border-color: var(--ink); }
button:active, .btn:active { background: var(--line); }
button.primary, .btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 600; }
button.primary:hover, .btn.primary:hover { background: #3a342c; }
button.danger { color: var(--bad); border-color: var(--bad); }
button.danger:hover { background: var(--bad-soft); }
button.link { border: 0; background: none; color: var(--ink); padding: 0; min-height: 0; font-weight: 500; text-decoration: underline; text-decoration-color: var(--control); text-underline-offset: 2px; }
button.link:hover { text-decoration-color: var(--ink); background: none; }
button.link-bad { color: var(--muted); }
button.link-bad:hover, button.link-bad:focus-visible { color: var(--bad); text-decoration-color: var(--bad); }
button:disabled { opacity: .55; cursor: not-allowed; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
label { display: block; font-size: 13px; font-weight: 500; color: var(--muted); }
input, select, textarea { font: inherit; font-weight: 400; color: var(--ink); width: 100%; padding: 4px 8px; min-height: 32px; border: 1px solid var(--control); border-radius: 4px; background: #fff; margin-top: 2px; accent-color: var(--blue); }
select { appearance: none; padding-right: 26px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%2316130f' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 8px center / 11px; }
input[type=date]::-webkit-calendar-picker-indicator { cursor: pointer; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M1 3h14v12H1zM1 7h14M5 1v4M11 1v4' fill='none' stroke='%2316130f' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat center / 15px; }

input:hover, select:hover, textarea:hover { border-color: var(--ink); }
input::placeholder { color: var(--muted); }
input[type=checkbox] { width: 18px; min-height: 18px; margin: 0; accent-color: var(--blue); flex: none; }
.check { display: flex; gap: 8px; align-items: center; color: var(--ink); font-size: 15px; font-weight: 400; }
.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px 12px; }
.form .full { grid-column: 1 / -1; }
.seg { display: inline-flex; }
.seg button { border-radius: 0; margin-left: -1px; }
.seg button:first-child { border-radius: 4px 0 0 4px; margin-left: 0; }
.seg button:last-child { border-radius: 0 4px 4px 0; }
.seg button.on { background: var(--ink); border-color: var(--ink); color: #fff; position: relative; }
.seg button b { font-weight: 700; margin-left: 6px; font-variant-numeric: tabular-nums; }

/* Status */
/* Status is a small printed mark and a word, not a coloured pill. */
.tag { display: inline-flex; align-items: center; gap: 5px; flex: none; font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.tag::before { content: ''; flex: none; width: 10px; height: 10px; background: var(--control); }
.tag.good { color: var(--good); }
.tag.good::before { background: var(--good); }
.tag.warn { color: var(--warn); }
.tag.warn::before { background: linear-gradient(90deg, var(--warn) 50%, transparent 50%); box-shadow: inset 0 0 0 1px var(--warn); } /* taste-skill-ignore */
.tag.bad { color: var(--bad); }
.tag.bad::before { background: var(--bad); }
.tag.info { color: var(--blue); }
.tag.info::before { background: var(--blue); }
/* Collection uses the pallet gauge's own marks: solid is gone, hatched is part gone, empty is still on the floor. */
.tag.stock { color: var(--ink); }
.tag.stock::before { background: var(--blue); }
.tag.stock.part::before { background: repeating-linear-gradient(135deg, var(--blue) 0 1.5px, #fff 1.5px 4px); box-shadow: inset 0 0 0 1px var(--blue); } /* taste-skill-ignore */
.tag.stock.none { color: var(--muted); }
.tag.stock.none::before { background: none; box-shadow: inset 0 0 0 1px var(--control); } /* taste-skill-ignore */
.note { padding: 6px 10px; border-radius: 4px; margin: 6px 0; background: var(--warn-soft); color: var(--warn); }
.note.bad { background: var(--bad-soft); color: var(--bad); }
.note.info { background: var(--blue-soft); color: #0a4c87; }
.gp-low { color: var(--bad); font-weight: 700; }

/* The pallet gauge: one block per pallet, a short block for loose cases, hatched where it's sold but not collected.
   The hatching carries the data, so it reads without relying on colour. taste-skill-ignore */
.gauge { display: inline-flex; flex-wrap: nowrap; align-items: center; gap: 2px; height: 14px; vertical-align: middle; }
.gauge i { display: block; flex: none; width: 12px; height: 14px; background: linear-gradient(90deg, var(--blue) var(--f, 100%), transparent var(--f, 100%)), repeating-linear-gradient(135deg, var(--blue) 0 1.5px, #fff 1.5px 4px); box-shadow: inset 0 0 0 1px var(--blue); } /* taste-skill-ignore */
.gauge.over i { background: repeating-linear-gradient(135deg, var(--bad) 0 1.5px, #fff 1.5px 4px); box-shadow: inset 0 0 0 1px var(--bad); } /* taste-skill-ignore */
.gauge .more { margin-left: 4px; font-size: 13px; color: var(--muted); }
.free { display: block; font-size: 17px; font-weight: 700; line-height: 1; }
td.stencil { font-size: 17px; line-height: 1; }
.gauge-key { display: inline-flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); }
.gauge-key span { display: inline-flex; align-items: center; gap: 5px; }

/* Lists that pop out */
.search { position: relative; }
/* In a form the matches sit under the box and push the page down, so nothing is hidden behind a pop-up. */
.search .results { position: static; margin-top: 4px; box-shadow: none; border-color: var(--control); max-height: 360px; }

.results { position: absolute; z-index: 30; left: 0; right: 0; top: 100%; margin-top: 2px; background: #fff; border: 1px solid var(--ink); border-radius: 4px; max-height: 420px; overflow-y: auto; overflow-x: hidden; box-shadow: 0 6px 18px #0003; }
.results button { display: flex; width: 100%; justify-content: space-between; gap: 16px; text-align: left; border: 0; border-bottom: 1px solid var(--rule); border-radius: 0; min-height: 30px; font-weight: 400; }
.results button.active, .results button:hover { background: var(--blue-soft); }
.results button > span:first-child { font-weight: 600; white-space: normal; }

/* New invoice */
.bill-to { display: grid; grid-template-columns: 300px 220px minmax(280px, 1fr); gap: 12px; margin-bottom: 10px; align-items: start; }
#nameWrap[hidden] { display: none; }
.bill-to:has(#nameWrap[hidden]) { grid-template-columns: 300px minmax(280px, 1fr); }
.qty-box { background: var(--blue-soft); border-radius: 4px; padding: 8px 10px; margin-bottom: 10px; }
.qty-row { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: flex-end; }
.qty-name { min-width: 230px; flex: 1; align-self: center; }
.qty-name b { display: block; font-size: 15px; font-weight: 700; }
.qty-row .field { width: 96px; }
.qty-row .field.price { width: 150px; }
.qty-box .answer { font-weight: 700; font-size: 15px; align-self: center; min-width: 170px; }
.line-actions { display: flex; gap: 12px; justify-content: flex-end; white-space: nowrap; }
.line-input { width: 74px; text-align: right; margin: 0; }
.input-bad { border-color: var(--bad) !important; background: var(--bad-soft); color: var(--bad); font-weight: 700; }
.price-box { border: 3px solid var(--ink); border-radius: 4px; font-size: 17px; font-weight: 700; min-height: 38px; text-align: right; }
.line-input.price-box { width: 120px; }
.total-box { border: 3px solid var(--ink); border-radius: 4px; padding: 6px 12px; margin-bottom: 6px; text-align: right; font-size: 32px; line-height: 1.1; font-weight: 700; white-space: nowrap; }
.big-total { font-size: 25px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.15; }
.till { display: flex; flex-direction: column; gap: 6px; }
.till button.primary, .panel form > button.primary { min-height: 38px; width: 100%; }
.till #savePrint { min-height: 46px; font-size: 17px; }
.till .row button { flex: 1; }
.details-row { background: var(--tint); }
.details-box { display: flex; flex-wrap: wrap; gap: 6px 28px; margin-top: 6px; }
.details-row .details-box { margin: 0; }
.details-box div { display: flex; flex-direction: column; }
.details-box span { font-size: 13px; color: var(--muted); }
.details-box b { font-size: 15px; font-variant-numeric: tabular-nums; }
.details-box small { color: var(--muted); font-size: 13px; }
.pay-row { display: grid; grid-template-columns: 76px 1fr 1fr auto; gap: 6px; align-items: center; margin-bottom: 6px; }
.pay-row input { margin: 0; }
.short-banner { background: var(--bad); color: #fff; border-radius: 4px; padding: 6px 12px; margin-bottom: 12px; font-size: 19px; font-weight: 700; display: flex; align-items: baseline; gap: 14px; }
.short-banner small { font-size: 13px; font-weight: 500; }

/* Key figures: one strip split by rules */
.kpis, .tiles { display: flex; flex-wrap: wrap; border-top: 2px solid var(--ink); border-bottom: 1px solid var(--control); margin-bottom: 12px; }
.kpi, .tile { flex: 1 1 150px; padding: 5px 14px 6px; border-right: 1px solid var(--line); min-width: 0; }
.kpi:first-child, .tile:first-child { padding-left: 0; }
.kpi:last-child, .tile:last-child { border-right: 0; }
.kpi span, .tile span { display: block; color: var(--muted); font-size: 13px; }
.kpi b, .tile b { display: block; font-size: 23px; font-weight: 500; line-height: 1.2; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tile { display: flex; flex-direction: column-reverse; justify-content: flex-end; }
.kpi.neg b { color: var(--bad); }
.presets input { width: 150px; margin: 0; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }

/* Settings: its own list of areas down the side */
.settings { display: grid; grid-template-columns: 196px minmax(0, 1fr); gap: 24px; align-items: start; }
.settings nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: calc(var(--bar) + 8px); }
.settings nav a { padding: 5px 10px; border-radius: 4px; color: var(--ink); text-decoration: none; font-weight: 500; }
.settings nav a:hover { background: var(--tint); }
.settings nav a.on { background: var(--ink); color: #fff; font-weight: 600; }
.settings-body { max-width: 1180px; }

dialog { border: 0; border-radius: 6px; padding: 16px 18px; width: min(640px, calc(100vw - 32px)); box-shadow: 0 16px 50px #0005; color: var(--ink); }
dialog::backdrop { background: #16130f80; }
dialog h2 { font-size: 18px; font-weight: 700; }
.link-list { display: flex; flex-direction: column; gap: 4px; }
.link-list button { display: flex; justify-content: space-between; align-items: center; gap: 16px; width: 100%; text-align: left; min-height: 38px; }
details summary { cursor: pointer; }
#toast { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 50; background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 4px; max-width: calc(100vw - 32px); display: none; font-weight: 500; }
#toast.show { display: block; }
#toast.err { background: var(--bad); }

/* Login */
.login { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 16px; background: var(--kraft) var(--tex); }
.login .mark { font: 76px/1 "Saira Stencil One", sans-serif; color: var(--ink); letter-spacing: .02em; }
.login .card { background: #fff; border-radius: 8px; padding: 20px; width: min(440px, 100%); }
.user-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.user-grid button { min-height: 58px; font-size: 18px; font-weight: 600; }

/* Floor tablet: same world, bigger for fingers and worse light */
.floor { font-size: 16px; }
.floor-top { position: sticky; top: 0; z-index: 20; background: var(--kraft) var(--tex); color: var(--ink); padding: 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.floor-top .mark { font: 30px/1 "Saira Stencil One", sans-serif; padding: 0 10px 0 6px; }
.floor-top a { color: var(--ink); text-decoration: none; padding: 11px 15px; border-radius: 4px; font-weight: 600; font-size: 17px; }
.floor-top a.on { background: var(--ink); color: #fff; }
.floor-top .sp { flex: 1; }
.floor-top button { background: transparent; color: var(--ink); border-color: var(--ink); min-height: 44px; }
.floor-body { background: #fff; margin: 0 8px 8px; border-radius: 8px; padding: 14px; min-height: calc(100vh - 70px); }
.floor-inner { max-width: 1100px; margin: 0 auto; }
.floor h2 { font-size: 18px; font-weight: 700; margin: 14px 0 8px; }
.floor h2:first-child { margin-top: 0; }
.floor h2.stop { color: var(--bad); }
.floor input { min-height: 50px; font-size: 17px; }
.floor table td { padding: 9px 8px; }
.floor th { font-size: 13px; }
.floor .btn, .floor button { min-height: 46px; }
.floor .tag { font-size: 16px; font-weight: 700; }
.floor .tag::before { width: 13px; height: 13px; }
.floor .small { font-size: 13px; }
.floor-card { display: flex; gap: 16px; align-items: center; justify-content: space-between; width: 100%; text-align: left; background: #fff; border: 1px solid var(--control); border-radius: 4px; padding: 10px 14px; margin-bottom: 8px; min-height: 68px; color: inherit; font-weight: 400; white-space: normal; }
.floor-card:hover { background: var(--tint); }
.floor-card.unpaid, .floor-card.part { border-color: var(--bad); }
.floor-card b { font-size: 18px; font-weight: 700; margin-right: 10px; }
.floor-card .state { text-align: right; flex: none; }
.state .tag + .tag { margin-left: 12px; }
.status-banner { padding: 12px; border-radius: 4px; font-size: 26px; font-weight: 700; text-align: center; margin-bottom: 12px; line-height: 1.1; }
.status-banner small { display: block; font-size: 15px; font-weight: 500; margin-top: 2px; }
.status-banner.paid { background: var(--good); color: #fff; }
.status-banner.unpaid { background: var(--bad); color: #fff; }
.status-banner.cancelled { background: #3a342c; color: #fff; }
/* Stock take scan screen */
.st-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.floor input.st-scan { width: 100%; min-height: 66px; font-size: 24px; text-align: center; letter-spacing: .04em; border: 2px solid var(--ink); }
.st-scan:focus { outline: 3px solid var(--blue); outline-offset: 2px; }
.st-tools { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.st-idle { max-width: 640px; margin: 40px auto; text-align: center; }
.st-card { border-radius: 6px; padding: 14px 16px; margin: 10px 0; border: 2px solid var(--control); background: var(--tint); }
.st-card.ok { border-color: var(--good); background: var(--good-soft); }
.st-card.bad { border-color: var(--bad); background: var(--bad-soft); }
.st-card.warn { border-color: var(--warn); background: var(--warn-soft); }
.st-card.alarm { border-color: var(--bad); background: var(--bad); color: #fff; }
.st-card.alarm .st-label { color: #fff; }
.st-label { font-size: 15px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.st-card.ok .st-label { color: var(--good); }
.st-card.bad .st-label { color: var(--bad); }
.st-card.warn .st-label { color: var(--warn); }
.st-big { font-size: 26px; font-weight: 700; line-height: 1.15; margin: 4px 0; }
.st-cases { font-size: 18px; }
.st-cases b { font-size: 30px; font-variant-numeric: tabular-nums; }
.st-acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.st-pick { display: grid; gap: 6px; margin-top: 8px; }
.st-pick button, .st-guess { justify-content: flex-start; text-align: left; font-size: 17px; width: 100%; }
.st-pick button .small { margin-left: 8px; }
.st-diff.up { color: var(--good); font-weight: 700; }
.st-diff.down { color: var(--bad); font-weight: 700; }
.st-how ol { margin: 0; padding-left: 1.3rem; line-height: 1.55; }
.st-how li { margin-bottom: 4px; }
.reader-ok { color: var(--good); font-weight: 600; margin-right: 10px; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.stepper { display: inline-flex; align-items: center; gap: 6px; }
.stepper button { width: 54px; height: 54px; font-size: 23px; padding: 0; }
.stepper input { width: 86px; margin: 0; text-align: center; }
.floor button.primary { min-height: 58px; font-size: 18px; width: 100%; }
.floor .row button.primary { width: auto; }
.return-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.return-choice.three { grid-template-columns: repeat(3, 1fr); }
.return-choice button { flex-direction: column; min-height: 116px; gap: 6px; font-size: 18px; white-space: normal; text-align: center; }
.return-choice small { font-size: 13px; font-weight: 400; color: var(--muted); }
.return-choice button.good { border: 2px solid var(--good); background: var(--good-soft); }
.return-choice button.bad { border: 2px solid var(--bad); background: var(--bad-soft); }
.floor button.floor-card { justify-content: space-between; flex-direction: row; font-size: inherit; }

@media (min-width: 1000px) {
  .table-wrap { overflow: visible; }
  main .table-wrap th { position: sticky; top: var(--bar); z-index: 2; }
  dialog .table-wrap { overflow-x: auto; }
  dialog .table-wrap th { position: static; }
}
@media (max-width: 1400px) {
  main td, main th { padding-left: 6px; padding-right: 6px; }
  .acts-cell button + button { margin-left: 8px; }
}
@media (max-width: 1360px) {
  .find { width: 220px; }
  .bar a.navlink { padding: 5px 8px; font-size: 13px; }
  .bar a.navlink.on, .bar a.navlink.on:hover { padding: 9px 8px 11px; }
}
@media (max-width: 1150px) {
  .cols, .split { grid-template-columns: 1fr; }
  .sticky { position: static; }
  .bill-to, .bill-to:has(#nameWrap[hidden]) { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 1000px) {
  .bar { height: auto; flex-wrap: wrap; padding: 6px 8px; position: static; }
  .bar nav { flex-wrap: wrap !important; }
  .find { order: 9; width: 100%; }
  .find .results { width: 100%; }
  main { padding: 10px 12px 20px; }
  .settings { grid-template-columns: 1fr; }
  .settings nav { position: static; flex-direction: row; flex-wrap: wrap; }
  .kpi, .tile { flex-basis: 45%; border-bottom: 1px solid var(--line); }
  h1 { white-space: normal; }
}
@media (max-width: 700px) {
  .return-choice.three { grid-template-columns: 1fr; }
  .bill-to, .bill-to:has(#nameWrap[hidden]) { grid-template-columns: 1fr; }
  .tools input[type=search], .tools .q { width: 100%; }
}
.st-truck { width: 100%; min-height: 72px; font-size: 20px; margin-bottom: 14px; }
@media (max-width: 700px) {
  .floor-top { flex-wrap: nowrap; overflow-x: auto; padding: 4px 6px; gap: 2px; }
  .floor-top .mark { font-size: 22px; padding: 0 6px 0 2px; }
  .floor-top a { padding: 9px 10px; font-size: 15px; white-space: nowrap; }
  .floor-top button, .floor-top span { white-space: nowrap; }
  .floor-body { margin: 0; border-radius: 0; padding: 10px; min-height: calc(100vh - 50px); }
  .st-big { font-size: 22px; }
  .floor input.st-scan { min-height: 58px; font-size: 20px; }
}
/* Promos: one card per promo, one panel per deal, the flyer photo read at the top. */
.promo-card h2 { font-size: 17px; }
.promo-deals { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.promo-deals li { border-top: 1px solid var(--rule); padding-top: 8px; }
.promo-form { grid-template-columns: 2fr 1fr 1fr; margin-bottom: 12px; }
.photo-drop { border: 2px dashed var(--control); background: var(--tint); }
.photo-drop.over { border-color: var(--blue); background: var(--blue-soft); }
.photo-thumb { width: 96px; height: 96px; object-fit: cover; border-radius: 4px; border: 1px solid var(--line); }
.photo-pick { margin-top: 10px; gap: 12px; flex-wrap: wrap; }
.photo-pick .btn { min-height: 44px; cursor: pointer; }
.link-label { display: inline; text-decoration: underline; text-decoration-color: var(--control); text-underline-offset: 2px; cursor: pointer; font-weight: 600; }
.deal.deal-empty { border-color: var(--bad); }
.chips { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 8px 0; }
.tag.chip { color: var(--ink); font-size: 14px; }
.tag.chip::before { display: none; }
.deal-prices { grid-template-columns: repeat(3, 1fr); margin-top: 8px; }
.price-split { font-variant-numeric: tabular-nums; white-space: nowrap; line-height: 1.5; }
.promo-note { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.order table { margin: 8px 0 4px; }
@media (max-width: 700px) {
  .promo-form, .deal-prices { grid-template-columns: 1fr; }
}

/* Ordering website for customers: a phone first, the same kraft and white sheet, big enough for thumbs. */
.photo-pick { display: flex; gap: 12px; align-items: center; margin-top: 4px; }
.photo-pick img, .photo-none { width: 96px; height: 96px; object-fit: contain; border: 1px solid var(--line); border-radius: 4px; background: #fff; flex: none; }
.photo-none { display: grid; place-items: center; color: var(--muted); font-size: 13px; }
.photo-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.photo-actions label.btn { color: var(--ink); font-size: 14px; }
.shop-body { font-size: 16px; }
.shop-body input, .shop-body textarea, .shop-body button { min-height: 44px; font-size: 16px; }
.shop-body button.link { min-height: 0; }
.shop-big { min-height: 52px !important; font-size: 17px !important; width: 100%; }
.shop-login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.shop-card { background: var(--sheet); border-radius: 8px; padding: 22px 20px; width: 100%; max-width: 420px; }
.shop-card h1 { font-size: 24px; margin-bottom: 6px; }
.shop-card input { font-size: 17px; }
.shop-card label + label { margin-top: 10px; }
.shop-error { color: var(--bad); font-weight: 600; }
.shop-top { position: sticky; top: 0; z-index: 20; background: var(--kraft) var(--tex); }
.shop-bar { display: flex; align-items: center; gap: 8px; padding: 10px 16px; background: var(--kraft) var(--tex); }
.shop-name { font: 19px/1.1 "Saira Stencil One", sans-serif; letter-spacing: .02em; }
.shop-who { font-weight: 600; font-size: 14px; text-align: right; }
.shop-bar .sp { flex: 1; }
.shop-tabs { display: flex; gap: 4px; padding: 0 16px; }
.shop-tabs button { flex: 1; border: 0; background: transparent; font-weight: 600; border-radius: 6px 6px 0 0; padding: 8px 6px; gap: 6px; }
.shop-tabs button.on { background: var(--sheet); }
.shop-tabs .count { background: var(--bad); color: #fff; font-size: 13px; font-weight: 700; min-width: 20px; height: 20px; line-height: 20px; border-radius: 10px; padding: 0 6px; }
.shop-main { background: var(--sheet); max-width: 760px; margin: 0 auto; padding: 14px 16px 110px; min-height: calc(100vh - 100px); }
.shop-promo { background: var(--blue-soft); border-radius: 6px; padding: 12px 14px; margin-bottom: 14px; color: #0a4c87; }
.shop-promo h2 { font-size: 18px; margin-bottom: 6px; }
.shop-promo ul { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 8px; }
.shop-promo button.link { color: #0a4c87; font-weight: 600; }
.shop-search input { font-size: 17px; }
.shop-item, .shop-order { border-bottom: 1px solid var(--line); padding: 12px 0; }
.shop-item.picked { background: var(--tint); margin: 0 -16px; padding: 12px 16px; }
.shop-item-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.shop-price { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.shop-price b { font-size: 18px; display: block; }
.shop-price s { color: var(--muted); font-size: 14px; }
.shop-out { color: var(--bad); font-weight: 600; }
.shop-qty { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.shop-qty label { width: 110px; }
.shop-foot { position: fixed; left: 0; right: 0; bottom: 0; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: var(--sheet); border-top: 1px solid var(--line); z-index: 30; }
.shop-foot:empty { display: none; }
.shop-foot button { max-width: 728px; margin: 0 auto; display: flex; }
.shop-line { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.shop-line .grow { flex: 1; min-width: 0; }
.shop-line-end { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.shop-total { display: flex; justify-content: space-between; align-items: baseline; padding: 14px 0 4px; font-size: 18px; }
.shop-total b { font-size: 24px; font-variant-numeric: tabular-nums; }
.shop-order ul { margin: 8px 0; padding-left: 20px; }
.shop-order .row { gap: 8px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Print preview: the same pages as the paper, laid out as A4 sheets. */
dialog.print-preview { width: min(1000px, 96vw); max-height: 94vh; padding: 0; flex-direction: column; }
dialog.print-preview[open] { display: flex; }
.preview-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.preview-head h2 { margin: 0; }
.preview-pages { overflow: auto; background: #d9d4cc; padding: 16px; }
.preview-pages .doc { width: 210mm; min-height: 297mm; padding: 12mm; margin: 0 auto 16px; background: #fff; box-shadow: 0 2px 10px #0003; zoom: .8; }

/* ---------- Printed documents. These must not change with the screen design. ---------- */

.doc table { width: 100%; border-collapse: collapse; }
.doc th { text-align: left; font-size: 15.3px; font-weight: 600; border-bottom: 1px solid #d9ddd7; padding: 7.65px 8.5px; white-space: nowrap; background: none; }
.doc th.num { text-align: right; }
.doc td { border-bottom: 1px solid #d9ddd7; padding: 11.9px 10.2px; vertical-align: middle; }
.doc tr:last-child td { border-bottom: 0; }
.doc h1 { margin: 0; font-weight: bold; white-space: normal; }
.doc a { color: #0f766e; }
.doc .small { font-size: 14.79px; }
.doc .muted { color: #5f6b67; }
.doc p { margin: 1em 0; }
@media print {
  body { background: #fff; font-size: 11pt; }
  #app, #toast { display: none !important; }
  #print { display: block !important; }
  @page { size: A4; margin: 12mm; }
}
#print { display: none; }
.doc { page-break-after: always; color: #000; font-size: 10.5pt; font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; line-height: normal; }
.doc:last-child { page-break-after: auto; }
.doc-head { display: flex; justify-content: space-between; gap: 17px; border-bottom: 2px solid #000; padding-bottom: 6px; margin-bottom: 8px; }
.doc h1 { font-size: 15pt; }
.doc .copy { font-weight: 800; font-size: 12pt; text-align: right; }
.doc .inv-no { font-size: 17pt; font-weight: 800; text-align: right; }
.doc table { margin: 8px 0; }
.doc th, .doc td { border-bottom: 1px solid #999; color: #000; padding: 4px 5px; }
.doc-foot { display: flex; justify-content: space-between; gap: 17px; margin-top: 10px; align-items: flex-start; }
.stamp-box { width: 62mm; height: 34mm; border: 2px dashed #000; padding: 4px; font-size: 9pt; }
.doc-totals td { border: 0; padding: 2px 5px; }
.signoff { margin-top: 16px; }

/* Tax invoice, matching the business's existing layout */
.tax { display: flex; flex-direction: column; height: 268mm; font: 9.5pt Arial, Helvetica, sans-serif; line-height: 1.2; }
.tax table { margin: 0; }
.tax-copy { text-align: center; font-weight: 700; font-size: 8pt; margin-bottom: 3px; }
.tax-top { display: grid; grid-template-columns: 58% 1fr; gap: 12mm; }
.tax-left, .tax-right { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tax-box { border: 1px solid #000; }
.tax-box-head { font-weight: 700; border-bottom: 1px solid #000; padding: 2px 5px; }
.tax-pad { padding: 3px 5px; }
.tax-seller { font-size: 11pt; padding: 3px 5px; }
.tax-seller b { font-weight: 400; }
.tax-small { font-size: 8pt; }
.barcode { display: block; height: 8mm; width: 38mm; margin: 0 auto; }
.barcode rect { fill: #000; }
.doc .tax-grid { width: 100%; border: 1px solid #000; border-collapse: collapse; }
.doc .tax-grid th, .doc .tax-grid td { border: 1px solid #000; padding: 2px 4px; font-size: 9.5pt; color: #000; white-space: normal; }
.doc .tax-grid th { text-align: center; font-weight: 400; }
.doc .tax-title th { font-weight: 700; }
.doc .tax-grid th.tax-word { font-size: 18pt; }
.tax-center { text-align: center; }
.doc .tax-lines { height: 100%; }
.tax-fill { height: 100%; }
.tax-items { flex: 1; min-height: 0; border: 1px solid #000; margin-top: 8px; overflow: hidden; position: relative; }
.tax-items::before, .tax-items::after { content: ''; }
.doc .tax-lines th { color: #000; font-size: 8.5pt; font-weight: 400; text-align: center; border-bottom: 1px solid #000; border-right: 1px solid #000; vertical-align: bottom; white-space: normal; }
.doc .tax-lines td { border-bottom: 0; border-right: 1px solid #000; vertical-align: top; padding: 2px 4px; }
.tax-paid { display: flex; justify-content: space-between; padding-top: 8px !important; border-right: 1px solid #000; }
.tax-summary td { border-top: 1px dashed #000; font-weight: 700; font-size: 8.5pt; }
.tax-foot { display: grid; grid-template-columns: 1fr 37%; gap: 8mm; margin-top: 4px; align-items: start; }
.tax-bank { text-align: center; font-size: 8.5pt; padding-top: 8px; }
.tax-sign { text-align: left; padding-top: 14px; font-size: 9.5pt; }
.tax-totals { display: flex; flex-direction: column; gap: 5px; }
.doc .tax-big th { text-align: left; font-weight: 700; font-size: 12pt; }
.doc .tax-big td { font-size: 12pt; }
/* The invoice page: the items large enough for a customer at the counter to read, then taking payment
   across the full width underneath, then what happened to it so far. */
.inv-lines table { font-size: 17px; }
.inv-lines td { padding: 8px 10px; }
.inv-lines td.num { font-size: 18px; }
.inv-lines tfoot td { font-size: 24px; padding-top: 10px; }
.inv-lines tfoot td:first-child { font-size: 17px; }
.pay-big { display: grid; grid-template-columns: minmax(220px, 300px) 1fr; gap: 24px; align-items: start; padding: 18px; }
.pay-big h2 { margin-top: 0; }
.pay-how { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.pay-how p { margin: 0; }
.pay-big .big-total { font-size: 36px; }
.pay-big .pay-row { grid-template-columns: 110px minmax(140px, 1fr) minmax(200px, 1.6fr) auto; gap: 10px; margin-bottom: 10px; }
.pay-big .pay-row label { font-size: 17px; font-weight: 600; }
.pay-big .pay-row input { font-size: 18px; min-height: 44px; }
.pay-big .pay-row .full-rest { min-height: 44px; min-width: 80px; }
.pay-big button.primary { width: 100%; min-height: 50px; font-size: 18px; margin-top: 6px; }
.inv-history { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; align-items: start; }
.picked-chip { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; padding: 4px 10px; border: 1px solid var(--good); background: var(--good-soft); border-radius: 4px; font-weight: 600; }
.picked-chip button { border: 0; background: none; min-height: 0; padding: 2px 6px; font-weight: 700; }
/* A reference box that can pick a payment from Payments: its list opens under the box. */
.pick-wrap { position: relative; display: block; flex: 1; min-width: 0; }
.pick-wrap > input { width: 100%; }
.add-name .pick-wrap { width: 100%; }
/* Search results: a long address wraps on the right instead of pushing the list sideways. */
.results button > span:last-child { text-align: right; white-space: normal; overflow-wrap: anywhere; flex: 0 1 48%; }
