/*
 * Mapvera Wayfinding UI — place-driven directions.
 * The UI is MOUNTED INSIDE `.mapvera-sidebar` so it inherits the proven sheet controller
 * (initSheet in viewerpage.ts): on mobile the sidebar is a draggable bottom sheet with iOS-keyboard
 * fitting; on desktop it is a static side-panel column. We only hide the legacy Mapplic sidebar
 * chrome + route box and lay our own views out inside the same host. Companion to mapvera-wayfinding.js.
 */

/* Hide the legacy Mapplic route widget + the sidebar's own search header / filter / directory list /
   dim — but KEEP the sidebar element itself (it is our sheet host). The mapplic directory is a
   <ul class="mapvera-list-container">; our scroll areas are <div>s with the same class, so target
   the UL specifically. */
.mapvera-routes .mapvera-routes-panel { display: none !important; }
.mvw-host > .mapvera-sidebar-header,
.mvw-host > .mapvera-filter,
.mvw-host > ul.mapvera-list-container,
.mvw-host > .mapvera-sidebar-dim { display: none !important; }

/* Bottom-sheet (portrait/mobile only): an artistic top shadow + soft halo so the sheet reads as a
   distinct floating surface and never blends into a white map behind it. Desktop is a static column.
   NOTE: mapvera.css ships `html .mapvera-portrait .mapvera-sidebar { box-shadow:none !important }` which
   out-specifies a plain selector, so we match its specificity AND add .mvw-host to win the cascade. */
html .mapvera-portrait .mapvera-sidebar.mvw-host {
  box-shadow: 0 -3px 20px rgba(24, 12, 44, .16), 0 -1px 6px rgba(24, 12, 44, .10) !important;
}

.mvw, .mvw * { box-sizing: border-box; }
.mvw {
  --mvw-accent: #33313a; /* neutral dark accent — the wayfinding chrome uses greys, not brand colour */
  --mvw-ink: #23222a;
  --mvw-sub: #6f6d78;
  --mvw-line: #e6e5ea;
  --mvw-bg: #ffffff;
  --mvw-soft: #f6f4fb;
  font-family: "Outfit", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--mvw-ink);
  display: flex; flex-direction: column;
  width: 100%; height: 100%; min-height: 0; background: var(--mvw-bg);
}

/* The host must lay the handle (top) + our UI out as a column. */
.mvw-host { display: flex !important; flex-direction: column; }

/* ---------------------------------------------------------------------------------------------
   Views: only the one matching data-view shows; each is a flex column of a fixed header + a
   scrolling list. Place/route views are themselves the scroll area.
   --------------------------------------------------------------------------------------------- */
.mvw-view { display: none; flex: 1 1 auto; min-height: 0; flex-direction: column; }
.mvw[data-view="search"] .mvw-view-search,
.mvw[data-view="place"]  .mvw-view-place,
.mvw[data-view="dir"]    .mvw-view-dir,
.mvw[data-view="route"]  .mvw-view-route { display: flex; }

