/* Nimbus POS design system — single small stylesheet, no framework. */
:root {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-2: #64748b;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #dbeafe;
  --success: #16a34a;
  --success-soft: #dcfce7;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --warn: #d97706;
  --warn-soft: #fef3c7;
  --radius: 10px;
  --shadow: 0 1px 3px rgb(15 23 42 / 0.08), 0 1px 2px rgb(15 23 42 / 0.04);
  --sidebar-w: 232px;
}
/* Theme: data-theme=light|dark forces; no attribute (auto) follows the OS.
   Set early by the inline head script in base.html from localStorage 'nimbus-theme'. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f172a;
    --surface: #1e293b;
    --surface-2: #26334a;
    --border: #334155;
    --text: #f1f5f9;
    --text-2: #94a3b8;
    --primary-soft: #1e3a5f;
    --success-soft: #14532d;
    --danger-soft: #7f1d1d;
    --warn-soft: #78350f;
    --shadow: 0 1px 3px rgb(0 0 0 / 0.4);
  
  }
}
:root[data-theme="dark"] {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-2: #26334a;
  --border: #334155;
  --text: #f1f5f9;
  --text-2: #94a3b8;
  --primary-soft: #1e3a5f;
  --success-soft: #14532d;
  --danger-soft: #7f1d1d;
  --warn-soft: #78350f;
  --shadow: 0 1px 3px rgb(0 0 0 / 0.4);
  
}
* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
}
h1 { font-size: 1.4rem; margin: 0 0 1rem; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
a { color: var(--primary); text-decoration: none; }

/* ---- Icons (inline SVG sprite in shell.html) ---- */
.ic {
  width: 1.25em; height: 1.25em; flex-shrink: 0; vertical-align: -.22em;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.btn .ic { width: 1.15em; height: 1.15em; }

/* ---- App shell ---- */
.shell { display: flex; min-height: 100vh; min-height: 100svh; }
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: .9rem .65rem .6rem;
  display: flex;
  flex-direction: column;
  gap: 0;
  position: sticky; top: 0; height: 100vh; height: 100dvh;
  flex-shrink: 0;
}
.sidebar .brand {
  font-weight: 800; font-size: 1.12rem; letter-spacing: -.01em; padding: .2rem .5rem .8rem;
  display: flex; align-items: center; gap: .5rem;
}
.sidebar .brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.nav-scroll { overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; min-height: 0; display: flex; flex-direction: column; gap: .1rem; margin: 0 -.15rem; padding: 0 .15rem; }
.nav-scroll > * { flex-shrink: 0; }
.sidebar a.nav-item {
  display: flex; align-items: center; gap: .6rem;
  padding: .38rem .65rem; border-radius: 8px; min-height: 37px;
  color: var(--text-2); font-weight: 500; font-size: .92rem;
  white-space: nowrap; overflow: hidden;
}
.sidebar a.nav-item .ic { width: 20px; height: 20px; opacity: .85; }
@media (hover: hover) {
  .sidebar a.nav-item:hover { background: var(--surface-2); color: var(--text); }
}
.sidebar a.nav-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.sidebar a.nav-item.active .ic { opacity: 1; }
.nav-group {
  font-size: .66rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-2); opacity: .8; padding: .7rem .65rem .2rem; white-space: nowrap; overflow: hidden; line-height: 1.2;
}
@media (max-height: 900px) {
  .sidebar a.nav-item { min-height: 34px; padding: .28rem .65rem; font-size: .88rem; }
  .sidebar a.nav-item .ic { width: 18px; height: 18px; }
  .nav-group { padding: .5rem .65rem .12rem; font-size: .62rem; }
  .ctx-btn { min-height: 40px; padding: .35rem .5rem; }
  .ctx-logout .ctx-btn { min-height: 34px; }
  .sidebar .brand { padding-bottom: .5rem; }
}
.sidebar .spacer { flex: 1; }
.sidebar .context { font-size: .8rem; color: var(--text-2); padding: .5rem .1rem 0; border-top: 1px solid var(--border); margin-top: .5rem; }
.ctx-btn {
  display: flex; align-items: center; gap: .45rem; width: 100%;
  background: none; border: 0; border-radius: 8px; padding: .45rem .5rem;
  font: inherit; font-size: .85rem; color: var(--text); cursor: pointer; text-align: left;
  min-height: 44px; touch-action: manipulation;
}
@media (hover: hover) { .ctx-btn:hover { background: var(--surface-2); } }
.ctx-btn .ctx-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.ctx-btn .ctx-chev { color: var(--text-2); width: 16px; height: 16px; }
.ctx-btn > .ic:first-child { width: 20px; height: 20px; color: var(--text-2); }
.ctx-static { padding: .45rem .5rem; font-size: .85rem; color: var(--text); font-weight: 600; }
.ctx-meta { padding: .15rem .5rem .3rem; font-size: .72rem; }
.ctx-logout { margin: 0; }
.ctx-logout .ctx-btn { color: var(--text-2); font-weight: 500; min-height: 40px; }
.ctx-logout .ctx-btn .ctx-label { font-weight: 500; }
main.content { flex: 1; padding: 1.25rem 1.5rem 2rem; max-width: 1320px; min-width: 0; }

/* Collapsible sidebar (icons only): more grid room on tablets. The state
   class lives on <html> (hx-boost only swaps <body>) and is restored from
   localStorage by the inline head script — which also collapses by default
   on tablet widths (769–1100 px). */
.nav-toggle {
  margin-left: auto; width: 32px; height: 32px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: none; border: 1px solid var(--border); border-radius: 8px;
  color: var(--text-2); cursor: pointer; font: inherit; font-size: 1rem;
  touch-action: manipulation;
}
@media (hover: hover) { .nav-toggle:hover { background: var(--surface-2); color: var(--text); } }
.nav-toggle::before { content: '«'; }
@media (min-width: 769px) {
  html.nav-collapsed .nav-toggle::before { content: '»'; }
  html.nav-collapsed .sidebar { width: 68px; padding: .9rem .5rem .6rem; }
  html.nav-collapsed .sidebar .nav-label,
  html.nav-collapsed .sidebar .brand-name,
  html.nav-collapsed .sidebar .brand .dot,
  html.nav-collapsed .sidebar .ctx-label,
  html.nav-collapsed .sidebar .ctx-chev,
  html.nav-collapsed .sidebar .ctx-meta { display: none; }
  html.nav-collapsed .nav-group { height: 1px; padding: 0; margin: .5rem .4rem; background: var(--border); font-size: 0; }
  html.nav-collapsed .sidebar .brand { padding: .2rem 0 .8rem; justify-content: center; }
  html.nav-collapsed .nav-toggle { margin-left: 0; }
  html.nav-collapsed .sidebar a.nav-item { justify-content: center; padding: .5rem 0; }
  html.nav-collapsed .sidebar a.nav-item .ic { width: 22px; height: 22px; }
  html.nav-collapsed .sidebar .context { padding: .5rem 0 0; }
  html.nav-collapsed .ctx-btn { justify-content: center; padding: .5rem 0; }
  html.nav-collapsed .ctx-static { text-align: center; padding: .5rem 0; }
  html.nav-collapsed main.content { padding-left: 1.25rem; }
}

/* Phone tab bar + "Više" sheet (the sidebar is hidden below 769 px). */
.tabbar { display: none; }
.more-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .45rem; }
.more-grid .nav-group { grid-column: 1 / -1; padding: .5rem .2rem .1rem; }
.more-grid .nav-group:first-child { padding-top: 0; }
.more-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .35rem;
  min-height: 74px; padding: .55rem .3rem; border-radius: 12px;
  background: var(--surface-2); color: var(--text); font-size: .78rem; font-weight: 600; text-align: center;
  touch-action: manipulation; line-height: 1.15;
}
.more-item .ic { width: 24px; height: 24px; color: var(--text-2); }
.more-item.active { background: var(--primary-soft); color: var(--primary); }
.more-item.active .ic { color: var(--primary); }
.more-item:active { background: var(--primary-soft); }
@media (max-width: 768px) {
  .shell { flex-direction: column; }
  .sidebar { display: none; }
  .tabbar {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; height: 60px;
    background: var(--surface); border-top: 1px solid var(--border);
    /* Constant padding on purpose — never env(safe-area-inset-bottom) here (ux-playbook rule 9). */
    padding: 0 .2rem;
  }
  .tabbar .tab {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .15rem;
    color: var(--text-2); font: inherit; font-size: .64rem; font-weight: 600; letter-spacing: .01em;
    background: none; border: 0; padding: .35rem 0; min-width: 0; touch-action: manipulation; position: relative;
    -webkit-tap-highlight-color: transparent;
  }
  .tabbar .tab .ic { width: 24px; height: 24px; }
  .tabbar .tab span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tabbar .tab.active { color: var(--primary); }
  .tabbar .tab.active::before { content: ''; position: absolute; top: 0; left: 22%; right: 22%; height: 3px; border-radius: 0 0 3px 3px; background: var(--primary); }
  .tabbar .tab:active { color: var(--primary); }
  main.content { padding: .9rem .75rem 5.5rem; }
}

