:root {
  --bg: #f4f2ee; --surface: #ffffff; --surface-2: #f8f7f4; --border: #e2ded6;
  --text: #1d1b18; --muted: #6b665d;
  --accent-l: #2f5d50; --accent-d: #7fb8a4; --accent: var(--accent-l);
  --deplete: #dc2626; --restock: #15803d; --waste: #a16207; --count: #1d4ed8; --newitem: #7e22ce;
  --ok: #15803d; --warn: #b45309; --bad: #b91c1c;
  --radius: 14px; --shadow: 0 1px 2px rgba(0,0,0,.06), 0 4px 14px rgba(0,0,0,.05);
  color-scheme: light;
}
/* Colour themes (Settings → Appearance, or the website header): accent for light and dark. */
:root[data-color="ocean"] { --accent-l: #1f5f8b; --accent-d: #7fb6e0; }
:root[data-color="plum"]  { --accent-l: #6d3f86; --accent-d: #c3a0dc; }
:root[data-color="slate"] { --accent-l: #3d4b5c; --accent-d: #a9b6c6; }
:root[data-color="ember"] { --accent-l: #9a3d12; --accent-d: #f0a27a; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141311; --surface: #1d1c19; --surface-2: #24221f; --border: #34312c;
    --text: #f1eee8; --muted: #a39d92; --accent: var(--accent-d);
    --deplete: #ef4444; --restock: #16a34a; --waste: #b7791f; --count: #2563eb; --newitem: #9333ea;
    --ok: #22c55e; --warn: #f59e0b; --bad: #f87171;
    --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141311; --surface: #1d1c19; --surface-2: #24221f; --border: #34312c;
  --text: #f1eee8; --muted: #a39d92; --accent: var(--accent-d);
  --deplete: #ef4444; --restock: #16a34a; --waste: #b7791f; --count: #2563eb; --newitem: #9333ea;
  --ok: #22c55e; --warn: #f59e0b; --bad: #f87171;
  --shadow: none; color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent; -webkit-user-select: none; user-select: none;
}
input, select, textarea { -webkit-user-select: text; user-select: text; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h3 { font-size: 15px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 24px 0 10px; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }

/* ---------- top bar & tabs ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px;
  padding: max(10px, env(safe-area-inset-top)) 16px 10px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; font-size: 18px; flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 32px; height: 32px; border-radius: 8px; flex: none; }
.brand-text { min-width: 0; display: flex; align-items: baseline; flex-wrap: wrap; column-gap: 6px; line-height: 1.15; }
.brand-text .bt-name, .brand-text .bt-sub { min-width: 0; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wordmark { font-weight: 800; letter-spacing: -0.03em; }
.wordmark .q { color: #f97316; }
.brand small { font-weight: 500; color: var(--muted); font-size: 14px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: 14px; white-space: nowrap; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.dot.on { background: var(--ok); } .dot.off { background: var(--bad); } .dot.wait { background: var(--warn); }
.tabs { display: flex; gap: 4px; padding: 8px 16px 0; background: var(--surface); border-bottom: 1px solid var(--border); overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 10px 14px 12px; font-weight: 600; color: var(--muted); border-bottom: 3px solid transparent; cursor: pointer; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
main { max-width: 1100px; margin: 0 auto; padding: 16px 16px 60px; }

.banner { margin: 12px 16px 0; padding: 10px 14px; border-radius: 10px; font-size: 15px; border: 1px solid; }
.banner.warn { background: color-mix(in srgb, var(--warn) 12%, var(--surface)); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.banner.info { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); font-weight: 600; cursor: pointer; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.primary { color: #10201b; } }
:root[data-theme="dark"] .btn.primary { color: #10201b; }
.btn.danger { color: var(--bad); }
.btn.small { min-height: 34px; padding: 0 10px; font-size: 14px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.icon-btn { width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; font-size: 20px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---------- scan view ---------- */
.modes { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.mode-btn { min-height: 64px; border-radius: 12px; border: 2px solid var(--border); background: var(--surface); font-weight: 700; font-size: 16px; cursor: pointer; color: var(--muted); }
.mode-btn kbd { display: block; font: 500 11px ui-monospace, monospace; opacity: .7; margin-top: 2px; }
.mode-btn[aria-pressed="true"] { color: #fff; border-color: transparent; background: var(--mode-color); }
.mode-band { margin-top: 12px; border-radius: var(--radius); padding: 18px 20px; color: #fff; background: var(--mode-color); display: flex; align-items: center; gap: 16px; transition: background .15s; }
.mode-band .name { font-size: 34px; font-weight: 800; letter-spacing: -.01em; }
.mode-band .hint { opacity: .9; }
.mode-band .grow { flex: 1; }
[data-mode="deplete"] { --mode-color: var(--deplete); } [data-mode="restock"] { --mode-color: var(--restock); }
[data-mode="waste"] { --mode-color: var(--waste); } [data-mode="count"] { --mode-color: var(--count); }
[data-mode="newitem"] { --mode-color: var(--newitem); }
.qty-strip { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.qty-strip .label { color: var(--muted); font-weight: 600; margin-right: 4px; }
.qty-strip button { min-width: 52px; min-height: 44px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); font-weight: 700; cursor: pointer; }
.qty-strip button[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.qty-strip .lock { margin-left: auto; }

.flash { animation: flash .5s ease-out; }
@keyframes flash { from { box-shadow: 0 0 0 6px var(--flash, var(--ok)); } to { box-shadow: 0 0 0 0 transparent; } }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.last-scan { margin-top: 12px; padding: 20px; min-height: 120px; display: flex; align-items: center; gap: 18px; }
.last-scan .big { font-size: 26px; font-weight: 700; }
.last-scan .change { font-size: 40px; font-weight: 800; min-width: 110px; text-align: center; }
.last-scan .after { font-size: 18px; }
.last-scan.empty { color: var(--muted); justify-content: center; font-size: 18px; }
.neg { color: var(--bad); } .pos { color: var(--ok); }
.manual { display: flex; gap: 8px; margin-top: 12px; }
.camera-row { margin-top: 12px; }
.camera-btn { width: 100%; min-height: 64px; font-size: 20px; border-radius: 14px; }
.manual input { flex: 1; min-height: 44px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list .sub { font-size: 13px; color: var(--muted); }
.list li.undone { opacity: .45; text-decoration: line-through; }
.tag { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 6px; color: #fff; background: var(--mode-color, var(--muted)); text-transform: uppercase; letter-spacing: .03em; }
.tag.plain { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.badge-unk { color: var(--warn); font-weight: 700; }

/* ---------- stock view ---------- */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar input, .toolbar select { min-height: 44px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); }
/* Toolbars: search on its own row, every other control stretched evenly across the row below it. */
.toolbar input[type=search] { flex: 1 1 100%; min-width: 0; }
.toolbar > select, .toolbar > .btn, .toolbar > details.menu, .toolbar > .seg { flex: 1 1 0; min-width: 140px; }
.toolbar > details.menu > summary { width: 100%; justify-content: center; text-align: center; }
.toolbar > .btn { justify-content: center; text-align: center; white-space: nowrap; }
.toolbar > .seg { margin-top: 0; min-height: 44px; }
.toolbar > .seg button { flex: 1; }
.toolbar-hint { margin: -4px 0 12px; font-size: 14px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { font-size: 13px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; background: var(--surface-2); }
td.r, th.r { text-align: right; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--surface-2); }
tr.low td.qty { color: var(--bad); font-weight: 700; }

/* ---------- order list ---------- */
.supplier-group { margin-bottom: 16px; overflow: hidden; }
.supplier-group header { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.supplier-group header h2 { font-size: 17px; flex: 1; }

/* ---------- excel view ---------- */
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.panel { padding: 18px; }
.panel h2 { font-size: 18px; margin-bottom: 6px; }
.panel p { margin: 0 0 14px; color: var(--muted); }
.drop { display: block; border: 2px dashed var(--border); border-radius: 12px; padding: 22px; text-align: center; cursor: pointer; color: var(--muted); }
.drop input { display: none; }
.preview { margin-top: 14px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.chip { font-size: 13px; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); }
.chip.ok { border-color: color-mix(in srgb, var(--ok) 50%, transparent); }
.errors { color: var(--bad); font-size: 14px; margin: 8px 0 0; padding-left: 18px; }

/* ---------- dialogs ---------- */
dialog { border: 0; border-radius: 18px; padding: 0; width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 40px); background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(0,0,0,.45); }
dialog form, .dlg { padding: 20px; }
dialog h2 { font-size: 20px; margin-bottom: 14px; }
.fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.fields .full { grid-column: 1 / -1; }
.fields label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 700; color: var(--accent); letter-spacing: .01em; }
.fields input, .fields select { min-height: 44px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); font-size: 16px; color: var(--text); font-weight: 400; }
.dlg-actions { display: flex; gap: 8px; margin-top: 18px; }
.dlg-actions .spacer { flex: 1; }
.form-error { color: var(--bad); margin-top: 10px; min-height: 1em; }
.terms-ok { display: flex; align-items: center; gap: 8px; margin: 12px 0 0; font-weight: 400; }
.terms-ok input { width: 18px; height: 18px; margin: 0; }
.terms-new { margin: 12px 0 0; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.terms-new .terms-ok { margin: 0; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.keypad button { min-height: 58px; font-size: 24px; font-weight: 700; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; }
.keypad-display { font-size: 44px; font-weight: 800; text-align: center; padding: 10px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); min-height: 76px; }

/* ---------- setup ---------- */
.setup { position: fixed; inset: 0; z-index: 50; background: var(--bg); overflow: auto; display: flex; padding: 24px 16px; }
.setup .inner { width: min(640px, 100%); margin: auto; padding-top: env(safe-area-inset-top); }   /* margin:auto centers without clipping tall content */
.setup .hero { display: flex; align-items: center; gap: 16px; margin-bottom: 28px; }
.setup .hero-mark { width: 72px; height: 72px; border-radius: 18px; box-shadow: var(--shadow); flex: none; }
.setup .hero-name { font-size: 34px; line-height: 1.1; }
.setup .hero-tag { color: var(--muted); font-size: 16px; margin-top: 2px; }
.setup h1 { font-size: 30px; margin-bottom: 6px; }
.setup .choice { padding: 20px; margin-top: 14px; }
.setup .choice h2 { font-size: 20px; margin-bottom: 6px; }
.setup .choice p { color: var(--muted); margin: 0 0 14px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 12px; font-weight: 600; z-index: 100; max-width: calc(100vw - 32px); }

@media (max-width: 720px) {
  .modes { grid-template-columns: repeat(3, 1fr); }
  .mode-band .name { font-size: 26px; }
  .last-scan { flex-wrap: wrap; }
  .fields { grid-template-columns: minmax(0, 1fr); }
  .mode-btn kbd { display: none; }
}
.barcode-row { display: flex; gap: 8px; align-items: center; }
.barcode-row input { flex: 1; min-width: 0; }
.barcode-row .btn { flex: none; padding: 0 10px; }

/* ---------- online product lookup (new item form) ---------- */
.lookup-note { margin: 8px 0 4px; padding: 8px 12px; border-radius: 10px; font-size: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.lookup-note.found { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }

/* ---------- label picker (hub) ---------- */
.pick-list { max-height: min(50vh, 420px); overflow: auto; margin: 0; }
.pick-row { display: flex; align-items: center; gap: 10px; padding: 10px 14px; cursor: pointer; }
.pick-row input { width: 20px; height: 20px; flex: none; }
.pick-row .grow { flex: 1; min-width: 0; }

.pick-list li { padding: 0; }

/* ---------- hubs found on the Wi-Fi (phones) ---------- */
.found-hubs { margin: 4px 0 14px; }
.found-hub { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; min-height: 56px; padding: 8px 14px; margin-bottom: 8px; text-align: left; }
.found-hub.picked { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent); }

/* ---------- Standalone Pro upgrade ---------- */
.checks { list-style: none; padding: 0; margin: 0 0 12px; }
.checks li { padding: 6px 0 6px 28px; position: relative; }
.checks li::before { content: '✓'; position: absolute; left: 4px; color: var(--ok); font-weight: 800; }
.pro-buy { width: 100%; min-height: 54px; font-size: 18px; margin-top: 4px; }

/* "Barcode scanner connected" (after its first scan) */
.scanner-badge { margin: 10px 0 0; padding: 6px 12px; border-radius: 999px; display: inline-block; font-size: 14px; font-weight: 600;
  background: color-mix(in srgb, var(--ok) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--ok) 35%, transparent); }

/* ---------- stock: sorting, A–Z bar, letter sections ---------- */
.sort-select { display: block; }
.th-sort { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; }
.th-sort:hover, .th-sort.on { color: var(--text); }
.th-sort:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.th-sort .arrow { font-size: 10px; opacity: .55; }
.th-sort.on .arrow { opacity: 1; color: var(--accent); }
.az { display: flex; gap: 2px; margin: 0 0 10px; padding: 4px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); overflow-x: auto; scrollbar-width: none; }
.az button { flex: 1 0 auto; min-width: 26px; min-height: 32px; padding: 0 4px; border: 0; border-radius: 7px; background: none; color: var(--accent); font: 700 14px var(--font, inherit); cursor: pointer; }
.az button:hover:not(:disabled) { background: var(--surface-2); }
.az button:disabled { color: var(--muted); opacity: .35; cursor: default; }
.stock-table tr.letter-row th { background: var(--surface-2); color: var(--accent); font-size: 15px; font-weight: 800; padding: 6px 14px; text-transform: none; letter-spacing: 0; cursor: default; }
.stock-table tr.letter-row:hover { background: none; }
.m-meta, .m-unit { display: none; }

/* Phones and narrow tablets: items as cards, a Sort menu, and a Contacts-style A–Z strip on the right. */
@media (max-width: 720px) {
  .sort-select { display: block; }
  #view-stock .table-wrap { overflow: visible; }
  .stock-table thead { display: none; }
  .stock-table, .stock-table tbody { display: block; }
  .stock-table tr.item-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2px 12px; padding: 10px 34px 10px 14px; border-bottom: 1px solid var(--border); }
  .stock-table tr.item-row td { display: none; padding: 0; border: 0; white-space: normal; }
  .stock-table tr.item-row td.c-name, .stock-table tr.item-row td.c-qty { display: block; }
  .stock-table td.c-qty { font-size: 20px; font-weight: 800; text-align: right; }
  .m-meta { display: block; font-size: 13px; }
  .m-unit { display: block; font-size: 12px; font-weight: 500; color: var(--muted); }
  .stock-table tr.letter-row { display: block; position: sticky; top: var(--topbar-h, 0px); z-index: 2; }
  .stock-table tr.letter-row th { display: block; padding: 4px 14px; border-bottom: 1px solid var(--border); }
  .az { position: fixed; z-index: 15; right: max(2px, env(safe-area-inset-right)); top: calc(var(--topbar-h, 56px) + 10px); bottom: calc(10px + env(safe-area-inset-bottom));
    flex-direction: column; justify-content: space-between; gap: 0; margin: 0; padding: 4px 0; width: 26px; border-radius: 13px; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
  .az button { flex: 1 1 0; min-width: 0; min-height: 0; padding: 0; font-size: 11px; line-height: 1; border-radius: 0; }
}

/* ---------- Cloud Max: site switcher ---------- */
.site-bar { display: flex; align-items: center; gap: 10px; max-width: 1100px; margin: 8px auto 0; padding: 0 16px; }
.site-bar label { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.site-bar select { flex: 0 1 320px; min-height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 16px; font-weight: 600; }
.site-bar .site-manage { font-size: 14px; font-weight: 600; }

/* ---------- appearance settings ---------- */
.swatches { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.swatch { width: 40px; height: 40px; border-radius: 50%; border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--border); cursor: pointer; padding: 0; }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--text); }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; margin-top: 6px; }
.seg button { border: 0; background: var(--surface); padding: 8px 14px; cursor: pointer; font-weight: 600; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--accent); color: #fff; }
:root[data-theme="dark"] .seg button[aria-pressed="true"] { color: #111; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .seg button[aria-pressed="true"] { color: #111; } }
.cat-list { list-style: none; margin: 8px 0 0; padding: 0; max-height: 50vh; overflow: auto; }
.cat-list li { display: flex; align-items: center; gap: 10px; padding: 8px 2px; border-bottom: 1px solid var(--border); }
.cat-list li .grow { flex: 1; }
.order-qty { text-align: right; white-space: nowrap; }
.order-qty .lbl { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.order-qty .n { font-size: 20px; font-weight: 800; }

/* − / + on the last scan */
.last-scan .adj { display: flex; align-items: center; gap: 6px; }
.last-scan .adj-btn { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font-size: 26px; font-weight: 700; line-height: 1; cursor: pointer; flex: none; }
.last-scan .adj-btn:active { transform: scale(.94); }
.last-scan .adj-n { background: none; border: 0; padding: 0 4px; cursor: pointer; min-width: 90px; border-radius: 10px; }
.last-scan .adj-n:hover { background: var(--surface-2); }
@media (max-width: 720px) { .last-scan .adj-n { min-width: 64px; font-size: 32px; } .last-scan .adj-btn { width: 40px; height: 40px; } }

/* Camera Scan In amount */
.scanin-step { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 14px; }
.scanin-step .adj-btn.big { width: 64px; height: 64px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font-size: 34px; font-weight: 700; cursor: pointer; }
.scanin-step input { width: 120px; min-height: 64px; text-align: center; font-size: 36px; font-weight: 800; border-radius: 14px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); }

.list li.day-head { padding: 8px 16px; background: var(--surface-2); font-size: 13px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .04em; }

/* Export ▾ menu (Stock and Order list) */
details.menu { position: relative; }
details.menu > summary { list-style: none; cursor: pointer; }
details.menu > summary::-webkit-details-marker { display: none; }
details.menu .menu-list { position: absolute; left: 0; max-width: calc(100vw - 32px); top: calc(100% + 4px); z-index: 20; min-width: 260px; padding: 6px; display: flex; flex-direction: column; box-shadow: 0 8px 24px rgba(0,0,0,.18); }
details.menu .menu-list > button { text-align: left; background: none; border: 0; color: var(--text); font: inherit; padding: 10px 12px; border-radius: 8px; cursor: pointer; }
details.menu .menu-list > button:hover, details.menu .menu-list > button:focus-visible { background: var(--surface-2); }
details.menu .menu-list > button.hidden { display: none; }
#orderExport .menu-list { left: auto; right: 0; }
.import-wrap { max-width: 640px; }

/* Ordering: cases, on order, suggested pars */
.order-qty .cases { font-size: 13px; color: var(--muted); }
.order-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.on-order-tag { display: inline-block; font-size: 12px; font-weight: 700; color: var(--accent); }
.par-suggest { grid-column: 1 / -1; font-size: 14px; padding: 8px 12px; border-radius: 10px; background: var(--surface-2); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.par-suggest.hidden { display: none; }
.suggest-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.suggest-table th, .suggest-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); text-align: left; }
.suggest-table .r { text-align: right; }
.suggest-wrap { max-height: 55vh; overflow: auto; }

/* Order list: board view, overdue, par check-in, send dialog */
.board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: start; }
@media (max-width: 760px) { .board { grid-template-columns: 1fr; } }
.board-col { padding: 12px; }
.board-col h3 { margin: 0; font-size: 16px; }
.board-hint { margin: 2px 0 10px; font-size: 13px; }
.board-empty { font-size: 14px; }
.kcard { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; background: var(--surface-2); }
.kcard .title { font-weight: 700; }
.kcard .sub { font-size: 13px; color: var(--muted); }
.kcard-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.kcard.late { border-color: var(--bad); }
.tag { display: inline-block; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; padding: 2px 7px; border-radius: 999px; vertical-align: middle; }
.tag.overdue { background: var(--bad); color: #fff; }
.par-check { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 16px; margin-bottom: 12px; border-left: 4px solid var(--accent); }
.par-check .spacer { flex: 1; }
.so-qty { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.so-qty input { width: 74px; min-height: 36px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); text-align: right; font: inherit; }
.check-row { display: flex; gap: 8px; align-items: center; margin-top: 10px; font-size: 14px; }
.oe-methods { display: grid; gap: 8px; }
.oe-method { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; font-weight: 400; color: var(--text); cursor: pointer; }
.oe-method input { margin-top: 4px; }
.oe-smtp.hidden { display: none; }
.oe-help { font-size: 13px; font-weight: 400; }
.fields textarea { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; resize: vertical; }
.fields label.check-row, .fields label.oe-method { flex-direction: row; font-size: 14px; font-weight: 400; color: var(--text); letter-spacing: 0; }
.fields label.check-row input, .fields label.oe-method input { min-height: 0; width: auto; padding: 0; }
.fields .oe-help, .fields .oe-help a { font-weight: 400; }

/* Header → Appearance (every screen): light / dark, colour, text size */
.appear-menu > summary.icon-btn { display: inline-flex; align-items: center; justify-content: center; color: var(--text); }
details.menu .appear-card { left: auto; right: 0; min-width: 290px; padding: 14px; gap: 6px; }
.appear-card .lbl { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-top: 6px; }
.appear-card .lbl:first-child { margin-top: 0; }
.appear-card .seg { display: flex; margin-top: 0; }
.appear-card .seg button { flex: 1; padding: 9px 0; }
.appear-card .swatches { margin-top: 0; }
:root[data-text="large"] body { zoom: 1.15; }
/* Settings sections */
.fields .set-h { grid-column: 1 / -1; margin: 10px 0 -4px; padding-top: 10px; border-top: 1px solid var(--border); font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.fields .set-h:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.fields input[type=checkbox], .fields input[type=radio] { min-height: 0; width: 18px; height: 18px; padding: 0; margin: 0; flex: none; accent-color: var(--accent); }
.fields label > span:has(> input[type=checkbox]) { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 600; color: var(--text); }
/* Order list: List / Board stays put at the far left, a fixed size; the other controls flow after it. */
.toolbar > #orderView { flex: 0 0 240px; min-width: 240px; order: -1; }
@media (max-width: 520px) { .toolbar > #orderView { flex-basis: 100%; } }
.toolbar select:disabled { opacity: .5; cursor: not-allowed; }
/* Settings opens as a panel at the top right, under the ⚙ (full width on phones). */
dialog.side-panel { margin: calc(env(safe-area-inset-top) + 62px) 12px auto auto; width: min(600px, calc(100vw - 24px)); max-height: calc(100vh - 80px); overflow: auto; border-radius: 16px; }
dialog.side-panel::backdrop { background: rgba(0,0,0,.25); }
.biz-links { display: flex; flex-wrap: wrap; gap: 8px; }
.biz-link { text-decoration: none; color: var(--text); }
.fields .biz-note { margin: -4px 0 0; font-size: 13px; font-weight: 400; }
/* Settings: tabs across the top of the panel */
.set-tabs { display: flex; gap: 4px; margin: -4px 0 14px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.set-tabs button { flex: none; border: 0; background: none; padding: 10px 12px; font: inherit; font-size: 15px; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.set-tabs button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.set-pane[hidden] { display: none; }
.set-pane { min-height: 260px; align-content: start; }   /* every tab the same size — the panel doesn't jump */
/* Settings → Business */
.biz-frame iframe { width: 100%; height: min(62vh, 640px); border: 1px solid var(--border); border-radius: 12px; background: var(--bg); }
.biz-card { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; background: var(--surface-2); }
.biz-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.biz-k { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 6px; }
.biz-row .biz-k { margin-bottom: 0; }
.biz-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.biz-stats div { display: flex; flex-direction: column; font-size: 13px; }
.biz-v { font-size: 18px; font-weight: 800; color: var(--text); }
@media (max-width: 520px) { .biz-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.biz-list { list-style: none; margin: 6px 0 0; padding: 0; }
.biz-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0; border-top: 1px solid var(--border); font-size: 14px; flex-wrap: wrap; }
.biz-list li:first-child { border-top: 0; }
.biz-list li > span.muted, .biz-list li > div .muted { font-size: 13px; }
.biz-acts { display: flex; gap: 6px; }
.biz-code { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; margin: 8px 0; border-radius: 10px; border: 1px dashed var(--accent); background: var(--surface); }
.biz-code strong { font-size: 26px; letter-spacing: .1em; }
.biz-code .btn { align-self: flex-start; }
.biz-invite { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.biz-invite input { flex: 1 1 180px; min-height: 38px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; }
.biz-invite select { min-height: 38px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; padding: 0 8px; }
.biz-card .biz-note { font-size: 12.5px; margin: 6px 0 0; }
/* The ⚙ (account and settings) in the theme colour, so it stands out from the other header buttons */
#settingsBtn { background: var(--accent); border-color: var(--accent); color: #fff; }
#settingsBtn:hover { filter: brightness(1.08); }
/* Settings → Business sections */
.biz-nav { display: grid; grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr)); gap: 8px; margin: 0 0 14px; }
@media (max-width: 520px) { .biz-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.biz-nav button { display: flex; align-items: center; justify-content: center; text-align: center; min-height: 42px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: 10px; padding: 6px 8px; font: inherit; font-size: 13.5px; font-weight: 600; line-height: 1.2; cursor: pointer; transition: background .12s, border-color .12s; }
.biz-nav button:hover { border-color: var(--accent); }
.biz-nav button[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.biz-card .seg { margin-top: 0; }
.plan-pick { display: grid; gap: 8px; }
.plan-opt { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.plan-opt.on { border-color: var(--accent); }
.plan-opt > div { display: flex; flex-direction: column; font-size: 14px; }
.plan-opt .muted { font-size: 12.5px; }
.plan-opt .tag { background: var(--accent); color: #fff; }
.rep-wrap { max-height: 320px; overflow: auto; }
.rep-bars { display: flex; align-items: flex-end; gap: 3px; height: 110px; padding-top: 6px; overflow-x: auto; }
.rep-bars span { flex: 0 0 12px; height: 100%; display: flex; flex-direction: column-reverse; gap: 1px; }
.rep-bars i { display: block; border-radius: 3px 3px 0 0; min-height: 1px; }
.rep-bars i.u, .rep-key.u { background: var(--restock); }
.rep-bars i.w, .rep-key.w { background: var(--waste); }
.rep-key { display: inline-block; width: 10px; height: 10px; border-radius: 3px; vertical-align: -1px; margin: 0 4px 0 8px; }
.biz-code { flex-direction: row; align-items: center; gap: 12px; flex-wrap: wrap; }
.biz-code img { border-radius: 8px; background: #fff; padding: 4px; }
.biz-code > div { display: flex; flex-direction: column; gap: 4px; flex: 1 1 200px; }
.site-manage { border: 0; background: none; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; }
.biz-acts { flex-wrap: wrap; justify-content: flex-end; } .biz-acts .btn { white-space: nowrap; }
.linkish { border: 0; background: none; padding: 0; font: inherit; color: var(--accent); text-decoration: underline; cursor: pointer; }
.lic-code { width: 100%; margin: 6px 0; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: 12px ui-monospace, monospace; resize: vertical; }
.biz-row > .btn { white-space: nowrap; flex: none; }
/* Settings → Licenses: theme-coloured section headings that fold open and closed */
.lic-group { margin-bottom: 12px; }
.lic-group > summary { list-style: none; cursor: pointer; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; padding: 6px 0 10px; }
.lic-group > summary::-webkit-details-marker { display: none; }
.lic-group > summary::before { content: "▸"; color: var(--accent); font-size: 13px; transition: transform .15s; display: inline-block; }
.lic-group[open] > summary::before { transform: rotate(90deg); }
.lic-h { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); }
.lic-group > summary .muted { font-size: 13px; }
.biz-note, .biz-card .muted { overflow-wrap: anywhere; }
.biz-row > div { min-width: 0; }

/* Recent scans: a mode-row button (opens the list in a panel) */
.mode-btn.recent-btn { color: var(--text); border-style: dashed; }
.mode-btn.recent-btn:hover { border-color: var(--accent); color: var(--accent); }
@media (max-width: 720px) {
  .brand-text { flex-direction: column; align-items: flex-start; row-gap: 1px; }
  .brand-text .bt-name { font-size: 17px; }
  .brand small.bt-sub { font-size: 12.5px; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.2; }
  .mode-btn.recent-btn { font-size: 14px; padding: 0 4px; }
  /* Phones: when all is synced, the green dot says it — more room for the business and location */
  .topbar { gap: 8px; }
  .pill:has(.dot.on) { padding: 9px; }
  .pill:has(.dot.on) span:last-child { display: none; }
}

/* Settings → What's new */
.wn-seg { display: flex; margin: 12px 0; }
.wn-seg button { flex: 1; padding: 8px 4px; font-size: 13.5px; }
.wn-items { margin: 6px 0 0; padding-left: 18px; font-size: 14px; line-height: 1.45; }
.wn-items li { margin-bottom: 4px; }
.wn-plat { display: inline-block; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--accent); margin-right: 2px; }
.tag.wn-this { background: var(--accent); color: #fff; }
/* Order list → Orders */
.orders-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.orders-bar .seg { margin-top: 0; }
.tag.order-st { background: var(--surface); border: 1px solid var(--border); color: var(--text); }
.tag.order-st.warn { background: var(--warn); border-color: var(--warn); color: #fff; }
.tag.order-st.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.tag.order-st.bad { background: var(--bad); border-color: var(--bad); color: #fff; }
.tag.order-st.muted { color: var(--muted); }
.order-rec header { flex-wrap: wrap; }
.order-rec header h2 { flex: 1 1 auto; }
.order-rec header > .muted { flex: 1 1 100%; font-size: 13px; order: 9; }
