/* Stockroom — clean, calm and touch-friendly. Phone first; sidebar on wider screens. */
/* Colors and type follow heielectric.com: charcoal #494B51, steel gray #818285, near-black #222, Open Sans.
   Light is the default. Dark follows the device setting unless this device picked a theme in Settings → Appearance
   (stored per device and applied by theme.js as <html data-theme="light|dark"> before the page draws). */
@font-face { font-family: "Open Sans"; src: url(/vendor/open-sans.woff2) format("woff2"); font-weight: 300 800; font-style: normal; font-display: swap; }
:root {
  --bg: #f4f4f5;
  --surface: #ffffff;
  --surface-2: #efeff1;
  --line: #e2e2e5;
  --text: #2b2d31;
  --muted: #6b6d72;
  --accent: #494b51;
  --accent-ink: #ffffff;
  --accent-soft: #ececee;
  --steel: #818285;
  --good: #15803d;
  --good-soft: #e8f5ec;
  --warn: #b45309;
  --warn-soft: #fff6e6;
  --bad: #dc2626;
  --bad-soft: #fdeceb;
  --nav: #ffffff;
  --nav-ink: #494b51;
  --nav-strong: #222222;
  --nav-line: #e2e2e5;
  --nav-hover: #f2f2f3;
  --nav-active: #494b51;
  --nav-active-text: #ffffff;
  --nav-active-ink: #ffffff;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(34, 34, 34, .05), 0 6px 22px rgba(34, 34, 34, .06);
  --shadow-lg: 0 24px 64px rgba(34, 34, 34, .24);
  --font: "Open Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, monospace;
  --tap: 48px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
  --bg: #141517; --surface: #1d1f22; --surface-2: #26282c; --line: #34373c; --text: #ececee; --muted: #9a9ca3;
  --accent: #d9dbdf; --accent-ink: #141517; --accent-soft: #2e3035; --steel: #6c6e73; --good: #34d399; --good-soft: #0f2e27;
  --warn: #fbbf24; --warn-soft: #33270b; --bad: #f87171; --bad-soft: #3a1717;
  --nav: #0f1012; --nav-ink: #a3a5ab; --nav-strong: #ffffff; --nav-line: rgba(255, 255, 255, .08); --nav-hover: rgba(255, 255, 255, .05); --nav-active: #d9dbdf; --nav-active-text: #141517; --nav-active-ink: #141517;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 28px rgba(0, 0, 0, .25);
  color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141517; --surface: #1d1f22; --surface-2: #26282c; --line: #34373c; --text: #ececee; --muted: #9a9ca3;
  --accent: #d9dbdf; --accent-ink: #141517; --accent-soft: #2e3035; --steel: #6c6e73; --good: #34d399; --good-soft: #0f2e27;
  --warn: #fbbf24; --warn-soft: #33270b; --bad: #f87171; --bad-soft: #3a1717;
  --nav: #0f1012; --nav-ink: #a3a5ab; --nav-strong: #ffffff; --nav-line: rgba(255, 255, 255, .08); --nav-hover: rgba(255, 255, 255, .05); --nav-active: #d9dbdf; --nav-active-text: #141517; --nav-active-ink: #141517;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 28px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.45; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
h1, h2, h3 { margin: 0; letter-spacing: -.02em; }
h1 { font-size: 24px; font-weight: 700; }
h2 { font-size: 16px; font-weight: 650; margin-bottom: 12px; }
a { color: var(--accent); text-decoration: none; }
code, .mono { font-family: var(--mono); font-size: .92em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
.ico { width: 20px; height: 20px; flex: none; }

/* ---- controls ---- */
input, select, textarea {
  font: inherit; color: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  min-height: var(--tap); padding: 10px 14px; width: 100%; outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 0; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); color: var(--muted); }
input[type=checkbox], input[type=radio] { width: 20px; height: 20px; min-height: 0; accent-color: var(--accent); margin: 0; }
label { display: grid; gap: 6px; font-size: 13px; font-weight: 550; color: var(--muted); }
label.check { display: flex; align-items: center; gap: 10px; color: var(--text); font-size: 15px; font-weight: 500; min-height: var(--tap); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--tap); padding: 0 18px;
  border-radius: 12px; border: 1px solid transparent; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap;
  background: var(--surface-2); color: var(--text); transition: transform .06s, background .15s, opacity .15s; text-decoration: none; user-select: none;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 22%, transparent); }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.ghost:hover:not(:disabled) { background: var(--surface-2); }