/* ---- Components ---- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1rem 1.25rem; margin-bottom: 1rem;
}
.grid { display: grid; gap: 1rem; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }

.stat { padding: .9rem 1.1rem; }
.stat .label { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); }
.stat .value { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .sub { font-size: .8rem; color: var(--text-2); }

table.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.data th {
  text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-2); padding: .5rem .6rem; border-bottom: 2px solid var(--border);
}
table.data td { padding: .55rem .6rem; border-bottom: 1px solid var(--border); }
@media (hover: hover) {
  table.data tr:hover td { background: var(--surface-2); }
}
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data td.num { white-space: nowrap; }
.table-wrap { overflow-x: auto; scrollbar-gutter: stable; }

/* Touch-first buttons: ≥48px primary, ≥44px small (fingers, not cursors). */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 48px; padding: .55rem 1.05rem; border-radius: 10px; border: 1px solid transparent;
  font-size: .95rem; font-weight: 600; cursor: pointer;
  background: var(--primary); color: #fff;
  transition: background .12s;
  touch-action: manipulation;
}
@media (hover: hover) {
  .btn:hover { background: var(--primary-hover); }
  .btn.secondary:hover { background: var(--surface-2); }
}
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn.danger { background: var(--danger); }
.btn.success { background: var(--success); }
.btn.sm { min-height: 44px; padding: .4rem .75rem; font-size: .85rem; }
.btn.lg { min-height: 58px; padding: .85rem 1.4rem; font-size: 1.1rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

label.field { display: block; margin-bottom: .8rem; font-size: .85rem; font-weight: 500; }
label.field span { display: block; margin-bottom: .3rem; color: var(--text-2); }
/* 16px inputs: anything smaller makes iPad Safari zoom the page on focus. */
input, select, textarea {
  width: 100%; min-height: 44px; padding: .55rem .7rem; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text); font: inherit; font-size: 1rem;
}
input[type="checkbox"], input[type="radio"] {
  min-height: 0; width: 1.35rem; height: 1.35rem; accent-color: var(--primary);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: var(--primary); }
.form-row { display: flex; gap: .75rem; flex-wrap: wrap; }
.form-row > * { flex: 1; min-width: 140px; }

dialog {
  border: 1px solid var(--border); border-radius: 12px; padding: 1.2rem 1.4rem;
  background: var(--surface); color: var(--text); width: min(440px, calc(100vw - 2rem));
}
dialog::backdrop { background: rgb(0 0 0 / .45); }

.badge {
  display: inline-block; padding: .15rem .55rem; border-radius: 999px;
  font-size: .74rem; font-weight: 600;
}
.badge { background: var(--surface-2); color: var(--text-2); }
.badge.ok { background: var(--success-soft); color: var(--success); }
.badge.err { background: var(--danger-soft); color: var(--danger); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.info { background: var(--primary-soft); color: var(--primary); }

.alert { display: flex; gap: .55rem; align-items: flex-start; padding: .7rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-size: .9rem; }
.alert .ic { width: 20px; height: 20px; flex-shrink: 0; margin-top: .1rem; }
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.alert.info { background: var(--primary-soft); color: var(--primary); }
.alert.err { background: var(--danger-soft); color: var(--danger); }
.alert.ok { background: var(--success-soft); color: var(--success); }

/* ---- Printer page: the settings form reveals only what the chosen mode
   needs (address field, IP vs MAC caption, per-mode hint) — CSS :has(), no JS. */
.printer-form .addr, .printer-form .lbl-mac, .printer-form .help { display: none; }
.printer-form:has(select[name="printer_mode"] option[value="network"]:checked) .addr,
.printer-form:has(select[name="printer_mode"] option[value="epos"]:checked) .addr,
.printer-form:has(select[name="printer_mode"] option[value="cloudprnt"]:checked) .addr { display: block; }
.printer-form:has(select[name="printer_mode"] option[value="cloudprnt"]:checked) .lbl-ip { display: none; }
.printer-form:has(select[name="printer_mode"] option[value="cloudprnt"]:checked) .lbl-mac { display: block; }
.printer-form:has(select[name="printer_mode"] option[value="browser"]:checked) .help-browser,
.printer-form:has(select[name="printer_mode"] option[value="network"]:checked) .help-network,
.printer-form:has(select[name="printer_mode"] option[value="webusb"]:checked) .help-webusb,
.printer-form:has(select[name="printer_mode"] option[value="rawbt"]:checked) .help-rawbt,
.printer-form:has(select[name="printer_mode"] option[value="epos"]:checked) .help-epos,
.printer-form:has(select[name="printer_mode"] option[value="cloudprnt"]:checked) .help-cloudprnt { display: block; }
.printer-form .checks { display: flex; gap: 1.2rem; flex-wrap: wrap; margin: .2rem 0 .9rem; }
.printer-form .checks label { display: flex; gap: .45rem; align-items: center; font-size: .9rem; }
.printer-form .checks input { width: auto; }
table.kv { font-size: .9rem; border-collapse: collapse; }
table.kv th { text-align: left; font-weight: 500; color: var(--text-2); padding: .3rem .8rem .3rem 0; white-space: nowrap; vertical-align: top; }
table.kv td { padding: .3rem 0; }

/* ---- Page header: title + context on the left, primary actions on the right ---- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: .75rem 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head h1 { margin: 0; line-height: 1.2; }
.page-head .sub { color: var(--text-2); font-size: .88rem; margin-top: .2rem; }
.page-head .actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.back { display: inline-flex; align-items: center; gap: .3rem; color: var(--text-2); font-size: .85rem; font-weight: 500; min-height: 32px; }
@media (hover: hover) { .back:hover { color: var(--primary); } }

/* ---- Stat tiles as links ---- */
a.card.stat { display: block; color: inherit; transition: border-color .12s; }
@media (hover: hover) { a.card.stat:hover { border-color: var(--primary); } }
.stat .delta { font-size: .78rem; font-weight: 600; }
.stat .delta.up { color: var(--success); }
.stat .delta.down { color: var(--danger); }

/* ---- Empty states ---- */
.empty { text-align: center; color: var(--text-2); padding: 2rem 1rem; font-size: .92rem; }
.empty .ic { width: 34px; height: 34px; opacity: .45; display: block; margin: 0 auto .5rem; }
.empty strong { display: block; color: var(--text); font-weight: 600; margin-bottom: .2rem; }

/* ---- Pager ---- */
.pager { display: flex; align-items: center; justify-content: space-between; gap: .6rem; flex-wrap: wrap; margin-top: .8rem; font-size: .85rem; color: var(--text-2); }
.pager .pages { display: flex; gap: .3rem; }
.pager a, .pager span.cur { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; min-height: 40px; padding: 0 .6rem; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 600; }
.pager span.cur { background: var(--primary-soft); color: var(--primary); border-color: var(--primary); }
.pager a.disabled { opacity: .4; pointer-events: none; }

/* ---- Segmented control (filter chips that behave like radio buttons) ---- */
.seg { display: inline-flex; gap: .25rem; padding: .2rem; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.seg a, .seg button, .seg label { display: inline-flex; align-items: center; justify-content: center; gap: .3rem; min-height: 38px; padding: .3rem .8rem; border-radius: 8px; border: 0; background: none; color: var(--text-2); font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer; touch-action: manipulation; white-space: nowrap; }
.seg .sel, .seg label:has(input:checked) { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.seg input { position: absolute; opacity: 0; width: 0; height: 0; }

/* ---- Tables: stacked card rows on phones (add class "stack"; cells carry data-l labels) ---- */
@media (max-width: 640px) {
  table.data.stack, table.data.stack tbody { display: block; }
  table.data.stack thead { display: none; }
  table.data.stack tr { display: grid; grid-template-columns: 1fr auto; gap: .15rem .8rem; padding: .65rem .2rem; border-bottom: 1px solid var(--border); }
  table.data.stack td { display: block; padding: 0; border: 0; min-width: 0; }
  table.data.stack td.full { grid-column: 1 / -1; }
  table.data.stack td.num { text-align: right; }
  table.data.stack td[data-l]::before { content: attr(data-l); display: block; font-size: .66rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); }
  table.data.stack td.actions { grid-column: 1 / -1; display: flex; gap: .4rem; justify-content: flex-end; padding-top: .3rem; }
  /* invoices: number + amount first, then date/status, then the rest */
  table.data.stack td.c-num { order: 1; } table.data.stack td.c-amt { order: 2; font-size: 1.05rem; }
  table.data.stack td.c-date { order: 3; } table.data.stack td.c-st { order: 4; text-align: right; }
  table.data.stack td.c-cust { order: 5; } table.data.stack td.c-pay { order: 6; text-align: right; }
  table.data.stack td.c-oper { order: 7; } table.data.stack td.c-off { order: 8; text-align: right; }
}
table.data tr.total td { font-weight: 700; border-top: 2px solid var(--border); background: var(--surface-2); }
table.data tr.clickable { cursor: pointer; }
table.data th.sortable a { color: inherit; }
.user-cell { display: flex; align-items: center; gap: .6rem; }
.avatar.is-off { opacity: .45; }

/* ---- Inline icon buttons ---- */
.btn.icon { padding: .4rem .6rem; min-width: 44px; }
.btn.ghost { background: none; border-color: transparent; color: var(--text-2); }
@media (hover: hover) { .btn.ghost:hover { background: var(--surface-2); color: var(--text); } }

.toolbar { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.toolbar .grow { flex: 1; }
.muted { color: var(--text-2); font-size: .85rem; }
.mono { font-family: ui-monospace, monospace; font-size: .85em; }
.right { text-align: right; }

/* ---- POS screen ----
   Two columns from 720 px (portrait iPad included); below that the cart is a
   bottom sheet above the tab bar, with a collapsed bar showing count + total. */
.pos-layout { display: grid; grid-template-columns: 1fr minmax(300px, 380px); gap: 1rem; align-items: start; }
@media (max-width: 719px) { .pos-layout { grid-template-columns: 1fr; } }
.pos-layout > * { min-width: 0; }
.pos-toolbar { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-bottom: .6rem; }
.pos-search { position: relative; flex: 1; min-width: 200px; max-width: 460px; display: block; margin: 0; }
.pos-search .ic { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); color: var(--text-2); width: 18px; height: 18px; pointer-events: none; }
.pos-search input { padding-left: 2.3rem; }
.pos-actions { display: flex; gap: .4rem; margin-left: auto; }
.ctx-toolbar-btn { display: none; }
/* Group chips: one row, horizontally scrollable on narrow screens. */
.pos-chips { display: flex; gap: .4rem; overflow-x: auto; scrollbar-width: none; padding: .1rem .1rem .55rem; margin: 0 -.1rem .35rem; -webkit-overflow-scrolling: touch; }
.pos-chips::-webkit-scrollbar { display: none; }
.pos-chips .chip { flex-shrink: 0; gap: .4rem; padding: .3rem .8rem .3rem .65rem; min-height: 42px; }
.pos-chips .chip-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--g, var(--text-2)); flex-shrink: 0; }
.pos-chips .chip-n { font-size: .72rem; font-weight: 600; color: var(--text-2); opacity: .8; }
.pos-chips .chip.sel { background: color-mix(in srgb, var(--g, var(--primary)) 28%, var(--surface)); color: var(--text); border-color: var(--g, var(--primary)); box-shadow: inset 0 0 0 1px var(--g, var(--primary)); }
.pos-chips .chip.sel .chip-n { color: var(--text); }
/* Group colour tokens (tile accent + chip dot) — the same pastels Nimbus
   Booking paints appointments with (overview.html .appointment-block-N):
   blue = Šišanje i oblikovanje kose, violet = Bojanje i kemijski procesi,
   teal = Njega kose i tretmani, orange = Make up, pink = Svečane prigode,
   red = custom, slate = teren/ostalo. indigo/green/amber have no booking twin. */
