/* ---------------------------------------------------------------------------
   Mapstore web client styles.

   Design tokens follow the brief: a neutral light-grey base with translucent
   "frosted glass" panels floating over the map. No dark slate, no bright
   accent green.

   Layout: pre-search renders a centred hero card. Post-search the body
   becomes a two-column grid on >= 960 px viewports (list 40 / map 60),
   stacked on narrow screens (map on top, list below).
   --------------------------------------------------------------------------- */

:root {
  /* base */
  --bg: #ECEEF1;
  --ink: #1B1F24;
  --ink-soft: #5B636C;
  --hairline: rgba(27, 31, 36, 0.10);

  /* glass surfaces */
  --glass: rgba(248, 249, 251, 0.72);
  --glass-strong: rgba(248, 249, 251, 0.88);
  --glass-edge: rgba(255, 255, 255, 0.55);
  --glass-shadow: 0 8px 30px rgba(20, 26, 33, 0.12);

  /* neutral accent (CTAs / selected chips) */
  --accent: #2B2F36;
  --accent-ink: #FFFFFF;
  --accent-soft: rgba(43, 47, 54, 0.08);

  /* route + primary-stop emphasis */
  --route: #0E5C4A;

  /* semantic availability */
  --confirmed: #2F7D52;
  --likely: #B07A2E;
  --unconfirmed: #8A8F8B;

  /* shapes */
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --pill: 999px;

  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.45;
}

body {
  /* A subtle gradient so the glass panels have something to refract. */
  background:
    radial-gradient(1200px 800px at 20% -10%, #DBE3EC 0%, transparent 60%),
    radial-gradient(1000px 600px at 110% 110%, #D8E6E0 0%, transparent 55%),
    var(--bg);
  min-height: 100vh;
}

button { font: inherit; }

/* ---------- glass primitives --------------------------------------------- */

.glass,
.glass-strong {
  background: var(--glass);
  -webkit-backdrop-filter: blur(20px) saturate(120%);
  backdrop-filter: blur(20px) saturate(120%);
  border: 1px solid var(--hairline);
  box-shadow: var(--glass-shadow), inset 0 1px 0 var(--glass-edge);
  border-radius: var(--radius-lg);
}
.glass-strong { background: var(--glass-strong); }

/* Fallback for browsers without backdrop-filter (Firefox in default config,
   older Safari). Swap to near-opaque so text never goes unreadable. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass,
  .glass-strong { background: rgba(248, 249, 251, 0.97); }
}

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

.topbar {
  position: sticky;
  top: 12px;
  z-index: 50;
  margin: 12px 16px 0;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  border-radius: var(--pill);
}

.brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  color: var(--ink);
  /* Slightly negative top margin so the cursive wordmark's optical baseline
     aligns with the tagline next to it. */
  margin-top: -2px;
}
.brand:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 6px;
}
.brand-logo {
  display: block;
  height: 38px;
  width: auto;
  /* The bundled PNG has a hairline drop shadow already baked in, so we let
     it render as-is rather than adding a CSS filter on top. */
  user-select: none;
}
@media (max-width: 720px) {
  .brand-logo { height: 32px; }
}
.brand-tag {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13.5px;
  flex: 1;
}

/* Header right: cart + account affordances (spec section 15). The
   tagline is hidden on narrow viewports so the action buttons stay
   visible without crowding the brand. */
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.header-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 14px;
  border-radius: var(--pill);
  border: 1px solid var(--hairline);
  background: rgba(255, 255, 255, 0.55);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: var(--ink);
  font-size: 13.5px;
  cursor: pointer;
  transition: background 120ms ease, transform 120ms ease;
}
.header-btn:hover {
  background: rgba(255, 255, 255, 0.85);
}
.header-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.header-btn-label { font-weight: 500; }
.cart-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 2px 6px rgba(20, 26, 33, 0.18);
}
@media (max-width: 720px) {
  .brand-tag { display: none; }
  .header-btn-label { display: none; }
  .header-btn { padding: 0 10px; }
}

/* ---------- side panels (cart, account, claim) ------------------------- */

.panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 26, 33, 0.32);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  z-index: 200;
  display: flex;
  justify-content: flex-end;
}
.side-panel {
  width: min(420px, 100vw);
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: rgba(248, 249, 251, 0.96);
  -webkit-backdrop-filter: blur(24px) saturate(120%);
  backdrop-filter: blur(24px) saturate(120%);
  border-left: 1px solid var(--hairline);
  box-shadow: -12px 0 40px rgba(20, 26, 33, 0.18);
  animation: slide-in 220ms ease-out;
}
@keyframes slide-in {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
.side-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--hairline);
}
.side-panel-head h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
}
.side-panel-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.side-panel-foot {
  padding: 16px 20px calc(16px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--hairline);
  background: rgba(248, 249, 251, 0.98);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--pill);
  border: 1px solid var(--hairline);
  background: rgba(255, 255, 255, 0.55);
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.9); }
.icon-btn.small { width: 26px; height: 26px; font-size: 12px; }

.cart-line {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--hairline);
  background: rgba(255, 255, 255, 0.55);
}
.cart-line-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.cart-line-title {
  font-weight: 600;
  flex: 1;
}
.cart-line-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-soft);
  font-size: 13px;
}
.cart-line-costs {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13.5px;
}
.cart-line-costs li {
  display: flex;
  justify-content: space-between;
  color: var(--ink-soft);
}
.cart-line-costs li span { color: var(--ink); font-variant-numeric: tabular-nums; }
.cart-foot-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 16px;
}
.cart-foot-total strong { font-size: 22px; font-variant-numeric: tabular-nums; }

.account-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--hairline);
  background: rgba(255, 255, 255, 0.55);
}
.account-block h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.account-note {
  margin: 0;
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.5;
}
.account-menu {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.account-menu li {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--hairline);
  font-size: 14px;
}
.account-menu li:last-child { border-bottom: none; }
.empty {
  margin: 16px 0;
  color: var(--ink-soft);
  font-size: 14px;
  text-align: center;
}

/* ---------- shell layout ------------------------------------------------- */

.shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.layout {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  padding: 16px;
  align-items: start;
}

/* Pre-search: hide the map column entirely and let the list panel breathe. */
.shell:not(.has-result) .panel-map { display: none; }
.shell:not(.has-result) .layout {
  grid-template-columns: minmax(0, 720px);
  justify-content: center;
  padding-top: 6vh;
}

.panel-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

/* The map column. Sticky on wide screens so the user can scroll the list
   without losing the map. */
.panel-map {
  position: relative;
  min-width: 0;
  min-height: 280px;
}

/* Desktop / tablet landscape: two-column split. */
@media (min-width: 960px) {
  .shell.has-result .layout {
    grid-template-columns: minmax(420px, 40fr) minmax(0, 60fr);
  }
  .shell.has-result .panel-list {
    max-height: calc(100vh - 110px);
    overflow-y: auto;
    padding-right: 4px;
  }
  .shell.has-result .panel-map {
    position: sticky;
    top: 90px;
    height: calc(100vh - 110px);
  }
}

/* Narrow screens: stack with the map pinned on top of the list. */
@media (max-width: 959.98px) {
  .shell.has-result .layout {
    grid-template-columns: 1fr;
  }
  .shell.has-result .panel-map {
    order: -1;
    height: 45vh;
    min-height: 280px;
  }
}

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

