/* ── CONARTIST — PHONE MODE ──
   Every rule here is scoped to body.is-phone, which app.js sets from ONE media query
   ((max-width:640px) or a touch screen ≤500px tall — i.e. a phone, portrait or sideways).
   Keying off the class instead of repeating @media keeps "what is a phone" in one place and
   guarantees none of this reaches desktop or iPad. The phone is scoped to four jobs —
   stock counts, conventions, reports, paste orders — so most of this file HIDES things.
   Mark desktop-only controls with class="desk-only" rather than adding selectors here. */

  body.is-phone .desk-only { display: none !important; }
  /* …and the reverse: phone-only controls (e.g. Orders → 📋 Paste orders). */
  .phone-only { display: none !important; }
  body.is-phone .phone-only { display: revert !important; }
  /* Real phones only, not a narrowed computer window (body.phone-device, app.js) — e.g.
     Settings → This phone's POS and shake switches, which do nothing on a computer. */
  .phone-device-only { display: none !important; }
  body.phone-device .phone-device-only { display: revert !important; }

  /* POS is off on phones unless this device opts in (window.setPhonePOS(true)). */
  body.is-phone:not(.phone-pos) [data-tab="pos"] { display: none !important; }

  /* Bottom nav: account for the iPhone home-indicator inset so tabs aren't cramped and the
     last list row isn't hidden behind the bar. */
  body.is-phone {
    --tab-bar-height: calc(60px + env(safe-area-inset-bottom, 0px));
  }
  body.is-phone #bottom-nav { height: var(--tab-bar-height); }
  body.is-phone #main { padding-bottom: var(--tab-bar-height); }
  body.is-phone .tab-label { font-size: 9px; }

  /* Headers scroll away. Sticky headers full of controls left ~140px of a 844px screen
     for the actual list. */
  body.is-phone .page-header { position: static; padding: 16px 16px 12px; }
  body.is-phone .page-title { font-size: 24px; }
  body.is-phone .page-subtitle { display: none; }
  body.is-phone .screen-body { padding: 12px 16px; }

  /* Touch targets ≥44px (the old ≤640 rule shrank icon buttons to 28px). */
  body.is-phone .icon-btn { width: 44px; height: 44px; min-width: 44px; }
  body.is-phone .modal-close { width: 44px; height: 44px; min-width: 44px; min-height: 44px; box-sizing: border-box; flex-shrink: 0; }
  body.is-phone .modal-footer button { min-height: 44px; }
  /* Range / period toggles (Reports 7d–All + Week/Month, Conventions 30–90 days). */
  body.is-phone .con-win-btn { min-height: 44px; }
  body.is-phone .page-header-top .btn-primary { min-height: 44px; }

  /* Modals as bottom sheets. The same rules live in pos.css under @media (max-width:640px)
     for small non-phone windows; repeated here so a SIDEWAYS phone (844×390, wider than
     640) gets the sheet too instead of the desktop centred dialog with 64px gutters. */
  body.is-phone .modal { max-width: 100% !important; width: 100% !important; margin: 0 !important;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0; max-height: 92dvh; }
  body.is-phone .modal-overlay { align-items: flex-end; padding: 0; }
  /* An open sheet holds still: the page behind can't scroll, a drag on the backdrop /
     header / footer moves nothing, and the form's scroll stops at its ends instead of
     carrying on into the page (iOS dragged the whole sheet around). */
  html:has(body.is-phone .modal-overlay.open),
  body.is-phone:has(.modal-overlay.open),
  body.is-phone:has(.modal-overlay.open) #main { overflow: hidden !important; overscroll-behavior: none; }
  body.is-phone .modal-overlay { overscroll-behavior: contain; touch-action: none; }
  body.is-phone .modal-body { overscroll-behavior: contain; touch-action: pan-y; }
  body.is-phone .modal-header,
  body.is-phone .modal-body,
  body.is-phone .modal-footer { padding-left: 16px !important; padding-right: 16px !important; }
  /* Long product / con names wrap to two lines max instead of pushing ✕ off the sheet. */
  body.is-phone .modal-title {
    flex: 1; min-width: 0; overflow: hidden;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  }

  /* One column for every form — two columns truncated selects to "— pic" / "Austr". */
  body.is-phone .form-grid { grid-template-columns: 1fr !important; }
  /* Every child takes the one column: `.span2` / `grid-column: span 2` children would
     otherwise create an implicit second column and squeeze the rest into slivers. */
  body.is-phone .form-grid > * { min-width: 0; grid-column: 1 / -1 !important; }

  /* 16px inputs: iOS Safari zooms the whole page when focusing anything smaller. */
  body.is-phone input:not([type="checkbox"]):not([type="radio"]),
  body.is-phone select,
  body.is-phone textarea { font-size: 16px !important; }

  /* Overflow fixes found in the phone audit. */
  /* Reports card rows: always one card per row on a phone — including a sideways phone
     wider than the 641–900 rule that stacks them on iPad. */
  body.is-phone .sales-charts-row,
  body.is-phone .sales-bottom-row { flex-direction: column; flex-wrap: nowrap; }
  body.is-phone .settings-tab-bar { overflow-y: hidden; scrollbar-width: none; }
  body.is-phone .settings-tab-bar::-webkit-scrollbar { display: none; }

  /* ── REPORTS ── glanceable stats only (pages/sales.js rp*; desktop styles in components.css).
     Controls become selects, cards go 2-up, cards stack, every control is ≥44px, the
     drill-down and "Showing" picker are bottom sheets (the .modal rules above). */
  body.is-phone .rp-controls { gap: 8px; }
  body.is-phone .rp-prow { display: flex; gap: 8px; align-items: center; min-width: 0; }
  body.is-phone .rp-prow-wrap { flex-wrap: wrap; }
  body.is-phone .rp-pselect,
  body.is-phone .rp-con-select {
    flex: 1 1 0; min-width: 0; width: 100%; max-width: 100%; height: 44px; padding: 0 10px; box-sizing: border-box;
    border: 1px solid var(--border); border-radius: 10px; background: var(--bg-card); font-weight: 600; color: var(--text-primary);
    font-family: var(--font-body);
  }
  body.is-phone .rp-con-select { border: 2px solid var(--rp-con, var(--accent)); }
  body.is-phone .rp-seg button { height: 44px; min-width: 44px; padding: 0 10px; }
  body.is-phone .rp-chip { min-height: 44px; }
  body.is-phone .rp-con-pill { min-height: 44px; flex: 1 1 auto; min-width: 0; }
  body.is-phone .rp-custom { flex: 1; min-width: 0; }
  body.is-phone .rp-date { flex: 1; min-width: 0; height: 44px; }
  body.is-phone .rp-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  body.is-phone .rp-cards .stat-card { padding: 12px 14px; }
  body.is-phone .rp-cards .stat-card:nth-child(5) { grid-column: 1 / -1; }
  body.is-phone .rp-cards .stat-value { font-size: 20px; }
  body.is-phone .rp-cards.rp-cards-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  body.is-phone .rp-cards.rp-cards-3 .stat-card { padding: 10px; }
  body.is-phone .rp-cards.rp-cards-3 .stat-value { font-size: 17px; }
  body.is-phone .rp-cards.rp-cards-3 .rp-lbl-n { display: none; } /* "Per open hour" fits on one line */
  body.is-phone .rp-cards .rp-empty-card { grid-column: 1 / -1; }
  body.is-phone .rp-empty-btn { min-height: 44px; margin: 10px 0 0; }
  body.is-phone .rp-row2 { flex-direction: column; gap: 14px; }
  body.is-phone .rp-best3 { grid-template-columns: 1fr; gap: 14px; }
  body.is-phone .rp-best3 > :first-child { grid-column: auto; }
  body.is-phone .rp-best-row { min-height: 52px; }
  /* Best sellers on phone: plain underline tabs (Products · Categories · Series). */
  body.is-phone .rp-utabs { display: flex; gap: 22px; border-bottom: 1px solid var(--border); margin: 2px 0 6px; }
  body.is-phone .rp-utabs button {
    min-height: 44px; padding: 0; border: 0; border-bottom: 3px solid transparent; margin-bottom: -1px;
    background: transparent; font-family: var(--font-body); font-size: 15px; color: var(--text-secondary); cursor: pointer;
  }
  body.is-phone .rp-utabs button.on { border-bottom-color: var(--accent); color: var(--text-primary); font-weight: 700; }
  body.is-phone .rp-row2 > .rp-cons { flex: none; width: 100%; min-width: 0; box-sizing: border-box; }
  body.is-phone .rp-card { padding: 14px; }
  body.is-phone .rp-card-head { gap: 8px; }
  body.is-phone .rp-best .rp-card-head .rp-card-title,
  body.is-phone .rp-trends .rp-card-head .rp-card-title { flex: 1; }
  body.is-phone .rp-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; box-sizing: border-box; }
  body.is-phone .rp-tabs-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  body.is-phone .rp-tabs button { min-height: 44px; padding: 0 4px; font-size: 13px; white-space: normal; line-height: 1.15; }
  body.is-phone .rp-link { min-height: 44px; }
  body.is-phone .rp-link-inline { min-height: 44px; }
  body.is-phone .rp-rank-row { min-height: 48px; grid-template-columns: 18px minmax(0, 1fr) auto auto; gap: 8px; }
  body.is-phone .rp-rank-row .rp-amt { min-width: 0; }
  body.is-phone .rp-qty { font-size: 12px; }
  body.is-phone .rp-con-row { min-height: 52px; }
  body.is-phone .rp-picker-wrap { width: 100%; }
  body.is-phone .rp-show-btn { width: 100%; max-width: 100%; min-height: 44px; border-radius: 22px; font-size: 15px; text-align: left; }
  body.is-phone .rp-yearrow { margin-left: 0; width: 100%; flex-wrap: nowrap; }
  body.is-phone .rp-year { flex: 1; min-width: 0; height: 44px; }
  /* No per-bar labels on a phone — the ◀ Month ▶ strip carries the numbers. */
  body.is-phone .rp-mval,
  body.is-phone .rp-mchg { display: none; }
  body.is-phone .rp-mchart,
  body.is-phone .rp-mlabels { gap: 4px; }
  body.is-phone .rp-mbars { gap: 2px; }
  body.is-phone .rp-mbar { width: 7px; border-radius: 3px 3px 0 0; }
  body.is-phone .rp-mlabels { font-size: 11px; }
  body.is-phone .rp-step { width: 44px; height: 44px; }
  body.is-phone .rp-strip-text { font-size: 13px; }
  body.is-phone .rp-mlist-row { min-height: 44px; font-size: 13px; }
  body.is-phone .rp-legend-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  body.is-phone .rp-legend button { min-height: 44px; padding: 4px 8px; border-radius: 10px; flex-wrap: wrap; text-align: left; line-height: 1.2; min-width: 0; }
  body.is-phone .rp-hchart,
  body.is-phone .rp-hlabels { gap: 4px; }
  body.is-phone .rp-hcol { gap: 1px; }
  body.is-phone .rp-hlabels { font-size: 10px; }
  body.is-phone .rp-recent .rp-chip { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  body.is-phone .rp-more { min-height: 52px; margin: 14px 0; font-weight: 700; }
  body.is-phone .rp-popt { min-height: 48px; }
  body.is-phone .rp-search { height: 44px; }
  body.is-phone .rp-plist { max-height: none; }
  body.is-phone .rp-modal .modal-footer { flex-wrap: wrap; }
  body.is-phone .rp-modal .modal-footer .btn-secondary { flex: 1 1 100%; }
  body.is-phone .rp-modal .rp-mode { flex-shrink: 0; }
  body.is-phone .rp-modal .modal-header { flex-wrap: wrap; }
  body.is-phone .rp-modal .rp-modal-head { flex: 1 1 calc(100% - 60px); }
  /* The expenses / subscriptions ledger is admin — iPad/desktop only. */
  body.is-phone #reports-expenses { display: none !important; }

  /* ── STOCK (pages/stock-phone.js) ── */
  /* Stock level colours come from the theme (Settings → Theme → Stock level colours). */
  .sp-header { display: flex; flex-direction: column; gap: 10px; }
  .sp-title-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
  .sp-icon-btn {
    width: 44px; height: 44px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--border); border-radius: 12px; background: var(--bg-card); color: var(--text-primary); cursor: pointer;
  }
  .sp-back { border: 0; background: transparent; }
  .sp-icon-gap { width: 44px; flex-shrink: 0; }
  .sp-search { width: 100%; min-height: 44px; box-sizing: border-box; }
  .sp-controls { display: flex; gap: 8px; }
  .sp-channel {
    flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; height: 44px; padding: 0 12px; box-sizing: border-box;
    border: 1px solid var(--border); border-radius: 10px; background: var(--bg-card);
  }
  .sp-channel span { font-size: 12px; color: var(--text-muted); }
  .sp-channel select { flex: 1; min-width: 0; border: 0; background: transparent; font-family: var(--font-body); font-size: 14px; font-weight: 600; color: var(--text-primary); }
  .sp-seg { display: flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--bg-card); flex-shrink: 0; }
  .sp-seg button { height: 44px; padding: 0 12px; border: 0; background: transparent; font-family: var(--font-body); font-size: 13px; color: var(--text-secondary); cursor: pointer; }
  .sp-seg button.on { background: var(--accent); color: var(--accent-fg); font-weight: 600; }
  .sp-tabs { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 12px; background: var(--border); }
  .sp-tabs button { height: 44px; border: 0; border-radius: 9px; background: transparent; font-family: var(--font-body); font-size: 14px; color: var(--text-secondary); cursor: pointer; }
  .sp-tabs button.on { background: var(--accent); color: var(--accent-fg); font-weight: 600; }
  #sp-tab-restock:not(.on) { color: var(--stock-out-bg, #B42318); font-weight: 600; }
  /* Selected keeps the red (a light fill + red ring) — plain accent would hide the warning
     in the one state where it matters. */
  #sp-tab-restock.on { background: var(--bg-card); color: var(--stock-out-bg, #B42318); box-shadow: inset 0 0 0 2px var(--stock-out-bg, #B42318); }

  .sp-group { margin-bottom: 6px; }
  .sp-group-head {
    width: 100%; min-height: 44px; display: flex; align-items: center; gap: 8px; padding: 4px 2px;
    border: 0; background: transparent; font-family: var(--font-body); color: var(--text-primary); cursor: pointer; text-align: left;
  }
  .sp-chev { flex-shrink: 0; transition: transform .15s; }
  .sp-chev.open { transform: rotate(90deg); }
  .sp-group-head[aria-disabled="true"] { cursor: default; }
  .sp-group-head[aria-disabled="true"] .sp-chev { visibility: hidden; }
  .sp-group-name { font-size: 15px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
  .sp-group-count { font-size: 13px; color: var(--text-muted); }
  .sp-group-sum { margin-left: auto; display: flex; gap: 8px; font-size: 12px; flex-shrink: 0; }
  /* Out/low counts as small chips in the level colours (fill + its own text colour, so a
     light theme colour can't make them unreadable). */
  .sp-group-sum b { padding: 1px 8px; border-radius: 10px; }
  .sp-group-sum .t-out { background: var(--stock-out-bg, #B42318); color: var(--stock-out-fg, #FFFFFF); }
  .sp-group-sum .t-low { background: var(--stock-low-bg, #F8D58A); color: var(--stock-low-fg, #5C3600); }
  .sp-group-body { display: flex; flex-direction: column; gap: 8px; }

  .sp-row {
    display: flex; align-items: center; gap: 10px; min-height: 64px; padding: 8px 8px 8px 10px; box-sizing: border-box;
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; cursor: pointer;
  }
  .sp-thumb { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; flex-shrink: 0; }
  .sp-thumb-emoji { display: flex; align-items: center; justify-content: center; font-size: 26px; background: var(--bg); }
  .sp-row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
  .sp-name { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .sp-sub { font-size: 12px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .sp-struck { text-decoration: line-through; color: var(--text-muted); }

  /* The number: same box whether showing or editing, so the column never moves. */
  .sp-num {
    width: 60px; height: 48px; flex-shrink: 0; box-sizing: border-box; padding: 0;
    border: 0; border-radius: 12px; text-align: center; cursor: pointer;
    font-family: var(--font-body); font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums;
    -moz-appearance: textfield; appearance: textfield;
  }
  .sp-num::-webkit-outer-spin-button, .sp-num::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
  .sp-num.lvl-out  { background: var(--stock-out-bg, #B42318);  color: var(--stock-out-fg, #FFFFFF); }
  .sp-num.lvl-low  { background: var(--stock-low-bg, #F8D58A);  color: var(--stock-low-fg, #5C3600); }
  .sp-num.lvl-good { background: var(--stock-good-bg, #CDEBD5); color: var(--stock-good-fg, #17572A); }
  .sp-num.lvl-none { background: var(--bg-card); color: var(--text-muted); border: 1px dashed var(--border); font-weight: 400; }
  .sp-num-input { outline: 2px solid var(--text-primary); outline-offset: -2px; cursor: text; }
  /* Beat the phone-wide 16px input rule (no iOS zoom at 16+ anyway) so digits don't shrink while editing. */
  body.is-phone .sp-num { font-size: 20px !important; }
  body.is-phone .spg-qty { font-size: 18px !important; }
  /* Keep the last row clear of the Undo bar while it's showing. */
  body:has(.sp-snack.show) #sp-list { padding-bottom: 72px; }

  .sp-more { width: 100%; min-height: 44px; margin-top: 8px; }
  .sp-empty { text-align: center; color: var(--text-muted); padding: 40px 12px; font-size: 14px; }

  /* All-channels sheet */
  .spe-sub { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
  .spe-note { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
  .spe-note:empty { display: none; }
  .spe-rows { border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
  .spe-row { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 4px 8px 4px 14px; border-bottom: 1px solid var(--border); }
  .spe-row:last-child { border-bottom: 0; }
  .spe-label { flex: 1; min-width: 0; display: flex; flex-direction: column; }
  .spe-name { font-size: 15px; font-weight: 600; overflow: hidden; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .spe-was { font-size: 12px; font-weight: 600; color: var(--stock-good-fg, #17572A); }
  .spe-was.neg { color: var(--danger); }
  .spe-input { cursor: text; }
  .spe-cost { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-size: 13px; font-weight: 600; }
  .spe-cost span { flex: 1; }
  .spe-cost em { font-style: normal; font-weight: 400; color: var(--text-muted); }
  .spe-cost input { width: 110px; height: 44px; box-sizing: border-box; padding: 0 12px; border: 1px solid var(--border); border-radius: 12px; font-family: var(--font-body); font-size: 16px; }

  /* Undo snackbar — sits above the bottom nav, never inside the list. */
  .sp-snack {
    position: fixed; left: 12px; right: 12px; bottom: calc(var(--tab-bar-height, 60px) + 10px); z-index: 900;
    display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 6px 0 16px; border-radius: 14px;
    background: #1F1B16; color: #FFFFFF; font-family: var(--font-body); font-size: 14px;
    opacity: 0; transform: translateY(12px); pointer-events: none; transition: opacity .2s, transform .2s;
  }
  .sp-snack.show { opacity: 1; transform: none; pointer-events: auto; }
  .sp-snack span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .sp-snack button { height: 44px; padding: 0 14px; border: 0; background: transparent; color: #8FE3A5; font-family: var(--font-body); font-size: 14px; font-weight: 700; cursor: pointer; }
  body:not(.is-phone) .sp-snack { display: none; }

  /* Stock history */
  .sp-hist-chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
  .sp-chip {
    min-height: 44px; padding: 0 14px; border-radius: 20px; flex-shrink: 0;
    border: 1px solid var(--border); background: var(--bg-card); color: var(--text-secondary);
    font-family: var(--font-body); font-size: 13px; white-space: nowrap; cursor: pointer;
  }
  .sp-chip.active { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); font-weight: 600; }
  .sp-hist-day { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); padding: 12px 2px 6px; }
  .sp-hist-card { border: 1px solid var(--border); border-radius: 14px; background: var(--bg-card); overflow: hidden; }
  .sp-hist-row { display: flex; align-items: center; gap: 10px; min-height: 60px; padding: 6px 8px 6px 12px; border-bottom: 1px solid var(--border); }
  .sp-hist-row:last-child { border-bottom: 0; }
  .sp-hist-time { width: 52px; flex-shrink: 0; font-size: 12px; color: var(--text-secondary); }
  .sp-hist-delta { flex-shrink: 0; font-weight: 700; font-variant-numeric: tabular-nums; width: auto; min-width: 44px; padding: 3px 8px; box-sizing: border-box; border-radius: 10px; text-align: center; font-size: 14px; }
  .sp-hist-delta.up { background: var(--stock-good-bg, #CDEBD5); color: var(--stock-good-fg, #17572A); }
  .sp-hist-delta.down { background: var(--stock-out-bg, #B42318); color: var(--stock-out-fg, #FFFFFF); }


  /* Gacha (phone): capsule icon, pack sheet */
  .spg-ball {
    width: 44px; height: 44px; border-radius: 22px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
    background: var(--accent-light); color: var(--accent-dark, var(--text-primary));
  }
  #spg-thumb { margin-right: 10px; display: flex; }
  .sp-row-gacha { background: var(--accent-light); }
  .spg-tabs { margin-bottom: 12px; }
  .spg-bulk { display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin-bottom: 10px; border-radius: 14px; background: var(--bg); }
  .spg-all { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 15px; font-weight: 600; cursor: pointer; }
  .spg-all input, .spg-check input { width: 22px; height: 22px; accent-color: var(--text-primary); }
  .spg-each-label { font-size: 13px; color: var(--text-muted); }
  .spg-each { background: var(--bg-card); color: var(--text-primary); border: 2px solid var(--text-primary); cursor: text; }
  .spg-check { width: 44px; height: 44px; min-width: 44px; min-height: 44px; box-sizing: border-box; flex-shrink: 0; display: flex; align-items: center; justify-content: center; margin-left: -8px; cursor: pointer; }
  .spg-row { padding-left: 8px; }
  .spg-qty { background: var(--bg-card); color: var(--text-primary); border: 1px solid var(--border); font-size: 18px; }
  .spg-have { font-size: 12px; color: var(--text-secondary); }
  .spg-have.short { color: var(--stock-low-fg, #5C3600); font-weight: 600; }
  .spg-off { width: 60px; flex-shrink: 0; text-align: center; font-size: 12px; color: var(--text-secondary); }
  .spg-note { font-size: 12px; color: var(--text-secondary); margin-top: 10px; }
  .spg-pack { flex: 1; min-height: 52px; font-size: 16px; }
  .spg-pack:disabled { opacity: .5; }


  /* Landscape phone (body.phone-landscape, set in app.js): the Stock header folds into ONE
     row — title, search, channel, grouping, tabs, history — and products sit two per row,
     so the list isn't squeezed under a 240px header. Same controls, same order as portrait. */
  body.phone-landscape .sp-header { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; padding-top: 8px; padding-bottom: 8px; }
  body.phone-landscape .sp-title-row { display: contents; }
  body.phone-landscape .sp-header .page-title { font-size: 18px; flex-shrink: 0; }
  body.phone-landscape #sp-list-view .sp-title-row .sp-icon-btn { order: 10; }
  body.phone-landscape .sp-search { flex: 1 1 96px; min-width: 96px; width: auto; }
  body.phone-landscape .sp-controls { flex-shrink: 0; }
  body.phone-landscape .sp-channel { flex: 0 1 150px; min-width: 110px; width: auto; }
  /* Small phones sideways (≈667px): whatever doesn't fit wraps to a second row instead of
     pushing History off-screen. Scoped to the header so sheet tabs keep their 50/50 split. */
  body.phone-landscape .sp-header .sp-tabs { flex-shrink: 0; display: flex; }
  body.phone-landscape .sp-header .sp-tabs button { padding: 0 10px; white-space: nowrap; }
  body.phone-landscape .sp-group-body { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  /* History keeps its back button first; its filter chips stay on the same row. */
  body.phone-landscape .sp-hist-chips { flex-shrink: 0; max-width: 45%; }

  /* ── ORDERS ── one card per order instead of a table. */
  body.is-phone .orders-header-row { display: none !important; }
  body.is-phone .orders-row {
    grid-template-columns: minmax(0, 1fr) auto !important;
    grid-template-areas: "customer total" "items status" "ref date";
    gap: 4px 12px !important; padding: 12px 14px !important; min-height: 64px;
  }
  /* The ≤1100 compact table (orders.js) hides the ref and time — the card wants them. */
  body.is-phone .orders-row > .orders-cell-ref      { display: block !important; grid-area: ref; font-size: 12px; color: var(--text-muted); }
  body.is-phone .orders-time                        { display: inline !important; }
  body.is-phone .orders-row > .orders-cell-customer { grid-area: customer; font-weight: 600; }
  body.is-phone .orders-row > .orders-cell-payment  { grid-area: total; align-items: flex-end; }
  body.is-phone .orders-row > .orders-cell-status   { grid-area: status; justify-self: end; }
  body.is-phone .orders-row > .orders-cell-items    { grid-area: items; font-size: 12px; color: var(--text-muted); }
  body.is-phone .orders-row > .orders-cell-date     { grid-area: date; justify-self: end; }
  body.is-phone .orders-row > .orders-cell-platform,
  body.is-phone .orders-pay-method                  { display: none !important; }
  /* Sales logs' one-line month summary is data, not a hint: it stays (Orders' shelf note goes). */
  body.is-phone .page-subtitle.orders-sum { display: block; }
  /* New menu (orders.js pageMode): sales logs lead with the order # instead of a customer. */
  body.is-phone .orders-row > .orders-cell-amt   { grid-area: total; justify-self: end; }
  body.is-phone .orders-row > .orders-cell-where { grid-area: where; font-size: 12px; color: var(--text-muted); }
  body.is-phone .orders-row > .orders-cell-pay   { grid-area: pay; justify-self: end; }
  body.is-phone .orders-k-log .orders-row     { grid-template-areas: "ref total" "items date"; }
  body.is-phone .orders-k-con .orders-row     { grid-template-areas: "ref total" "where pay" "items date"; }
  body.is-phone .orders-k-history .orders-row { grid-template-areas: "ref total" "where date" "items items"; }
  body.is-phone :is(.orders-k-log, .orders-k-con, .orders-k-history) .orders-row > .orders-cell-ref { font-family: inherit; font-size: 14px; font-weight: 600; color: var(--text-primary); }
  .orders-paste-choice { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; margin-bottom: 8px; font-size: 15px; }

  /* Paste-import review: each pasted line stacks — product picker full width on top
     (it's the control you need when a line didn't match), numbers underneath. */
  body.is-phone .pi-line {
    grid-template-columns: minmax(0, 1fr) 64px 84px auto 44px !important;
    row-gap: 6px !important; padding: 8px 0 !important; border-bottom: 1px solid var(--border);
  }
  body.is-phone .pi-line > select { grid-column: 1 / -1; order: -1; min-height: 44px; }
  body.is-phone .pi-line > input { min-height: 44px; }
  body.is-phone .pi-line > .con-cost-delete { width: 44px; height: 44px; }
  /* Review header + detected-column mapping (markup in sales.js renderPasteReview):
     column selects, order # / date inputs, the order's ✕, and the no-stock checkbox. */
  body.is-phone #paste-import-modal select,
  body.is-phone #pi-review input.form-input { min-height: 44px; }
  body.is-phone #pi-review .con-cost-delete { min-width: 44px; min-height: 44px; }
  body.is-phone #paste-import-modal label:has(#pi-no-stock) { min-height: 44px; }
  body.is-phone #pi-no-stock { width: 22px; height: 22px; }
  body.is-phone [onclick^="ordersPasteOrders"] { min-height: 44px; }

  /* ── CONVENTIONS ── */
  body.is-phone .con-card-actions { flex-direction: row; gap: 10px; }
  body.is-phone .con-card-actions .icon-btn { width: 44px; height: 44px; }
  body.is-phone .con-status-pill-btn { min-height: 44px; padding: 6px 12px !important; font-size: 13px !important; }
  body.is-phone .con-card-row--status { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
  /* "⏳ $280 pending" and the paid chip share one wrapper — space them apart. */
  body.is-phone .con-status-extra { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; }
  .con-paid-chip {
    min-height: 44px; padding: 6px 14px; border-radius: 22px; cursor: pointer;
    border: 1px solid #86EFAC; background: #F0FDF4; color: #15803D;
    font-family: var(--font-body); font-size: 13px; font-weight: 600;
  }

  /* ── Moved from components.css: admin rows, profile switcher, helper Reports (phone) ── */
  body.is-phone .admin-row { flex-wrap:wrap; }
  body.is-phone .admin-row-actions { width:100%; justify-content:stretch; }
  body.is-phone .admin-row-actions > * { flex:1; min-height:44px; justify-content:center; }
  .profile-only { display: none !important; }
  body.is-phone.has-profiles .profile-only { display: flex !important; }
  /* Helper Reports = the main Reports phone layout: the 3-card row (as .rp-cards-3). */
  body.is-phone .hr-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  body.is-phone .hr-card { padding: 12px 10px; }
  body.is-phone .hr-value { font-size: 20px; }
  body.is-phone .hr-charts { grid-template-columns: minmax(0, 1fr); }
body.is-phone .hr-charts .settings-card { min-width:0; }
  body.is-phone .hr-best { grid-template-columns:1fr; gap:0; }
  body.is-phone .hr-best-tabs { display:grid; grid-template-columns:repeat(3, minmax(0,1fr)); border-bottom:1px solid var(--border); margin-bottom:8px; }
  body.is-phone .hr-best-tabs button { min-height:44px; border:0; border-bottom:2px solid transparent; background:transparent; font-family:inherit; font-size:14px; color:var(--text-secondary); }
  body.is-phone .hr-best-tabs button.on { border-bottom-color:var(--accent); color:var(--accent-dark); font-weight:700; }
  body.is-phone .hr-best-card { display:none; }
  body.is-phone .hr-best-card.on { display:block; }
  /* 44px taps on the phone sheets / helper Reports. */
  body.is-phone .idea-vote, body.is-phone .admin-pill, body.is-phone .fb-kinds label,
  body.is-phone .hr-select, body.is-phone .hr-vs, body.is-phone .hr-toggle button { min-height: 44px; }

  /* Restock: one column of places (components.css draws two). */
  body.is-phone .rs-rows { grid-template-columns: minmax(0, 1fr); }

  /* ── New menu Overview (pages/overview.js draws list markup on a phone) ── */
  body.is-phone .ov-ch-row { grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; padding: 10px 16px; min-height: 56px; }
  body.is-phone .ov-ch-main { display: flex; flex-direction: column; min-width: 0; }
  body.is-phone .ov-ch-main b { font-weight: 600; font-size: 15px; }
  body.is-phone .ov-ch-main span { font-size: 12px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  body.is-phone .ov-ch-main span.ov-warn { color: var(--status-warn-fg); }
  body.is-phone .ov-ch-amt { font-size: 15px; }
  body.is-phone .ov-kpi { padding: 12px 14px; }
  body.is-phone .ov-kpi-val { font-size: 22px; }
  body.is-phone .ov-st-search { max-width: none; flex: 1 1 100%; min-height: 44px; }
  body.is-phone .ov-pills .pos-col-chip { min-height: 44px; }
  body.is-phone .ov-st-item { padding: 10px 16px; border-top: 1px solid var(--border); }
  body.is-phone .ov-st-item:first-child { border-top: 0; }
  body.is-phone .ov-st-top { display: flex; gap: 8px; align-items: baseline; justify-content: space-between; font-size: 15px; }
  body.is-phone .ov-st-top b:first-child { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  body.is-phone .ov-chips { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 6px; }
  body.is-phone .ov-chip { font-size: 12px; border-radius: 6px; padding: 3px 7px; background: var(--bg); color: var(--text-primary); }
  body.is-phone .ov-chip-low { background: var(--stock-low-bg); color: var(--stock-low-fg); font-weight: 700; }
  body.is-phone .ov-chip-out { background: var(--stock-out-bg); color: var(--stock-out-fg); font-weight: 700; }
  body.is-phone .ov-st-more { display: block; width: 100%; min-height: 44px; margin-top: 12px; }
