/* Component tokens extend the linen / evergreen contract in DESIGN.md. */
:root {
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --control-height: 44px;
  --radius-control: 8px;
  --radius-panel: 12px;
  --type-caption: 12px;
  --type-body: 14px;
  --type-heading: 24px;
  --workspace-max: 1440px;
  --workspace-gutter: 24px;
  --dropdown-inset: 20px;
  --chevron-size: 14px;
}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
body { background: var(--page); }
.topbar { display: grid; grid-template-columns: 190px minmax(180px, 1fr) max-content; align-items: center; justify-content: space-between; gap: 24px; padding: var(--space-3) max(var(--workspace-gutter), calc((100vw - var(--workspace-max)) / 2 + var(--workspace-gutter))); background: var(--forest); border-bottom: 0; }
.brand img { display: block; width: 170px; height: auto; filter: brightness(0) invert(1); }
.search-panel { position: relative; padding: 0; border: 0; background: none; }
.search-panel svg { position: absolute; width: 20px; height: 20px; left: 16px; top: 17px; fill: none; stroke: var(--forest); stroke-width: 1.8; }
.search-panel input { width: 100%; min-height: 54px; padding: 12px 18px 12px 46px; border: 1px solid var(--rule); border-radius: 10px; background: var(--page); font-weight: 400; }
.header-actions { display: flex; align-items: stretch; gap: 8px; }
#basket-toggle, #flyers-toggle, #price-history-toggle, #history-toggle { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; box-shadow: none; min-height: 48px; padding: 10px 15px; border-radius: var(--radius-control); color: var(--forest); background: var(--panel); font: 600 16px/1.25 var(--font-body); white-space: normal; overflow: visible; text-overflow: clip; text-decoration: none; }
#flyers-toggle:hover, #price-history-toggle:hover, #history-toggle:hover { filter: brightness(0.94); }
.basket-button-label { display: inline-flex; align-items: center; white-space: nowrap; }
#basket-count { display: inline-grid; place-items: center; background: var(--forest-soft); min-width: 24px; height: 24px; margin-left: 8px; border-radius: 50%; }
@media (max-width: 1100px) {
  .topbar { grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 12px 18px; }
  .brand img { width: 146px; }
  .search-panel { grid-row: 2; grid-column: 1 / -1; }
  .search-panel input { min-height: 44px; }
  .search-panel svg { top: 13px; }
  #basket-toggle, #flyers-toggle, #price-history-toggle, #history-toggle { font-size: 14px; padding: 8px 12px; }
}
@media (max-width: 900px) {
  .topbar .header-actions { grid-row: 2; grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .topbar .search-panel { grid-row: 3; }
}
@media (max-width: 600px) {
  .topbar .header-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  #flyers-toggle, #price-history-toggle, #history-toggle { font-size: 12px; padding: 8px; }
}
.intro { max-width: var(--workspace-max); margin: auto; padding: var(--space-4) var(--workspace-gutter); }
.eyebrow { color: var(--forest); font-size: 11px; letter-spacing: .1em; font-weight: 600; }
.intro h1 { font-family: var(--font-body); font-size: 30px; letter-spacing: -.025em; line-height: 1.25; font-weight: 600; color: var(--ink); }
.topbar-title { gap: 4px; }
.method-note summary { font-size: 12px; text-transform: none; letter-spacing: 0; font-weight: 500; min-height: 44px; gap: 16px; padding-right: 16px; }
.method-note-body { font-size: 13px; line-height: 1.6; max-width: 650px; }
.layout { max-width: var(--workspace-max); margin: auto; padding: 0 24px 40px; grid-template-columns: minmax(0, 1fr) 310px; gap: 24px; }
.control-panel { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: var(--space-3); gap: var(--space-2) var(--space-4); box-shadow: none; border-color: var(--rule); border-radius: var(--radius-panel); }
.control-field { padding: 0; border: 0; background: transparent; min-width: 0; }
.control-label { font-weight: 600; color: var(--muted); font-size: 12px; }
.week-toggle { max-width: none; min-height: var(--control-height); padding: 10px var(--dropdown-inset); gap: 16px; font-size: 14px; }
.week-options { z-index: 12; }
.mode-tabs { min-width: 0; width: 100%; }
.mode-tabs button { font-weight: 600; min-height: var(--control-height); font-size: var(--type-body); }
.filter-disclosure { width: 100%; }
.filter-disclosure > summary { display: none; }
.store-panel { border-top: 1px solid var(--faint); padding-top: 14px; }
.store-panel-head { display: flex; justify-content: flex-start; align-items: center; flex-wrap: wrap; gap: 8px 20px; margin-bottom: 6px; }
.store-actions { display: flex; gap: 3px; min-width: 0; padding: 3px; border: 1px solid var(--rule); border-radius: 10px; background: var(--page); }
.store-actions button { min-height: 36px; padding: 7px 12px; border: 1px solid transparent; border-radius: 7px; box-shadow: none; font-size: 12px; font-weight: 500; color: var(--muted); background: transparent; text-decoration: none; cursor: pointer; }
.store-actions button.active { background: var(--forest); color: white; }
.store-actions button:not(.active):hover { background: var(--forest-soft); color: var(--forest); }
.store-filter { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: var(--space-2); }
.control-field .store-choice { display: flex; align-items: center; min-width: 0; width: 100%; min-height: 44px; margin: 0; padding: var(--space-2); gap: var(--space-2); border-radius: var(--radius-control); font-size: var(--type-caption); background: #fff; }
.store-choice span { font-weight: 500; line-height: 1.35; white-space: normal; overflow-wrap: normal; word-break: normal; }
.control-field .store-choice:has(input:checked) { background: var(--forest-soft); border-color: #91aa9d; }
.store-choice small { display: none; }
.control-field .store-choice input { flex: 0 0 16px; width: 16px; height: 16px; margin: 0; padding: 0; }
.rayon-field > .control-label { display: none; }
.category-tabs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px 8px; }
.category-tabs button { min-height: 44px; height: 100%; padding: var(--space-2) var(--space-3); gap: var(--space-2); border-radius: var(--radius-control); font-size: var(--type-body); box-shadow: none; }
.category-name { font-size: 13px; font-weight: 500; line-height: 1.35; gap: 0; }
.category-name > span { display: none; }
.category-count { min-width: 23px; padding: 3px; font-size: 10px; font-weight: 500; }
.category-tabs button.active { color: white; background: var(--forest); }
.category-tabs button.active .category-count { background: #ffffff20; color: white; }
.week-header { border: 0; background: transparent; box-shadow: none; padding: 0; margin-bottom: 12px; }
.week-header-main { display: block; }
.week-header h2 { max-width: none; font-family: var(--font-body); font-size: 20px; font-weight: 600; letter-spacing: -.02em; }
.week-context { margin: 6px 0 0; font-size: 12px; color: var(--muted); line-height: 1.5; }
.category-title { margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--rule); }
.category-title .eyebrow { display: none; }
.category-title h2 { font-family: var(--font-body); font-size: 14px; font-weight: 500; }
.category-title h2 > span { display: none; }
.category-title > span { font-size: 12px; }
.items-grid { align-items: stretch; grid-auto-rows: auto; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-4); }
.item-card { height: 100%; content-visibility: auto; contain-intrinsic-size: auto 260px; box-shadow: none; border: 1px solid var(--rule); border-radius: var(--radius-panel); transition: border-color .15s; }
.item-card:hover { transform: none; box-shadow: none; border-color: #81978a; }
.item-card.selected { background: #fffefa; border-color: var(--forest); box-shadow: 0 0 0 1px var(--forest); }
.product-media { overflow: hidden; height: 132px; min-height: 0; border-bottom: 1px solid var(--faint); background: white; }
.proof { display: block; width: 100%; height: 100%; aspect-ratio: auto; max-height: 100%; min-height: 0; object-fit: contain; padding: 12px; }
.proof-button { display: block; height: 100%; min-height: 0; min-width: 0; overflow: hidden; }
svg.proof, svg.image-preview-img { overflow: hidden; }
svg.image-preview-img { display: block; height: min(65vh, 640px); }
.media-store { left: 8px; bottom: 6px; top: auto; background: #fffffff0; font-weight: 600; font-size: 11px; padding: 3px 6px; border: 1px solid var(--faint); box-shadow: none; }
.product-body { display: flex; flex-direction: column; align-items: stretch; min-height: 0; padding: var(--space-3); gap: 6px; justify-content: flex-start; }
.product-purchase { display: flex; margin: 0; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px 8px; }
.item-name { font-size: var(--type-body); line-height: 1.35; font-weight: 500; min-height: 0; overflow-wrap: break-word; text-wrap: initial; }
.product-purchase .price { padding: 0; letter-spacing: -.025em; background: transparent; text-align: left; font-family: var(--font-body); font-size: 24px; line-height: 1.2; font-weight: 700; color: var(--forest); white-space: normal; }
.unit-note { font-size: 11px; line-height: 1.5; color: var(--muted); margin: 0; }
.evidence-details summary { color: var(--muted); cursor: pointer; min-height: 32px; padding: 7px 0 0; }
.add-control { position: absolute; z-index: 1; top: 8px; right: 8px; min-width: 44px; height: 44px; padding: 0 10px; margin: 0; border: 1px solid #91aa9d; border-radius: var(--radius-control); background: #fffefa; color: var(--forest); font-weight: 500; font-size: 26px; line-height: 1; box-shadow: 0 1px 4px #17251f12; }
.item-card.selected .add-control { font-size: 12px; font-weight: 600; }
.add-control:hover, .item-card.selected .add-control, .item-card.selected .add-control:hover { background: var(--forest); color: #fff; box-shadow: none; }
.add-control span { color: inherit; }
.add-control:has(input:focus-visible) { outline: 3px solid var(--ochre); outline-offset: 3px; }
.add-control input { width: 100%; height: 100%; margin: 0; }
.selection-panel { border: 1px solid var(--rule); border-radius: var(--radius-panel); background: var(--panel); box-shadow: none; padding: 16px; top: 16px; max-height: calc(100dvh - 32px); overflow-y: auto; }
.selection-panel > * { flex-shrink: 0; }
.panel-heading { padding-bottom: 10px; }
.panel-heading h2 { font-family: var(--font-body); font-size: 20px; line-height: 1.25; font-weight: 600; letter-spacing: -.02em; }
.selection-summary { font-size: 12px; padding: 8px 0; margin: 0; background: transparent; font-weight: 500; }
.selection-list { display: flex; flex: 0 0 auto; flex-direction: column; gap: var(--space-4); min-height: 0; overflow: visible; padding: 0; }
.store-block { flex: 0 0 auto; border: 0; border-radius: 0; padding: 0; background: transparent; }
.store-block h3 { font: 600 14px/1.4 var(--font-body); margin-bottom: 2px; }
.store-address { font-size: 11px; margin-bottom: 8px; }
.selected-item { gap: 8px; padding: 8px 0; }
.selected-item strong { font-size: 12px; font-weight: 500; line-height: 1.4; }
.selected-item small { font-size: 14px; font-weight: 600; }
.selected-item .selected-condition { display: inline-block; margin-left: 8px; font-size: 11px; font-weight: 400; color: var(--muted); }
.selected-item button { min-height: 44px; padding: 4px 0 4px 8px; font-size: 11px; font-weight: 500; border: 0; background: transparent; text-decoration: underline; text-underline-offset: 3px; }
.store-subtotal { margin-top: 0; padding-top: 8px; }
.store-subtotal span, .store-subtotal strong { font-size: 12px; font-weight: 600; }
.store-subtotal small { font-size: 11px; }
.selection-estimate { margin: 0 0 16px; padding: 12px; background: var(--forest-soft); border: 0; border-radius: var(--radius-control); }
.selection-estimate:not(:empty) { gap: 6px; }
.estimate-total { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 12px; }
.estimate-total span { font-size: 12px; letter-spacing: 0; text-transform: none; font-weight: 600; }
.estimate-total strong { font-size: 22px; line-height: 1.25; font-weight: 700; font-variant-numeric: tabular-nums; }
.selection-estimate p { font-size: 11px; line-height: 1.5; }
.export-status:empty { display: none; }
.selection-list .empty-state { border: 0; box-shadow: none; padding: 24px 0; background: none; text-align: left; font-size: 13px; line-height: 1.6; }
.selection-list .empty-state p { margin-bottom: 8px; font: 600 18px/1.35 var(--font-body); color: var(--forest); }
.notes-field { margin-top: 16px; }
.notes-field textarea { font-size: 12px; min-height: 60px; }
.basket-actions { position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding-top: 12px; background: var(--panel); backdrop-filter: none; }
#print-button { grid-column: auto; background: var(--forest-soft); color: var(--forest); }
.button.secondary { background: var(--forest); }
.basket-actions .button { min-height: 44px; font-size: 12px; box-shadow: none; white-space: normal; overflow: visible; text-overflow: clip; }
#clear-button { font-weight: 500; }
.basket-close { display: none; }
.site-footer { border-top: 1px solid var(--rule); padding: 24px; text-align: center; font-size: 12px; color: var(--muted); }
summary:focus-visible, textarea:focus-visible { outline: 3px solid var(--ochre); outline-offset: 3px; }
@media (max-width: 1100px) { .store-filter { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
@media (max-width: 1180px) { .items-grid { align-items: stretch; grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) {
  .intro { padding: 12px 18px; }
  .intro h1 { font-size: 24px; }
  .week-header h2 { font-size: 22px; }
  .layout { padding: 0 18px 32px; grid-template-columns: 1fr; gap: 22px; }
  .control-panel { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 14px; gap: 10px; }
  .week-field, .mode-field { grid-column: 1 / -1; }
  .store-panel, .rayon-field { grid-column: auto; }
  .filter-disclosure[open] { grid-column: 1 / -1; }
  .week-field > .control-label, .mode-field > .control-label { display: none; }
  .week-toggle { max-width: none; width: 100%; }
  .mode-tabs { min-width: 0; }
  .filter-disclosure { border-top: 1px solid var(--rule); padding-top: 0; }
  .filter-disclosure > summary { display: list-item; cursor: pointer; min-height: 46px; padding: 14px 0 8px; font-size: 13px; font-weight: 600; }
  .filter-disclosure > summary span { font-size: 11px; color: var(--muted); font-weight: 400; margin-left: 8px; }
  .store-panel-head > .control-label { display: none; }
  .store-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; }
  .store-actions button { min-height: 44px; padding: 6px 4px; text-align: center; line-height: 1.4; font-size: 11px; }
  .store-filter { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .category-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding-top: 10px; }
  .category-tabs button { min-height: 44px; }
  .items-grid { align-items: stretch; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .item-name { font-size: 13px; }
  .product-purchase .price { font-size: 21px; }
  .selection-panel { display: none; }
  body.basket-open { overflow: hidden; }
  .basket-open .selection-panel { display: flex; position: fixed; inset: 0; width: 100%; height: 100dvh; max-height: none; z-index: 30; border-radius: 0; border: 0; padding: 20px 20px max(20px, env(safe-area-inset-bottom)); overflow-y: auto; }
  .basket-open .selection-list { flex: 0 0 auto; overflow: visible; }
  .basket-close { display: flex; position: sticky; top: -20px; z-index: 1; justify-content: space-between; min-height: 44px; align-items: center; border: 0; background: var(--panel); padding: 12px 0; margin-bottom: 12px; color: var(--forest); cursor: pointer; font: 500 14px var(--font-body); }
  .basket-close span { font-size: 24px; }
  .basket-actions { position: static; grid-template-columns: 1fr 1fr; }
  #print-button { grid-column: auto; background: var(--forest-soft); color: var(--forest); }
}
@media (max-width: 600px) { .store-filter { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 360px) { .items-grid { align-items: stretch; grid-template-columns: 1fr; } .brand img { width: 118px; } #basket-count { margin-left: 4px; min-width: 18px; } .topbar { gap: 8px; } }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto; } }

.nav-link { display: inline-flex; justify-content: center; align-items: center; gap: 10px; border: 0; padding: 8px 0; min-height: 44px; background: transparent; color: var(--forest); font: 500 13px/1.3 var(--font-body); cursor: pointer; }
.header-actions .nav-link { color: white; }
.nav-link:hover { text-decoration: underline; text-underline-offset: 4px; }
.flyers-dialog { width: min(960px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); margin: auto; padding: 24px; color: var(--ink); background: var(--page); border: 1px solid var(--rule); border-radius: var(--radius-panel); }
.flyers-dialog::backdrop { background: #17251f80; }
.flyers-heading { position: sticky; top: -24px; z-index: 2; padding: 16px 0; background: var(--page); display: flex; align-items: start; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.flyers-heading h2 { font: 600 28px/1.3 var(--font-body); letter-spacing: -.02em; }
.flyers-heading p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.flyers-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.flyer-card { overflow: hidden; border: 1px solid var(--rule); border-radius: var(--radius-panel); background: var(--panel); color: var(--ink); text-decoration: none; }
.flyer-card:hover { border-color: var(--forest); }
.flyer-preview { display: flex; height: 120px; gap: 6px; align-items: center; padding: 12px; background: white; border-bottom: 1px solid var(--faint); }
.flyer-preview img { object-fit: contain; width: calc((100% - 12px) / 3); height: 100%; }
.flyer-card h3 { margin: 14px 14px 0; font: 600 16px/1.3 var(--font-body); }
.flyer-card p { margin: 6px 14px 0; font-size: 12px; color: var(--muted); }
.flyer-action { display: flex; align-items: center; min-height: 44px; margin: 8px 14px; font-size: 12px; color: var(--forest); }
@media (max-width: 600px) {
  .flyers-dialog { padding: 16px; width: calc(100vw - 20px); max-height: calc(100dvh - 20px); }
  .flyers-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .flyer-preview { height: 100px; padding: 8px; }
  .flyer-card h3 { font-size: 14px; margin: 10px 10px 0; }
  .flyer-card p { margin: 6px 10px 0; }
  .flyer-action { margin: 6px 10px; font-size: 11px; }
}

@media print { .intro, .site-footer, #basket-close { display: none; } .selection-panel { display: block; } }

/* Price comparisons share the same scale and controls as the shopping list. */
.selection-savings { width: 100%; border: 0; text-align: left; cursor: pointer; font-family: var(--font-body); display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 6px 12px; padding: 12px; margin: 0 0 12px; border-radius: var(--radius-control); background: var(--forest); color: white; }
.selection-savings:hover { background: #243d31; }
.selection-savings:focus-visible { outline: 3px solid var(--ochre); outline-offset: 3px; }
.selection-savings[hidden] { display: none; }
.selection-savings span { font-size: 12px; font-weight: 600; }
.selection-savings strong { font-size: 22px; line-height: 1.25; font-weight: 700; font-variant-numeric: tabular-nums; }
.selection-savings small { grid-column: 1 / -1; font-size: 11px; line-height: 1.5; opacity: .85; }
.basket-access, .basket-button-totals, .basket-button-arrow { display: none; }
.topbar > *, .layout > *, .product-body, .filter-disclosure { min-width: 0; }
/* The basket shares the sidebar breakpoint. Tablet access stays in the page flow. */
@media (max-width: 900px) {
  .basket-access { display: block; position: sticky; top: 0; z-index: 20; padding: 10px 18px; border-bottom: 1px solid var(--rule); background: var(--page); }
  #basket-toggle { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto 18px; gap: 8px; align-items: center; min-height: 60px; padding: 12px 16px; border-radius: 10px; color: white; background: var(--forest); border: 1px solid #ffffff40; font-size: 14px; }
  .basket-button-label { text-align: left; white-space: nowrap; }
  #basket-count { background: #ffffff20; color: white; margin-left: 5px; }
  .basket-button-totals { display: grid; gap: 4px; text-align: right; font-size: 11px; font-weight: 500; line-height: 1.4; white-space: normal; font-variant-numeric: tabular-nums; }
  #basket-mobile-savings { font-size: 10px; font-weight: 400; opacity: .85; }
  #basket-mobile-savings[hidden] { display: none; }
  .basket-button-arrow { display: block; font-size: 18px; }
  .basket-open #basket-toggle { visibility: hidden; }
  .basket-open .selection-panel { overscroll-behavior: contain; }
}
@media (max-width: 600px) {
  body { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
  .basket-access { position: static; height: 0; padding: 0; border: 0; }
  .topbar { grid-template-columns: minmax(0, 1fr) auto; padding: 12px 16px; }
  .brand img { width: 146px; }
  .intro, .layout { padding-left: 16px; padding-right: 16px; }
  #basket-toggle { position: fixed; z-index: 20; left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); width: calc(100% - 24px); border-radius: 12px; box-shadow: 0 4px 18px #17251f25; }
  .items-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .product-media { height: 148px; }
  .item-name { font-size: 15px; }
  .product-purchase .price { font-size: 25px; }
  .week-toggle { font-size: 12px; }
  .mode-tabs button { padding: 8px; font-size: 12px; }
  .filter-disclosure > summary { font-size: 12px; }
  .filter-disclosure > summary span { margin-left: 4px; }
}
.flyers-grid[hidden], #flyer-reader[hidden] { display: none; }
.flyer-card { display: block; width: 100%; padding: 0; text-align: left; font-family: var(--font-body); cursor: pointer; }
.flyer-preview { height: 220px; justify-content: center; color: var(--muted); }
.flyer-preview img { width: 100%; }
.flyer-period { margin: 8px 0 20px; color: var(--muted); font-size: 13px; }
.flyer-page { margin: 0 auto 24px; max-width: 740px; }
.flyer-page-image { position: relative; overflow: hidden; background: white; }
.flyer-page-image img { display: block; position: absolute; max-width: none; }
.flyer-page figcaption { text-align: center; font-size: 11px; color: var(--muted); margin-top: 8px; }
.flyer-source { font-size: 12px; color: var(--muted); }
.flyer-message { padding: 20px; font-size: 14px; }
@media (max-width: 600px) { .flyer-preview { height: 180px; } .flyers-heading { gap: 12px; } .flyers-heading h2 { font-size: 22px; } }
@media print { #basket-toggle, .basket-access, .flyers-dialog { display: none; } }

.week-toggle span:first-child { white-space: normal; overflow: visible; text-overflow: clip; }
@media (max-width: 600px) { .flyers-heading { top: -16px; } }

/* Equal cards per row; store banners separate destinations from amounts. */
.store-banner { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; min-height: 64px; padding: 10px 12px; border-radius: var(--radius-control); background: var(--forest); color: white; }
.store-banner-info { min-width: 0; }
.store-banner h3 { color: white; font-size: 14px; margin: 0; }
.store-banner .store-address { color: #ffffffd9; font-size: 11px; margin: 3px 0 0; }
.store-block .selected-item { padding: 10px 2px; }
.store-subtotal { margin: 0 2px; }
.store-subtotal span { color: var(--muted); font-size: 11px; font-weight: 400; }
.store-subtotal strong { font-size: 13px; }


/* A quiet pill opens the full comparison while keeping the card compact. */
.price-pill { display: inline-flex; align-items: center; justify-content: center; min-height: 32px; padding: 6px 10px; border: 1px solid var(--rule); border-radius: 999px; font: 500 12px/1.25 var(--font-body); color: var(--forest); background: var(--panel); cursor: pointer; max-width: 100%; }
.price-pill.saving { color: white; background: var(--forest); border-color: var(--forest); }
.price-pill.difference { background: var(--forest-soft); border-color: #91aa9d; }
.price-pill:hover { box-shadow: 0 0 0 2px #2d473925; }
.price-pill:focus-visible { outline: 3px solid var(--ochre); outline-offset: 3px; }
.product-meta { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; min-height: 16px; font-size: 12px; line-height: 1.4; color: var(--muted); }
.member-label { color: var(--forest); font-size: 12px; font-weight: 600; }
.comparison-dialog { margin: auto; padding: 20px; width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); border: 1px solid var(--rule); border-radius: var(--radius-panel); background: var(--panel); color: var(--ink); }
.comparison-dialog::backdrop { background: #17251f80; }
.comparison-heading { display: flex; align-items: start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.comparison-heading h2 { font: 600 20px/1.3 var(--font-body); }
.comparison-heading > button { flex: 0 0 44px; width: 44px; height: 44px; border: 0; border-radius: var(--radius-control); font-size: 26px; color: var(--forest); background: var(--forest-soft); cursor: pointer; }
.comparison-saving { display: flex; flex-direction: column; gap: 6px; padding: 14px; margin-bottom: 8px; border-radius: var(--radius-control); color: var(--forest); background: var(--forest-soft); }
.comparison-saving strong { font-size: 22px; }
.comparison-saving span, .comparison-saving small { font-size: 12px; }
.comparison-offers { display: grid; gap: 12px; }
.comparison-offer { border: 1px solid var(--rule); border-radius: var(--radius-control); overflow: hidden; }
.comparison-store-banner { grid-template-columns: minmax(0, 1fr); border-radius: 0; }
.comparison-offer-body { display: grid; gap: 10px; padding: 12px; }
.comparison-store { font-size: 15px; font-weight: 600; }
.comparison-price { font-size: 20px; line-height: 1.25; color: var(--forest); white-space: nowrap; font-variant-numeric: tabular-nums; }
.comparison-offer-info { display: grid; gap: 8px; min-width: 0; }
.comparison-product { margin: 0; font-size: 13px; line-height: 1.5; }
.comparison-metadata { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-size: 12px; line-height: 1.4; color: var(--muted); }
.comparison-format-note { padding: 3px 7px; border-radius: 4px; background: var(--forest-soft); color: var(--forest); font-size: 11px; }
.comparison-offer-purchase { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.comparison-add { min-height: 44px; padding: 8px 12px; border: 1px solid var(--rule); border-radius: var(--radius-control); background: var(--forest-soft); color: var(--forest); cursor: pointer; font: 600 12px var(--font-body); }
.comparison-add:disabled { background: transparent; color: var(--muted); cursor: default; }
.price-history { padding: 16px 0; font-size: 13px; }
.price-history h3 { font: 600 14px var(--font-body); margin-bottom: 6px; }
.price-history small { display: block; margin-top: 6px; color: var(--muted); }
@media (min-width: 901px) {
  .intro { padding-top: 12px; padding-bottom: 12px; }
  .topbar-title { display: grid; grid-template-columns: 1fr auto; align-items: center; }
  .topbar-title > .region-field { grid-column: 1 / -1; }
  .intro h1 { font-size: 26px; }
  .method-note { margin: 0; }
  .method-note[open] { grid-column: 1 / -1; }
  .week-field > .control-label, .mode-field > .control-label { display: none; }
  .store-panel { padding-top: 8px; }
  .store-panel-head { margin-bottom: 10px; }
}
@media (max-width: 600px) {
  .price-pill { min-height: 44px; font-size: 12px; }
  .comparison-dialog { padding: 16px; }
  .comparison-heading h2 { font-size: 18px; }
}
@media print { .comparison-dialog { display: none; } }

.region-field { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; min-width: 0; }
.region-field label { font-size: 12px; color: var(--muted); white-space: nowrap; }
.select-control { position: relative; display: inline-flex; min-width: 0; max-width: calc(100% - 65px); }
#region-select { appearance: none; width: 100%; min-height: 44px; padding: 10px calc(var(--dropdown-inset) + var(--chevron-size) + 16px) 10px var(--dropdown-inset); background-color: transparent; border: 1px solid var(--rule); border-radius: var(--radius-control); color: var(--forest); font: 500 13px var(--font-body); }
.disclosure-icon, .select-control::after, .method-note summary::after, .filter-disclosure > summary::after {
  content: ""; display: inline-block; width: var(--chevron-size); height: var(--chevron-size); flex: 0 0 var(--chevron-size);
  background: currentColor; color: var(--forest);
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m3 6 5 5 5-5' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.select-control::after { position: absolute; right: var(--dropdown-inset); top: calc(50% - var(--chevron-size) / 2); pointer-events: none; }
.dropdown { position: relative; min-width: 0; max-width: 100%; align-self: start; }
.dropdown[data-open] { z-index: 3; }
.dropdown-toggle { display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; min-height: var(--control-height); padding: 10px var(--dropdown-inset); border: 1px solid var(--rule); border-radius: var(--radius-control); background: var(--panel); color: var(--forest); text-align: left; font: 500 13px/1.4 var(--font-body); cursor: pointer; }
.dropdown-label { min-width: 0; white-space: normal; overflow-wrap: anywhere; }
.dropdown-toggle[aria-expanded="true"] .disclosure-icon { transform: rotate(180deg); }
.dropdown-toggle:disabled { opacity: .6; cursor: default; }
.dropdown-toggle:focus-visible { outline: 3px solid var(--ochre); outline-offset: 2px; }
.dropdown-options { position: absolute; top: calc(100% + 6px); left: 0; width: 100%; min-width: 0; max-height: min(260px, 35dvh); overflow: auto; overscroll-behavior: contain; margin: 0; padding: 4px; border: 1px solid var(--rule); border-radius: var(--radius-control); background: var(--panel); box-shadow: 0 8px 20px #17251f1a; }
.dropdown-option { display: flex; align-items: center; min-height: var(--control-height); padding: 10px 12px; border-radius: 5px; color: var(--forest); font: 500 13px/1.4 var(--font-body); white-space: normal; overflow-wrap: anywhere; cursor: pointer; }
.dropdown-option:hover, .dropdown-option.active { background: var(--forest-soft); }
.dropdown-option[aria-selected="true"] { font-weight: 700; }
.week-toggle[aria-expanded="true"] .disclosure-icon, .method-note[open] summary::after, .filter-disclosure[open] > summary::after { content: ""; transform: rotate(180deg); }
@media (max-width: 900px) {
  .filter-disclosure > summary { display: flex; align-items: center; gap: 8px; list-style: none; padding: 12px 0; }
  .filter-disclosure > summary::-webkit-details-marker { display: none; }
  .filter-disclosure > summary::after { margin-left: auto; }
  .filter-disclosure > summary span { margin-left: 0; white-space: nowrap; }
}
@media (max-width: 360px) { .store-panel, .rayon-field { grid-column: 1 / -1; } }
.store-banner .store-locator { display: inline-flex; align-items: center; justify-content: center; gap: 5px; appearance: none; border: 0; background: none; color: white; padding: 8px 0 8px 4px; min-height: 44px; font: 500 11px/1.4 var(--font-body); text-align: left; white-space: nowrap; cursor: pointer; }
.store-locator svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; flex-shrink: 0; }
.store-locator span { text-decoration: underline; text-underline-offset: 4px; }
.basket-store-banner { grid-template-columns: minmax(0, .85fr) minmax(0, 1.4fr); align-items: start; gap: 12px; padding: 10px 12px 4px; }
.store-banner-identity, .store-banner-destination { min-width: 0; }
.store-banner-destination { display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
.basket-store-banner .store-address { margin: 0; font-size: 11px; line-height: 1.4; overflow-wrap: anywhere; }
.basket-store-banner .store-distance { margin-top: 5px; font-size: 11px; line-height: 1.4; }
.basket-store-banner .store-locator { padding: 6px 0 6px 8px; }
.store-dialog { width: min(560px, calc(100vw - 24px)); height: min(680px, calc(100dvh - 24px)); overflow: hidden; }
.store-dialog[open] { display: flex; flex-direction: column; }
.store-dialog > :not(#store-results) { flex-shrink: 0; }
#store-results { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
#store-dialog-region, #store-results-count, .store-dialog-note { font-size: 12px; line-height: 1.5; color: var(--muted); }
#store-dialog-region { margin: -4px 0 16px; }
#store-search { width: 100%; min-height: 44px; border: 1px solid var(--rule); border-radius: var(--radius-control); padding: 10px 12px; color: var(--ink); background: var(--panel); font: 400 14px var(--font-body); }
#store-results-count { margin: 12px 0 0; }
.branch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 0; }
.branch-row + .branch-row { border-top: 1px solid var(--rule); }
.branch-info { display: grid; gap: 6px; min-width: 0; line-height: 1.5; }
.branch-info strong { font-size: 14px; font-weight: 600; }
.branch-info a { font-size: 13px; overflow-wrap: anywhere; }
.branch-row > button { flex-shrink: 0; min-height: 44px; }
.branch-info span { font-size: 12px; color: var(--muted); }
.branch-reset { min-height: 44px; padding: 8px 0; border: 0; background: none; font: 500 12px var(--font-body); text-decoration: underline; text-underline-offset: 4px; color: var(--forest); cursor: pointer; }
.store-dialog-note { border-top: 1px solid var(--rule); margin: 0; padding-top: 16px; }
.store-empty { padding: 20px 0; font-size: 14px; line-height: 1.5; }
@media (max-width: 380px) {
  .store-dialog { padding: 18px; }
  .branch-row { gap: 8px; }
  .branch-row > button { padding-inline: 10px; }
}
body:has(dialog[open]) { overflow: hidden; }
@media (max-width: 600px) { #region-select { min-height: 44px; } }

.dialog-close { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; gap: 10px; min-height: 44px; padding: 10px 14px; border: 1px solid var(--rule); border-radius: var(--radius-control); background: var(--forest-soft); color: var(--forest); font: 600 13px/1 var(--font-body); text-decoration: none; white-space: nowrap; cursor: pointer; }
.dialog-close span { font-size: 22px; text-decoration: none; }
.dialog-close:hover { border-color: var(--forest); }
.selected-item .selected-product { padding: 0; border: 0; border-radius: 0; min-height: 32px; font: 500 12px/1.4 var(--font-body); text-align: left; color: var(--ink); background: transparent; text-decoration: none; }
.selected-item .selected-product:hover { color: var(--forest); text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 360px) { .topbar .brand img { width: 110px; } }
