/*
 * The web app's styles.
 *
 * The colours are the ones in theme.js, and deliberately the same values: that
 * file's palette is WCAG-checked against the phone screens by
 * tests/contrast.test.mjs, so inventing a second palette here would mean
 * shipping text that fails contrast on the one surface nobody tested.
 *
 * Reused rather than imported because those tokens are a JavaScript module and
 * this is CSS — a build step that rewrote one into the other would be more
 * machinery than the handful of values is worth. If a colour changes in
 * theme.js, it changes here too; the list is short enough to keep in view.
 */

:root {
  --primary: #0c855d;
  --primary-light: #ecfdf5;
  --primary-border: #a7f3d0;
  --bg: #f8fafc;
  --surface: #ffffff;
  --ink: #1e293b;
  --ink-soft: #475569;
  --muted: #64748b;
  --border: #e2e8f0;
  --border-soft: #f1f5f9;
  --success: #166534;
  --danger: #dc2626;
  --danger-light: #fef2f2;
  --danger-border: #fecaca;

  /* Danger as TEXT, which is a different job from danger as a border or a fill.
     `--danger` is #dc2626, which theme.js records as 4.83:1 — measured against
     WHITE, which is where the phone puts it. On the tint below it is 4.41:1 and
     fails AA, so anything red on `--danger-light` uses this instead: 6.01:1 on
     the tint, 6.57:1 on white. */
  --danger-strong: #b42318;

  /* White on the primary fill, and the deeper green it presses to.
     Named after theme.js's tokens rather than after where they are used, so
     this file and that one stay two views of one palette. The two greens share
     a value today and are still two roles — the phone has them as
     primaryPressed and primaryOnTint for the same reason. */
  --on-primary: #ffffff;
  --primary-pressed: #0a6b4a;
  --primary-on-tint: #0a6b4a;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.08);
  --wrap: 920px;

  /* The type scale: four sizes.

     It was ten, including 12.5 and 13.5 — values nobody chose, which is where
     a design has landed rather than been decided. On a page whose whole job is
     to make a list of prices comparable, type that drifted per component is
     type that stops reading as one system. */
  --text-xs: 0.75rem;     /* 12px — captions, footnote lines */
  --text-sm: 0.875rem;    /* 14px — meta, buttons, helper text */
  --text-base: 1rem;      /* 16px — body, inputs, card names. Never smaller on
                             an input, because iOS zooms the page on focus */
  --text-lg: 1.25rem;     /* 20px — the wordmark, page-level figures */

  /* rem, not px, and that is the point rather than a style. A browser set to a
     larger default font leaves px untouched, so the reader's own text-size
     preference was being ignored on every one of the forty-odd sizes here. The
     root is the only place a pixel amount is right.

     Four steps: 12 / 14 / 16 / 20. There were five, and the one that went was
     18px — it was carrying the lede, a glyph in the wordmark badge, and the
     +/- glyph inside a button. A size used for a glyph inside a control is not
     a type role, and the lede reads the same a step up. Fewer steps that each
     mean something beats a scale padded to look complete. */
}

* { box-sizing: border-box; }

/* The `hidden` attribute loses to any display rule, and several things below
   are grids or flex containers — so it is enforced once here rather than
   remembered at every element that can be hidden. */
[hidden] { display: none !important; }

/* Declared because the page is light-only. Without it a browser in dark mode
   renders native controls — the chain `<select>` above all — in dark colours
   on a light page, and paints scrollbars to match the wrong theme. */
:root { color-scheme: light; }

/* A tap should not wait 300ms for a double-tap-to-zoom that never comes. */
button, a, label, input, select, summary { touch-action: manipulation; }

/* Skip link: off screen until focused, then a real target. The nav is four
   items and a sign-in on every page, and a keyboard user should not have to
   walk it on every navigation to reach the search box. */
.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 20;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 700;
  text-decoration: none;
}

.skip-link:focus { top: 12px; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 1rem/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* ---------- top bar ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 16px 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 800;
  font-size: var(--text-lg);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: 10px;
  background: var(--primary);
  color: var(--on-primary);
  font-size: var(--text-lg);
}

