/* Vava Maps — theme-free CORE stylesheet.
   Palette-neutral component + layout system for the standalone pages. Every
   colour, radius, shadow and metric is a CSS custom property; an option theme
   (theme2.css) overrides the tokens under a body class to reskin without
   touching these component rules. Extracted from styles.css section 1. */

/* ---------- design tokens (defaults; overridden per option theme) ---------- */
:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-head: var(--font-sans);

  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --text: #0f172a;
  --text-soft: #475569;
  --text-mute: #94a3b8;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;

  --primary: #0f766e;
  --primary-strong: #0b5c55;
  --primary-soft: #ccfbf1;
  --on-primary: #ffffff;

  --accent: #14b8a6;
  --focus: #2563eb;

  --ok: #16a34a; --warn: #d97706; --danger: #dc2626; --danger-bg: #fde8e8;

  --radius: 6px;
  --radius-sm: 6px;
  --radius-pill: 6px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .08);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, .10);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, .16);

  --header-h: 60px;
  --toolbar-h: 56px;
  --split-list: 1.15fr;
  --split-map: 1fr;
  --card-gap: 12px;
  --pad: 16px;

  /* freshness palette */
  --fresh-live: #16a34a;   --fresh-live-bg: #dcfce7;
  --fresh-today: #0891b2;  --fresh-today-bg: #cffafe;
  --fresh-recent: #2563eb; --fresh-recent-bg: #dbeafe;
  --fresh-aging: #d97706;  --fresh-aging-bg: #fef3c7;
  --fresh-unconf: #64748b; --fresh-unconf-bg: #f1f5f9;
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- app shell ---------- */
/* height: 100dvh (dynamic viewport) so the shell tracks Safari's collapsing URL
   toolbar — plain 100vh overflows behind it on iOS, pushing the header out of view */
.app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden; }

/* ---------- header ---------- */
.app-header {
  height: var(--header-h); flex: none;
  display: flex; align-items: center; gap: 16px;
  padding: 0 var(--pad);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: relative; z-index: 1100; /* stacking context above the Leaflet map (~1000) so header dropdowns sit on top */
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-family: var(--font-head); cursor: pointer; }
.brand__mark {
  width: 28px; height: 28px; border-radius: 6px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: grid; place-items: center; color: var(--on-primary);
  font-size: 15px; font-weight: 800;
}
.brand__name { font-size: 16px; letter-spacing: -.2px; }
.brand__name span { color: var(--primary); }

.search {
  flex: 1 1 auto; max-width: 620px;
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 0 14px; height: 40px;
}
.search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.search svg { width: 16px; height: 16px; color: var(--text-mute); flex: none; }
.search input {
  border: 0; background: transparent; flex: 1; height: 100%;
  font-size: 14px; color: var(--text); outline: none;
}
.header-spacer { flex: 1; }
.search-count { font-weight: 700; color: var(--text); font-size: 13px; white-space: nowrap; }
.search-count span { color: var(--text-mute); font-weight: 500; }

.header-actions { display: flex; align-items: center; gap: 8px; }
.select-inline {
  height: 36px; border: 1px solid var(--border); background: var(--surface);
  border-radius: var(--radius-sm); padding: 0 8px; color: var(--text-soft); font-size: 13px;
}

/* ---------- currency flag dropdown ---------- */
.cur { position: relative; }
.cur__btn {
  height: 36px; display: inline-flex; align-items: center; gap: 7px;
  padding: 0 9px; border: 1px solid var(--border); background: var(--surface);
  border-radius: var(--radius-sm); color: var(--text-soft); font-size: 13px; font-weight: 600;
}
.cur__btn:hover { border-color: var(--border-strong); }
.cur__sym {
  min-width: 18px; flex: none; text-align: center;
  color: var(--text); font-weight: 700;
}
.cur__chev { width: 14px; height: 14px; color: var(--text-mute); }
.cur__menu {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 1100; /* above Leaflet panes */
  margin: 0; padding: 5px; list-style: none; min-width: 152px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-md);
}
.cur__opt {
  width: 100%; display: flex; align-items: center; gap: 9px;
  padding: 7px 8px; border: 0; background: transparent; border-radius: var(--radius-sm);
  color: var(--text); font-size: 13px; font-weight: 600; text-align: left;
}
.cur__opt:hover { background: var(--surface-2); }
.cur__opt[aria-selected="true"] { color: var(--primary); }

