/* ── Map cursor (#120) ────────────────────────────────────────────
   Default cursor over the map canvas is a crosshair — signals that
   the map is interactive (click to extend the route, click on the
   route to drop a waypoint).  On active press / drag the cursor
   switches to `grabbing` via :active.  Contextual overrides for
   "hovering the existing route" or "dragging a waypoint" come from
   body-level classes that route_drag.js toggles; "over a POI" from
   poi_hover.js. */
.maplibregl-canvas-container.maplibregl-interactive,
.maplibregl-canvas-container.maplibregl-interactive .maplibregl-canvas {
  cursor: crosshair !important;
}
.maplibregl-canvas-container.maplibregl-interactive:active,
.maplibregl-canvas-container.maplibregl-interactive:active .maplibregl-canvas {
  cursor: grabbing !important;
}
/* Over a POI (poi_hover.js): a click opens its details.  Before the grab
   rules, so a drag that starts on one still shows grab / grabbing. */
body.ps-cursor-pointer .maplibregl-canvas-container.maplibregl-interactive:not(:active),
body.ps-cursor-pointer .maplibregl-canvas-container.maplibregl-interactive:not(:active) .maplibregl-canvas {
  cursor: pointer !important;
}
/* Street View mode: a click opens Street View there — a camera, not the
   routing crosshair (a press still pans: grabbing). */
body.ps-streetview .maplibregl-canvas-container.maplibregl-interactive:not(:active),
body.ps-streetview .maplibregl-canvas-container.maplibregl-interactive:not(:active) .maplibregl-canvas {
  cursor: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%22-1%20-1%2018%2018%22%3E%3Cpath%20fill%3D%22%231f2937%22%20stroke%3D%22%23fff%22%20stroke-width%3D%221.1%22%20paint-order%3D%22stroke%22%20d%3D%22M2%204a2%202%200%200%200-2%202v6a2%202%200%200%200%202%202h12a2%202%200%200%200%202-2V6a2%202%200%200%200-2-2h-1.172a2%202%200%200%201-1.414-.586l-.828-.828A2%202%200%200%200%209.172%202H6.828a2%202%200%200%200-1.414.586l-.828.828A2%202%200%200%201%203.172%204z%22%2F%3E%3Ccircle%20cx%3D%228%22%20cy%3D%228.5%22%20r%3D%222.6%22%20fill%3D%22%23fff%22%2F%3E%3C%2Fsvg%3E") 12 12, crosshair !important;
}
body.ps-cursor-grab .maplibregl-canvas-container.maplibregl-interactive,
body.ps-cursor-grab .maplibregl-canvas-container.maplibregl-interactive .maplibregl-canvas {
  cursor: grab !important;
}
body.ps-cursor-grabbing .maplibregl-canvas-container.maplibregl-interactive,
body.ps-cursor-grabbing .maplibregl-canvas-container.maplibregl-interactive .maplibregl-canvas {
  cursor: grabbing !important;
}

/* ── Design tokens (#133) ──────────────────────────────────────
   Single source of truth for the palette + spacing scale.  All
   subsequent rules should reference these instead of hard-coding
   hex values, so future theme tweaks (or a proper dark/light
   toggle) become one-line changes here.

   Direction B (Komoot/Strava minimal light) baseline: white app
   surfaces, a light green accent for primary actions, a coral
   accent for destructive, muted grays for supporting UI.  Same
   token names would work for a future dark palette — just swap
   values under a `[data-theme="dark"]` selector. */
:root {
  /* Backgrounds */
  --bg:            #ffffff;         /* page + panel bodies */
  --panel-bg:      #f7f7f9;         /* recessed surfaces (left panel) */
  --floating-bg:   rgba(255, 255, 255, 0.94);  /* topbar / floating chips */
  --overlay-bg:    rgba(255, 255, 255, 0.85);  /* map controls */
  --hover-bg:      #eef1f4;

  /* Foregrounds */
  --fg:            #1a1a2e;         /* body text */
  --fg-muted:      #6b7280;         /* secondary text, labels */
  --fg-subtle:     #9ca3af;         /* placeholder, disabled */
  --fg-inverse:    #ffffff;         /* text on accent surfaces */
  /* Darkly's secondary text is for dark backgrounds (white 75 %: .text-muted
     unreadable on the light panels and popovers — user 2026-11-04). */
  --bs-secondary-color: var(--fg-muted);

  /* Borders + shadows */
  --border:        #e5e7eb;
  --border-strong: #cbd0d7;
  --shadow-sm:     0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md:     0 4px 10px rgba(15, 23, 42, 0.08);

  /* Accent colours (Komoot/Strava-adjacent) */
  --accent:        #00a870;         /* primary green */
  --accent-hover:  #00915f;
  --accent-soft:   rgba(0, 168, 112, 0.10);
  --warn:          #f6a821;
  --warn-soft:     rgba(246, 168, 33, 0.12);
  --danger:        #e04f4f;
  --danger-soft:   rgba(224, 79, 79, 0.10);

  /* Shape */
  --radius-sm:     4px;
  --radius:        6px;
  --radius-lg:     10px;
  --pill:          9999px;

  /* Spacing scale (rarely referenced but useful for consistency) */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
}

/* ── Reset / base ────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
       background: var(--bg); color: var(--fg); font-size: 14px; }
/* #186 — Prevent a transient page-level scrollbar from appearing
   when a hover state (Bootstrap tooltip or popover positioned near
   the viewport edge) briefly extends past the viewport bounds.  The
   scrollbar was reclaiming ~15 px of horizontal space and shifting
   every fixed / absolute-positioned control left for one frame.
   The app shell already uses height: 100vh + overflow: hidden, so
   there's no legitimate page-level scroll to preserve. */
html, body { overflow: hidden; height: 100%; }

/* ── App shell ───────────────────────────────────────────────── */
.app-shell {
  position: relative;   /* anchor for floating topbar + stats bar */
  display: flex;
  flex-direction: column;
  height: 100vh;
  /* Mobile browsers: 100vh is the viewport WITH the browser's own toolbars
     hidden, so the bottom of the stats bar / elevation chart sat under
     Chrome's bottom toolbar.  dvh is the area actually visible now. */
  height: 100dvh;
  overflow: hidden;
}

/* ── Topbar (#133 Phase D) ──────────────────────────────────────
   Floats over the map as a translucent rounded capsule so the map
   canvas fills the full viewport underneath.  Direction B still
   applies inside the capsule: dark text on translucent white,
   green primary Import, muted secondary buttons.  Positioned above
   the map-ctrl-strip (z-index 1600) so popover flyouts anchor
   correctly. */