.g-slate { --g: #b0bec5; } .g-blue { --g: #90caf9; } .g-violet { --g: #b39ddb; } .g-pink { --g: #f48fb1; }
.g-amber { --g: #ffe082; } .g-teal { --g: #80cbc4; } .g-indigo { --g: #9fa8da; } .g-red { --g: #ef9a9a; }
.g-orange { --g: #ffcc80; } .g-green { --g: #a5d6a7; }

.pos-products { display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: .45rem; }
/* Tablet band only — must not reach phones, where .pos-layout is one column
   and the cart is a fixed bottom sheet (a later rule would win the cascade). */
@media (min-width: 720px) and (max-width: 1100px) {
  .pos-layout { grid-template-columns: 1fr minmax(272px, 320px); gap: .75rem; }
  .pos-products { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .cart-line .qty button { width: 36px; height: 36px; }
  .cart-line .amt { width: 58px; }
}
@media (max-width: 719px) {
  .pos-products { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .4rem; }
  .pos-product { grid-template-columns: 34px minmax(0, 1fr); padding: .45rem .5rem .45rem .5rem; }
  .pos-product .pt-thumb { width: 34px; height: 34px; }
  .pos-product .pt-name { -webkit-line-clamp: 3; font-size: .78rem; }
}
.pos-group-head { grid-column: 1 / -1; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); padding: .55rem .15rem .05rem; }
.pos-group-head:first-child { padding-top: 0; }
/* Compact tile: thumb | name / price. Coloured left edge = group. */
.pos-product {
  display: grid; grid-template-columns: 42px minmax(0, 1fr); grid-template-rows: auto auto; column-gap: .55rem; row-gap: .12rem;
  align-items: center; min-height: 66px; padding: .5rem .6rem .5rem .55rem;
  background: var(--surface); border: 1px solid var(--border); border-left: 6px solid var(--g, var(--border));
  border-radius: var(--radius); cursor: pointer; text-align: left; font: inherit; color: var(--text);
  transition: border-color .1s, transform .05s, background .1s; touch-action: manipulation;
  -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none;
}
@media (hover: hover) { .pos-product:hover { border-color: var(--g, var(--primary)); background: var(--surface-2); } }
.pos-product:active { transform: scale(.98); background: var(--primary-soft); }
.pos-product.no-thumb { grid-template-columns: minmax(0, 1fr); }
.pos-product.no-thumb .pt-thumb { display: none; }
.pos-product .pt-thumb { grid-row: 1 / 3; width: 42px; height: 42px; border-radius: 8px; background: var(--surface-2); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.pos-product .pt-thumb img { width: 100%; height: 100%; object-fit: contain; background: #fff; pointer-events: none; }
.pos-product .pt-thumb img.pt-icon { width: 28px; height: 28px; background: none; }
.pos-product .pt-glyph { width: 20px; height: 20px; color: var(--g, var(--text-2)); opacity: .8; }
.pos-product .pt-name { font-weight: 600; font-size: .82rem; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pos-product .pt-meta { display: flex; align-items: baseline; gap: .5rem; }
.pos-product .pt-price { font-weight: 700; font-size: .86rem; color: var(--primary); font-variant-numeric: tabular-nums; }
.pos-product .pt-stock { font-size: .7rem; color: var(--text-2); }
.pos-product .pt-stock.neg { color: var(--danger); font-weight: 600; }
.pos-product .pt-stock::before { content: 'zal. '; }
/* Family tile (parent service): price range + plain variant count, popup on tap. */
.pos-product.fam .pt-meta { justify-content: space-between; flex-wrap: wrap; row-gap: .1rem; }
.pos-product .pt-price { white-space: nowrap; }
.pos-product .pt-var { display: inline-flex; align-items: center; gap: .05rem; font-size: .74rem; font-weight: 600; color: var(--text-2); white-space: nowrap; }
.pos-product .pt-var .ic { width: 15px; height: 15px; }
/* Variant picker: tablet-first — a wide dialog with big cards (same tile
   language as the grid, just larger type and hit area). */
dialog.ctx-dlg.dlg-fam { width: min(800px, calc(100vw - 2rem)); }
.dlg-fam .dlg-head h3 { display: flex; align-items: center; gap: .6rem; font-size: 1.25rem; }
.dlg-fam .dlg-head .chip-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--g, var(--text-2)); flex-shrink: 0; }
.dlg-fam .dlg-body { padding: 1rem 1.15rem 1.2rem; }
.var-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .7rem; }
.var-section { grid-column: 1 / -1; font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); padding: .5rem .1rem 0; }
.var-section:first-child { padding-top: 0; }
.var-tile {
  display: flex; flex-direction: column; justify-content: center; gap: .3rem; min-height: 112px; padding: 1rem 1.15rem;
  background: var(--surface); border: 1px solid var(--border); border-left: 6px solid var(--g, var(--border));
  border-radius: var(--radius); box-shadow: var(--shadow); cursor: pointer; text-align: left; font: inherit; color: var(--text);
  transition: border-color .1s, transform .05s, background .1s;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none;
}
@media (hover: hover) { .var-tile:hover { border-color: var(--g, var(--primary)); background: var(--surface-2); } }
.var-tile:active { transform: scale(.98); background: var(--primary-soft); }
.var-tile .vl { font-weight: 700; font-size: 1.15rem; line-height: 1.2; }
.var-tile .vl::first-letter { text-transform: uppercase; }
.var-tile .vp { font-weight: 800; font-size: 1.4rem; color: var(--primary); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
@media (max-width: 719px) {
  .var-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
  .var-tile { min-height: 96px; padding: .8rem .9rem; }
  .var-tile .vl { font-size: 1.02rem; }
  .var-tile .vp { font-size: 1.25rem; }
}
.product-thumb {
  width: 36px; height: 36px; object-fit: contain; border-radius: 6px;
  background: var(--surface-2); display: inline-flex; align-items: center; justify-content: center;
  vertical-align: middle;
}
img.product-thumb { background: #fff; }
.product-thumb-empty { opacity: .4; font-size: 1.1rem; }
.product-thumb-empty .icon-img { opacity: 1; }

/* Icon picker: thumb cell opens a dropdown grid of colored SVG icons. */
.icon-picker { position: relative; }
.icon-picker summary { list-style: none; cursor: pointer; }
.icon-picker summary::-webkit-details-marker { display: none; }
.icon-picker[open] summary .product-thumb { outline: 2px solid var(--primary); }
.icon-grid {
  position: absolute; z-index: 30; left: 0; top: calc(100% + 4px);
  display: grid; grid-template-columns: repeat(7, 34px); gap: 4px;
  padding: 6px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; box-shadow: 0 6px 24px rgba(0,0,0,.25);
}
.icon-choice {
  width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  border: 1px solid transparent; border-radius: 6px; background: none;
  color: var(--text-2); cursor: pointer; font-size: .9rem;
}
.icon-choice:hover { background: var(--surface-2); }
.icon-choice.sel { border-color: var(--primary); background: var(--primary-soft); }
.icon-img { width: 22px; height: 22px; vertical-align: middle; }
.icon-img-lg { width: 40px; height: 40px; }
.print-buttons { display: inline-flex; gap: .6rem; flex-wrap: wrap; }

/* ---- Cart: header, scrolling body, fixed footer with total + payment ---- */
#cart-card { display: flex; flex-direction: column; padding: 0; margin: 0; overflow: hidden; }
.cart-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .7rem 1rem .45rem; }
.cart-head h2 { display: flex; align-items: center; gap: .5rem; margin: 0; }
#cart-panel { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
#cart-form { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.cart-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; padding: 0 1rem .4rem; }
.cart-foot { flex-shrink: 0; padding: .45rem 1rem .85rem; border-top: 1px solid var(--border); background: var(--surface); }
.cart-bar { display: none; }
.cart-customer { display: flex; align-items: center; gap: .5rem; padding: .35rem .1rem .35rem .4rem; margin-bottom: .2rem; border-radius: 8px; background: var(--primary-soft); color: var(--primary); font-weight: 600; font-size: .9rem; }
.cart-customer .ic { flex-shrink: 0; }
.cart-customer-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cart-customer .btn.ghost { color: var(--primary); min-height: 36px; }
.cart-customer-search { position: relative; margin-bottom: .3rem; }
.cart-customer-search > .ic { position: absolute; left: .7rem; top: 12px; width: 18px; height: 18px; color: var(--text-2); pointer-events: none; }
.cart-customer-search input { padding-left: 2.3rem; }
.lines { padding: .2rem 0; }
.cart-line { display: flex; align-items: center; gap: .5rem; padding: .35rem 0; border-bottom: 1px solid var(--border); font-size: .93rem; }
.cart-line .n { flex: 1; min-width: 0; font-weight: 500; line-height: 1.25; }
.cart-line .qty { display: flex; align-items: center; gap: .15rem; }
.cart-line .qty .qv { min-width: 1.7rem; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
/* The most-tapped controls on the POS — full finger size. */
.cart-line .qty button {
  width: 42px; height: 42px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); cursor: pointer; display: flex; align-items: center; justify-content: center;
  touch-action: manipulation;
}
.cart-line .qty button .ic { width: 18px; height: 18px; }
.cart-line .qty button:active { background: var(--primary-soft); }
.cart-line .amt { width: 68px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.cart-empty { padding: 1.4rem .5rem; }
.cart-empty .ic { width: 30px; height: 30px; }
.cart-empty strong { font-size: .95rem; }
.cart-adj { margin-top: .5rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.cart-adj summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: .5rem; padding: .55rem .75rem; min-height: 44px; font-size: .88rem; font-weight: 600; color: var(--text-2); }
.cart-adj summary::-webkit-details-marker { display: none; }
.cart-adj summary .ic { width: 18px; height: 18px; }
.cart-adj summary .badge { margin-left: auto; }
.cart-adj summary .adj-chev { margin-left: auto; transition: transform .15s; }
.cart-adj summary .badge + .adj-chev { margin-left: 0; }
.cart-adj[open] summary .adj-chev { transform: rotate(180deg); }
.cart-adj .form-row { padding: 0 .75rem .2rem; }
.cart-adj .form-row > * { min-width: 90px; }
.cart-adj label.field { margin-bottom: .6rem; }
.cart-disc { padding: .15rem 0; }
.loyalty-opt { display: flex; gap: .5rem; align-items: center; font-size: .92rem; min-height: 44px; }
.pos-total { display: flex; justify-content: space-between; align-items: baseline; padding: .35rem 0 .45rem; font-size: 1.02rem; font-weight: 600; }
.pos-total .sum { font-size: 1.75rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.pay-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: .55rem; }
.pay-buttons[hidden] { display: none; }
.pay-buttons.one { grid-template-columns: 1fr; }
/* Automatic poklon bon on the cart: option line, deduction and the bold amount left to pay. */
.voucher-opt { display: flex; align-items: center; gap: .45rem; }
.voucher-opt > span { flex: 1; }
.voucher-opt .ic { color: var(--primary); flex-shrink: 0; }
.voucher-opt-amt { color: var(--primary); white-space: nowrap; }
.pos-total.has-voucher { font-size: .9rem; color: var(--text-2); }
.pos-total.has-voucher .sum { font-size: 1rem; font-weight: 600; color: var(--text-2); text-decoration: none; }
.pos-voucher-line { display: flex; justify-content: space-between; align-items: center; color: var(--primary); font-size: .9rem; font-weight: 600; padding: 0 0 .15rem; }
.pos-voucher-line .ic { width: 15px; height: 15px; vertical-align: -3px; }
.pos-due { display: flex; justify-content: space-between; align-items: baseline; font-weight: 800; font-size: 1.1rem; padding: .1rem 0 .5rem; }
.pos-due .sum { font-size: 1.6rem; }
/* Checkout preview: the receipt total is context, the charge box is the instruction. */
.confirm-line.confirm-total { border-top: 1px solid var(--border); margin-top: .3rem; padding-top: .35rem; font-weight: 600; }
.confirm-charge { display: flex; justify-content: space-between; align-items: baseline; gap: .8rem; margin-top: .6rem; padding: .65rem .85rem; border-radius: var(--radius); background: var(--primary-soft); color: var(--primary); font-weight: 800; font-size: 1rem; }
.confirm-charge > span:first-child { font-size: .92rem; line-height: 1.25; }
.confirm-charge .sum { font-size: 1.75rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.confirm-charge.zero { background: var(--surface-2); color: var(--text-2); }
.confirm-charge[hidden] { display: none; }
/* One-tap "pay with the customer's bon" above cash/card. */
.pay-voucher { width: 100%; margin-bottom: .55rem; background: var(--primary-soft); color: var(--primary); border-color: var(--primary); }
.pay-voucher .muted { font-weight: 500; }
/* Poklon bon tile in the grid + sale dialog steps. */
.pos-product.pos-voucher { --g: var(--primary); background: var(--primary-soft); }
.pos-product .pt-inline { width: 16px; height: 16px; vertical-align: -3px; color: var(--primary); }
.sell-step { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-2); margin: .8rem 0 .3rem; }
.sell-step-n { width: 20px; height: 20px; border-radius: 50%; background: var(--primary); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: .72rem; flex-shrink: 0; }
.sell-step-hint { font-weight: 500; text-transform: none; letter-spacing: 0; font-size: .76rem; }
.sell-holder-picked { display: flex; align-items: center; gap: .4rem; margin: .35rem 0 0; font-weight: 600; color: var(--success, #15803d); }
.sell-holder-picked > span { flex: 1; }
.sell-holder-picked[hidden] { display: none; }
.sell-more { margin-top: .7rem; }
.sell-more summary { cursor: pointer; color: var(--primary); font-weight: 600; font-size: .85rem; list-style: none; }
.sell-more summary::before { content: '+ '; }
.sell-more[open] summary::before { content: '− '; }
.sell-more > .form-row, .sell-more > .field { margin-top: .5rem; }
.pay-buttons .btn { gap: .5rem; }
.cart-more { display: flex; justify-content: space-between; gap: .5rem; margin-top: .5rem; }
.quick-cash { display: flex; gap: .45rem; margin: .4rem 0 .6rem; flex-wrap: wrap; }
.quick-cash .btn { flex: 1; min-width: 60px; }
.confirm-lines { display: flex; flex-direction: column; gap: .3rem; margin: .6rem 0 0; max-height: 38vh; overflow-y: auto; scrollbar-width: thin; }
.confirm-line { display: flex; justify-content: space-between; gap: 1rem; font-variant-numeric: tabular-nums; }
.confirm-line[hidden] { display: none; }
.cart-backdrop { display: none; }
/* Two-column mode: the cart fills the viewport height and scrolls internally,
   so total + payment never leave the screen. */
@media (min-width: 720px) {
  .pos-cart { position: sticky; top: 1rem; height: calc(100vh - 2rem); height: calc(100dvh - 2rem); }
  #cart-card { height: 100%; }
}
/* Phones: bottom sheet above the tab bar. Collapsed = just the bar. */
@media (max-width: 719px) {
  .pos-cart {
    position: fixed; left: 0; right: 0; bottom: 60px; z-index: 46; height: 84dvh; height: 84vh;
    transform: translateY(calc(100% - 62px)); transition: transform .22s ease;
  }
  .pos-cart.open { transform: none; }
  #cart-card { height: 100%; border-radius: 16px 16px 0 0; border-bottom: 0; border-top: 2px solid var(--primary); box-shadow: 0 -8px 28px rgba(15, 23, 42, .18); }
  .cart-head { display: none; }
  .cart-bar { display: flex; align-items: stretch; height: 62px; flex-shrink: 0; border-bottom: 1px solid var(--border); }
  .cart-bar-op { display: flex; align-items: center; padding: 0 .4rem 0 .8rem; background: none; border: 0; cursor: pointer; }
  .cart-bar-main { flex: 1; display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: 0 .9rem 0 .4rem; background: none; border: 0; font: inherit; color: var(--text); cursor: pointer; text-align: left; }
  .cart-bar-l { display: flex; align-items: center; gap: .5rem; font-size: .95rem; }
  .cart-bar-l .ic { width: 22px; height: 22px; color: var(--primary); }
  .cart-bar-r { display: flex; align-items: center; gap: .4rem; font-size: 1.15rem; }
  .cart-bar-chev { transform: rotate(180deg); transition: transform .2s; color: var(--text-2); }
  .pos-cart.open .cart-bar-chev { transform: none; }
  .cart-backdrop { display: block; position: fixed; inset: 0; bottom: 60px; z-index: 45; background: rgb(15 23 42 / .35); opacity: 0; pointer-events: none; transition: opacity .2s; }
  .pos-cart.open ~ .cart-backdrop, .cart-backdrop.open { opacity: 1; pointer-events: auto; }
  main.content:has(.pos-layout) { padding-bottom: 8.5rem; }
  .pos-actions { width: 100%; margin-left: 0; }
  .pos-actions .btn { flex: 1; white-space: nowrap; font-size: .82rem; padding-left: .5rem; padding-right: .5rem; }
}
/* In-flight spinner: visible feedback for every cart round-trip. */
.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--primary);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#offline-banner {
  position: sticky; top: 0; z-index: 90; background: var(--danger); color: #fff;
  text-align: center; padding: .55rem .8rem; font-weight: 600; font-size: .92rem;
}

/* ---- Context dialogs (operator / office switch) ---- */
dialog.ctx-dlg { padding: 0; width: min(420px, calc(100vw - 2rem)); max-height: min(85vh, calc(100dvh - 2rem)); }
dialog.ctx-dlg[open] { display: flex; flex-direction: column; }
.ctx-dlg .dlg-head { flex-shrink: 0; padding: 1rem 3.2rem .75rem 1.15rem; border-bottom: 1px solid var(--border); }
.ctx-dlg .dlg-head h3 { margin: 0; font-size: 1.05rem; }
.ctx-dlg .dlg-close {
  position: absolute; top: .45rem; right: .45rem; width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  background: none; border: 0; border-radius: 10px; font-size: 1.5rem; line-height: 1;
  color: var(--text-2); cursor: pointer; touch-action: manipulation;
}
@media (hover: hover) { .ctx-dlg .dlg-close:hover { background: var(--surface-2); color: var(--text); } }
.ctx-dlg .dlg-close:focus { outline: none; }
.ctx-dlg .dlg-close:focus-visible { outline: 2px solid var(--primary); }
.ctx-dlg .dlg-body { padding: .8rem 1.15rem 1.1rem; overflow-y: auto; outline: none; scrollbar-width: thin; }
/* Phones: bottom sheet instead of a floating box. */
@media (max-width: 600px) {
  dialog.ctx-dlg {
    margin: auto auto 0; width: 100vw; max-width: 100vw;
    border-left: 0; border-right: 0; border-bottom: 0; border-radius: 14px 14px 0 0;
    max-height: 90dvh;
  }
  .ctx-dlg .dlg-body { padding-bottom: calc(1.1rem + env(safe-area-inset-bottom)); }
}

/* Wide variant for form-heavy dialogs (product editor). */
dialog.ctx-dlg.dlg-wide { width: min(720px, calc(100vw - 2rem)); }
.dlg-section { margin: 1.1rem 0 .5rem; padding-top: .8rem; border-top: 1px solid var(--border); font-size: .95rem; }

/* Quick-range chips (reports presets). */
.chip {
  display: inline-flex; align-items: center; min-height: 44px; padding: .3rem .85rem;
  border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text-2); font-size: .85rem; font-weight: 600; touch-action: manipulation;
}
@media (hover: hover) { .chip:hover { background: var(--surface-2); color: var(--text); } }
.chip.sel { background: var(--primary-soft); color: var(--primary); border-color: var(--primary); }

/* In-table magnitude bars: single hue, value printed in the same row. */
.bar-cell { width: 18%; min-width: 48px; }
.mini-bar { height: 8px; min-width: 2px; border-radius: 4px; background: var(--primary); opacity: .7; }

.op-list { display: flex; flex-direction: column; gap: .4rem; }
.op-group { font-size: .74rem; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: .03em; margin: .8rem 0 .4rem; }
.op-group:first-child { margin-top: 0; }
.op-row {
  position: relative; display: flex; gap: .6rem; align-items: center;
  font-size: 1rem; min-height: 52px; padding: .5rem .8rem; border-radius: 10px; cursor: pointer;
  width: 100%; background: var(--surface); border: 1px solid var(--border);
  font-family: inherit; color: var(--text); text-align: left;
  touch-action: manipulation;
}
@media (hover: hover) { .op-row:hover { background: var(--surface-2); } }
.op-row:active { background: var(--surface-2); }
.op-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .05rem; }
.op-name { font-weight: 600; }
.op-hint { font-size: .75rem; }
.op-go { color: var(--text-2); font-size: 1.25rem; line-height: 1; }
.op-row.is-current { cursor: default; background: var(--surface-2); }
.op-row.is-disabled { cursor: default; opacity: .55; }
/* ---- Avatars: colored initials, same tone for the same person everywhere
   (POS strip, operator dialog, sidebar). Tones are keyed by user id in
   src/avatar.rs; keep TONES there in sync with the .av-N list here. ---- */
.avatar {
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--av, var(--text-2)); color: #fff;
  font-weight: 700; font-size: .85rem; letter-spacing: .02em; line-height: 1;
  user-select: none; -webkit-user-select: none;
}
.avatar.sm { width: 28px; height: 28px; font-size: .66rem; }
.avatar.lg { width: 60px; height: 60px; font-size: 1.3rem; }
.avatar.xl { width: 72px; height: 72px; font-size: 1.55rem; }
.av-0 { --av: #0d9488; } .av-1 { --av: #e11d48; } .av-2 { --av: #7c3aed; }
.av-3 { --av: #b45309; } .av-4 { --av: #0284c7; } .av-5 { --av: #db2777; }
.av-6 { --av: #15803d; } .av-7 { --av: #c2410c; } .av-8 { --av: #4f46e5; }
.av-9 { --av: #4d7c0f; }
.ctx-btn .avatar, .ctx-static .avatar { margin-right: .1rem; }
.ctx-static { display: flex; align-items: center; gap: .45rem; }
.op-row .avatar { margin-left: -.15rem; }
.op-row .op-glyph { width: 40px; text-align: center; font-size: 1.3rem; line-height: 1; flex: 0 0 auto; }

/* Operator tiles: profile-picker style — big avatar, name under it, the whole
   tile is the tap target (≥ 84×100 px). Used by the "Tko prodaje?" dialog. */
.op-tile {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: .4rem;
  width: 88px; min-height: 104px; padding: .55rem .25rem .45rem;
  border-radius: 14px; border: 1px solid transparent; background: none;
  font-family: inherit; color: var(--text-2); cursor: pointer; touch-action: manipulation;
  -webkit-tap-highlight-color: transparent; transition: background-color .1s, border-color .1s;
}
.op-tile .op-name {
  max-width: 100%; font-size: .8rem; font-weight: 600; line-height: 1.2; text-align: center;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.op-tile .op-hint { max-width: 100%; font-size: .68rem; line-height: 1.2; color: var(--text-2); text-align: center; }
.op-tile .avatar { transition: transform .08s; }
@media (hover: hover) { .op-tile:not(:disabled):hover { background: var(--surface-2); color: var(--text); } }
.op-tile:not(:disabled):active { background: var(--surface-2); }
.op-tile:not(:disabled):active .avatar { transform: scale(.92); }
.op-tile:focus { outline: none; }
.op-tile:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
/* No OIB on file — visible so nobody wonders where a colleague went, but not selectable. */
.op-tile:disabled { opacity: .45; cursor: not-allowed; }
.op-tile:disabled .op-hint { color: var(--danger, #b3261e); font-weight: 600; }
/* Cart header: "Račun" + the operator on the register; tapping the pill
   opens the "Tko prodaje?" dialog (one tap to switch from the cart). */
.op-current {
  display: inline-flex; align-items: center; gap: .45rem; min-height: 44px; max-width: 60%;
  padding: .2rem .65rem .2rem .25rem; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border);
  font-family: inherit; font-size: .9rem; font-weight: 600; color: var(--text);
  cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.op-current .avatar { width: 36px; height: 36px; font-size: .8rem; }
.op-current-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.op-current-chev { color: var(--text-2); font-size: .85rem; }
@media (hover: hover) { .op-current:hover { border-color: var(--primary); } }
.op-current:active { background: var(--primary-soft); border-color: var(--primary); }
.op-current:focus { outline: none; }
.op-current:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Dialog grid: bordered card tiles, full names allowed to wrap to two lines. */
dialog.ctx-dlg.dlg-ops { width: min(620px, calc(100vw - 2rem)); }
.op-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: .5rem; }
.op-tile.card-tile {
  width: auto; min-height: 136px; padding: .85rem .4rem .7rem; gap: .5rem;
  background: var(--surface); border-color: var(--border); color: var(--text);
}
.op-tile.card-tile .op-name {
  white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  font-size: .85rem;
}
@media (hover: hover) { .op-tile.card-tile:hover { border-color: var(--primary); background: var(--surface); } }
.op-tile.card-tile:active { border-color: var(--primary); background: var(--primary-soft); }

/* ---- Receipt ---- */
.receipt { font-family: ui-monospace, monospace; font-size: .82rem; background: #fff; color: #000; max-width: 340px; margin: 0 auto; padding: 1rem; }
.receipt hr { border: 0; border-top: 1px dashed #000; }
.receipt .c { text-align: center; }
.receipt table { width: 100%; border-collapse: collapse; }
.receipt td { padding: .1rem 0; vertical-align: top; }
.receipt td.r { text-align: right; white-space: nowrap; }
.receipt .qr { display: flex; justify-content: center; margin: .5rem 0; }
.receipt .qr svg { width: 128px; height: 128px; }
@media print {
  body * { visibility: hidden; }
  .receipt, .receipt * { visibility: visible; }
  .receipt { position: absolute; left: 0; top: 0; max-width: none; width: 72mm; }
}

/* ---- Login ---- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.login-card { width: 100%; max-width: 380px; }
.login-card .brand { text-align: center; font-size: 1.5rem; font-weight: 800; margin-bottom: 1.5rem; }

/* HTMX request indicator */
.htmx-indicator { opacity: 0; transition: opacity .15s; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }

#toast {
  position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%);
  z-index: 100; display: flex; flex-direction: column; gap: .5rem; pointer-events: none;
}
#toast .t { background: var(--text); color: var(--bg); padding: .6rem 1.1rem; border-radius: 8px; font-size: .9rem; box-shadow: var(--shadow); animation: toast-in .2s ease-out; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---- KPD classification picker (product editor) ---- */
div.field { display: block; margin-bottom: .8rem; font-size: .85rem; font-weight: 500; }
div.field > span { display: block; margin-bottom: .3rem; color: var(--text-2); }
.kpd-picker { position: relative; }
.kpd-results { position: absolute; top: 100%; left: 0; min-width: 100%; width: max-content;
  max-width: min(480px, 90vw); z-index: 40; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(15, 23, 42, .14); max-height: 250px; overflow-y: auto; }
.kpd-results:empty { display: none; }
.kpd-row { display: flex; gap: .45rem; align-items: baseline; width: 100%; text-align: left;
  padding: .45rem .6rem; border: 0; border-bottom: 1px solid var(--border); background: none;
  cursor: pointer; font-size: .8rem; font-weight: 400; color: var(--text); }
.kpd-row:last-child { border-bottom: 0; }
.kpd-row:hover { background: var(--primary-soft); }
.kpd-row .mono { flex-shrink: 0; }
.kpd-row.muted-row { cursor: default; color: var(--text-2); }
.kpd-row.muted-row:hover { background: none; }

/* ---- Filter bar (list pages) ---- */
.filter-bar { padding: .8rem 1rem .5rem; }
.filter-row { display: flex; gap: .6rem .8rem; align-items: flex-end; flex-wrap: wrap; margin-bottom: .5rem; }
.filter-row:last-child { margin-bottom: 0; }
.search-field { position: relative; flex: 1 1 260px; min-width: 200px; display: block; margin: 0; }
.search-field .ic { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--text-2); pointer-events: none; }
.search-field input { padding-left: 2.3rem; }
label.field.compact { margin: 0; flex: 0 1 auto; min-width: 120px; }
label.field.compact input, label.field.compact select { min-height: 42px; width: auto; min-width: 120px; }
label.field.compact input[type="date"] { min-width: 150px; }
label.check { display: flex; gap: .4rem; align-items: center; font-size: .9rem; min-height: 42px; }
label.check input { width: auto; }
.summary-strip { display: flex; gap: .5rem 1.4rem; flex-wrap: wrap; align-items: baseline; padding: .2rem .3rem .7rem; }
.sum-item { display: flex; gap: .45rem; align-items: baseline; }
.sum-item .lbl { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-2); }
.sum-item strong { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.sum-item:first-child strong, .sum-item:nth-child(2) strong { font-size: 1.25rem; }
@media (max-width: 640px) {
  .filter-row .seg { width: 100%; overflow-x: auto; scrollbar-width: none; }
  label.field.compact { flex: 1 1 45%; }
  label.field.compact input, label.field.compact select { width: 100%; }
}

/* ---- Key/value summary grid (detail pages) ---- */
.kv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .7rem 1.2rem; }
.kv { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.kv .k { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-2); }
.kv .v { font-size: .95rem; font-weight: 500; display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; min-width: 0; }
.kv .v.big { font-size: 1.5rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.kv .v.small { font-size: .78rem; word-break: break-all; }
.kv .v .btn.ghost.sm { min-height: 32px; padding: .15rem .45rem; }
details.receipt-preview > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: .5rem; font-weight: 600; min-height: 44px; }
details.receipt-preview > summary::-webkit-details-marker { display: none; }
details.receipt-preview[open] > summary { margin-bottom: .6rem; }
.grow { flex: 1; }
.kv .v.small-text { font-size: .85rem; font-weight: 500; color: var(--text-2); }

/* ---- Dashboard quick actions ---- */
.quick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .55rem; }
.quick { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .45rem; min-height: 92px; padding: .7rem .5rem; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); font-weight: 600; font-size: .88rem; text-align: center; touch-action: manipulation; }
.quick .ic { width: 26px; height: 26px; color: var(--primary); }
@media (hover: hover) { .quick:hover { border-color: var(--primary); background: var(--surface); } }
.quick:active { background: var(--primary-soft); }
.stat .sub { overflow: hidden; text-overflow: ellipsis; }
.check-list { display: flex; flex-direction: column; gap: .2rem; margin: .2rem 0 .6rem; }
.check-list .check { min-height: 40px; }
textarea { min-height: 80px; resize: vertical; line-height: 1.4; }

/* ---- Products: groups editor + bulk bar ---- */
.group-row { display: flex; gap: .45rem; align-items: center; flex-wrap: wrap; }
.group-row input, .group-row select { min-height: 40px; width: auto; flex: 0 1 auto; }
.group-row input[name="name"] { flex: 1 1 160px; min-width: 140px; }
.group-row .chip-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--g, var(--text-2)); flex-shrink: 0; }
.bulk-bar { position: sticky; top: .5rem; z-index: 20; display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; padding: .55rem .9rem; margin-bottom: .6rem; border-radius: 10px; background: var(--primary-soft); border: 1px solid var(--primary); }
.bulk-bar[hidden] { display: none; }
@media (max-width: 640px) {
  table.data.stack td.c-num { grid-column: 1 / -1; }
}

@media (max-width: 640px) { .hide-sm { display: none !important; } table.data td.actions .btn { padding: .3rem .5rem; } }

.inline-edit { min-height: 40px; padding: .35rem .55rem; background: var(--surface-2); border-color: transparent; }
.inline-edit:focus { background: var(--surface); }
.price-edit { max-width: 150px; text-align: right; font-variant-numeric: tabular-nums; }
@media (min-width: 641px) { .hide-lg { display: none !important; } }

th.price-col { width: 170px; }
@media (max-width: 640px) {
  th.price-col { width: 96px; }
  .price-edit { max-width: 96px; padding: .3rem .4rem; }
  table.data td .btn.sm { min-height: 40px; }
}

/* ---- Tabs (settings) ---- */
.tabs { display: flex; gap: .2rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab-link { display: inline-flex; align-items: center; gap: .4rem; padding: .6rem .9rem; min-height: 44px; color: var(--text-2); font-weight: 600; font-size: .9rem; white-space: nowrap; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tab-link .ic { width: 18px; height: 18px; }
.tab-link.active { color: var(--primary); border-bottom-color: var(--primary); }
@media (hover: hover) { .tab-link:hover { color: var(--text); } }

.cart-customer-search .qr-btn { position: absolute; right: .25rem; top: 2px; min-height: 40px; height: 40px; }
.cart-customer-search input { padding-right: 3rem; }
.qr-btn .ic { width: 20px; height: 20px; }

/* Phone: secondary filter row folds behind a "Filteri" button */
.filters-toggle { display: none; }
@media (max-width: 640px) {
  .filters-toggle { display: inline-flex; }
  .filter-bar .filter-row.more { display: none; }
  .filter-bar.open .filter-row.more { display: flex; }
}

/* Dark mode: readable text on the soft status backgrounds (auto = OS dark and not forced light; or forced dark) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .alert.err, :root:not([data-theme="light"]) .badge.err { color: #fecaca; }
  :root:not([data-theme="light"]) .alert.warn, :root:not([data-theme="light"]) .badge.warn { color: #fde68a; }
  :root:not([data-theme="light"]) .alert.ok, :root:not([data-theme="light"]) .badge.ok { color: #bbf7d0; }
  :root:not([data-theme="light"]) .alert.info, :root:not([data-theme="light"]) .badge.info { color: #bfdbfe; }
  :root:not([data-theme="light"]) .stat .delta.up { color: #86efac; }
  :root:not([data-theme="light"]) .stat .delta.down { color: #fca5a5; }
  :root:not([data-theme="light"]) .pos-product .pt-thumb img { background: #fff; }
}
:root[data-theme="dark"] .alert.err, :root[data-theme="dark"] .badge.err { color: #fecaca; }
:root[data-theme="dark"] .alert.warn, :root[data-theme="dark"] .badge.warn { color: #fde68a; }
:root[data-theme="dark"] .alert.ok, :root[data-theme="dark"] .badge.ok { color: #bbf7d0; }
:root[data-theme="dark"] .alert.info, :root[data-theme="dark"] .badge.info { color: #bfdbfe; }
:root[data-theme="dark"] .stat .delta.up { color: #86efac; }
:root[data-theme="dark"] .stat .delta.down { color: #fca5a5; }
:root[data-theme="dark"] .pos-product .pt-thumb img { background: #fff; }

/* Theme picker (Postavke → Izgled, context menu). */
.theme-seg { margin: .2rem 0 .4rem; }
.theme-seg .seg { width: 100%; }
.theme-seg .seg button { flex: 1; min-height: 44px; }
.install-app { margin: .6rem 0 .2rem; }
.install-app .install-hint { margin: .35rem 0 0; font-size: .82rem; }
.install-card { margin-top: 1rem; max-width: 520px; }
.install-card h3 { margin: 0 0 .5rem; }

/* Inventura (popis robe). Two tabs — Prodajni (take-home) / Profesionalni
   (colour tubes etc.) — a compact one-line-per-article list, and a sticky
   header that always carries the finish button, so nobody scrolls 200 rows
   to close the count. */
.inv-head { position: sticky; top: 0; z-index: 5; background: var(--bg); margin: -1.25rem -1.5rem .5rem; padding: .7rem 1.5rem 0; }
.inv-head-top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .45rem; }
.inv-title .back { min-height: 0; margin-bottom: .1rem; }
.inv-title h1 { margin: 0; font-size: 1.35rem; line-height: 1.2; }
.inv-office { color: var(--text-2); font-weight: 500; font-size: .95rem; }
.inv-office::before { content: '·'; margin: 0 .35rem 0 .15rem; }
.inv-head-actions { display: flex; align-items: center; gap: .6rem; flex-shrink: 0; }
.inv-progress { display: inline-flex; align-items: baseline; gap: .25rem; font-variant-numeric: tabular-nums; padding: .4rem .75rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); white-space: nowrap; line-height: 1; }
.inv-progress b { font-size: 1.1rem; }
.inv-progress .inv-of { color: var(--text-2); font-size: .85rem; font-weight: 500; }
.inv-finish { min-height: 44px; padding: .5rem 1.1rem; font-size: .95rem; }
.inv-head-tools { display: flex; align-items: center; gap: .6rem; margin-bottom: .45rem; }
.inv-seg { flex: 0 0 auto; }
.inv-seg button { min-height: 40px; padding: .3rem 1rem; }
.inv-seg .n { font-weight: 500; opacity: .65; font-size: .8em; }
.inv-search { flex: 1 1 200px; }
.inv-search input { min-height: 44px; }
.inv-search-btn { display: none; width: 44px; height: 44px; flex: 0 0 auto; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); align-items: center; justify-content: center; touch-action: manipulation; cursor: pointer; }
.inv-search-btn .ic { width: 20px; height: 20px; }
.inv-chips { display: flex; gap: .4rem; overflow-x: auto; scrollbar-width: none; padding-bottom: .45rem; -webkit-overflow-scrolling: touch; }
.inv-chips::-webkit-scrollbar { display: none; }
.inv-chips .chip { flex: 0 0 auto; gap: .4rem; min-height: 36px; padding: .25rem .8rem; }
.inv-chips .chip[hidden] { display: none; }
.inv-chips .chip .chip-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--g, var(--text-2)); }
.inv-chips .chip .n { font-weight: 500; opacity: .65; }
.inv-chips .chip .ic { width: 15px; height: 15px; }
.inv-chip-todo { margin-left: auto; }
.inv-track { height: 3px; background: var(--border); border-radius: 2px; margin: 0 0 0; overflow: hidden; }
.inv-fill { height: 100%; width: 0; background: var(--primary); border-radius: 2px; transition: width .25s; }
.inv-fill.full { background: var(--success); }