.search-card {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.search-label {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  text-transform: uppercase;
}

.search-input {
  width: 100%;
  min-height: 96px;
  resize: vertical;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font: inherit;
  background: rgba(255, 255, 255, 0.85);
  color: var(--ink);
  outline: none;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.search-input::placeholder { color: var(--ink-soft); }
.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.search-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.cta {
  background: var(--accent);
  color: var(--accent-ink);
  border: 0;
  border-radius: var(--pill);
  padding: 10px 22px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.08s ease, background 0.12s ease;
}
.cta:hover { background: #14171B; }
.cta:active { transform: translateY(1px); }
.cta:disabled { opacity: 0.6; cursor: progress; }
.cta-light { background: #FFFFFF; color: var(--ink); border: 1px solid var(--hairline); }

.user-loc {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 13px;
}
.loc-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2563EB;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.18);
}

.chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 2px;
}
.chip {
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
  border: 1px solid var(--hairline);
  border-radius: var(--pill);
  padding: 6px 12px;
  font-size: 12.5px;
  cursor: pointer;
  transition: background 0.12s ease;
}
.chip:hover { background: rgba(255, 255, 255, 0.95); }

/* ---------- plan strip --------------------------------------------------- */

.section-title {
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 14px 4px 6px;
  font-weight: 700;
}

.plan-strip {
  display: flex;
  /* `align-items: flex-start` so each chip is sized to its own intrinsic
     height instead of being stretched to the row baseline (which collapsed
     them to 22 px). */
  align-items: flex-start;
  /* Let chips wrap onto a second row when the panel is too narrow for
     all of them. The previous `overflow-x: auto` turned this element
     into a scroll container which, as a flex item inside the
     column-flex `.panel-list` (max-height + overflow-y: auto on
     desktop), was free to collapse vertically to 8 px and hide the
     chips behind the next card. Wrapping side-steps that entirely. */
  flex-wrap: wrap;
  gap: 8px;
  padding: 2px 0;
  /* Belt-and-braces: never let the parent column flex shrink us
     vertically below our intrinsic content height. */
  flex: 0 0 auto;
  min-height: 72px;
}

.plan-chip {
  flex: 0 0 auto;
  min-width: 168px;
  min-height: 64px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  backdrop-filter: blur(14px) saturate(120%);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(20, 26, 33, 0.06);
  transition: transform 0.08s ease, background 0.12s ease, color 0.12s ease;
  user-select: none;
}
.plan-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.plan-chip > * + * { margin-top: 2px; }
.plan-chip:hover { transform: translateY(-1px); }
.plan-chip.active {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}
.plan-chip.active .plan-meta,
.plan-chip.active .plan-meta.dim { color: rgba(255, 255, 255, 0.82); }

.plan-label { font-weight: 700; font-size: 13.5px; }
.plan-meta { font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; }
.plan-meta.dim { opacity: 0.85; }

/* ---------- plan summary ------------------------------------------------- */

.plan-summary { padding: 14px 16px; }
.plan-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.plan-summary-stops { font-weight: 800; font-size: 18px; }
.plan-summary-dist { color: var(--ink-soft); font-size: 13px; }
.plan-summary-price { font-weight: 800; font-size: 22px; }

/* ---------- stops list --------------------------------------------------- */

.stops {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stop-card {
  padding: 12px 14px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  cursor: pointer;
  transition: transform 0.08s ease, border-color 0.12s ease;
}
.stop-card:hover { transform: translateY(-1px); }
.stop-card.primary { border-color: var(--route); }
.stop-card.selected {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.stop-pin {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: #FFFFFF;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
  border: 2px solid;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}
.stop-pin.primary {
  width: 32px;
  height: 32px;
  font-size: 14px;
  outline: 2px solid var(--route);
  outline-offset: 2px;
}

.stop-body { flex: 1; min-width: 0; }
.stop-name { font-weight: 700; font-size: 15px; display: block; }
.stop-addr { color: var(--ink-soft); font-size: 12.5px; margin: 2px 0 8px; }

.line-items {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.line-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  font-size: 13.5px;
}
.line-item-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.line-item-title { color: var(--ink-soft); }
.line-item-right { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }

/* ---------- FontAwesome icon chips -------------------------------------- */

.fa-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 2px 0 0;
}
.fa-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 22px;
  border-radius: 8px;
  background: rgba(43, 47, 54, 0.06);
  color: var(--ink);
  font-size: 11px;
  cursor: help;
  border: 1px solid var(--hairline);
  transition: background 0.12s ease;
}
.fa-chip:hover { background: rgba(43, 47, 54, 0.12); }
.fa-chip i { font-size: 12px; line-height: 1; }
.fa-chip-logistics {
  background: rgba(37, 99, 235, 0.08);
  color: #1d4fc0;
  border-color: rgba(37, 99, 235, 0.18);
}
.fa-chip-service {
  background: rgba(47, 125, 82, 0.10);
  color: #1f6041;
  border-color: rgba(47, 125, 82, 0.22);
}
.fa-chip-overflow {
  font-weight: 700;
  padding: 0 6px;
  width: auto;
  min-width: 26px;
}

/* ---------- Add-to-cart sheet ------------------------------------------ */

.atc-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11, 13, 16, 0.45);
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 12px;
}