.topnav { display: flex; gap: 20px; flex-wrap: wrap; }

.topnav a {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: var(--text-base);
  font-weight: 500;
}

.topnav a:hover { color: var(--primary); }

/* Privatnost leaves the app while the four beside it switch view, so it is set
   apart rather than left to look like a fifth view that happens to reload the
   page. Separated rather than removed: the policy URL is a store requirement
   and belongs where people look for it. */
.navbtn.ext {
  margin-left: 4px;
  padding-left: 18px;
  border-left: 1px solid var(--border);
}

/* ---------- hero ---------- */

/* The bottom padding clears the home indicator on a phone, where the last
   control otherwise sits under the swipe bar. */
main {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 20px calc(64px + env(safe-area-inset-bottom, 0px));
}

.hero {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 24px 0 8px;
}

/* The app's mascot, at the size the phone shows it scaled for a desktop. */
.hero-mascot {
  flex: 0 0 auto;
  width: 104px;
  height: 104px;
  object-fit: contain;
}

.hero-text { min-width: 0; }

.hero h1 {
  margin: 0 0 10px;
  font-size: clamp(1.75rem, 5vw, 2.5rem);
  /* 1.3, not the 1.15 a display heading usually wants. These wrap to two lines
     on a phone — "Što je na akciji ovaj tjedan?" is not a one-line heading —
     and at 1.15 the second line crowds the first. Tight leading is a display
     choice that assumes one line. */
  line-height: 1.3;
  letter-spacing: -0.02em;
  /* Keeps a two-line heading from leaving one word on the second line. */
  text-wrap: balance;
}

/* The empty state, with the mascot the phone uses for one. */
.empty {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 32px 20px;
  text-align: center;
  color: var(--muted);
}

.empty img {
  width: 140px;
  height: 140px;
  object-fit: contain;
}

.empty p { margin: 0; max-width: 44ch; }

.lede {
  margin: 0;
  max-width: 62ch;
  color: var(--ink-soft);
  font-size: var(--text-lg);
}

/* ---------- search ---------- */

.search-section { padding: 28px 0 8px; }

.search-form {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow);
}

.search-input {
  flex: 1 1 260px;
  min-height: 48px;
  padding: 0 14px;
  font: inherit;
  color: var(--ink);
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
}

/* :focus-visible, not :focus — a mouse click on an input that then keeps a
   permanent ring reads as a stuck control, while a keyboard user still needs
   to see where they are. One rule for every interactive element rather than a
   style per component, so nothing ends up relying on the browser default while
   its neighbour has a designed one. */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}

.search-input:focus-visible,
.store-select:focus-visible {
  outline-offset: 1px;
  border-color: var(--primary);
}

.store-select {
  flex: 0 0 auto;
  min-height: 48px;
  padding: 0 34px 0 12px;
  font: inherit;
  color: var(--ink);
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 21px, calc(100% - 13px) 21px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.search-btn {
  min-height: 48px;
  padding: 0 22px;
  font: inherit;
  font-weight: 700;
  color: var(--on-primary);
  background: var(--primary);
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.search-btn:hover { background: var(--primary-pressed); }

.hint {
  margin: 10px 2px 0;
  color: var(--muted);
  font-size: var(--text-sm);
}

/* ---------- status ---------- */

.status:empty { display: none; }

.status {
  margin: 18px 2px 0;
  color: var(--ink-soft);
  font-size: var(--text-base);
}

.status.error {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--danger-light);
  border: 1px solid var(--danger-border);
  /* --danger-strong, not --danger: see the token's note. #dc2626 on this tint
     is 4.41:1 and fails AA; this is 6.01:1. */
  color: var(--danger-strong);
  font-weight: 600;
}

/* ---------- results ---------- */

.results {
  margin-top: 16px;
  display: grid;
  gap: 12px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  /* A search can render seventy of these — fifty flyer rows and twenty price
     rows. This skips layout and paint for the ones off screen, which is the
     cheap version of the virtualization a list this long would otherwise want.
     The intrinsic size keeps the scrollbar honest while they are skipped. */
  content-visibility: auto;
  contain-intrinsic-size: auto 120px;
}

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.card-name {
  margin: 0;
  font-size: var(--text-base);
  font-weight: 650;
  line-height: 1.35;
  /* Flyer names run long — "MIJEŠANO MLJEVENO MESO PIK, 850g" is ordinary —
     so break rather than push the price off the card. */
  overflow-wrap: anywhere;
}

/* Prices and totals stack in columns and should line up on the digit. */
.card-price,
.chain-total,
.chain-found,
.route-total,
.qty-n,
.card-meta .save {
  font-variant-numeric: tabular-nums;
}

.card-price {
  flex: 0 0 auto;
  font-size: var(--text-lg);
  font-weight: 800;
  color: var(--primary);
  white-space: nowrap;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 8px;
  color: var(--muted);
  font-size: var(--text-sm);
}

.chip-store {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--border-soft);
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--ink-soft);
  white-space: nowrap;
}

