/* style.css — Bean & Leaf POS. Same identity as the Menu Costing app:
   leaf green + roasted brown on cool sage paper. Tablet-first. */
:root {
  --bg: #e9eee8; --surface: #ffffff; --surface-2: #f3f6f1; --ink: #18231d; --ink-2: #4f5d55; --ink-3: #7a877f;
  --line: #d3dcd3; --accent: #2b6a4c; --accent-ink: #ffffff; --accent-soft: #dcebe1; --roast: #6b3f24; --roast-soft: #f1e6dc;
  --good: #23764a; --warn: #a85a06; --bad: #b42318; --good-soft: #def1e5; --warn-soft: #fbecd7; --bad-soft: #fbe2df;
  --shadow: 0 1px 0 rgba(24,35,29,.04), 0 6px 20px -12px rgba(24,35,29,.25);
  --font-display: 'Bricolage Grotesque', 'Avenir Next', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Figtree', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --r-sm: 8px; --r-md: 14px; --r-lg: 20px;
  color-scheme: light; box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111814; --surface: #19221d; --surface-2: #1f2a24; --ink: #e3ebe5; --ink-2: #a6b3ab; --ink-3: #7e8c84; --line: #2d3a33;
    --accent: #78c99f; --accent-ink: #0d1a13; --accent-soft: #1f3a2c; --roast: #d8a77c; --roast-soft: #33251b;
    --good: #72d29d; --warn: #f2a855; --bad: #f58a80; --good-soft: #193526; --warn-soft: #3a2a14; --bad-soft: #3d1d1a;
    --shadow: 0 1px 0 rgba(0,0,0,.3), 0 8px 24px -14px rgba(0,0,0,.8); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111814; --surface: #19221d; --surface-2: #1f2a24; --ink: #e3ebe5; --ink-2: #a6b3ab; --ink-3: #7e8c84; --line: #2d3a33;
  --accent: #78c99f; --accent-ink: #0d1a13; --accent-soft: #1f3a2c; --roast: #d8a77c; --roast-soft: #33251b;
  --good: #72d29d; --warn: #f2a855; --bad: #f58a80; --good-soft: #193526; --warn-soft: #3a2a14; --bad-soft: #3d1d1a;
  --shadow: 0 1px 0 rgba(0,0,0,.3), 0 8px 24px -14px rgba(0,0,0,.8); color-scheme: dark;
}
*, *::before, *::after { box-sizing: inherit; }
html { scroll-padding-top: env(safe-area-inset-top, 0px); }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
body.no-scroll { overflow: hidden; }
h1, h2, h3 { font-family: var(--font-display); margin: 0; line-height: 1.15; }
h2 { font-size: 20px; font-weight: 800; } h3 { font-size: 16px; }
button, input, select { font: inherit; color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.mono { font-family: var(--font-mono); } .small { font-size: 12px; }
.neg { color: var(--bad) !important; } .pos { color: var(--good); }
.hint { color: var(--ink-3); font-size: 13px; }
.note { margin: 0; background: var(--surface-2); border-radius: var(--r-sm); padding: 10px 12px; color: var(--ink-2); font-size: 14px; }
.empty { color: var(--ink-2); text-align: center; padding: 28px 12px; margin: 0; }
.mt { margin-top: 14px; }

.app { max-width: 1440px; margin: 0 auto; padding: 12px 18px 24px; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 8px 16px; border-radius: 999px; border: 1px solid transparent; font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap; }
.btn-primary { background: var(--accent); color: var(--accent-ink); } .btn-primary:hover { filter: brightness(1.07); }
.btn-quiet { background: var(--surface); border-color: var(--line); } .btn-quiet:hover { border-color: var(--ink-3); }
.btn-danger { background: var(--bad); color: #fff; }
.btn-icon { width: 44px; padding: 0; }
.btn-lg { min-height: 52px; font-size: 16px; padding: 10px 22px; }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.link-btn { background: none; border: 0; padding: 4px 0; color: var(--accent); font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; min-height: 32px; }
.link-btn:disabled { color: var(--ink-3); cursor: default; }
.link-btn.small { font-size: 13px; }
.mini { background: none; border: 1px solid transparent; border-radius: var(--r-sm); padding: 6px 8px; min-height: 34px; display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.mini .i { width: 15px; height: 15px; }
.mini:hover { background: var(--surface-2); color: var(--ink); }
.mini-danger:hover { background: var(--bad-soft); color: var(--bad); }

/* ---------- header & nav ---------- */
.header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 4px 0 12px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 44px; height: 44px; border-radius: 14px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; transform: rotate(-6deg); }
.brand-name { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.brand-tag { margin: 0; font-size: 13px; color: var(--ink-2); }
.header-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.shift-pill { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--ink-2); padding: 6px 12px; border-radius: 999px; background: var(--surface-2); }
.shift-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); }
.shift-pill.is-open { color: var(--good); background: var(--good-soft); } .shift-pill.is-open .dot { background: var(--good); box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 25%, transparent); }
.count-badge { min-width: 22px; height: 22px; border-radius: 11px; background: var(--roast); color: var(--roast-soft); font-size: 12px; display: inline-grid; place-items: center; padding: 0 6px; }
.save-warn { background: var(--bad-soft); color: var(--bad); border-radius: var(--r-sm); padding: 10px 14px; font-weight: 600; margin-bottom: 10px; }
.nav { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.nav-btn { display: inline-flex; align-items: center; gap: 8px; background: none; border: 0; border-bottom: 3px solid transparent; margin-bottom: -1px; padding: 12px 14px; font-weight: 600; color: var(--ink-2); cursor: pointer; white-space: nowrap; min-height: 48px; }
.nav-btn[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }

/* ---------- common ---------- */
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 8px 16px; min-height: 40px; font-weight: 600; cursor: pointer; }
.chip.is-active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.search { position: relative; display: flex; align-items: center; }
.search .i { position: absolute; left: 12px; color: var(--ink-3); pointer-events: none; }
.search input { min-height: 44px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); padding: 8px 14px 8px 38px; width: 260px; max-width: 100%; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field.inline { flex-direction: row; align-items: center; gap: 8px; }
.field.grow { flex: 1; }
.field input, .field select, .rline select, .rline input, .mgroup input, .mgroup select, .adj select, .adj input, .filters select {
  min-height: 44px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); padding: 8px 10px; width: 100%;
}
.field.inline input, .field.inline select { width: auto; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px 14px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; min-height: 40px; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 4px; gap: 4px; }
.seg button { border: 0; background: none; border-radius: 999px; padding: 8px 16px; min-height: 40px; font-weight: 600; color: var(--ink-2); cursor: pointer; flex: 1; }
.seg button[aria-checked="true"], .seg button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.seg-wide { margin-bottom: 14px; }
.seg-field { border: 0; padding: 0; margin: 0; } .seg-field legend { font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); text-transform: capitalize; }
.badge.good { background: var(--good-soft); color: var(--good); } .badge.warn { background: var(--warn-soft); color: var(--warn); } .badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.t-sale { background: var(--roast-soft); color: var(--roast); } .badge.t-stock-in { background: var(--good-soft); color: var(--good); } .badge.t-refund { background: var(--accent-soft); color: var(--accent); }
.alert { display: flex; gap: 10px; border-radius: var(--r-md); padding: 10px 12px; font-size: 13px; }
.alert div { display: flex; flex-direction: column; gap: 2px; }
.alert-warn { background: var(--warn-soft); color: var(--warn); } .alert-bad { background: var(--bad-soft); color: var(--bad); }
.card-block { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; }
.block-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.card-block .table-wrap { border: 0; border-radius: 0; }
.table { width: 100%; border-collapse: collapse; min-width: 640px; }
.card-block .table { min-width: 0; }
.table th, .table td { padding: 11px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.table th { font-size: 12px; font-weight: 600; color: var(--ink-3); background: var(--surface-2); white-space: nowrap; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .sub { display: block; font-size: 12px; color: var(--ink-3); }
.row-link { cursor: pointer; } .row-link:hover td { background: var(--surface-2); }
.row-acts { text-align: right; white-space: nowrap; }
tr.is-inactive td { opacity: .6; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 10px; color: var(--ink-2); font-size: 14px; flex-wrap: wrap; }
.pager div { display: flex; align-items: center; gap: 10px; }

/* ---------- register ---------- */
.register { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; align-items: start; }
.catalog { position: relative; min-height: 60vh; }
.catalog-bar { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tile {
  position: relative; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px; min-height: 108px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 10px; cursor: pointer; box-shadow: var(--shadow); transition: transform .08s, border-color .15s;
}
.tile:hover { border-color: var(--accent); } .tile:active { transform: scale(.98); }
.tile:disabled { cursor: not-allowed; opacity: .55; }
.tile-name { font-family: var(--font-display); font-weight: 600; font-size: 17px; line-height: 1.2; }
.tile-foot { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.tile-price { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--accent); }
.tile-opts { font-size: 11px; font-weight: 700; color: var(--roast); background: var(--roast-soft); border-radius: 6px; padding: 2px 6px; }
.tile.s-out { border-style: dashed; }
.stock-badge { font-size: 11px; font-weight: 700; border-radius: 6px; padding: 2px 6px; }
.stock-badge.low { background: var(--warn-soft); color: var(--warn); } .stock-badge.out { background: var(--bad-soft); color: var(--bad); }
.catalog.is-locked .tiles { filter: blur(1.5px); opacity: .5; pointer-events: none; }
.open-shift { position: absolute; inset: 0; display: flex; align-items: flex-start; justify-content: center; padding-top: 60px; }
.open-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 24px; width: min(420px, 100%); display: flex; flex-direction: column; gap: 14px; box-shadow: 0 30px 60px -30px rgba(0,0,0,.4); }
.open-card p { margin: 0; color: var(--ink-2); }

.cart { position: sticky; top: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; display: flex; flex-direction: column; gap: 12px; max-height: calc(100vh - 24px); box-shadow: var(--shadow); }
.cart-head { display: flex; justify-content: space-between; align-items: center; }
.cart-close { display: none; }
.cart .seg { width: 100%; }
.cart-empty { text-align: center; color: var(--ink-3); padding: 24px 8px; }
.cart-empty .i { width: 32px; height: 32px; }
.clines { list-style: none; margin: 0; padding: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; min-height: 60px; }
.cline { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.cline-main { display: flex; flex-direction: column; min-width: 0; }
.cline-name { font-weight: 700; }
.cline-opts, .cline-unit { font-size: 12px; color: var(--ink-3); }
.cline-note { font-size: 12px; color: var(--roast); font-style: italic; }
.cline-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.cline-total { font-weight: 700; font-variant-numeric: tabular-nums; }
.cline-acts { display: flex; }
.cline-acts .mini { min-height: 28px; padding: 2px 6px; font-size: 12px; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; }
.stepper button { width: 36px; height: 36px; border: 0; background: none; cursor: pointer; display: grid; place-items: center; border-radius: 50%; }
.stepper span { min-width: 26px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.stepper-lg button { width: 48px; height: 48px; } .stepper-lg span { min-width: 36px; font-size: 18px; }
.totals { display: flex; flex-direction: column; gap: 4px; border-top: 1px solid var(--line); padding-top: 10px; font-size: 14px; }
.totals > div { display: flex; justify-content: space-between; align-items: center; }
.totals b { font-variant-numeric: tabular-nums; }
.totals small { color: var(--ink-3); }
.totals .grand { font-family: var(--font-display); font-size: 24px; font-weight: 800; margin-top: 4px; }
.cart-actions { display: grid; grid-template-columns: auto auto 1fr; gap: 8px; }
.btn-pay { min-height: 56px; font-size: 17px; border-radius: var(--r-md); }
.cart-bar { display: none; }

/* ---------- dialogs ---------- */
.overlay { position: fixed; inset: 0; background: rgba(10, 16, 12, .5); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50; }
.dialog { background: var(--surface); border-radius: var(--r-lg); width: min(560px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; box-shadow: 0 30px 60px -20px rgba(0,0,0,.45); }
.dialog-wide { width: min(880px, 100%); } .dialog-small { width: min(440px, 100%); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px 6px; gap: 10px; }
.dialog-head h2 { font-size: 22px; }
.dialog-body { padding: 10px 20px 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.dialog-body p { margin: 0; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.dialog-foot:empty { display: none; }
.opt-group { border: 0; margin: 0; padding: 0; }
.opt-group legend { font-weight: 700; margin-bottom: 8px; } .opt-group legend small { color: var(--ink-3); font-weight: 500; }
.opt-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.opt { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px 12px; min-height: 48px; cursor: pointer; }
.opt input { accent-color: var(--accent); width: 18px; height: 18px; }
.opt em { margin-left: auto; font-style: normal; font-size: 13px; color: var(--ink-3); }
.opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.picker-foot { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.picker-price { color: var(--ink-2); } .picker-price b { color: var(--ink); font-variant-numeric: tabular-nums; }
.pay-total { display: flex; justify-content: space-between; align-items: baseline; background: var(--surface-2); border-radius: var(--r-md); padding: 14px 16px; }
.pay-total b { font-family: var(--font-display); font-size: 34px; font-variant-numeric: tabular-nums; }
.pms { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.pm { border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-md); min-height: 56px; font-weight: 700; cursor: pointer; padding: 8px; }
.pm.is-active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.quick button { min-height: 48px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); font-weight: 700; cursor: pointer; font-variant-numeric: tabular-nums; }
.change { font-size: 16px; color: var(--ink-2); } .change b { font-family: var(--font-display); font-size: 26px; color: var(--ink); }
.success { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 0; }
.success > .i { width: 54px; height: 54px; color: var(--accent-ink); background: var(--accent); border-radius: 50%; padding: 12px; stroke-width: 3; }
.change-big { font-family: var(--font-display); font-size: 22px; } .change-big b { font-size: 34px; }
.held-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.held-list li { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center; border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px 12px; }
.held-list li div:first-child { display: flex; flex-direction: column; } .held-list span { font-size: 13px; color: var(--ink-3); }
.sum-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
.sum-grid > div { background: var(--surface-2); border-radius: var(--r-sm); padding: 8px 10px; display: flex; flex-direction: column; }
.sum-grid span { font-size: 12px; color: var(--ink-3); } .sum-grid b { font-variant-numeric: tabular-nums; }
.sum-grid .hl { background: var(--accent-soft); }
.diff-box { background: var(--surface-2); border-radius: var(--r-sm); padding: 8px 12px; display: flex; flex-direction: column; justify-content: center; }
.diff-box span { font-size: 12px; color: var(--ink-3); } .diff-box b { font-family: var(--font-display); font-size: 22px; }
.receipt-preview { background: var(--surface-2); border-radius: var(--r-md); padding: 16px; display: flex; justify-content: center; overflow-x: auto; }
.receipt-preview .receipt { background: #fff; color: #111; padding: 14px 12px; box-shadow: var(--shadow); }
.used { margin: 0; padding-left: 20px; }

/* product editor */
.sub-block { border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.rline, .adj { display: grid; grid-template-columns: minmax(0, 1fr) 100px 96px 44px; gap: 8px; align-items: center; }
.mgroup { border: 1px dashed var(--line); border-radius: var(--r-md); padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.mgroup-head { display: grid; grid-template-columns: minmax(0, 1fr) 150px auto 44px; gap: 8px; align-items: center; }
.mopt { background: var(--surface-2); border-radius: var(--r-sm); padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.mopt-row { display: grid; grid-template-columns: minmax(0, 1fr) auto 44px; gap: 8px; align-items: center; }
.mopt-row .field.inline input { width: 90px; }
.adjs { display: flex; flex-direction: column; gap: 6px; padding-left: 10px; border-left: 2px solid var(--line); }
.live { display: flex; gap: 24px; background: var(--accent-soft); border-radius: var(--r-md); padding: 10px 14px; }
.live b { font-family: var(--font-display); font-size: 20px; font-variant-numeric: tabular-nums; }
.mini-label { display: block; font-size: 12px; color: var(--ink-2); }

/* menu, stock, reports, settings */
.cat-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.cat-chip { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line); border-radius: 999px; padding: 2px 4px 2px 14px; font-weight: 600; }
.cat-chip small { color: var(--ink-3); margin-right: 4px; }
.menu-group { margin-bottom: 18px; } .menu-group h2 { margin-bottom: 8px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px; display: flex; flex-direction: column; gap: 2px; }
.kpi:first-child { background: var(--roast); border-color: var(--roast); color: var(--roast-soft); }
.kpi span, .kpi small { font-size: 13px; color: inherit; opacity: .75; }
.kpi:not(:first-child) span, .kpi:not(:first-child) small { color: var(--ink-3); opacity: 1; }
.kpi b { font-family: var(--font-display); font-size: 26px; font-variant-numeric: tabular-nums; }
.chart-wrap { overflow-x: auto; }
.chart { width: 100%; min-width: 520px; height: auto; display: block; }
.chart .bar { fill: var(--accent); } .chart .bar:hover { fill: var(--roast); }
.chart .axis { fill: var(--ink-3); font-size: 11px; font-family: var(--font-body); }
.chart .base { stroke: var(--line); }
.rep-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; }
.settings { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 14px; align-items: start; }
.settings .card-block { margin: 0; }
.pm-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.pm-list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); font-weight: 600; }

/* ---------- toast ---------- */
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 20px); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-weight: 600; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 100; max-width: calc(100% - 32px); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); } .toast.bad { background: var(--bad); color: #fff; }

/* ---------- receipt (screen preview + print) ---------- */
.receipt { font-family: var(--font-mono); font-size: 12px; line-height: 1.45; width: 72mm; }
.receipt.w-58mm { width: 52mm; font-size: 11px; }
.receipt p { margin: 0; }
.receipt hr { border: 0; border-top: 1px dashed #555; margin: 6px 0; }
.r-biz { text-align: center; font-weight: 700; font-size: 1.3em; }
.r-c { text-align: center; }
.r-reprint { text-align: center; font-weight: 700; margin-bottom: 4px !important; }
.r-line { display: flex; justify-content: space-between; gap: 8px; }
.r-line span:last-child { white-space: nowrap; }
.r-opt { padding-left: 12px; color: #444; }
.r-total { font-weight: 700; font-size: 1.2em; }
.r-refund { text-align: center; font-weight: 700; }
.print-area { display: none; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) { .register { grid-template-columns: minmax(0, 1fr) 340px; } .rep-grid { grid-template-columns: 1fr; } }
@media (max-width: 820px) {
  .app { padding: 10px 12px calc(84px + env(safe-area-inset-bottom, 0px)); }
  .hide-sm { display: none; }
  .nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--line); border-bottom: 0; margin: 0; padding: 4px 4px env(safe-area-inset-bottom, 0px); justify-content: space-around; }
  .nav-btn { flex-direction: column; gap: 2px; font-size: 11px; padding: 6px 4px; border-bottom: 0; border-top: 3px solid transparent; min-height: 56px; flex: 1; }
  .nav-btn[aria-current="page"] { border-top-color: var(--accent); border-bottom-color: transparent; }
  .register { grid-template-columns: 1fr; }
  .cart { position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 40; max-height: 88vh; border-radius: var(--r-lg) var(--r-lg) 0 0; transform: translateY(105%); transition: transform .25s; padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
  body.cart-open .cart { transform: none; }
  body.cart-open::after { content: ""; position: fixed; inset: 0; background: rgba(10,16,12,.45); z-index: 35; }
  .cart-close { display: inline-flex; }
  .cart-bar { display: flex; position: fixed; left: 12px; right: 12px; bottom: calc(70px + env(safe-area-inset-bottom, 0px)); z-index: 31; align-items: center; gap: 10px; background: var(--accent); color: var(--accent-ink); border: 0; border-radius: var(--r-md); min-height: 54px; padding: 0 16px; font-weight: 700; cursor: pointer; box-shadow: 0 10px 30px -10px rgba(0,0,0,.5); }
  .cart-bar b { margin-left: auto; font-variant-numeric: tabular-nums; }
  [data-tab]:not([data-tab="register"]) ~ .cart-bar, .view:not([data-tab="register"]) .cart-bar { display: none; }
  .tiles { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .search input { width: 100%; } .catalog-bar .search { flex: 1 1 100%; }
  .overlay { padding: 0; align-items: stretch; }
  .dialog, .dialog-wide { width: 100%; max-height: none; height: 100%; border-radius: 0; }
  .dialog-small { height: auto; margin: auto 14px; border-radius: var(--r-lg); }
  .rline, .adj { grid-template-columns: 1fr 1fr 44px; } .rline select:first-child, .adj select:first-child { grid-column: 1 / -1; }
  .mgroup-head { grid-template-columns: 1fr 44px; } .mgroup-head select, .mgroup-head .check { grid-column: 1 / -1; }
  .settings { grid-template-columns: 1fr; }
  .header { padding-bottom: 8px; } .brand-name { font-size: 22px; }
  .toast { top: calc(12px + env(safe-area-inset-top, 0px)); bottom: auto; transform: translate(-50%, -20px); }
  .toast.show { transform: translate(-50%, 0); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }

/* ---------- print ---------- */
@media print {
  body { background: #fff !important; color: #111 !important; }
  .app, #dialogs, .toast { display: none !important; }
  .print-area { display: block !important; }
  body.print-receipt .receipt { width: 100%; color: #000; }
  .print-doc { font-family: var(--font-body); color: #111; }
  .print-doc h1 { font-size: 22pt; } .print-doc > p { margin: 2pt 0 12pt; color: #555; }
  .print-doc .sum-grid { grid-template-columns: repeat(3, 1fr); }
  .print-doc .sum-grid > div { background: #f2f4f2; }
  .print-doc .table { min-width: 0; width: 100%; } .print-doc .table td { padding: 4pt 6pt; border-bottom: 1px solid #ccc; }
  tr, .sum-grid > div { break-inside: avoid; }
}