.atc-sheet {
  width: min(560px, 100%);
  max-height: 92vh;
  border-radius: 18px;
  background: rgba(248, 249, 251, 0.96);
  box-shadow: 0 24px 60px rgba(11, 13, 16, 0.30);
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.atc-head {
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--hairline);
  background: rgba(248, 249, 251, 0.96);
}

.atc-body {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 16px 12px;
  min-height: 0;
}

.atc-product { font-weight: 800; font-size: 16px; }
.atc-merchant { color: var(--ink-soft); font-size: 13px; margin-top: 2px; }

.atc-close {
  background: rgba(43, 47, 54, 0.06);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
}
.atc-close:hover { background: rgba(43, 47, 54, 0.16); }

.atc-section {
  margin-top: 16px;
}
.atc-h3 {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 8px;
}

.atc-mode {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--hairline);
  cursor: pointer;
  margin-bottom: 6px;
}
.atc-mode.active {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  background: rgba(43, 47, 54, 0.05);
}
.atc-mode-icon {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(37, 99, 235, 0.10);
  border-radius: 8px;
  color: #1d4fc0;
}
.atc-mode-label { flex: 1; font-weight: 700; }
.atc-mode-fee { font-weight: 700; color: var(--ink); }

.atc-pickup-note {
  font-size: 13px;
  color: var(--ink-soft);
  margin: 8px 4px 0;
}

.atc-receiver {
  margin-top: 10px;
}
.atc-receiver-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
  margin-bottom: 6px;
}
.atc-address {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--hairline);
  background: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  margin-bottom: 6px;
}
.atc-address.active {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  background: rgba(43, 47, 54, 0.05);
}
.atc-address-label { font-weight: 700; font-size: 14px; }
.atc-address-line { color: var(--ink-soft); font-size: 12.5px; margin-top: 2px; }
.atc-live .atc-address-label { display: inline-flex; align-items: center; gap: 6px; }

.atc-service {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--hairline);
  cursor: pointer;
  margin-bottom: 6px;
}
.atc-service.selected {
  outline: 2px solid var(--confirmed);
  outline-offset: -2px;
  background: rgba(47, 125, 82, 0.08);
}
.atc-service-icon {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(47, 125, 82, 0.10);
  border-radius: 8px;
  color: #1f6041;
}
.atc-service-body { flex: 1; min-width: 0; }
.atc-service-label { font-weight: 700; font-size: 14px; }
.atc-service-descr {
  color: var(--ink-soft); font-size: 12.5px; margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.atc-service-price {
  font-weight: 700;
  white-space: nowrap;
  font-size: 13px;
}

.atc-foot {
  flex: 0 0 auto;
  padding: 12px 16px 16px;
  background: rgba(248, 249, 251, 0.96);
  border-top: 1px solid var(--hairline);
  box-shadow: 0 -8px 24px rgba(11, 13, 16, 0.08);
}
.atc-total-line {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 4px;
}
.atc-total-grand {
  display: flex;
  justify-content: space-between;
  font-size: 16px;
  font-weight: 800;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--hairline);
}
.atc-confirm {
  width: 100%;
  margin-top: 10px;
  padding: 12px 16px;
  font-size: 15px;
}
.atc-loading {
  color: var(--ink-soft);
  font-size: 13px;
  margin: 4px;
}

/* ---------- Clickable product + merchant link buttons ------------------- */

.link-product,
.link-merchant {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  display: inline-block;
  max-width: 100%;
}

.link-product:hover,
.link-product:focus-visible,
.link-merchant:hover,
.link-merchant:focus-visible {
  text-decoration: underline;
  text-underline-offset: 3px;
  outline: none;
}