.chip-store i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: 0 0 auto;
}

/* The chain's own logo where assets/logos has one. Sized to the text rather
   than to a badge: 22 of the 29 chains have a file, so this reads as a label
   with a mark beside it, not as a missing image in the other seven. */
.chip-logo {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  object-fit: contain;
  border-radius: 4px;
}

.was {
  text-decoration: line-through;
  color: var(--muted);
}

.save {
  color: var(--success);
  font-weight: 700;
}

.valid { margin-left: auto; white-space: nowrap; }

/* ---------- about ---------- */

.about { margin-top: 56px; }

.about h2 {
  font-size: var(--text-lg);
  margin: 28px 0 10px;
}

.steps {
  margin: 0;
  padding-left: 20px;
  color: var(--ink-soft);
}

.steps li { margin-bottom: 6px; }

.about p { color: var(--ink-soft); max-width: 66ch; }

/* ---------- footer ---------- */

.footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.footer-inner {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 26px 20px 36px;
  color: var(--ink-soft);
  font-size: var(--text-sm);
}

.footer-brand { font-weight: 800; color: var(--ink); margin: 0 0 6px; }

.footer a { color: var(--primary); text-decoration: none; }
.footer a:hover { text-decoration: underline; }

.dot { color: var(--muted); margin: 0 6px; }

.footer-note { margin: 10px 0 0; color: var(--muted); font-size: var(--text-xs); }

/* ---------- the account panel ---------- */

.linkbtn.danger { color: var(--danger); }

.who {
  font-weight: 600;
  color: var(--muted);
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.consent-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
}

.consent-text { flex: 1; display: grid; gap: 3px; font-size: var(--text-sm); }
.consent-text strong { font-size: var(--text-base); }
.consent-text span { color: var(--muted); font-size: var(--text-xs); line-height: 1.5; }

.consent-box {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: var(--primary);
}