/* ---------- buttons ---------- */
.btn {
  height: 38px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text); font-weight: 600; font-size: 13px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: background .12s, border-color .12s, box-shadow .12s;
}
.btn:hover { background: var(--surface-2); }
.btn--primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn--primary:hover { background: var(--primary-strong); }
.btn--ghost { border-color: transparent; background: transparent; color: var(--text-soft); }
.btn--ghost:hover { background: var(--surface-2); }
.btn--sm { height: 32px; padding: 0 10px; font-size: 12.5px; }
.btn--block { width: 100%; }

/* ---------- toolbar / filters ---------- */
.toolbar {
  min-height: var(--toolbar-h); flex: none;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 9px var(--pad);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 20;
}
.toolbar__count { font-weight: 700; }
.toolbar__count span { color: var(--text-mute); font-weight: 500; }
.toolbar__spacer { flex: 1; }

.role-toggle { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 3px; }
.role-toggle button {
  border: 0; background: transparent; border-radius: var(--radius-pill);
  padding: 5px 12px; font-size: 12.5px; font-weight: 600; color: var(--text-soft);
}
.role-toggle button[aria-pressed="true"] { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-sm); }

.chips { display: flex; gap: 7px; flex-wrap: wrap; }
.chip {
  height: 34px; padding: 0 12px; border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text-soft); font-size: 12.5px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px;
}
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip[aria-pressed="true"] { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-strong); }
.chip__dot { width: 8px; height: 8px; border-radius: 6px; background: var(--accent); }

.sort { display: inline-flex; align-items: center; gap: 6px; color: var(--text-soft); font-size: 12.5px; }
.sort select { height: 34px; border: 1px solid var(--border-strong); background: var(--surface); border-radius: var(--radius-sm); padding: 0 8px; color: var(--text); font-size: 12.5px; }

/* ---------- search facets (dropdowns) ---------- */
.facets { display: flex; gap: 8px; flex-wrap: wrap; }
.facet-select {
  height: 34px; border: 1px solid var(--border-strong); background: var(--surface);
  border-radius: var(--radius-sm); padding: 0 8px; color: var(--text); font-size: 12.5px;
}
.facet-select:hover { border-color: var(--primary); }

/* ---------- left slide-in filter drawer ---------- */
.filters-btn { gap: 8px; }
.filters-btn svg { width: 16px; height: 16px; }
.filters-btn__count {
  min-width: 18px; height: 18px; padding: 0 5px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary); color: var(--on-primary);
  border-radius: var(--radius-pill); font-size: 11px; font-weight: 700; line-height: 1;
}
.filter-drawer {
  position: fixed; top: var(--header-h); left: 0; bottom: 0;
  width: 360px; max-width: 86vw; z-index: 1300; /* above Leaflet controls (~1000) */
  display: flex; flex-direction: column;
  background: var(--surface); border-right: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  transform: translateX(-100%); transition: transform .26s ease;
}
.filter-drawer.is-open { transform: translateX(0); }
.filter-drawer__head {
  flex: none; display: flex; align-items: center; justify-content: space-between;
  padding: 16px var(--pad); border-bottom: 1px solid var(--border);
}
.filter-drawer__title { font-size: 15px; font-weight: 700; }
.filter-drawer__body {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: 18px var(--pad); display: flex; flex-direction: column; gap: 20px;
}
.filter-group { display: flex; flex-direction: column; gap: 9px; }
.filter-group__label {
  font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--text-mute);
}
.filter-group__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.facet-all {
  border: 0; background: transparent; padding: 0; cursor: pointer;
  color: var(--primary); font-size: 11.5px; font-weight: 700; letter-spacing: .03em;
}
.facet-all:hover { color: var(--primary-strong); text-decoration: underline; }
.filter-drawer .role-toggle { width: 100%; }
.filter-drawer .role-toggle button { flex: 1; }
.filter-drawer .facets { flex-direction: column; gap: 12px; flex-wrap: nowrap; }
.facet-field { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 600; color: var(--text-soft); }
.filter-drawer .facet-select { width: 100%; height: 40px; }

