/* TTS POS shared styles. Mobile first. */
:root {
  /* TTS Packaging brand guidelines 2026 */
  --teal: #3A94A5;      /* primary: structure, large areas, key headings (teal / white) */
  --green: #63B74A;     /* accent: short signals and small highlights only */
  --kraft: #D8C5A3;     /* support: warm backgrounds (kraft / deep ink) */
  --deep-ink: #17383D;  /* body text and dark backgrounds */
  --bg: #f5f7f7; --panel: #fff; --ink: var(--deep-ink); --muted: #56686b; --line: #dde3e4;
  --brand: var(--teal); --brand-ink: #fff;
  --link: #2a7584;      /* teal darkened so small link text stays readable */
  --accent: #e3f0f3;    /* light teal tint for hover */
  --danger: #b42318; --warn: #9a4a06; --warn-bg: #fff4e5;
  --ok-bg: #eaf5e5; --ok-ink: #2f6b1f;   /* white / green accent */
  --radius: 10px; --tap: 44px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; background: var(--bg); color: var(--ink); font-size: 15px; -webkit-text-size-adjust: 100%; }
a { color: var(--link); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
h1 { font-size: 20px; margin: 0; }
h2 { font-size: 17px; margin: 0 0 10px; }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--brand); color: var(--brand-ink); display: flex; align-items: center; gap: 10px; padding: 8px 12px; min-height: 52px; padding-top: max(8px, env(safe-area-inset-top)); border-bottom: 3px solid var(--green); }
.topbar .title { font-weight: 700; font-size: 17px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar a, .topbar button { color: var(--brand-ink); background: rgba(255,255,255,.14); border: 0; border-radius: 8px; padding: 8px 12px; text-decoration: none; font-weight: 600; min-height: 38px; }
.topbar a.active { background: #fff; color: var(--deep-ink); }

.wrap { padding: 12px; max-width: 1100px; margin: 0 auto; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.grow { flex: 1 1 160px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--tap); padding: 8px 16px; border-radius: var(--radius); border: 1px solid var(--line); background: #fff; color: var(--ink); font-weight: 600; text-decoration: none; }
.btn.primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn.primary:hover { background: #317f8e; }
.btn.danger { color: var(--danger); border-color: #f1c2bd; }
.btn.small { min-height: 34px; padding: 4px 10px; font-size: 14px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* forms */
label.field { display: block; margin-bottom: 10px; }
label.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.input, input[type=text], input[type=number], input[type=search], input[type=password], input[type=date], input[type=time], input[type=email], input[type=tel], input[type=url], select, textarea {
  width: 100%; min-height: var(--tap); padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); }
textarea { min-height: 80px; }
input[type=checkbox] { width: 20px; height: 20px; vertical-align: middle; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 560px) { .grid2 { grid-template-columns: 1fr; } }

/* tables */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 9px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.table th { font-size: 12px; text-transform: uppercase; color: var(--muted); letter-spacing: .3px; }
.table tr.click { cursor: pointer; }
.table tr.click:hover { background: var(--accent); }
.table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* pills */
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.pill.paid { background: var(--ok-bg); color: var(--ok-ink); }
.pill.unpaid, .pill.part { background: #fde8e6; color: var(--danger); }
.pill.void { background: #e5e7eb; color: #444; }
.pill.customer { background: var(--kraft); color: var(--deep-ink); }
.pill.manual { background: var(--warn-bg); color: var(--warn); }
.pill.standard { background: #eef0f3; color: var(--muted); }

/* messages */
.msg { padding: 10px 12px; border-radius: 8px; margin-bottom: 10px; }
.msg.error { background: #fde8e6; color: var(--danger); }
.msg.ok { background: var(--ok-bg); color: var(--ok-ink); }
.msg.warn { background: var(--warn-bg); color: var(--warn); }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: flex-end; justify-content: center; z-index: 50; }
@media (min-width: 700px) { .modal-bg { align-items: center; } }
.modal { background: #fff; border-radius: 14px 14px 0 0; width: 100%; max-width: 640px; max-height: 92vh; overflow: auto; padding: 16px; }
@media (min-width: 700px) { .modal { border-radius: 14px; } }
.modal h2 { display: flex; justify-content: space-between; align-items: center; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.stat .v { font-size: 22px; font-weight: 800; }
.stat .l { font-size: 12px; color: var(--muted); text-transform: uppercase; }

.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 0 12px; background: #fff; border-bottom: 1px solid var(--line); }
.tabs a { padding: 12px 10px; text-decoration: none; color: var(--muted); font-weight: 600; white-space: nowrap; border-bottom: 3px solid transparent; }
.tabs a.active { color: var(--deep-ink); border-color: var(--teal); }

/* selected choice buttons (payment type, due date, categories) */
:focus-visible { outline: 3px solid var(--teal); outline-offset: 1px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px var(--accent); }

/* ---------- back office: side menu layout (like Nexchar) ---------- */
.shell { display: flex; min-height: 100vh; }
.side { width: 240px; flex: 0 0 240px; background: var(--teal); color: #fff; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 40; }
.side-logo { margin: 16px 16px 12px; background: #fff; border-radius: 14px; padding: 12px; display: flex; justify-content: center; }
.side-logo img { width: 120px; height: auto; display: block; }   /* brand minimum on screen: 110px */
.side-nav { display: flex; flex-direction: column; padding: 8px 0; flex: 1; }
.side a, .side button { display: flex; align-items: center; gap: 12px; padding: 12px 20px; color: #fff; text-decoration: none; font-weight: 600; font-size: 15px; background: none; border: 0; border-left: 4px solid transparent; text-align: left; width: 100%; min-height: var(--tap); }
.side a:hover, .side button:hover { background: rgba(255,255,255,.12); }
.side a.active { background: #2f7b89; border-left-color: var(--green); }
.side svg { width: 20px; height: 20px; flex: 0 0 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.side-foot { border-top: 1px solid rgba(255,255,255,.25); padding: 8px 0 max(12px, env(safe-area-inset-bottom)); }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mainhead { display: flex; align-items: center; gap: 12px; background: #fff; border-bottom: 1px solid var(--line); padding: 14px 20px; padding-top: max(14px, env(safe-area-inset-top)); position: sticky; top: 0; z-index: 20; }
.mainhead .eyebrow { font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.mainhead h1 { font-size: 22px; color: var(--deep-ink); }
.who { text-align: right; }
.who-name { font-weight: 600; color: var(--deep-ink); }
.who-role { font-size: 12px; color: var(--muted); }
.menu-btn { display: none; background: none; border: 1px solid var(--line); border-radius: 8px; width: var(--tap); height: var(--tap); align-items: center; justify-content: center; color: var(--deep-ink); }
.menu-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.side-scrim { display: none; }
.main .wrap { width: 100%; }
@media (max-width: 899px) {
  /* 9 Oct: on phones the menu sits at the top of the page and scrolls with the page itself — an iPhone home-screen app
     wouldn't scroll a menu pinned to the screen. */
  .side { position: absolute; left: 0; top: 0; bottom: auto; height: auto; min-height: 100%; overflow: visible; transform: translateX(-100%); transition: transform .2s ease; box-shadow: 4px 0 20px rgba(0,0,0,.2); }
  .side-nav { flex: 0 0 auto; }
  body.menu-open .side { transform: none; }
  body.menu-open .side-scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 30; }
  .menu-btn { display: inline-flex; }
  .mainhead { padding: 10px 12px; padding-top: max(10px, env(safe-area-inset-top)); }
  .mainhead h1 { font-size: 19px; }
  .who-role { display: none; }
}
@media (prefers-reduced-motion: reduce) { .side { transition: none; } }

/* ---------- back office: menu groups ---------- */
.side-group > button.gh { justify-content: flex-start; }
.side-group > button.gh .chev { margin-left: auto; width: 16px; height: 16px; flex: 0 0 16px; transition: transform .15s ease; }
.side-group.open > button.gh .chev { transform: rotate(90deg); }
.side-group .sub { display: none; padding: 0 0 6px; }
.side-group.open .sub { display: block; }
.side .sub a { padding: 9px 20px 9px 52px; font-weight: 500; font-size: 14px; min-height: 38px; }
.side .sub a.active { background: #2f7b89; border-left-color: var(--green); font-weight: 700; }
.side-group.has-active > button.gh { background: rgba(0,0,0,.08); }
.side .badge { margin-left: auto; background: #fff; color: var(--deep-ink); border-radius: 999px; font-size: 11px; font-weight: 800; padding: 1px 7px; }

/* ---------- toolbars, filters, quick dates ---------- */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 12px; }
.toolbar .field { margin: 0; min-width: 140px; flex: 1 1 140px; }
.toolbar .field.wide { flex: 2 1 220px; }
.toolbar .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 600; min-height: 34px; }
.chip.on { background: var(--teal); border-color: var(--teal); color: #fff; }
.datebar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.datebar input[type=date] { width: auto; min-width: 150px; flex: 0 1 160px; }
.datebar .to { color: var(--muted); }

/* ---------- page tabs (inside a page) ---------- */
.ptabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.ptabs a, .ptabs button { padding: 10px 12px; text-decoration: none; color: var(--muted); font-weight: 600; white-space: nowrap; border: 0; background: none; border-bottom: 3px solid transparent; }
.ptabs .on { color: var(--deep-ink); border-bottom-color: var(--teal); }

/* ---------- stat tiles ---------- */
.stat .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat.teal { border-top: 3px solid var(--teal); }
.stat.warn .v { color: var(--warn); }
.stat.bad .v { color: var(--danger); }
.stat.click { cursor: pointer; }
.stat.click:hover { background: var(--accent); }
.up { color: var(--ok-ink); font-weight: 700; } .down { color: var(--danger); font-weight: 700; }

/* ---------- Nexchar status colours ----------
   green = delivered & paid · yellow = delivered, not paid · orange = ordered, not delivered · red = deleted */
:root { --st-green: #63B74A; --st-yellow: #E9B824; --st-orange: #E57A2E; --st-red: #B42318; }
.table tr.st-green td:first-child { box-shadow: inset 4px 0 0 var(--st-green); }
.table tr.st-yellow td:first-child { box-shadow: inset 4px 0 0 var(--st-yellow); }
.table tr.st-orange td:first-child { box-shadow: inset 4px 0 0 var(--st-orange); }
.table tr.st-red td:first-child { box-shadow: inset 4px 0 0 var(--st-red); }
.table tr.st-red td { color: var(--muted); }
.pill.st-green { background: var(--ok-bg); color: var(--ok-ink); }
.pill.st-yellow { background: #FFF5D6; color: #7A5A00; }
.pill.st-orange { background: #FDEBDD; color: #9A4A06; }
.pill.st-red { background: #FDE8E6; color: var(--st-red); }
.pill.overdue { background: var(--st-red); color: #fff; }
.pill.teal { background: var(--accent); color: #1f5f6b; }
.pill.grey { background: #eef0f3; color: var(--muted); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin: 8px 0 0; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

/* ---------- tables: sorting, totals, money ---------- */
.table th.sort { cursor: pointer; user-select: none; }
.table th.sort:hover { color: var(--deep-ink); }
.table th.sorted::after { content: ' ▾'; }
.table th.sorted.asc::after { content: ' ▴'; }
.table tfoot td { font-weight: 800; border-top: 2px solid var(--deep-ink); border-bottom: 0; }
.table td.neg, .neg { color: var(--danger); }
.table td.actions-cell { white-space: nowrap; text-align: right; }
.table tr.sel td { background: var(--accent); }
.table .thumb { width: 40px; height: 40px; object-fit: contain; border: 1px solid var(--line); border-radius: 6px; background: #fff; display: block; }
.table .code { font-weight: 700; white-space: nowrap; }
.table-note { font-size: 13px; color: var(--muted); padding: 8px 0 0; }

/* ---------- forms: line items ---------- */
.lines .line { display: grid; grid-template-columns: minmax(180px, 3fr) 90px 110px 90px 110px 40px; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.lines .line.head { font-size: 12px; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.lines .line input, .lines .line select { min-height: 38px; }
@media (max-width: 700px) {
  .lines .line { grid-template-columns: 1fr 1fr 1fr; }
  .lines .line.head { display: none; }
  .lines .line > :first-child { grid-column: 1 / -1; }
}
.picker { position: relative; }
.picker .results { position: absolute; left: 0; right: 0; top: 100%; z-index: 30; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(23,56,61,.15); max-height: 300px; overflow-y: auto; }
.picker .results button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.picker .results button:hover, .picker .results button.hl { background: var(--accent); }
.picker .results .muted { padding: 8px 10px; }
.totals-box { margin-left: auto; min-width: 240px; }
.totals-box div { display: flex; justify-content: space-between; gap: 16px; padding: 3px 0; }
.totals-box .grand { font-weight: 800; font-size: 17px; border-top: 2px solid var(--deep-ink); padding-top: 6px; margin-top: 4px; }
.yesno { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.yesno button { border: 0; background: #fff; padding: 8px 16px; font-weight: 600; min-height: 40px; }
.yesno button.on { background: var(--teal); color: #fff; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px 14px; }
.checks label { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; }
.checks label small { display: block; color: var(--muted); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; }
.kv > :nth-child(odd) { color: var(--muted); }
.modal.wide { max-width: 900px; }
.empty { padding: 18px; text-align: center; color: var(--muted); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; text-decoration: none; color: var(--ink); display: block; }
.card:hover { border-color: var(--teal); background: var(--accent); }
.card h3 { margin: 0 0 4px; font-size: 15px; color: var(--deep-ink); }
.card p { margin: 0; font-size: 13px; color: var(--muted); }
.section-title { font-size: 12px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); margin: 18px 0 8px; }
@media print { .side, .mainhead, .toolbar, .datebar, .no-print { display: none !important; } .panel { border: 0; } }
/* back office uses the full width of a laptop screen */
.main .wrap { max-width: 1480px; }
.table td .small { line-height: 1.3; }
.table td.namecol { min-width: 240px; }
.btn { white-space: nowrap; }
@media (min-width: 900px) { .shell { background: linear-gradient(to right, var(--teal) 240px, transparent 240px); } }

/* ---------- charts ---------- */
.chart { min-height: 120px; }
.chart-svg { display: block; max-width: 100%; overflow: visible; font-family: inherit; }
.chart-svg:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--ink); margin: 0 0 6px 58px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i.k-line { width: 16px; height: 2px; border-radius: 1px; display: inline-block; }
.chart-legend i.k-box { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.chart-tip { position: absolute; z-index: 5; pointer-events: none; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 18px rgba(23,56,61,.14); padding: 8px 10px; font-size: 12.5px; min-width: 140px; }
.chart-tip .tt { color: var(--muted); margin-bottom: 4px; }
.chart-tip .tr { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.chart-tip .tr i { width: 12px; height: 2px; border-radius: 1px; display: inline-block; flex: 0 0 12px; }
.chart-tip .tr strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.chart-tip .tr span { color: var(--muted); }
.pl { width: 100%; border-collapse: collapse; }
.pl td { padding: 7px 8px; border-bottom: 1px solid var(--line); }
.pl td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pl tr.sub td { color: var(--muted); padding-left: 24px; }
.pl tr.tot td { font-weight: 800; border-top: 2px solid var(--deep-ink); }
.pl tr.head td { font-size: 12px; text-transform: uppercase; color: var(--muted); font-weight: 700; }
@media (max-width: 600px) {
  .datebar .chips, .toolbar .chips { flex-wrap: nowrap; overflow-x: auto; width: 100%; padding-bottom: 2px; -webkit-overflow-scrolling: touch; }
  .datebar .chip, .toolbar .chip { flex: 0 0 auto; }
  .table td.namecol { min-width: 180px; }
}

/* ---------- dashboard ---------- */
.dash { display: flex; flex-direction: column; gap: 12px; }
.dash > .panel { margin-bottom: 0; }
.d-actions { display: flex; gap: 8px; flex-wrap: wrap; order: 1; }
.d-period { order: 2; } .d-now { order: 3; } .d-todo { order: 4; } .d-ask { order: 4; } .d-lists { order: 5; }
.d-lists { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 12px; }
.d-lists .panel { margin-bottom: 0; }
.band-label { font-size: 12px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; color: var(--deep-ink); margin: 4px 0 8px; }
.band-label .muted { font-weight: 500; text-transform: none; letter-spacing: 0; }
.stat .v .vat { font-size: 12px; font-weight: 600; color: var(--muted); }
.stat .sub strong { color: var(--ink); font-weight: 700; }
.todo { display: flex; flex-direction: column; gap: 6px; }
.todo-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 14px; min-height: var(--tap); border: 1px solid var(--line); border-left: 4px solid var(--teal); border-radius: 8px; background: #fff; color: var(--ink); text-decoration: none; font-weight: 600; }
.todo-item:hover { background: var(--accent); }
.todo-item.bad { border-left-color: var(--danger); color: var(--danger); }
.todo-item.warn { border-left-color: var(--st-orange); }
.todo-item span { color: var(--muted); font-size: 20px; }
@media (max-width: 700px) {
  /* Out delivering: actions and what needs doing first, then the numbers. */
  .d-actions { order: 1; } .d-todo { order: 2; } .d-ask { order: 2; } .d-lists { order: 3; grid-template-columns: 1fr; } .d-now { order: 4; } .d-period { order: 5; }
  .d-actions .btn { flex: 1 1 calc(50% - 8px); }
  .dash .stats { grid-template-columns: 1fr 1fr; }
  .dash .stat .v { font-size: 18px; }
}
.dash > *, .d-lists > * { min-width: 0; }
@media (max-width: 700px) {
  .dash .hide-phone { display: none; }
  .dash .actions-cell { white-space: normal; width: 1%; }
  .dash .actions-cell .btn { display: flex; width: 100%; margin: 3px 0; }
}
.show-phone { display: none; }
@media (max-width: 700px) { .dash .show-phone { display: block; } }
@media (max-width: 700px) { .dash .btn .show-phone { display: inline; } .dash tr.hide-phone { display: none; } }

/* ---------- products: items list and item page ---------- */
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 12px; }
@media (max-width: 560px) { .grid3 { grid-template-columns: 1fr 1fr; } }
.items-tools .field { min-width: 130px; }
.it-name { font-weight: 700; line-height: 1.3; }
.it-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; line-height: 1.5; }
.it-sub .code { color: var(--deep-ink); }
.selbar { position: sticky; top: 56px; z-index: 12; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; background: var(--deep-ink); color: #fff; padding: 8px 12px; border-radius: var(--radius); margin-bottom: 10px; }
.selbar strong { margin-right: 6px; }
.selbar .btn { background: #fff; }
.item-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.item-head h2 { font-size: 20px; }
.item-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.item-grid > div { min-width: 0; }
@media (min-width: 1000px) { .item-grid { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); align-items: start; } }
.price-card { border-top: 4px solid var(--teal); }
.profit-line { font-size: 14px; padding: 8px 10px; background: var(--accent); border-radius: 8px; min-height: 20px; }
.choice { margin-bottom: 8px; }
.choice .btn { text-align: left; justify-content: flex-start; white-space: normal; flex-direction: column; align-items: flex-start; }
.pill.bulk { background: var(--ok-bg); color: var(--ok-ink); }
/* items list as cards on a phone */
@media (max-width: 700px) {
  .item-cards .table-wrap { overflow: visible; }
  .item-cards table, .item-cards tbody { display: block; }
  .item-cards thead { display: none; }
  .item-cards tbody tr { display: grid; grid-template-columns: 26px 48px minmax(0, 1fr) auto; grid-template-areas: "tick pic item item" "tick pic price stock" ". . act act";
    gap: 4px 8px; border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 8px; background: #fff; }
  .item-cards tbody td { border: 0; padding: 0; text-align: left; }
  .item-cards td.c-tick { grid-area: tick; } .item-cards td.c-pic { grid-area: pic; } .item-cards td.c-item { grid-area: item; }
  .item-cards td.c-price { grid-area: price; } .item-cards td.c-stock { grid-area: stock; text-align: right; } .item-cards td.c-act { grid-area: act; }
  .item-cards td.c-cat, .item-cards td.c-in { display: none; }
  .item-cards tfoot { display: none; }
}

/* Delete-sale: what happened to the money paid */
.choice-list { display: grid; gap: 8px; margin: 8px 0; }
.choice-list .choice { display: flex; gap: 10px; align-items: flex-start; margin: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; background: var(--panel); }
.choice-list .choice:has(input:checked) { border-color: var(--teal); background: var(--accent); }
.choice-list .choice input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--teal); flex: none; }
.panel.warn-panel { background: var(--warn-bg); border-color: #f3d3a8; color: var(--warn); }
.panel.warn-panel .row { align-items: center; }

/* Stock count */
.progress { height: 10px; background: #e5ecee; border-radius: 999px; overflow: hidden; }
.progress > div { height: 100%; background: var(--green); border-radius: 999px; transition: width .2s; }
label.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; min-height: 40px; cursor: pointer; }
label.check input { width: 18px; height: 18px; accent-color: var(--teal); }
.cnt-cat { background: var(--accent); color: var(--deep-ink); font-weight: 700; padding: 8px 14px; border-bottom: 1px solid var(--teal); position: sticky; top: 0; z-index: 1; }
.cnt-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); border-left: 4px solid transparent; }
.cnt-row.done { border-left-color: var(--green); background: #fbfdfb; }
.cnt-item { flex: 1 1 auto; min-width: 0; }
.cnt-item .code { font-weight: 700; color: var(--link); }
.cnt-sys, .cnt-in { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex: none; }
.cnt-sys strong { font-size: 18px; min-width: 48px; text-align: right; }
.cnt-in input { width: 90px; min-height: 44px; font-size: 20px; font-weight: 700; text-align: center; }
.cnt-badge { width: 92px; flex: none; text-align: right; }
.cnt-state { font-weight: 700; font-size: 14px; }
.cnt-state.ok { color: var(--ok-ink); }
.cnt-state.warn { color: var(--warn); }
.cnt-state.neg { color: var(--danger); font-size: 13px; }
@media (max-width: 600px) {
  .cnt-row { flex-wrap: wrap; gap: 6px 10px; padding: 10px 12px; }
  .cnt-item { flex: 1 1 100%; }
  .cnt-sys { flex-direction: row; align-items: baseline; gap: 6px; }
  .cnt-in { flex-direction: row; align-items: center; gap: 8px; margin-left: auto; }
  .cnt-badge { width: auto; min-width: 60px; }
  .count-head .row { flex-wrap: wrap; }
}

/* Target progress bars */
.tbar { display: inline-block; width: 90px; height: 8px; background: #e5ecee; border-radius: 999px; overflow: hidden; vertical-align: middle; margin-right: 6px; }
.tbar > div { height: 100%; border-radius: 999px; }

/* Save as PDF: a clean page with the TTS header */
.print-head { display: none; }
@media print {
  @page { margin: 12mm; }
  body { background: #fff; }
  .print-head { display: flex !important; justify-content: space-between; align-items: center; border-bottom: 3px solid var(--teal); padding-bottom: 8px; margin-bottom: 12px; }
  .print-head img { height: 48px; }
  .print-head h1 { margin: 0; font-size: 20px; color: var(--teal); }
  .print-head .small { color: var(--muted); }
  .main, .main .wrap { margin: 0 !important; padding: 0 !important; max-width: none !important; }
  .shell { background: none !important; display: block !important; }
  .stats { break-inside: avoid; }
  .panel { break-inside: avoid; box-shadow: none; }
  .table { font-size: 11px; }
  #dueBar, .flash, .msg { display: none !important; }
  .chart-svg { max-width: 100%; }
}

/* What a price really makes after running costs */
.real { display: inline-block; font-size: 12.5px; border-radius: 8px; padding: 4px 8px; line-height: 1.35; }
.real-red { background: #fde8e6; color: var(--danger); border-left: 4px solid var(--danger); }
.real-yellow { background: #fff6d6; color: #7a5a00; border-left: 4px solid var(--st-yellow); }
.real-green { background: var(--ok-bg); color: var(--ok-ink); border-left: 4px solid var(--green); }

/* ---------- AI helper ---------- */
.ai-q { font-weight: 700; margin-top: 10px; }
.ai-q::before { content: 'You: '; color: var(--muted); font-weight: 600; }
.ai-a { background: var(--accent); border-left: 4px solid var(--teal); border-radius: 8px; padding: 10px 12px; margin-top: 6px; line-height: 1.5; }
.ai-btn { border-color: var(--teal); color: var(--link); }

/* ---------- deleted sales: red, crossed out, reason shown ---------- */
.pill.del { background: var(--danger); color: #fff; letter-spacing: .6px; }
.del-why { color: var(--danger); margin-top: 3px; max-width: 260px; white-space: normal; }
tr.row-void td { background: #fdecea !important; color: #8a1c12; }
tr.row-void td.num, tr.row-void td.code, tr.row-void td:first-child strong { text-decoration: line-through; text-decoration-color: rgba(180,35,24,.7); }
tr.row-void td:first-child { box-shadow: inset 4px 0 0 var(--danger); }

/* till: No VAT sale — prices to type */
input.price.need-price { border: 2px solid var(--st-orange, #e07b24); background: #fff7ef; }
.vat-q .yesno button { padding: 6px 12px; min-height: 34px; font-size: 14px; }

/* label sheet picker: 2 × 4 map of the A4 sheet */
.lmap { margin: 4px 0 8px; }
.lmap-sheet { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; width: 150px; padding: 6px; background: #f3f5f5; border: 1px solid var(--line); border-radius: 6px; margin-top: 4px; }
.lmap-sheet span { height: 26px; border: 1px dashed #b8c4c6; border-radius: 3px; display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--muted); background: #fff; }
.lmap-sheet span.on { background: var(--teal); color: #fff; border-style: solid; border-color: var(--teal); }
.lmap-sheet span.used { background: #dfe4e5; text-decoration: line-through; }

/* purchase lines: VAT paid? per item */
.line-vat { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.yesno.sm button { padding: 4px 10px; min-height: 32px; font-size: 13px; }
.line-vat select { width: auto; min-height: 32px; }

/* label sheet planner */
.lp-wrap { display: grid; grid-template-columns: 320px 1fr; gap: 12px; align-items: start; }
@media (max-width: 800px) { .lp-wrap { grid-template-columns: 1fr; } }
.lp-res { display: flex; flex-direction: column; gap: 4px; max-height: 260px; overflow: auto; margin-bottom: 8px; }
.lp-hit { text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 8px 10px; }
.lp-hit.on, .lp-hit:hover { border-color: var(--teal); background: var(--accent); }
.lp-chosen { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 4px; }
.lp-adj { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.lp-sheets { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.lp-sheet-wrap { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.lp-sheet { position: relative; width: 300px; background: #fbfbfb; border: 1px solid #cfd8da; border-radius: 4px; box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.lp-sheet.wide { width: 420px; }
.lp-sheet .lp-cell { position: absolute; }
.lp-cell.tiny { padding: 1px 2px; border-radius: 3px; align-items: center; font-size: 9px; }
.lp-cell.tiny strong { font-size: 9px; white-space: nowrap; overflow: hidden; max-width: 100%; }
.lp-cell.tiny .empty { font-size: 9px; }
.lp-mini { position: absolute; border: 1px dashed #b8c4c6; border-radius: 3px; background: #fff; font-size: 10px; color: var(--muted); display: flex; align-items: center; justify-content: center; }
.ly-wrap { display: grid; grid-template-columns: 1fr 200px; gap: 14px; align-items: start; }
.ly-pic { width: 200px; }
@media (max-width: 640px) { .ly-wrap { grid-template-columns: 1fr; } }
.lp-cell { border: 1px dashed #b8c4c6; border-radius: 6px; background: #fff; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; padding: 4px 6px; overflow: hidden; text-align: left; font-size: 11px; line-height: 1.2; }
.lp-cell .n { position: absolute; top: 3px; right: 5px; font-size: 10px; color: var(--muted); }
.lp-cell .empty { color: var(--muted); width: 100%; text-align: center; }
.lp-cell.can:hover { border-color: var(--teal); background: var(--accent); }
.lp-cell.on { border: 1.5px solid var(--teal); background: #eef7f9; }
.lp-cell .sz { font-size: 10px; color: var(--link); font-weight: 700; }
.lp-cell .nm { font-size: 10px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Till: customer's own prices */
.keepPrice { border-color: var(--teal); color: var(--teal); background: #fff; font-weight: 700; white-space: nowrap; }
.keepPrice:hover { background: var(--accent); }
.tp-hits { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.tp-hit { display: flex; gap: 8px; align-items: center; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; background: #fff; }
.tp-hit .grow { flex: 1; min-width: 0; }

/* "The system has been updated — reload" bar */
.update-bar { position: fixed; left: 50%; top: 10px; transform: translateX(-50%); z-index: 9999; background: var(--ink, #17383D); color: #fff; padding: 10px 14px; border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0,0,0,.25); display: flex; gap: 12px; align-items: center; max-width: calc(100% - 32px); font-size: 14px; flex-wrap: wrap; }
.update-bar button { background: var(--green, #63B74A); color: #fff; border: 0; border-radius: 8px; padding: 8px 14px; font-weight: 700; cursor: pointer; }

/* Customer who is also a supplier: both ways */
.bw-mini { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.bw-mini > div { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: #fff; }
.bw-mini span { display: block; font-size: 12px; color: var(--muted); }
.bw-mini strong { font-size: 18px; }
.bw-mini .net { background: var(--accent); border-color: var(--teal); }
@media (max-width: 560px) { .bw-mini { grid-template-columns: 1fr; } }

/* Cash flow */
.cf-week { cursor: pointer; }
.cf-week:hover td { background: var(--accent); }
.cf-detail > td { background: #fafbfb; }
.cf-bars { display: flex; flex-direction: column; gap: 3px; }
.cf-bar { display: block; height: 7px; border-radius: 4px; }
.cf-bar.in { background: var(--green, #63B74A); }
.cf-bar.out { background: var(--danger); }

/* Cash flow v2 */
.cf-h { margin: 6px 0 8px; font-size: 15px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.cf-sub { margin: 12px 0 6px; font-size: 14px; }
.cf-two { gap: 12px; align-items: start; }
.cf-two > .panel { margin-bottom: 12px; }
.cf-lowrow td { background: #fdf1ef; }
.cf-chart { position: relative; margin: 6px 0 4px; }
.cf-chart svg { width: 100%; height: auto; display: block; }
.cf-grid { stroke: #e6eaeb; stroke-width: 1; }
.cf-axis { font-size: 11px; fill: var(--muted); }
.cf-low { stroke: #8a979a; stroke-width: 1.5; stroke-dasharray: 6 4; }
.cf-zero { stroke: #b9c3c5; stroke-width: 1; }
.cf-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.cf-line.real { stroke: #0089A8; }
.cf-line.usual { stroke: #4E9A3A; stroke-dasharray: 7 4; }
.cf-dot.real { fill: #0089A8; stroke: #fff; stroke-width: 2; }
.cf-lab { font-size: 12px; font-weight: 700; fill: var(--ink, #17383D); }
.cf-cross { stroke: #9aa6a8; stroke-width: 1; }
.cf-hit { fill: transparent; cursor: crosshair; }
.cf-tip { position: absolute; top: 4px; width: 180px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; box-shadow: 0 4px 14px rgba(0,0,0,.12); pointer-events: none; font-size: 12px; }
.cf-tiprow { display: flex; align-items: center; gap: 6px; }
.cf-tip i, .cf-legend i { display: inline-block; width: 16px; height: 0; border-top: 2px solid; vertical-align: middle; }
.cf-tip i.real, .cf-legend i.real { border-color: #0089A8; }
.cf-tip i.usual, .cf-legend i.usual { border-color: #4E9A3A; border-top-style: dashed; }
.cf-legend i.low { border-color: #8a979a; border-top-style: dashed; }
.cf-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12px; color: var(--muted); margin-top: 4px; }
.cf-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cf-list { display: flex; flex-direction: column; gap: 8px; }
.cf-li-top { display: flex; gap: 8px; align-items: baseline; font-size: 14px; }
.cf-li-top .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cf-li-bar { display: block; height: 8px; border-radius: 0 4px 4px 0; margin-top: 3px; }
.cf-li-bar.in { background: #4E9A3A; }
.cf-li-bar.out { background: #0089A8; }
.cf-plan input, .cf-plan select { min-height: 36px; }
@media (max-width: 800px) { .cf-two { grid-template-columns: 1fr; } }
/* Cash flow: tappable boxes and the explain pop-up */
.stat[data-explain] { cursor: pointer; position: relative; transition: border-color .15s, box-shadow .15s; }
.stat[data-explain]::after { content: '›'; position: absolute; right: 10px; top: 8px; font-size: 18px; color: var(--muted); }
.stat[data-explain]:hover, .stat[data-explain]:focus { border-color: var(--teal); box-shadow: 0 0 0 3px var(--accent); outline: none; }
.ex-sum td { padding: 6px 8px; }
.ex-sum .ex-total td { border-top: 2px solid var(--ink, #17383D); font-weight: 800; font-size: 16px; }
.ex-big { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--accent); }
.ex-big strong { font-size: 22px; }
.ex-row { cursor: pointer; }
.ex-row:hover td { background: var(--accent); }
/* Cash flow: past weeks */
.cf-pastrow td { background: #f6f7f7; color: #4a5b5e; }
.cf-today td { background: var(--accent); font-weight: 600; border-top: 2px solid var(--teal); border-bottom: 2px solid var(--teal); }
.cf-pastbg { fill: #f3f5f5; }
.cf-nowline { stroke: var(--teal); stroke-width: 1.5; }
.cf-axis.now { font-weight: 700; fill: var(--ink, #17383D); }
.cf-line.actual { stroke: #B5651D; }
.cf-dot.actual { fill: #B5651D; stroke: #fff; stroke-width: 2; }
.cf-dot.now { fill: var(--ink, #17383D); stroke: #fff; stroke-width: 2; }
.cf-tip i.actual, .cf-legend i.actual { border-color: #B5651D; }

/* a required box left empty on a new item */
.field.missing input, .field.missing select { border-color: var(--danger); box-shadow: 0 0 0 3px #fbe4e1; }
.field.missing > span { color: var(--danger); }

/* till: not enough stock — send anyway or back-order */
.short-row { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }

/* Undo after a delete */
.undo-bar { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 2000; display: flex; gap: 12px; align-items: center;
  background: var(--deep-ink); color: #fff; padding: 10px 14px; border-radius: 10px; box-shadow: 0 6px 24px rgba(0,0,0,.25); max-width: calc(100vw - 32px); }
.undo-bar .btn { background: var(--green); border-color: var(--green); color: #fff; }
.undo-x { background: none; border: 0; color: #fff; font-size: 20px; line-height: 1; cursor: pointer; padding: 0 4px; }

/* weekly prep: one regular per row, tap to see their expected order */
.prep-reg { border-top: 1px solid var(--line); padding: 8px 0; }
.prep-reg > summary { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; cursor: pointer; }

/* "Undo delete" panel at the bottom of a page where something was deleted */
.undo-panel { margin-top: 12px; }
.undo-panel .row + .row { margin-top: 8px; }
.undo-row { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 8px 0; border-top: 1px solid var(--line); }

/* expenses: amount + including / excluding VAT */
.vb-mode button { padding: 8px 12px; }
.vb-sum { margin: -4px 0 10px; padding: 8px 10px; background: var(--accent); border-radius: 8px; }

/* Sort button above lists (8 Oct) */
.sortbar { display: flex; justify-content: flex-end; margin: 0 0 8px; }
.sortbar label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted, #5b6b70); font-weight: 600; }
.sortbar select { width: auto; min-height: 34px; padding: 4px 8px; font-size: 13px; }

/* Reasons on customers (edit 63) */
.why { color: var(--link); }
.reason-box { border-left: 4px solid var(--teal); background: var(--accent); padding: 10px 12px; border-radius: 8px; margin-bottom: 12px; }
.reason-box.nochase { border-left-color: var(--muted); background: #eef1f1; }
.duequick { margin-bottom: 10px; }
.table tr.row-warn td { background: var(--warn-bg); }
.panel.lump { margin-bottom: 12px; }
.table tr.dues-group td { background: #f4f9fa; } .table tr.dues-child td { background: #fbfdfd; }
/* Today's run (9 Oct): a timeline of the stops with the vehicle on it */
.panel.run { padding-left: 18px; }
.run-row { display: flex; align-items: flex-start; gap: 12px; position: relative; }
.run-dot { flex: 0 0 34px; height: 34px; border-radius: 50%; border: 2px solid var(--line); background: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; color: var(--muted, #5b6b6e); z-index: 1; }
.run-dot.done { background: #63B74A; border-color: #63B74A; color: #fff; }
.run-dot.next { border-color: var(--teal); color: var(--teal); box-shadow: 0 0 0 4px rgba(58,148,165,.18); }
.run-dot.start, .run-dot.end { background: var(--ink, #17383D); border-color: var(--ink, #17383D); color: #fff; }
.run-body { flex: 1; min-width: 0; padding: 4px 0 2px; }
.run-row.rs-done .run-body { opacity: .7; }
.run-line { margin-left: 16px; width: 4px; min-height: 34px; background: var(--line); border-radius: 2px; position: relative; }
.run-line.gone { background: #63B74A; }
.run-line.moving { min-height: 56px; background: linear-gradient(#63B74A 0 50%, var(--line) 50% 100%); }
.run-veh { position: absolute; left: -2px; z-index: 2; filter: drop-shadow(0 1px 2px rgba(0,0,0,.25)); }
.run-line .run-veh { top: 50%; transform: translate(-40%, -50%); left: 0; animation: runbob 1.2s ease-in-out infinite; }
.run-row .run-veh { top: -4px; left: 34px; }
@keyframes runbob { 0%, 100% { transform: translate(-40%, -50%); } 50% { transform: translate(-40%, -60%); } }
@media (prefers-reduced-motion: reduce) { .run-line .run-veh { animation: none; } }
