/* Shop app styles. Colours, fonts, radii and shadows come from tokens.css, never written here.
   Layout: phone = one column + bottom bar; laptop (>=900px) = left sidebar + wide dashboard grid. */
* { box-sizing: border-box; }
html, body { height: 100%; }

/* ---- Shared control look: every text box, search bar, dropdown button, date box and
   square icon button uses the same height, corner, border, background and focus ring. ---- */
.field input, .field select, .field textarea, .search, .picker-btn, .inline-input, .range-row input[type="date"], .dir-btn {
  min-height: var(--control-h); border-radius: var(--control-radius); border: 1px solid var(--control-line);
  background: var(--control-bg); color: var(--control-ink);
}
.field input::placeholder, .field textarea::placeholder, .search input::placeholder, .inline-input::placeholder, .picker-search input::placeholder { color: var(--control-placeholder); }
.field input:focus, .field select:focus, .field textarea:focus, .inline-input:focus, .range-row input[type="date"]:focus, .search:focus-within, .picker-btn:focus-visible, .dir-btn:focus-visible {
  outline: none; border-color: var(--control-focus); box-shadow: var(--focus-ring);
}
.pay-type .inline-input, .range-row input[type="date"] { min-height: var(--control-h-sm); }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 15px; line-height: 1.45; font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
/* No double-tap zoom: quick taps (like "1 1" on the PIN pad) register as two taps. Pinch zoom still works. */
html, body, button, a, input, select, textarea, label { touch-action: manipulation; }
button { -webkit-tap-highlight-color: transparent; -webkit-user-select: none; user-select: none; }
/* iPhones zoom in on any text box under 16px when it's tapped, so phones get 16px. */
@media (pointer: coarse) { input, select, textarea, .inline-input, .search input, .connect input { font-size: 16px !important; } }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { margin: 0; font-weight: 400; text-wrap: balance; }
.display { font-family: var(--font-display); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Demo strip */
.demo-strip { background: var(--warn-bg); color: var(--warn); font-size: 12px; font-weight: 600; text-align: center; padding-block: 6px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }

/* Sign-in */
.signin { min-height: 100%; background: var(--brand-dark); color: var(--brand-dark-ink); display: flex; align-items: center; justify-content: center; padding-block: 32px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.signin-box { width: 100%; max-width: 360px; display: flex; flex-direction: column; align-items: center; gap: 20px; }
.signin h1 { font-family: var(--font-display); font-size: 42px; line-height: 1; }
/* Shop logos */
.shop-logo { display: inline-flex; align-items: center; justify-content: center; flex: none; color: var(--accent); }
.shop-logo svg { width: 100%; height: 100%; }
.brand .shop-logo { width: 26px; height: 26px; margin-right: 8px; vertical-align: -3px; }
.brand { display: inline-flex; align-items: center; }
.shop-logo.big { width: 64px; height: 64px; border-radius: 20px; background: var(--pin-glow); color: var(--pin-on); padding: 12px; margin-bottom: -8px; }
.shop-logo.small { width: 18px; height: 18px; margin-right: 6px; vertical-align: -3px; }
.seg button .shop-logo.small { color: inherit; }
.shop-logo.tiny { width: 14px; height: 14px; }
.switch-hint .shop-logo.tiny { color: inherit; }
.switch-hint .switch-to { display: inline-flex; align-items: center; gap: 3px; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; padding: 4px; border-radius: var(--r-md); background: var(--surface-2); width: 100%; }
.seg button { min-height: 40px; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--muted); font-weight: 600; font-size: 14px; }
.seg button[aria-pressed="true"] { background: var(--seg-on); color: var(--ink); box-shadow: var(--shadow); }
.signin .seg { background: var(--on-dark-fill); }
.signin .seg button { color: var(--brand-dark-muted); }
.signin .seg button[aria-pressed="true"] { background: var(--brand-dark-ink); color: var(--brand-dark); }
.pin-dots { display: flex; gap: 14px; }
.pin-dots span { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--brand-dark-muted); }
.pin-dots span.on { background: var(--pin-on); border-color: var(--pin-on); }
.pin-err { min-height: 20px; color: var(--pin-on); font-size: 14px; font-weight: 600; }
.keypad { display: grid; grid-template-columns: repeat(3, 72px); gap: 14px 24px; }
.keypad button { width: 72px; height: 72px; border-radius: 50%; border: 0; background: var(--on-dark-fill); color: var(--brand-dark-ink); font-size: 26px; }
.keypad button.ghost { background: transparent; font-size: 16px; }
.signin-hint { font-size: 12px; color: var(--brand-dark-muted); text-align: center; max-width: 300px; }