.app-topbar {
  position: absolute !important;
  top: 12px;
  left: 12px;
  right: 12px;
  z-index: 1750;
  background: var(--floating-bg) !important;
  border: 1px solid var(--border);
  border-radius: var(--pill);
  box-shadow: var(--shadow-md);
  color: var(--fg);
  backdrop-filter: blur(8px) saturate(1.1);
  padding: 4px 12px !important;
}
.app-topbar .navbar-brand {
  color: var(--fg) !important;
  font-weight: 600;
  letter-spacing: -0.2px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
/* Favicon reused as the topbar brand mark — same green rounded
   square, sized to the brand text's cap height.  Uses background-
   image instead of <img> because Chromium reports naturalWidth = 0
   for width-attributed SVG inside <img> under some viewport
   conditions, falling back to the broken-image sprite. */
.app-topbar .topbar-brand-mark {
  width: 26px;
  height: 26px;
  display: inline-block;
  background: url("favicon.svg") center / contain no-repeat;
  flex-shrink: 0;
}
.app-topbar .text-muted { color: var(--fg-muted) !important; }
.app-topbar .btn-primary {
  background: var(--accent) !important;
  border-color: var(--accent) !important;
  color: var(--fg-inverse) !important;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.app-topbar .btn-primary:hover {
  background: var(--accent-hover) !important;
  border-color: var(--accent-hover) !important;
}
.app-topbar .btn-secondary,
.app-topbar .btn-light {
  background: var(--bg) !important;
  border: 1px solid var(--border) !important;
  color: var(--fg) !important;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.app-topbar .btn-secondary:hover,
.app-topbar .btn-light:hover {
  background: var(--hover-bg) !important;
  border-color: var(--border-strong) !important;
}
.topbar-link {
  color: var(--fg-muted) !important;
  text-decoration: none;
}
.topbar-link:hover { color: var(--fg) !important; }

/* #133 — destructive-flavour topbar button (Clear all).  Same
   ghost pill shape as the other secondary buttons but with a
   danger tint so users read "this will remove things" before
   they click.  Bootstrap's `.btn-outline-danger` picks the wrong
   accent; force our own token. */
.app-topbar .btn.topbar-danger {
  background: var(--danger-soft) !important;
  border-color: var(--danger) !important;
  color: var(--danger) !important;
}
.app-topbar .btn.topbar-danger:hover {
  background: var(--danger) !important;
  border-color: var(--danger) !important;
  color: var(--fg-inverse) !important;
}

/* ── Main body: left panel + map ─────────────────────────────── */
.main-body {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 0;
  /* Phase D — topbar + stats-bar are now absolute-positioned, so
     main-body fills the full viewport minus a tiny top pad that
     covers plotly's default 8 px modebar top-offset.  Keeps the
     map layers underneath both floating capsules. */
  height: 100%;
}

/* ── Left panel (track upload + per-track list) ──────────────── */
.left-panel {
  width: 300px;
  min-width: 260px;
  max-width: 340px;
  overflow-y: auto;
  background: var(--panel-bg);
  border-right: 1px solid var(--border);
  flex-shrink: 0;
}

/* ── Map wrapper ─────────────────────────────────────────────── */
.map-wrapper {
  position: relative;
  flex: 1;
  height: 100%;
  min-width: 0;
  overflow: hidden;
}

/* ── Map graph ───────────────────────────────────────────────── */
.map-graph {
  width: 100%;
  height: 100%;
}
.map-graph .js-plotly-plot,
.map-graph .plotly,
.map-graph .plot-container {
  height: 100% !important;
}

/* ── Plotly modebar: move from top-right to top-left ──────────────
   Keep the container full-width (Plotly's inline width:100%, right:0)
   but absolutely position the inner .modebar to the top-left of the
   map area, where the track-editing controls are conceptually grouped. */
.map-graph .modebar-container {
  /* Push below the floating topbar (12 + ~40 + 6 slack) so the
     modebar's tools don't hide under it. */
  top: 66px !important;
}
.map-graph .modebar {
  position: absolute !important;
  left: 8px !important;
  right: auto !important;
  top: 0 !important;
  background: var(--overlay-bg) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
  padding: 2px !important;
  box-shadow: var(--shadow-sm);
}

/* ── Right-edge map control strip ────────────────────────────── */
.map-ctrl-strip {
  position: absolute;
  /* Sit below the floating topbar (Phase D): topbar bottom edge
     ≈ 54 px, plus a little breathing room. */
  top: 66px;
  right: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  z-index: 1600;     /* above reroute banner so it can never cover them */
}

.map-ctrl-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  background: var(--overlay-bg) !important;
  border: 1px solid var(--border) !important;
  color: var(--fg) !important;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  padding: 0 !important;
  box-shadow: var(--shadow-sm);
  transition: background 120ms, border-color 120ms, color 120ms;
}
/* Hold-to-peek: a long press is the gesture — no text selection, callout
   or scroll on it. */
#btn-peek { touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.map-ctrl-btn:hover {
  background: var(--hover-bg) !important;
  border-color: var(--border-strong) !important;
  color: var(--accent) !important;
}

/* Draggable start / end endpoint dots (Rule #66) — sit on top of the
   Plotly Scattermap markers so the user can grab them.  Sized a bit
   bigger than .route-waypoint so the hit target is generous; the
   visible halo + colour come from the Plotly trace below. */
.route-endpoint-drag {
  position: absolute;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;       /* hit-tested in JS via lat/lon */
  z-index: 1490;              /* below .route-waypoint, above polyline */
  border: 2px solid rgba(0, 0, 0, 0);
  cursor: grab;
}
.route-endpoint-start { background: rgba(0, 216, 106, 0.30); }
.route-endpoint-end   { background: rgba(229, 57, 53, 0.30); }

/* Pending import slice endpoints (#85 V3 step 4) — distinct square
   shape so the user reads them as "not the route's endpoints, drag
   me to cut the imported track".  Gray fill, dark border, same
   z-index family as the round route endpoints. */
.pending-endpoint {
  position: absolute;
  width: 18px;
  height: 18px;
  transform: translate(-50%, -50%) rotate(45deg);
  pointer-events: none;
  z-index: 1490;
  border: 2px solid #1a1a2e;
  border-radius: 3px;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.6);
  cursor: grab;
}
.pending-endpoint-start { background: #6fd17e; }   /* greener, "from" */
.pending-endpoint-end   { background: #d97a7a; }   /* redder, "to" */

/* Floating "+ Add this slice" pill (#85 V3 step 3) — sits at the
   midpoint of each pending track's slice.  Hover lifts opacity so it
   reads as an actionable button. */
/* Pending pill.  Two flavours:
   * solo  — single green "Add this slice" button (regular GPX import).
   * combo — two halves inside one oval: green "Add this slice" on
            the left, white "Elevation" on the right, thin vertical
            divider between (gravel candidates only).
   Outer element carries border-radius + shadow + positioning; the
   inner button halves handle click and colour. */
.pending-add-btn {
  position: absolute;
  transform: translate(-50%, -50%);
  z-index: 1495;
  border: 1px solid #1a1a2e;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  opacity: 0.9;
  transition: opacity 120ms, transform 120ms;
  display: inline-flex;
  align-items: stretch;
  overflow: hidden;
  pointer-events: auto;      /* override .route-polyline-layer none */
}
.pending-add-btn:hover {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.04);
}
.pending-add-half {
  padding: 0.35rem 0.7rem;
  border: 0;
  background: transparent;
  cursor: pointer;
  color: #ffffff;
  font: inherit;
  display: inline-flex;
  align-items: center;
}
.pending-add-half-add {
  background: rgba(28, 168, 80, 0.92);
  color: #ffffff;
}
.pending-add-half-add:hover { background: rgba(24, 149, 71, 0.98); }
.pending-add-half-elev {
  background: rgba(255, 255, 255, 0.94);
  color: #0d6efd;
}
.pending-add-half-elev:hover { background: #ffffff; color: #084298; }
/* #258 — middle "Attach to route" half.  Blue palette distinct
   from the green "Add" and the white "Elevation" so the three
   actions are visually separable at a glance.  Only rendered when
   ``_isSpliceEligible`` is true for the current route. */
.pending-add-half-attach {
  background: rgba(13, 110, 253, 0.92);
  color: #ffffff;
}
.pending-add-half-attach:hover { background: rgba(10, 88, 202, 0.98); }
/* #260 — rightmost "Cancel" half.  Red palette so it reads as
   destructive at a glance; matches the pending-start-cancel color
   (which now uses the same class so both surfaces feel identical). */
.pending-add-half-cancel {
  background: rgba(212, 58, 58, 0.92);
  color: #ffffff;
}
.pending-add-half-cancel:hover { background: rgba(176, 44, 44, 0.98); }
.pending-add-divider {
  width: 1px;
  background: rgba(26, 26, 46, 0.55);
  align-self: stretch;
}
.pending-add-btn i { font-size: 14px; vertical-align: -1px; }

/* #168 — floating "dist · gain" chip above the combo pill on
   gravel candidates.  Non-interactive; provides quick stats
   without opening the Import popover or the elevation overlay. */
.pending-info-chip {
  position: absolute;
  transform: translate(-50%, -100%);
  z-index: 1494;
  padding: 2px 8px;
  background: rgba(255, 255, 255, 0.92);
  color: #1a1a2e;
  border: 1px solid rgba(26, 26, 46, 0.35);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  pointer-events: none;
}

/* #134/#260 — cancel button for the orphan Draw pending_start,
   now rendered as a pill (shares .pending-add-btn wrapper +
   .pending-add-half-cancel styling with the pending-pill's
   rightmost Cancel).  This class only tweaks the anchor point so
   the pill sits ABOVE the green start marker rather than
   overlapping it (default .pending-add-btn anchors at its centre;
   we anchor at its bottom-centre instead). */
.pending-start-cancel {
  transform: translate(-50%, -100%);
  z-index: 1500;
}
.pending-start-cancel:hover {
  transform: translate(-50%, -100%) scale(1.04);
}

/* Waypoint dot (Rule #2) — Hammerhead-style: white centre, firm dark
   edge that matches the route polyline's outline so the dot reads as
   part of the route geometry. */
/* Preview line drawn from the planned-route end to the snap-cursor dot
   while the user hovers off-route.  Dimmer than the real polyline so
   it reads as a "this is where a click would extend toward" hint. */
.snap-preview-line {
  pointer-events: none;
  opacity: 0.9;
}

/* In-flight "routing…" dot — shown right after the user commits a click
   or drag-drop while the routing engine works on the new leg. */
.routing-loading-dot {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(255, 200, 60, 0.85);
  border: 2px solid rgba(0, 0, 0, 0.75);
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 1480;            /* below .route-waypoint (1500) */
  box-shadow: 0 0 0 1.5px rgba(0, 0, 0, 0.35);
  animation: routing-pulse 900ms ease-in-out infinite;
}
@keyframes routing-pulse {
  0%   { transform: translate(-50%, -50%) scale(0.85); opacity: 0.65; }
  50%  { transform: translate(-50%, -50%) scale(1.15); opacity: 1.0;  }
  100% { transform: translate(-50%, -50%) scale(0.85); opacity: 0.65; }
}

/* Failure flash — routing came back unreachable for the dot's position.
   A short, brighter pulse in red so the rejection lands where the user
   was already looking; no side-panel error needed. */
.routing-loading-dot.error {
  background: rgba(255, 70, 70, 0.95);
  border-color: rgba(120, 0, 0, 0.9);
  animation: routing-error 600ms ease-out forwards;
}
@keyframes routing-error {
  0%   { transform: translate(-50%, -50%) scale(0.9);  opacity: 1.0; }
  30%  { transform: translate(-50%, -50%) scale(1.35); opacity: 1.0; }
  100% { transform: translate(-50%, -50%) scale(1.6);  opacity: 0.0; }
}

/* ── #138 — Topbar search ─────────────────────────────────────────
   Persistent input in the topbar with a dropdown of ranked results.
   Sits between the brand and the Import button; results overlay
   under the input so they don't shift the topbar layout. */
.topbar-search {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 220px;
  max-width: 340px;
  flex: 0 1 320px;
}
.topbar-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--fg-muted);
  font-size: 14px;
  pointer-events: none;
  z-index: 1;
}
.topbar-search-input.form-control {
  padding: 4px 10px 4px 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--fg);
  font-size: 13px;
}
.topbar-search-input.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.topbar-search-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 2000;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
  max-height: 60vh;
  overflow-y: auto;
  display: none;
}
.topbar-search-results.open {
  display: block;
}
.topbar-search-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.topbar-search-row:last-child { border-bottom: 0; }
.topbar-search-row:hover,
.topbar-search-row.active {
  background: var(--bg-hover);
}
.topbar-search-row-icon {
  font-size: 15px;
  color: var(--fg-muted);
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}
.topbar-search-row-body {
  flex: 1 1 auto;
  min-width: 0;
}
.topbar-search-row-name {
  font-size: 13px;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-search-row-meta {
  font-size: 11px;
  color: var(--fg-muted);
}
.topbar-search-row-dist {
  font-size: 11px;
  color: var(--fg-muted);
  flex-shrink: 0;
  margin-left: auto;
}
.topbar-search-heading {
  padding: 6px 12px 2px;
  color: var(--fg-muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.topbar-search-empty {
  padding: 12px;
  color: var(--fg-muted);
  font-size: 12px;
  text-align: center;
}

/* Search-result overlay layer — sits above the route layers so
   the action popover isn't painted over by the route's markers.  Pointer-events pass through by default; the pin +
   popover elements opt back in individually.  Same pattern as
   .route-polyline-layer above. */
.search-pin-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1500;
  overflow: hidden;
}

/* Result pin dropped on the map after choosing a search result.
   Positioned via m.project(); a small action popover attaches to it
   via .topbar-search-pin-popover.  Visually a red teardrop that
   matches the .pending-start-cancel red palette so all three
   map-hover overlays (add-slice pill, cancel-X, search pin) share
   the same visual family. */
.topbar-search-pin {
  position: absolute;
  transform: translate(-50%, -100%);
  width: 24px;
  height: 32px;
  pointer-events: auto;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.35));
}
/* #140 — auto-route pick markers.  Same silhouette + positioning
   convention as the topbar-search-pin (bottom-of-pin at the projected
   coord).  Coloured green for start, blue for end via inline SVG. */
.auto-route-marker {
  position: absolute;
  transform: translate(-50%, -100%);
  width: 24px;
  height: 32px;
  pointer-events: none;   /* the pin is informational; user still */
                          /* clicks the map to re-pick */
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.35));
}
.auto-route-marker .pin-body {
  width: 100%;
  height: 100%;
  background-repeat: no-repeat;
  background-position: center;
}

.topbar-search-pin .pin-body {
  width: 100%;
  height: 100%;
  background: url("data:image/svg+xml;utf8,\
<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 32'>\
<path d='M12 0 C5 0 0 5 0 12 c0 8 12 20 12 20 s12-12 12-20 c0-7-5-12-12-12z' \
fill='%23d43a3a' stroke='%23ffffff' stroke-width='2'/>\
<circle cx='12' cy='12' r='4' fill='%23ffffff'/>\
</svg>") no-repeat center;
}

/* Action popover attached to the pin.  Sizing / shadow / radius /
   font weight consistent with .pending-add-btn (the "Add this slice"
   pill) — same visual family, more room for context (title + sub +
   two actions).  Primary action is the same green pill; the
   Dismiss is a slim ghost sibling so the eye lands on Route first. */
.topbar-search-pin-popover {
  position: absolute;
  transform: translate(-50%, calc(-100% - 40px));
  background: #ffffff;
  border: 1px solid #1a1a2e;
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  padding: 8px 10px 6px;
  min-width: 200px;
  max-width: 260px;
  pointer-events: auto;
  font-size: 12px;
  color: var(--fg);
}
.topbar-search-pin-popover .pin-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 2px;
  padding-right: 18px;   /* room for the close X */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-search-pin-popover .pin-sub {
  font-size: 11px;
  color: var(--fg-muted);
  margin-bottom: 8px;
}
.topbar-search-pin-popover .pin-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.topbar-search-pin-popover .pin-btn {
  border: 1px solid #1a1a2e;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  padding: 0.35rem 0.7rem;
  text-align: center;
  cursor: pointer;
  transition: opacity 120ms, transform 120ms;
  white-space: nowrap;
}
.topbar-search-pin-popover .pin-btn.pin-btn-primary {
  background: rgba(28, 168, 80, 0.92);
  color: #ffffff;
  opacity: 0.9;
}
.topbar-search-pin-popover .pin-btn.pin-btn-primary:hover {
  opacity: 1;
  transform: scale(1.03);
}
/* "+1.2 km" — what the detour adds (topbar_search.js setDetourCost). */
.topbar-search-pin-popover .pin-detour-cost {
  margin-left: 6px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.topbar-search-pin-popover .pin-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.topbar-search-pin-popover .pin-btn.pin-btn-secondary {
  background: #ffffff;
  color: var(--fg-muted);
  border-color: var(--border);
  font-weight: 500;
  opacity: 0.85;
}
.topbar-search-pin-popover .pin-btn.pin-btn-secondary:hover {
  color: var(--fg);
  opacity: 1;
}
.topbar-search-pin-popover .pin-close {
  position: absolute;
  top: 4px;
  right: 4px;
  background: transparent;
  border: 0;
  color: var(--fg-muted);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 2px 4px;
}
.topbar-search-pin-popover .pin-close:hover { color: var(--fg); }

/* Snap-to-road cursor preview — translucent ghost dot showing where an
   off-route click would actually land after snap_to_road.  Smaller and
   softer than .route-waypoint so it reads as a hover hint, not a real
   marker. */
.snap-cursor-dot {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.45);
  border: 1.5px solid rgba(0, 0, 0, 0.65);
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 1450;          /* below .route-waypoint (1500) */
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.35);
}

.route-waypoint {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.85);
  background: #FFFFFF;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 1500;
  box-shadow: 0 0 0 1.5px rgba(0,0,0,0.35),
              0 1px 4px rgba(0,0,0,0.45);
}

/* #124 — hover-only preview waypoint that follows the cursor along the
   route line.  Same shape as .route-waypoint so it reads as a real
   marker dropped at click time, but translucent and one level below in
   z so a real waypoint on top wins visually. */
.route-waypoint-ghost {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.55);
  background: rgba(255, 255, 255, 0.6);
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 1495;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.2);
}
body.ps-route-hidden .route-waypoint-ghost { display: none; }

/* Thin divider between nav buttons and layer controls */
.ctrl-sep {
  width: 28px;
  margin: 2px 0;
  border-color: #3a3a5c;
  opacity: 1;
}

/* #147 — the underlying dbc.Select is hidden; picker UI lives in
   the popover instead.  Kept the class for defensive styling. */
.layer-select { display: none !important; }

/* Basemap-picker popover (opens on the LEFT of the map-ctrl-strip). */
.layer-select-popover {
  z-index: 1800 !important;
}
.layer-popover-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
  min-width: 160px;
}
/* Borderless rows, mirroring the Android app's .layer-opt
   (mobile/www/style.css); text and row height match the POI / overlay
   menus' checkbox rows. */
.layer-popover-body .layer-opt-btn {
  text-align: left;
  padding: 4px 10px !important;
  font-size: 14px !important;
  font-weight: 400;
  line-height: 21px;
  border-radius: var(--radius) !important;
  background: none !important;
  border: 0 !important;
  box-shadow: none !important;
  color: var(--fg) !important;
}
.layer-popover-body .layer-opt-btn:hover,
.layer-popover-body .layer-opt-btn:focus-visible {
  background: var(--hover-bg) !important;
}
.layer-popover-body .layer-opt-btn.active {
  background: var(--accent-soft) !important;
  color: var(--accent-hover) !important;
}

/* #180 — Overlays popover: a checkbox per overlay so several can be
   on at once. */
.overlays-popover {
  z-index: 1800 !important;
}
/* Rows use the plain Bootstrap .form-check, same as the POI-category
   popover, so the two menus share spacing. */
.overlays-popover-body {
  min-width: 190px;
}
.overlays-popover-body .overlay-check label {
  cursor: pointer;
  user-select: none;
}
.route-notes-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 10px;
  margin: 0 0 2px 21px;
  font-size: 11px;
  color: var(--fg-muted);
}
/* Active badge on the toolbar button when any overlay is on. */
#overlays-btn.has-active::after {
  content: "";
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 1px var(--bg);
}
#overlays-btn { position: relative; }

/* #121 — reskin dbc.Switch as a 36×36 square icon button.  The
   real <input type=checkbox> is hidden; the label (which already
   carries the for=switch-id wire-up) is restyled into the visible
   button.  Active state (checkbox checked) lifts the background. */
.overlay-switch {
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  min-height: 0;
  display: block;
}
.overlay-switch .form-check-input {
  /* visually-hidden but still focusable + clickable via label */
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
  opacity: 0;
}

/* #133 — POI category checkboxes (and any other real checkboxes
   inside popovers) were invisible on the light popover body:
   Bootstrap's default checkbox border is a subtle gray-on-white
   that all but vanishes at 1 em × 1 em.  Give the input an
   explicit visible border and a green fill on checked, matching
   Direction B's accent everywhere else.  Scope excludes the
   `.overlay-switch` variant above and the dbc.Switch UI. */
.popover-body .form-check-input:not([type="radio"]),
.form-check-input:not([type="radio"]):not(.overlay-switch .form-check-input) {
  background-color: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
}
.popover-body .form-check-input:checked,
.form-check-input:checked:not(.overlay-switch .form-check-input) {
  background-color: var(--accent);
  border-color: var(--accent);
}
.popover-body .form-check-input:focus,
.form-check-input:focus:not(.overlay-switch .form-check-input) {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.popover-body .form-check-label {
  color: var(--fg);
  cursor: pointer;
}
.overlay-switch .form-check-label {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  background: var(--overlay-bg);
  border: 1px solid var(--border);
  color: var(--fg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  margin: 0;
  padding: 0;
  transition: background 120ms, border-color 120ms, color 120ms;
  box-shadow: var(--shadow-sm);
}
.overlay-switch .form-check-label:hover {
  background: var(--hover-bg);
  border-color: var(--border-strong);
  color: var(--accent);
}
.overlay-switch .form-check-input:focus-visible + .form-check-label {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
/* Checked / active state — clearly different than hover. */
.overlay-switch .form-check-input:checked + .form-check-label {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--fg-inverse);
}
/* #123 — How-to-use modal.  Centered over the map, dark theme to
   match the rest of the app, z-index above the right-edge map
   control strip (1600) so no map UI peeks through. */
.help-modal .modal-dialog {
  z-index: 2000;
}
.help-modal ~ .modal-backdrop,
.modal-backdrop.show {
  z-index: 1990;
}
/* #247 — light-theme overrides for the help modal AND every
   provider import modal.  dbc.themes.DARKLY sets a dark modal
   background by default; other surfaces (topbar, popovers,
   auto-route/share toasts) all have manual light overrides, so
   these modals were the last hold-outs still reading as
   "foreign notifications" instead of app surfaces.  Shared
   selector list keeps the four provider modals + help in sync;
   add any new import modal's id here to inherit the styling. */
.help-modal .modal-content,
#hammerhead-modal .modal-content,
#strava-modal     .modal-content,
#rwgps-modal      .modal-content,
#gdrive-modal     .modal-content {
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}
.help-modal .modal-header,
#hammerhead-modal .modal-header,
#strava-modal     .modal-header,
#rwgps-modal      .modal-header,
#gdrive-modal     .modal-header {
  border-bottom: 1px solid var(--border);
  padding: 14px 18px;
}
.help-modal .modal-title,
#hammerhead-modal .modal-title,
#strava-modal     .modal-title,
#rwgps-modal      .modal-title,
#gdrive-modal     .modal-title {
  color: var(--fg);
  font-size: 16px;
  font-weight: 600;
}
.help-modal .btn-close,
#hammerhead-modal .btn-close,
#strava-modal     .btn-close,
#rwgps-modal      .btn-close,
#gdrive-modal     .btn-close {
  /* DARKLY theme paints btn-close with a WHITE cross SVG so it
     reads on the dark modal it expects.  On our light-themed
     modals the white SVG vanishes into the light backdrop.
     Replace with a dark cross SVG (Bootstrap 5's default one)
     so the ✕ is actually visible.  ``opacity: 0.7`` gives it the
     same visual weight as the other muted controls. */
  background: transparent
    url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%231a1a2e'%3e%3cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/%3e%3c/svg%3e")
    center/1em auto no-repeat;
  filter: none;
  opacity: 0.7;
}
.help-modal .btn-close:hover,
#hammerhead-modal .btn-close:hover,
#strava-modal     .btn-close:hover,
#rwgps-modal      .btn-close:hover,
#gdrive-modal     .btn-close:hover {
  opacity: 1;
}
.help-modal .modal-body,
#hammerhead-modal .modal-body,
#strava-modal     .modal-body,
#rwgps-modal      .modal-body,
#gdrive-modal     .modal-body {
  padding: 16px 22px 22px;
  max-height: 75vh;
  overflow-y: auto;
  color: var(--fg);
  background: var(--bg);
}
/* Modal footers (sign-out / close buttons on provider modals) */
#hammerhead-modal .modal-footer,
#strava-modal     .modal-footer,
#rwgps-modal      .modal-footer,
#gdrive-modal     .modal-footer {
  border-top: 1px solid var(--border);
  background: var(--bg);
}
/* In-app manual (manual.py → layout._help_content): one tab per page of
   docs/manual/, user-facing text + feature pictures. */
.manual-tabs { flex-wrap: wrap; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.manual-tabs .nav-link { padding: 5px 10px; font-size: 12.5px; color: var(--fg-muted); border: 0;
                         border-bottom: 2px solid transparent; border-radius: 0; background: none; }
.manual-tabs .nav-link:hover { color: var(--fg); }
.manual-tabs .nav-link.active { color: var(--accent); border-bottom-color: var(--accent); background: none; }
.manual-md { font-size: 13.5px; line-height: 1.6; color: var(--fg); }
.manual-md h2 { font-size: 15px; font-weight: 600; margin: 16px 0 6px; }
.manual-md p, .manual-md ul, .manual-md ol { margin-bottom: 10px; }
.manual-md li { margin-bottom: 4px; }
.manual-md img { display: block; max-width: 100%; margin: 8px 0 14px; border: 1px solid var(--border);
                 border-radius: 8px; box-shadow: var(--shadow-sm, 0 1px 3px rgba(0,0,0,0.12)); }
.manual-md blockquote { margin: 10px 0; padding: 8px 12px; border-left: 3px solid var(--accent);
                        background: var(--accent-soft); border-radius: 0 6px 6px 0; color: var(--fg); }
.manual-md blockquote p { margin: 0; }
.help-footer .bmc-link { color: #8a6d00; }
/* Footer of the help window: privacy policy · Buy me a coffee. */
.help-footer {
  margin-top: 20px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 13px;
}
.help-footer a { color: var(--fg-muted); text-decoration: none; }
.help-footer a:hover { color: var(--accent); text-decoration: underline; }

/* #122 — dark, compact tooltip skin (overrides Bootstrap default
   black-on-grey with our app palette). */
/* Bootstrap tooltip — kept SLIGHTLY dark (fg-inverse-on-fg) so
   tooltips read as UI chrome, not as inline content. */
.ps-tooltip .tooltip-inner {
  background: var(--fg);
  color: var(--fg-inverse);
  border: 1px solid var(--fg);
  border-radius: var(--radius-sm);
  font-size: 11px;
  padding: 4px 8px;
  max-width: 240px;
  box-shadow: var(--shadow-md);
}
.ps-tooltip .tooltip-arrow::before {
  border-top-color:    var(--fg) !important;
  border-bottom-color: var(--fg) !important;
  border-left-color:   var(--fg) !important;
  border-right-color:  var(--fg) !important;
}

.overlay-switch .form-check-input:checked + .form-check-label:hover {
  background: var(--accent-hover);
}

/* ── Upload zone ─────────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 16px;
  text-align: center;
  color: var(--fg-muted);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.upload-zone:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* ── Track cards ─────────────────────────────────────────────── */
.track-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 10px 8px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
}
.track-card-header {
  display: flex;
  align-items: center;
  margin-bottom: 6px;
}
.track-color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 8px;
  flex-shrink: 0;
}
.track-filename {
  font-size: 12px;
  font-weight: 600;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Elevation graph (per track) ─────────────────────────────── */
.elev-graph {
  margin-top: 4px;
}

/* ── Defaults section (under track list) ──────────────────────── */
.defaults-sep {
  border-color: var(--border);
  margin: 16px 0 10px;
  opacity: 1;
}
/* Options that only apply under a parent setting (e.g. "Avoid ski
   tracks" under Snow mode): indented with a guide line. */
.defaults-sub {
  margin: 2px 0 0 10px;
  padding-left: 10px;
  border-left: 2px solid var(--border);
}
.defaults-label {
  font-size: 11px;
  color: var(--fg-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
/* #125 — cycling-speed input row in the Settings popover. */
.defaults-speed-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.default-speed-input {
  width: 80px !important;
  background: var(--bg) !important;
  border: 1px solid var(--border) !important;
  color: var(--fg) !important;
  border-radius: var(--radius-sm);
}
.default-speed-input:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 2px var(--accent-soft) !important;
}
.defaults-unit {
  font-size: 12px;
  color: var(--fg-muted);
}
/* The start-time row wraps rather than widening the Settings popover (its
   date labels are long — "Tue 27 Oct · less certain"; user 2026-10-21). */
.defaults-start-row { flex-wrap: wrap; row-gap: 6px; }
.defaults-start-row .default-start-day-select { flex: 1 1 150px; min-width: 0; max-width: 100%; }
/* #142 — day-of-week picker sits next to the time input. */
.default-start-day-select {
  width: auto !important;
  background: var(--bg) !important;
  border: 1px solid var(--border) !important;
  color: var(--fg) !important;
  border-radius: var(--radius-sm);
  padding: 3px 8px !important;
  font-size: 12px !important;
}

/* #132 — reverse route direction controls in the Settings popover. */
.reverse-controls-sep {
  border-color: var(--border);
  margin: 14px 0 10px;
  opacity: 1;
}
.reverse-controls .reverse-btn {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--fg);
  text-align: left;
  font-size: 13px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
}
.reverse-controls .reverse-btn:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--accent);
  color: var(--accent);
}
.reverse-controls .reverse-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── Per-track stats row (under elevation graph) ────────────── */
.track-stats-row {
  display: flex;
  gap: 6px;
  margin-top: 4px;
  flex-wrap: wrap;
  align-items: center;
}
.track-sparkline {
  display: inline-block;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  flex-shrink: 0;
}
/* #179 — surface mix chip on gravel candidate cards.  Segmented
   bar of surface classes weighted by length, plus a short label
   for the dominant class. */