.mvw-fixed { flex: 0 0 auto; padding: 4px 16px 8px; }
.mvw-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 0 12px 10px; }
.mvw-search-list .mvw-row { padding: 8px 10px; }
/* Pretty, thin scrollbar (desktop). */
.mvw-scroll::-webkit-scrollbar { width: 8px; }
.mvw-scroll::-webkit-scrollbar-thumb { background: #d7d5df; border-radius: 4px; border: 2px solid transparent; background-clip: content-box; }
.mvw-scroll::-webkit-scrollbar-track { background: transparent; }
.mvw-scroll { scrollbar-width: thin; scrollbar-color: #d7d5df transparent; }
/* Clamped (place card) sheet: hide the grab handle + kill the top spacing above the title. The grab
   handle is hidden, so the host reclaims its 18px reserve and rises to top:6px — but the default
   `.mapvera-sidebar .mvw {top:18px}` (line below) has EQUAL specificity and comes later, so it won this
   before. Adding `.mapvera-sidebar` here (the class mvw-place-open sits ON) out-specifies it. Head then
   sits ~9px from the sheet top (1.5× the close-×'s 6px) — a tight, deliberate whitespace reduction. */
.mvw-place-open > .mv-sheet-handle { display: none !important; }
.mvw-place-open .mvw-view-place { padding-top: 3px; }
/* A 2+ line title starts right under the grab bar; push the whole card down so the first line clears the
   pill (JS adds .mvw-place-multiline). Single-line titles keep the tight 3px top above. */
.mvw-place-open .mvw-view-place.mvw-place-multiline { padding-top: 16px; }
html .mapvera-portrait .mvw-place-open.mapvera-sidebar .mvw { top: 6px; }
.mvw-view-place, .mvw-view-route { padding: 16px; }
/* Trim the whitespace above "Est. N min" — pull the route header up close to the top (just clear of the
   grab bar), mirroring the tightened place-card title. */
.mvw-view-route { padding-top: 5px; }

/* Neutralise the mapplic/company absolute positioning that targets ANY `.mapvera-list-container`
   (our scroll divs carry that class so initSheet's drag arbitration lets them scroll natively).
   Higher specificity than mapvera.css's `html .mapvera-portrait .mapvera-sidebar .mapvera-list-container`. */
html .mvw .mapvera-list-container,
html .mapvera-portrait .mapvera-sidebar .mvw .mapvera-list-container {
  position: static !important; top: auto !important; bottom: auto !important; left: auto !important; right: auto !important;
  background: transparent !important; box-shadow: none !important; width: auto !important; height: auto !important;
}

/* On mobile the sheet shell (mapvera.css) is fixed + 82vh with an absolute grab handle at the top;
   sit our UI just below that handle and let it fill the rest. */
html .mapvera-portrait .mapvera-sidebar .mvw { position: absolute; top: 18px; left: 0; right: 0; bottom: 0; height: auto; }

/* ---- icons ----
   Icon tiles are rounded SQUARES, never circles: client logos / category icons come in every shape
   (square, circle, wide rectangle) and must never be cropped. Images are CONTAINED (the whole logo
   shows). The fallback is an initials tile — 2 letters for a two-word name, 1 for one word — which
   Mapvera's own thumbnail() already produces, so it matches the rest of the map. */
.mvw-ic { width: 20px; height: 20px; fill: currentColor; flex: 0 0 auto; }
/* Icon tiles. Scoped under .mvw + !important because mapplic's `.mapvera-thumbnail` (50px, cover)
   otherwise wins. Images are CONTAINED at any aspect (never cropped); the fallback is a generic grey
   initials tile (2 letters two-word name / 1 letter one word — from Mapvera's own thumbnail()). */
/* EVERY icon (uploaded logo OR generated tile OR category glyph) occupies the SAME fixed square slot, so
   all names left-align in one column and no logo looks bigger/smaller. Logos are CONTAINED (never
   cropped or distorted — any aspect ratio) and centred both axes inside the slot. */
.mvw .mvw-catic, .mvw .mvw-thumb, .mvw img.mvw-thumb {
  width: 44px !important; height: 44px !important; min-width: 44px !important; max-width: 44px !important;
  object-fit: contain !important; object-position: center !important;
  border: 0 !important; border-radius: 0 !important; box-shadow: none !important;
  flex: 0 0 auto; overflow: hidden; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; text-transform: uppercase; line-height: 1;
}
.mvw .mvw-catic img { max-width: 100% !important; max-height: 100% !important; width: auto !important; height: auto !important; object-fit: contain !important; }
/* Mapplic ships `.mapvera-thumbnail { margin-right: 10px }` for its own directory list. Inside our UI
   that pushed UPLOADED-image icons ~10px further from their label than the generated placeholder tiles
   (which have no such margin) — THIS is the "huge gap on user-uploaded images only". Zero it everywhere. */
.mvw .mvw-thumb, .mvw .mvw-catic, .mvw img.mvw-thumb, .mvw .mapvera-thumbnail, .mvw .mvw-place-ic { margin: 0 !important; }
.mvw .mvw-catic, .mvw .mvw-thumb.mapvera-thumbnail-placeholder { background: #8e8b97 !important; color: #fff !important; }
.mvw .mvw-thumb.mapvera-thumbnail-placeholder svg { width: 20px !important; height: 20px !important; fill: currentColor; }
.mvw .mvw-place-ic, .mvw img.mvw-place-ic { width: 50px !important; height: 50px !important; min-width: 50px !important; max-width: 50px !important; object-fit: contain !important; object-position: center !important; }
/* Every chip icon is a UNIFORM 18px square — uploaded logos are contained (letterboxed) inside the same
   box as generated tiles, so text sits equally close to both (was: uploaded imgs up to 28px wide, which
   pushed their label further right than generated icons). */
.mvw .mvw-chip .mvw-catic, .mvw .mvw-chip .mvw-thumb, .mvw .mvw-chip img.mvw-thumb {
  width: 18px !important; height: 18px !important; min-width: 18px !important; max-width: 18px !important;
  object-fit: contain !important; border-radius: 0 !important; font-size: 9px;
}
/* Auto-generated INITIAL tiles ("J&C", "B&H") keep a FIXED HEIGHT but may grow in WIDTH so a 3-char "A&B"
   initial fits at full size — the text never shrinks, wraps or clips. Uploaded-image tiles stay square.
   min-width (inherited: 44 rows / 50 place / 18 chip) preserves alignment for the common 1–2 char case. */
.mvw .mapvera-thumbnail-placeholder {
  width: auto !important; max-width: none !important; overflow: visible !important; white-space: nowrap; padding: 0 3px;
}
.mvw .mvw-chip .mapvera-thumbnail-placeholder {
  width: auto !important; max-width: none !important; min-width: 18px !important; overflow: visible !important; white-space: nowrap; padding: 0 3px;
}

/* ---- SEARCH view ---- */
/* Search bar + Directions form a single pill: input on the left, a dark-grey Directions button fused
   to the right end (square left edge, rounded right matching the bar). */
.mvw-searchbar {
  display: flex; align-items: center; gap: 6px;
  background: #fff; border: 1px solid rgba(0, 0, 0, .06);
  border-radius: 12px; padding: 0 0 0 12px; height: 54px; cursor: text; overflow: visible;
}
/* Big (~3×) magnifier. pointer-events:none = clicks pass straight THROUGH the icon to focus the input
   (the whole bar is the tap target), so the large icon never blocks the search. Colour + stroke are
   matched to the search-bar BORDER: --mvw-line light grey, and vector-effect:non-scaling-stroke pins the
   stroke to exactly 1 device px (== the 1px border) regardless of the icon's scale. */
.mvw-searchbar-ic { color: var(--mvw-sub); width: 31.5px; height: 31.5px; flex: 0 0 auto; pointer-events: none; }
.mvw-searchbar-ic circle, .mvw-searchbar-ic path { vector-effect: non-scaling-stroke; }
/* !important: mapplic's .mapvera-search-input forces 22px + a big left padding/indent, which made every
   field look huge and pushed the placeholder far from the icon. Force size AND zero the padding/indent
   so "Search" sits right next to the magnifier (only the 6px searchbar gap between them). */
.mvw .mvw-input, .mvw .mvw-field-input {
  padding: 0 !important; text-indent: 0 !important; margin: 0 !important;
}
.mvw .mvw-input {
  flex: 1; border: 0; background: transparent; outline: none;
  font-size: 17px !important; color: var(--mvw-ink); font-family: inherit; font-weight: 400 !important; min-width: 0; letter-spacing: 0 !important;
}
.mvw .mvw-field-input, .mvw .mvw-field-val { font-size: 16px !important; }
/* Placeholder is the prominent element next to the small icon — bigger than the 18px magnifier. */
.mvw .mvw-input::placeholder { color: var(--mvw-sub) !important; opacity: 1; font-size: 17px !important; font-weight: 400 !important; letter-spacing: .5px !important; }
/* From/To placeholders in black. */
.mvw .mvw-field-input::placeholder { color: var(--mvw-ink) !important; opacity: 1; }
.mvw-x {
  border: 0; background: transparent; color: var(--mvw-sub); font-size: 21px; line-height: 1;
  cursor: pointer; width: 26px; height: 26px; border-radius: 50%; flex: 0 0 auto;
}
/* Search-box clear × = the SAME dark-circle + white SVG cross as the directions From/To fields. */
.mvw-search-clear { display: none; margin-right: 8px; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%; background: rgba(0, 0, 0, .06); }
.mvw.mvw-typing .mvw-search-clear { display: inline-flex; align-items: center; justify-content: center; }
.mvw-search-clear .mvw-x-svg { width: 11px; height: 11px; display: block; }
.mvw-search-clear .mvw-x-svg path { fill: none; stroke: var(--mvw-ink); stroke-width: 2.6; stroke-linecap: round; }
/* Directions = dark-grey button fused to the right end of the search bar. The -1px margins bleed the
   button OVER the 1px border on top/bottom/right so it reaches the box's OUTER edge (no thin sliver of
   border showing around it); overflow:hidden on the bar clips the bleed to the rounded corner. */
.mvw-dirbtn {
  flex: 0 0 auto; align-self: stretch; width: 48px; margin: -1px -1px -1px 0; padding: 0; border: 0;
  background: #33313a; color: #fff; border-radius: 0 12px 12px 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.mvw-dirbtn .mvw-ic { width: 26px; height: 26px; fill: #fff; }
.mvw-dirbtn .mvw-ic { width: 22px; height: 22px; fill: currentColor; }

/* Horizontal category strip — no bubbles, tiny icons; a right-edge fade hints there's more to scroll.
   flex-wrap:nowrap is forced (!important) and the strip is height-locked to a single row so it can NEVER
   wrap to 2+ lines anywhere it appears (search, recents, place card) — it only ever scrolls sideways. */
.mvw-chips {
  display: flex !important; flex-wrap: nowrap !important; gap: 4px; overflow-x: auto; overflow-y: hidden;
  padding: 6px 2px 2px 0; margin: 0 -2px; scrollbar-width: none;
  /* The sheet sets touch-action:none; per-touched-element pan-x here re-enables native horizontal
     finger-scroll of the category strip (same trick the vertical list uses with pan-y). */
  touch-action: pan-x !important; -webkit-overflow-scrolling: touch;
}
/* Right-edge fade ONLY while there's more to scroll (class toggled by JS on scroll). At the end the last
   category is fully opaque — no clipped/faded text. */
.mvw-chips.mvw-fade-r {
  -webkit-mask-image: linear-gradient(90deg, #000 90%, transparent);
  mask-image: linear-gradient(90deg, #000 90%, transparent);
}
.mvw-chips::-webkit-scrollbar { display: none; }
.mvw-chip {
  display: inline-flex; align-items: center; gap: 5px; flex: 0 0 auto;
  background: transparent; border: 0; border-radius: 8px;
  padding: 3px 6px; font-size: 13px; font-weight: 500; color: var(--mvw-ink);
  cursor: pointer; font-family: inherit; white-space: nowrap;
}
.mvw-chip .mvw-catic, .mvw-chip .mvw-thumb { width: 16px; height: 16px; min-width: 16px; font-size: 9px; border-radius: 4px; }
.mvw-chip img.mvw-thumb { height: 16px; max-width: 30px; }
.mvw.mvw-typing .mvw-chips { display: none; }

/* Category scroll arrows — DESKTOP / landscape only (portrait uses touch swipe, no arrows). Each shows only
   when the strip can still scroll THAT way (mvw-can-l / mvw-can-r toggled by JS). They overlay the strip
   edges so chips slide under them. */
.mvw-chips-wrap { position: relative; }
.mvw-chips-arrow {
  display: none; position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  width: 26px; height: 26px; align-items: center; justify-content: center;
  border: 0; border-radius: 50%; background: var(--mvw-bg); color: var(--mvw-ink);
  box-shadow: 0 1px 5px rgba(0, 0, 0, .2); cursor: pointer; font-size: 19px; line-height: 1; font-family: inherit; padding: 0;
}
.mvw-chips-arrow-l { left: -2px; }
.mvw-chips-arrow-r { right: -2px; }
.mapvera-element:not(.mapvera-portrait) .mvw-chips-wrap.mvw-can-l .mvw-chips-arrow-l,
.mapvera-element:not(.mapvera-portrait) .mvw-chips-wrap.mvw-can-r .mvw-chips-arrow-r { display: inline-flex; }

/* ---- lists / rows ---- */
.mvw-listlabel { font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--mvw-sub); padding: 8px 4px 3px; }
.mvw-clear-recent { display: block; width: 100%; margin: 2px 0 6px; padding: 4px 6px; border: 0; background: transparent; color: var(--mvw-sub); font-size: 13px; font-weight: 600; font-family: inherit; cursor: pointer; text-align: right; }
.mvw-row {
  display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
  background: transparent; border: 0; border-radius: 10px; padding: 7px 8px; cursor: pointer;
  font-family: inherit; color: var(--mvw-ink);
}
.mvw-row-body { flex: 1; min-width: 0; }
/* Location NAMES wrap to as many lines as needed (never truncated with "…"). The row is align-items:center
   so the logo stays vertically centred against a 1- or 2-line name. overflow-wrap handles a single very
   long word (future-proof for unusual names). */
.mvw-row-title { font-size: 15.5px; font-weight: 600; line-height: 1.25; overflow-wrap: break-word; }
.mvw-row-sub { font-size: 13px; color: var(--mvw-sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.mvw-row-badge { font-size: 12px; color: var(--mvw-sub); flex: 0 0 auto; }
.mvw-row-action .mvw-catic, .mvw-row-action .mvw-thumb { background: #efe8fb; color: var(--mvw-accent); }
.mvw-empty { padding: 24px 6px; color: var(--mvw-sub); font-size: 14px; text-align: center; }

/* ---- PLACE card ---- */
.mvw-view-place { position: relative; }
/* Close × floats at the sheet's TRUE top-right corner, 6px from each edge, in both view types. It's
   positioned relative to the .mvw host, whose top differs by state: 6px on the place card (grab handle
   hidden) vs 18px on dir/route (grab handle shown). So the top offset is set per-state below to land the
   × at 6px from the sheet top either way; right:6px works for both (host right == sheet right). */
.mvw-place-close, .mvw-view-close {
  position: absolute; right: 6px; z-index: 7;
  width: 30px; height: 30px; border-radius: 50%; border: 0;
  background: rgba(0, 0, 0, .06); color: var(--mvw-ink);
  font-size: 21px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.mvw-place-close { top: 0; }     /* place card: host at 6px → × 6px from sheet top */
.mvw-view-close { top: -12px; }  /* dir/route: host at 18px → × 6px from sheet top */
/* Invisible enlarged tap target (fat-finger protection) — the visible circle stays 30px, but the
   clickable area extends ~14px down/left (into the sheet, where hit-testing isn't clipped by the sheet's
   overflow) so near-misses still register as a close. */
.mvw-place-close::before, .mvw-view-close::before {
  content: ""; position: absolute; top: -8px; right: -6px; bottom: -14px; left: -14px;
}
.mvw-place-head { display: flex; align-items: center; gap: 12px; padding-right: 40px; }
.mvw-place-ic { width: 46px; height: 46px; min-width: 46px; font-size: 18px; }
.mvw-place-title { font-size: 21px; font-weight: 700; line-height: 1.15; }
.mvw-place-cat { font-size: 13.5px; color: var(--mvw-sub); margin-top: 3px; line-height: 1.6; }
.mvw-cat-link { color: var(--mvw-accent); text-decoration: none; font-weight: 600; }
.mvw-cat-link:hover { text-decoration: underline; }
.mvw-cat-sep { margin: 0 6px; color: #c4bcd8; }
/* Linked-categories strip on the place card — a horizontal, single-line scrollable row of icon chips
   (reuses .mvw-chips / .mvw-chip). Unlimited categories: it scrolls, it never wraps. */
.mvw-place-cats { margin: 8px 0 2px; }
.mvw-place-desc { font-size: 15px; line-height: 1.5; color: #43414c; margin-top: 12px; }
.mvw-place-actions { display: flex; gap: 10px; margin-top: 12px; }
.mvw-place-dir { flex: 1; } /* Directions is the primary action; Share sits beside it */
.mvw-place-more { width: 100%; margin-top: 10px; } /* full-width More, under Directions/Share */
/* Any lone action button fills the row — whether it's literally the only action (e.g. just Share, or just
   More), or its row-mate (a More/CTA button) got neutralized OFFLINE (display:none + data-mvoff). So the
   row always looks balanced, regardless of which button ends up alone. */
.mvw-place-actions > .mvw-btn:only-child,
.mvw-place-actions:has(> [data-mvoff]) > .mvw-btn:not([data-mvoff]) { flex: 1 1 auto; }

/* ---- Share (moved here from the old tooltip) ---- */
.mvw-share-btn svg { width: 18px; height: 18px; transition: transform .2s ease; }
/* When the share row is open, rotate the toggle icon -90° (expanded state). */
.mvw-share-open .mvw-share-btn svg { transform: rotate(-90deg); }
.mvw-share-row { display: none; gap: 14px; margin-top: 14px; justify-content: center; }
.mvw-share-open .mvw-share-row { display: flex; }
.mvw-share-row button, .mvw-share-row a {
  width: 44px; height: 44px; border-radius: 50%; border: 0;
  background: transparent; display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--mvw-ink); text-decoration: none; padding: 0;
}
/* Each icon keeps its OWN fill attribute — outline icons (share/os/copy) stay outline (fill:none +
   stroke), brand icons (fb/wa) stay filled. A blanket `fill:currentColor` here flooded the outline
   icons solid, which is the "extra fill breaking share icons". Do NOT set fill on the group. */
.mvw-share-row svg { width: 20px; height: 20px; }
.mvw-toast {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%);
  background: #1c1230; color: #fff; padding: 8px 16px; border-radius: 999px; font-size: 14px;
  z-index: 6; box-shadow: 0 6px 18px rgba(0, 0, 0, .3); white-space: nowrap;
}

.mvw-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 12px; padding: 12px 18px; font-size: 15px; font-weight: 600;
  cursor: pointer; font-family: inherit;
}
/* Grey fill, no border — the primary action style used for Directions / More */
.mvw-btn-outline { background: rgba(0, 0, 0, .06); color: var(--mvw-ink); border: 0; }
.mvw-btn-outline .mvw-ic { fill: currentColor; }
.mvw-btn-outline:disabled { opacity: .4; cursor: not-allowed; }
/* White with a light-grey border — the secondary style used for Share / Show all */
.mvw-btn-ghost { background: transparent; color: var(--mvw-ink); border: 1.5px solid rgba(0, 0, 0, .06); }
/* Clear — neutral grey, not red */
.mvw-btn-clear { background: transparent; color: var(--mvw-sub); border: 1px solid var(--mvw-line); }

/* ---- DIRECTIONS ---- */
.mvw-view-dir, .mvw-view-route { position: relative; }
.mvw-view-dir .mvw-fixed { padding-top: 10px; padding-right: 44px; padding-bottom: 0; } /* clear the floating close circle; no gap under Clear before the list */
.mvw-hint:empty { display: none; }

/* Right padding reserves space for the swap toggle so BOTH fields end before it (were overlapping). */
.mvw-fields { position: relative; padding-left: 32px; padding-right: 48px; }
/* Google-style DOTTED line joining the origin/destination icons. */
.mvw-fields-rail { position: absolute; left: 13px; top: 26px; bottom: 30px; width: 0; border-left: 3px dotted #c3c2c9; background: transparent; }
.mvw-field {
  position: relative; display: flex; align-items: center; gap: 10px;
  background: #fff; border: 1.5px solid rgba(0, 0, 0, .06); border-radius: 10px;
  padding: 0 10px; height: 44px; margin-bottom: 8px;
}
.mvw-field.mvw-active { border-color: var(--mvw-accent); }
/* Origin ring / destination pin ICONS instead of green/red colour blocks. */
.mvw-field-dot {
  position: absolute; left: -30.5px; top: 50%; transform: translateY(-50%); /* centre the icon exactly on the 3px dotted rail */
  width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center;
  background: transparent !important; border: 0 !important; border-radius: 0 !important; box-shadow: none !important;
}
.mvw-field-dot svg { width: 24px; height: 24px; }
.mvw-dot-from { color: var(--mvw-sub); }
.mvw-dot-to { color: var(--mvw-accent); }
.mvw-field-input { height: 100%; min-width: 0; }
/* Clear × = dark circle, white ×, genuinely clickable (raised above the input). The × is an SVG cross
   (not a text glyph) so it is PERFECTLY centred in the circle regardless of font metrics. */
.mvw-field-clear {
  display: none; flex: 0 0 auto; width: 22px; height: 22px; border: 0; border-radius: 50%;
  background: rgba(0, 0, 0, .06); cursor: pointer; padding: 0;
  align-items: center; justify-content: center; position: relative; z-index: 3;
}
.mvw-field-clear .mvw-x-svg { width: 11px; height: 11px; display: block; }
.mvw-field-clear .mvw-x-svg path { fill: none; stroke: var(--mvw-ink); stroke-width: 2.6; stroke-linecap: round; }
/* Show the × whenever the field has content — while TYPING (input no longer shows its placeholder)
   as well as when a place is picked (.mvw-filled). Hidden only when the field is blank. */
.mvw-field.mvw-filled .mvw-field-clear,
.mvw-field-input:not(:placeholder-shown) ~ .mvw-field-clear { display: inline-flex; }

/* Route panel From/To are the SAME field component, read-only + tappable — full width up to the swap. */
.mvw-route-field { display: flex; width: 100%; align-items: center; text-align: left; cursor: pointer; }
.mvw-route-tofield { padding-right: 0; } /* the directions button fuses flush to the field's right inner edge */
.mvw-field-val { flex: 1; min-width: 0; color: var(--mvw-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Directions re-trigger = an EXACT mini of the search-bar Directions button (see .mvw-dirbtn): dark fill,
   white icon, FLAT left edge, fused to the right — touching the field's top, bottom and right inner edges,
   with the field's own border wrapping it. align-self:stretch = touch top+bottom; right radius matches the
   field corner (10px − 1.5px border ≈ 8.5px). color:#fff keeps the diamond white (icon uses currentColor). */
.mvw-route-dir {
  align-self: stretch; flex: 0 0 auto; width: 48px; margin: -1.5px -1.5px -1.5px 0; padding: 0; border: 0;
  border-radius: 0 10px 10px 0; /* matches the field's OUTER corner (button now covers the 1.5px border) */
  background: #33313a; color: #fff; display: inline-flex; align-items: center; justify-content: center;
}
.mvw-route-dir svg, .mvw-route-dir svg path { width: 22px; height: 22px; fill: #fff !important; }

.mvw-swap {
  border: 0; background: #fff; color: var(--mvw-ink);
  width: 38px; height: 38px; border-radius: 50%; cursor: pointer; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
}
.mvw-swap-fields { position: absolute; right: 3px; top: 28px; z-index: 2; }
/* Step-free (accessibility) toggle — same right axis as the swap, sits below it, vertically centred on the
   destination box (its `top` is set by JS to the box centre; translateY keeps it centred there). Colour is
   --mvw-acc (a light purple by default, per-map customisable via routes.acccolor). */
.mvw-acc-toggle {
  position: absolute; right: 3px; top: 74px; z-index: 2; transform: translateY(-50%); /* top refined by JS to the destination-box centre */
  width: 38px; height: 38px; border: 0; background: transparent !important; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; color: var(--mvw-ink); /* always black — state is shown by the icon only */
}
.mvw-acc-toggle .mvw-ic { width: 25px; height: 25px; }
/* No-route error banner in the route panel (e.g. no step-free path found). */
.mvw-route-error { margin: 10px 4px 4px; padding: 10px 12px; border-radius: 10px; background: rgba(217,45,45,.08);
  color: #b3261e; font-size: 13.5px; font-weight: 600; line-height: 1.35; }
.mvw-route-meta-err { color: var(--mvw-sub); }
/* Swap arrows spin 180° each tap (change-direction toggle). The rotation is applied inline on the BUTTON
   (an HTML element — CSS transform on an <svg> root is unreliable) and animated by swap() via rAF. */
.mvw-swap { transition: transform .25s ease; }
.mvw-hint { font-size: 13px; color: var(--mvw-sub); padding: 6px 4px 2px; }
/* "Clear" link — right-aligned to the FIELD's right edge (fields reserve 48px on the right for swap). */
.mvw-dir-clear { display: block; margin: 4px 48px 0 auto; padding: 2px 2px; border: 0; background: transparent; color: var(--mvw-sub); font-size: 13px; font-weight: 600; font-family: inherit; cursor: pointer; }
/* Route panel: "STEPS" heading + "Clear" share ONE line, tight against the fields above. Steps left,
   Clear pinned right (48px reserved so it lines up with the field's right edge). */
.mvw-steps-head { display: flex; align-items: center; justify-content: space-between; margin: 0 0 2px; padding-right: 47px; }
/* "Clear" sits in a 48px column right-aligned to the To field's edge and centres its text — so it lands
   exactly under the horizontal centre of the black route button above it. */
.mvw-steps-head .mvw-dir-clear { margin: 0 0 0 auto; width: 48px; text-align: center; padding-left: 0; padding-right: 0; }
/* Directions suggestions: tight, compact rows (no descriptions, minimal headings). */
.mvw-dir-list .mvw-row { padding: 6px 8px; gap: 10px; }
.mvw-dir-list .mvw-row:first-child { padding-top: 2px; } /* first result sits just under the Clear link */
.mvw-dir-list .mvw-row .mvw-catic, .mvw-dir-list .mvw-row .mvw-thumb { width: 30px; height: 30px; min-width: 30px; }
.mvw-dir-list .mvw-row-title { font-size: 15px; }
.mvw-dir-list .mvw-listlabel { padding: 8px 4px 2px; }

/* ---- ROUTE (active) ---- */
/* Column layout so the walk time / distance can sit at the very top (order:-1), and the summary,
   actions and steps follow. This makes the peek show the ETA first. */
.mvw-route-inner { display: flex; flex-direction: column; }
.mvw-route-top { display: flex; align-items: center; gap: 10px; }
.mvw-route-summary { flex: 1; display: flex; gap: 12px; min-width: 0; }
.mvw-route-rail { display: flex; flex-direction: column; align-items: center; padding-top: 8px; }
.mvw-route-rail .mvw-dot-from { position: static; width: 11px; height: 11px; border-radius: 50%; background: #38b26b; box-shadow: none; }
.mvw-route-rail .mvw-route-line { width: 2px; flex: 1; min-height: 22px; background: var(--mvw-line); margin: 3px 0; }
.mvw-route-rail .mvw-dot-to { position: static; width: 11px; height: 11px; background: #ea3546; border-radius: 3px; }
.mvw-route-pts { flex: 1; min-width: 0; }
.mvw-route-pt {
  display: block; width: 100%; text-align: left; background: var(--mvw-soft);
  border: 0; border-radius: 10px; padding: 8px 12px; margin-bottom: 8px; cursor: pointer; font-family: inherit;
}
.mvw-route-pt small { display: block; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--mvw-sub); }
.mvw-route-pt span { font-size: 15.5px; font-weight: 600; color: var(--mvw-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.mvw-route-meta { order: -1; margin: 0 2px 14px; font-size: 20px; }
.mvw-route-meta strong { color: var(--mvw-ink); font-weight: 700; }
.mvw-route-meta span { color: var(--mvw-sub); }
.mvw-route-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.mvw-route-actions .mvw-btn { flex: 1 1 auto; padding: 10px 14px; font-size: 14px; white-space: nowrap; }

/* ---- Turn-by-turn steps ---- */
.mvw-steps-label { font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--mvw-sub); margin: 0 0 0 2px; }
.mvw-steps { list-style: none; margin: 0; padding: 0; }
/* Each step's text is vertically centred against its icon, whatever the text length. */
.mvw-step { display: flex; align-items: center; gap: 11px; padding: 9px 2px; }
.mvw-step + .mvw-step { border-top: 1px solid var(--mvw-line); }
/* Every step icon = the same light-grey circle as the close × (rgba(0,0,0,.06)) with a BLACK glyph. */
.mvw-step-ic {
  width: 28px; height: 28px; min-width: 28px; border-radius: 50%;
  background: rgba(0, 0, 0, .06); color: var(--mvw-ink);
  display: inline-flex; align-items: center; justify-content: center;
}
.mvw-step-ic svg { width: 17px; height: 17px; }
/* The final "Arrive" step is the exception: BLACK circle, WHITE glyph. */
.mvw-step-end .mvw-step-ic { background: var(--mvw-ink); color: #fff; }
.mvw-step-body { flex: 1; min-width: 0; }
.mvw-step-text { font-size: 15px; color: var(--mvw-ink); line-height: 1.35; }
.mvw-step-text strong { font-weight: 700; color: var(--mvw-ink); }
/* A step that names a location is tappable (opens that place). */
.mvw-step-link { cursor: pointer; }
.mvw-step-link:active { background: rgba(0, 0, 0, .04); border-radius: 8px; }
.mvw-step-dist { font-size: 12.5px; color: var(--mvw-sub); margin-top: 2px; }

/* While a route is active, calm the map so the line reads clearly. */
.mapvera-routes.mvw-routing .mapvera-pin:not(.mapvera-active) { opacity: .35; transition: opacity .3s; }

/* ---------------------------------------------------------------------------------------------
   Standalone fallback — only when a map has NO sidebar to host us. A simple fixed bottom card.
   --------------------------------------------------------------------------------------------- */
.mvw-standalone {
  position: absolute; left: 0; right: 0; bottom: 0; top: auto; height: auto;
  border-radius: 18px 18px 0 0; box-shadow: 0 -10px 40px rgba(40, 15, 80, .18);
  max-height: 70vh; z-index: 500;
}
.mvw-standalone[data-open="peek"] { max-height: 160px; }
@media (min-width: 860px) {
  .mvw-standalone { left: 16px; right: auto; top: 16px; bottom: 16px; width: 380px; border-radius: 18px; max-height: none; }
}