.link-merchant {
  color: var(--accent);
  font-weight: 700;
}

.link-product {
  color: var(--ink);
}

/* ---------- Product + merchant detail sheets ---------------------------- */

.detail-attrs {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  font-size: 13px;
}
.detail-attrs th,
.detail-attrs td {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid var(--hairline);
}
.detail-attrs th {
  color: var(--ink-soft);
  font-weight: 600;
  width: 40%;
}
.detail-attrs td { color: var(--ink); }
.detail-attrs tr:last-child th,
.detail-attrs tr:last-child td { border-bottom: 0; }

.detail-offers {
  list-style: none;
  padding: 0;
  margin: 0;
}
.detail-offer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--hairline);
  margin-bottom: 6px;
}
.detail-offer-main { flex: 1; min-width: 0; }
.detail-offer-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 4px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--ink-soft);
}
.detail-offer-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.merchant-stats {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.merchant-stat {
  display: inline-flex;
  flex-direction: column;
  font-size: 13.5px;
}
.merchant-stat strong {
  font-size: 11px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 800;
}
.merchant-note {
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--ink);
  font-size: 12.5px;
  margin: 8px 0 0;
}

.add {
  background: #FFFFFF;
  color: var(--ink);
  border: 1px solid var(--hairline);
  border-radius: var(--pill);
  padding: 5px 12px;
  font-weight: 600;
  cursor: pointer;
  font-size: 12.5px;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.add:hover { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* ---------- per-need offers --------------------------------------------- */

.need-block { margin: 14px 0 6px; }
.need-title { font-weight: 700; font-size: 14.5px; margin: 6px 4px 8px; }

.offer-card {
  padding: 14px;
  margin: 8px 0;
  cursor: pointer;
  transition: transform 0.08s ease;
}
.offer-card:hover { transform: translateY(-1px); }
.offer-card.selected { outline: 2px solid var(--accent); outline-offset: -2px; }

.offer-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.offer-name { font-weight: 700; font-size: 15.5px; display: block; }
.offer-title { color: var(--ink-soft); font-size: 13px; margin-top: 2px; display: block; }
.offer-title.link-product { color: var(--ink-soft); }
.offer-price { font-weight: 800; font-size: 17px; }

.offer-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin: 10px 0 2px;
}

.badge {
  --badge: var(--unconfirmed);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: var(--pill);
  border: 1px solid var(--badge);
  color: var(--badge);
  font-size: 12px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.7);
}
.badge .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--badge);
  display: inline-block;
}
.meta { color: var(--ink-soft); font-size: 12.5px; }

.rationale {
  background: rgba(14, 92, 74, 0.06);
  border-left: 3px solid var(--route);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  margin: 10px 0 4px;
  font-size: 13px;
  color: var(--ink);
}

.offer-actions { display: flex; justify-content: flex-end; margin-top: 8px; }

/* ---------- map ---------------------------------------------------------- */

.map-shell {
  width: 100%;
  height: 100%;
  min-height: 280px;
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--glass-shadow);
  border: 1px solid var(--hairline);
}
.map-canvas { width: 100%; height: 100%; min-height: 280px; }

.map-unavailable {
  position: absolute;
  inset: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
}
.map-unavailable-title { font-weight: 800; font-size: 16px; margin-bottom: 6px; }
.map-unavailable-body { color: var(--ink-soft); font-size: 13px; }

/* Leaflet integration tweaks: keep the OSM attribution legible against a
   light theme without recoloring tiles. */
.leaflet-control-attribution {
  background: rgba(255, 255, 255, 0.78) !important;
  color: var(--ink-soft) !important;
  border-radius: 6px 0 0 0;
  font-size: 11px !important;
}
.leaflet-control-attribution a { color: var(--ink) !important; }
.leaflet-control-zoom a {
  background: rgba(255, 255, 255, 0.92) !important;
  color: var(--ink) !important;
  border: 1px solid var(--hairline) !important;
}
.leaflet-popup-content-wrapper {
  background: var(--glass-strong);
  -webkit-backdrop-filter: blur(20px) saturate(120%);
  backdrop-filter: blur(20px) saturate(120%);
  border: 1px solid var(--hairline);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius-md);
  padding: 4px 4px;
}
.leaflet-popup-tip { background: rgba(248, 249, 251, 0.92); }
.leaflet-popup-content { margin: 8px 12px; color: var(--ink); }