.surface-mix-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.surface-mix-bar {
  display: inline-flex;
  width: 48px;
  height: 8px;
  border: 1px solid var(--border);
  border-radius: 2px;
  overflow: hidden;
  flex-shrink: 0;
}
.surface-mix-seg {
  display: inline-block;
  height: 100%;
}
/* #175 — post-discovery filter bar in the Import popover. */
.track-filter-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0 6px;
  flex-wrap: wrap;
}
.track-filter-bar .filter-check {
  margin-right: 4px !important;
}
.track-filter-bar .filter-num {
  width: 68px;
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  font-size: 12px;
}
.track-card-hidden { display: none !important; }
.track-filter-bar .filter-sort {
  width: 160px;
  font-size: 12px;
}
.track-filter-bar .filter-sort .Select-control {
  min-height: 26px;
  height: 26px;
}
.track-filter-bar .filter-sort .Select-value,
.track-filter-bar .filter-sort .Select-value-label,
.track-filter-bar .filter-sort .Select-placeholder {
  line-height: 24px !important;
  font-size: 12px !important;
}
.track-stat {
  font-size: 11px;
  color: var(--fg-muted);
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px 8px;
  white-space: nowrap;
}
/* #88 — pre-import warning when a pending track contains stretches of
   HC_HARD or harder.  Amber background stands out against the
   muted standard chips. */
.track-stat-warn {
  color: #8a5a10;
  background: var(--warn-soft);
  border-color: var(--warn);
}

/* ── Queue panel (inside left-route) ─────────────────────────── */
.queue-panel-inner {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  flex: 1 1 0;
  min-height: 0;
}

/* ── Queue segment card ──────────────────────────────────────── */
.queue-segment {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  font-size: 12px;
  cursor: default;
  transition: border-color 0.1s, background 0.1s;
}
.queue-segment:hover {
  border-color: var(--accent);
  background: var(--hover-bg);
}

/* ── Queue gap card ──────────────────────────────────────────── */
.queue-gap {
  background: var(--warn-soft);
  border: 1px dashed var(--warn);
  border-radius: var(--radius);
  padding: 8px 10px;
  font-size: 12px;
}
.gap-icon-row {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}
.gap-icon-btn {
  width: 28px;
  height: 24px;
  padding: 0 !important;
  font-size: 13px;
  border-radius: var(--radius-sm);
  color: var(--fg-muted) !important;
  background: var(--bg) !important;
  border: 1px solid var(--border) !important;
  transition: color 0.12s, border-color 0.12s, background 0.12s;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.gap-icon-btn:hover {
  color: var(--fg) !important;
  border-color: var(--border-strong) !important;
  background: var(--hover-bg) !important;
}
.gap-icon-btn.active {
  color: var(--accent) !important;
  border-color: var(--accent) !important;
  background: var(--accent-soft) !important;
}

/* ── Stats bar (#133 Phase D) ───────────────────────────────────
   Floats over the map like the topbar: a translucent white card
   pinned to the bottom of the viewport with a subtle shadow.
   `.elev-scrubber-line` positioning still works because the card
   is `position: absolute` — its own children can be absolute
   against it. */
.stats-bar {
  position: absolute;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));   /* viewport-fit=cover */
  left: 12px;
  right: 12px;
  z-index: 1750;
  background: var(--floating-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(8px) saturate(1.1);
  padding: 8px 14px !important;
  max-height: 45vh;
  overflow-y: auto;
}
.elev-scrubber-line {
  /* #239 — bring visual weight up to match its paired ``.scrubber-dot``
     (the yellow dot the chart draws on the MAP when hovering the
     line — same source glyph, opposite direction).  Old form was
     2px dotted #FFFF00 which blended into the light chart backing
     colors and the pink route-halo palette.  Now: bright yellow
     3px body, dark 1px outline stroke (via box-shadow), soft yellow
     outer glow — exactly the vocabulary of ``.scrubber-dot`` so the
     two read as an obvious pair. */
  position: absolute;
  width: 3px;
  background: #FFF200;
  box-shadow:
    0 0 0 1px #1a1a2e,               /* dark 1px stroke */
    0 0 8px rgba(255, 242, 0, 0.75); /* yellow outer glow */
  pointer-events: none;
  z-index: 5;
  /* Center the 3px body on the JS-computed pixel column (elev_hover.js
     writes ``left = xa.d2p(km)``, i.e. the exact target x).  Same
     pattern as .route-waypoint / .scrubber-dot use to center on their
     coord. */
  transform: translateX(-50%);
}
.stat-chips-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.stat-chip {
  font-size: 12px;
  color: var(--fg);
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: var(--pill);
  padding: 3px 10px;
  display: inline-flex;
  align-items: center;
}

/* ── View-mode picker (above the elevation chart) ────────────────── */
/* View mode: one dropdown button showing the selected mode (stats_panel). */
.view-mode-picker { margin-left: auto; }   /* push to the right end of the chips row */
.view-mode-picker .view-mode-toggle {
  font-size: 11px;
  padding: 3px 10px;
  color: var(--fg-muted);
  border-radius: var(--pill);
  background: var(--panel-bg);
  border: 1px solid var(--border);
}
.view-mode-picker .view-mode-toggle:hover { color: var(--fg); background: var(--hover-bg); }
.view-mode-picker.has-mode .view-mode-toggle {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: var(--accent);
}
/* The menu opens UP (direction="up") and is skinned like the map
   controls' basemap menu (.layer-popover-body): popover card, borderless
   14px rows, hover-bg, the active one accent-soft. */
.view-mode-picker .dropdown-menu {
  min-width: 170px;
  padding: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  color: var(--fg);
  z-index: 1800;
}
/* #stats-bar scrolls (overflow-y: auto), which would clip the upward
   menu and let clicks fall through to the map: unclip it while open.
   (A portalled popover isn't an option — route_polyline.js and
   chart_tooltip.js read the active mode off the always-mounted items.) */
.stats-bar:has(.view-mode-picker .dropdown-menu.show) { overflow: visible; }
.view-mode-picker .dropdown-item {
  padding: 4px 10px;
  font-size: 14px;
  font-weight: 400;
  line-height: 21px;
  border-radius: var(--radius);
  background: none;
  color: var(--fg);
}
.view-mode-picker .dropdown-item:hover,
.view-mode-picker .dropdown-item:focus-visible {
  background: var(--hover-bg);
  color: var(--fg);
}
.view-mode-picker .dropdown-item.view-mode-btn.active,
.view-mode-picker .dropdown-item.view-mode-btn:active {
  background: var(--accent-soft);
  color: var(--accent-hover);
}
.view-mode-picker .dropdown-item.disabled { color: var(--fg-muted); opacity: 0.6; }
.view-mode-picker .dropdown-divider { margin: 4px 0; border-color: var(--border); }

/* ── Composition stats (per active view mode) ────────────────── */
.comp-stats {
  display: inline-flex;
  gap: 10px;
  font-size: 11px;
  color: var(--fg-muted);
  margin-left: 8px;
}
.comp-stat { display: inline-flex; align-items: center; gap: 4px; }
.comp-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  border: 1px solid rgba(0, 0, 0, 0.6);
}
.route-elev-graph { display: block; }
/* The chart's own SVG sets its height (taller with no section open). */

/* #271 — hide the AM/PM field on time inputs marked with .time-24h.
   Chromium respects browser locale for the format; hiding the
   ampm-field forces the hh field into 24h effectively (the picker
   still stores in a locale-neutral hh:mm form). */
input[type="time"].time-24h::-webkit-datetime-edit-ampm-field {
  display: none;
}

/* #270 — ETA chip is a button.  Match .stat-chip styling exactly
   but expose the hand cursor + pointer events so users know it's
   clickable. */
.stat-chip.stat-chip-btn {
  cursor: pointer;
  border: none;
  transition: background 80ms ease-out;
}
.stat-chip.stat-chip-btn:hover {
  background: var(--hover-bg);
}

/* ── Label strip above the elevation graph ────────────────────────────── */
.label-strip {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 0;
  margin-top: 4px;
  margin-bottom: 2px;
  /* Match the plotly chart's left/right margin so each label cell sits
     directly above the curve segment for that section. */
  padding-left: 38px;
  padding-right: 8px;
  height: 16px;
  user-select: none;
  /* Never widen the stats bar (it scrolls): clip — unlike hidden this
     makes no scroll container, and merge buttons sit between cells. */
  overflow-x: clip;
}
.label-strip-cell {
  position: relative;             /* anchor for the absolute merge button */
  border-left: 1px dotted var(--border-strong);
  /* Tiny sections still get a clickable target. */
  min-width: 4px;
  cursor: pointer;
  padding: 0 4px;
  background: var(--bg);
  transition: background 80ms ease-out;
  /* overflow:hidden would clip the merge button — clip name with the
     inner span's text-truncate instead. */
}
.label-strip-cell:first-child { border-left: none; }
.label-strip-cell:hover { background: var(--hover-bg); }
.label-strip-cell.selected {
  background: var(--accent-soft);
  border-left: 1px solid var(--accent);
}
.label-strip-name {
  font-size: 10px;
  font-weight: 600;
  color: var(--fg-muted);
  pointer-events: none;
}
/* ── Merge-with-next button, sits straddling the right edge of a cell.
   Hidden until the user hovers either cell at the joint, then fades in
   so the affordance only appears when relevant. */
.label-strip-merge-btn {
  position: absolute;
  top: 50%;
  right: -8px;                    /* half-overlap with the next cell */
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--accent);
  background: var(--bg);
  color: var(--accent);
  font-size: 10px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 100ms ease-out, background 100ms ease-out;
  z-index: 30;
  box-shadow: var(--shadow-sm);
}
.label-strip-cell:hover > .label-strip-merge-btn,
.label-strip-cell + .label-strip-cell:hover > .label-strip-merge-btn,
.label-strip-merge-btn:hover {
  opacity: 1;
}
.label-strip-merge-btn:hover {
  background: var(--accent);
  color: var(--fg-inverse);
}

/* Inspector — shows controls for whichever clip is currently selected. */
.inspector {
  margin-top: 4px;
  padding: 6px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-height: 32px;
  box-shadow: var(--shadow-sm);
}
.inspector-empty {
  margin-top: 4px;
  padding: 6px 12px;
  background: var(--panel-bg);
  border-radius: var(--radius);
  text-align: center;
  color: var(--fg-muted);
}
.inspector-stats {
  flex-shrink: 0;
  font-size: 12px;
  color: var(--fg);
}
.inspector-stat {
  font-size: 11px;
  color: var(--fg-muted);
}
.inspector-section-name {
  cursor: text;
  border-bottom: 1px dashed transparent;
  padding-bottom: 1px;
  transition: border-bottom-color 0.15s;
}
.inspector-section-name:hover {
  border-bottom-color: var(--border-strong);
}
/* ── Route-name editor in the top bar (Route metadata #44). */
.route-name-input {
  width: 240px;
  background: var(--bg) !important;
  border: 1px solid var(--border) !important;
  color: var(--fg) !important;
}
.route-name-input::placeholder {
  color: var(--fg-subtle);
}
.route-name-input:focus {
  background: var(--bg) !important;
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 2px var(--accent-soft) !important;
  color: var(--fg) !important;
}