/* App shell */
.shell { min-height: 100%; display: flex; flex-direction: column; }
.sidebar { display: none; }
/* Phone header: its own band (card colour + hairline) that stays at the top while scrolling.
   The top padding clears the iPhone status bar when the app is opened from the home screen. */
.topbar { position: sticky; top: 0; z-index: 15; padding-block: calc(8px + env(safe-area-inset-top, 0px)) 8px; background: var(--chrome); border-bottom: 1px solid var(--chrome-line); box-shadow: var(--shadow-bar); margin-bottom: 10px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.brand { font-family: var(--font-display); font-size: 26px; line-height: 1.05; }
.brand-sub { font-size: 12px; color: var(--muted); }
.main { flex: 1 1 auto; width: 100%; max-width: 1240px; margin: 0 auto; padding-block: 4px 112px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); display: flex; flex-direction: column; gap: 14px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-head h1 { font-family: var(--font-display); font-size: 30px; line-height: 1.05; }
.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--chrome); border-top: 1px solid var(--chrome-line); display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); padding-top: 6px; padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px)); padding-left: max(6px, env(safe-area-inset-left, 0px)); padding-right: max(6px, env(safe-area-inset-right, 0px)); }
.nav-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 48px; border: 0; background: transparent; color: var(--muted); font-size: 11px; font-weight: 600; }
.nav-btn[aria-current="page"] { color: var(--accent); }
.nav-btn svg { width: 22px; height: 22px; }
.nav-btn.sell .fab { width: 48px; height: 48px; margin-top: -24px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-fab); }
.nav-btn.sell { color: var(--ink); }