.mp-popup { min-width: 180px; }
.mp-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14.5px;
  font-weight: 700;
}
.mp-stop {
  display: inline-flex;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 11px;
}
.mp-item { color: var(--ink-soft); font-size: 12.5px; margin-top: 4px; }
.mp-row { display: flex; gap: 10px; margin-top: 6px; }
.mp-price { font-weight: 800; }
.mp-meta { color: var(--ink-soft); font-size: 12px; }
.mp-add {
  margin-top: 10px;
  width: 100%;
  background: var(--accent);
  color: var(--accent-ink);
  border: 0;
  border-radius: var(--pill);
  padding: 6px 12px;
  font-weight: 700;
  cursor: pointer;
}
.mp-add:hover { background: #14171B; }

/* Pin SVG container drop-shadow */
.mapstore-pin { background: transparent !important; border: 0 !important; }
.mapstore-user-dot { background: transparent !important; border: 0 !important; }

/* ---------- cart bar (floating) ----------------------------------------- */

.cart-bar {
  position: fixed;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  border-radius: var(--pill);
  font-weight: 600;
}
.cart-total { font-weight: 800; font-size: 16px; }


/* ---------- merchant detail rich profile + claim ------------------------ */

.merchant-status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 6px;
  align-items: center;
}
.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--pill);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.status-chip.status-verified {
  background: rgba(31, 156, 92, 0.14);
  color: #1F9C5C;
}
.status-chip.status-claimed {
  background: rgba(31, 90, 156, 0.14);
  color: #1F5A9C;
}
.status-chip.status-provisional {
  background: rgba(196, 110, 25, 0.16);
  color: #9C5A1F;
}
.merchant-tag {
  font-size: 12px;
  color: var(--ink-soft);
  background: var(--surface-soft, rgba(255, 255, 255, 0.6));
  border: 1px solid var(--border, rgba(0, 0, 0, 0.06));
  padding: 4px 10px;
  border-radius: var(--pill);
}
.merchant-about {
  margin: 8px 0 12px;
  color: var(--ink);
  line-height: 1.45;
  font-size: 14px;
}
.merchant-block {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.merchant-block-h {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  margin: 0 0 4px;
  font-weight: 700;
}
.merchant-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.merchant-chip {
  background: var(--surface-soft, rgba(255, 255, 255, 0.55));
  border: 1px solid var(--border, rgba(0, 0, 0, 0.08));
  border-radius: var(--pill);
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  text-transform: capitalize;
}
.merchant-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink);
}
.merchant-line-text {
  margin: 4px 0;
  font-size: 13px;
  color: var(--ink);
  line-height: 1.4;
}
.merchant-line-meta {
  font-size: 12px;
  color: var(--ink-soft);
}
.claim-cta {
  margin-top: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--pill);
  background: var(--accent);
  color: var(--accent-ink);
  border: 0;
  font-weight: 700;
  cursor: pointer;
}
.claim-cta:hover { background: #14171B; }

/* ---------- claim sheet form ------------------------------------------- */

.claim-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
  font-size: 13px;
}
.claim-field > span {
  font-weight: 600;
  color: var(--ink-soft);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.05em;
}
.claim-field input {
  border: 1px solid var(--border, rgba(0, 0, 0, 0.12));
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 14px;
  background: var(--surface-soft, rgba(255, 255, 255, 0.85));
  color: var(--ink);
}
.claim-role-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.claim-role-chip {
  background: var(--surface-soft, rgba(255, 255, 255, 0.6));
  border: 1px solid var(--border, rgba(0, 0, 0, 0.1));
  border-radius: var(--pill);
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  color: var(--ink);
  font-weight: 600;
}
.claim-role-chip.active {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: transparent;
}
.claim-error {
  color: #C03A2B;
  font-size: 13px;
  margin-top: 8px;
}
.claim-legal {
  margin-top: 10px;
  font-size: 11px;
  color: var(--ink-soft);
  line-height: 1.4;
}
.claim-confirm {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  color: #1F9C5C;
  margin-bottom: 8px;
}
.claim-docs {
  margin-top: 10px;
  background: var(--surface-soft, rgba(255, 255, 255, 0.55));
  border: 1px solid var(--border, rgba(0, 0, 0, 0.08));
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.cta {
  margin-top: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--pill);
  background: var(--accent);
  color: var(--accent-ink);
  border: 0;
  font-weight: 700;
  cursor: pointer;
}
.cta:hover { background: #14171B; }
.cta:disabled { opacity: 0.6; cursor: not-allowed; }


/* ---------- Google-Maps-style merchant card (spec section 15) ---------- */

/* Override the base atc-sheet to give the merchant card a tighter
   layout so the photo carousel can run edge-to-edge under the
   header. */
.merchant-card-sheet {
  padding: 0 !important;
  overflow: hidden;
}
.merchant-card-sheet .atc-body {
  padding: 0 16px 16px;
}
.merchant-card-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 4;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(0, 0, 0, 0.08);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.16);
}
.merchant-card-close:hover { background: #fff; }

/* Photo carousel */
.mc-carousel {
  position: relative;
  width: 100%;
  height: 200px;
  background: #0e0f12;
  overflow: hidden;
}
.mc-carousel-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 240ms ease;
}
.mc-carousel-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 0;
  background: rgba(0, 0, 0, 0.42);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.mc-carousel-nav.prev { left: 8px; }
