/* Layout: a red bar with the currency, then filters | results | shopping list (stacked on phones) */
:root {
  --bg: #f4f5f7; --surface: #fff; --fg: #1b2230; --muted: #5d6879; --line: #dfe3ea;
  --accent: #c8102e; --on-accent: #fff; --sale: #0b7a43; --sale-bg: #e3f4ea; --unit: #1f4fa3; --star: #b7791f; --makro: #d6001c;
  --badge: #ff3b30; --on-badge: #fff;
  /* Out of stock at Makro: amber, at least 4.7:1 on the surface and on its own tint, in both themes */
  --warn: #a8530a; --warn-bg: #fdf0d5;
  --font: "IBM Plex Sans", system-ui, sans-serif; --font-num: "IBM Plex Mono", ui-monospace, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11151c; --surface: #1a1f28; --fg: #e7eaf0; --muted: #9aa4b4; --line: #2c3340;
    --accent: #e0334d; --sale: #5fd396; --sale-bg: #173327; --unit: #8db4ff; --star: #f2c14e; --makro: #ff6b7d; color-scheme: dark;
    --badge: #ff453a; --on-badge: #fff;
    --warn: #f5b43c; --warn-bg: #3a2a0c;
  }
}
:root[data-theme="dark"] {
  --bg: #11151c; --surface: #1a1f28; --fg: #e7eaf0; --muted: #9aa4b4; --line: #2c3340;
  --accent: #e0334d; --sale: #5fd396; --sale-bg: #173327; --unit: #8db4ff; --star: #f2c14e; --makro: #ff6b7d; color-scheme: dark;
  --badge: #ff453a; --on-badge: #fff;
  --warn: #f5b43c; --warn-bg: #3a2a0c;
}

* { box-sizing: border-box; }
/* The sticky bars' heights, kept by makro.shopper.sticky; these until it measures. Keyboard focus scrolls
   a card clear of the red bar, and of the action bar while it sticks; the gutter keeps the page from
   shifting as the scrollbar comes and goes. */
:root { --header-h: 52px; --action-bar-h: 0px; }
html { scrollbar-gutter: stable; scroll-padding-top: calc(var(--header-h) + env(safe-area-inset-top, 0px) + 8px); }
html:has(.action-bar:not(.empty)) {
  scroll-padding-top: calc(var(--header-h) + var(--action-bar-h) + env(safe-area-inset-top, 0px) + 8px);
}
body { margin: 0; font: 15px/1.45 var(--font); background: var(--bg); color: var(--fg); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .5; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
a { color: inherit; }
h1, h2, h3 { text-wrap: balance; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.wrap { max-width: 1400px; margin: 0 auto; padding-inline: 16px; }
.note { color: var(--muted); }
.note.error { color: var(--accent); }
.page-note { padding-block: 24px; }

.top { background: var(--accent); color: var(--on-accent); padding-block: 12px; position: sticky; top: 0; z-index: 2; }
.top .wrap { display: flex; gap: 16px; align-items: center; justify-content: space-between; }
.top .home { text-decoration: none; }
.top h1 { margin: 0; font-size: 1.2rem; }
.currency select { padding: 5px 8px; border: 1px solid var(--on-accent); border-radius: 6px; background: transparent; color: var(--on-accent); }
.currency option { color: var(--fg); background: var(--surface); }
.top-nav { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; justify-content: flex-end; }

/* The branch picker in the header, and the note under it */
.branch { display: flex; align-items: center; }
.branch-picker input { width: 13em; max-width: 46vw; padding: 5px 8px; border: 1px solid var(--on-accent); border-radius: 6px;
                       background: transparent; color: var(--on-accent); }
.branch-picker input::placeholder { color: var(--on-accent); opacity: .85; }
.branch-clear { margin-left: 2px; min-width: 28px; min-height: 28px; border: 0; border-radius: 6px; background: none;
                color: var(--on-accent); font-size: 1.1rem; }
.branch-clear[data-hovered] { background: rgb(255 255 255 / .15); }
.branch-popover { width: min(320px, calc(100vw - 32px)); max-height: 60vh; }
.branch-list { padding: 4px; outline: none; }
.branch-list .note { margin: 6px 8px; }
.branch-option { display: flex; flex-direction: column; padding: 6px 10px; border-radius: 6px; cursor: default; outline: none; }
.branch-option[data-focused] { background: var(--bg); }
.branch-option[data-selected] .branch-name { font-weight: 600; color: var(--accent); }
.branch-where { font-size: .78rem; color: var(--muted); }
.branch-note { margin: 8px 0 0; font-size: .85rem; }
.branch-note .link { padding: 0; border: 0; background: none; color: var(--accent); text-decoration: underline; font: inherit; }
.branch-note .link:disabled { color: var(--muted); text-decoration: none; }
.outside { margin-left: 6px; padding: 0 5px; border: 1px solid var(--line); border-radius: 4px; text-transform: none;
           letter-spacing: 0; color: var(--muted); white-space: nowrap; }
@media (max-width: 760px) { .top .wrap { flex-wrap: wrap; } .branch-picker input { width: 10em; } }

.toolbar { padding-block: 16px 4px; }
.search { display: flex; gap: 8px; }
.search input { flex: 1; min-width: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.search button { padding: 10px 18px; border: 0; border-radius: 8px; background: var(--accent); color: var(--on-accent); font-weight: 600; }
.toolbar .note { margin: 8px 0 0; }
/* The search box, and beside it which site it searches; the switch wraps below on phones */
.search-bar { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.search-bar .search { flex: 1 1 320px; min-width: 0; }
.site-toggle { display: inline-flex; flex: none; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.site-toggle button { min-height: 36px; padding: 6px 12px; border: 0; border-radius: 7px; background: none; color: var(--muted); font-weight: 600; white-space: nowrap; }
.site-toggle button:hover { color: var(--fg); }
.site-toggle button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.site-toggle button[aria-pressed="true"] .makro-tag { border-color: var(--on-accent); color: var(--on-accent); }
.site-toggle .makro-tag { font-size: .85em; }
@media (max-width: 760px) { .site-toggle { width: 100%; } .site-toggle button { flex: 1; } }

.layout { display: grid; grid-template-columns: 230px minmax(0, 1fr) 300px; gap: 24px; align-items: start; padding-block: 16px 40px; }
.product-layout { grid-template-columns: minmax(0, 1fr) 300px; }
/* makro.pro's results have its category explorer for a filters column; the catalogue's stays mounted, hidden */
.layout > [hidden] { display: none; }
@media (max-width: 1100px) { .layout { grid-template-columns: 210px minmax(0, 1fr); } .layout > .basket { grid-column: 1 / -1; } }
@media (max-width: 760px) { .layout, .product-layout { grid-template-columns: minmax(0, 1fr); } }

/* Filters: React InstantSearch widgets, styled through their ais- classes */
.facets { display: flex; flex-direction: column; gap: 18px; }
/* A filter with nothing to choose under the current search shows no heading */
.facet:not(:has(li)) { display: none; }
.facet h3 { margin: 0 0 6px; font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
/* makro.pro's own labels, apart from the graph's facets */
.facet-group { display: flex; flex-direction: column; gap: 18px; border-top: 1px solid var(--line); padding-top: 12px; }
.facet-group > h2 { margin: 0; font-size: .85rem; color: var(--makro); }
.facet-group > p { margin: -12px 0 0; font-size: .75rem; color: var(--muted); }
.ais-HierarchicalMenu-list, .ais-RefinementList-list, .ais-CurrentRefinements-list, .ais-Pagination-list { list-style: none; margin: 0; padding: 0; }
.ais-HierarchicalMenu-list--child { padding-left: 14px; }
.ais-HierarchicalMenu-link, .ais-RefinementList-label { display: flex; gap: 6px; align-items: baseline; padding: 3px 0; text-decoration: none; cursor: pointer; }
.ais-HierarchicalMenu-item--selected > div > .ais-HierarchicalMenu-link { font-weight: 600; }
.ais-HierarchicalMenu-count, .ais-RefinementList-count { margin-left: auto; font-family: var(--font-num); font-size: .78rem; color: var(--muted); }
.ais-RefinementList-searchBox input, .ais-SearchBox-input { width: 100%; padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.ais-RefinementList-searchBox form { display: flex; }
.ais-SearchBox-submit, .ais-SearchBox-reset, .ais-SearchBox-loadingIndicator { display: none; }
.ais-RefinementList-showMore, .ais-HierarchicalMenu-showMore, .ais-ClearRefinements-button, .clear, button.link {
  padding: 4px 0; border: 0; background: none; color: var(--accent); text-decoration: underline; }
.ais-ClearRefinements-button--disabled { display: none; }
.ais-ToggleRefinement-label { display: flex; gap: 6px; align-items: center; cursor: pointer; }

.results-bar { display: flex; flex-wrap: wrap; gap: 8px 16px; justify-content: space-between; align-items: center; margin-bottom: 10px; color: var(--muted); }
.sort { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sort select, .sort-direction { min-height: 34px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--fg); }
.sort-direction { white-space: nowrap; }
.sort-direction:hover { border-color: var(--muted); }
.ais-CurrentRefinements-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.ais-CurrentRefinements-item { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; padding: 3px 8px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: .85rem; }
.ais-CurrentRefinements-label { color: var(--muted); }
.ais-CurrentRefinements-category { display: flex; gap: 4px; }
.ais-CurrentRefinements-delete { border: 0; background: none; color: var(--accent); }
.ais-Pagination-list { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
/* Sort and the top paginator sit together at the bar's right end */
.results-controls { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: flex-end; margin-left: auto; }
.pages { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: flex-end; }
.page-count { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pages-top .ais-Pagination-link { min-width: 30px; padding: 4px 8px; }
.pages-bottom { margin-top: 20px; }
.per-page { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.per-page button { width: 28px; height: 28px; padding: 0; border: 1px solid var(--line); border-radius: 6px;
                   background: var(--surface); color: var(--fg); line-height: 1; }
.per-page button:disabled { opacity: .4; }
.ais-Pagination-link { display: block; min-width: 34px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; text-align: center; text-decoration: none; background: var(--surface); }
.ais-Pagination-item--selected .ais-Pagination-link { background: var(--fg); color: var(--bg); }
.ais-Pagination-item--disabled { opacity: .4; }

.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.product { display: flex; flex-direction: column; gap: 4px; padding: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; min-width: 0; }
.product .image { position: relative; display: block; aspect-ratio: 1; max-width: 100%; background: #fff; border-radius: 6px; overflow: hidden; }
.product img { width: 100%; height: 100%; object-fit: contain; }
.product.sold-out img { opacity: .45; }
.badge { position: absolute; top: 6px; left: 6px; padding: 2px 7px; border-radius: 4px; font-size: .78rem; font-weight: 600; }
.badge.sale { background: var(--sale-bg); color: var(--sale); }
.badge.out { background: var(--fg); color: var(--bg); }
/* A result from makro.pro's search: its tag, on the card's own colour over the white image */
.product .source { position: absolute; top: 6px; right: 6px; padding: 0 3px; border-radius: 5px; background: var(--surface); line-height: 1.3; }
.makro-found { margin: 0; overflow-wrap: anywhere; }
.makro-results .grid[aria-busy="true"] { opacity: .6; }
.refine { min-height: 34px; padding: 5px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--fg); white-space: nowrap; }
.refine:hover { border-color: var(--muted); }
.chip.in-category { text-decoration: none; white-space: nowrap; }

/* makro.pro's category explorer: its tree scrolls inside the column, the queue bar stays at its foot;
   on phones a disclosure above the results */
.makro-categories { position: sticky; top: calc(var(--header-h) + 8px); display: flex; flex-direction: column; min-width: 0;
                    max-height: calc(100vh - var(--header-h) - 16px); }
.cat-disclosure { display: none; }
.cat-body { display: flex; flex-direction: column; gap: 6px; min-height: 0; }
.cat-heading { margin: 0; font-size: .75rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.cat-heading .makro-tag { text-transform: none; letter-spacing: 0; }
.cat-all { display: block; padding: 3px 0; text-decoration: none; }
.cat-all:hover, .cat-name:hover { text-decoration: underline; }
.cat-all[aria-current], .cat-name[aria-current] { font-weight: 600; color: var(--accent); }
.cat-tree { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.cat-tree, .cat-tree ul { list-style: none; margin: 0; padding: 0; }
.cat-tree ul { padding-left: 12px; }
.cat-row { display: grid; grid-template-columns: 20px 20px minmax(0, 1fr); grid-template-areas: "exp box name" ". . counts";
           column-gap: 2px; align-items: center; padding: 2px 0; }
.cat-row.current { box-shadow: inset 2px 0 0 var(--accent); }
.cat-expand { grid-area: exp; display: grid; place-items: center; width: 20px; height: 24px; padding: 0; border: 0; background: none; color: var(--muted); }
.cat-expand span { transition: transform .15s; }
.cat-expand[aria-expanded="true"] span { transform: rotate(90deg); }
.cat-row input { grid-area: box; width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.cat-name { grid-area: name; display: block; text-decoration: none; overflow-wrap: anywhere; }
.cat-name::first-letter { text-transform: uppercase; }
.cat-counts { grid-area: counts; font-family: var(--font-num); font-size: .72rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.queue-bar { display: flex; flex-direction: column; gap: 6px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.queue-status { margin: 0; font-size: .85rem; }
.queue-status:empty { display: none; }
.queue-actions { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
button.queue { padding: 8px 12px; border: 0; border-radius: 8px; background: var(--accent); color: var(--on-accent); font-weight: 600; text-align: left; }
@media (pointer: coarse) { .cat-row { padding-block: 5px; } .cat-expand { height: 32px; } .cat-row input { width: 20px; height: 20px; }
                           .cat-row { grid-template-columns: 28px 26px minmax(0, 1fr); } }
@media (max-width: 760px) {
  .makro-categories { position: static; max-height: none; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
  .cat-disclosure { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; width: 100%; min-height: 44px; padding: 10px 12px;
                    border: 0; background: none; color: var(--fg); font-weight: 600; text-align: left; }
  .cat-disclosure > span[aria-hidden] { display: inline-block; transition: transform .15s; }
  .makro-categories.open .cat-disclosure > span[aria-hidden] { transform: rotate(90deg); }
  .cat-disclosure .cat-current { font-weight: 400; overflow-wrap: anywhere; }
  .cat-disclosure .count { margin-left: auto; color: var(--muted); font-weight: 400; }
  .makro-categories:not(.open) .cat-body { display: none; }
  .cat-body { padding: 0 12px 12px; }
  .cat-heading { display: none; }
  .cat-tree { max-height: 60vh; }
}
.brand { font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-top: 4px; }
.title { text-decoration: none; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; min-height: 4.35em; }
.title:hover { text-decoration: underline; }
.pack { font-size: .82rem; color: var(--muted); }
.price { display: flex; flex-wrap: wrap; gap: 2px 8px; align-items: baseline; font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.price strong { font-size: 1.1rem; }
.price s { color: var(--muted); font-size: .85rem; }
.price .per-unit { flex-basis: 100%; }
.per-unit { font-family: var(--font-num); font-size: .85rem; color: var(--unit); font-variant-numeric: tabular-nums; }
.add { margin-top: auto; padding: 8px; border: 0; border-radius: 8px; background: var(--accent); color: var(--on-accent); font-weight: 600; }

.stepper { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 6px; border: 1px solid var(--accent); border-radius: 8px; }
.stepper button { width: 36px; height: 34px; border: 0; background: none; color: var(--accent); font-size: 1.15rem; }
.stepper.small span { font-family: var(--font-num); font-size: .9rem; }
/* Kept in place while hidden, so the icon doesn't jump when the first one goes in */
.stepper .invisible { visibility: hidden; }
.cart-count { display: inline-flex; padding: 4px 12px 2px 0; }
.cart-count.addable { cursor: pointer; }
/* A cart with an iOS-style notification badge: a red circle for one digit, a pill for more, ringed in
   the colour behind it (--badge-ring, the card's by default) to part it from the icon */
.cart-icon { position: relative; display: inline-flex; color: var(--fg); }
.cart-icon svg { display: block; }
.cart-badge { position: absolute; top: -6px; left: 14px; min-width: 18px; height: 18px; padding: 0 5px;
              border-radius: 9px; background: var(--badge); color: var(--on-badge);
              box-shadow: 0 0 0 2px var(--badge-ring, var(--surface));
              font: 700 11px/18px var(--font); font-variant-numeric: tabular-nums; text-align: center; white-space: nowrap; }
.summary { --badge-ring: var(--bg); }
.stepper.small { margin-top: 0; border-color: var(--line); }
.stepper.small button { width: 28px; height: 26px; color: var(--fg); }
/* The + of a product out of stock at Makro: amber on its tint; it still adds */
.stepper button.out-of-stock { background: var(--warn-bg); color: var(--warn); font-weight: 700; border-radius: 0 7px 7px 0; }
.stepper.small button.out-of-stock { border-radius: 0 6px 6px 0; }
.stock-label { align-self: flex-start; padding: 0 6px; border-radius: 4px; background: var(--warn-bg); color: var(--warn);
               font-size: .75rem; font-weight: 600; }
/* Adding many to the cart: the cart, then +3 or + All (12) */
.add-many { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.add-many .cart-icon { color: inherit; }
.add-many .cart-icon svg { width: 20px; height: 20px; }
.add-count { font-variant-numeric: tabular-nums; white-space: nowrap; }
.all-pill { padding: 0 6px; border: 1px solid currentColor; border-radius: 9px; font-size: .85em; }

/* Sticky, and never taller than the window: the items scroll inside it,
   so the heading, total and Empty cart stay in view however long it is */
.basket { position: sticky; top: 72px; display: flex; flex-direction: column;
  max-height: calc(100dvh - 72px - 16px - env(safe-area-inset-bottom, 0px));
  padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.basket > ul { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
@media (max-width: 1100px) { .basket { position: static; max-height: none; } }
.basket h2 { display: flex; align-items: center; gap: 14px; margin: 0 0 10px; font-size: 1rem; }
.basket ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.basket li { padding-block: 10px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.basket li a { text-decoration: none; font-size: .9rem; }
.basket li a:hover { text-decoration: underline; }
.line { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.amounts { display: flex; flex-direction: column; align-items: flex-end; }
.amount { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.amounts .per-unit { font-size: .75rem; }
.total { display: flex; justify-content: space-between; align-items: baseline; padding-top: 12px; border-top: 2px solid var(--fg); color: var(--muted); }
.total strong { color: var(--fg); font-family: var(--font-num); font-size: 1.25rem; }

/* Product page */
.product-page { min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.back { color: var(--muted); text-decoration: none; }
.product-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; }
@media (max-width: 760px) { .product-top { grid-template-columns: minmax(0, 1fr); } }
.gallery .main-image { aspect-ratio: 1; max-width: 100%; background: #fff; border-radius: 10px; overflow: hidden; }
.gallery .main-image img { width: 100%; height: 100%; object-fit: contain; }
.thumbs { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.thumbs button { width: 60px; height: 60px; padding: 0; border: 2px solid var(--line); border-radius: 6px; background: #fff; overflow: hidden; }
.thumbs button.on { border-color: var(--accent); }
.thumbs img { width: 100%; height: 100%; object-fit: contain; }
.summary { display: flex; flex-direction: column; gap: 8px; }
.summary h1 { margin: 0; font-size: 1.5rem; line-height: 1.25; }
.summary .th { margin: 0; color: var(--muted); }
.price.big strong { font-size: 1.8rem; }
.per-unit.big { margin: 0; font-size: 1.05rem; }
.summary .actions { margin-top: 4px; max-width: 300px; }
.stock { margin: 0; color: var(--sale); }
.stock.out { color: var(--accent); }
.seller { color: var(--muted); }
.product-page h2 { font-size: 1rem; margin: 0 0 8px; }
.tiers, .history { border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tiers th, .tiers td, .history td { padding: 4px 14px 4px 0; text-align: left; border-bottom: 1px solid var(--line); }
.tiers th { color: var(--muted); font-weight: 400; font-size: .85rem; }
.num { font-family: var(--font-num); text-align: right !important; }
.properties { display: grid; grid-template-columns: max-content 1fr; gap: 10px 16px; margin: 0; }
.properties > div { display: contents; }
.properties dt { color: var(--muted); font-size: .85rem; padding-top: 4px; }
.properties dd { margin: 0; min-width: 0; }
@media (max-width: 420px) {
  .properties { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .properties dd { margin-bottom: 8px; }
}
/* Each value's hierarchy as a breadcrumb of chips, root first; each opens the catalogue filtered to that level */
.trails { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.trail { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; row-gap: 4px; }
.trail li { display: flex; align-items: center; min-width: 0; }
.trail li + li::before { content: "›"; padding-inline: 5px; color: var(--muted); }
.trail .chip { display: inline-flex; align-items: baseline; max-width: 100%; text-decoration: none; overflow-wrap: anywhere; }
.trail li:last-child .chip { border-color: var(--fg); font-weight: 600; }
.trail li:last-child .chip:hover { border-color: var(--accent); }
.trail .chip .count { font-family: var(--font-num); font-size: .78rem; font-weight: 400; }
@media (pointer: coarse) { .trail .chip { padding-block: 6px; } }

/* "why": a ruling's reasoning and sources, under the value or pack size it explains */
.trail-row, .why-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.why-row > p { margin: 0; }
.why summary { list-style: none; cursor: pointer; font-size: .75rem; color: var(--muted); text-decoration: underline dotted; }
.why summary::-webkit-details-marker { display: none; }
.why summary:hover, .why[open] summary { color: var(--accent); }
@media (pointer: coarse) { .why summary { padding: 6px 4px; } }
.why[open] { flex-basis: 100%; }
.why-body { margin-top: 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font-size: .85rem; }
.why-reasoning { margin: 0 0 8px; }
.why-sources { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.why-sources li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; min-width: 0; overflow-wrap: anywhere; }
.why-label { color: var(--muted); font-size: .75rem; letter-spacing: .04em; text-transform: uppercase; }
.why-sources code { font-family: var(--font-num); font-size: .78rem; color: var(--muted); }
.why-sources q { color: var(--fg); }
.why-photo { display: block; width: 72px; height: 72px; object-fit: contain; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); }
.why-meta { margin: 8px 0 0; color: var(--muted); font-size: .75rem; }

/* Where the results sit in the category tree; a chip drops the text search */
.snap { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 12px; }
.snap > span { color: var(--muted); font-size: .85rem; }
.chip { font: inherit; font-size: .85rem; padding: 3px 10px; border: 1px solid var(--line); border-radius: 999px;
        background: var(--surface); color: var(--fg); cursor: pointer; }
.chip:hover { border-color: var(--accent); }
.chip .count { margin-left: 6px; color: var(--muted); font-variant-numeric: tabular-nums; }
.fresh { color: var(--muted); font-size: .85rem; }
.description { white-space: pre-line; max-width: 70ch; }
.attributes { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; }
.attributes dt { color: var(--muted); }
.attributes dd { margin: 0; }
.ais-HierarchicalMenu-showMore--disabled, .ais-RefinementList-showMore--disabled { display: none; }

/* Favourites: a star beside each Add button, and a page of lists */
.actions { margin-top: auto; display: flex; gap: 6px; align-items: stretch; }
.actions > .stepper, .actions > .add { flex: 1; margin-top: 0; }
.star { flex: none; width: 38px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
        color: var(--muted); font-size: 1.15rem; line-height: 1; }
.star:hover { border-color: var(--star); color: var(--star); }
.star.on { border-color: var(--star); color: var(--star); }
.top-nav { display: flex; gap: 16px; align-items: center; }
.top-nav a { color: var(--on-accent); text-decoration: none; font-weight: 600; }
.top-nav a:hover { text-decoration: underline; }
.on-lists { margin: 0; color: var(--muted); font-size: .9rem; }
.lists { display: flex; flex-direction: column; gap: 4px; }
.lists h2 { margin: 0 0 6px; font-size: 1rem; }
.lists h3 { margin: 12px 0 4px; font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.lists ul { list-style: none; margin: 0; padding: 0; }
.lists li a { display: flex; gap: 8px; justify-content: space-between; padding: 4px 8px; border-radius: 6px; text-decoration: none; }
.lists li a:hover { background: var(--surface); }
.lists li a.on { background: var(--surface); font-weight: 600; box-shadow: inset 3px 0 var(--accent); }
.lists .count { font-family: var(--font-num); font-size: .78rem; color: var(--muted); }
.list-view { min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.list-head { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: flex-start; }
.list-head h2 { margin: 0; font-size: 1.3rem; }
.list-head .note { margin: 4px 0 0; max-width: 60ch; }
.list-head .add { margin-top: 0; padding-inline: 16px; }
.lists-head { display: flex; gap: 8px; justify-content: space-between; align-items: baseline; }
.lists li { display: flex; align-items: center; gap: 2px; }
.lists li a { flex: 1; min-width: 0; }
.list-menu { flex: none; width: 28px; height: 28px; border: 0; border-radius: 6px; background: none; color: var(--muted); line-height: 1; }
.list-menu:hover, .list-menu[data-pressed], .list-menu[aria-expanded="true"] { background: var(--surface); color: var(--fg); }
.list-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.secondary { padding: 7px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--fg); font-weight: 600; }
.secondary:hover, .secondary[aria-pressed="true"] { border-color: var(--fg); }
.secondary.danger { color: var(--accent); }
.secondary.danger:hover { border-color: var(--accent); }

/* A list's products: React Aria's GridList, selected as in a file manager */
.product-grid { outline: none; }
.product-grid .product { cursor: default; user-select: none; -webkit-user-select: none; position: relative; outline: none; }
.product-grid .title:hover { text-decoration: none; }
.product-grid .product[data-hovered] { border-color: var(--muted); }
.product-grid .product[data-focus-visible] { outline: 2px solid var(--accent); outline-offset: 2px; }
.product-grid .product[data-selected] { border-color: var(--unit); box-shadow: 0 0 0 2px var(--unit); background: color-mix(in srgb, var(--unit) 8%, var(--surface)); }
.select-box { position: absolute; top: 14px; right: 14px; z-index: 1; }
.select-box .box { display: block; width: 22px; height: 22px; border: 2px solid var(--muted); border-radius: 6px; background: var(--surface); }
.select-box[data-selected] .box { border-color: var(--unit); background: var(--unit); }
/* The tick: two sides of a rotated box, in the surface colour on the filled box */
.select-box[data-selected] .box::after { content: ""; display: block; width: 6px; height: 11px; margin: 1px auto 0;
                                         border: solid var(--surface); border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); }
.select-box[data-focus-visible] .box { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Dragging products onto a list in the nav. The handle is where a keyboard or screen reader
   starts a drag (React Aria gives it no pointer events: a mouse drags the whole card). */
.drag-handle { position: absolute; top: 14px; left: 14px; z-index: 1; display: grid; place-items: center; width: 22px; height: 22px;
               padding: 0; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--muted);
               font-size: .85rem; line-height: 1; opacity: 0; }
.product-grid .product[data-hovered] .drag-handle, .product-grid .product[data-selected] .drag-handle,
.product-grid .product[data-focus-visible-within] .drag-handle { opacity: 1; }
.product-grid .product[data-hovered] { cursor: grab; }
.drag-handle[data-focus-visible] { opacity: 1; outline: 2px solid var(--accent); outline-offset: 2px; }
.product-grid .product[data-dragging] { opacity: .5; }
.drag-preview { display: inline-block; padding: 6px 14px; border-radius: 999px; background: var(--fg); color: var(--bg);
                font-weight: 600; font-size: .9rem; white-space: nowrap; }
/* While dragging: the lists that take a drop are outlined, the one under the pointer or keyboard filled */
.lists.dragging a.drop-ok { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--unit) 45%, transparent); }
.lists.dragging a.no-drop { opacity: .5; }
.lists li a[data-drop-target] { background: color-mix(in srgb, var(--unit) 18%, var(--surface)); color: var(--fg);
                                box-shadow: inset 0 0 0 2px var(--unit); }
.lists li a[data-drop-target] .count { color: var(--fg); }

/* Right under the red bar, whatever its height, so nothing shows between them */
.action-bar { position: sticky; top: var(--header-h); z-index: 1; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px 10px;
              background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.action-bar.empty { position: static; background: none; border-color: transparent; padding-inline: 0; }
.action-bar .add { margin-top: 0; padding-inline: 14px; }
.selected-count { margin-right: auto; font-weight: 600; }
.action-bar.empty .selected-count { font-weight: 400; color: var(--muted); font-size: .85rem; }
.action-bar .link { padding: 4px; border: 0; background: none; color: var(--accent); text-decoration: underline; }

/* Menus, dialogs and the undo toast, React Aria's, in portals at the body */
.popover { min-width: 180px; max-width: min(320px, calc(100vw - 32px)); background: var(--surface); color: var(--fg);
           border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 6px 24px rgb(0 0 0 / .18); overflow: auto; }
.menu { padding: 4px; outline: none; max-height: 50vh; }
.menu-item { padding: 6px 10px; border-radius: 6px; cursor: default; outline: none; }
.menu-item[data-focused] { background: var(--bg); }
.menu-item[data-disabled] { color: var(--muted); opacity: .6; }
.menu-item.danger { color: var(--accent); }
.menu-separator { height: 1px; margin: 4px 0; background: var(--line); }
.modal-overlay { position: fixed; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center; padding: 16px;
                 background: rgb(0 0 0 / .4); }
.modal { width: min(380px, 100%); background: var(--surface); color: var(--fg); border-radius: 12px; box-shadow: 0 10px 40px rgb(0 0 0 / .3); }
.dialog { padding: 18px; outline: none; }
.dialog h2 { margin: 0 0 12px; font-size: 1.1rem; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: .85rem; color: var(--muted); }
.field input { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--fg); }
.dialog-error { margin: 8px 0 0; color: var(--accent); font-size: .9rem; }
.field input[aria-invalid="true"] { border-color: var(--accent); }
.dialog-buttons { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.dialog-buttons .add { margin-top: 0; padding-inline: 16px; }
.toast { position: fixed; z-index: 4; left: calc(16px + env(safe-area-inset-left, 0px)); bottom: calc(16px + env(safe-area-inset-bottom, 0px));
         max-width: min(420px, calc(100vw - 96px)); display: flex; gap: 12px; align-items: center; padding: 10px 10px 10px 14px;
         background: var(--fg); color: var(--bg); border-radius: 10px; box-shadow: 0 6px 24px rgb(0 0 0 / .25); }
.toast .link { color: inherit; font-weight: 600; }
.toast-close { border: 0; background: none; color: inherit; font-size: 1.2rem; line-height: 1; opacity: .7; }

/* What belongs to the real makro.pro carries this tag, everywhere */
.makro { white-space: nowrap; color: inherit; text-decoration: none; }
a.makro:hover .makro-label { text-decoration: underline; }
.makro-tag { display: inline-block; padding: 0 5px; border: 1px solid var(--makro); border-radius: 4px;
             color: var(--makro); font-size: .72em; font-weight: 600; letter-spacing: .02em; line-height: 1.5;
             vertical-align: .1em; }
.lists h3 .makro-tag { letter-spacing: .02em; text-transform: none; }

/* The request queue: fixed bottom-right, clear of the notch and home bar; collapses to a round button */
.requests-dock { position: fixed; z-index: 3; right: calc(16px + env(safe-area-inset-right, 0px));
                 bottom: calc(16px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; align-items: flex-end; }
.requests { width: min(360px, calc(100vw - 32px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)));
            /* About 5 rows, the rest scrolling, so it covers little of the cart */
            max-height: min(50vh, 280px); display: flex; flex-direction: column; background: var(--surface); color: var(--fg);
            border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 6px 24px rgb(0 0 0 / .18); overflow: hidden; }
.requests[hidden] { display: none; }
.requests-head { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 14px; border-bottom: 1px solid var(--line); }
.requests-head h2 { margin: 0 auto 0 0; font-size: .9rem; display: flex; gap: 8px; align-items: baseline; }
.requests-outstanding { color: var(--unit); font-size: .78rem; font-weight: 400; font-family: var(--font-num);
                        font-variant-numeric: tabular-nums; white-space: nowrap; }
.requests-outstanding.stalling { color: var(--accent); font-weight: 600; }
.requests-head .link { font-size: .85rem; }
.requests-close { width: 32px; height: 32px; border: 0; border-radius: 6px; background: none; color: var(--muted); font-size: 1.3rem; line-height: 1; }
.requests-close:hover { background: var(--bg); color: var(--fg); }
.requests > .note { margin: 0; padding: 12px 14px; font-size: .85rem; }
.request-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; overscroll-behavior: contain; }
.request { display: flex; flex-direction: column; gap: 2px; padding: 7px 14px; border-top: 1px solid var(--line); font-size: .82rem;
           box-shadow: inset 3px 0 var(--muted); }
.request:first-child { border-top: 0; }
.request.in-flight { box-shadow: inset 3px 0 var(--unit); }
.request.done { box-shadow: inset 3px 0 var(--sale); animation: request-fade 1.5s ease 8s forwards; }
.request.cancelled { animation: request-fade 1.5s ease 8s forwards; }
.request.failed { box-shadow: inset 3px 0 var(--accent); }
@keyframes request-fade { to { opacity: .45; } }
.request-line { display: flex; gap: 10px; justify-content: space-between; align-items: baseline; min-width: 0; }
.request-label { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.request-path { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-family: var(--font-num); font-size: .75rem; }
.request-method { font-weight: 600; }
/* The path gives way to the sizes after it, which stay whole */
.request-where { display: flex; align-items: baseline; min-width: 0; }
.request-size { flex: none; white-space: pre; color: var(--muted); font-family: var(--font-num); font-size: .72rem;
                font-variant-numeric: tabular-nums; opacity: .85; }
.request-duration, .request-state { flex: none; font-family: var(--font-num); font-size: .75rem; font-variant-numeric: tabular-nums; color: var(--muted); }
.request.in-flight .request-state { color: var(--unit); }
.request.done .request-state { color: var(--sale); }
.request.failed .request-state { color: var(--accent); font-weight: 600; white-space: normal; text-align: right; }
.request-dismiss { align-self: flex-end; font-size: .78rem; padding: 2px 0; }
/* Round with only its icon; a pill with the in-flight summary beside it */
.requests-toggle { min-width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; gap: 8px;
                   padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
                   color: var(--fg); box-shadow: 0 3px 12px rgb(0 0 0 / .18); }
.requests-toggle:hover { border-color: var(--accent); }
/* Phones: the shopping list ends the page, so leave room below it for the dock's button */
@media (max-width: 760px) {
  .layout { padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
  .requests { max-height: min(40vh, 320px); }
}