@media (min-width: 900px) {
  .shell { flex-direction: row; }
  .sidebar { display: flex; flex-direction: column; gap: 6px; width: 236px; flex: none; position: sticky; top: 0; height: 100vh; padding: 26px 16px 20px max(16px, env(safe-area-inset-left, 0px)); border-right: 1px solid var(--chrome-line); background: var(--chrome); }
  .sidebar .brand-switch { margin-bottom: 12px; }
  .side-link { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: var(--r-sm); border: 0; background: transparent; color: var(--muted); font-weight: 600; font-size: 14px; text-align: left; }
  .side-link svg { width: 20px; height: 20px; }
  .side-link[aria-current="page"] { background: var(--chrome-on); color: var(--accent); }
  .side-sell { margin: 10px 0; min-height: 48px; border-radius: var(--r-md); border: 0; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 15px; display: flex; align-items: center; justify-content: center; gap: 8px; }
  .side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 4px; padding: 12px 0 calc(16px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
  .topbar, .bottom-nav { display: none; }
  .content { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
  .main { padding-block: 28px 48px; padding-left: 32px; padding-right: max(32px, env(safe-area-inset-right, 0px)); gap: 18px; }
}
.content { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

/* Controls */
.btn { min-height: var(--btn-h); padding: 0 16px; border-radius: var(--btn-radius); border: 1px solid var(--control-line); background: var(--control-bg); color: var(--control-ink); font-weight: 600; font-size: var(--fs-md); display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn { white-space: nowrap; }
.btn svg, .side-sell svg { width: 18px; height: 18px; flex: none; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.dark { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.danger { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.btn.block { width: 100%; min-height: var(--btn-h-lg); font-size: var(--fs-input); border-radius: var(--control-radius); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.link-btn { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 700; font-size: 13px; min-height: 32px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { min-height: var(--chip-h); padding: 0 14px; border-radius: var(--pill-radius); border: 1px solid var(--control-line); background: var(--control-bg); font-size: 13px; font-weight: 600; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip .count { opacity: 0.7; margin-left: 4px; }
.search { display: flex; align-items: center; gap: 8px; padding: 0 var(--control-pad-x); flex: none; min-width: 0; }
.toolbar .search { flex: 1 1 220px; }
.search input { flex: 1 1 auto; min-width: 0; border: 0; outline: none; background: transparent; font-size: var(--fs-input); color: inherit; }
.search svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
/* Inventory: search, then Show + Sort + direction (one row on wide screens). */
.toolbar.inv { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
@media (min-width: 900px) { .toolbar.inv { grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); } }
.inv-filters { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 46px; gap: 8px; align-items: stretch; }
.inv-filters .picker-text b { font-size: 14px; }
.inv-filters .picker-btn { padding-left: 12px; gap: 6px; }
/* Narrow phones: the sort box shows just the choice ("Last stocked"); its label is read out. */
@media (max-width: 480px) { #stock-sort .picker-prefix { display: none; } }
.dir-btn { width: var(--control-h); height: 100%; display: inline-flex; align-items: center; justify-content: center; }
.dir-btn svg { width: 20px; height: 20px; }
.row-when { font-size: 12px; color: var(--muted); }
/* Inventory history: its own view in the product window. The window stays put; only the list scrolls. */
.sheet.sheet-locked { height: var(--sheet-lock); }
.hist-scroll { max-height: var(--hist-h); overflow-y: auto; overscroll-behavior: contain; margin: 0 -4px; padding: 0 4px; border-radius: var(--r-sm); }
.sheet-locked .hist-scroll { flex: 1 1 auto; min-height: 0; max-height: none; }
.hist-scroll:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.hist-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.hist-list li { display: flex; flex-direction: column; gap: 2px; padding: 12px 0; border-top: 1px dotted var(--hist-divider); font-size: var(--fs-md); }
.hist-list li:first-child { border-top: 0; padding-top: 2px; }
.hist-list small { color: var(--muted); font-size: var(--fs-sm); }
/* Save and Remove side by side, so the edit window fits a phone screen without scrolling. */
.btn-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.btn-row .btn { min-height: var(--btn-h-lg); font-size: var(--fs-base); border-radius: var(--control-radius); }
/* Search and filter as two equal bars (stacked on phones). */
.toolbar.two { display: grid; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 700px) { .toolbar.two { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* Dropdown picker: looks like the app's fields; opens a card-style list under it. */
.picker { position: relative; min-width: 0; }
.picker-btn { width: 100%; display: flex; align-items: center; gap: 10px; padding: 6px 12px 6px var(--control-pad-x); text-align: left; font-weight: 400; }
.field .picker-btn { min-height: calc(var(--control-h) + 4px); } /* room for the product photo */
.picker-btn > svg { width: 18px; height: 18px; flex: none; color: var(--muted); margin-left: auto; transition: transform 0.15s; }
.picker.open .picker-btn { border-color: var(--control-focus); box-shadow: var(--focus-ring); }
.picker.open .picker-btn > svg { transform: rotate(180deg); }
.picker-text { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; line-height: 1.25; }
.picker-text b { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.picker-text small { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.picker-placeholder { color: var(--muted); font-size: 15px; }
.picker-meta { flex: none; font-size: 13px; font-weight: 600; color: var(--muted); }
.picker-panel { position: absolute; z-index: 40; top: calc(100% + 6px); left: 0; right: 0; background: var(--pop-bg); border: 1px solid var(--pop-line); border-radius: var(--pop-radius); box-shadow: var(--pop-shadow); overflow: hidden; }
.picker-search { display: flex; align-items: center; gap: 8px; padding: 0 12px; min-height: var(--control-h); border-bottom: 1px solid var(--pop-line); }
.picker-search svg { width: 17px; height: 17px; color: var(--muted); flex: none; }
.picker-search input, .field .picker-search input { flex: 1 1 auto; min-width: 0; min-height: var(--control-h-sm); padding: 0; border: 0; border-radius: 0; outline: none; background: transparent; font-size: var(--fs-input); box-shadow: none; }
/* About 5 rows tall; the rest scroll inside the list. */
.picker-list { list-style: none; margin: 0; padding: 4px; max-height: 292px; overflow-y: auto; overscroll-behavior: contain; }
.picker-opt { width: 100%; min-height: var(--option-h); display: flex; align-items: center; gap: 10px; padding: 6px 10px; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--ink); text-align: left; }
.picker-opt:hover, .picker-opt:focus-visible { background: var(--option-hover); }
li[aria-selected="true"] > .picker-opt { background: var(--option-selected); }
.picker-tick { width: 18px; flex: none; color: var(--accent); display: inline-flex; }
.picker-tick svg { width: 18px; height: 18px; }
.picker-empty { padding: 16px 12px; color: var(--muted); font-size: 14px; }
.thumb.sm { width: 40px; height: 40px; border-radius: 9px; }
.thumb.sm svg { width: 18px; height: 18px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; }
.field input, .field select, .field textarea { padding: 10px var(--control-pad-x); font-size: var(--fs-input); font-weight: 400; }
.field textarea { resize: vertical; min-height: 72px; }
.field .hint { font-weight: 400; font-size: 12px; color: var(--muted); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }

/* Cards */
.card { background: var(--card-bg); border-radius: var(--card-radius); padding: var(--card-pad); display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.card h2 { font-family: var(--font-display); font-size: 20px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }

/* Dashboard */
.dash { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.kpi { background: var(--card-bg); border-radius: var(--card-radius-sm); padding: 14px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.kpi .label { font-size: 12px; color: var(--muted); }
.kpi .value { font-size: 22px; font-weight: 700; line-height: 1.2; }
.kpi .value.good { color: var(--good); }
.kpi .sub { font-size: 11px; color: var(--muted); }
.meter { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--good); }
.hero { background: var(--hero); border: 1px solid var(--hero-edge); color: var(--hero-ink); border-radius: 22px; padding: 20px 18px 14px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.hero .eyebrow { font-size: 12px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--hero-muted); }
.hero .big { font-family: var(--font-display); font-size: 44px; line-height: 1; }
.hero .vs { font-size: 12px; color: var(--hero-muted); }
.delta { padding: 5px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; align-self: flex-start; }
.delta.up { background: var(--delta-up-bg); color: var(--delta-up); }
.delta.down { background: var(--delta-down-bg); color: var(--delta-down); }
.delta.flat { background: var(--delta-flat); color: var(--hero-ink); }
.chart { position: relative; height: 150px; display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 6px; }
.chart .yaxis { position: relative; font-size: 10px; color: var(--hero-muted); }
.chart .yaxis span { position: absolute; right: 0; transform: translateY(-50%); }
.at-top { top: 0; } .at-mid { top: 50%; } .at-bottom { top: 100%; }
.chart .plot { position: relative; border-bottom: 1px solid var(--hero-line); }
.chart .grid-line { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--hero-line); }
.chart .bars { position: absolute; inset: 0; display: flex; align-items: flex-end; gap: 3px; }
.chart .line { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.chart .line .area { fill: var(--bar); opacity: 0.45; }
.chart .line .stroke { fill: none; stroke: var(--bar-hi); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.chart .dot { position: absolute; width: 7px; height: 7px; border-radius: 50%; background: var(--bar-hi); transform: translate(-50%, -50%); box-shadow: 0 0 0 2px var(--hero); pointer-events: none; }
.chart .dot.hi { width: 10px; height: 10px; }
.chart .hits { position: absolute; inset: 0; display: flex; }
.chart .hits span { flex: 1 1 0; }
.chart .hits span:hover { background: linear-gradient(to right, transparent calc(50% - 0.5px), var(--hero-line) calc(50% - 0.5px), var(--hero-line) calc(50% + 0.5px), transparent calc(50% + 0.5px)); }
/* Shop name at the top of the menu: tap to switch shops */
.brand-switch { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; border: 0; background: transparent; padding: 6px 10px 10px; margin: -6px 0 6px; border-radius: var(--r-md); text-align: left; color: inherit; min-width: 0; }
button.brand-switch:hover, button.brand-switch:focus-visible { background: var(--surface-2); }
.brand-switch .switch-hint { display: inline-flex; align-items: center; gap: 5px; line-height: 1; margin-top: 6px; font-size: 12px; font-weight: 700; color: var(--accent); }
.brand-switch .switch-hint svg { width: 14px; height: 14px; }
.topbar .brand-switch { padding: 4px 8px; margin: -4px -8px; }
.topbar .brand-switch .switch-hint { margin-top: 2px; }
.inline-input { width: 100%; padding: 6px 12px; font-size: var(--fs-input); font-weight: 600; }
.inline-input:disabled { color: var(--muted); background: transparent; border-style: dashed; }
/* Payment types: name box and its button on one line, same height; a note only when switched off. */
.pay-types { display: flex; flex-direction: column; gap: 8px; }
.pay-type { display: grid; grid-template-columns: minmax(0, 1fr) 52px; align-items: center; gap: 4px 10px; }
/* "Add a ___" rows use the same two columns as the payment types: field, then a 52px action. */
.add-row { display: grid; grid-template-columns: minmax(0, 1fr) 52px; align-items: end; gap: 10px; }
.add-row .inline-input, .add-row .field input { min-height: 44px; }
/* iPhone-style on/off switch */
.switch { position: relative; width: 52px; height: 32px; border-radius: 999px; border: 0; padding: 0; background: var(--line); transition: background 0.2s; justify-self: center; }
.switch i { position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: var(--knob); box-shadow: var(--shadow-knob); transition: transform 0.2s; }
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"] i { transform: translateX(20px); }
@media (prefers-reduced-motion: reduce) { .switch, .switch i { transition: none; } }
td.when { white-space: nowrap; font-variant-numeric: tabular-nums; }
#mail-err:empty { display: none; }
.pill.pay-custom { background: var(--surface-2); color: var(--ink); }
.xaxis { display: flex; justify-content: space-between; font-size: 11px; color: var(--hero-muted); padding-left: 50px; }
.split { display: flex; height: 14px; border-radius: 7px; overflow: hidden; gap: 2px; background: var(--surface-2); }
.legend { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; font-size: 13px; }
.legend .sw { width: 10px; height: 10px; border-radius: 2px; display: inline-block; margin-right: 6px; }
.legend b { display: block; font-size: 16px; }
.rank { display: flex; flex-direction: column; gap: 5px; }
.rank-row { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.rank-row span:first-child { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-bar { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.rank-bar > i { display: block; height: 100%; background: var(--cash); border-radius: 4px; }
.shelf { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.shelf div { background: var(--surface-2); border-radius: var(--r-sm); padding: 10px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.shelf div.pos { background: var(--good-bg); color: var(--good); }
.shelf span { font-size: 11px; color: var(--muted); }
.shelf div.pos span { color: var(--good); }
.shelf b { font-size: 15px; }
.counts { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; }
.count-btn { min-height: 56px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 11px; }
.count-btn b { font-size: 18px; }
.count-btn.low { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.count-btn.out { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.notice { background: var(--warn-bg); color: var(--warn); border-radius: var(--r-lg); padding: 14px 16px; display: flex; gap: 12px; font-size: 13px; }
.notice svg { width: 20px; height: 20px; flex: none; margin-top: 2px; }
.notice div { display: flex; flex-direction: column; gap: 4px; }
.notice .link-btn { color: var(--warn); align-self: flex-start; }
.staff-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 14px; padding-top: 8px; border-top: 1px solid var(--surface-2); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--surface-2); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; margin-right: 10px; flex: none; }
@media (min-width: 640px) { .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1100px) {
  .dash { grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
  .dash > .hero { grid-column: span 8; }
  .dash > .side-stack { grid-column: span 4; }
  .dash > .kpis { grid-column: span 12; }
  .dash > .w4 { grid-column: span 4; }
  .dash > .w6 { grid-column: span 6; }
  .dash > .w12 { grid-column: span 12; }
  .chart { height: 220px; }
}
@media (min-width: 1100px) { .dash > .hero { order: 1; } .dash > .side-stack { order: 2; } .dash > .kpis { order: 3; } .dash > .w4 { order: 4; } }
.side-stack { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.period-box { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.period-box.period-top { max-width: 460px; }
.period-box.period-side { display: none; }
@media (min-width: 1100px) { .period-box.period-top { display: none; } .period-box.period-side { display: flex; } }
/* Calendar button at the end of the period switch: narrower than the text buttons. */
.seg.period-seg { grid-template-columns: repeat(4, minmax(0, 1fr)) 44px; grid-auto-flow: row; }
.seg.period-seg button { white-space: nowrap; font-size: 13px; padding: 0 4px; }
.seg .seg-icon { display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.seg .seg-icon svg { width: 18px; height: 18px; }
.range-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.range-row input[type="date"] { padding: 6px 12px; font-size: var(--fs-input); width: 100%; min-width: 0; -webkit-appearance: none; appearance: none; }

/* Stock list */
.list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
@media (max-width: 420px) { .list { grid-template-columns: minmax(0, 1fr); } }
.row { background: var(--card-bg); border-radius: var(--card-radius); padding: var(--item-pad); display: flex; gap: 12px; align-items: center; min-width: 0; }
.thumb { width: 60px; height: 60px; border-radius: 12px; flex: none; display: flex; align-items: center; justify-content: center; color: var(--on-photo); overflow: hidden; }
.thumb { position: relative; }
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.thumb svg { width: 26px; height: 26px; }
.row-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 4px; border: 0; background: none; padding: 0; text-align: left; }
.row-title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub { font-size: 12px; color: var(--muted); }
.stockbar { display: flex; align-items: center; gap: 8px; }
.stockbar .track { flex: 1 1 auto; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.stockbar .track i { display: block; height: 100%; }
.stockbar b { font-size: 12px; white-space: nowrap; }
.tone-ok { color: var(--good); } .tone-low { color: var(--warn); } .tone-out { color: var(--bad); }
.fill-ok { background: var(--good); } .fill-low { background: var(--fill-low); } .fill-out { background: var(--bad); }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.tile { background: var(--card-bg); border-radius: var(--card-radius-sm); overflow: hidden; border: 0; padding: 0; text-align: left; display: flex; flex-direction: column; min-width: 0; }
.tile .pic { height: 120px; display: flex; align-items: flex-end; justify-content: flex-end; padding: 8px; position: relative; }
.tile .pic img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tile .pic svg { position: absolute; inset: 0; margin: auto; width: 34px; height: 34px; color: var(--on-photo); }
.tile.out .pic { opacity: 0.45; }
.badge { position: relative; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--badge-bg); color: var(--badge-ink); }
.badge.low { background: var(--badge-low-bg); color: var(--badge-low); } .badge.out { background: var(--badge-out-bg); color: var(--badge-out); }
.badge.nfs { background: var(--badge-nfs-bg); color: var(--badge-nfs); }
.tile .meta { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 2px; }
.tile .meta b { font-size: 14px; font-weight: 600; line-height: 1.3; }
.tile .price { font-size: 15px; font-weight: 700; color: var(--accent); }
.empty { text-align: center; color: var(--muted); padding: 40px 16px; }

/* Sales table */
.table-wrap { background: var(--surface); border-radius: var(--r-lg); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--surface-2); white-space: nowrap; }
th { font-size: 12px; color: var(--muted); font-weight: 600; background: var(--surface); position: sticky; top: 0; }
td.num, th.num { text-align: right; }
tfoot td { font-weight: 700; border-bottom: 0; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill.cash, .pill.pay-cash { background: var(--accent-soft); color: var(--accent); }
.pill.pay-card { background: var(--surface-2); color: var(--card); }
.pill.pay-qr { background: var(--surface-2); color: var(--qr); }
.pill.pay-legacy, .pill.pay-other, .pill.pay-unknown { background: var(--surface-2); color: var(--muted); }

/* Settings */
.set-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 56px; border-top: 1px solid var(--surface-2); }
.set-row:first-of-type { border-top: 0; }
.set-row > div { display: flex; flex-direction: column; min-width: 0; }
.set-row small { color: var(--muted); font-size: 12px; }
.name-chip { display: inline-flex; align-items: center; gap: 4px; min-height: 36px; padding: 0 6px 0 14px; border-radius: 999px; background: var(--surface-2); font-size: 14px; }
.name-chip button { width: 28px; height: 28px; border: 0; background: transparent; border-radius: 50%; color: var(--muted); }
.settings-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
/* Wide screens: two independent columns (access and data tools left, shop settings right),
   so a short card never leaves a gap under it. Phones: one list, Access and the shop
   settings first, then the data tools. */
.settings-col { display: contents; }
.settings-grid > .settings-col > .card.tool { order: 1; }
@media (min-width: 1000px) {
  .settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 16px; }
  .settings-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
  .settings-grid > .settings-col > .card.tool { order: 0; }
}

/* Sheet / dialog */
.overlay { position: fixed; inset: 0; z-index: 50; background: var(--scrim); display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 520px; max-height: 92%; overflow-y: auto; background: var(--bg); border-radius: 24px 24px 0 0; padding: 10px 20px calc(24px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 14px; }
/* Nothing in a sheet squeezes when it overflows (the grab handle would vanish and nudge the header). */
.sheet > * { flex-shrink: 0; }
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); align-self: center; }
.sheet-head { display: flex; align-items: center; gap: 12px; }
.sheet-head h2 { font-family: var(--font-display); font-size: 22px; flex: 1 1 auto; min-width: 0; }
.icon-btn { width: var(--icon-btn); height: var(--icon-btn); border-radius: 50%; border: 0; background: transparent; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn.add-btn { border: 1px solid var(--control-line); background: var(--control-bg); color: var(--control-ink); }
.icon-btn.add-btn.wide { width: var(--icon-btn-wide); border-radius: var(--pill-radius); }
.icon-btn.add-btn.danger { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.icon-btn.add-btn:disabled { opacity: 0.4; }
.icon-btn.add-btn.busy { opacity: 0.5; }
.set-row .icon-btn { margin-right: 4px; }
.confirm-actions.one { grid-template-columns: 1fr; }
.card p a { color: var(--accent); font-weight: 600; text-underline-offset: 2px; }
.topbar-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.brand-mini { display: flex; flex-direction: column; min-width: 0; }
.topbar .brand { font-size: 22px; white-space: nowrap; }
.topbar .brand .shop-logo { width: 22px; height: 22px; margin-right: 6px; }
.topbar-actions { display: flex; align-items: center; flex: none; }
.shop-pill { display: inline-flex; align-items: center; gap: 5px; min-height: 36px; padding: 0 12px 0 9px; margin-right: 2px; border-radius: 999px; border: 1px solid var(--chrome-line); background: transparent; color: var(--accent); font-size: 13px; font-weight: 700; white-space: nowrap; }
.shop-pill .shop-logo { width: 15px; height: 15px; }
/* On phones the data note sits inside the sticky header as one short line. */
.topbar .demo-strip { margin: 8px calc(-1 * max(16px, env(safe-area-inset-right, 0px))) -8px calc(-1 * max(16px, env(safe-area-inset-left, 0px))); padding-block: 4px; font-size: 11px; }
@media (max-width: 899px) { #app > .demo-strip { display: none; } }
@media (min-width: 700px) { .overlay { align-items: center; } .sheet { border-radius: 24px; max-height: 88%; } .sheet .grab { display: none; } }
.stepper { display: flex; align-items: center; justify-content: center; gap: 22px; }
.stepper button { width: 52px; height: 52px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); font-size: 24px; }
.stepper button.plus { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.stepper output { font-family: var(--font-display); font-size: 48px; min-width: 72px; text-align: center; line-height: 1; }
.stepper.compact { gap: 14px; }
.stepper.compact button { width: var(--icon-btn); height: var(--icon-btn); }
.stepper.compact output { font-size: 30px; min-width: 40px; }
.panel { background: var(--card-bg); border-radius: var(--card-radius); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.pick { display: flex; gap: 12px; align-items: center; }
.sum-row { display: flex; justify-content: space-between; font-size: 14px; }
.sum-row b { font-size: 18px; }

.overlay.confirm { z-index: 70; align-items: center; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.confirm-box { max-width: 420px; border-radius: 22px; padding: 22px 20px 20px; gap: 12px; }
.confirm-box h2 { font-family: var(--font-display); font-size: 22px; }
.confirm-icon { width: 40px; height: 40px; border-radius: 50%; background: var(--warn-bg); color: var(--warn); display: flex; align-items: center; justify-content: center; }
.confirm-icon.danger { background: var(--bad-bg); color: var(--bad); }
.confirm-icon svg { width: 20px; height: 20px; }
.confirm-text p { margin: 0 0 6px; }
.confirm-text .keep { color: var(--muted); font-size: 13px; }
.confirm-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 6px; }
.btn.danger-solid { background: var(--bad); color: var(--surface); border-color: var(--bad); }
.sheet:focus { outline: none; }
.demo-strip.live { background: var(--good-bg); color: var(--good); }
.demo-strip.real { background: var(--warn-bg); color: var(--warn); }
.pill.test { background: var(--warn-bg); color: var(--warn); font-size: 10px; letter-spacing: 0.5px; padding: 1px 6px; vertical-align: 1px; }
.pill.nfs { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); font-size: 10px; letter-spacing: 0.3px; padding: 0 6px; vertical-align: 1px; }
.state { text-align: center; padding: 64px 16px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.state h2 { font-size: 26px; }
.spinner { width: 32px; height: 32px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.connect { width: 100%; display: flex; flex-direction: column; gap: 12px; align-items: stretch; }
.connect input { min-height: var(--control-h); padding: 0 var(--control-pad-x); border-radius: var(--control-radius); border: 1px solid var(--on-dark-line); background: var(--on-dark-fill); color: var(--brand-dark-ink); font-size: 15px; }
.connect input::placeholder { color: var(--brand-dark-muted); }
.connect .btn.block { min-height: 50px; font-size: 15px; }
.connect .btn:not(.primary) { background: transparent; color: var(--brand-dark-ink); border: 1.5px solid var(--on-dark-outline); }
.connect .btn:not(.primary):hover { background: var(--on-dark-hover); }
.connect .pin-err { text-align: center; }
.preview-note { margin: 0; padding: 10px 12px; border-radius: var(--r-sm); background: var(--good-bg); color: var(--good); font-size: 13px; }
.check-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.updated { font-size: 12px; color: var(--muted); }
.toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 60; background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 12px; font-size: 14px; font-weight: 600; box-shadow: var(--shadow); max-width: calc(100% - 32px); }
@media (min-width: 900px) { .toast { bottom: 28px; } }

/* Small helpers used by the screens instead of inline styles */
.m0 { margin: 0; } .text-center { text-align: center; } .text-left { text-align: left; }
.text-bad { color: var(--bad); } .text-ink { color: var(--ink); } .fw-600 { font-weight: 600; }
.mw-none { max-width: none; } .break-all { word-break: break-all; } .items-center { align-items: center; }
.justify-center { justify-content: center; }
.side-updated { padding: 0 12px 4px 44px; }
.pin-prompt { color: var(--brand-dark-muted); font-size: var(--fs-md); }
.hero-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.hero-figure { display: flex; flex-direction: column; gap: 4px; }
.staff-name { display: flex; align-items: center; min-width: 0; }
.w-420 { max-width: 420px; } .w-520 { max-width: 520px; }
.form-card { max-width: 620px; }
.thumb.lg { width: 84px; height: 84px; } .thumb.empty { background: var(--surface-2); color: var(--muted); }
.table-wrap.inset { background: var(--surface-2); }
.sheet-title { flex: 1 1 auto; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }
