/* ---------- tokens ---------- */
:root {
  /* Neutral greys (map-app style); only --brand and the price colours carry colour. */
  --ground: #f8f9fa;
  --surface: #ffffff;
  --surface-2: #f1f3f4;     /* chips, quiet buttons */
  --ink: #202124;
  --muted: #5f6368;
  --line: #e3e5e8;
  --brand: #0e5e47;         /* Madeira laurel green: shell + primary action */
  --brand-strong: #0a4a38;
  --brand-ink: #ffffff;
  --brand-soft: #dcefe6;
  --sun: #f6c945;           /* the bolt */
  --focus: #1c7ed6;
  --shadow: 0 -2px 12px rgba(60, 64, 67, .15);
  --shadow-sm: 0 1px 3px rgba(60, 64, 67, .2);
  /* price scale (semantic, not decoration) */
  --p0: #8e9893;
  --p1: #0f8a5f;
  --p2: #6fa21b;
  --p3: #d98e0b;
  --p4: #cf3f2a;
  --radius: 14px;
  --peek: 228px;
  --sheet: 74vh;            /* fallback; 74dvh below follows Safari's moving toolbar */
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ground: #18191b;
    --surface: #202124;
    --surface-2: #303134;
    --ink: #e8eaed;
    --muted: #9aa0a6;
    --line: #3c4043;
    --brand: #0b241c;
    --brand-strong: #3fbf8f;
    --brand-ink: #edf2ef;
    --brand-soft: #173a2e;
    --focus: #6cb6ff;
    --shadow: 0 -2px 12px rgba(0, 0, 0, .45);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, .5);
    --p0: #7d8782;
    --p1: #2fb37f;
    --p2: #93c43a;
    --p3: #f0a62a;
    --p4: #f0644d;
    color-scheme: dark;
  }
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
/* An app-like map page: pinch zooms the map, never the page around it. */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body, .top, .panel, .fab { touch-action: pan-x pan-y; }
#map { touch-action: none; }
body {
  font: 400 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-variant-numeric: tabular-nums;
  background: var(--ground);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
::selection { background: var(--brand-soft); color: var(--ink); }
a { color: var(--brand-strong); text-underline-offset: 2px; }
@media (prefers-color-scheme: light) { a { color: var(--brand); } }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 8px; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: 0; }

/* ---------- top: floating search + chips over the map (Google Maps style) ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.top {
  position: fixed; left: 0; right: 0; top: 0; z-index: 1001;
  padding: max(10px, env(safe-area-inset-top)) 0 0;
  pointer-events: none; /* the map stays draggable between the pills */
}
.top > * { pointer-events: auto; }