.inspector-section-name-input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--fg);
  padding: 2px 6px;
  font-size: inherit;
  font-weight: 600;
  font-family: inherit;
  outline: none;
  margin-left: 8px;
  min-width: 160px;
}
.inspector-section-name-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.inspector-label {
  font-size: 10px;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.inspector-btn { padding: 2px 6px !important; font-size: 12px !important; }
/* #133 — destructive section-card buttons (queue-remove / gap-remove)
   share the topbar-danger token: light-red fill + border, filled
   danger on hover.  Matches Clear all visually so the "removes
   things" affordance is consistent. */
.inspector-btn.text-danger {
  background: var(--danger-soft) !important;
  border: 1px solid var(--danger) !important;
  color: var(--danger) !important;
  border-radius: var(--radius-sm);
  padding: 3px 8px !important;
}
.inspector-btn.text-danger:hover {
  background: var(--danger) !important;
  color: var(--fg-inverse) !important;
}

/* #133 — inline rerouting spinner.  Sits inline at the right edge
   of the section-card row so it drops in/out without pushing the
   elevation chart around.  Hidden by default; the clientside
   callbacks in app.py add `.rerouting` on click of any per-segment
   preference button and clear it when store-queue updates. */
.stats-inspector-loading-parent {
  position: relative;
}
.inspector-reroute-spinner {
  display: none;                 /* hidden until .rerouting fires */
  position: absolute;
  right: 14px;
  top: 8px;
  width: 24px;
  height: 24px;
  font-size: 18px;
  line-height: 24px;
  text-align: center;
  color: var(--accent);
  animation: ps-spin 900ms linear infinite;
  pointer-events: none;
  z-index: 5;
}
.stats-inspector-loading-parent.rerouting .inspector-reroute-spinner {
  display: inline-block;
}
@keyframes ps-spin {
  to { transform: rotate(360deg); }
}
.inspector-icon-btn {
  padding: 3px 8px !important;
  font-size: 12px !important;
  color: var(--fg-muted) !important;
  border-radius: var(--radius-sm);
  transition: background 120ms, color 120ms;
}
.inspector-icon-btn:hover {
  background: var(--hover-bg) !important;
  color: var(--fg) !important;
}
.inspector-icon-btn.active {
  color: var(--accent) !important;
  background: var(--accent-soft) !important;
  border-radius: var(--radius-sm);
}

/* ── Drag-to-reroute anchors (HTML overlay on map) ───────────── */
.drag-anchor {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #000;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 1500;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.4), 0 0 6px rgba(0,0,0,0.5);
}

/* ── Route editing previews (SVG overlay on map) ─────────────── */
/* route_drag.js / snap_cursor.js previews; the route and its marks are
   map layers (route_polyline.js).  pointer-events: none so MapLibre
   still receives pan / zoom / click. */
.route-polyline-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1300;
  overflow: hidden;
}
.route-polyline-layer svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}
.route-hover-tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--fg);
  color: var(--fg-inverse);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  border: 1px solid var(--fg);
  box-shadow: var(--shadow-md);
  z-index: 1600;
  white-space: nowrap;
  transform: translate(8px, 8px);
}

/* On-map action pills (route_drag.js: Add this slice, Cancel start) —
   over the route SVG (1300), under the search pin layer (1500). */
.map-pill-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1450;
  overflow: hidden;
}

/* ── Cursor snap indicator (when in Draw / Reroute mode) ─────────── */
.snap-indicator {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(0, 216, 106, 0.30);
  border: 2px solid #00D86A;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.6), 0 0 8px rgba(0, 216, 106, 0.6);
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 1500;     /* above chevrons */
  display: none;
  will-change: transform, left, top;
}

/* ── Elevation-bar scrubber dot (HTML overlay on map) ─────────── */
.scrubber-dot {
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #FFF200;
  border: 2px solid #1a1a2e;
  box-shadow: 0 0 8px rgba(255, 242, 0, 0.7);
  pointer-events: none;
  z-index: 1500;
  transform: translate(-50%, -50%);
  transition: opacity 0.1s;
}


/* POI hover label (#101) — small absolutely-positioned card pinned
   above the hovered POI dot.  poi_hover.js sets its left/top via
   MapLibre.project() on every map move + hover. */
.poi-hover-label {
  position: absolute;
  transform: translate(-50%, calc(-100% - 14px));
  background: var(--fg);
  color: var(--fg-inverse);
  padding: 6px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--fg);
  box-shadow: var(--shadow-md);
  font-size: 12px;
  line-height: 1.4;
  pointer-events: none;
  white-space: nowrap;
  max-width: 280px;
  z-index: 1700;
}
.poi-hover-name  { font-weight: 600; }
.poi-hover-cat   { opacity: 0.78; }
.poi-hover-hours { opacity: 0.65; font-size: 11px; margin-top: 2px; }
/* Open/closed status from opening_hours (hover label + pin popover). */
.poi-hours-status { font-size: 11px; font-weight: 600; margin-top: 2px; }
.poi-hours-status.open   { color: #16a34a; }
.poi-hours-status.closed { color: #dc2626; }
.topbar-search-pin-popover .pin-sub:has(+ .pin-hours) { margin-bottom: 4px; }
.topbar-search-pin-popover .pin-hours { margin-bottom: 8px; }
.topbar-search-pin-popover .pin-hours-raw { font-size: 11px; color: var(--fg-muted); }
.topbar-search-pin-popover .pin-sub:has(+ .pin-facts, + .pin-links) { margin-bottom: 6px; }
.topbar-search-pin-popover .pin-facts {
  display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px;
}
.topbar-search-pin-popover .pin-fact {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px;
  border-radius: 999px; background: var(--hover-bg, #f1f3f5); font-size: 11px;
}
.topbar-search-pin-popover .pin-links {
  display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px;
}
.topbar-search-pin-popover .pin-link {
  display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500;
  color: var(--accent, #16a34a); text-decoration: none;
}
.topbar-search-pin-popover .pin-link:hover { text-decoration: underline; }
.topbar-search-pin-popover .pin-link span {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}


/* ── Dash range slider overrides ─────────────────────────────── */
.rc-slider-track { background-color: var(--accent) !important; }
.rc-slider-handle { border-color: var(--accent) !important; background: var(--accent) !important; }

/* Modals must clear the route-overlay z-index stack (waypoints at
   1500, polylines + chevrons up to 1600).  Bootstrap defaults
   (1050 / 1055) would let our SVG and HTML overlays bleed through. */
.modal-backdrop { z-index: 2000 !important; }
.modal          { z-index: 2001 !important; }
.toast-container, .toast { z-index: 2100 !important; }
/* Bootstrap's default popover z-index (1070) sits below our
   map-ctrl-strip (1600) AND the floating stats-bar (1750), so
   topbar popovers get covered by both.  Lift above everything
   with 1800.  #140: this became critical when the Generate button
   ended up at the bottom of the Settings popover — with a route
   loaded the stats-bar's top overlapped it. */
.popover { z-index: 1800 !important; }
/* Tooltips above the popovers they can open in (Settings options),
   still below toasts. */
.tooltip { z-index: 1850 !important; }

/* ── #154 — Map scale bar (bottom-left) ───────────────────────────
   Custom drop-in for MapLibre's ScaleControl (see
   assets/map_scale.js).  The container IS the bar — its ``width``
   is the "nice" metres in pixels, and its label sits centered
   inside it.  Semi-transparent chip so the map underneath stays
   partly visible.

   ``!important`` on padding / border / background beats MapLibre's
   own ``.maplibregl-ctrl`` reset (same 1-class specificity, loaded
   later in the cascade). */

/* ── #155 — Section overview floating overlay ─────────────────────
   Anchored above the elevation-chart notification marker the user
   tapped.  Positioning is set inline by section_detail.js — CSS
   only owns the shell + typography. */
.section-detail-overlay {
  cursor: zoom-in;                 /* click → zoom the map to the section */
  position: absolute;
  z-index: 1780;                   /* above stats-bar (1750) */
  /* 760 px on desktop for more chart breathing room; clamped by
     viewport minus 24 px so tight phones still fit. */
  width: min(760px, calc(100vw - 24px));
  padding: 10px 12px 8px;
  background: var(--floating-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(10px) saturate(1.1);
  color: var(--fg);
  font-size: 12px;
}
/* Tail pointing at the notification marker.  ``--tail-x`` is set
   by the positioning callback so the tail tracks the marker even
   when the overlay is clamped to the viewport edge (in which case
   the overlay body shifts sideways but the tail should keep
   pointing straight down at the marker). */
.section-detail-overlay::after {
  content: "";
  position: absolute;
  left: var(--tail-x, 50%);
  bottom: -8px;
  margin-left: -8px;
  width: 0; height: 0;
  border-left:  8px solid transparent;
  border-right: 8px solid transparent;
  border-top:   8px solid var(--floating-bg);
  filter: drop-shadow(0 1px 0 var(--border));
  transition: left 120ms ease-out;
}
.section-detail-overlay.anchored-below::after {
  bottom: auto;
  top: -8px;
  border-top: none;
  border-bottom: 8px solid var(--floating-bg);
}
/* Opened from a route-notes row: the card sits beside the list and the
   tail points left at the hovered row. */
.section-detail-overlay.anchored-side::after {
  left: -8px;
  top: var(--tail-y, 50%);
  bottom: auto;
  margin-left: 0;
  margin-top: -8px;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: none;
  border-right: 8px solid var(--floating-bg);
  transition: none;
}
.section-detail-close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: var(--fg-muted);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
  padding: 0;
}
.section-detail-close:hover {
  background: var(--hover-bg);
  color: var(--fg);
}
.section-detail-title {
  font-weight: 600;
  font-size: 13px;
  margin-right: 26px;
  margin-bottom: 6px;
}
.section-detail-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 6px;
  align-items: center;
  margin-bottom: 6px;
}
.section-detail-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  padding: 2px 8px;
}
.section-detail-chip-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  border: 1px solid rgba(0, 0, 0, 0.5);
  margin-right: 4px;
}
.section-detail-graph .js-plotly-plot,
.section-detail-graph .plotly,
.section-detail-graph .plot-container {
  height: 280px !important;
}

.ps-scale-bar {
  display: flex !important;
  align-items: center;
  justify-content: center;
  min-width: 60px;
  height: 20px;
  padding: 0 8px !important;
  margin: 0 0 8px 8px !important;
  /* Partially transparent (~78% white) — the map still bleeds
     through, but enough contrast that the label stays legible
     against dense city basemaps as well as pale rural / water
     tiles.  A blur helps low-contrast backgrounds further. */
  background: rgba(255, 255, 255, 0.78) !important;
  border-left:   2px solid var(--fg) !important;
  border-right:  2px solid var(--fg) !important;
  border-bottom: 2px solid var(--fg) !important;
  border-top:    none !important;
  border-radius: 0;
  /* Subtle shadow lifts the chip off dark map tiles (e.g. satellite
     imagery, night mode) so the border edges never disappear. */
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15) !important;
  backdrop-filter: blur(6px) saturate(1.15);
  -webkit-backdrop-filter: blur(6px) saturate(1.15);
  font-size: 12px;
  font-weight: 600;
  color: var(--fg);
  line-height: 1;
  letter-spacing: 0.2px;
  white-space: nowrap;
  user-select: none;
  pointer-events: none;
  box-sizing: border-box;
}

/* ── Popover shell (#133 Phase B) ────────────────────────────────
   Bootstrap's default popover is dark inherited from BS 5's tooltip
   scheme.  Reskin to Direction B light: white body, subtle border +
   shadow, matches the topbar chip aesthetic. */
.popover {
  background: var(--bg) !important;
  border: 1px solid var(--border) !important;
  box-shadow: var(--shadow-md);
  border-radius: var(--radius-lg);
  color: var(--fg);
}
.popover-body {
  color: var(--fg);
  padding: 12px 14px;
}
.popover-header {
  background: var(--panel-bg);
  border-bottom: 1px solid var(--border);
  color: var(--fg);
  font-weight: 600;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
/* Bootstrap paints the popover arrow with its own colour scheme —
   retint the outer + inner triangles so they match the light body
   instead of leaking a dark edge into a light popover. */
.popover .popover-arrow::before { border-color: var(--border) !important; }
.popover .popover-arrow::after  { border-color: transparent !important; }
.bs-popover-bottom > .popover-arrow::after,
.bs-popover-auto[data-popper-placement^="bottom"] > .popover-arrow::after {
  border-bottom-color: var(--bg) !important;
}
.bs-popover-top > .popover-arrow::after,
.bs-popover-auto[data-popper-placement^="top"] > .popover-arrow::after {
  border-top-color: var(--bg) !important;
}
.bs-popover-start > .popover-arrow::after,
.bs-popover-auto[data-popper-placement^="left"] > .popover-arrow::after {
  border-left-color: var(--bg) !important;
}
.bs-popover-end > .popover-arrow::after,
.bs-popover-auto[data-popper-placement^="right"] > .popover-arrow::after {
  border-right-color: var(--bg) !important;
}

/* ── Menu rows (#85 / #133) ──────────────────────────────────────
   Full-width menu items used inside both Export and Import
   dropdowns.  Works on dbc.Button, html.Button, AND the html.Div
   wrapped by dcc.Upload — the tag varies but the visual is the
   same left-aligned icon + label row that fills the popover width
   and hovers to a hover-bg tint. */
.export-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  padding: 0.45rem 0.6rem;
  margin: 0;
  color: var(--fg) !important;
  text-decoration: none !important;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  cursor: pointer;
  text-align: left;
  transition: background 100ms ease-out;
}
.export-row:hover {
  background: var(--hover-bg);
}
.export-row[disabled],
.export-row:disabled {
  color: var(--fg-subtle) !important;
  cursor: not-allowed;
}
.export-row[disabled]:hover,
.export-row:disabled:hover {
  background: transparent;
}

/* ── Integrations toolbar (#85) ──────────────────────────────────
   Single horizontal row of icon-only sources at the top of the
   left panel: file upload, URL paste, Hammerhead, Ride with GPS.
   Each .toolbar-icon-btn is a square button — focused state gets
   a brighter border so keyboard nav reads. */
.integrations-toolbar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.toolbar-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius);
  background: var(--panel-bg);
  border: 1px solid var(--border);
  color: var(--fg);
  font-size: 18px;
  padding: 0;
  cursor: pointer;
  transition: background 120ms, border-color 120ms, color 120ms;
}
.toolbar-icon-btn:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}
.toolbar-icon-btn:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

/* ── Browse Hammerhead tile grid (#84) ───────────────────────────
   Auto-fitting grid: tiles are ~220 px wide minimum, columns add as
   the modal grows.  Each tile shows the route thumbnail, name,
   distance, and an Add button. */
.hh-tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
  padding: 0.25rem 0;
}
.hh-tile {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.5rem;
  box-shadow: var(--shadow-sm);
  transition: border-color 120ms, box-shadow 120ms;
}
.hh-tile:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}
.hh-tile-img {
  display: block;
  width: 100%;
  height: 130px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--panel-bg);
}
.hh-tile-meta {
  flex: 1;
  margin: 0.5rem 0;
  overflow: hidden;
}
.hh-tile-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hh-tile-add {
  align-self: flex-end;
}

/* ── #89 — Hold Shift to fade the route overlay ────────────────
   When shift_hide.js detects Shift-down on document, it toggles
   `ps-route-hidden` on <body>.  We fade the SVG polyline layer,
   waypoints, endpoint handles, and pending-import dots
   so the user can peek at what's under the route.  Pointer-events
   off so the underlying MapLibre canvas takes clicks during the
   peek. */
body.ps-route-hidden #route-polyline-layer svg,
body.ps-route-hidden .route-endpoint-drag,
body.ps-route-hidden .route-waypoint,
body.ps-route-hidden .pending-endpoint,
body.ps-route-hidden .pending-add-btn {
  opacity: 0 !important;
  pointer-events: none !important;
  transition: opacity 0.1s linear;
}
#route-polyline-layer svg,
.route-endpoint-drag,
.route-waypoint,
.pending-endpoint,
.pending-add-btn {
  transition: opacity 0.1s linear;
}

/* Route attention summary chip (restricted areas / private yards) —
   docs/route-attention.md.  Amber by default, red when anything is
   restricted. */
.stat-chip.attn-chip {
    background: rgba(245, 165, 36, 0.16);
    border: 1px solid rgba(245, 165, 36, 0.6);
    color: #F5A524;
    cursor: help;
}
.stat-chip.attn-chip.attn-chip-restricted {
    background: rgba(229, 72, 77, 0.16);
    border-color: rgba(229, 72, 77, 0.7);
    color: #FF6B6F;
}


/* Route-notes list — rises from the notes chip at the left of the stats
   bar (stats_panel._build_notes_chip); same floating-card look as the
   chart's section-detail hover card. */