.inv-list { display: grid; grid-template-columns: 1fr; gap: .4rem; padding-bottom: 1.5rem; }
.inv-sec { grid-column: 1 / -1; display: flex; align-items: center; gap: .45rem; margin: .7rem 0 .1rem .25rem; font-size: .78rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-2); }
.inv-sec:first-child { margin-top: .1rem; }
.inv-sec .chip-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--g, var(--text-2)); }
.inv-sec[hidden], .inv-row[hidden] { display: none; }
.inv-row {
  display: grid; grid-template-columns: 56px minmax(0, 1fr) auto auto; align-items: center; gap: .75rem;
  min-height: 64px; padding: .35rem .5rem .35rem .35rem; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border); transition: background .15s, border-color .15s;
}
.inv-row.bad { border-color: var(--danger); }
.inv-pic { width: 56px; height: 56px; border-radius: 9px; background: #fff; border: 1px solid var(--border); padding: 2px; display: flex; align-items: center; justify-content: center; overflow: hidden; cursor: zoom-in; flex-shrink: 0; touch-action: manipulation; }
.inv-pic img { width: 100%; height: 100%; object-fit: contain; display: block; }
.inv-pic-empty { background: var(--surface-2); cursor: default; }
.inv-label { font-weight: 800; font-size: 1.05rem; letter-spacing: .02em; color: var(--text-2); text-align: center; line-height: 1; word-break: break-all; }
.inv-info { min-width: 0; }
.inv-name { font-weight: 600; font-size: .95rem; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.inv-meta { display: flex; gap: .6rem; color: var(--text-2); font-size: .78rem; margin-top: .15rem; }
.inv-sku { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .02em; }
.inv-book-sm { display: none; }
.inv-book { display: flex; flex-direction: column; align-items: flex-end; min-width: 72px; line-height: 1.15; font-variant-numeric: tabular-nums; }
.inv-book-lbl { font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-2); }
.inv-book-val { font-weight: 600; font-size: 1rem; }
.inv-book-val small { color: var(--text-2); font-weight: 500; font-size: .75rem; }
.inv-delta { font-size: .8rem; font-weight: 700; min-height: 1em; }
.inv-delta.up { color: var(--success); }
.inv-delta.dn { color: var(--danger); }
.inv-qty { display: inline-flex; align-items: stretch; height: 48px; border-radius: 11px; border: 1px solid var(--border); background: var(--surface-2); overflow: hidden; }
.inv-step { width: 46px; border: 0; background: none; color: var(--text); display: inline-flex; align-items: center; justify-content: center; touch-action: manipulation; cursor: pointer; }
.inv-step .ic { width: 20px; height: 20px; }
.inv-step:active { background: var(--primary-soft); color: var(--primary); }
.inv-in { width: 62px; height: auto; min-height: 0; border: 0; border-left: 1px solid var(--border); border-right: 1px solid var(--border); border-radius: 0; background: var(--surface); text-align: center; font-size: 1.2rem; font-weight: 700; padding: 0 .2rem; font-variant-numeric: tabular-nums; }
.inv-in:focus { outline: none; box-shadow: inset 0 0 0 2px var(--primary); }
.inv-in::placeholder { color: var(--text-2); opacity: .5; font-weight: 500; }
.inv-row.done .inv-in { background: var(--success-soft); color: #14532d; }
.inv-row.diff .inv-in { background: var(--warn-soft); color: #78350f; }
:root[data-theme="dark"] .inv-row.done .inv-in { color: #bbf7d0; }
:root[data-theme="dark"] .inv-row.diff .inv-in { color: #fde68a; }
.inv-row.bad .inv-in { background: var(--danger-soft); }

@media (min-width: 1200px) { .inv-list { grid-template-columns: 1fr 1fr; gap: .4rem .6rem; } }
@media (min-width: 769px) { html.nav-collapsed .inv-head { margin-left: -1.25rem; padding-left: 1.25rem; } }
@media (max-width: 768px) {
  .inv-head { margin: -.9rem -.75rem .4rem; padding: .55rem .75rem 0; }
  .inv-head-top { margin-bottom: .5rem; }
  .inv-title .back { display: none; }
  .inv-title h1 { font-size: 1.2rem; }
  .inv-office { display: block; font-size: .8rem; }
  .inv-office::before { content: none; }
  .inv-head-actions { gap: .45rem; }
  .inv-progress { padding: .35rem .6rem; }
  .inv-finish { padding: .5rem .85rem; }
  .inv-head-tools { gap: .5rem; margin-bottom: .5rem; flex-wrap: wrap; }
  .inv-seg { flex: 1 1 auto; display: flex; }
  .inv-seg button { flex: 1; padding: .3rem .5rem; }
  .inv-search { display: none; flex: 1 1 100%; }
  .inv-search.open { display: block; }
  .inv-search-btn { display: inline-flex; }
  .inv-list { padding-bottom: 5rem; }
  .inv-row { grid-template-columns: 52px minmax(0, 1fr) auto; gap: .55rem; min-height: 64px; padding: .35rem .4rem; }
  .inv-pic { width: 52px; height: 52px; }
  .inv-book { display: none; }
  .inv-book-sm { display: inline; }
  .inv-meta { flex-wrap: wrap; gap: .15rem .55rem; }
  .inv-qty { height: 46px; }
  .inv-step { width: 42px; }
  .inv-in { width: 56px; font-size: 1.1rem; }
  .inv-name { font-size: .9rem; }
}
@media (max-width: 360px) { .inv-step { width: 38px; } .inv-in { width: 50px; } }

.inv-review .inv-review-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: .4rem; margin-bottom: .8rem; }
.inv-stat { padding: .5rem .6rem; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); display: flex; flex-direction: column; line-height: 1.15; }
.inv-stat b { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.inv-stat span { font-size: .74rem; color: var(--text-2); }
.inv-stat.warn b { color: var(--warn); }
.inv-stat.up b { color: var(--success); }
.inv-stat.dn b { color: var(--danger); }
.inv-review-opts { display: flex; flex-direction: column; gap: .3rem; margin: 0 0 .8rem; }
.inv-review-opts .check { margin: 0; }
.inv-review-wrap { max-height: 32vh; overflow-y: auto; }
.inv-review-note { font-size: .82rem; }
.inv-up { color: var(--success); font-weight: 600; }
.inv-dn { color: var(--danger); font-weight: 600; }
dialog.inv-zoom { width: min(520px, calc(100vw - 2rem)); background: #fff; padding: 1rem; align-items: center; text-align: center; cursor: zoom-out; }
dialog.inv-zoom img { max-width: 100%; max-height: 70vh; object-fit: contain; }
.inv-zoom-name { margin-top: .6rem; font-weight: 700; color: #111; }
