/* Daabu ERP – light, minimal. Cream ground, white surfaces, muted gold only for accents.
   Contrast (WCAG AA): ink on white 15:1, muted on white 6.3:1, gold-ink on white 6.0:1, white on brand 5.0:1. */
:root {
  color-scheme: light; /* always light: the shop's own look, never flipped by the device's dark mode */
  --bg: #fbf5ee; --card: #ffffff; --ink: #2a2420; --muted: #6b5e53; --line: #ece3d8; --line-strong: #dccfbf;
  --gold: #b08a3e; --gold-ink: #7d5f22; --gold-soft: #f6eddd; --brand: #8c6a2b; --brand-hover: #775a23; --brand-ink: #fff;
  --ok: #1f6f3d; --ok-soft: #e8f3ec; --bad: #a8321f; --bad-soft: #fbeae6; --warn: #8a5a00; --warn-soft: #fbf1df;
  --radius: 10px;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { background: var(--bg); }
body { margin: 0; color: var(--ink); font-size: 15px; line-height: 1.45; }
a { color: var(--gold-ink); }
a:hover { color: var(--ink); }

/* Header */
header#topbar[hidden] { display: none; }
header#topbar { display: flex; gap: 16px; align-items: center; padding: 0 20px; height: 56px; background: var(--card); border-bottom: 1px solid var(--line); }
header .brand img { height: 26px; display: block; }
header #where { margin-left: auto; color: var(--muted); font-size: 14px; }
header button.link { color: var(--ink); background: none; font-size: 14px; text-decoration: none; }
header button.link:hover { color: var(--gold-ink); }

/* Menu: sidebar on wide screens, one scrolling strip on phones and counters. */
#side { display: none; }
body.in #side { display: block; background: var(--card); border-bottom: 1px solid var(--line); overflow-x: auto; }
#side nav { display: flex; gap: 4px; padding: 6px 12px; white-space: nowrap; }
.navgroup { display: contents; }
.navgroup span { display: none; }
#side nav a { color: var(--ink); text-decoration: none; padding: 7px 12px; border-radius: 8px; font-size: 14px; }
#side nav a:hover { background: var(--bg); }
#side nav a.active { background: var(--gold-soft); color: var(--gold-ink); font-weight: 600; }
@media (min-width: 1000px) {
  body.in header#topbar { position: sticky; top: 0; z-index: 10; }
  body.in #side { position: fixed; top: 56px; bottom: 0; left: 0; width: 216px; border-bottom: none; border-right: 1px solid var(--line); overflow-y: auto; }
  #side nav { flex-direction: column; padding: 16px 12px; white-space: normal; }
  .navgroup { display: flex; flex-direction: column; gap: 1px; margin-bottom: 18px; }
  .navgroup span { display: block; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); padding: 0 12px 6px; }
  #side nav a { padding: 7px 12px; position: relative; }
  #side nav a.nav-sub { padding: 5px 12px 5px 26px; font-size: 13px; color: var(--muted); }
  #side nav a.nav-sub::after { content: ''; position: absolute; left: 14px; top: 0; bottom: 0; border-left: 1px solid var(--line); }
  #side nav a.nav-sub.active { color: var(--gold-ink); }
  #side nav a.active::before { content: ''; position: absolute; left: -12px; top: 6px; bottom: 6px; width: 3px; border-radius: 0 3px 3px 0; background: var(--gold); }
  body.in main { margin-left: 216px; max-width: 1320px; padding: 28px 32px; }
}

/* Layout */
main { padding: 20px 16px; max-width: 1200px; margin: 0 auto; }
h1 { font-size: 22px; font-weight: 600; letter-spacing: -.01em; margin: 0 0 16px; }
h2 { font-size: 15px; font-weight: 600; margin: 24px 0 10px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 16px; }
.card > h1:first-child, .card > h2:first-child { margin-top: 0; }
.grid { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: 1fr 1fr; }
.cols-bill { grid-template-columns: minmax(0,1fr) 330px; }
@media (min-width: 1000px) and (max-width: 1360px) { .cols-bill { grid-template-columns: minmax(0,1fr) 300px; } }
@media (max-width: 860px) { .cols-2, .cols-bill { grid-template-columns: 1fr; } .card { padding: 16px; } }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.muted { color: var(--muted); }
.ok { color: var(--ok); } .bad { color: var(--bad); } .warn { color: var(--warn); }