/* Locate: round floating button, bottom right above the sheet */
.fab {
  position: fixed; right: 14px; z-index: 1001;
  bottom: calc(var(--peek) + env(safe-area-inset-bottom) + 14px);
  display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%;
  border: 0; background: var(--surface); color: var(--focus);
  box-shadow: 0 1px 3px rgba(0,0,0,.25), 0 4px 10px rgba(0,0,0,.12);
}
.fab svg { width: 24px; height: 24px; }
/* First visit without location: one clear way in, centred above the sheet. */
.near-me {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 1001;
  bottom: calc(var(--peek) + env(safe-area-inset-bottom) + 20px);
  display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 18px 0 14px;
  border: 0; border-radius: 999px; background: var(--focus); color: #fff; font-weight: 600; font-size: 15px;
  box-shadow: 0 1px 3px rgba(60,64,67,.3), 0 4px 10px rgba(60,64,67,.2); white-space: nowrap;
}
.near-me svg { width: 20px; height: 20px; }
.near-me:active { transform: translateX(-50%) scale(.96); }
.near-me[aria-busy="true"] svg { animation: pulse 1s ease-in-out infinite; }
@media (prefers-color-scheme: dark) { .near-me { color: #0b1a2b; } }
.fab:active { background: var(--surface-2); }
.fab[aria-busy="true"] svg { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }

/* ---------- filter chips: one scrollable row of floating pills ---------- */
.filters {
  display: flex; gap: 8px; padding: 10px 12px 8px; overflow-x: auto; scrollbar-width: none;
  /* let the map show through; only the pills catch taps */
  pointer-events: none;
}
.filters::-webkit-scrollbar { display: none; }
.chip {
  pointer-events: auto;
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  min-height: 36px; padding: 0 13px 0 10px; border-radius: 999px;
  border: 0; background: var(--surface); color: var(--ink);
  box-shadow: 0 1px 2px rgba(60,64,67,.3), 0 1px 3px 1px rgba(60,64,67,.15);
  font-weight: 600; font-size: 14px; white-space: nowrap;
  transition: background .15s, color .15s;
}
.chip svg { width: 16px; height: 16px; color: var(--muted); }
.chip:hover { background: var(--surface-2); }
.chip[aria-pressed="true"] { background: var(--brand-soft); color: var(--brand); }
.chip[aria-pressed="true"] svg { color: var(--brand); }
@media (prefers-color-scheme: dark) {
  .chip { box-shadow: 0 1px 3px rgba(0,0,0,.6); }
  .chip[aria-pressed="true"] { background: color-mix(in srgb, var(--brand-strong) 13%, var(--surface)); color: var(--brand-strong); }
  .chip[aria-pressed="true"] svg { color: var(--brand-strong); }
}
.chip[hidden] { display: none; }
.chip .short { display: none; }
@media (max-width: 359px) { .chip .long { display: none; } .chip .short { display: inline; } }
.chip .count {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; margin-left: 2px;
  border-radius: 10px; background: var(--brand); color: #fff; font-size: 12px; font-weight: 600;
}
.chip .count[hidden] { display: none; }
@media (prefers-color-scheme: dark) { .chip .count { background: var(--brand-strong); color: #07140f; } }

/* "Filters" menu: a floating card under the chips */
.filter-menu {
  position: absolute; right: 12px; top: calc(100% + 2px); width: min(300px, calc(100vw - 24px));
  display: grid; gap: 2px; padding: 8px; border-radius: 18px; background: var(--surface);
  box-shadow: 0 2px 6px rgba(0,0,0,.2), 0 10px 30px rgba(0,0,0,.18);
}
.filter-menu[hidden] { display: none; }
.menu-open .top { z-index: 1003; }
.filter-menu { max-height: calc(var(--vvh, 100vh) - 130px); overflow-y: auto; overscroll-behavior: contain; }
.filter-menu .opt {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 46px; padding: 0 12px;
  border: 0; border-radius: 12px; background: none; color: var(--ink); font: inherit; font-size: 16px; font-weight: 600;
  text-align: left; cursor: pointer;
}
.filter-menu .opt[hidden] { display: none; }
.filter-menu .opt:hover { background: var(--surface-2); }
.filter-menu .opt svg { width: 20px; height: 20px; color: var(--muted); flex: none; }
.filter-menu .tick {
  margin-left: auto; width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--line); flex: none;
}
.filter-menu .opt[aria-pressed="true"] { background: var(--brand-soft); }
.filter-menu .opt[aria-pressed="true"] .tick {
  border-color: var(--brand); background: var(--brand)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/16px no-repeat;
}
.filter-menu .plug-opt select {
  margin-left: auto; appearance: none; -webkit-appearance: none; font: inherit; font-size: 16px; font-weight: 600;
  color: var(--ink); background: var(--surface-2); border: 0; border-radius: 10px; padding: 7px 30px 7px 12px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: right 14px center, right 9px center; background-size: 5px 5px; background-repeat: no-repeat;
}
.filter-menu .plug-opt.on { background: var(--brand-soft); }
.filter-menu .plug-opt select option { color: #13201b; background: #fff; }
.filter-menu .done { justify-content: center; margin-top: 4px; background: var(--brand); color: #fff; }
.filter-menu .done:hover { background: var(--brand-strong); }
@media (prefers-color-scheme: dark) {
  .filter-menu .opt[aria-pressed="true"] .tick { border-color: var(--brand-strong); background-color: var(--brand-strong); }
  .filter-menu .done { background: var(--brand-strong); color: #07140f; }
}
/* the panel's own chips (e.g. "Show all of Madeira") stay flat */
.panel .chip { box-shadow: none; border: 1px solid var(--line); }

/* ---------- map ---------- */
#map { position: fixed; inset: 0; background: var(--ground); }
.leaflet-container { font-family: inherit; }
.leaflet-control-attribution { font-size: 10px; }
.leaflet-bar { border: 0 !important; box-shadow: var(--shadow-sm) !important; border-radius: 12px !important; overflow: hidden; }
.leaflet-bar a { width: 40px !important; height: 40px !important; line-height: 40px !important; background: var(--surface) !important; color: var(--ink) !important; border-color: var(--line) !important; }
.leaflet-bar a:hover { background: var(--surface-2) !important; }
.leaflet-control-attribution { background: color-mix(in srgb, var(--surface) 80%, transparent) !important; color: var(--muted); }

/* Price-tag pins: the site's signature. Colour = price band, text = ≈ €/kWh. */
.pin-tag {
  display: inline-flex; align-items: center; gap: 3px; transform: translate(-50%, calc(-100% - 7px)); /* arrow tip on the charger */
  padding: 3px 7px; border-radius: 8px; white-space: nowrap;
  background: var(--c); color: #fff; font: 600 12.5px/1.2 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-variant-numeric: tabular-nums; box-shadow: var(--shadow-sm); position: relative;
  border: 2px solid #fff;
}
.pin-tag::after {
  content: ""; position: absolute; left: 50%; bottom: -7px; transform: translateX(-50%);
  border: 6px solid transparent; border-top-color: #fff; border-bottom: 0;
}
.pin-tag svg { width: 11px; height: 11px; color: var(--sun); }
/* zoomed out: smaller tags so most chargers keep a price */
.pin-tag.compact { padding: 1px 4px; font-size: 11px; border-width: 1.5px; border-radius: 6px; transform: translate(-50%, calc(-100% - 5px)); }
.pin-tag.compact::after { bottom: -5px; border-width: 4px; border-bottom: 0; }
.pin-tag.selected { outline: 3px solid var(--focus); outline-offset: 1px; z-index: 1; }
.pin-wrap { background: none; border: 0; }

/* ---------- panel: bottom sheet on phones, side panel on desktop ---------- */
.panel {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1002;
  height: var(--sheet); display: flex; flex-direction: column;
  background: var(--surface); border-radius: 20px 20px 0 0; box-shadow: var(--shadow);
  transform: translateY(calc(var(--sheet) - var(--peek) - env(safe-area-inset-bottom)));
  padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right);
  transition: transform .25s cubic-bezier(.2, .8, .2, 1);
}
.panel.open { transform: none; }
.grip { border: 0; background: none; padding: 10px 0 4px; display: grid; place-items: center; flex: none; }
.grip span { width: 40px; height: 5px; border-radius: 3px; background: var(--line); }
.view { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.view[hidden] { display: none; }

.list-head { padding: 2px 16px 10px; display: grid; gap: 8px; }
.list-head h1, .list-head h2 { font-size: 17px; }

.seg {
  display: grid; grid-template-columns: repeat(3, 1fr); padding: 3px; gap: 3px;
  background: var(--surface-2); border-radius: 11px;
}
.seg button {
  border: 0; background: none; min-height: 34px; border-radius: 8px;
  font-weight: 600; font-size: 13.5px; color: var(--muted);
}
.seg button[aria-checked="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

.scale { display: flex; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 600; }
.scale button { flex: 1; display: grid; gap: 4px; text-align: center; font: inherit; color: inherit; border: 0;
  padding: 6px 2px 5px; border-radius: 10px; background: var(--surface-2); cursor: pointer;
  transition: opacity .15s, background .15s, transform .1s; -webkit-tap-highlight-color: transparent; }
/* Looks like a row of buttons: chip background, a thick colour bar, a press effect. */
.scale button::before { content: ""; height: 8px; border-radius: 4px; background: var(--c); }
.scale button:active { transform: scale(.94); }
.scale.picked button { background: none; }
.scale button.off { opacity: .3; }
.scale button.on { color: var(--ink); background: var(--surface-2); box-shadow: inset 0 0 0 2px var(--c); }
.scale button:focus-visible { outline: 2px solid var(--focus); }
/* First visit: the colours pop one after another once, to show they can be tapped. */
.scale.hint button { animation: band-pop .5s ease-out 1 both; }
.scale.hint button:nth-child(2) { animation-delay: .08s; } .scale.hint button:nth-child(3) { animation-delay: .16s; }
.scale.hint button:nth-child(4) { animation-delay: .24s; } .scale.hint button:nth-child(5) { animation-delay: .32s; }
@keyframes band-pop { 40% { transform: translateY(-3px) scale(1.06); } }
@media (prefers-reduced-motion: reduce) { .scale.hint button { animation: none; } }
.limit[hidden] { display: none; }
.list .more { padding: 14px 16px 4px; text-align: center; color: var(--muted); font-size: 13px; }

/* limit slider: max price / min power / max distance, following the tab */
.limit { display: grid; gap: 2px; }
.limit-row { display: flex; align-items: center; gap: 10px; min-height: 32px; }
.limit-row label { flex: 0 0 40%; font-size: 13.5px; font-weight: 600; color: var(--muted); line-height: 1.2; }
.limit.on .limit-row label { color: var(--ink); }
.limit-clear { display: grid; place-items: center; flex: none; width: 32px; height: 32px; margin-right: -6px; border: 0; border-radius: 50%; background: none; color: var(--muted); }
.limit-clear:hover { background: var(--surface-2); }
.limit-also { font-size: 12.5px; color: var(--muted); font-weight: 600; }
#limit-range { flex: 1; min-width: 0; font-size: 16px; height: 32px; margin: 0; accent-color: var(--brand); cursor: pointer; touch-action: pan-x; }
@media (prefers-color-scheme: dark) { #limit-range { accent-color: var(--brand-strong); } }
#limit-range:disabled { opacity: .4; cursor: not-allowed; }

.list { list-style: none; margin: 0; padding: 0 8px; overflow-y: auto; flex: 1; overscroll-behavior: contain; }
/* list view: the list and its footer scroll as one, so the footer never eats the list's space */
.scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.scroll > .list { overflow: visible; flex: none; }
.row {
  display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center;
  padding: 12px 8px; border-top: 1px solid var(--line); cursor: pointer; border-radius: 10px;
}
.row:first-child { border-top: 0; }
.row:hover { background: var(--surface-2); }
.row:hover + .row { border-top-color: transparent; }
.badge {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px;
  background: var(--c); color: #fff;
}
.badge svg { width: 18px; height: 18px; }
.badge.fast svg { color: var(--sun); }
.badge.none { background: var(--surface-2); color: var(--muted); }
.row-main { min-width: 0; }
.row-name, .row-sub { display: block; }
.row-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-price { text-align: right; font-weight: 700; font-size: 16px; }
.row-price small { display: block; font-weight: 600; font-size: 11.5px; color: var(--muted); }
.row-price.none { font-weight: 600; font-size: 12.5px; color: var(--muted); }

.empty { padding: 24px 16px; text-align: center; color: var(--muted); display: grid; gap: 12px; justify-items: center; }
.empty strong { color: var(--ink); font-size: 15px; }

.skeleton { height: 64px; margin: 6px 8px; border-radius: 12px; background: linear-gradient(90deg, var(--surface-2), var(--line), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

.foot { padding: 14px 16px calc(16px + env(safe-area-inset-bottom)); color: var(--muted); font-size: 12px; border-top: 1px solid var(--line); }
.foot p { margin: 0; max-width: 65ch; }

/* ---------- detail ---------- */
.detail { overflow-y: auto; padding: 0 16px calc(20px + env(safe-area-inset-bottom)); overscroll-behavior: contain; }
.detail-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 -6px 6px; }
.text-btn {
  display: inline-flex; align-items: center; gap: 4px; border: 0; background: none;
  min-height: 40px; padding: 0 8px; border-radius: 10px; font-weight: 600; color: var(--muted);
}
.text-btn:hover { background: var(--surface-2); color: var(--ink); }
.detail h2 { font-size: 21px; line-height: 1.2; }
.place { color: var(--muted); font-size: 13.5px; margin-top: 4px; }

.price-box {
  display: grid; grid-template-columns: auto 1fr; gap: 2px 14px; align-items: center;
  margin: 14px 0; padding: 12px 14px; border-radius: var(--radius);
  background: color-mix(in srgb, var(--c) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--c) 35%, var(--surface));
}
.price-box .big { grid-row: span 2; font-size: 28px; font-weight: 700; letter-spacing: -0.02em; color: var(--ink); }
.price-box .big small { font-size: 14px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.price-box .band { font-weight: 600; font-size: 13.5px; color: var(--ink); display: flex; align-items: center; gap: 6px; }
.price-box .band::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.price-box .parts { font-size: 13px; color: var(--muted); }
.price-box.none { display: block; background: var(--surface-2); border-color: var(--line); color: var(--muted); font-size: 14px; }
.note { font-size: 13px; color: var(--muted); margin: -6px 0 14px; }
.note summary { cursor: pointer; font-weight: 600; list-style: none; display: inline-flex; gap: 5px; align-items: center; }
.note summary::-webkit-details-marker { display: none; }
.note summary svg { width: 15px; height: 15px; }
.note p { margin: 6px 0 0; max-width: 60ch; }
.warn { color: var(--p4); }

.nav-primary {
  display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 54px; margin-top: 16px;
  border-radius: var(--radius); background: var(--brand); color: var(--brand-ink) !important;
  text-decoration: none; font-weight: 600; font-size: 17px; transition: background .15s;
}
.nav-primary:hover { background: var(--brand-strong); }
.nav-primary svg { width: 20px; height: 20px; fill: currentColor; stroke: none; }
@media (prefers-color-scheme: dark) {
  .nav-primary { background: var(--brand-strong); color: #07140f !important; }
  .nav-primary:hover { background: #57d3a4; }
}
.nav-more { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.nav-more a {
  flex: 1 1 auto; display: grid; place-items: center; min-height: 44px; padding: 0 12px; border-radius: 12px;
  background: var(--surface-2); color: var(--ink) !important; text-decoration: none; font-weight: 600; font-size: 14px;
}
.nav-more a:hover { background: var(--line); }

.section-label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 18px 0 8px; }
.facts { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.facts li { display: flex; align-items: center; gap: 10px; font-size: 14.5px; }
.facts li svg { color: var(--muted); }
.facts li .sub { color: var(--muted); font-size: 13px; margin-left: auto; text-align: right; }
.app-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; margin-top: 10px;
  border-radius: 12px; border: 1.5px solid var(--brand); color: var(--brand) !important; text-decoration: none; font-weight: 600;
}
@media (prefers-color-scheme: dark) { .app-btn { border-color: var(--brand-strong); color: var(--brand-strong) !important; } }
.code { margin-top: 18px; font-size: 12px; color: var(--muted); }

/* ---------- desktop ---------- */
@media (min-width: 900px), (orientation: landscape) and (max-height: 520px) and (min-width: 560px) {
  #map { right: 400px; }
  .top { right: 400px; padding-top: 14px; }
  .search { max-width: 520px; padding: 0 16px; }
  .results { left: 16px; right: 16px; }
  .filters { padding-left: 16px; }
  .fab { right: 416px; bottom: 124px; width: 44px; height: 44px; }
  .near-me { left: calc(50% - 200px); bottom: 28px; }
  .fab svg { width: 20px; height: 20px; }
  .panel {
    left: auto; top: 0; width: 400px; height: auto; transform: none;
    border-radius: 0; box-shadow: none; border-left: 1px solid var(--line);
  }
  .grip { display: none; }
  .list-head { padding-top: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- search: a big white pill, like Google Maps ---------- */
.search { position: relative; padding: 0 12px; }
.search-box {
  display: flex; align-items: center; gap: 12px; height: 56px; padding: 0 18px 0 8px;
  background: var(--surface); color: var(--muted); border-radius: 28px;
  box-shadow: 0 1px 3px rgba(0,0,0,.25), 0 4px 12px rgba(0,0,0,.12);
  cursor: text;
}
.search-box:focus-within { box-shadow: 0 2px 6px rgba(0,0,0,.28), 0 8px 20px rgba(0,0,0,.16); }
.search-box .brand-mark {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; flex: none;
  background: var(--brand); color: var(--sun);
}
.search-box .brand-mark svg { width: 22px; height: 22px; }
@media (prefers-color-scheme: dark) { .search-box .brand-mark { background: var(--mark, #0e5e47); } }
.search-box .search-icon { width: 22px; height: 22px; color: var(--muted); }
.search-box input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--ink);
  font-family: inherit; font-weight: 500; font-size: 17px; line-height: 1.2; /* 16px+ stops iOS zooming in on focus */
}
.search-box input::placeholder { color: var(--muted); font-weight: 500; }
.search-box input::-webkit-search-cancel-button { filter: grayscale(1); }
.results {
  position: absolute; left: 12px; right: 12px; top: 62px; margin: 0; padding: 6px; list-style: none; z-index: 2;
  background: var(--surface); border-radius: 20px; box-shadow: 0 10px 30px rgba(0,0,0,.2); max-height: min(50vh, calc(var(--vvh, 100dvh) - 130px)); overflow-y: auto; overscroll-behavior: contain;
}
.results li { display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: 14px; cursor: pointer; font-size: 16px; }
.results li[aria-selected="true"], .results li:hover { background: var(--surface-2); }
.results li svg { color: var(--muted); }
.results .r-name { font-weight: 600; }
.results .r-sub { color: var(--muted); font-size: 13px; }
.results .r-msg { color: var(--muted); cursor: default; }
.results .r-msg:hover { background: none; }

/* ---------- route ---------- */
.from-box { position: relative; }
.from-row {
  display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 12px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface-2); cursor: text;
}
.from-row:focus-within { border-color: var(--brand); background: var(--surface); }
.from-label { color: var(--muted); font-weight: 600; font-size: 14px; flex: none; }
.from-row input {
  flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: none; color: var(--ink);
  font: inherit; font-size: 16px; font-weight: 600;
}
.from-row input::placeholder { color: #1c7ed6; opacity: 1; }
.from-row input::-webkit-search-cancel-button { cursor: pointer; }
.results.from-results { left: 0; right: 0; top: 50px; z-index: 5; }
.route-head { padding: 2px 16px 12px; display: grid; gap: 10px; border-bottom: 1px solid var(--line); }
.route-head .row-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.route-head h1 { font-size: 18px; }
.route-head .meta { color: var(--muted); font-size: 13.5px; font-weight: 600; }
.range-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-weight: 600; font-size: 14px; }
.range-input { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.range-input input {
  width: 92px; height: 38px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font: inherit; font-size: 16px; font-weight: 600; text-align: right;
}
.stops-summary p { margin: 0; }
.stops-summary .stop-list { padding: 6px 0 0; overflow: visible; flex: none; }
.stops-summary .row { padding-left: 4px; padding-right: 4px; }
.stops-summary { font-size: 13.5px; line-height: 1.4; padding: 9px 12px; border-radius: 10px; background: var(--brand-soft); color: var(--ink); }
.stops-summary.warn { background: color-mix(in srgb, var(--p4) 16%, var(--surface)); }
.row.stop { background: var(--brand-soft); border-radius: 12px; }
.row.stop .row-sub { color: var(--ink); font-weight: 600; }
.stop-pin span {
  display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: var(--brand); color: #fff; font-weight: 600; font-size: 14px; border: 2.5px solid #fff; box-shadow: var(--shadow-sm);
}
@media (prefers-color-scheme: dark) { .stop-pin span { background: var(--brand-strong); color: #07140f; } }
.gmaps-route {
  display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; margin-top: 8px; padding: 0 12px;
  border-radius: 12px; background: var(--surface); border: 1px solid var(--line); color: var(--brand) !important;
  text-decoration: none; font-weight: 600; font-size: 14.5px; text-align: center;
}
.gmaps-route:hover { background: var(--surface-2); }
.gmaps-route svg { width: 18px; height: 18px; flex: none; }
@media (prefers-color-scheme: dark) { .gmaps-route { color: var(--brand-strong) !important; } }
.gmaps-note { margin-top: 8px !important; color: var(--muted); }
.gmaps-parts .gmaps-route { margin-top: 6px; }
.route-head .nav-primary { margin-top: 0; min-height: 48px; font-size: 16px; }
.leg { color: var(--muted); font-size: 12px; font-weight: 600; }

/* ---------- location help ---------- */
.help { padding: 4px 16px calc(20px + env(safe-area-inset-bottom)); overflow-y: auto; }
.help h2 { font-size: 19px; margin-bottom: 6px; }
.help p { color: var(--muted); margin: 0 0 12px; max-width: 60ch; }
.help ol { margin: 0 0 14px; padding-left: 20px; display: grid; gap: 4px; }
.help h3 { font-size: 14px; margin: 14px 0 6px; }
.help .actions { display: grid; gap: 8px; margin-top: 16px; }
.btn-quiet {
  display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface-2); font-weight: 600;
}
.btn-quiet:hover { background: var(--line); }

.toast {
  position: fixed; left: 50%; top: calc(env(safe-area-inset-top) + 200px); transform: translateX(-50%);
  z-index: 1004; padding: 10px 16px; border-radius: 999px; background: var(--ink); color: var(--surface);
  font-weight: 600; font-size: 14px; box-shadow: var(--shadow-sm); white-space: nowrap;
}

/* price breakdown */
.breakdown { width: 100%; border-collapse: collapse; font-size: 13.5px; margin: 8px 0 2px; }
.breakdown td { padding: 3px 0; color: var(--muted); }
.breakdown td:last-child { text-align: right; color: var(--ink); font-weight: 600; }
.breakdown tr.total td { border-top: 1px solid var(--line); padding-top: 6px; color: var(--ink); font-weight: 600; }
.est { font-size: 11.5px; font-weight: 600; color: var(--muted); }

/* OpenStreetMap tiles have no dark style: invert and soften them at night. */
@media (prefers-color-scheme: dark) {
  .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(0.88) contrast(0.88) saturate(0.25); }
  .leaflet-container { background: #1d2422; }
}

/* Small phones: keep all three filter chips on screen. */
@media (max-width: 380px) {
  .filters { gap: 6px; }
  .chip { font-size: 13px; padding: 0 10px 0 8px; gap: 4px; }
  .chip svg { width: 14px; height: 14px; }
}
.limit-clear[hidden] { display: none; }

/* Ko-fi tip link: warm Ko-fi coral so it stands out, one gentle nudge when first seen */
.tip {
  display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; margin-bottom: 14px;
  border-radius: 14px; background: #ff5e5b; color: #fff !important;
  font-weight: 600; font-size: 15px; text-decoration: none;
  box-shadow: 0 4px 14px rgba(255, 94, 91, .35);
  transition: transform .15s, box-shadow .15s;
}
.tip .cup { font-size: 20px; display: inline-block; transform-origin: 50% 90%; }
.tip:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(255, 94, 91, .45); }
.tip:active { transform: translateY(1px); }
.tip.nudge .cup { animation: cup-wiggle 1.2s ease-in-out 1; }
@keyframes cup-wiggle {
  0%, 100% { transform: rotate(0); }
  15% { transform: rotate(-14deg); } 30% { transform: rotate(12deg); }
  45% { transform: rotate(-8deg); } 60% { transform: rotate(5deg); } 75% { transform: rotate(0); }
}

/* ---------- mobile hardening (iPhone Safari + Android Chrome quirks) ---------- */
@supports (height: 100dvh) { :root { --sheet: 74dvh; } }
/* no pull-to-refresh or rubber-band bounce fighting the map and the sheet */
html, body { overscroll-behavior: none; }
body { position: fixed; inset: 0; width: 100%; }
/* notch / rounded corners in landscape */
.top { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
.fab { right: max(14px, calc(env(safe-area-inset-right) + 8px)); }
/* no long-press callouts or accidental text selection on map and controls */
#map, .pin-tag, .chip, .fab, .seg, .grip, .tip, .nav-primary, .nav-more a { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
/* no double-tap zoom (and its tap delay) on anything tappable */
button, a, input, label, .row, .results li { touch-action: pan-x pan-y; } /* pan only: no double-tap or pinch zoom of the page */
/* hover colours only where there is a real pointer: on touch they "stick" after a tap */
@media (hover: none) {
  .chip:hover { background: var(--surface); }
  .chip[aria-pressed="true"]:hover { background: var(--brand-soft); }
  .row:hover, .text-btn:hover, .limit-clear:hover, .results li:hover { background: none; }
  .results li[aria-selected="true"] { background: var(--surface-2); }
  .tip:hover { transform: none; box-shadow: 0 4px 14px rgba(255, 94, 91, .35); }
  .nav-primary:hover { background: var(--brand); }
  .nav-more a:hover, .btn-quiet:hover { background: var(--surface-2); }
}
/* landscape phones: side panel is narrower */
@media (orientation: landscape) and (max-height: 520px) and (min-width: 560px) and (max-width: 899px) {
  #map, .top { right: min(360px, 45vw); }
  .panel { width: min(360px, 45vw); padding-bottom: env(safe-area-inset-bottom); }
  .fab { right: calc(min(360px, 45vw) + 16px); bottom: 16px; }
  .near-me { left: calc(50% - min(180px, 22.5vw)); bottom: 16px; }
  .filters { padding-top: 6px; }
  .search-box { height: 48px; }
}

/* About + FAQ: plain readable text at the end of the list (also what search engines index) */
.about { margin: 4px 0 18px; color: var(--muted); font-size: 13.5px; line-height: 1.5; }
.about h1 { font-size: 17px; color: var(--ink); margin-bottom: 6px; }
.about h2 { font-size: 15px; color: var(--ink); margin: 16px 0 4px; }
.about p { margin: 0 0 8px; max-width: 65ch; }
.about details { border-top: 1px solid var(--line); padding: 8px 0; }
.about summary { cursor: pointer; color: var(--ink); font-weight: 600; font-size: 14px; }
.about details p { margin: 6px 0 0; }

/* ---------- France: network estimates and the operator's own price text ---------- */
.price-note { font-size: 13px; color: var(--muted); margin: -6px 0 12px; max-width: 60ch; }
.note .quote { font-style: italic; overflow-wrap: anywhere; }

/* ---------- trust: estimate labels, data age, live status, plan B ---------- */
.trust { font-size: 13px; color: var(--muted); margin: -6px 0 10px; line-height: 1.45; max-width: 60ch; }
.conf { display: inline-block; padding: 1px 8px; margin-right: 4px; border-radius: 999px; font-size: 11.5px; font-weight: 700;
  letter-spacing: .02em; background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); }
.price-box.none .conf { margin: 0 0 6px; display: table; }
.live { display: flex; align-items: flex-start; gap: 10px; margin: 14px 0 0; padding: 10px 12px; border-radius: 12px;
  background: var(--surface-2); font-weight: 600; font-size: 14.5px; }
.live .dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; flex: none; background: var(--p0); }
.live .sub { display: block; font-weight: 500; font-size: 12.5px; color: var(--muted); }
.live.ok .dot { background: var(--p1); } .live.busy .dot { background: var(--p3); } .live.bad .dot { background: var(--p4); }
.live.unknown { color: var(--muted); }
.live.unknown .dot { background: transparent; border: 2px dashed var(--p0); width: 12px; height: 12px; margin-top: 5px; }
.alt-list { padding: 0; overflow: visible; flex: none; }
.alt-list .row { padding-left: 0; padding-right: 0; }
.data-line { display: flex; align-items: center; gap: 6px; border: 0; background: none; padding: 0; margin-top: -2px;
  font-size: 12.5px; font-weight: 600; color: var(--muted); text-align: left; }
.data-line svg { width: 14px; height: 14px; }
.data-line span { text-decoration: underline dotted; text-underline-offset: 3px; }
.cov { width: 100%; border-collapse: collapse; font-size: 13.5px; margin: 6px 0 4px; }
.cov th { text-align: right; font-weight: 600; color: var(--muted); font-size: 12px; padding: 4px 0 6px 8px; }
.cov td { padding: 7px 0 7px 8px; text-align: right; border-top: 1px solid var(--line); font-weight: 600; }
.cov td:first-child, .cov th:first-child { text-align: left; padding-left: 0; color: var(--ink); }

/* ---------- ultra-fast (200 kW+, Ionity, Tesla): gold ring and a double bolt ---------- */
:root { --ultra: #e0a800; }
@media (prefers-color-scheme: dark) { :root { --ultra: #f6c945; } }
.pin-tag.ultra { border-color: var(--ultra); box-shadow: 0 0 0 1.5px rgba(0,0,0,.35), var(--shadow-sm); }
.pin-tag.ultra::after { border-top-color: var(--ultra); }
.pin-tag.ultra { padding-left: 3px; }
.pin-tag .b2 { width: 20px; height: 18px; padding: 2px; margin-right: 2px; border-radius: 5px; background: #202124; color: var(--sun); }
.pin-tag.compact .b2 { width: 15px; height: 14px; padding: 1.5px; border-radius: 4px; margin-right: 1px; }
.badge.ultra { box-shadow: inset 0 0 0 3px var(--ultra); }
.badge.ultra svg { color: var(--sun); width: 20px; height: 20px; }
.ultra-pill { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 6px; padding: 2px 10px 2px 6px; border-radius: 999px;
  background: #202124; color: #fff; font-size: 12.5px; font-weight: 700; }
.ultra-pill svg { width: 15px; height: 15px; color: var(--sun); }
@media (prefers-color-scheme: dark) { .ultra-pill { background: #3c4043; } }

/* ---------- Fast Charge France: Provence lavender instead of Madeira green ---------- */
:root {
  --brand: #5b3f8c;         /* lavender: shell + primary action */
  --brand-strong: #46306e;
  --brand-soft: #e9e2f5;
  --mark: #5b3f8c;
}
@media (prefers-color-scheme: dark) {
  :root {
    --brand: #1c1528;
    --brand-strong: #b9a1e8;
    --brand-soft: #2f2445;
  }
}