/* The address picker sits above the form that adds another. */
.where-pick {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.where-pick .store-select { flex: 1; max-width: 320px; }

/* ---------- watching a price ---------- */

.saved-list { display: grid; gap: 8px; }

.saved-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.saved-body { flex: 1; min-width: 0; display: grid; gap: 4px; }

.saved-name { font-weight: 650; }

/* The one line that answers "is it cheap yet". Tinted when the target has been
   met, so it reads at a glance rather than needing to be compared. */
.saved-status {
  font-size: var(--text-sm);
  color: var(--muted);
}

.saved-status.is-hit {
  color: var(--success);
  font-weight: 700;
}

.saved-status.is-waiting { font-style: italic; }

.saved-target {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.saved-target .search-input {
  min-height: 44px;
  max-width: 140px;
  padding: 0 12px;
  /* 16px, not 14: a smaller input font makes iOS Safari zoom the whole page
     when the field is focused, and the page then stays zoomed. This is the one
     place a size below the scale is a bug rather than a choice. */
  font-size: var(--text-base);
}

.saved-target .search-btn {
  min-height: 44px;
  padding: 0 16px;
  font-size: var(--text-sm);
}

/* ---------- product images ---------- */

.card-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.card-body { flex: 1; min-width: 0; }

/* contain, not cover: these are packshots on white backgrounds, and cropping
   a bottle to a square cuts the label off. */
.card-thumb {
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  object-fit: contain;
  border-radius: 8px;
  background: var(--bg);
}

/* Holds the space before a packshot arrives, so the text does not jump right
   when one does — and collapses to nothing when there is none. */
.thumb-slot {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
}

.thumb-slot:empty { display: none; }

/* The buttons a barcoded product carries. Below the row rather than beside the
   price, which is what the shopper came for. */
.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
}

.card-btn {
  min-height: 44px;
  padding: 0 16px;
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.card-btn:hover { background: var(--primary-border); }

/* The "show all" row that keeps fifty inert flyer cards from burying the
   price block below them. Centred because it is a control over the list, not
   a member of it. */
.show-all {
  display: flex;
  justify-content: center;
  padding: 4px 0;
}

.basket-thumb {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
}

.basket-thumb .card-thumb { width: 40px; height: 40px; }

/* ---------- nav and account ---------- */

.navbtn {
  display: inline-block;
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--ink-soft);
  text-decoration: none;
  cursor: pointer;
}

.navbtn:hover { color: var(--primary); }

.navbtn.is-active {
  color: var(--primary);
  font-weight: 700;
}

.account {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: var(--text-sm);
}

.linkbtn {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
}

.linkbtn:hover { text-decoration: underline; }

/* ---------- signing in ---------- */

.signin {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: start center;
  padding: 84px 20px 20px;
  background: rgba(15, 23, 42, 0.42);
  /* Scrolling inside the overlay should not scroll the page behind it, and
     reaching its end should not start rubber-banding the document. */
  overflow-y: auto;
  overscroll-behavior: contain;
}

.signin-form {
  width: min(420px, 100%);
  display: grid;
  gap: 12px;
  padding: 22px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.25);
}

.signin-form h2 { margin: 0; font-size: var(--text-lg); }

.signin-sub {
  margin: 0 0 4px;
  color: var(--ink-soft);
  font-size: var(--text-sm);
}

.signin-msg {
  margin: 2px 0 0;
  min-height: 20px;
  font-size: var(--text-sm);
  color: var(--muted);
}

.signin-msg.error { color: var(--danger); font-weight: 600; }

.signin-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
}

/* ---------- chat ---------- */

.locked {
  display: grid;
  gap: 12px;
  justify-items: start;
  margin-top: 20px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--ink-soft);
}

.locked p { margin: 0; }

.chat-log {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}

.turn { display: flex; }
.turn-user { justify-content: flex-end; }
.turn-bot { justify-content: flex-start; }

.bubble {
  max-width: min(680px, 92%);
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* The same green-on-tint pairing the Popis screen uses, and the same reason:
   primaryStrong as text, not primary. */
.turn-user .bubble {
  background: var(--primary-light);
  border-color: var(--primary-border);
  color: var(--primary-on-tint);
}

.answer { margin: 0; }
.answer + .results { margin-top: 10px; }

/* Products inside a chat bubble lose the card chrome. A card inside a card is
   two borders and two shadows to say one thing — the bubble already groups
   them, so the products only need separating from each other. */
.bubble .card {
  padding: 0;
  background: none;
  border: 0;
  box-shadow: none;
  content-visibility: visible;
}

.bubble .card + .card {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
}

.chat-form {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.chat-form .search-input { flex: 1; }

/* ---------- basket ---------- */

.section-title {
  margin: 32px 0 10px;
  font-size: var(--text-lg);
}

/* Where the shopper is. Subordinate to the list below it — it is a setting,
   not the thing they came for. */
.where { margin-top: 8px; }

.where .search-form { align-items: center; }

.where .linkbtn {
  align-self: center;
  padding: 0 4px;
}

.basket-list { display: grid; gap: 8px; }

.basket-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.basket-name {
  flex: 1;
  font-weight: 600;
  /* min-width: 0, or the name wins the argument with the buttons. A flex item
     defaults to min-width: auto, which refuses to shrink below its content —
     so one long unbreakable product name pushes the +/- controls off the row
     rather than wrapping. Anywhere, because these names come off flyers and
     are not guaranteed to have spaces in them. */
  min-width: 0;
  overflow-wrap: anywhere;
}

.qty { display: inline-flex; align-items: center; gap: 2px; }

.qty-btn {
  display: grid;
  place-items: center;
  /* 44, not 30. These are the most-tapped controls in the basket — adding a
     second milk, taking one off — and they were the smallest thing on the
     page. The audit's criterion is 44; WCAG 2.2 AA only asks for 24, so this
     was passing the letter and failing the thumb. */
  width: 44px;
  height: 44px;
  font: inherit;
  font-size: var(--text-lg);
  line-height: 1;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}

.qty-btn:hover { border-color: var(--primary); color: var(--primary); }

.qty-n {
  min-width: 22px;
  text-align: center;
  font-weight: 700;
}

/* Collapsed by default: it is a setting, and most people never change it. */
.stores {
  margin-top: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}

.stores summary {
  cursor: pointer;
  font-weight: 700;
  font-size: var(--text-sm);
}

.stores-count { color: var(--muted); font-weight: 500; }

.stores .search-input {
  min-height: 40px;
  margin-top: 12px;
  font-size: var(--text-base);
}

.store-filter {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px 16px;
  margin-top: 12px;
}

.store-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--text-sm);
  cursor: pointer;
}