/* facet checkbox groups — every option visible, multi-select per facet */
.facet-opts { display: flex; flex-wrap: wrap; gap: 6px; }
.facet-opt { position: relative; display: inline-flex; }
.facet-opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.facet-opt span {
  display: inline-flex; align-items: center; padding: 6px 11px;
  border: 1px solid var(--border-strong); border-radius: 5px;
  background: var(--surface); color: var(--text-soft); font-size: 12.5px; font-weight: 600;
  cursor: pointer; transition: border-color .12s, color .12s, background .12s;
}
.facet-opt span:hover { border-color: var(--primary); color: var(--primary-strong); }
.facet-opt input:checked + span { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-strong); box-shadow: inset 0 0 0 1px var(--primary); }
.facet-opt input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
.filter-drawer__foot {
  flex: none; display: flex; gap: 10px;
  padding: 14px var(--pad); border-top: 1px solid var(--border);
}
.filter-drawer__foot .btn { flex: 1; }

/* ---------- right slide-in offering detail drawer ---------- */
.detail-drawer {
  position: fixed; top: var(--header-h); right: 0; bottom: 0;
  width: 380px; max-width: 92vw; z-index: 1300; /* above Leaflet controls (~1000) */
  display: flex; flex-direction: column;
  background: var(--surface); border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  transform: translateX(100%); transition: transform .26s ease;
}
.detail-drawer.is-open { transform: translateX(0); }
.detail-drawer__body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.detail-drawer__scroll { flex: 1; min-height: 0; overflow-y: auto; }
.detail-drawer__close {
  position: absolute; top: 12px; right: 12px; z-index: 5;
  width: 30px; height: 30px; border: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius); background: rgba(28, 20, 14, .62); color: #fff;
}
.detail-drawer__close:hover { background: rgba(28, 20, 14, .82); }
.detail-drawer__close svg { width: 16px; height: 16px; }

/* hero — clean full-bleed slab photo (title/price/status live in the body below) */
.dd-hero { position: relative; height: 200px; overflow: hidden; flex: none; }
.dd-hero .slab { position: absolute; inset: 0; }
.dd-hero .slab-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; display: block; }

/* header — material name + price + status pill, sitting below the clean image */
.dd-head { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.dd-head__row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; width: 100%; }
.dd-head__id { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.dd-cat { font-size: 11px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--text-mute); }
.dd-name { font-size: 20px; font-weight: 800; line-height: 1.15; letter-spacing: -.2px; color: var(--text); overflow-wrap: anywhere; }
.dd-price { flex: 0 0 auto; text-align: right; }
.dd-price b { display: block; font-size: 16px; font-weight: 700; letter-spacing: -.02em; color: var(--text); white-space: nowrap; }
.dd-price s { display: block; margin-top: 1px; text-decoration: none; font-size: 12px; color: var(--text-mute); white-space: nowrap; }

