/* ---------- Phone shell ----------
   Below 680px Shopperoo behaves like an app: bottom tab bar, bottom sheets instead of
   popovers, a docked plan total, 16px fields (no iOS focus zoom), and 40px+ touch targets.
   Desktop only needs the new elements switched off. */
.tab-icon { display: contents; }
.tab-icon > [data-icon] { display: none; }
.tabs .tab-count { order: 1; }
.sheet-head, .scrim, .entry-add, .plan-dock, .m-only { display: none; }
.filter-row { display: contents; }
html { -webkit-tap-highlight-color: transparent; }
button, label, select, summary, [role="tab"] { touch-action: manipulation; }

/* Touch screens: hover never ends on a phone, so pressed states replace hover tints. */
@media (hover: none) {
  .drop-hint, .entry-kbd { display: none; }
  .deal-row:hover:not([aria-expanded="true"]):not(:active), .crow:hover:not(:active), .alt:hover:not(:active),
  .item:hover:not(:focus-within), .plan-opt:hover:not(:active), .menu-item:hover:not(.active):not(:active),
  .ghost-btn:hover:not(:active), .icon-btn:hover:not(:active), .chip:hover:not(:active) { background: transparent; }
  .ghost-btn.strong:hover:not(:active) { background: var(--sunken); }
  .chip:hover:not(:active) { background: var(--surface); }
  .deal-row:active, .alt:active, .crow:active, .menu-item:active, .plan-opt:active, .hbar:active,
  .ghost-btn:active, .icon-btn:active, .chip:active, .size-chip:active { background: var(--hover); }
  .btn, .chip, .plan-opt, .size-chip, .tabs .tab-icon, .entry-add, .plan-dock, .add-other { transition: transform 120ms var(--ease), background var(--t), opacity var(--t); }
  .btn:active, .chip:active, .size-chip:active, .entry-add:active, .add-other:active { transform: scale(.96); }
  .plan-dock:active { transform: scale(.985); }
  .tabs button:active .tab-icon { transform: scale(.92); }
}