.btn.danger { background: var(--bad); color: #fff; }
.btn.ghost.danger, .btn.danger.ghost { background: transparent; color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 13px; }
.btn.block { width: 100%; }
.btn.big { min-height: 58px; font-size: 17px; }
.icon-btn { display: inline-grid; place-items: center; min-width: 40px; min-height: 40px; border-radius: 10px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 16px; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.cam { color: var(--accent); background: var(--accent-soft); min-width: var(--tap); min-height: var(--tap); }
.icon-btn.cam .ico { width: 24px; height: 24px; }
.input-with-btn { display: flex; gap: 8px; align-items: center; }
.file-btn { display: inline-flex; color: var(--text); font-size: 15px; }

/* ---- app shell: bottom tabs on phones, sidebar from 900px ---- */
.boot { display: grid; place-items: center; min-height: 100vh; }
.boot-mark, .auth-mark, .brand-mark { width: 44px; height: 44px; border-radius: 12px; background: url(/icon.svg) center / cover; }
.shell { min-height: 100vh; min-height: 100dvh; padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
.nav { position: fixed; z-index: 20; inset: auto 0 0 0; background: var(--nav); color: var(--nav-ink); border-top: 1px solid var(--nav-line); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); }
.nav .brand, .nav .nav-foot { display: none; }
.nav nav { display: flex; justify-content: space-around; }
.nav nav a { flex: 1; display: grid; justify-items: center; gap: 3px; padding: 8px 4px; border-radius: 12px; color: var(--nav-ink); font-size: 11px; font-weight: 600; }
.nav nav a.active { color: var(--nav-active-text); background: var(--nav-active); }
.nav nav a.active .ico { color: var(--nav-active-ink); }
main { min-width: 0; }

@media (min-width: 900px) {
  .shell { display: grid; grid-template-columns: 232px 1fr; padding-bottom: 0; }
  /* dvh = the height actually visible; plain vh on tablets includes the browser bars and pushes the bottom off-screen. */
  .nav { position: sticky; top: 0; inset: auto; height: 100vh; height: 100dvh; display: flex; flex-direction: column; padding: 20px 14px calc(16px + env(safe-area-inset-bottom)); overflow-y: auto; overscroll-behavior: contain; border-top: 0; border-right: 1px solid var(--nav-line); }
  .nav .brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 22px; color: var(--nav-strong); font-weight: 700; font-size: 16px; }
  .nav .brand img { max-width: 44px; max-height: 44px; border-radius: 10px; background: #fff; object-fit: contain; border: 1px solid var(--nav-line); }
  .nav nav { flex-direction: column; gap: 4px; }
  .nav nav a { display: flex; align-items: center; gap: 12px; padding: 11px 12px; font-size: 14.5px; }
  .nav nav a:hover { background: var(--nav-hover); color: var(--nav-strong); }
  .nav .nav-foot { display: grid; gap: 12px; margin-top: auto; }
  .nav .who { display: grid; font-size: 13px; padding: 0 8px; }
  .nav .who strong { color: var(--nav-strong); }
  .nav .nav-foot .btn { color: var(--nav-ink); border-color: var(--nav-line); }
}
.status { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; padding: 6px 10px; border-radius: 999px; background: var(--nav-hover); }
.status i { width: 8px; height: 8px; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 3px rgba(52, 211, 153, .2); }
.status.offline i { background: #fbbf24; box-shadow: 0 0 0 3px rgba(251, 191, 36, .2); }
.status.warn { color: #fbbf24; }

/* Phones also need to see whether they are offline: a slim bar above the tabs. */
@media (max-width: 899px) {
  .nav .nav-foot { display: block; position: absolute; bottom: 100%; left: 0; right: 0; pointer-events: none; }
  .nav .nav-foot > :not(.status) { display: none; }
  .nav .status { display: none; margin: 0 auto 8px; width: max-content; pointer-events: auto; background: var(--nav); color: var(--nav-ink); }
  .nav .status.offline, .nav .status.warn { display: flex; }
}

/* ---- pages ---- */
.page { padding: 18px 16px 28px; display: grid; gap: 16px; max-width: 1240px; margin: 0 auto; }
.page.narrow { max-width: 860px; }
@media (min-width: 900px) { .page { padding: 32px 36px; gap: 20px; } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.back { display: inline-block; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); min-width: 0; }
.sub-card { padding: 14px 0; }
.split { display: grid; gap: 16px; }
@media (min-width: 900px) { .split { grid-template-columns: 1fr 1fr; } }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar input[type=search] { flex: 1 1 260px; }
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.banner { padding: 14px 16px; border-radius: var(--radius-sm); background: var(--accent-soft); }
.banner.warn { background: var(--warn-soft); color: var(--warn); }
.banner .queued { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 8px; color: var(--text); }
.pill { font-size: 13px; padding: 6px 12px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-weight: 600; }
.tag { display: inline-block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.tag.void, .tag.sale { background: var(--bad-soft); color: var(--bad); }
.tag.receive { background: var(--good-soft); color: var(--good); }
.tag.count { background: var(--accent-soft); color: var(--accent); }
.low, .neg { color: var(--bad); font-weight: 650; }
.pos { color: var(--good); font-weight: 650; }
.error { color: var(--bad); min-height: 1.2em; margin: 0; }
.hint { color: var(--muted); font-size: 13px; text-align: center; margin: 0; }

/* ---- forms ---- */
.form { display: grid; gap: 14px; }
.form.grid { grid-template-columns: 1fr; }
@media (min-width: 640px) { .form.grid { grid-template-columns: repeat(2, 1fr); } .form.grid.compact { grid-template-columns: repeat(3, 1fr); } .form.grid .full { grid-column: 1 / -1; } }
.form.inline { display: flex; gap: 8px; }
.form .checks { display: flex; flex-wrap: wrap; gap: 4px 20px; align-items: center; }
.actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.actions.end { align-items: end; }
.segmented { display: flex; background: var(--surface-2); border-radius: 12px; padding: 4px; gap: 4px; }
.segmented label { flex: 1; display: block; color: var(--text); font-size: 14px; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span, .segmented.links a { display: grid; place-items: center; min-height: 40px; padding: 0 12px; border-radius: 9px; font-weight: 600; cursor: pointer; color: var(--muted); }
.segmented input:checked + span, .segmented.links a.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 4px rgba(15, 23, 42, .12); }
.segmented.links { flex: 0 1 auto; overflow-x: auto; }
.date-range { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.date-range input { width: auto; }
.copy-row { display: flex; gap: 8px; }
.logo-row { display: flex; gap: 18px; align-items: center; margin-top: 18px; flex-wrap: wrap; }
.logo-preview { width: 160px; height: 90px; border: 1px dashed var(--line); border-radius: var(--radius-sm); display: grid; place-items: center; background: #fff; }
.logo-preview img { max-width: 92%; max-height: 80px; }

/* ---- tables ---- */
.table-wrap { overflow-x: auto; padding: 0; }
.card.table-wrap { padding: 4px 0; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 10px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr[data-id] { cursor: pointer; }
.table tbody tr[data-id]:hover { background: var(--surface-2); }
.table .num { text-align: right; white-space: nowrap; }
.table tr.inactive { opacity: .55; }
.table .empty-row { text-align: center; color: var(--muted); padding: 28px; }
.count-input { width: 96px; min-height: 40px; text-align: right; padding: 6px 10px; }
@media (max-width: 640px) { .hide-sm { display: none; } .table th, .table td { padding: 10px 12px; } }

/* ---- stats and lists ---- */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: grid; gap: 4px; box-shadow: var(--shadow); }
.card .stat { box-shadow: none; background: var(--surface-2); border: 0; }
.stat span { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.stat strong { font-size: 22px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat small { color: var(--muted); }
.stat.accent { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.stat.accent span { color: inherit; opacity: .8; }
.pick-list { display: grid; gap: 6px; }
.pick { display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 12px 14px; min-height: 56px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; cursor: pointer; }
.pick:hover { border-color: var(--accent); }
.pick span { display: grid; min-width: 0; }
.pick small { color: var(--muted); }
.pick b { font-variant-numeric: tabular-nums; }
.bars { display: grid; gap: 12px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 1fr) 2fr auto; gap: 12px; align-items: center; font-size: 14px; }
.bar { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.picked-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 0; }
.picked-head > div:first-child { display: grid; }
.picked-head small { color: var(--muted); }
.big-num { font-size: 32px; font-weight: 750; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.big-num small { font-size: 14px; font-weight: 500; color: var(--muted); }

/* ---- checkout ---- */
.checkout { display: grid; gap: 14px; padding: 14px 12px; min-height: calc(100vh - 80px); align-content: start; }
@media (min-width: 900px) { .checkout { grid-template-columns: minmax(0, 1fr) 360px; padding: 24px; gap: 20px; min-height: 100vh; align-items: start; } }
.sale-pane { display: grid; gap: 12px; align-content: start; min-width: 0; }
.scanbar { position: relative; display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 6px 6px 16px; box-shadow: var(--shadow); }
.scanbar > .ico { color: var(--muted); }
.scanbar input { border: 0; box-shadow: none; padding: 10px 0; font-size: 17px; min-height: 52px; background: transparent; }
.scanbar input:focus { box-shadow: none; }
.scanbar:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.suggest { position: absolute; z-index: 15; top: calc(100% + 6px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; display: grid; gap: 2px; max-height: 60vh; overflow: auto; }
.suggest button { display: flex; justify-content: space-between; align-items: center; gap: 10px; text-align: left; padding: 10px 12px; min-height: 52px; border: 0; border-radius: 10px; background: transparent; color: var(--text); font: inherit; cursor: pointer; }
.suggest button span { display: grid; }
.suggest button small { color: var(--muted); }
.suggest button.on, .suggest button:hover { background: var(--accent-soft); }
.cart { display: grid; gap: 8px; }
.line { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 8px 12px 8px 4px; }
.line.flash { animation: flash .7s ease-out; }
@keyframes flash { from { background: var(--accent-soft); border-color: var(--accent); } }
tr.flash td { animation: flash .9s ease-out; }
.line-main { display: grid; text-align: left; border: 0; background: transparent; color: var(--text); font: inherit; padding: 8px; cursor: pointer; min-width: 0; border-radius: 10px; }
.line-main strong { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.3; }
.line-main small { color: var(--muted); font-size: 12.5px; }
.line .amount { font-variant-numeric: tabular-nums; font-size: 16px; min-width: 72px; text-align: right; }
.stepper { display: flex; align-items: center; background: var(--surface-2); border-radius: 12px; }
.stepper button { width: 40px; height: 40px; border: 0; background: transparent; color: var(--text); font-size: 20px; cursor: pointer; border-radius: 12px; }
.stepper button:active { background: var(--line); }
.stepper span { min-width: 30px; text-align: center; font-weight: 650; font-variant-numeric: tabular-nums; }
.empty-cart { text-align: center; padding: 48px 20px; color: var(--muted); border: 2px dashed var(--line); border-radius: var(--radius); }
.empty-cart h2 { color: var(--text); margin: 14px 0 4px; }
.scan-art { width: 64px; height: 64px; margin: 0 auto; border-radius: 18px; background: var(--accent-soft); position: relative; }
.scan-art::after { content: ""; position: absolute; inset: 18px 14px; background: repeating-linear-gradient(90deg, var(--accent) 0 3px, transparent 3px 6px, var(--accent) 6px 8px, transparent 8px 11px); }
.pay-pane { display: grid; gap: 12px; position: sticky; bottom: calc(72px + env(safe-area-inset-bottom)); }
@media (min-width: 900px) { .pay-pane { top: 24px; bottom: auto; } }
.totals { display: grid; gap: 8px; }
.totals .row { display: flex; justify-content: space-between; color: var(--muted); font-variant-numeric: tabular-nums; }
.totals .grand { color: var(--text); font-size: 26px; font-weight: 750; letter-spacing: -.02em; padding-top: 10px; border-top: 1px solid var(--line); margin-top: 4px; }
.pay-buttons { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.btn.pay { min-height: 64px; font-size: 16px; border-radius: 14px; color: #fff; }
.btn.pay.cash { background: var(--good); }
.btn.pay.card-btn { background: #494b51; }
.btn.pay.other { background: var(--steel); }
/* On phones the cart scrolls and the total + pay buttons stay docked above the tab bar. */
@media (max-width: 899px) {
  .pay-pane { background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); margin: 0 -12px; padding: 10px 12px; border-top: 1px solid var(--line); }
  .pay-pane .totals { padding: 12px 14px; gap: 2px; }
  .pay-pane .totals .row:not(.grand) { display: none; }
  .pay-pane .totals .grand { border: 0; padding: 0; margin: 0; font-size: 22px; }
  .pay-pane #clear, .pay-pane .hint { display: none; }
}

/* ---- dialogs ---- */
.modal-back { position: fixed; inset: 0; z-index: 50; background: rgba(8, 12, 24, .5); backdrop-filter: blur(3px); display: grid; align-items: end; justify-items: center; opacity: 0; transition: opacity .18s; }
.modal-back.show { opacity: 1; }
.modal { width: 100%; max-height: 92vh; overflow: auto; background: var(--surface); border-radius: 22px 22px 0 0; box-shadow: var(--shadow-lg); transform: translateY(20px); transition: transform .2s; padding-bottom: env(safe-area-inset-bottom); }
.modal-back.show .modal { transform: none; }
@media (min-width: 640px) { .modal-back { align-items: center; } .modal { width: min(460px, calc(100vw - 32px)); border-radius: 22px; } .modal.wide { width: min(720px, calc(100vw - 32px)); } }
.modal header { display: flex; justify-content: space-between; align-items: center; padding: 18px 18px 0 22px; }
.modal header h2 { margin: 0; font-size: 18px; }
.modal-body { padding: 16px 22px 22px; display: grid; gap: 14px; }
.modal-body p { margin: 0; }
.due { font-size: 15px; color: var(--muted); }
.due strong { display: block; font-size: 34px; color: var(--text); letter-spacing: -.03em; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font: inherit; font-weight: 650; cursor: pointer; }
.change { font-size: 18px; font-weight: 700; }
.change.ok { color: var(--good); }
.change.short { color: var(--bad); }
.change-due { text-align: center; padding: 18px; border-radius: var(--radius); background: var(--good-soft); color: var(--good); font-weight: 600; }
.change-due strong { display: block; font-size: 40px; letter-spacing: -.03em; }
.change-due.paid { background: var(--accent-soft); color: var(--accent); }
.receipt-actions { display: grid; grid-auto-flow: column; gap: 8px; }
.card-wait { display: grid; justify-items: center; gap: 14px; padding: 16px; text-align: center; }
.spinner { width: 44px; height: 44px; border-radius: 50%; border: 4px solid var(--accent-soft); border-top-color: var(--accent); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.camera-box { position: relative; border-radius: 16px; overflow: hidden; background: #000; aspect-ratio: 3 / 4; max-height: 62vh; }
@media (min-width: 640px) { .camera-box { aspect-ratio: 4 / 3; } }
.camera { width: 100%; height: 100%; object-fit: cover; display: block; }
.aim { position: absolute; inset: 32% 10%; border: 3px solid rgba(255, 255, 255, .9); border-radius: 14px; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .35); }
.aim::after { content: ""; position: absolute; left: 6%; right: 6%; top: 50%; height: 2px; background: #f43f5e; box-shadow: 0 0 12px #f43f5e; animation: sweep 1.6s ease-in-out infinite alternate; }
@keyframes sweep { from { transform: translateY(-28px); } to { transform: translateY(28px); } }
.camera-bar { display: flex; align-items: center; gap: 10px; }
.camera-status { flex: 1; font-weight: 600; color: var(--muted); overflow-wrap: anywhere; }
[data-torch].on { background: #fde68a; color: #111; border-color: #fde68a; }

/* ---- sign-in ---- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(180deg, #494b51 0 34%, var(--bg) 34%); }
.auth-card { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 24px; padding: 32px 28px; box-shadow: var(--shadow-lg); display: grid; gap: 16px; }
.auth-card h1 { margin-top: 4px; }
.auth-card p { margin: -8px 0 4px; }

/* ---- toasts ---- */
#toasts { position: fixed; z-index: 60; left: 50%; top: max(16px, env(safe-area-inset-top)); transform: translateX(-50%); display: grid; gap: 8px; width: min(440px, calc(100vw - 24px)); pointer-events: none; }
.toast { padding: 12px 16px; border-radius: 12px; background: #222222; color: #fff; box-shadow: var(--shadow-lg); font-weight: 550; opacity: 0; transform: translateY(-8px); transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: none; }
.toast.good { background: #047857; }
.toast.error { background: #b91c1c; }
.toast.warn { background: #b45309; }

/* ---- receipts (screen preview and 80mm print) ---- */
.receipt-card { display: grid; justify-items: center; background: var(--surface-2); }
.receipt { width: 72mm; max-width: 100%; background: #fff; color: #111; padding: 16px 14px; font-size: 13px; border-radius: 6px; box-shadow: 0 2px 10px rgba(0, 0, 0, .12); }
.receipt table { width: 100%; border-collapse: collapse; }
.receipt td { padding: 2px 0; vertical-align: top; }
.receipt td:last-child { text-align: right; white-space: nowrap; padding-left: 8px; }
.r-logo { display: block; max-width: 48mm; max-height: 22mm; margin: 0 auto 6px; }
.r-name { text-align: center; font-weight: 700; font-size: 16px; }
.r-center { text-align: center; color: #333; }
.r-meta { margin: 10px 0; color: #444; font-size: 12px; }
.r-sub { color: #555; font-size: 12px; }
.r-void { text-align: center; font-weight: 800; letter-spacing: .1em; margin-bottom: 6px; }
.r-totals { border-top: 1px dashed #999; margin-top: 6px; padding-top: 4px; }
.r-grand td { font-weight: 800; font-size: 15px; }
.r-foot { margin-top: 12px; }
#print-area { display: none; }
@media print {
  @page { size: letter; margin: 12mm; }
  @page receipt { size: 80mm auto; margin: 4mm; }
  #print-area .receipt { page: receipt; }
  body { background: #fff; }
  body > :not(#print-area) { display: none !important; }
  #print-area { display: block; }
  #print-area .receipt { box-shadow: none; width: 100%; padding: 0; }
}

/* ---- inventory count scan log ---- */
.scan-log { padding: 4px 0; }
.scan-entry { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.scan-entry:last-child { border-bottom: 0; }
.scan-entry.flash { animation: flash .8s ease-out; }
.scan-qty { min-width: 52px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-weight: 750; font-variant-numeric: tabular-nums; background: var(--good-soft); color: var(--good); }
.scan-qty.set { background: var(--accent-soft); color: var(--accent); }
.scan-info { display: grid; min-width: 0; }
.scan-info strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scan-info small { color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; }
.icon-btn.del { color: var(--bad); min-width: var(--tap); min-height: var(--tap); }
.icon-btn.del:hover { background: var(--bad-soft); }

/* ---- product photos ---- */
.thumb { width: 44px; height: 44px; border-radius: 10px; object-fit: contain; background: #fff; border: 1px solid var(--line); flex: none; display: block; }
.thumb.none { background: var(--surface-2) url(/icon.svg) center / 18px no-repeat; opacity: .5; }
.thumb.big { width: 132px; height: 132px; border-radius: 14px; object-fit: contain; }
.thumb-cell { width: 60px; padding-right: 0 !important; }
.gallery { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.gallery figure { margin: 0; display: grid; gap: 6px; justify-items: center; }
.gallery figcaption { display: flex; align-items: center; gap: 4px; }
.line { grid-template-columns: auto minmax(0, 1fr) auto auto; padding-left: 10px; }
.suggest button .grow, .pick .grow { flex: 1; }
.suggest button, .pick { justify-content: flex-start; }
.scan-entry { grid-template-columns: auto auto minmax(0, 1fr) auto; }
.scan-info strong { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.3; }
.scan-info .desc { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.segmented.links a { white-space: nowrap; }
@media (max-width: 640px) {
  .scan-entry { gap: 10px; padding: 12px 10px; }
  .scan-qty { min-width: 44px; }
  .page-head h1 { font-size: 22px; }
}
.segmented.links a { display: flex; align-items: center; justify-content: center; gap: 4px; }
.show-sm { display: none; }
@media (max-width: 640px) {
  .show-sm { display: block; color: var(--muted); font-weight: 500; }
}
/* Two-row cart lines on phones and tablets so long product names stay readable. */
@media (max-width: 1180px) {
  .line { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "img main main" "img step amt"; row-gap: 4px; padding: 10px 12px; }
  .line > .thumb { grid-area: img; align-self: start; }
  .line > .line-main { grid-area: main; padding: 2px 4px; }
  .line > .stepper { grid-area: step; justify-self: start; margin-left: 4px; }
  .line > .amount { grid-area: amt; }
}
@media (max-width: 640px) {
  .table th, .table td { padding: 10px 8px; }
  .thumb-cell { width: 48px; }
  .thumb-cell .thumb { width: 38px; height: 38px; }
}
/* Short screens (tablet in landscape): tighten the sidebar so everything fits without scrolling. */
@media (min-width: 900px) and (max-height: 760px) {
  .nav { padding-top: 14px; }
  .nav .brand { padding-bottom: 12px; }
  .nav nav a { padding: 8px 12px; }
  .nav .nav-foot { gap: 8px; }
}
.appearance { display: grid; gap: 6px; }
.appearance .label { font-size: 13px; font-weight: 550; color: var(--muted); }
.appearance .segmented { max-width: 360px; }
.camera-bar .icon-only { min-width: var(--tap); padding: 0; font-size: 20px; }

/* ---- camera scanner overlay (full screen) ----
   A column: hint, camera window (gets whatever height is left), optional list, buttons.
   The scan frame lives inside the camera window, so the list can never cover it. */
body.scanning { overflow: hidden; }
.scanner-screen { position: fixed; inset: 0; z-index: 55; background: #000; color: #fff; display: flex; flex-direction: column; height: 100dvh; overscroll-behavior: contain; touch-action: none; }
.scanner-screen video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scanner-hint { position: relative; z-index: 1; flex: 0 0 auto; margin: 0; padding: calc(10px + env(safe-area-inset-top)) 16px 8px; text-align: center; font-weight: 600; font-size: 15px; line-height: 1.3; background: linear-gradient(rgba(0, 0, 0, .7), rgba(0, 0, 0, 0)); }
.scanner-view { position: relative; z-index: 1; flex: 1 1 auto; min-height: 150px; display: flex; align-items: center; justify-content: center; padding: 6px 0 10px; overflow: hidden; }
.scanner-frame { flex: 0 0 auto; border: 3px solid #fff; border-radius: 14px; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .45); transition: border-color .15s, box-shadow .15s; pointer-events: none; max-height: calc(100% - 8px); }
.scanner-frame.wide { width: min(80vw, 460px); height: min(52vw, 300px); }
.scanner-frame.square { width: min(64vw, 320px); height: min(64vw, 320px); max-width: calc(100% - 32px); }
.scanner-frame.hit { border-color: #22c55e; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .45), 0 0 0 6px rgba(34, 197, 94, .45); }
.scanner-status { position: absolute; z-index: 2; left: 50%; bottom: 14px; transform: translateX(-50%); max-width: 88vw; padding: 8px 14px; border-radius: 999px; background: rgba(0, 0, 0, .75); font-size: 14px; text-align: center; }
.scanner-last { position: absolute; z-index: 2; left: 12px; right: 12px; bottom: 10px; padding: 10px 14px; border-radius: 14px; background: rgba(21, 128, 61, .94); display: grid; gap: 2px; box-shadow: 0 8px 24px rgba(0, 0, 0, .35); }
.scanner-last.bad { background: rgba(185, 28, 28, .94); }
.scanner-last small { font-size: 12px; opacity: .85; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.scanner-last span { font-size: 15px; font-weight: 700; overflow-wrap: anywhere; }
.scanner-buttons { position: relative; z-index: 1; flex: 0 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: rgba(0, 0, 0, .8); }
.scanner-buttons button { min-height: 50px; border: 1px solid rgba(255, 255, 255, .25); border-radius: 12px; background: rgba(255, 255, 255, .1); color: #fff; font: inherit; font-weight: 700; cursor: pointer; padding: 0 4px; }
.scanner-buttons button[hidden] { display: none; }
.scanner-buttons button.on { background: #fde047; color: #111; border-color: #fde047; }
.scanner-buttons .cancel { background: #fff; color: #111; border-color: #fff; }
.scanner-buttons:has(button[data-zoom][hidden]) { grid-template-columns: repeat(3, 1fr); }

/* Register tape / counted list under the camera: limited height, scrolls inside, folds away. */
.scanner-tape { position: relative; z-index: 1; flex: 0 1 auto; min-height: 0; margin: 0 10px 8px; background: #fff; color: #222; border-radius: 14px; overflow: hidden; box-shadow: 0 10px 30px rgba(0, 0, 0, .4); display: flex; flex-direction: column; }
.tape-lines { flex: 0 1 auto; min-height: 0; max-height: min(26dvh, 230px); overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; }
.scanner-tape.folded .tape-lines { display: none; }
.tape-line { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; align-items: center; padding: 7px 6px 7px 12px; border-bottom: 1px dashed #d4d4d8; cursor: pointer; }
.tape-line.new { animation: tapeNew 1s ease-out; }
@keyframes tapeNew { from { background: #dcfce7; } to { background: transparent; } }
.tape-name { display: grid; min-width: 0; }
.tape-name span { font-weight: 700; font-size: 13.5px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tape-name small { color: #6b6d72; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tape-line b { font-variant-numeric: tabular-nums; font-size: 14px; }
.tape-minus { width: 34px; height: 34px; border-radius: 10px; border: 1px solid #d4d4d8; background: #f4f4f5; color: #b91c1c; font-size: 20px; font-weight: 700; cursor: pointer; }
.tape-empty { padding: 14px; text-align: center; color: #6b6d72; font-size: 14px; }
.tape-total { flex: 0 0 auto; display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; padding: 9px 14px; background: #494b51; color: #fff; border: 0; font: inherit; cursor: pointer; text-align: left; }
.tape-total span { font-size: 13px; opacity: .85; flex: 1; }
.tape-total strong { font-size: 22px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.tape-total i { width: 0; height: 0; border-left: 6px solid transparent; border-right: 6px solid transparent; border-top: 7px solid #fff; opacity: .8; }
.scanner-tape.folded .tape-total i { border-top: 0; border-bottom: 7px solid #fff; }

/* "How many?" pad over the camera, and quantity prompts in the count */
.scanner-ask { position: absolute; inset: 0; z-index: 5; background: rgba(0, 0, 0, .55); display: grid; align-items: end; }
.ask-card { background: #fff; color: #222; border-radius: 20px 20px 0 0; padding: 20px 18px calc(18px + env(safe-area-inset-bottom)); display: grid; gap: 14px; }
.ask-card h3 { margin: 0; font-size: 18px; line-height: 1.3; }
.ask-card p { margin: -8px 0 0; color: #6b6d72; font-size: 13px; }
.ask-row { display: grid; grid-template-columns: 64px 1fr 64px; gap: 10px; }
.ask-row button { height: 64px; border-radius: 14px; border: 1px solid #d4d4d8; background: #f4f4f5; font-size: 28px; font-weight: 700; color: #222; cursor: pointer; }
.ask-row input { height: 64px; text-align: center; font-size: 32px; font-weight: 800; border: 2px solid #494b51; border-radius: 14px; color: #222; background: #fff; min-height: 0; }
.ask-chips { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.ask-chips button { min-width: 0; height: 44px; border-radius: 999px; border: 1px solid #d4d4d8; background: #fff; font-weight: 700; color: #222; cursor: pointer; }
.ask-actions { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; }
.ask-actions button { height: 56px; border-radius: 14px; border: 1px solid #d4d4d8; background: #fff; font-size: 16px; font-weight: 700; color: #222; cursor: pointer; }
.ask-actions .ok { background: #494b51; border-color: #494b51; color: #fff; }
@media (min-width: 640px) { .scanner-ask { align-items: center; justify-items: center; } .ask-card { width: min(420px, 92vw); border-radius: 20px; } }
.tape-line { cursor: pointer; }
.ask-toggle { min-height: 40px; }
button.scan-qty { border: 0; font: inherit; font-weight: 750; cursor: pointer; }
.qty-big { font-size: 28px; font-weight: 800; text-align: center; height: 60px; }
.ask-actions .ok.danger { background: #b91c1c; border-color: #b91c1c; color: #fff; }
.ask-card[role="alertdialog"] p { margin: -6px 0 4px; font-size: 15px; color: #444; }

/* ---- reports ---- */
.group-title { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 6px 0 10px; }
.report-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.report-card { display: grid; gap: 4px; padding: 14px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); color: var(--text); box-shadow: var(--shadow); text-decoration: none; }
.report-card:hover { border-color: var(--accent); }
.report-card strong { font-size: 15px; }
.report-card span { font-size: 13px; color: var(--muted); line-height: 1.4; }
.report-card.saved { grid-template-columns: 1fr auto; align-items: start; border-left: 4px solid var(--accent); }
.report-card.saved a { display: grid; gap: 4px; color: inherit; text-decoration: none; }
.report-page .page-head p { margin: 4px 0 0; max-width: 640px; }
.filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px 12px; align-items: end; }
.filters label { font-size: 12px; }
.filters label.wide { grid-column: span 2; }
@media (max-width: 640px) { .filters { grid-template-columns: 1fr 1fr; } .filters label.wide { grid-column: 1 / -1; } }
.filters select, .filters input { min-height: 42px; padding: 8px 10px; }
.filters label.check { font-size: 14px; min-height: 42px; }
.filter-actions { display: flex; justify-content: flex-end; }
.report-note { margin: -4px 0 0; }
.report-table th button { all: unset; cursor: pointer; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; }
.report-table th button:hover { color: var(--text); }
.report-table tfoot td { font-weight: 700; border-top: 2px solid var(--line); background: var(--surface-2); }
.report-table td a { font-weight: 600; }
.chart { padding: 14px 16px; }
.chart-head, .chart-axis { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.vbars { display: flex; align-items: flex-end; gap: 3px; height: 160px; margin: 8px 0 6px; border-bottom: 1px solid var(--line); }
.vbars.dense { gap: 1px; }
.vbar { flex: 1; height: 100%; display: flex; align-items: flex-end; }
.vbar i { display: block; width: 100%; min-height: 1px; background: var(--accent); border-radius: 3px 3px 0 0; opacity: .85; }
.vbar:hover i { opacity: 1; }
.hbars { display: grid; gap: 8px; }
.hbar { display: grid; grid-template-columns: minmax(80px, 30%) 1fr auto; gap: 10px; align-items: center; font-size: 13px; }
.hbar span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .track { height: 12px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.hbar i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.hbar b { font-variant-numeric: tabular-nums; }
.col-list { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 12px; }
@media print {
  #print-area .report-print { font-family: Arial, sans-serif; color: #111; }
  #print-area .report-print h1 { font-size: 18px; margin: 0 0 4px; }
  #print-area .report-print p { font-size: 11px; color: #444; margin: 0 0 10px; }
  #print-area .report-print .stat-row { display: flex; gap: 10px; margin-bottom: 10px; }
  #print-area .report-print .stat { border: 1px solid #ccc; padding: 6px 10px; border-radius: 6px; box-shadow: none; }
  #print-area .report-print .stat span { font-size: 10px; display: block; color: #555; }
  #print-area .report-print .stat strong { font-size: 14px; }
  #print-area .report-print table { width: 100%; border-collapse: collapse; font-size: 10.5px; }
  #print-area .report-print th, #print-area .report-print td { border-bottom: 1px solid #ddd; padding: 4px 6px; text-align: left; }
  #print-area .report-print .num { text-align: right; }
  #print-area .report-print th button { all: unset; font-weight: 700; }
  #print-area .report-print tfoot td { font-weight: 700; border-top: 2px solid #999; }
  #print-area .report-print .chart, #print-area .report-print .card { border: 0; box-shadow: none; padding: 0; }
  #print-area .report-print .vbar i, #print-area .report-print .hbar i { background: #494b51; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}
.page { grid-template-columns: minmax(0, 1fr); }

/* Panels over the camera (unknown barcode, link, new product) */
.panel-card { max-height: 88dvh; overflow-y: auto; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.panel-x { width: 40px; height: 40px; border: 0; border-radius: 10px; background: #f4f4f5; font-size: 16px; cursor: pointer; color: #222; }
.panel-body { display: grid; gap: 12px; }
.panel-body .btn { color: #222; }
.panel-body .btn.primary { background: #494b51; color: #fff; }
.panel-body .btn.ghost { border-color: #d4d4d8; background: #fff; }
.panel-body input, .panel-body select { background: #fff; color: #222; border-color: #d4d4d8; }
.panel-body label { color: #6b6d72; }
.panel-body .pick { background: #fff; color: #222; border-color: #e2e2e5; }
.panel-body .pick small, .panel-body .muted { color: #6b6d72; }
.unknown-code { margin: 0; font-size: 15px; }
.choice-list { display: grid; gap: 8px; }
.picker-results { max-height: 46dvh; overflow-y: auto; }
.form-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ---- customers ---- */
.customer-search { display: flex; gap: 8px; align-items: center; padding: 8px 8px 8px 12px; }
.customer-search input { border: 0; box-shadow: none; font-size: 20px; font-weight: 600; min-height: 56px; background: transparent; }
.customer-search input:focus { box-shadow: none; }
.customer-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.customer-row { justify-content: flex-start; }
.avatar { width: 40px; height: 40px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 800; font-size: 14px; }
.cust-stat { display: grid; justify-items: end; }
.cust-stat small { color: var(--muted); }
.small-stat { font-size: 18px !important; }
.note-banner { display: grid; gap: 4px; background: var(--warn-soft); color: var(--text); }
.pick.voided { opacity: .55; }
.cust-chip { display: flex; align-items: center; gap: 6px; }
.cust-chip .btn { min-height: 46px; border-style: dashed; }
.cust-on { flex: 1; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); color: var(--text); text-decoration: none; min-width: 0; }
.cust-on .grow { display: grid; min-width: 0; }
.cust-on strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cust-on small { color: var(--muted); }
@media (max-width: 899px) { .pay-pane .cust-chip .btn { min-height: 40px; } }

/* ---- charge accounts ---- */
.owes { color: var(--bad); }
.account-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.account-head h2 { margin-bottom: 4px; }
.account-balance { font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.account-balance.owes { color: var(--bad); }
.account-balance.credit { color: var(--good); }
.account-card .stat-row { margin-bottom: 12px; }
.account-card .stat small { line-height: 1.5; }
.account-settings { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px 14px; display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px 14px; align-items: end; }
.account-settings legend { padding: 0 6px; font-weight: 700; color: var(--text); font-size: 14px; }
.account-settings label.check { grid-column: 1 / -1; }
.ledger td { vertical-align: top; }
.btn.pay.account { background: #7c5e10; }
.pay-buttons.four { grid-template-columns: 1fr 1fr; }
@media (min-width: 900px) { .pay-buttons.four { grid-template-columns: repeat(4, 1fr); } }

/* ---- invoices ---- */
.inv-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 6px 0 8px; }
.inv-head h3, .ledger-title { margin: 0; font-size: 15px; }
.ledger-title { margin: 16px 0 8px; }
.small-seg a { min-height: 32px; font-size: 13px; }
.inv { font-size: 12px; color: var(--muted); }
.tag.inv-paid { background: var(--good-soft); color: var(--good); }
.tag.inv-open { background: var(--bad-soft); color: var(--bad); }
.tag.inv-partly-paid { background: var(--warn-soft); color: var(--warn); }
.tag.inv-voided { background: var(--surface-2); color: var(--muted); text-decoration: line-through; }

/* Receipt lines: Qty | Item | Each | Amount */
.receipt .r-lines th { font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; color: #555; border-bottom: 1px solid #999; padding: 2px 0; text-align: left; }
.receipt .r-lines th:nth-child(3), .receipt .r-lines th:nth-child(4) { text-align: right; }
.receipt .r-lines td { padding: 3px 0; vertical-align: top; }
.receipt .r-lines td:nth-child(3) { text-align: right; white-space: nowrap; padding-left: 6px; color: #444; }
.receipt .r-lines td:nth-child(4) { text-align: right; white-space: nowrap; padding-left: 6px; font-weight: 600; }
.receipt .r-lines .r-qty { width: 2.2em; font-weight: 600; }

/* Official receipt: bordered document with sections */
.receipt.official { border: 2px solid #222; border-radius: 4px; padding: 0; overflow: hidden; font-size: 12.5px; }
.receipt.official .r-head { padding: 12px 12px 10px; text-align: center; border-bottom: 1px solid #222; }
.receipt.official .r-logo { margin-bottom: 4px; }
.receipt.official .r-name { font-size: 16px; font-weight: 800; letter-spacing: .02em; text-transform: uppercase; }
.receipt.official .r-addr { font-size: 11.5px; line-height: 1.45; margin-top: 2px; }
.receipt.official .r-title { background: #222; color: #fff; text-align: center; font-weight: 800; letter-spacing: .25em; padding: 6px 0; font-size: 13px; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
.receipt.official.is-void .r-title { background: #b91c1c; }
.receipt.official .r-info { margin: 0; padding: 8px 12px; display: grid; gap: 3px; border-bottom: 1px solid #222; }
.receipt.official .r-info div { display: grid; grid-template-columns: 74px 1fr; gap: 6px; }
.receipt.official .r-info dt { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: #555; font-weight: 700; }
.receipt.official .r-info dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.receipt.official .r-lines { width: 100%; border-collapse: collapse; }
.receipt.official .r-lines th { background: #efefef; border-bottom: 1px solid #222; padding: 5px 4px; font-size: 10px; color: #222; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
.receipt.official .r-lines th:first-child, .receipt.official .r-lines td:first-child { padding-left: 12px; }
.receipt.official .r-lines th:last-child, .receipt.official .r-lines td:last-child { padding-right: 12px; }
.receipt.official .r-lines td { border-bottom: 1px solid #d4d4d4; padding: 6px 4px; }
.receipt.official .r-lines tbody tr:last-child td { border-bottom: 1px solid #222; }
.receipt.official .r-box { padding: 8px 12px; border-bottom: 1px solid #222; }
.receipt.official .r-row { display: flex; justify-content: space-between; gap: 10px; padding: 2px 0; font-variant-numeric: tabular-nums; }
.receipt.official .r-grand { margin-top: 4px; padding-top: 6px; border-top: 2px solid #222; font-size: 16px; font-weight: 800; }
.receipt.official .r-strong { font-weight: 800; border-top: 1px dashed #999; margin-top: 4px; padding-top: 4px; }
.receipt.official .r-section-title { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; font-weight: 800; color: #555; margin-bottom: 2px; }
.receipt.official .r-foot { padding: 10px 12px 12px; text-align: center; font-size: 11.5px; line-height: 1.5; color: #333; }
@media print { #print-area .receipt.official { border: 2px solid #000; width: 100%; } }

/* Compact checkout footer on phones: slim customer strip, thin total bar, one row of payment buttons. */
@media (max-width: 899px) {
  .pay-pane { gap: 6px; padding: 8px 10px; }
  .pay-pane .cust-chip .btn { min-height: 36px; font-size: 13.5px; }
  .pay-pane .cust-on { padding: 4px 8px; gap: 8px; border-radius: 10px; }
  .pay-pane .cust-on .avatar { width: 28px; height: 28px; font-size: 11px; }
  .pay-pane .cust-on strong { font-size: 14px; line-height: 1.2; }
  .pay-pane .cust-on small { font-size: 12px; line-height: 1.2; }
  .pay-pane .cust-chip .icon-btn { min-width: 34px; min-height: 34px; }
  .pay-pane .totals { padding: 6px 12px; border-radius: 10px; }
  .pay-pane .totals .grand { font-size: 18px; }
  .pay-buttons, .pay-buttons.four { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .pay-buttons.four { grid-template-columns: repeat(4, 1fr); }
  .btn.pay { min-height: 46px; font-size: 14px; border-radius: 10px; padding: 0 4px; }
}

/* In-app photo camera */
.photo-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.photo-screen .photo-preview { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.photo-screen video[hidden], .photo-screen .photo-preview[hidden] { display: none; }
.photo-buttons { align-items: center; }
.photo-buttons[hidden] { display: none; }
.photo-buttons[data-review] { grid-template-columns: 1fr 1fr; }
.photo-buttons .shutter { justify-self: center; width: 66px; height: 66px; min-height: 0; border-radius: 50%; border: 4px solid #fff; background: transparent; padding: 0; display: grid; place-items: center; }
.photo-buttons .shutter i { width: 50px; height: 50px; border-radius: 50%; background: #fff; display: block; }
.photo-buttons .shutter:active i { transform: scale(.9); }
.new-photos { display: grid; gap: 8px; } .new-photos .label { font-size: 13px; font-weight: 550; color: var(--muted); } .new-photos .gallery:empty { display: none; }

.cat-row { align-items: center; gap: 8px; }
.cat-row .grow { display: grid; }

.auth-logo { display: block; max-width: 100%; max-height: 96px; width: auto; margin: 0 auto 4px; padding: 10px 14px; background: #fff; border-radius: 14px; object-fit: contain; box-sizing: border-box; }

.auth-video { position: fixed; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0; opacity: 0; transition: opacity .8s; pointer-events: none; }
.auth-video.on { opacity: 1; }
body:has(.auth-video.on) .auth { background: rgba(20, 21, 24, .55); }
.auth { position: relative; z-index: 1; }
.logo-preview video { width: 100%; height: 100%; object-fit: cover; border-radius: var(--radius-sm); }

/* ---- purchasing ---- */
.tag.po-draft { background: var(--surface-2); color: var(--muted); }
.tag.po-ordered { background: var(--accent-soft); color: var(--accent); }
.tag.po-partial { background: var(--warn-soft); color: var(--warn); }
.tag.po-received { background: var(--good-soft); color: var(--good); }
.tag.po-closed, .tag.po-cancelled { background: var(--surface-2); color: var(--muted); text-decoration: line-through; }
.tag.po-late { background: var(--bad-soft); color: var(--bad); }
.po-status { vertical-align: middle; font-size: 14px; }
.po-grid { display: grid; grid-template-columns: minmax(240px, 1fr) 2fr; gap: 16px; }
@media (max-width: 860px) { .po-grid { grid-template-columns: 1fr; } }
.po-supplier select { width: 100%; margin-bottom: 8px; }
.po-contact { line-height: 1.6; margin-top: 6px; }
.po-add { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.po-add .input-with-btn { flex: 1 1 280px; }
.cell-input { width: 100%; min-width: 0; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; font-size: 14px; }
.cell-input.num { width: 90px; text-align: right; }
.cell-input.wide { min-width: 180px; }
.cell-input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.po-lines td { vertical-align: middle; }
.po-foot { display: grid; grid-template-columns: 1fr 300px; gap: 20px; margin-top: 14px; }
@media (max-width: 760px) { .po-foot { grid-template-columns: 1fr; } }
.po-totals { display: grid; gap: 8px; align-content: start; }
.po-totals > div, .po-totals > label { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 14px; }
.po-totals .grand { border-top: 2px solid var(--text); padding-top: 8px; font-size: 18px; }
.on-order { color: var(--good); font-weight: 600; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.card-head h2 { margin: 0; }
h3.sub { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 18px 0 6px; }

/* ---- profile ---- */
.nav a.who { text-decoration: none; color: inherit; border-radius: 10px; padding: 6px 8px; margin: 0 0 2px; }
.nav a.who:hover, .nav a.who.active { background: var(--nav-hover, rgba(255,255,255,.06)); }
.nav a.who strong::after { content: ' ›'; opacity: .55; }
.profile-head { display: flex; align-items: center; gap: 14px; }
.profile-head .avatar { width: 56px; height: 56px; font-size: 20px; }

.tag.po-backorder { background: var(--warn-soft); color: var(--warn); margin-left: 4px; }
.cell-input.date { width: 150px; }
.due-cell { white-space: nowrap; }
.banner.warn-banner { background: var(--warn-soft); color: var(--text); border: 1px solid var(--warn); border-radius: var(--radius-sm, 10px); padding: 10px 14px; }

.auth-link { justify-self: center; font-size: 14px; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.auth-link:hover { color: var(--text); }
.attach-chip { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border: 1px dashed var(--line); border-radius: 10px; background: var(--surface-2); }
.attach-chip a { font-weight: 700; }

/* ---- phone bottom bar: four tabs and More ---- */
.nav-more { display: none; }
@media (max-width: 899px) {
  .nav nav a.overflow { display: none; }
  .nav { display: flex; }
  .nav nav { flex: 4; }
  .nav-more { flex: 1; display: grid; justify-items: center; gap: 3px; padding: 8px 4px; border-radius: 12px; border: 0; background: transparent; color: var(--nav-ink); font: inherit; font-size: 11px; font-weight: 600; cursor: pointer; }
  .nav-more.active { color: var(--nav-active-text); background: var(--nav-active); }
}
.more-back { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, .45); display: flex; align-items: flex-end; opacity: 0; transition: opacity .18s; }
.more-back.show { opacity: 1; }
.more-sheet { width: 100%; background: var(--nav); color: var(--nav-ink); border-radius: 18px 18px 0 0; padding: 14px 12px calc(16px + env(safe-area-inset-bottom)); display: grid; gap: 10px; transform: translateY(24px); transition: transform .18s; }
.more-back.show .more-sheet { transform: none; }
.more-who { display: grid; padding: 4px 10px 8px; font-size: 13px; border-bottom: 1px solid var(--nav-line); }
.more-who strong { color: var(--nav-strong); font-size: 15px; }
.more-sheet nav { display: grid; gap: 2px; }
.more-sheet nav a { display: flex; align-items: center; gap: 14px; padding: 13px 12px; border-radius: 12px; color: var(--nav-ink); font-weight: 600; font-size: 15.5px; }
.more-sheet nav a.active { background: var(--nav-active); color: var(--nav-active-text); }
.more-sheet .btn { color: var(--nav-ink); border-color: var(--nav-line); }
.product-tabs { align-self: flex-start; }
#addcat { margin-bottom: 12px; }

.delivery { border: 1px solid var(--line); border-radius: 12px; margin-top: 10px; overflow: hidden; }
.delivery-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 14px; background: var(--surface-2); }
.delivery-head > div { display: grid; }
.delivery .table td { padding: 9px 14px; }