/* body */
.dd-body { padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.dd-body .mh-company { font-size: 13.5px; }
.dd-divider { border-top: 1px solid var(--border); }
.dd-loc { display: flex; align-items: flex-start; gap: 6px; font-size: 13px; color: var(--text-soft); line-height: 1.4; }
.dd-loc svg { width: 15px; height: 15px; flex: 0 0 auto; margin-top: 1px; color: var(--accent); }
.dd-loc__type { color: var(--text-mute); }
.dd-loc__dist { margin-left: auto; flex: 0 0 auto; font-weight: 700; color: var(--text); white-space: nowrap; }
.dd-specs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.dd-spec { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dd-spec span { font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-mute); }
.dd-spec b { font-size: 13px; font-weight: 700; color: var(--text); }

/* pinned footer CTAs */
.dd-foot { flex: none; padding: 14px 16px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.dd-foot__row { display: flex; gap: 8px; }
.dd-foot__row .btn { flex: 1; }

/* ---------- layout: list + map ---------- */
.layout {
  flex: 1; min-height: 0;
  display: grid;
  grid-template-columns: var(--split-list) var(--split-map);
  transition: grid-template-columns .32s ease;
}
/* collapse the results panel to let the map fill the width (and back) */
.layout.panels-collapsed { grid-template-columns: 0fr var(--split-map); }
.layout.panels-collapsed .list-pane { overflow: hidden; min-width: 0; }
.list-pane {
  min-height: 0; min-width: 0; overflow: hidden;
  background: var(--bg);
  display: flex; flex-direction: column;
}
.list-head {
  flex: none; display: flex; align-items: center; justify-content: flex-end;
  gap: 8px; padding: 9px var(--pad);
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.list-scroll {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: var(--pad);
  display: flex; flex-direction: column; gap: var(--card-gap);
  scroll-behavior: smooth;
}
.map-pane { position: relative; min-height: 0; border-left: 1px solid var(--border); }
[data-map] { position: absolute; inset: 0; background: var(--surface-2); }

.search-area {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  z-index: 500; box-shadow: var(--shadow-md);
}

/* handle on the results↔map boundary: collapse results to expand the map, and back */
.panel-toggle {
  position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  z-index: 700; width: 24px; height: 58px;
  display: grid; place-items: center;
  background: var(--surface); color: var(--text-soft);
  border: 1px solid var(--border); border-left: 0;
  border-radius: 0 var(--radius) var(--radius) 0;
  box-shadow: var(--shadow-md); cursor: pointer;
  transition: color .12s;
}
.panel-toggle:hover { color: var(--primary); }
.panel-toggle svg { width: 16px; height: 16px; transition: transform .2s ease; }
.panel-toggle[aria-pressed="true"] svg { transform: rotate(180deg); }

/* map legend: what the pin colours mean (colour = seller type; green dot = live stock, a ring on pins) */
.map-legend {
  position: absolute; left: 12px; bottom: 12px; z-index: 600;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-md);
  padding: 8px 11px; display: flex; flex-direction: column; gap: 6px;
  font-size: 11.5px; font-weight: 600; color: var(--text-soft);
}
.map-legend__item { display: flex; align-items: center; gap: 8px; }
.map-legend__dot {
  width: 11px; height: 11px; flex: none; border-radius: 3px;
  background: var(--primary); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--border);
}
.map-legend__dot--supplier    { background: var(--role-supplier); }
.map-legend__dot--distributor { background: var(--role-distributor); }
/* live stock = solid green dot with a soft breathing pulse (on pins it shows as a green ring) */
.map-legend__dot--live {
  background: var(--fresh-live);
  animation: legend-breathe 2s ease-in-out infinite;
}
@keyframes legend-breathe {
  0%, 100% { transform: scale(1);    box-shadow: 0 0 0 1px var(--border), 0 0 0 0    color-mix(in srgb, var(--fresh-live) 68%, transparent); }
  50%      { transform: scale(1.11); box-shadow: 0 0 0 1px var(--border), 0 0 0 6.5px color-mix(in srgb, var(--fresh-live) 0%,  transparent); }
}
@media (prefers-reduced-motion: reduce) {
  .map-legend__dot--live { animation: none; }
}

/* ---------- group heading ---------- */
.group-head {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
  color: var(--text-mute); margin: 4px 2px 0;
}
.group-head::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.group-head:first-child { margin-top: 0; }

/* ---------- result card ---------- */
.result-card {
  position: relative;
  display: grid; grid-template-columns: 200px 1fr;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow-sm); transition: box-shadow .14s, border-color .14s, transform .14s;
  /* overflow:hidden zeroes the auto min-size, so as a flex-column child the card
     would otherwise shrink to a sliver when the list is long — keep its height. */
  flex-shrink: 0;
}
.result-card:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.result-card.is-active { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft), var(--shadow-md); }