/* Forms */
label { display: block; font-size: 13px; font-weight: 500; color: var(--muted); margin: 10px 0 4px; }
input, select, textarea { font: inherit; color: var(--ink); padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; width: 100%; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(176,138,62,.18); }
input::placeholder, textarea::placeholder { color: #9a8d81; }
input.scan { font-size: 20px; padding: 13px 16px; border: 1.5px solid var(--gold); }
button, a.btn { font: inherit; font-size: 14px; font-weight: 500; padding: 9px 16px; border-radius: 8px; border: 1px solid var(--line-strong); background: #fff; color: var(--ink); cursor: pointer; text-decoration: none; display: inline-block; }
button:hover, a.btn:hover { border-color: var(--gold); color: var(--ink); }
button.primary, a.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
button.primary:hover, a.btn.primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); color: #fff; }
button.big { font-size: 16px; padding: 13px 18px; width: 100%; }
button.danger { color: var(--bad); border-color: #e6b9b0; }
button.link { background: none; border: none; padding: 4px 2px; color: var(--gold-ink); text-decoration: none; font-weight: 500; }
button.link:hover { color: var(--ink); text-decoration: underline; }
button:disabled { opacity: .5; cursor: not-allowed; }

/* Tables */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; }
tbody tr:last-child td { border-bottom: none; }
td.r, th.r { text-align: right; font-variant-numeric: tabular-nums; }
.scroll-x { overflow-x: auto; }
table.cart td, table.cart th { padding-left: 6px; padding-right: 6px; }
table.cart td.r { white-space: nowrap; }
table.dense td, table.dense th { padding: 7px 6px; }
table.dense input { padding: 6px 8px; }
.totals td { border: none; padding: 4px 0; }
.totals .grand td { font-size: 22px; font-weight: 700; padding-top: 10px; border-top: 1px solid var(--line); }

/* Status */
.pill { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 12px; font-weight: 500; background: #f1ece6; color: var(--ink); }
.pill.in_stock, .pill.active, .pill.ready, .pill.closed { background: var(--ok-soft); color: var(--ok); }
.pill.sold, .pill.cancelled { background: var(--bad-soft); color: var(--bad); }
.pill.in_work, .pill.open, .pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.ready { font-weight: 600; }
.error-box { background: var(--bad-soft); color: var(--bad); padding: 10px 14px; border-radius: 8px; margin: 10px 0; font-weight: 500; }
.notice { background: var(--gold-soft); border: none; border-radius: 8px; padding: 12px 14px; margin-bottom: 14px; color: var(--ink); }
tr.voided td { color: var(--muted); text-decoration: line-through; }

/* Tabs */
.tabs { display: flex; gap: 22px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.tabs a { padding: 10px 0; color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--ink); }
.tabs a.active { color: var(--ink); border-bottom-color: var(--gold); }

/* KPI tiles: quiet label, strong dark number */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin: 16px 0; }
@media (max-width: 560px) { .tiles { grid-template-columns: 1fr 1fr; gap: 8px; } .tile { padding: 12px; } .tile b { font-size: 18px; } }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; color: var(--ink); }
.tile span { display: block; font-size: 12px; font-weight: 500; color: var(--muted); }
.tile b { display: block; font-size: 22px; font-weight: 650; color: var(--ink); margin-top: 4px; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.tile small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
a.tile { text-decoration: none; transition: border-color .15s; }
a.tile:hover { border-color: var(--gold); color: var(--ink); }
.card .tiles .tile { background: var(--bg); border-color: transparent; }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 120px; padding: 4px 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
.bars div { flex: 1; min-width: 14px; max-width: 48px; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.bars i { display: block; width: 100%; background: var(--gold); border-radius: 3px 3px 0 0; min-height: 2px; opacity: .85; }
.bars small { font-size: 10px; color: var(--muted); }

/* Pictures */
.thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 8px; background: #f2ebe2; display: block; }
img.thumb[data-item] { cursor: zoom-in; }
.photo-full { position: fixed; inset: 0; z-index: 90; background: rgba(20,16,10,.85); display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: zoom-out; }
.photo-full img { max-width: 94vw; max-height: 86vh; border-radius: 8px; background: #222; }
.photo-full p { color: #eee; }
.photo-lg { max-width: 100%; max-height: 360px; border-radius: 10px; background: #f2ebe2; }

/* Login */
.login { max-width: 400px; margin: 48px auto; padding: 32px; }
.login-logo { display: block; width: 78%; margin: 4px auto 24px; }
.login h1 { text-align: center; font-size: 16px; font-weight: 500; color: var(--muted); }
code.secret { font-size: 18px; letter-spacing: 2px; word-break: break-all; background: var(--bg); padding: 8px 10px; border-radius: 8px; display: block; }

#toast { position: fixed; z-index: 1100; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 10px; opacity: 0; transition: opacity .2s; pointer-events: none; max-width: 90vw; font-size: 14px; }
#toast.show { opacity: 1; }
/* Above the bottom button bar (billing and vouchers), never behind it. */
body:has(.actionbar) #toast { bottom: 84px; }
#toast.bad { background: var(--bad); }

/* Staff screens: no copy/select, faint name + time watermark. */
body.staff main { -webkit-user-select: none; user-select: none; }
body.staff main input, body.staff main textarea { -webkit-user-select: text; user-select: text; }
#watermark { position: fixed; inset: 0; pointer-events: none; z-index: 50; opacity: .05; font-size: 22px; font-weight: 700; color: #000;
  display: none; overflow: hidden; white-space: pre; line-height: 120px; transform: rotate(-24deg) scale(1.4); }
body.staff #watermark { display: block; }

/* Printing: thermal bill (80 mm) and barcode labels (50 × 25 mm). */
.print-only { display: none; }
@media print {
  header#topbar, #side, #toast, #watermark, .no-print { display: none !important; }
  body.in main { margin-left: 0 !important; }
  main { padding: 0; max-width: none; }
  .print-only { display: block; }
  html, body { background: #fff; }
  .card { border: none; padding: 0; }
}
.receipt { width: 76mm; font-size: 12px; font-family: ui-monospace, Menlo, Consolas, monospace; color: #000; }
.receipt .logo { display: block; width: 46mm; margin: 0 auto 2px; }
.receipt table td, .receipt table th { padding: 2px 0; border: none; font-size: 12px; text-transform: none; letter-spacing: 0; color: #000; }
.receipt .c { text-align: center; }
.receipt hr { border: none; border-top: 1px dashed #000; }
.receipt-part { page-break-inside: avoid; }
.labels { display: flex; flex-wrap: wrap; gap: 6px; }
.label { width: 50mm; height: 25mm; border: 1px dashed #ccc; padding: 1.5mm; overflow: hidden; display: flex; flex-direction: column; font-size: 9px; line-height: 1.15; page-break-inside: avoid; background: #fff; color: #000; }
.label svg { width: 100%; height: 9mm; }
.label .mrp { font-size: 12px; font-weight: 700; }
.label .code { font-size: 8px; letter-spacing: 1px; }
@media print { .label { border: none; page-break-after: always; } .labels { display: block; } }

/* Search-as-you-type dropdown (customers) */
.dd-wrap { position: relative; }
.dd { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30; background: var(--card); border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: 0 8px 24px rgba(42,36,32,.10); padding: 4px; max-height: 360px; overflow-y: auto; }
.dd-item { display: block; width: 100%; text-align: left; background: none; border: 0; border-radius: 8px; padding: 8px 10px; color: var(--ink); cursor: pointer; font: inherit; }
.dd-item:hover, .dd-item.on { background: var(--gold-soft); }
.dd-main { display: flex; justify-content: space-between; gap: 12px; }
.dd-item small { display: block; margin-top: 2px; }
.dd-note { padding: 10px; color: var(--muted); font-size: 14px; }
.card:has(.dd-wrap) { overflow: visible !important; }

/* Invoice window (sales, purchase, GRN, returns, transfers): party + doc at top, entry row, item grid,
   adjustments bottom-left, totals + net bottom-right, action bar along the bottom. */
.inv { display: flex; flex-direction: column; gap: 12px; padding-bottom: 72px; }
.inv .card { margin-bottom: 0; }
.inv-head { display: grid; grid-template-columns: minmax(280px, 1.3fr) minmax(200px, 1fr) minmax(220px, .9fr); gap: 20px; align-items: start; }
.inv-cust { display: grid; grid-template-columns: 120px 1fr; gap: 6px 10px; align-items: center; }
.inv-cust label { margin: 0; }
.inv-cust .dd { grid-column: 2; top: auto; }
.inv-card { font-size: 13px; }
.inv-card .cc { background: var(--gold-soft); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.inv-card p { margin: 0; }
.inv-doc h1 { font-size: 18px; margin: 0 0 8px; text-align: right; color: var(--gold-ink); }
.inv-doc dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0 0 10px; font-size: 14px; }
.inv-doc dt { color: var(--muted); text-align: right; }
.inv-doc dd { margin: 0; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.inv-doc .row { justify-content: flex-end; }
.key { display: inline-block; font-size: 10px; font-weight: 600; color: var(--muted); border: 1px solid var(--line-strong); border-radius: 4px; padding: 0 4px; margin-left: 4px; vertical-align: 1px; line-height: 15px; }
button.primary .key { color: #fff; border-color: rgba(255,255,255,.5); }
.inv-entry { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.inv-entry > div { display: flex; flex-direction: column; }
.inv-entry .grow { flex: 1; min-width: 220px; }
.inv-entry label { margin: 0 0 4px; }
.inv-entry input.scan { font-size: 17px; padding: 9px 12px; }
.inv-toggles { gap: 4px; padding-bottom: 4px; }
label.check { display: inline-flex; align-items: center; gap: 6px; margin: 0; color: var(--ink); font-size: 14px; cursor: pointer; white-space: nowrap; }
label.check input { width: auto; margin: 0; accent-color: var(--brand); }
input.num { text-align: right; font-variant-numeric: tabular-nums; }
input[readonly] { background: var(--bg); color: var(--muted); }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
.inv-grid-wrap { display: flex; gap: 12px; margin-top: 10px; }
.inv-grid { flex: 1; min-height: 260px; border: 1px solid var(--line); border-radius: 8px; }
.inv-grid table th { position: sticky; top: 0; background: var(--bg); }
.inv-grid table td, .inv-grid table th { padding: 7px 8px; }
.inv-grid input { padding: 5px 8px; }
.inv-empty { text-align: center; padding: 60px 0; margin: 0; }
.inv-items.returning .inv-entry input.scan { border-color: var(--bad); }
tr.ret td { color: var(--bad); }
.inv-pic { width: 200px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.inv-pic .photo-lg, .inv-pic .nopic { width: 200px; height: 240px; object-fit: cover; border-radius: 8px; background: #f2ebe2; }
.inv-pic .nopic { display: grid; place-items: center; color: var(--muted); }
.inv-foot { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); gap: 12px; align-items: start; }
.inv-pair { display: grid; grid-template-columns: 1fr 1.4fr; gap: 16px; }
.inv-pair label, .inv-foot label { margin-top: 0; }
.inv-foot .card > label { margin-top: 12px; }
.row.nowrap { flex-wrap: nowrap; }
.paymodes { display: flex; flex-wrap: wrap; gap: 6px; }
.pm { position: relative; }
.pm input { position: absolute; left: 0; top: 0; width: 1px; height: 1px; margin: 0; opacity: 0; pointer-events: none; }
.pm span { display: inline-block; padding: 7px 14px; border: 1px solid var(--line-strong); border-radius: 99px; font-size: 14px; color: var(--ink); cursor: pointer; background: #fff; }
.pm input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
.pm input:focus-visible + span { box-shadow: 0 0 0 3px rgba(176,138,62,.3); }
.inv-totals .totals td { padding: 3px 0; font-size: 14px; }
.inv-totals .totals td:first-child { color: var(--muted); }
.inv-totals .totals tr.sep td { border-top: 1px solid var(--line); padding-top: 8px; }
.inv-totals .net { display: flex; align-items: baseline; justify-content: space-between; border-top: 2px solid var(--ink); margin-top: 10px; padding-top: 10px; }
.inv-totals .net span { font-size: 15px; font-weight: 600; }
.inv-totals .net b { font-size: 30px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.holdlist { margin-top: 10px; }
.holdlist .row { padding: 6px 0; border-bottom: 1px solid var(--line); }
.actionbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; gap: 8px; align-items: center; padding: 10px 20px; background: var(--card); border-top: 1px solid var(--line); box-shadow: 0 -4px 16px rgba(42,36,32,.05); overflow-x: auto; }
.actionbar .spacer { flex: 1; }
.actionbar button { white-space: nowrap; }
@media (min-width: 1000px) { .actionbar { left: 216px; } }
@media (max-width: 1100px) { .inv-head { grid-template-columns: 1fr 1fr; } .inv-doc { grid-column: 1 / -1; } .inv-doc h1, .inv-doc dd, .inv-doc dt { text-align: left; } .inv-doc .row { justify-content: flex-start; } }
@media (max-width: 860px) { .inv-head, .inv-foot, .inv-pair { grid-template-columns: 1fr; } .inv-cust { grid-template-columns: 100px 1fr; } .inv-pic { display: none !important; } }
.inv-grid td.it { min-width: 220px; }
.inv-grid td.it b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 340px; }
.inv-grid td.it small { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; }
.inv-grid td.it .offer { color: var(--ok); }
.inv-grid td { vertical-align: middle; }
.plabel { min-width: 150px; white-space: nowrap; }
input[style*="uppercase"]::placeholder { text-transform: none; }

/* ── Invoice / voucher window: compact, and on a desktop it fits one screen with no page scroll.
   Only the item grid scrolls inside itself; the net amount and action bar always stay in view. ── */
.inv .card { padding: 12px 16px; }
.inv label { font-size: 12px; margin: 0 0 3px; }
.inv input, .inv select { padding: 6px 10px; font-size: 14px; }
.inv button, .inv a.btn { padding: 6px 12px; font-size: 13px; }
.inv button.link { padding: 0; }
.inv-head { gap: 16px; }
.inv-cust { grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 1fr); gap: 6px 10px; }
.inv-cust label { white-space: nowrap; }
.inv-cust .dd { grid-column: 1 / -1; }
.inv-doc h1 { font-size: 16px; margin: 0 0 4px; }
.inv-doc dl { gap: 2px 12px; margin: 0; font-size: 13px; }
.inv-card .cc { padding: 8px 10px; }
.inv-entry { gap: 8px; }
.inv-entry input.scan { font-size: 16px; padding: 7px 12px; }
.inv-grid-wrap { margin-top: 8px; }
.inv-grid table td, .inv-grid table th { padding: 5px 8px; }
.inv-grid input { padding: 3px 6px; }
.inv-empty { padding: 24px 0; }
.inv-pair { grid-template-columns: 1fr 1.5fr 1.2fr auto; gap: 12px; }
.inv-foot .card > label { margin-top: 8px; }
.inv .paymodes { align-items: center; }
.pm span { padding: 5px 12px; font-size: 13px; }
.inv-totals .totals td { padding: 1px 0; font-size: 13px; }
.inv-totals .totals tbody { display: grid; grid-template-columns: 1fr 1fr; column-gap: 24px; }
.inv-totals .totals tr { display: flex; justify-content: space-between; gap: 8px; white-space: nowrap; }
.inv-totals .totals tr.sep td { border-top: none; padding-top: 1px; }
.inv-totals .net { margin-top: 6px; padding-top: 6px; }
.inv-totals .net b { font-size: 28px; }
.actionbar { padding: 8px 16px; }
.actionbar button { padding: 7px 12px; font-size: 13px; }
/* GST (B2B) buyer details, shown under the customer once a valid GSTIN is typed */
.b2b { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: flex-end; background: var(--gold-soft); border-radius: 8px; padding: 8px 12px; }
.b2b[hidden] { display: none; }
.b2b > div { display: flex; flex-direction: column; }
.b2b .grow { flex: 1; min-width: 220px; }
.b2b-t { width: 100%; font-size: 12px; color: var(--gold-ink); }
.b2b-state { padding: 6px 0; font-weight: 600; font-size: 14px; white-space: nowrap; }
.b2b label.check { padding-bottom: 7px; font-size: 13px; }
.chips { margin-top: 6px; }
.chip { padding: 3px 10px !important; border-radius: 99px !important; font-size: 12px !important; color: var(--muted); }
.slip-code svg { width: 100%; max-width: 260px; height: 36px; }
@media (min-width: 1000px) and (min-height: 600px) {
  body.in main:has(> .inv) { padding-top: 12px; padding-bottom: 0; }
  /* Never hide anything: if a note makes the screen too tall, this area scrolls instead of clipping the item grid. */
  .inv { height: calc(100vh - 56px - 12px - 54px); padding-bottom: 8px; gap: 8px; overflow: hidden auto; }
  .inv > * { flex: none; }
  .inv > .inv-items { flex: 1 1 auto; min-height: 190px; display: flex; flex-direction: column; }
  .inv-items > .inv-grid-wrap { flex: 1 1 auto; min-height: 96px; }
  .inv-items > .notice { margin: 6px 0 0; padding: 4px 10px; font-size: 13px; }
  .inv-grid { min-height: 0; overflow: auto; }
  .inv-pic { overflow: hidden; }
  .inv-pic .photo-lg, .inv-pic .nopic { height: auto; max-height: 100%; aspect-ratio: 5 / 6; }
  .inv-foot > .card { max-height: 34vh; overflow: auto; }
  .inv > .notice { margin: 0; padding: 6px 12px; }
}

/* Tighter still, so the grid keeps room on a 1366×768 screen. */
.inv-head { grid-template-columns: minmax(380px, 1.6fr) minmax(180px, 1fr) minmax(200px, auto); grid-auto-flow: row dense; }
.inv-head .b2b { grid-row: 2; padding: 6px 10px; }
.b2b-t { display: none; }
.b2b-sum { flex: 1; font-size: 13px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inv-head .b2b { align-items: center; flex-wrap: nowrap; }
.b2b-ask { width: min(540px, 94vw); max-height: 94vh; overflow: auto; }
.b2b-ask .row { flex-wrap: nowrap; gap: 8px; }
.b2b-ask label { display: block; margin-top: 6px; }
.b2b-ask textarea { width: 100%; resize: vertical; }
.b2b-ask label.check { display: flex; gap: 6px; align-items: center; margin-top: 8px; }
.inv-grid td.it b { display: inline; max-width: none; }
.inv-grid td.it small { display: inline; margin-left: 6px; }
.inv-grid td.it { white-space: nowrap; max-width: 380px; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.inv-totals .totals td { line-height: 1.3; }
.inv-totals .net b { font-size: 26px; }
.inv-foot .card > label { margin-top: 6px; }
@media (min-width: 1000px) and (min-height: 600px) { .inv-foot > .card { max-height: none; overflow: visible; } }
body.in main:has(> .inv) { max-width: none; }
.inv-cust .dd { top: calc(100% + 4px); }
@media (min-width: 1000px) and (min-height: 600px) { .inv-pic .photo-lg, .inv-pic .nopic { max-height: calc(100% - 64px); width: auto; max-width: 200px; } }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.filters > div { display: flex; flex-direction: column; }
.filters label { margin: 0 0 3px; font-size: 12px; }
.filters input, .filters select { padding: 6px 10px; font-size: 14px; }
.filters .grow { flex: 1; min-width: 220px; }

/* Due and part payment */
.pill.due { background: var(--warn-soft); color: var(--warn); font-weight: 600; }
.part-pay { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; margin-top: 6px; }
.part-pay label { display: flex; flex-direction: column; font-size: 12px; margin: 0; }
.part-pay input { width: 90px; }
.part-pay .part-due { margin-left: auto; padding-bottom: 6px; white-space: nowrap; }
.part-pay.collect input { width: 100px; }
#keepWrap { margin-top: 4px; font-size: 12px; }

/* In-app question box (replaces the browser's prompt / confirm) */
.ask-wrap { position: fixed; inset: 0; background: rgba(40, 30, 10, .35); display: flex; align-items: flex-start; justify-content: center; padding: 15vh 16px 0; z-index: 1000; }
.ask { width: 100%; max-width: 420px; margin: 0; box-shadow: 0 12px 40px rgba(0, 0, 0, .2); }
.ask p { margin: 0 0 10px; font-weight: 600; }

/* A5 tax invoice: black and white, for laser / inkjet. Long bills run onto more pages; the item header repeats. */
@page a5 {
  size: A5 portrait; margin: 7mm 8mm 9mm;
  @bottom-right { content: "Page " counter(page) " of " counter(pages); font: 7pt Arial, sans-serif; }
}
.inv-a5 { page: a5; width: 132mm; font: 8pt/1.25 Arial, Helvetica, sans-serif; color: #000; background: #fff; }
.inv-a5 * { color: #000 !important; }
.inv-a5 .l { text-align: left !important; }
.a5-head { display: flex; gap: 4mm; align-items: center; border-bottom: 1.2pt solid #000; padding-bottom: 1.5mm; }
.a5-head img { width: 32mm; filter: grayscale(1) contrast(1.4); }
.a5-biz { flex: 1; text-align: right; font-size: 8pt; }
.a5-name { font-size: 12pt; font-weight: 700; letter-spacing: .5pt; }
.a5-title { text-align: center; font-weight: 700; letter-spacing: 2pt; font-size: 9pt; margin: 1.2mm 0; }
.a5-lbl { font-size: 7pt; text-transform: uppercase; letter-spacing: .6pt; font-weight: 700; }
.a5-sub { font-size: 7pt; }
.a5-parties, .a5-pay, .a5-sums { display: grid; grid-template-columns: 1.15fr 1fr; gap: 4mm; border: .8pt solid #000; padding: 1.2mm 2mm; break-inside: avoid; }
.a5-sums { border: none; padding: 0; margin-top: 2mm; grid-template-columns: 1fr 1fr; align-items: start; }
.a5-pay { margin-top: 2mm; }
.inv-a5 table { width: 100%; border-collapse: collapse; }
.inv-a5 td, .inv-a5 th { padding: .45mm 1mm; font-size: 7.6pt; border: none; text-transform: none; letter-spacing: 0; background: none; }
.a5-kv td:last-child { text-align: right; }
.a5-parties.a5-two { grid-template-columns: 1fr 1fr; }
.a5-shipto { border-left: .6pt solid #000; padding-left: 2mm; }
.a5-meta { display: flex; flex-wrap: wrap; gap: .5mm 3.5mm; font-size: 7.6pt; margin-bottom: 1.2mm; }
.a5-meta span { white-space: nowrap; }
.a5-items { margin-top: 2mm; }
.a5-items th, .a5-gst th { border-top: 1pt solid #000; border-bottom: 1pt solid #000; font-weight: 700; text-align: right; }
.a5-items td, .a5-gst td { text-align: right; border-bottom: .4pt solid #999; vertical-align: top; }
.a5-items td:first-child, .a5-items th:first-child { text-align: left; width: 5mm; }
.a5-items tr { break-inside: avoid; }
.a5-items thead { display: table-header-group; }
.a5-items .a5-total td { border-top: 1pt solid #000; border-bottom: 1pt solid #000; font-weight: 700; }
.a5-tot td { text-align: right; padding: .3mm 1mm; }
.a5-tot td:first-child { text-align: left; }
.a5-tot .a5-net td { border-top: 1pt solid #000; border-bottom: 1pt double #000; font-size: 10.5pt; font-weight: 700; padding: 1.2mm 1mm; }
.a5-words { margin-top: 1.5mm; font-style: italic; break-inside: avoid; }
.a5-code { margin-top: 1.5mm; }
.a5-code svg { height: 7mm; width: auto; }
.a5-terms { margin-top: 1.5mm; font-size: 7pt; white-space: pre-line; border-top: .6pt solid #000; padding-top: 1.5mm; break-inside: avoid; }
.a5-sign { display: flex; justify-content: space-between; margin-top: 4mm; font-size: 8pt; break-inside: avoid; }
.a5-sign > div { border-top: .8pt solid #000; padding-top: 1mm; min-width: 42mm; text-align: center; }
.a5-foot { text-align: center; font-size: 7.5pt; margin-top: 1.5mm; }
.a5-sign > .a5-foot { border: none; min-width: 0; flex: 1; align-self: flex-end; margin: 0 2mm; padding: 0; }
@media print {
  body[data-pf="a5"] .receipt.print-only { display: none !important; }
  body:not([data-pf="a5"]) .inv-a5.print-only { display: none !important; }
}

/* Daily sales report: A4, black and white. */
@page a4 { size: A4 portrait; margin: 10mm; @bottom-right { content: "Page " counter(page) " of " counter(pages); font: 7pt Arial, sans-serif; } }
/* Daily sales report: A4 portrait, black and white, laid out like the shop's own cash sheet */
.dsr { page: a4; background: #fff; color: #000; font: 9pt/1.35 Arial, Helvetica, sans-serif; max-width: 194mm; padding: 7mm; border: 1px solid var(--line); border-radius: 10px; font-variant-numeric: tabular-nums; }
.dsr * { color: #000; }
.dsr h3 { font-size: 10pt; font-weight: 700; margin: 5mm 0 1.2mm; break-after: avoid; text-transform: uppercase; letter-spacing: .6pt; }
.dsr-head { display: flex; gap: 5mm; align-items: center; padding-bottom: 2.5mm; border-bottom: 2pt solid #000; }
.dsr-head img { width: 30mm; filter: grayscale(1); }
.dsr-biz { flex: 1; font-size: 8.5pt; }
.dsr-title { font-size: 15pt; font-weight: 700; letter-spacing: .5pt; text-transform: uppercase; margin-bottom: .5mm; }
.dsr-date { text-align: right; font-size: 8.5pt; }
.dsr-day { font-size: 11.5pt; font-weight: 700; }
.dsr-sub { font-size: 7.5pt; font-weight: 400; }
.dsr-none { font-style: italic; }
.dsr-hero { display: flex; align-items: flex-end; gap: 7mm; margin-top: 3.5mm; padding: 2.5mm 4mm; border: 1.5pt solid #000; border-radius: 1.5mm; }
.dsr-hero > div:first-child { flex: 1; }
.dsr-hero > div:not(:first-child) { text-align: right; }
.dsr-lbl { font-size: 7.5pt; text-transform: uppercase; letter-spacing: .6pt; }
.dsr-big { font-size: 20pt; font-weight: 700; line-height: 1.1; }
.dsr-mid { font-size: 11pt; font-weight: 700; }
.dsr-t { width: 100%; border-collapse: collapse; }
.dsr-t th, .dsr-t td { padding: 1.1mm 1.6mm; font-size: 8.5pt; text-align: right; border: none; border-bottom: .5pt solid #aaa; text-transform: none; letter-spacing: 0; background: none; vertical-align: top; white-space: nowrap; }
.dsr-t td.l { white-space: normal; } .dsr-t td.nw { white-space: nowrap; }
.dsr-t th { border-top: 1pt solid #000; border-bottom: 1pt solid #000; font-weight: 700; font-size: 8pt; background: #ececec; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.dsr-z tbody tr:nth-child(even) td { background: #f5f5f5; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.dsr .l { text-align: left; } .dsr .c { text-align: center; } .dsr .mono { font-family: Consolas, 'Courier New', monospace; font-size: 8pt; }
.dsr-t tr { break-inside: avoid; }
.dsr-total td { font-weight: 700; border-top: 1.2pt solid #000; border-bottom: 1.2pt solid #000; background: none; }
.dsr-grand td { font-weight: 700; font-size: 10.5pt; border-top: 2pt solid #000; border-bottom: 2pt double #000; padding-top: 1.6mm; padding-bottom: 1.6mm; }
.dsr-cash td { padding-top: 1mm; padding-bottom: 1mm; }
.dsr-x td { text-decoration: line-through; }
.dsr-cols { display: grid; grid-template-columns: 1.15fr 1fr; gap: 7mm; align-items: start; }
.dsr-fill { display: inline-block; width: 20mm; border-bottom: .8pt solid #000; height: 3.5mm; }
.dsr-notes td { padding-top: .7mm; padding-bottom: .7mm; }
.dsr-note { margin: 4mm 0 0; font-size: 8.5pt; }
.dsr-sign { display: flex; justify-content: space-between; gap: 10mm; margin-top: 18mm; break-inside: avoid; font-size: 8.5pt; }
.dsr-sign > div { flex: 1; border-top: .8pt solid #000; text-align: center; padding-top: 1.2mm; }
.dsr-printed { margin-top: 3mm; font-size: 7pt; }
@media print { .dsr { border: none; padding: 0; max-width: none; } }
/* Daily sales report in the owner's cashbook layout (4 Dec 2026): plain ruled grid, one A4 page. */
.dsr2 { font: 8.5pt/1.3 Arial, Helvetica, sans-serif; }
.d2-top { display: flex; justify-content: space-between; font-size: 11pt; margin-bottom: 2.5mm; }
.d2-hero { display: flex; justify-content: space-between; align-items: center; border: 1pt solid #000; padding: 1.8mm 2.5mm; margin-bottom: 0; font-size: 8pt; }
.d2-big { font-size: 13pt; font-weight: 700; }
.d2 { width: 100%; border-collapse: collapse; }
.d2 th, .d2 td { border: .6pt solid #000; padding: .55mm 1.4mm; font-size: 8pt; text-align: center; vertical-align: middle; background: none; text-transform: none; letter-spacing: 0; color: #000; }
.d2 th { font-weight: 700; line-height: 1.2; }
.d2 th.d2-day { font-size: 9pt; }
.d2 td.r { text-align: right; white-space: nowrap; } .d2 td.l { text-align: left; }
.d2 tfoot td, .d2-b td { font-weight: 700; }
.d2-big2 td { font-size: 9.5pt; }
.d2-cash td:first-child { text-align: left; }
.d2-s { font-size: 6.8pt; font-weight: 400; }
.d2-x { text-decoration: line-through; }
.d2 tr { break-inside: avoid; }
.d2-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 5mm; align-items: start; }
.dsr2 h4 { font-size: 8.5pt; font-weight: 700; margin: 3mm 0 1mm; }
.d2-note { font-size: 8pt; margin: 2mm 0 0; }
.dsr2 .dsr-sign { margin-top: 10mm; }
.dsr2 h4 + .d2 { margin-top: 0; }

/* Per-piece delivery on the bill: given now, or held for finishing / alteration */
.hold-sel { width: auto; padding: 4px 6px; font-size: 13px; }
.hold-sel.on { border-color: var(--gold); background: var(--gold-soft); color: var(--gold-ink); font-weight: 600; }
.held-tag { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 999px; background: var(--gold-soft); color: var(--gold-ink); }
.held-tag.done { background: #e7f4e7; color: #2c6b2c; }
.hand-list { display: grid; gap: 4px; margin: 6px 0 10px; }
.hand-list .check { margin: 0; font-weight: 400; }
.a5-held { font-size: 8pt; font-weight: 700; }
#delivDate { width: 140px; }
@media (max-width: 1500px) { .inv-grid td.it { max-width: 230px; } .inv-grid td.mono { font-size: 12px; } }
.inv-grid .hold-sel { width: 98px; }
@media (max-width: 1500px) {
  .inv-grid table td, .inv-grid table th { padding-left: 5px; padding-right: 5px; }
  .inv-grid td.it { max-width: 170px; }
  .inv-grid .lpct { width: 46px !important; } .inv-grid .ldisc { width: 66px !important; }
}
#jobSvc { min-width: 96px; }
.denoms { display: grid; grid-template-columns: repeat(9, 1fr); gap: 6px; margin-bottom: 8px; }
.denoms label { margin: 0; font-size: 12px; } .denoms input { padding: 4px 6px; }
@media (max-width: 700px) { .denoms { grid-template-columns: repeat(5, 1fr); } }
.bad-in { border-color: var(--bad, #b3261e) !important; }
.vch #entryErr .error-box { max-height: 58px; overflow: auto; font-size: 13px; padding: 5px 10px; margin: 6px 0 0; line-height: 1.35; }
/* Goods received entry row on one line on 1366-wide shop screens, so the item grid keeps its height. */
@media (max-width: 1500px) {
  .vch[data-vch=grn] .inv-entry, .vch[data-vch=po] .inv-entry { gap: 6px; }
  .vch[data-vch=grn] .inv-entry .grow, .vch[data-vch=po] .inv-entry .grow { min-width: 130px; }
  .vch[data-vch=grn] .inv-entry input:not(#e_name), .vch[data-vch=po] .inv-entry input:not(#e_name) { width: 64px !important; padding-left: 6px; padding-right: 6px; }
  .vch[data-vch=grn] #e_category, .vch[data-vch=po] #e_category { width: 84px !important; }
  .vch[data-vch=grn] #e_qty, .vch[data-vch=grn] #e_size, .vch[data-vch=grn] #e_section { width: 46px !important; }
  .vch[data-vch=grn] .inv-entry label { font-size: 12px; white-space: nowrap; }
}
.hdr-set { margin-right: 16px; text-decoration: none; color: var(--gold-ink); font-size: 14px; }
/* Salesperson dropdown on the bill */
.combo { position: relative; }
.combo-list { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 2px); max-height: 260px; overflow: auto; margin: 0; padding: 4px 0; list-style: none; background: var(--card, #fff); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.12); }
.combo-list li { padding: 6px 12px; cursor: pointer; white-space: nowrap; }
.combo-list li.on, .combo-list li[data-i]:hover { background: var(--gold-soft); color: var(--gold-ink); }
.inv-grid .ldate { display: block; width: 98px; margin-top: 3px; padding: 2px 4px; font-size: 12px; }
/* Salesmen settings: active and inactive both visible without scrolling */
.sm-h { font-size: 15px; margin: 10px 0 6px; }
.sm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 5px 8px; }
.sm-chip { border: 1px solid var(--line); border-radius: 8px; padding: 3px 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 14px; white-space: nowrap; }
.sm-chip span { font-size: 12.5px; } .sm-chip .link { padding: 0; min-height: 0; }
.sm-chip.off { background: #f3f1ec; color: #8a857b; border-style: dashed; }
.sm-chip.off b { font-weight: 600; text-decoration: none; }
@media (min-width: 1100px) { .sm-page { grid-template-columns: 3fr 1fr; } }
.ord-chip { background: var(--gold-soft); border-radius: 8px; padding: 6px 10px; font-size: 13px; white-space: nowrap; }
/* Ledgers: the table scrolls inside the card so the page fits the screen */
.ledger .tiles { margin: 8px 0; }
.ledger-scroll { max-height: calc(100vh - 320px); min-height: 160px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.ledger-scroll table { margin: 0; }
.ledger-scroll th { position: sticky; top: 0; background: var(--bg); }
.ledger-scroll td.ld { max-width: 420px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
tr.strike td { text-decoration: line-through; }
.ledger-scroll td:first-child { white-space: nowrap; }
.ledger .tile { padding: 8px 14px; } .ledger .tile b { font-size: 20px; }
.vpay { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0 0 8px; padding: 8px 10px; background: var(--gold-soft); border-radius: 8px; }
.vpay input, .vpay select { width: auto; padding: 6px 8px; font-size: 14px; }
.vpay select#vpBill { max-width: 230px; }
.vpay button { padding: 6px 14px; }
.vpay + .ledger-scroll { max-height: calc(100vh - 370px); }
.ledger-scroll td:nth-child(2) { white-space: nowrap; }
.comm { grid-template-columns: 3fr 2fr; } .comm .ledger-scroll { max-height: calc(100vh - 360px); }
.alerts { grid-template-columns: 2fr 3fr; } .alerts .ledger-scroll { max-height: calc(100vh - 190px); } .alerts td.ld { max-width: 360px; }

/* Offline billing */
.off-chip { background: #fff4d6; color: #7a5200; border: 1px solid #e9c46a; border-radius: 999px; padding: 2px 10px; font-size: 12px; white-space: nowrap; }
.off-chip.down { background: #7a5200; color: #fff; border-color: #7a5200; }
.offl table td { vertical-align: top; }
.offl input[data-note] { min-width: 200px; }

/* Vendor form: one box, no page scroll at 1366×650. */
.ask.vf { max-width: 860px; max-height: 92vh; overflow-y: auto; }
.ask-wrap:has(.vf) { padding-top: 3vh; }
.vf-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px 10px; margin-top: 6px; }
.vf-grid label, .vf label { margin-top: 4px; font-size: 12px; }
.vf-grid .vf-wide { grid-column: span 2; }
.vf-c { display: grid; grid-template-columns: 1.2fr 1fr 1fr 1.4fr auto; gap: 6px; margin-top: 4px; }
@media (max-width: 700px) { .vf-grid { grid-template-columns: 1fr 1fr; } .vf-c { grid-template-columns: 1fr 1fr; } }
.dsr2 .d2 { width: calc(100% - 1.5pt); margin-left: .5pt; }
.dsr2 .d2 tr:last-child td { border-bottom: .6pt solid #000; }

/* A5 order / alteration slips: customer copy and shop copy on separate A5 pages. */
.a5-slip + .a5-slip { break-before: page; }
.a5-copy { text-align: center; font-size: 7pt; letter-spacing: 1pt; margin: -0.8mm 0 1.2mm; }
.a5-ord td:first-child, .a5-ord th:first-child { width: auto; } .a5-ord td:last-child, .a5-ord th:last-child { width: 30mm; }
/* Stock audit: lists scroll inside their card so the page itself fits 1366×650 */
.audit-scroll { max-height: calc(100vh - 480px); min-height: 90px; overflow: auto; }
.audit-head .tile { padding: 8px 14px; }
.audit-last { flex: 1.4; min-height: 40px; }
.audit-head .tiles { margin-top: 8px; }
/* Close day: note count on the left, totals and entries on the right; fits 1366×650 */
.closeday .card { padding-top: 12px; padding-bottom: 12px; }
.cd-denoms { width: 100%; }
.cd-denoms td, .cd-denoms th { padding: 1px 8px; }
.cd-denoms input.dn { width: 90px; text-align: right; padding: 2px 8px; height: 28px; }
.closeday h1 { font-size: 20px; margin-bottom: 4px; }
.cd-denoms tfoot td { border-top: 2px solid var(--line); font-size: 16px; }
.closeday .totals td { padding: 2px 8px; }
.closeday .totals .grand td { font-size: 16px; }
.closeday h2 { font-size: 15px; }
.cd-moves { max-height: 70px; overflow: auto; }
.cd-moves td { padding: 2px 8px; font-size: 13px; }
/* Charts */
.ch-head { padding-bottom: 0; }
.ch-head .row button { padding: 6px 10px; }
.ch-tiles { margin: 8px 0 4px; }
.ch-tiles .tile { padding: 6px 14px; }
.ch-card h2 { margin: 0 0 6px; font-size: 16px; }
.ch-card h2 small { font-weight: 400; font-size: 12px; }
.ch-svg { width: 100%; height: auto; max-height: calc(100vh - 400px); display: block; }
.ch-grid { stroke: var(--line); stroke-width: 1; }
.ch-ax { font-size: 11px; fill: var(--muted); }
.ch-big { font-size: 18px; font-weight: 700; fill: var(--ink); }
.hb { display: grid; grid-template-columns: minmax(90px, 30%) 1fr auto; gap: 4px 8px; align-items: center; max-height: calc(100vh - 425px); overflow: auto; font-size: 13px; }
.hb-row { display: contents; }
.hb-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-bar { background: var(--gold-soft); border-radius: 4px; height: 14px; overflow: hidden; }
.hb-bar i { display: block; height: 100%; border-radius: 4px; }
.hb-val { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hb-val small { display: block; color: var(--muted); font-size: 11px; line-height: 1.1; }
.donut { display: flex; gap: 16px; align-items: center; }
.ch-donut { width: 200px; height: 200px; flex: none; max-height: calc(100vh - 420px); }
.ch-legend { flex: 1; display: grid; gap: 4px; font-size: 13px; }
.ch-legend div { display: grid; grid-template-columns: 12px 1fr auto 40px; gap: 6px; align-items: center; }
.ch-legend i { width: 12px; height: 12px; border-radius: 3px; display: block; }
.ch-legend b { font-weight: 600; text-align: right; }
.ch-legend small { color: var(--muted); text-align: right; }
@media (max-width: 760px) { .donut { flex-direction: column; } }
/* Vendor portal: phone first, read only */
body.vp-body main, body.vp-body #app { max-width: 980px; margin: 0 auto; }
.vp { padding: 8px 0 24px; }
.vp-head { display: flex; gap: 12px; align-items: center; padding: 8px 4px 12px; }
.vp-head img { height: 30px; }
.vp-head small { display: block; color: var(--muted); font-size: 12px; }
.vp-tabs { overflow-x: auto; flex-wrap: nowrap; gap: 18px; padding: 0 4px; }
.vp-tabs a { white-space: nowrap; }
.vp-body-in { padding: 10px 4px; }
.vp-period { margin-bottom: 8px; }
.vp-period { flex-wrap: nowrap; align-items: center; }
.vp-period input { flex: 1; min-width: 0; width: auto; }
.vp-tiles { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.vp-list { display: grid; gap: 6px; }
.vp-item { display: flex; gap: 10px; justify-content: space-between; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; }
.vp-item > div:first-child, .vp-det summary > div:first-child { min-width: 0; }
.vp-item small { display: block; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.vp-item .r { text-align: right; white-space: nowrap; }
.vp-det { display: block; }
.vp-det summary { display: flex; gap: 10px; justify-content: space-between; cursor: pointer; list-style: none; }
.vp-sub { display: flex; justify-content: space-between; font-size: 13px; padding: 4px 0 0; border-top: 1px dashed var(--line); margin-top: 4px; }
.vp-foot { font-size: 12px; text-align: center; margin-top: 16px; }
@media (max-width: 600px) { .vp .grid.cols-2 { grid-template-columns: 1fr; } .vp-tiles .tile b { font-size: 20px; } }
/* Tally link */
.tl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 6px 14px; }
.tl-grid label { font-size: 12px; color: var(--muted); margin: 0; }
.tl-grid input { margin-top: 2px; padding: 5px 8px; }
.tl-scroll { max-height: calc(100vh - 395px); overflow: auto; margin-top: 6px; }
.tl-scroll h3 { font-size: 14px; margin: 8px 0 4px; }

/* ── Gap-check round 2 (5 Dec 2026) ── */
.ask p { white-space: pre-line; }
tr.lowmk td { background: color-mix(in srgb, var(--bad) 8%, transparent); }
.devcode { font: 700 28px/1.2 ui-monospace, Consolas, monospace; letter-spacing: .2em; margin: 8px 0; color: var(--ink, #222); }
.meter { height: 10px; border-radius: 5px; background: var(--line); overflow: hidden; margin: 6px 0 2px; }
.meter > i { display: block; height: 100%; background: var(--gold); }
.meter.ok > i { background: var(--ok); }
.cmpbar { display: grid; grid-template-columns: minmax(0, 11em) minmax(0, 1fr) 7.5em 5em; gap: 8px; align-items: center; font-size: 13px; padding: 3px 0; }
.cmpbar .b2 { display: grid; gap: 2px; }
.cmpbar .b2 i { display: block; height: 8px; border-radius: 2px; background: var(--gold); min-width: 1px; }
.cmpbar .b2 i.ly { background: #cdbf9f; }
.help { max-width: 860px; }
.help h2 { margin-top: 22px; }
.help ol, .help ul { padding-left: 1.3em; }
.help li { margin: 4px 0; }
.help .tip { background: var(--gold-soft); border-left: 3px solid var(--gold); padding: 8px 12px; margin: 10px 0; }
.rolechips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 4px; }
.binlbl { font: 600 13px ui-monospace, Consolas, monospace; background: var(--gold-soft); padding: 1px 6px; border-radius: 4px; }
@media print { .noprint { display: none !important; } }

/* Estimate slip (billing): preview in a box on screen; when printing, only the estimate prints. */
.est-card { max-width: min(620px, 96vw); max-height: 92vh; overflow: auto; }
.est-card .inv-a5.est-doc { display: block; margin: 0 auto; }
.est-card .receipt.est-doc { display: block; margin: 0 auto; }
@media print {
  body.printing-est > *:not(.est-wrap) { display: none !important; }
  body.printing-est .est-wrap { position: static !important; background: none !important; display: block !important; padding: 0 !important; }
  body.printing-est .est-card { box-shadow: none; border: none; max-height: none; overflow: visible; padding: 0; max-width: none; }
}
.ask-wrap.est-wrap { padding-top: 3vh; }
/* Salesman on every bill line (owner, 5 Dec 2026): a narrow picker per line; red until one is picked. */
.inv-grid select.lsm, .inv-grid select.ssm { width: 112px; padding: 4px 6px; font-size: 13px; }
.inv-grid select.bad-in { background: #fdecea; }
@media (max-width: 1500px) {
  .inv-grid select.lsm, .inv-grid select.ssm { width: 88px; padding: 4px 2px; }
  .inv-grid td.it { max-width: 120px; } .inv-grid .ldisc { width: 58px !important; }
}
/* "Pick the salesman first" sits beside the open salesman list, not under it. */
#scanErr .error-box.wait-sm { margin-left: 250px; }
/* Standing discount and courier on the sales invoice (owner, 5 Dec 2026). */
.std-pill { background: var(--gold-soft); color: var(--gold-ink); font-weight: 600; }
#aCourier.on { border-color: var(--gold); background: var(--gold-soft); color: var(--gold-ink); font-weight: 600; }
.courier-ask { width: min(460px, 94vw); }
.courier-ask label { display: block; margin-top: 6px; }
.courier-ask textarea { width: 100%; }
/* A5 packing slip: TO in big print, FROM smaller. Printed only from the bill's "Print packing slip". */
.pack-a5 { page: a5; width: 132mm; font: 10pt/1.3 Arial, Helvetica, sans-serif; color: #000; background: #fff; }
.pack-a5 .ps-title { text-align: center; font-weight: 700; letter-spacing: .5pt; border-bottom: 1pt solid #000; padding-bottom: 2mm; margin-bottom: 3mm; }
.pack-a5 .ps-box { border: 1.2pt solid #000; padding: 3mm 4mm; margin-bottom: 3mm; }
.pack-a5 .ps-lbl { font-weight: 700; font-size: 9pt; letter-spacing: 1pt; }
.pack-a5 .ps-to .ps-name { font-size: 16pt; font-weight: 700; }
.pack-a5 .ps-to .ps-addr, .pack-a5 .ps-to .ps-ph { font-size: 13pt; }
.pack-a5 .ps-from { font-size: 9.5pt; }
.pack-a5 .ps-from .ps-name { font-weight: 700; }
.pack-a5 .ps-items { width: 100%; border-collapse: collapse; font-size: 8.5pt; margin-top: 2mm; }
.pack-a5 .ps-items th, .pack-a5 .ps-items td { border: .6pt solid #000; padding: .8mm 1.5mm; text-align: center; }
.pack-a5 .ps-items .l { text-align: left; }
.pack-a5 .ps-sub { font-size: 7.5pt; }
.pack-a5 .ps-code { text-align: center; margin-top: 3mm; }
.pack-a5 .ps-note { font-size: 8pt; margin-top: 2mm; }
@media print {
  body[data-pf="slip"] .receipt.print-only, body[data-pf="slip"] .inv-a5.print-only { display: none !important; }
  body:not([data-pf="slip"]) .pack-a5.print-only { display: none !important; }
}
/* Room for "Every visit" (standing discount) beside the bill discount. */
.inv-pair { grid-template-columns: 1.45fr 1.4fr 1fr auto; }
#billDisc { min-width: 64px; }
#keepDiscWrap { white-space: nowrap; }
.a5-items td.a5-sm { white-space: nowrap; font-size: 7.5pt; }
.b2b-ask button { white-space: nowrap; }

/* New customer order: salesman picker and a small reference-barcode box on one row. */
.ord-row { gap: 12px; align-items: flex-start; flex-wrap: wrap; margin-top: 4px; }
.ord-row .combo input { width: 220px; }
.ord-row input.ref-bc { width: 170px; }

/* Goods received: vendor bill discount, freight and other charges (5 Dec 2026). */
.grn-x { display: flex; gap: 8px; align-items: flex-end; flex-wrap: nowrap; }
.grn-x > div { min-width: 0; }
.grn-x label { margin-top: 0; font-size: 12px; }
.grn-x input.num { width: 88px; }
.grn-x select { width: 70px; }
.grn-x .grow { flex: 1; }
.inv[data-vch=grn] .inv-cust > .row.nowrap { grid-column: 2 / -1; }
/* Type-to-search vendor box. */
.vpick { width: 100%; min-width: 0; flex: 1; }
.inv-cust .row.nowrap { min-width: 0; flex-wrap: nowrap; }
.inv-cust .row.nowrap > .link { white-space: nowrap; flex: none; }
input.bad-input { border-color: var(--bad, #b3261e); }
#vfGstOk.ok { color: var(--ok, #1d7a3a); }
#vfGstOk.bad { color: var(--bad, #b3261e); }

/* A5 packing slip for goods returned to a vendor (5 Dec 2026): big TO block, smaller FROM, contents without prices. */
.ps-wrap { display: flex; justify-content: center; }
.ps-wrap .inv-a5 { padding: 8mm; border: 1px solid var(--line); border-radius: 10px; box-sizing: content-box; }
.ps-to { border: 1.4pt solid #000; padding: 3mm 4mm; margin-top: 3mm; font-size: 11pt; line-height: 1.35; }
.ps-to .ps-name { font-size: 15pt; font-weight: 700; margin: .5mm 0 1mm; }
.ps-to .ps-phone { font-size: 12pt; margin-top: 1mm; }
.ps-from { border: .8pt solid #000; padding: 2mm 3mm; margin-top: 2.5mm; font-size: 8.5pt; }
.ps-from .ps-fname { font-weight: 700; font-size: 10pt; }
.ps-meta { margin-top: 2mm; }
.ps-meta td:nth-child(odd) { font-weight: 700; }
@media print { .ps-wrap .inv-a5 { padding: 0; border: none; } }

/* Vendor portal ageing buckets (owner, 5 Dec 2026) */
.vp-age { text-align: left; cursor: pointer; font: inherit; color: inherit; }
.vp-age.on { outline: 2px solid var(--gold); }

/* Bulk photos (owner, 5 Dec 2026): background upload bar and full photo on tap */
.bulk-bar { position: fixed; right: 16px; bottom: 16px; z-index: 70; background: #fff; border: 1px solid var(--line); border-left: 3px solid var(--gold); border-radius: 10px; padding: 8px 12px; font-size: 13px; display: flex; gap: 10px; align-items: center; box-shadow: 0 4px 16px rgba(0,0,0,.08); }
.bulk-bar progress { width: 140px; }
.photo-full { position: fixed; inset: 0; z-index: 90; background: rgba(20,16,10,.85); display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: zoom-out; }
.photo-full img { max-width: 94vw; max-height: 86vh; border-radius: 8px; background: #222; }
.photo-full p { color: #eee; }
img.photo-lg[data-item] { cursor: zoom-in; }