.mc-carousel-nav.next { right: 8px; }
.mc-carousel-nav:hover { background: rgba(0, 0, 0, 0.6); }
.mc-carousel-dots {
  position: absolute;
  bottom: 10px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 6px;
  z-index: 2;
}
.mc-carousel-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.4);
}
.mc-carousel-dot.active { background: #fff; }

/* Head block: title, score line, actions, notes */
.merchant-card-head {
  padding: 16px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.merchant-card-title {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.15;
}
.merchant-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  color: var(--ink-soft);
  font-size: 13px;
}
.merchant-score {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--ink);
  font-weight: 700;
}
.merchant-score-star { color: #f5b400; font-size: 12px; }
.merchant-score-count {
  color: var(--ink-soft);
  font-weight: 600;
}
.merchant-card-dot { padding: 0 2px; }
.merchant-card-cat { text-transform: capitalize; }
.merchant-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}
.mc-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  min-width: 40px;
  min-height: 36px;
}
.mc-action:hover { background: #f5f5f7; }
.mc-action-primary {
  background: #1a73e8;
  border-color: #1a73e8;
  color: #fff;
  padding-left: 18px;
  padding-right: 18px;
}
.mc-action-primary:hover { background: #1666cb; }
.merchant-card-notes {
  background: rgba(0, 0, 0, 0.04);
  border-radius: 12px;
  padding: 10px 12px;
  margin-top: 4px;
}
.merchant-card-notes-h {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 4px;
}
.merchant-card-notes p {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink);
}
.merchant-link {
  color: #1a73e8;
  text-decoration: none;
}
.merchant-link:hover { text-decoration: underline; }

/* ---- Discovered (live Google Places) rail ---- */
.section-subtitle {
  font-size: 13px;
  margin: -2px 0 8px 0;
  color: rgba(60, 64, 67, 0.7);
}
.discovered-rail {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  margin: 6px 0 18px 0;
}
.discovered-card {
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  transition: transform 80ms ease, box-shadow 120ms ease;
}
.discovered-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
}
.discovered-name { font-weight: 600; line-height: 1.2; }
.discovered-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 13px;
  color: rgba(60, 64, 67, 0.85);
}
.discovered-rating { font-weight: 600; }
.discovered-dot { opacity: 0.6; }
.discovered-kind { text-transform: capitalize; }
.discovered-addr {
  margin-top: 4px;
  font-size: 12px;
  color: rgba(60, 64, 67, 0.7);
  line-height: 1.25;
}