/* left column: slab photo (real ~19:11 proportions) with price + freshness underneath it */
.rc-media-col { display: flex; flex-direction: column; gap: 8px; padding: 10px; min-width: 0; }
.result-card__media {
  position: relative; overflow: hidden;
  aspect-ratio: 19 / 11; border-radius: var(--radius-sm);
}
.rc-buy { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.rc-buy__row { display: flex; align-items: flex-start; gap: 8px; width: 100%; }
.rc-qty { margin-left: auto; font-size: 11px; font-weight: 600; color: var(--text-soft); white-space: nowrap; }
.rc-media-col .badges { margin-top: auto; }
.slab { width: 100%; height: 100%; }
/* real photo layered over the gradient swatch; app.js removes it on load error */
.slab-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; display: block; }

.result-card__body { padding: 9px 13px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.rc-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.rc-material { font-size: 15px; font-weight: 500; font-family: var(--font-head); letter-spacing: -.2px; line-height: 1.2; }
.rc-cat { font-size: 11.5px; color: var(--text-mute); font-weight: 600; }
.rc-company { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-soft); flex-wrap: wrap; }
.rc-company b { color: var(--text); font-weight: 700; }

/* role corner flag — filled triangle in the card box's top-left corner, colour = seller type */
.rc-flag {
  position: absolute; top: 0; left: 0; z-index: 3;
  width: 0; height: 0;
  border-top: 28px solid var(--border-strong);
  border-right: 28px solid transparent;
}

.rc-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--text-soft); }
.rc-meta span { display: inline-flex; align-items: center; gap: 4px; }
.rc-meta b { color: var(--text); font-weight: 600; }

.rc-loc { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-soft); }
.rc-loc svg { width: 13px; height: 13px; color: var(--text-mute); }
.rc-dist { margin-left: auto; font-weight: 700; color: var(--text); }

.rc-bottom { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; margin-top: 1px; }
.rc-bottom--fresh { align-items: center; }
.rc-price { line-height: 1.2; }
.rc-price__main { font-size: 13px; font-weight: 500; }
.rc-price__orig { font-size: 11.5px; color: var(--text-mute); }
.rc-price__na { font-size: 12.5px; color: var(--text-mute); font-weight: 600; }

.rc-actions { display: flex; gap: 6px; }
.icon-btn {
  width: 34px; height: 34px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface);
  display: grid; place-items: center; color: var(--text-soft);
}
.icon-btn:hover { color: var(--primary); border-color: var(--primary); }
.icon-btn svg { width: 16px; height: 16px; }