.store-opt input { width: 16px; height: 16px; accent-color: var(--primary); }

.basket-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 18px;
}

.basket-actions .search-btn:disabled { opacity: 0.5; cursor: default; }

.chain-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 4px 14px;
  align-items: center;
  padding: 10px 14px;
  margin-bottom: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

/* The only row whose total describes the whole list. */
.chain-row.is-best {
  border-color: var(--primary-border);
  background: var(--primary-light);
}

.chain-name { font-weight: 700; }
.chain-found { color: var(--muted); font-size: var(--text-sm); }
.chain-total { font-weight: 800; color: var(--primary); text-align: right; }

.chain-missing {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: var(--text-xs);
}

/* The branch's address, under a chain's row. A line of its own rather than a
   fourth column: the grid is three columns wide and an address does not fit. */
.chain-where {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: var(--text-xs);
}

/* Dotted rather than a solid underline: it is a link out to a map, not part of
   the sentence. */
.chain-link {
  color: var(--primary);
  text-decoration: none;
  border-bottom: 1px dotted currentColor;
}

.chain-link:hover { border-bottom-style: solid; }

/* ---------- the trip ---------- */

.route-card {
  margin-top: 12px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.route-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.route-title { font-weight: 800; font-size: var(--text-base); }
.route-total { font-weight: 800; font-size: var(--text-lg); color: var(--primary); }
.route-sub { margin-top: 2px; color: var(--ink-soft); font-size: var(--text-sm); }
.route-goods { color: var(--muted); font-size: var(--text-xs); }

.route-stops {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding-left: 20px;
}

.route-stops li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0 10px;
  font-size: var(--text-sm);
}

.route-stop-name { font-weight: 700; }
.route-stop-total { font-weight: 700; color: var(--primary); }

.route-stop-where {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: var(--text-xs);
}

.route-missing { margin-top: 8px; color: var(--muted); font-size: var(--text-xs); }

.route-btn {
  display: inline-block;
  margin-top: 16px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: var(--on-primary);
  font-size: var(--text-sm);
  font-weight: 700;
  text-decoration: none;
}

.route-btn:hover { background: var(--primary-pressed); }

/* ---------- narrow screens ---------- */

@media (max-width: 560px) {
  .topbar { flex-direction: column; align-items: flex-start; gap: 10px; }
  .topnav { gap: 14px; flex-wrap: wrap; }
  .search-btn { flex: 1 1 100%; }
  .store-select { flex: 1 1 100%; }
  .valid { margin-left: 0; }
  .bubble { max-width: 100%; }
  .signin { padding: 16px; }

  /* Smaller beside the heading rather than above it: a 104px picture over the
     text pushes the search box off a phone's first screen, and the search box
     is the whole point of the page. */
  .hero-mascot { width: 68px; height: 68px; }
  .hero { gap: 14px; }
}