.stat-chip.attn-chip { cursor: pointer; }
.stat-chip.attn-chip.notes-chip-plain {
  background: var(--panel-bg);
  border-color: var(--border);
  color: var(--fg);
}
.stat-chip.attn-chip .bi-chevron-up { transition: transform 0.15s; font-size: 10px; }
.stat-chip.attn-chip:not(.open) .bi-chevron-up { transform: rotate(180deg); }
.notes-list {
  position: fixed;                 /* #notes-list-float, placed by section_detail_cache.js */
  z-index: 1790;                   /* above stats-bar + section card */
  width: min(440px, calc(100vw - 16px));
  max-height: min(60vh, 460px);
  display: flex;
  flex-direction: column;
  padding: 8px 6px 6px;
  background: var(--floating-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(10px) saturate(1.1);
  color: var(--fg);
  font-size: 12px;
}
.notes-list::after {               /* tail pointing down at the chip */
  content: "";
  position: absolute;
  bottom: -7px;
  left: var(--tail-x, 24px);
  width: 12px;
  height: 12px;
  background: var(--floating-bg);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  transform: translateX(-50%) rotate(45deg);
}
.notes-list-title {
  font-weight: 600;
  padding: 0 8px 6px;
}
.notes-list-rows { overflow-y: auto; }
.notes-row {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  gap: 6px;
  align-items: baseline;
  padding: 5px 8px;
  border-radius: 6px;
  cursor: zoom-in;
}
.notes-row:hover { background: var(--hover-bg, rgba(0, 0, 0, 0.06)); }
.notes-row-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notes-row-meta { color: var(--muted, #6b7280); white-space: nowrap; }


/* Per-section settings: summary chip + list card (stats_panel) */
.stat-chip.seg-settings-chip { cursor: pointer; gap: 2px; }
.seg-settings-chip .seg-chevron { font-size: 10px; }
.seg-settings-popover { max-width: none; font-size: 12px; }
.seg-settings-popover .popover-body { padding: 8px 10px; }
.seg-card-title { font-weight: 600; margin-bottom: 6px; }
/* Imported piece's card (stats_panel._imported_piece_settings). */
.seg-card-note { max-width: 300px; margin: -2px 0 6px; color: var(--muted, #6b7280); }
.seg-restore-btn {
  margin-top: 6px;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel-bg, #fff);
  color: var(--fg);
  font-size: 12px;
  cursor: pointer;
}
.seg-restore-btn:hover { border-color: #00a870; color: #00a870; }
.seg-row {
  display: grid;
  grid-template-columns: 84px auto;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
}
.seg-row-label { color: var(--muted, #6b7280); white-space: nowrap; }
.seg-opts { display: flex; flex-wrap: wrap; gap: 4px; }
.seg-opt.btn {
  padding: 2px 8px;
  font-size: 12px;
  color: var(--fg);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  white-space: nowrap;
}
.seg-opt.btn:hover { background: var(--hover-bg); }
.seg-opt.btn.active {
  background: #00a870;
  border-color: #00a870;
  color: #fff;
}

/* Label strip: "⚙ Routing" pill on routed sections opens their settings card */
.label-strip-settings-btn {
  flex: none;
  margin-left: 6px;
  padding: 0 7px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel-bg, #fff);
  color: var(--fg);
  font-size: 11px;
  line-height: 16px;
  white-space: nowrap;
  cursor: pointer;
}
.label-strip-settings-btn:hover,
.label-strip-cell.selected .label-strip-settings-btn {
  border-color: #00a870;
  color: #00a870;
}
/* Narrow cells: keep just the icon; narrower still, a compact icon pill;
   cells too small even for that drop it (select the section instead).
   The pill may shrink but never outgrow its cell — a tiny LAST section's
   pill used to poke past the strip and give #stats-bar a horizontal
   scrollbar. */
.label-strip-cell { container-type: inline-size; }
.label-strip-settings-btn { flex: 0 1 auto; min-width: 0; overflow: hidden; }
@container (max-width: 140px) { .label-strip-settings-text { display: none; } }
@container (max-width: 60px) {
  .label-strip-settings-btn { margin-left: 0; padding: 0 3px; flex-shrink: 0; }
  /* Routed cell this narrow: the truncated name is unreadable — give the
     room to the pill (cells without a pill keep their name). */
  .label-strip-name:has(+ .label-strip-settings-btn) { display: none; }
}
@container (max-width: 18px) { .label-strip-settings-btn { display: none; } }

/* Section weather (stats_panel._weather_button): a pill like "Routing" with
   icon + temperature; hover / click → popover with the forecast. */
.label-strip-weather-btn {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  margin-left: 4px;
  padding: 0 7px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel-bg, #fff);
  color: var(--fg);
  font-size: 11px;
  line-height: 16px;
  white-space: nowrap;
  cursor: pointer;
}
.label-strip-weather-btn:hover, .label-strip-weather-btn:focus { border-color: #2f80ed; color: #2f80ed; }
.label-strip-weather-text { font-variant-numeric: tabular-nums; }
@container (max-width: 190px) { .label-strip-weather-text { display: none; } }
@container (max-width: 90px) { .label-strip-weather-btn { margin-left: 2px; padding: 0 3px; flex-shrink: 0; } }
@container (max-width: 40px) { .label-strip-weather-btn { display: none; } }
/* Narrow routed cell with weather (stats_panel._more_button, docs/TODO
   2026-10-19): the weather pill stopped shrinking below 90 px and squeezed
   the Routing pill to nothing.  Below 110 px both give way to one pill
   (both icons) whose menu offers Routing settings + the forecast. */
.label-strip-more-btn {
  display: none;
  flex: 0 0 auto;
  align-items: center;
  gap: 3px;
  margin-left: 2px;
  padding: 0 5px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel-bg, #fff);
  color: var(--fg);
  font-size: 11px;
  line-height: 16px;
  white-space: nowrap;
  cursor: pointer;
}
.label-strip-more-btn:hover, .label-strip-more-btn:focus { border-color: #00a870; color: #00a870; }
.label-strip-more-caret { font-size: 8px; }
@container (max-width: 110px) {
  .label-strip-settings-btn:has(~ .label-strip-more-btn),
  .label-strip-weather-btn:has(~ .label-strip-more-btn) { display: none; }
  .label-strip-more-btn { display: inline-flex; }
}
@container (max-width: 44px) { .label-strip-more-caret { display: none; } .label-strip-more-btn { padding: 0 3px; } }
@container (max-width: 24px) { .label-strip-more-btn { display: none; } }
.strip-more-popover .strip-more-item {
  display: block;
  width: 100%;
  margin-bottom: 6px;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel-bg, #fff);
  color: var(--fg);
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
}
.strip-more-popover .strip-more-item:hover { border-color: #00a870; color: #00a870; }
.wx-popover { max-width: 300px; font-size: 12.5px; }
.wx-popover .popover-body { padding: 8px 10px; }
/* Section weather card (stats_panel._weather_card). */
.wx-card-head { font-weight: 600; margin-bottom: 1px; }
.wx-card-km { font-weight: 400; color: var(--fg-muted, #6b7785); }
.wx-card-when { color: var(--fg-muted, #6b7785); margin-bottom: 4px; }
.wx-card-line { line-height: 1.5; }
.wx-card-line.wx-wind { font-weight: 600; }
.wx-card-foot { margin: 6px 0 2px; padding-top: 5px; border-top: 1px solid var(--border); }
.strip-more-popover .strip-more-item { margin: 6px 0 0; }
.wx-pop-note { margin-top: 4px; color: var(--fg-muted, #6b7785); font-size: 11.5px; }

/* Section weather spans (stats_panel._weather_cell, in the section weather popover). */
.wx-temp { color: #c8642a; }
.wx-rain { color: #2f80ed; }
.wx-dry  { color: var(--fg-muted); font-weight: 400; }
.wx-wind.wx-head  { color: #AD1457; }
.wx-wind.wx-cross { color: #6A5BA6; }
.wx-wind.wx-tail  { color: #00796B; }
.wx-cert { color: var(--fg-muted); letter-spacing: -1px; }
/* ── Weather map (assets/weather_map.js): canvas under the route ───── */
.weather-map-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1290;            /* holds no drawing now (the map layers do) — its .on shows .wxm-ui */
  overflow: hidden;
  display: none;
}
.weather-map-layer.on { display: block; }
.weather-map-layer canvas { position: absolute; top: 0; left: 0; }
/* Hour control + legend: over the route + chevrons (1300–1500), under the
   map-ctrl strip + topbar (1600 / 1750). */
.wxm-ui { display: none; }
.weather-map-layer.on + .wxm-ui { display: block; }
.wxm-ui > .wxm-ctl, .wxm-ui > .wxm-legend { z-index: 1550; }
.wxm-ctl, .wxm-legend {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.94);
  border-radius: 16px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  font-size: 12.5px;
  color: #25303b;
  white-space: nowrap;
  pointer-events: auto;
}
.wxm-ctl { top: 66px; padding: 3px 8px; border-radius: 14px; }   /* below the floating topbar */
.wxm-ctl button {
  border: 0;
  background: #eef2f6;
  border-radius: 12px;
  min-width: 26px;
  height: 24px;
  font-size: 14px;
  line-height: 1;
  color: #25303b;
  cursor: pointer;
}
.wxm-ctl button.wxm-now { font-size: 11.5px; padding: 0 8px; }
.wxm-ctl button:disabled { opacity: 0.45; cursor: default; }
.wxm-ctl button:not(:disabled):hover { background: #dde4ec; }
.wxm-hour { font-weight: 600; min-width: 74px; text-align: center; }
/* The day picker (2026-10-20). */
.wxm-ctl select.wxm-day {
  border: 0; background: #eef2f6; border-radius: 12px; height: 24px; font-size: 12px;
  color: #25303b; padding: 0 6px; max-width: 150px; cursor: pointer;
  field-sizing: content;          /* as wide as the day shown, not the longest one */
}
.wxm-status { color: #6b7785; font-size: 11.5px; }
.wxm-status:empty { display: none; }
/* The title on its own line above the controls (user 2026-10-27), the box
   as wide as the wider of the two (a wrapping row was sized as if the
   title sat beside the controls). */
.wxm-ctl { flex-direction: column; gap: 2px; }
.wxm-ctl > .wxm-row { display: flex; align-items: center; gap: 6px; }
/* On a phone's browser (user 2026-10-29: too wide): on screen, the day
   picker and the status shrink first (the phone app's rules). */
.wxm-ctl, .wxm-legend { max-width: calc(100vw - 16px); box-sizing: border-box; }
.wxm-ctl > .wxm-row { max-width: 100%; min-width: 0; }
.wxm-ctl > .wxm-row > * { flex: none; }
.wxm-ctl > .wxm-row .wxm-day { flex: 0 1 auto; min-width: 3.5em; text-overflow: ellipsis; overflow: hidden; }
.wxm-ctl > .wxm-row .wxm-status { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.wxm-legend { flex-wrap: wrap; justify-content: center; white-space: normal; }
.wxm-title { text-align: center; font-weight: 600; font-size: 11.5px; color: #4a5562; cursor: default; line-height: 1.2; }
.wxm-ctl button.wxm-info { background: transparent; min-width: 24px; font-size: 15px; color: #4a5562; }
.wxm-ctl button.wxm-info[aria-expanded="true"] { color: var(--accent, #00a870); }
/* ⓘ: what the map shows, with its symbols (under the bar, top centre). */
.wxm-explain {
  position: absolute; top: 116px; left: 50%; transform: translateX(-50%); z-index: 1550;
  width: min(360px, calc(100% - 24px)); background: rgba(255, 255, 255, 0.97); border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25); padding: 10px 14px; font-size: 12.5px; color: #25303b;
  pointer-events: auto; white-space: normal; line-height: 1.4;
}
.wxm-explain[hidden] { display: none; }
.wxm-explain p { margin: 0 0 6px; }
.wxm-ex-list { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 4px; }
.wxm-ex-list li { display: flex; align-items: center; gap: 8px; }
.wxm-ex-list img { flex: none; border-radius: 4px; }
.wxm-ex-foot { color: #6b7785; font-size: 11.5px; margin: 0 !important; }
/* Pointing at a wind arrow: the wind there, in words. */
.wxm-tip {
  position: fixed; z-index: 1900; display: none; pointer-events: none; background: rgba(37, 48, 59, 0.92);
  color: #fff; font-size: 12px; padding: 4px 8px; border-radius: 6px; white-space: nowrap;
}
.wxm-legend { top: 101px; padding: 2px 10px; font-size: 11px; gap: 10px; }
.wxm-sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; opacity: 0.6; margin-right: 3px; vertical-align: -1px; }
.wxm-attr { color: #6b7785; }
@media (max-width: 700px) { .wxm-wl, .wxm-attr { display: none; } }

.wx-exp { color: #6b7785; font-weight: 500; }
.wx-exp-sheltered { color: #2f6f4f; }
.wx-exp-exposed { color: #b2452f; }

/* Wind marker hover (route_polyline.js _wxHoverHtml): the route tooltip,
   multi-line, offset clear of the marker. */
.route-hover-tooltip.route-hover-weather {
  line-height: 1.45;
  padding: 6px 10px;
  transform: translate(14px, 14px);
}
.route-hover-tooltip.route-hover-weather b { font-weight: 600; }

/* Wind view without a forecast yet: shelter colours + this note. */
.comp-stat.comp-note { font-style: italic; color: var(--fg-muted, #6b7785); }

/* Generate route panel (GeneratePanel.svelte, user 2026-10-28): a floating
   card like the notes list / weather control; the active field takes the
   next map click (start green, end red markers, draggable). */
.gen-panel {
  position: fixed; top: 66px; left: 12px; z-index: 1700;
  width: min(310px, calc(100vw - 24px));
  display: flex; flex-direction: column; gap: 8px;
  padding: 10px 12px 12px;
  background: var(--floating-bg); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-md);
  font-size: 13px; color: var(--fg);
}
/* Beside the rail's Generate button (GeneratePanel.svelte sets left / top):
   an arrow pointing at it, as the rail's popovers. */
.gen-arrow {
  position: absolute; right: -7px; width: 12px; height: 12px; margin-top: -6px;
  background: var(--floating-bg); border-right: 1px solid var(--border); border-top: 1px solid var(--border);
  transform: rotate(45deg);
}
.gen-head { display: flex; align-items: center; justify-content: space-between; }
.gen-title { font-weight: 600; font-size: 14px; }
.gen-close { border: 0; background: transparent; color: var(--fg-muted); padding: 2px 4px; border-radius: 6px; }
.gen-close:hover { background: var(--panel-bg); color: var(--fg); }
.gen-seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--panel-bg); border-radius: 8px; padding: 2px; gap: 2px; }
.gen-seg button { border: 0; background: transparent; border-radius: 6px; padding: 5px 6px; font-size: 12.5px; color: var(--fg-muted); }
.gen-seg button.active { background: var(--floating-bg); color: var(--fg); font-weight: 600; box-shadow: var(--shadow-sm); }
.gen-field {
  display: grid; grid-template-columns: auto auto 1fr auto; align-items: center; gap: 8px;
  width: 100%; padding: 7px 9px; text-align: left;
  border: 1px solid var(--border); border-radius: 8px; background: var(--floating-bg); color: var(--fg);
}
.gen-field:hover { border-color: var(--accent, #00a870); }
.gen-field.active { border-color: var(--accent, #00a870); box-shadow: 0 0 0 2px rgba(0, 168, 112, 0.18); }
.gen-field-label { font-weight: 600; min-width: 34px; }
.gen-field-value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gen-field-value.empty, .gen-field.active .gen-field-value { color: var(--fg-muted); font-style: italic; }
.gen-field-icon { color: var(--fg-muted); }
.gen-dot, .gen-marker { width: 12px; height: 12px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35); }
.gen-dot-start, .gen-marker-start { background: #16a34a; }
.gen-dot-end, .gen-marker-end { background: #e5484d; }
.gen-marker { width: 18px; height: 18px; border-width: 3px; cursor: grab; }
.gen-row { display: flex; align-items: center; gap: 8px; }
.gen-row-label { font-weight: 600; min-width: 46px; }
.gen-km { width: 80px; }
.gen-unit { color: var(--fg-muted); }
.gen-check { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.gen-check.disabled { opacity: 0.55; cursor: default; }
.gen-note { color: var(--fg-muted); font-size: 12px; margin-top: -4px; }
.gen-go { width: 100%; }
.gen-msg { font-size: 12.5px; }
.gen-error { color: #c0392b; }
.gen-result { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }

/* Section overview: the readout at the mouse (as the main chart's). */
#section-detail-body { position: relative; }
.section-detail-tip {
  position: absolute; top: 34px; transform: translateX(-50%); pointer-events: none; white-space: nowrap;
  padding: 3px 8px; border-radius: 6px; font-size: 11.5px; font-weight: 500;
  background: rgba(26, 26, 46, 0.88); color: #fff;
}

/* My POIs (MyPoiPanel.svelte + the shared form, assets/my_pois_ui.js): the
   Generate panel's card, a little wider for the category chips. */
.mypoi-panel { width: min(360px, calc(100vw - 24px)); max-height: calc(100vh - 90px); overflow-y: auto; }
.mypoi-star { color: #7c3aed; }
/* My POIs on the POI card (topbar_search.js): the note; Edit / Delete side
   by side, or Copy to my POIs, under the routing actions. */
.topbar-search-pin-popover .pin-note { font-size: 12px; margin: 2px 0 8px; white-space: pre-wrap; overflow-wrap: anywhere; }
.topbar-search-pin-popover .pin-actions-mine { flex-direction: row; margin-top: 6px; }
.topbar-search-pin-popover .pin-actions-mine .pin-btn { flex: 1 1 0; }
.topbar-search-pin-popover .pin-btn.pin-btn-danger:hover { color: #c0392b; border-color: #c0392b; }

/* Route POIs (StatsBar.svelte): the chip's list, numbered as on the map. */
.route-pois-chip i:first-child { color: #f59e0b; }
.route-poi-row { grid-template-columns: 22px 1fr auto; cursor: pointer; }
.route-poi-n { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 4px;
  border-radius: 9px; background: #f59e0b; color: #1f1300; font-weight: 700; font-size: 11px; }
.route-poi-row .notes-row-text { white-space: normal; }
.route-poi-row .poi-hours-status { display: block; font-size: 11px; }
.route-poi-remove { border: 0; background: transparent; color: var(--fg-muted); padding: 0 2px 0 6px; }
.route-poi-remove:hover { color: #c0392b; }
.route-pois-foot { display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--border); margin-top: 4px; }
.route-pois-export { display: flex; align-items: center; gap: 6px; padding: 6px 8px 2px; }

/* Open routes (RoutesBar.svelte, docs/multi-route-design.md): a tab per
   route over the stats; the active one is the route's blue. */
.routes-bar { display: flex; align-items: center; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 4px;
  border-bottom: 1px solid var(--border); scrollbar-width: thin; }
.route-tab { display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; max-width: 280px; padding: 3px 4px 3px 10px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--floating-bg); color: var(--fg-muted);
  font-size: 12px; cursor: pointer; }
.route-tab:hover { color: var(--fg); }
.route-tab.active { color: var(--fg); border-color: #2b6cff; box-shadow: 0 0 0 1px #2b6cff inset; cursor: default; }
.route-tab-hidden { opacity: 0.55; }
.route-tab-dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.route-tab-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.route-tab-meta { white-space: nowrap; }
.route-tab-rename { width: 140px; font: inherit; padding: 0 4px; border: 1px solid var(--border); border-radius: 4px; }
.route-tab-btn { border: 0; background: transparent; color: var(--fg-muted); padding: 2px 5px; border-radius: 999px; line-height: 1; }
.route-tab-btn:hover { background: var(--panel-bg); color: var(--fg); }
.route-add { flex: 0 0 auto; border: 1px dashed var(--border); padding: 4px 8px; }
.routes-add-menu { display: flex; flex-direction: column; }
.routes-add-menu button { border: 0; background: transparent; text-align: left; padding: 7px 10px; border-radius: 6px; color: var(--fg); font-size: 13px; }
.routes-add-menu button:hover:not(:disabled) { background: var(--panel-bg); }
.routes-add-menu button:disabled { opacity: 0.5; }

/* The Compare button in the routes bar (RoutesBar.svelte). */
.route-compare { flex: 0 0 auto; border: 1px solid var(--border); padding: 4px 10px; font-size: 12px; }
.route-compare-n { margin-left: 6px; padding: 0 6px; border-radius: 999px; background: #fff3d6; color: #8a5a00; font-size: 11px; font-weight: 600; }

/* "As own route" on a pending import's pill (DashMap.svelte): a route of its own. */
.pending-add-half-own { background: rgba(124, 58, 237, 0.92); color: #ffffff; }
.pending-add-half-own:hover { background: rgba(109, 40, 217, 0.98); }

/* Overlays menu: a group heading ("From your library") and a row's one-line status. */
.overlay-group-h { font-size: 11.5px; color: var(--fg-muted); font-weight: 600; margin: 2px 0 2px; }
.overlay-sub { font-size: 11.5px; color: var(--fg-muted); margin: -2px 0 4px 24px; }

/* Compare mode (CompareMode.svelte, CompareChart.svelte, webcore map/compare.ts):
   a floating panel over the map, labels on the ways, the compare chart. */
.cmp-panel { position: fixed; left: 16px; top: 76px; z-index: 1500; width: 340px; max-height: calc(100vh - 330px); overflow-y: auto;
  background: var(--floating-bg); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-md);
  padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; font-size: 12.5px; color: var(--fg); backdrop-filter: blur(6px); }
.cmp-panel { transition: transform .25s ease; }
.cmp-panel.tucked { transform: translateX(calc(-100% - 24px)); pointer-events: none; }
/* Its handle on the right edge (outside it: the panel scrolls), and the tab when it's tucked away. */
.cmp-hide { position: fixed; left: 355px; top: 90px; z-index: 1501; width: 22px; height: 40px; padding: 0; border: 1px solid var(--border);
  border-left: 0; border-radius: 0 10px 10px 0; background: var(--floating-bg); box-shadow: 3px 2px 6px rgba(0,0,0,.10); color: var(--fg); }
.cmp-tab { position: fixed; left: 0; top: 90px; z-index: 1501; display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 10px 8px 10px 6px; border: 1px solid var(--border); border-left: 0; border-radius: 0 12px 12px 0;
  background: var(--floating-bg); box-shadow: var(--shadow-md); color: var(--fg); }
.cmp-tab-label { writing-mode: vertical-rl; transform: rotate(180deg); font-size: 12.5px; font-weight: 600; }
.cmp-tab-n { background: #e8590c; color: #fff; border-radius: 999px; font-size: 11px; padding: 0 6px; }
.cmp-head { display: flex; align-items: center; justify-content: space-between; font-size: 14px; }
.cmp-note, .cmp-help { color: var(--fg-muted); font-size: 12px; }
.cmp-with { display: flex; align-items: center; gap: 8px; color: var(--fg-muted); }
.cmp-with select { width: auto; flex: 1 1 auto; }
.cmp-key { display: flex; flex-direction: column; gap: 3px; }
.cmp-key span { display: flex; align-items: center; gap: 6px; }
.cmp-key i { width: 22px; flex: 0 0 auto; display: inline-block; }
.cmp-k-a { height: 5px; border-radius: 3px; background: #2b6cff; }
.cmp-k-b { height: 0; border-top: 3px dashed #e8590c; }
.cmp-k-same { height: 5px; border-radius: 3px; background: #8b929c; }
.cmp-table { border-collapse: collapse; width: 100%; }
.cmp-table th, .cmp-table td { padding: 4px 6px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; background: transparent; }
.cmp-table tbody th { font-weight: 500; color: var(--fg-muted); }
.cmp-table thead th.cmp-a { color: #2b6cff; }
.cmp-table td.best { font-weight: 700; color: #0f7a4f; }
.cmp-was { display: block; color: var(--fg-muted); font-size: 11px; font-weight: 400; }
.cmp-secs-head { display: flex; align-items: center; gap: 6px; }
.cmp-secs-head b { flex: 1 1 auto; }
.cmp-step { border: 1px solid var(--border); background: var(--bg); border-radius: 8px; width: 30px; height: 28px; font-size: 16px; line-height: 1; color: var(--fg); }
.cmp-step-n { min-width: 44px; text-align: center; color: var(--fg-muted); }
.cmp-sec { display: flex; flex-direction: column; gap: 2px; text-align: left; border: 0; border-radius: 8px; padding: 6px 8px; background: transparent; color: var(--fg); }
.cmp-sec span { color: var(--fg-muted); }
.cmp-sec:hover, .cmp-sec.on { background: #fff4ec; }
.cmp-last { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--border); padding-top: 8px; }
.cmp-last span { flex: 1 1 auto; font-weight: 600; }
.route-compare.active { background: #eef3ff; border-color: #2b6cff; }

.ps-cmp-label { position: absolute; transform: none; pointer-events: auto; display: flex; flex-direction: column;
  gap: 1px; text-align: left; max-width: 200px; padding: 3px 8px; border-radius: 10px; background: #ffffff; color: #1a1a2e;
  border: 2px dashed var(--way); box-shadow: 0 2px 6px rgba(0,0,0,.16); font: 12px/1.3 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; cursor: pointer; }
.ps-cmp-label.riding { border-style: solid; }

.ps-cmp-label.hov, .ps-cmp-label.cur { box-shadow: 0 4px 14px rgba(0,0,0,.26); }
.ps-cmp-label .n { font-weight: 700; color: var(--way); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
.ps-cmp-label .h, .ps-cmp-label .s { font-size: 11px; color: #4b5563; display: none; }
.ps-cmp-label.hov .h, .ps-cmp-label.hov .s { display: block; }      /* the details while pointed at */
.ps-cmp-label:not(.riding) .h { color: var(--way); }

/* Compare mode's pins (user 2026-11-11, design 1): one per difference — its
   number and how much longer the other way is; merged where they'd overlap. */
.ps-cmp-pins { position: absolute; inset: 0; pointer-events: none; }
.ps-cmp-pin { position: absolute; transform: translate(-50%, -50%); pointer-events: auto; display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 7px 1px 2px; border-radius: 999px; background: #ffffff; color: #1a1a2e; border: 2px solid var(--way);
  box-shadow: 0 2px 6px rgba(0,0,0,.18); font: 600 11px/18px system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-variant-numeric: tabular-nums; white-space: nowrap; cursor: pointer; }
.ps-cmp-pin .num { min-width: 18px; height: 18px; border-radius: 999px; background: var(--way); color: #ffffff; display: inline-grid; place-items: center; }
.ps-cmp-pin.many { padding: 1px 8px; border-style: dashed; }
.ps-cmp-pin.hov { box-shadow: 0 4px 14px rgba(0,0,0,.28); }

.cmp-chart { width: 100%; position: relative; }
.cmp-chart-head { position: absolute; left: 38px; right: 8px; top: 0; z-index: 1; display: flex; align-items: center; gap: 10px;
  font-size: 11.5px; color: var(--fg-muted); height: 18px; pointer-events: none; }
.cmp-chart-head button { pointer-events: auto; padding: 0 8px; line-height: 16px; font-size: 11px; }
.cmp-chart-head b { color: var(--fg); }
.cmp-chart-readout { flex: 1 1 auto; text-align: right; color: var(--fg); }
.cmp-band rect { fill: rgba(232, 89, 12, 0.07); cursor: pointer; }
.cmp-band.on rect { fill: rgba(232, 89, 12, 0.17); }
.cmp-band text { font-size: 10.5px; font-weight: 600; pointer-events: none; }
.cmp-band-a { fill: #2b6cff; }

/* Hiding the route (hold Shift / the hide button) hides compare mode's labels too. */
body.ps-route-hidden .ps-cmp-labels { display: none; }

/* The OSM Standard map's legend (CtrlStrip.svelte; the phone's basemap popover). */
.map-legend { max-height: 52vh; overflow-y: auto; padding: 2px 4px 4px; min-width: 220px; }
.map-legend-h { font-size: 11.5px; font-weight: 600; color: var(--fg-muted); margin: 8px 0 2px; }
.map-legend-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; padding: 1px 0; color: var(--fg); }
.map-legend-row svg { flex: 0 0 auto; }

/* The Library button's ▾: saving (SaveMenu.svelte, user 2026-11-06). */
.library-split { display: inline-flex; }
.library-split #library-btn { border-top-right-radius: 0; border-bottom-right-radius: 0; }
/* (Two classes: Bootstrap's .btn radius otherwise wins and leaves a notch at the join.) */
.library-split .library-save-btn { border-radius: 0 var(--bs-btn-border-radius) var(--bs-btn-border-radius) 0; }
.library-save-btn { border-left: 1px solid rgba(255, 255, 255, .45);
  display: inline-flex; align-items: center; gap: 5px; padding-left: 7px; padding-right: 7px; }
.library-save-btn .bi { font-size: 10px; }
.library-save-dot { width: 7px; height: 7px; border-radius: 50%; background: #fbbf24; }
.save-menu { display: flex; flex-direction: column; gap: 1px; font-size: 13px; }
.save-menu-head { font-size: 12px; color: var(--bs-secondary-color, #6b7280); padding: 2px 8px 4px; }
.save-menu-item { display: block; text-align: left; border: 0; background: transparent; border-radius: 8px; padding: 6px 8px; color: inherit; }
.save-menu-item:hover:not(:disabled) { background: #f1f3f5; }
.save-menu-item.primary { background: #eaf6ee; }
.save-menu-item.primary:hover:not(:disabled) { background: #dcefe3; }
.save-menu-item small { display: block; color: var(--bs-secondary-color, #6b7280); font-size: 12px; }
.save-menu-item:disabled { opacity: .5; }
.save-menu-sep { height: 1px; background: #e5e7eb; margin: 4px 0; }
/* Wider than Bootstrap's 276 px popover cap, and never a sideways scrollbar. */
#library-save-menu { max-width: min(380px, calc(100vw - 16px)); }
#library-save-menu .popover-body { overflow-x: hidden; }
.save-new { display: flex; flex-direction: column; gap: 10px; font-size: 13px; }
.save-new-label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--bs-secondary-color, #6b7280); }
.save-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.save-tags .lib-tag { cursor: pointer; }
.save-tags .lib-tag-new { border: 1px dashed #d1d5db; border-radius: 999px; padding: 1px 9px; font: inherit; font-size: 12px; width: 90px; }
.save-new-actions { display: flex; justify-content: flex-end; gap: 8px; }
.route-tab-lib { color: var(--bs-secondary-color, #6b7280); font-size: 12px; }
.route-tab-state { font-size: 11.5px; color: #9a4b00; display: inline-flex; align-items: center; gap: 3px; }
.route-tab-state.edited::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #d97706; }
/* The bar lowered to its routes row, and its tab on the top edge (as the compare panel's handle). */
.stats-bar.down > :not(#routes-bar) { display: none !important; }
.routes-bar-sum { margin-left: auto; font-size: 12px; color: var(--fg-muted); white-space: nowrap; }
.stats-toggle { position: fixed; left: 50%; z-index: 1751; width: 56px; height: 24px; transform: translate(-50%, calc(-100% + 1px));
  padding: 0; border: 1px solid var(--border); border-bottom: 0; border-radius: 12px 12px 0 0; background: var(--floating-bg);
  box-shadow: 0 -3px 6px rgba(0, 0, 0, .08); color: var(--fg); display: flex; align-items: center; justify-content: center; font-size: 14px; }
.stats-toggle:hover { background: #f1f3f5; }
.save-set-routes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; color: var(--fg, #1a1a2e); }
.save-set-routes li { display: flex; align-items: center; gap: 6px; }
.save-set-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.save-set-what { color: var(--bs-secondary-color, #6b7280); }
.save-set-routes li { align-items: flex-start; }
.save-set-routes .save-set-dot { margin-top: 9px; }
.save-route-fields { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.save-route-fields .save-set-what { font-size: 11.5px; }

/* First-visit welcome (Welcome.svelte). */
.welcome { font-size: 14px; }
.welcome-lead { font-size: 15px; }
.welcome-steps { list-style: none; padding: 0; margin: 0 0 12px; display: flex; flex-direction: column; gap: 10px; }
.welcome-steps li { display: flex; gap: 10px; align-items: flex-start; }
.welcome-steps .bi { color: var(--accent, #00a870); font-size: 18px; line-height: 1.2; }
.welcome-help { margin: 0; color: var(--fg-muted); }
/* The welcome is a light modal (as Help); its footer's rule too. */
#welcome-modal .modal-footer { border-top: 1px solid var(--border); }
#welcome-modal .welcome-steps .bi { color: #16a34a; }