/* badges row */
.badges { display: flex; flex-wrap: wrap; gap: 5px; }
.badge {
  font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: var(--radius-pill);
  display: inline-flex; align-items: center; gap: 4px; border: 1px solid transparent;
}
.badge--verified { background: #eef2ff; color: #4338ca; }
.badge--paid { background: #fff7ed; color: #c2410c; }
.badge--cloud { background: #ecfeff; color: #0e7490; }
.badge svg { width: 11px; height: 11px; }

/* freshness pill */
.fresh { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: var(--radius-pill); display: inline-flex; align-items: center; gap: 5px; }
.fresh::before { content: ""; width: 7px; height: 7px; border-radius: 6px; background: currentColor; }
.fresh--live { color: var(--fresh-live); background: var(--fresh-live-bg); }
.fresh--live::before { box-shadow: 0 0 0 3px color-mix(in srgb, var(--fresh-live) 25%, transparent); }
.fresh--today { color: var(--fresh-today); background: var(--fresh-today-bg); }
.fresh--recent { color: var(--fresh-recent); background: var(--fresh-recent-bg); }
.fresh--aging { color: var(--fresh-aging); background: var(--fresh-aging-bg); }
.fresh--unconf { color: var(--fresh-unconf); background: var(--fresh-unconf-bg); }
.fresh__src { color: var(--text-mute); font-weight: 500; }

/* match tag */
.match-tag { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--text-mute); }

/* transport flags */
.flags { display: flex; gap: 6px; flex-wrap: wrap; }
.flag { font-size: 11px; color: var(--text-soft); display: inline-flex; align-items: center; gap: 4px; }
.flag svg { width: 12px; height: 12px; color: var(--primary); }

/* gated contact */
.gate {
  font-size: 11.5px; color: var(--text-soft); background: var(--surface-2);
  border: 1px dashed var(--border-strong); border-radius: var(--radius-sm);
  padding: 6px 9px; display: flex; align-items: center; gap: 6px;
}
.gate svg { width: 13px; height: 13px; color: var(--text-mute); }
.gate b { color: var(--text); }

/* ---------- map marker + popup ---------- */
.vava-pin {
  width: 22px; height: 28px; position: relative; display: grid; place-items: center;
  filter: drop-shadow(0 3px 4px rgba(15,23,42,.35));
}
.vava-pin__badge {
  position: absolute; top: 0; left: 0;
  width: 22px; height: 22px; border-radius: 6px 6px 6px 0;
  transform: rotate(-45deg);
  background: var(--primary); border: 2px solid #fff;
}
.vava-pin__glyph { position: relative; z-index: 2; color: #fff; font-size: 8px; font-weight: 800; margin-top: -4px; }
.vava-pin.is-live .vava-pin__badge { background: var(--fresh-live); }
.vava-pin.is-active { z-index: 1000 !important; }
.vava-pin.is-active .vava-pin__badge { transform: rotate(-45deg) scale(1.18); box-shadow: 0 0 0 4px var(--primary-soft); }

/* ---------- map popup: image-forward hero (Airbnb/Google place-card) ---------- */
/* Leaflet resets: kill default padding + clip so the hero photo bleeds to the rounded corners. */
.leaflet-popup-content-wrapper { padding: 0 !important; overflow: hidden; border-radius: var(--radius) !important; box-shadow: var(--shadow-lg) !important; }
.leaflet-popup-content { margin: 0 !important; width: 264px !important; }
/* native close button -> soft dark disc so its glyph stays legible over any hero photo */
.leaflet-popup-close-button {
  top: 8px !important; right: 8px !important; width: 26px !important; height: 26px !important;
  display: grid !important; place-items: center; padding: 0 !important; border-radius: 999px;
  color: #fff !important; background: rgba(28,20,14,.66); font: 700 15px/1 var(--font-sans);
  box-shadow: 0 1px 4px rgba(0,0,0,.28); transition: background .15s ease;
}
.leaflet-popup-close-button:hover { background: rgba(28,20,14,.82); color: #fff !important; }

.map-hero { font-family: var(--font-sans); color: var(--text); }

/* hero photo — real slab layered over the .slab gradient swatch fallback (onerror removes img) */
.map-hero__media { position: relative; height: 158px; overflow: hidden; }
.map-hero__media .slab { position: absolute; inset: 0; }
.map-hero__media .slab-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; display: block; }
.map-hero__top { position: absolute; top: 10px; left: 10px; z-index: 3; }
.map-hero__top .fresh { box-shadow: 0 1px 3px rgba(0,0,0,.25); }

/* material + category + price now sit in the footer below the clean image (not overlaid) */
.map-hero__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.map-hero__id { flex: 1 1 auto; min-width: 0; }
.map-hero__cat { display: block; margin-bottom: 3px; font-size: 10px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--text-mute); }
.map-hero__name { color: var(--text); font-weight: 800; font-size: 15px; line-height: 1.18; letter-spacing: -.2px; overflow-wrap: anywhere; }
.map-hero__price { flex: 0 0 auto; text-align: right; }
.map-hero__price b { display: block; color: var(--text); font-weight: 700; font-size: 13.5px; letter-spacing: -.02em; white-space: nowrap; }
.map-hero__price s { display: block; margin-top: 1px; text-decoration: none; color: var(--text-mute); font-size: 10.5px; white-space: nowrap; }

/* cream footer — sourcing facts on an opaque surface (contrast never depends on the photo) */
.map-hero__foot { background: var(--surface); padding: 11px 13px 13px; display: flex; flex-direction: column; gap: 8px; }
.mh-company { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text); min-width: 0; }
.mh-dot { width: 8px; height: 8px; border-radius: 999px; flex: 0 0 auto; background: var(--primary); }
.mh-dot--supplier { background: var(--role-supplier, var(--primary)); }
.mh-dot--distributor { background: var(--role-distributor, #1f6e74); }
.mh-dot--fabricator { background: var(--role-fabricator, #8a5a74); }
.mh-company b { font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mh-check { width: 13px; height: 13px; flex: 0 0 auto; color: var(--role-supplier, var(--primary)); }
.mh-role { margin-left: auto; flex: 0 0 auto; font-size: 10px; font-weight: 700; letter-spacing: .2px; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-soft); }
.mh-role--supplier { color: var(--role-supplier-ink, var(--primary-strong)); background: var(--role-supplier-bg, var(--surface-2)); }
.mh-role--distributor { color: var(--role-distributor-ink, #14565b); background: var(--role-distributor-bg, var(--surface-2)); }
.mh-role--fabricator { color: var(--role-fabricator-ink, #6b4357); background: var(--role-fabricator-bg, var(--surface-2)); }
.mh-loc { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-soft); }
.mh-loc svg { width: 13px; height: 13px; flex: 0 0 auto; color: var(--accent); }
.mh-loc > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mh-loc__type { color: var(--text-mute); }
.mh-loc__dist { margin-left: auto; flex: 0 0 auto; font-weight: 700; color: var(--text); white-space: nowrap; }
.mh-qty { font-size: 11.5px; color: var(--text-soft); display: flex; align-items: center; gap: 8px; }
.mh-qty b { color: var(--text); font-weight: 700; }
.mh-cloud { margin-left: auto; flex: 0 0 auto; display: inline-flex; align-items: center; gap: 4px; color: var(--text-mute); font-weight: 600; white-space: nowrap; }
.mh-cloud svg { width: 12px; height: 12px; }
.map-hero__foot .btn { margin-top: 3px; }

.cluster-ico {
  background: var(--primary); color: #fff; border: 3px solid #fff;
  border-radius: 6px; display: grid; place-items: center; position: relative;
  font-weight: 800; font-size: 13px; box-shadow: var(--shadow-md);
}
/* cluster contents: all-live green, mix = split half green / half brand colour */
.cluster-ico--live { background: var(--fresh-live); }
.cluster-ico--mixed { background: linear-gradient(90deg, var(--fresh-live) 0 50%, var(--primary) 50% 100%); }

/* ---------- mobile controls (hidden on desktop) ---------- */
.mobile-bar { display: none; }
.filters-scrim { display: none; }
.filters-scrim.is-open {
  display: block; position: fixed; inset: var(--header-h) 0 0 0;
  background: rgba(15, 23, 42, .45); z-index: 1200;
}
.detail-scrim { display: none; }
.detail-scrim.is-open {
  display: block; position: fixed; inset: var(--header-h) 0 0 0;
  background: rgba(15, 23, 42, .32); z-index: 1200;
}

/* ================= slab swatch textures ================= */
.slab--taj-mahal {
  background:
    repeating-linear-gradient(115deg, rgba(190,150,80,0) 0 22px, rgba(190,150,80,.28) 23px 25px, rgba(190,150,80,0) 26px 52px),
    linear-gradient(135deg, #efe6d2, #e4d4ac 55%, #dcc794);
}
.slab--calacatta-viola {
  background:
    repeating-linear-gradient(122deg, rgba(125,59,82,0) 0 20px, rgba(125,59,82,.38) 21px 23px, rgba(125,59,82,0) 24px 46px),
    linear-gradient(120deg, #f6f2ec, #ece5db 60%, #e5dccf);
}
.slab--black-galaxy {
  background:
    radial-gradient(rgba(212,175,90,.85) .6px, transparent 1.1px) 0 0 / 9px 9px,
    radial-gradient(rgba(212,175,90,.55) .6px, transparent 1.1px) 4px 5px / 13px 13px,
    linear-gradient(135deg, #101014, #191920);
}
.slab--patagonia {
  background:
    repeating-linear-gradient(105deg, rgba(150,90,60,0) 0 16px, rgba(150,90,60,.32) 17px 20px, rgba(120,120,130,.25) 21px 24px, rgba(150,90,60,0) 25px 44px),
    linear-gradient(120deg, #ece4d4, #cdbfa8 55%, #9a8f7d);
}
.slab--statuario {
  background:
    repeating-linear-gradient(118deg, rgba(110,116,128,0) 0 26px, rgba(110,116,128,.32) 27px 29px, rgba(110,116,128,0) 30px 58px),
    linear-gradient(120deg, #fbfbfb, #eef0f2 60%, #e6e9ec);
}
.slab--crema-marfil {
  background:
    repeating-linear-gradient(120deg, rgba(160,130,80,0) 0 30px, rgba(160,130,80,.16) 31px 33px, rgba(160,130,80,0) 34px 64px),
    linear-gradient(120deg, #ecdfc6, #e2d3b4);
}
.slab--nero-marquina {
  background:
    repeating-linear-gradient(125deg, rgba(240,240,240,0) 0 24px, rgba(240,240,240,.7) 25px 27px, rgba(240,240,240,0) 28px 54px),
    linear-gradient(135deg, #141414, #1d1d1f);
}
.slab--blue-roma {
  background:
    repeating-linear-gradient(112deg, rgba(70,90,120,0) 0 20px, rgba(70,90,120,.4) 21px 24px, rgba(70,90,120,0) 25px 48px),
    linear-gradient(120deg, #e2e9f0, #b9c6d6 55%, #8fa3ba);
}
.slab--verde-alpi {
  background:
    repeating-linear-gradient(118deg, rgba(225,232,227,0) 0 18px, rgba(225,232,227,.6) 19px 22px, rgba(225,232,227,0) 23px 44px),
    linear-gradient(135deg, #315649, #204439);
}

/* ================= responsive ================= */
@media (max-width: 1024px) {
  :root { --split-list: 1fr; --split-map: .95fr; }
  .search { max-width: none; }
}

/* Tablet portrait & phones: single column, map behind a toggle */
@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; }
  .result-card { grid-template-columns: 150px 1fr; }
  .panel-toggle { display: none; }
  .map-pane { display: none; }
  .map-pane.is-open {
    display: block; position: fixed;
    inset: calc(var(--header-h)) 0 0 0; z-index: 60; border-left: 0;
  }
  .header-actions .desktop-only { display: none; }
  .search-count { display: none; }

  .mobile-bar {
    display: flex; gap: 10px; position: fixed; left: 50%; bottom: 16px;
    transform: translateX(-50%); z-index: 70;
  }
  .mobile-bar .btn { box-shadow: var(--shadow-lg); }

  /* the header filter trigger hides on phone — the bottom mobile bar opens the same left drawer */
  .filters-btn { display: none; }
}