@media (max-width: 680px) {
  :root {
    --gutter: 16px; --nav-h: 58px; --safe-b: env(safe-area-inset-bottom, 0px);
    --fs: 15px; --fs-sm: 14px; --fs-md: 16px; --fs-lg: 19px; --fs-xl: 34px;
  }
  body { padding-bottom: calc(var(--nav-h) + var(--safe-b)); }
  .m-only { display: inline; }
  .d-only { display: none; }
  /* Nothing to plan yet: the plan controls wait until the basket has items. */
  .is-empty .results-bar { display: none; }
  .wrap { padding-inline: max(var(--gutter), env(safe-area-inset-left)) max(var(--gutter), env(safe-area-inset-right)); }
  main { padding-block: 12px 28px; }
  /* Anything we scroll to clears the sticky header and the bottom bars. */
  #plan-summary, .results-bar, .line, .item, .deals-toolbar, .deal-list > li { scroll-margin: 64px 0 calc(var(--nav-h) + var(--safe-b) + 84px); }

  /* 16px or larger, or iOS zooms the page on focus. */
  input[type="text"], input[type="search"], input:not([type]), input[type="number"], textarea, select { font-size: 16px; }

  /* ---- Top bar: brand, area, theme. Blur lives on a pseudo-element so the fixed tab bar
     inside the header stays fixed to the viewport (a filtered ancestor would capture it). ---- */
  .bar { background: none; backdrop-filter: none; -webkit-backdrop-filter: none; padding-top: env(safe-area-inset-top); }
  .bar::before { content: ''; position: absolute; inset: 0; z-index: -1; background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px); }
  .bar-inner { flex-wrap: nowrap; height: 56px; gap: 8px; padding-top: 0; }
  .brand { font-size: 20px; gap: 9px; flex: none; }
  .brand img { width: 26px; height: 26px; }
  .bar-tools { gap: 2px; min-width: 0; }
  .area-picker { min-width: 0; }
  .area-toggle { height: 38px; max-width: 100%; padding: 0 10px 0 11px; border-radius: var(--r-pill); font-size: 14px; }
  .area-toggle strong { max-width: min(36vw, 170px); }
  #theme-toggle { width: 40px; height: 40px; border-radius: var(--r-pill); }
  #theme-toggle .icon { width: 20px; height: 20px; }

  /* ---- Bottom tab bar ---- */
  .tabs { position: fixed; z-index: 45; left: 0; right: 0; bottom: 0; order: 0; width: auto; height: calc(var(--nav-h) + var(--safe-b)); margin: 0;
    display: grid; grid-template-columns: 1fr 1fr; gap: 0; padding: 0 max(12px, env(safe-area-inset-right)) var(--safe-b) max(12px, env(safe-area-inset-left));
    background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px);
    border-top: 1px solid var(--line); transition: transform 200ms var(--ease), visibility 200ms; }
  .tabs button { flex-direction: column; justify-content: center; gap: 3px; padding: 0; font-size: 12px; font-weight: 600; letter-spacing: .01em; color: var(--muted); }
  .tabs button[aria-selected="true"] { color: var(--ink); }
  .tabs button[aria-selected="true"]::after { display: none; }
  .tab-icon { position: relative; display: grid; place-items: center; width: 60px; height: 30px; border-radius: var(--r-pill); transition: background var(--t) var(--ease), transform 120ms var(--ease); }
  .tab-icon > [data-icon] { display: inline-flex; }
  .tab-icon .icon { width: 22px; height: 22px; stroke-width: 1.8; }
  .tabs button[aria-selected="true"] .tab-icon { background: var(--green-soft); color: var(--green-ink); }
  .tabs .tab-count, .tabs button[aria-selected="true"] .tab-count { position: absolute; top: -3px; left: calc(50% + 5px); min-width: 19px; height: 19px; padding: 0 5px; background: var(--green); color: var(--surface); box-shadow: 0 0 0 2px var(--bg); font-size: 11px; font-weight: 700; }
  .tab-count.bump { animation: bump 380ms var(--ease); }
  @keyframes bump { 40% { transform: scale(1.35); } }

  /* Keyboard up: the bottom bars would float on it, so they step aside. */
  html.typing .tabs { transform: translateY(105%); visibility: hidden; }
  html.typing .plan-dock { display: none; }

  /* ---- Bottom sheets (area picker, saved baskets) ---- */
  .popover.area-popover, .popover.saved-popover {
    position: fixed; z-index: 61; left: 0; right: 0; top: auto; bottom: 0; width: auto; max-height: min(82dvh, 680px);
    display: flex; flex-direction: column; padding: 8px max(12px, env(safe-area-inset-right)) calc(14px + var(--safe-b)) max(12px, env(safe-area-inset-left));
    border: 0; border-radius: 20px 20px 0 0; box-shadow: 0 -10px 40px -8px rgb(0 0 0 / .3); overscroll-behavior: contain; outline: none;
    animation: sheet-in 280ms cubic-bezier(.2, .9, .25, 1); }
  .popover.area-popover::before, .popover.saved-popover::before { content: ''; flex: none; align-self: center; width: 36px; height: 5px; margin-bottom: 6px; border-radius: 3px; background: var(--line-strong); }
  @keyframes sheet-in { from { transform: translateY(100%); } }
  .popover:not([hidden]) + .scrim { display: block; position: fixed; z-index: 60; inset: 0; background: rgb(10 10 9 / .45); animation: scrim-in 220ms var(--ease); }
  @keyframes scrim-in { from { opacity: 0; } }
  html:has(.popover:not([hidden])) { overflow: hidden; }
  html:has(.popover:not([hidden])) .plan-dock { display: none; }
  .sheet-head { display: flex; flex: none; align-items: center; justify-content: space-between; gap: 12px; padding: 2px 0 10px 6px; }
  .sheet-head h2 { font-size: 18px; font-weight: 700; letter-spacing: -.015em; }
  .sheet-head .icon-btn { width: 36px; height: 36px; border-radius: var(--r-pill); background: var(--sunken); }
  .area-popover .field-icon { flex: none; margin: 0 0 8px; }
  .area-popover .field-icon > [data-icon] { left: 13px; }
  .area-popover .field-icon input, .save-form input { height: 46px; border-radius: 12px; padding-left: 40px; }
  .save-form input { padding-left: 14px; }
  #area-options { flex: 1 1 auto; min-height: 0; max-height: none; overscroll-behavior: contain; margin: 0 -4px 8px; padding: 0 4px 8px; }
  .popover .menu-item { min-height: 50px; padding: 8px 12px; font-size: 16px; font-weight: 500; border-radius: 12px; }
  .popover .menu-item[aria-selected="true"] { font-weight: 700; background: var(--green-soft); color: var(--green-ink); }
  .popover .menu-item .check { width: 20px; height: 20px; }
  .area-popover .location { flex: none; color: var(--ink); font-weight: 600; }
  .area-popover .location .icon { width: 20px; height: 20px; color: var(--green); }
  .area-popover .fine, .saved-popover > .fine { flex: none; padding: 2px 12px 0; }
  #saved-list { overflow: auto; min-height: 0; overscroll-behavior: contain; }
  .saved-row .icon-btn { width: 44px; height: 44px; opacity: 1; color: var(--muted); }
  .saved-row .menu-item small { font-size: 13px; }
  .saved-empty { padding: 4px 12px 12px; font-size: 14px; }
  .save-form { flex: none; gap: 8px; padding: 12px 0 6px; }
  .save-form button { height: 46px; padding: 0 18px; border-radius: 12px; font-size: 15px; }

  /* ---- Controls get touch-sized ---- */
  .btn { height: 44px; padding: 0 18px; border-radius: 12px; font-size: 15px; }
  .btn.sm { height: 36px; padding: 0 12px; border-radius: 10px; font-size: 13px; }
  .ghost-btn { height: 38px; padding: 0 12px; border-radius: 10px; font-size: 14px; }
  .icon-btn.sm { width: 36px; height: 36px; }
  .icon-btn.sm .icon { width: 16px; height: 16px; }
  .chip { height: 36px; padding: 0 14px; font-size: 14px; }
  .chips { gap: 8px; }
  .badge { height: 22px; padding: 0 8px; }
  .switch { gap: 10px; font-size: 14px; }
  .switch-track { width: 42px; height: 26px; }
  .switch-track::after { top: 3px; left: 3px; width: 20px; height: 20px; }
  .switch input:checked + .switch-track::after { transform: translateX(16px); }
  .card, .list-panel, .stats, .deals-main, .side-card { border-radius: 16px; }

  /* ---- Basket list ---- */
  .list-panel { box-shadow: var(--shadow-card); }
  .panel-head { padding: 12px 8px 8px 16px; }
  .panel-head h2 { font-size: 18px; letter-spacing: -.015em; }
  .add-form { padding: 0 12px 10px; }
  .entry-icon { left: 14px; top: 16px; }
  .entry textarea { min-height: 50px; padding: 13px 54px 13px 40px; border-radius: 14px; font-size: 16px; line-height: 22px; }
  .entry-add { position: absolute; right: 7px; top: 7px; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; background: var(--ink); color: var(--bg);
    opacity: 0; transform: scale(.7); pointer-events: none; transition: opacity var(--t), transform 160ms var(--ease); }
  .entry-add .icon { width: 18px; height: 18px; stroke-width: 2.4; }
  .entry.has-text .entry-add { opacity: 1; transform: none; pointer-events: auto; }
  .suggestions { max-height: min(52dvh, 420px); padding: 6px; border-radius: 16px; overscroll-behavior: contain; }
  .suggestions li { gap: 12px; min-height: 54px; padding: 8px; border-radius: 12px; }
  .suggestions .thumb { width: 40px; height: 40px; }
  .suggest-info strong { font-size: 15px; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .suggest-info small { font-size: 13px; }
  .suggest-head { min-height: 0 !important; padding: 8px 8px 2px !important; }

  .items { padding: 0 8px; }
  .item { min-height: 54px; gap: 4px; padding: 0 0 0 8px; border-radius: 12px; }
  .item + .item::before { left: 8px; right: 8px; }
  .item-name { height: 42px; font-size: 16px; padding: 0 8px; margin-left: -8px; }
  .item .pin { width: 32px; height: 32px; }
  .item .pin .icon { width: 15px; height: 15px; }
  .stepper { height: 38px; border-radius: var(--r-pill); background: var(--sunken); box-shadow: inset 0 0 0 1px var(--line); }
  .stepper button, .stepper button:disabled { width: 36px; height: 38px; opacity: 1 !important; border-radius: var(--r-pill); }
  .stepper button:disabled { color: var(--faint); }
  .stepper button .icon { width: 15px; height: 15px; }
  .stepper input { width: 24px; height: 34px; font-size: 16px; }
  .stepper.one input { color: var(--ink-2); }
  .item .remove { width: 40px; height: 40px; opacity: 1; }
  .list-empty { padding: 4px 16px 16px; font-size: 14px; }
  .panel-foot { padding: 6px 16px 8px; }
  .panel-foot .link-btn { min-height: 40px; }

  /* ---- Plan controls ---- */
  .results { gap: 12px; }
  .results-bar { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; padding-top: 4px; }
  .seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 3px; border-radius: 12px; }
  .seg button { height: 38px; border-radius: 9px; font-size: 14px; }
  .plan-toggles { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px; padding: 0 2px; }
  .plan-toggles .switch { min-height: 32px; }
  .status { min-height: 16px; padding: 0 2px; }
  .status:empty { display: none; }

  /* ---- Plan ---- */
  .summary { padding: 16px; gap: 14px; }
  .summary-label { font-size: 12px; }
  .summary-total .cur { font-size: 14px; }
  .summary-total strong { font-size: 34px; }
  .summary-route { font-size: 15px; font-weight: 600; }
  .plans { margin-inline: -16px; padding: 2px 16px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-inline: 16px; scrollbar-width: none; gap: 8px; }
  .plans::-webkit-scrollbar { display: none; }
  .plan-opt { flex: none; min-width: 128px; padding: 10px 12px; border-radius: 12px; scroll-snap-align: start; }
  .plan-opt strong { font-size: 15px; }
  .summary-facts { gap: 8px 16px; font-size: 14px; }
  .missing { padding: 12px 14px; border-radius: 16px; }
  .store-head { padding: 14px 14px 12px; }
  .store-name h3 { font-size: 16px; }
  .store-total { font-size: 16px; }
  .store-meta { font-size: 13px; gap: 6px 14px; }
  .line-main { grid-template-columns: 44px minmax(0, 1fr) auto 36px; gap: 4px 12px; padding: 12px 6px 12px 14px; }
  .line-main > .thumb { width: 44px; height: 44px; border-radius: 10px; }
  .line-name { font-size: 15px; line-height: 1.3; }
  .line-sub { font-size: 13px; margin-top: 2px; }
  .line-badges { flex-wrap: wrap; }
  .line-cost { min-width: 0; font-size: 15px; }
  .line-cost small { font-size: 12px; }
  .swap { width: 36px; height: 36px; }
  .brand-check { padding: 0 14px 14px; gap: 10px; }
  .brand-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 8px; }
  .brand-actions .btn { width: 100%; }
  .alts { padding: 0 8px 12px; }
  .alts-head { padding: 4px 8px 6px; font-size: 13px; }
  .alt { grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px; min-height: 56px; padding: 8px; border-radius: 12px; }
  .alt .thumb { width: 40px; height: 40px; }
  .alt-name { font-size: 14px; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .alt small { white-space: normal; font-size: 12px; }
  .compare-head { padding: 14px 16px 8px; flex-wrap: wrap; }
  .crow { min-height: 46px; padding: 6px 16px; grid-template-columns: minmax(0, 1fr) 58px 76px; gap: 12px; font-size: 14px; }
  .crow-name { flex-direction: column; align-items: flex-start; gap: 0; }
  .crow-name strong, .crow-name small { max-width: 100%; }
  .crow-more { min-height: 40px; }
  .empty { padding: 20px 16px; gap: 14px; }
  .empty h2 { font-size: 20px; line-height: 1.25; }
  .empty .steps { gap: 8px; }
  .empty .step { padding: 12px 14px; border-radius: 12px; }
  .empty .row .btn { flex: 1; }
  .footnote { padding: 4px; line-height: 1.5; }

  /* ---- Plan dock: the total stays in reach while the list fills the screen ---- */
  .plan-dock { position: fixed; z-index: 44; display: flex; align-items: center; gap: 12px;
    left: max(12px, env(safe-area-inset-left)); right: max(12px, env(safe-area-inset-right)); bottom: calc(var(--nav-h) + var(--safe-b) + 10px);
    min-height: 60px; padding: 9px 10px 9px 16px; border-radius: 18px; background: var(--ink); color: var(--bg); text-align: left;
    box-shadow: 0 10px 30px -8px rgb(0 0 0 / .45), 0 2px 6px rgb(0 0 0 / .12); animation: dock-in 260ms cubic-bezier(.2, .9, .25, 1); }
  @keyframes dock-in { from { opacity: 0; transform: translateY(16px) scale(.98); } }
  .dock-text { flex: 1; min-width: 0; display: grid; gap: 1px; }
  .dock-text small { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 12px; font-weight: 600; color: color-mix(in srgb, var(--bg) 66%, transparent); white-space: nowrap; }
  .dock-route { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .dock-text strong { font-size: 21px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
  .dock-text .cur { margin-right: 5px; font-size: 12px; font-weight: 600; letter-spacing: 0; color: color-mix(in srgb, var(--bg) 60%, transparent); }
  .dock-cov { display: inline-flex; align-items: center; gap: 5px; flex: none; font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; color: color-mix(in srgb, var(--amber) 70%, var(--bg)); }
  .dock-cov.full { color: color-mix(in srgb, var(--green) 62%, var(--bg)); }
  .dock-cov .icon { width: 16px; height: 16px; }
  .dock-go { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 12px; background: color-mix(in srgb, var(--bg) 14%, transparent); }
  .dock-go .icon { width: 18px; height: 18px; }
  .plan-dock.busy strong { opacity: .55; }
  .plan-dock .spinner { width: 11px; height: 11px; flex: none; border-radius: 50%; border: 1.5px solid color-mix(in srgb, var(--bg) 35%, transparent); border-top-color: var(--bg); animation: spin 700ms linear infinite; }
  body:has(.plan-dock:not([hidden])) main { padding-bottom: 96px; }

  /* ---- Toast sits above the bars ---- */
  .toast { left: max(12px, env(safe-area-inset-left)); right: max(12px, env(safe-area-inset-right)); bottom: calc(var(--nav-h) + var(--safe-b) + 10px); transform: none; max-width: none;
    min-height: 52px; padding: 6px 6px 6px 16px; border-radius: 14px; font-size: 14px; animation: toast-up 240ms cubic-bezier(.2, .9, .25, 1); }
  #toast-text { flex: 1; min-width: 0; }
  .toast .link-btn { min-height: 40px; padding: 0 10px; }
  .toast .icon-btn.sm { width: 40px; height: 40px; }
  @keyframes toast-up { from { opacity: 0; transform: translateY(12px); } }
  body:has(.plan-dock:not([hidden])) .toast { bottom: calc(var(--nav-h) + var(--safe-b) + 80px); }
  html.typing .toast { bottom: 12px; }

  /* ---- Deals ---- */
  .deals-toolbar { display: flex; flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 10px; }
  .deals-search { flex: none; max-width: none; }
  .deals-search > [data-icon] { left: 14px; }
  .deals-search input { height: 48px; padding-left: 42px; border-radius: 14px; }
  .filter-row { display: flex; gap: 8px; overflow-x: auto; margin-inline: calc(-1 * var(--gutter)); padding: 2px var(--gutter); scroll-padding-inline: var(--gutter); scrollbar-width: none; overscroll-behavior-x: contain; }
  .filter-row::-webkit-scrollbar { display: none; }
  .deals-toolbar .filter-row .select { flex: none; }
  .deals-toolbar .filter-row .select select { width: auto; max-width: 64vw; field-sizing: content; height: 38px; padding: 0 32px 0 14px; border-radius: var(--r-pill); font-size: 16px; font-weight: 500; background: var(--surface); }
  .filter-row .select::after { right: 14px; }
  .filter-row .select.on select { background: var(--ink); border-color: var(--ink); color: var(--bg); font-weight: 600; }
  .filter-row .select.on::after { border-color: var(--bg); }
  #deals-reset { flex: none; height: 38px; margin: 0; padding: 0 14px; border-radius: var(--r-pill); color: var(--red); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--red) 35%, transparent); }

  /* Stats become a swipeable strip: four tiles stacked would push the deals off the first screen. */
  .stats { display: flex; gap: 8px; margin: 12px calc(-1 * var(--gutter)) 0; padding: 0 var(--gutter); overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-inline: var(--gutter);
    background: none; border: 0; border-radius: 0; box-shadow: none; scrollbar-width: none; overscroll-behavior-x: contain; }
  .stats::-webkit-scrollbar { display: none; }
  .stats.no-deals { display: none; }
  .stat, .stat + .stat, .stat:nth-child(n+3) { flex: 0 0 min(44vw, 200px); padding: 12px 14px 13px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-card); scroll-snap-align: start; }
  .stat-label { font-size: 12px; }
  .stat-value { font-size: 21px; }
  .stat:nth-child(4) .stat-value { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 17px; line-height: 24px; }
  .hist { top: 14px; right: 12px; bottom: auto; height: 20px; gap: 2px; }
  .hist span { width: 5px; }
  .stat-hist .stat-sub { padding-right: 0; }
  .stat-sub { font-size: 12px; }

  .deals-layout { margin-top: 12px; gap: 12px; }
  /* Deal rows: the discount rides on the photo like a shelf sticker, so the name gets the full width. */
  .deal-row { grid-template-columns: 56px minmax(0, 1fr) auto; grid-template-areas: "img title title" "img store price"; column-gap: 12px; row-gap: 8px; min-height: 84px; padding: 14px 14px 14px 14px; align-items: start; }
  .deal-row .thumb, .other-row .thumb { width: 56px; height: 56px; border-radius: 12px; }
  .deal-name { font-size: 15px; line-height: 1.3; }
  /* Meta wraps on phones. Each part carries its own dot and a negative margin, and the row clips its
     left edge, so a part that starts a new line loses its dot: no stray "·" at either end of a line. */
  .deal-meta { flex-wrap: wrap; gap: 1px 14px; margin-top: 3px; font-size: 12px; white-space: normal; overflow: hidden; }
  .deal-meta .sep { display: none; }
  .deal-meta > span:not(.sep) { position: relative; margin-left: -14px; padding-left: 14px; white-space: nowrap; }
  .deal-meta > span:not(.sep)::before { content: ''; position: absolute; left: 6px; top: calc(50% - 1px); width: 2px; height: 2px; border-radius: 50%; background: var(--faint); }
  .deal-store { align-self: end; min-width: 0; font-size: 13px; color: var(--ink-2); }
  .deal-store span::before { content: 'at '; color: var(--muted); font-weight: 400; }
  .deal-price { align-self: end; flex-direction: column; align-items: flex-end; gap: 0; }
  .deal-price strong { font-size: 16px; line-height: 1.2; }
  .deal-price small { font-size: 12px; white-space: nowrap; }
  .deal-off { grid-area: img; align-self: start; justify-self: center; margin-top: 44px; }
  .off-pill { padding: 2px 7px; font-size: 12px; font-weight: 700; background: var(--green); color: var(--surface); box-shadow: 0 0 0 2px var(--surface); }
  .deal-row:hover .off-pill, .deal-row[aria-expanded="true"] .off-pill { box-shadow: 0 0 0 2px var(--sunken); }
  .deal-detail { gap: 18px; padding: 4px 14px 18px; }
  .rung { grid-template-columns: minmax(0, 104px) minmax(0, 1fr) 62px; min-height: 24px; font-size: 13px; }
  .rung.unit { grid-template-columns: minmax(0, 116px) minmax(0, 1fr) 76px; min-height: 34px; }
  .size-chips { gap: 8px; }
  .size-chip { height: 34px; padding: 0 12px; font-size: 13px; }
  .detail-why { font-size: 14px; }
  .detail-why .actions { flex-wrap: wrap; gap: 8px 16px; }
  .detail-why .actions .btn { flex: 1 1 100%; }
  .detail-why .actions .link-btn { min-height: 36px; }
  .list-foot { flex-direction: column; align-items: stretch; gap: 10px; padding: 12px 14px 14px; text-align: center; }
  #deals-more { justify-content: center; height: 44px; border-radius: 12px; font-size: 15px; }

  .others-head { flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px 14px; }
  .others-head h2 { font-size: 15px; }
  .other-row { grid-template-columns: 52px minmax(0, 1fr) auto; grid-template-areas: "img title add" "img price add"; column-gap: 12px; row-gap: 4px; min-height: 80px; padding: 12px 10px 12px 14px; }
  .other-row .thumb { grid-area: img; align-self: start; }
  .other-row .deal-title { grid-area: title; }
  .other-row .deal-price { grid-area: price; justify-content: flex-start; text-align: left; }
  .other-row .add-other { grid-area: add; align-self: center; width: 44px; height: 44px; padding: 0; border-radius: var(--r-pill); }
  .other-row .add-other .icon { width: 20px; height: 20px; }
  .other-row .add-other span { display: none; }

  .deals-side { gap: 12px; }
  .side-card { padding: 14px 16px; }
  .side-head h2 { font-size: 16px; }
  .hbar { min-height: 38px; font-size: 14px; }
  .idx-row { grid-template-columns: minmax(0, 112px) minmax(0, 1fr) 48px; min-height: 28px; font-size: 13px; }
  .side-more { min-height: 36px; }
  .deal-empty { padding: 28px 20px; }
  .deal-empty p { font-size: 14px; max-width: 34ch; }
}

/* Narrow phones (small Androids, iPhone SE): tighter header and basket rows. */
@media (max-width: 380px) {
  .brand { font-size: 18px; gap: 7px; }
  .brand img { width: 24px; height: 24px; }
  .area-toggle { padding: 0 8px 0 9px; gap: 4px; }
  .stepper button, .stepper button:disabled { width: 31px; }
  .item .remove { width: 34px; }
}
/* 320px phones: the wordmark yields to the area name. */
@media (max-width: 340px) {
  .brand { font-size: 0; gap: 0; }
  .area-toggle strong { max-width: 52vw; }
  .line-main { grid-template-columns: 40px minmax(0, 1fr) auto 32px; gap: 4px 10px; }
  .line-main > .thumb { width: 40px; height: 40px; }
  .stat-value { font-size: 19px; }
}
