/* Vamoto site stylesheet. The tokens (colours, type, space, layout offsets)
   live in css/tokens.css, loaded first; the signed-in shell is css/shell.css
   and the shared building blocks are css/components.css. */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.45;
}

.hidden { display: none !important; }
.muted { color: var(--text-2); font-size: 13px; margin: 6px 0; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.92em; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- top nav ---------- */

#topnav {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 16px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  z-index: 50;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.brand-mark { color: var(--accent-ink); flex: none; display: block; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
}
/* R28 A: the two auth groups are wrappers only - their links must stay
   direct flex items of .nav-links, so the row keeps its gap. `.hidden`
   is !important, so it still wins. */
.nav-links > .nav-group { display: contents; }
.nav-links a {
  color: var(--text-2);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 8px;
  font-weight: 500;
  white-space: nowrap;
}
.nav-links a:hover { color: var(--text); background: var(--surface-2); }
.nav-links a.active { color: var(--accent-ink); background: var(--accent-soft); }
.nav-auth { display: flex; align-items: center; gap: 8px; }

/* Language picker (i18n design 1.4). The build fills this nav; in the source
   tree it is empty, so none of these rules paint anything there. Colours are
   the chrome tokens, so a livery swap carries the picker with it. */
.nav-lang { position: relative; }
.nav-lang-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
}
.nav-lang-btn:hover,
.nav-lang-btn[aria-expanded="true"] { color: var(--text); background: var(--surface-2); }
.nav-lang-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.nav-lang-flag {
  width: 20px;
  height: 15px;
  border-radius: 2px;
  display: block;
  /* The German flag's white-free bands and the Union Jack's blue both sit on
     a dark bar; a hairline keeps either from bleeding into it. */
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--text) 25%, transparent);
}
.nav-lang-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.nav-lang-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  margin: 0;
  padding: 6px;
  list-style: none;
  min-width: 170px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-float);
  /* Above the nav's own z-index: 50, and above the map controls. */
  z-index: 60;
}
.nav-lang-menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}
.nav-lang-menu a:hover { background: var(--surface-2); }
.nav-lang-menu a[aria-current="page"] { color: var(--accent-ink); font-weight: 700; }
/* On a phone the bar is tight: the flag alone still says which language it
   is, so the code goes. `hidden` on the menu stays the one truth for the
   open state, so nothing here touches [hidden]. */
@media (max-width: 720px) {
  .nav-lang-code { display: none; }
}
main { padding-top: var(--topbar-h); min-height: 100%; }
/* A fragment link lands its heading below the fixed top nav (staging QA w30:
   /privacy#delete-account is the stores' account-deletion URL). The app
   shell sets its own value (shell.css). */
html { scroll-padding-top: calc(var(--topbar-h) + 16px); }

/* ---------- inputs (buttons are css/components.css) ---------- */

input[type="text"], input[type="number"], input[type="search"], input[type="url"], select {
  width: 100%;
  padding: 9px 10px;
  min-height: 40px;
  margin: 4px 0 2px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
}
/* Native <option> popups take the select's colours; say them explicitly so
   a livery swap never leaves white text on a white list. */
select option { background: var(--surface-2); color: var(--text); }
select option:disabled { color: var(--text-2); }
label { display: block; margin-top: 10px; color: var(--text-2); font-size: 13px; font-weight: 600; }

.status {
  padding: 9px 12px;
  margin: 0 0 10px;
  border-radius: 8px;
  font-size: 13.5px;
}
.status.error { background: var(--danger-soft); border: 1px solid color-mix(in srgb, var(--danger) 45%, transparent); }
.status.info { background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); }
/* Muted status for the debounced auto re-route note ("Updating route..."). */
.status.muted { background: var(--surface-2); border: 1px solid var(--line); color: var(--text-2); }
.plan-status-action { margin-left: 6px; vertical-align: baseline; }

/* WEB-I1: the spinner in the planner status line while a route is being
   computed. Purely decorative (aria-hidden), and it stops moving for a rider
   who asked their OS for less motion. */
.plan-spinner {
  display: inline-block;
  width: 11px;
  height: 11px;
  vertical-align: -1px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: plan-spin 0.8s linear infinite;
}
@keyframes plan-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .plan-spinner { animation: none; }
}

/* D8: a new build is live (js/version_watch.js). Fixed under the nav, above the map views. */
.version-notice {
  position: fixed; top: var(--topbar-h); left: 0; right: 0; z-index: 45;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 8px 14px; background: var(--accent-soft); border-bottom: 1px solid var(--line); font-size: 13.5px;
}

/* ---------- landing ---------- */

#view-landing {
  max-width: 1040px;
  margin: 0 auto;
  padding: 24px 20px 64px;
}
.hero { text-align: center; padding: 64px 8px 40px; }
.hero h1 {
  font-size: clamp(34px, 6vw, 56px);
  margin: 0 0 16px;
  background: linear-gradient(100deg, var(--text) 40%, var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-sub {
  max-width: 620px;
  margin: 0 auto 28px;
  color: var(--text-2);
  font-size: 18px;
}

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
  margin-top: 32px;
}

/* ---------- map views (planner + ridden) ---------- */

.map-view {
  position: relative;
  height: calc(100dvh - var(--topbar-h));
  overflow: hidden;
}
.map { position: absolute; inset: 0; }
/* Keep the map sized after MapLibre's lazy stylesheet sets position: relative. */
.map.maplibregl-map { position: absolute; }
/* MapLibre's canvas is its own positioned stacking context. Keep a failed
   basemap's retry control above it and reachable rather than merely present. */
.map-load-error {
  position: absolute;
  z-index: 20;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
/* The places layer's busy / unavailable note on the maps outside the
   planner (js/views/map_overlays.js mapNote). */
.map-note {
  position: absolute;
  z-index: 15;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  font-size: 13px;
  pointer-events: none;
}


/* D9: #/plan needs an account. A signed-out visitor gets the sign-in status
   and nothing else: no views and no map exist, and the `> *` rule keeps any
   markup added later to #view-plan hidden by default. #plan-status stays a
   direct child for exactly this. */
#view-plan.plan-signed-out { height: auto; overflow: visible; }
#view-plan.plan-signed-out > * { display: none; }
#view-plan.plan-signed-out > #plan-status {
  display: block;
  position: static;
  max-width: 560px;
  margin: 48px auto;
}

.field-group { margin: 14px 0; }
.field-group > label:first-child { margin-top: 0; }
/* D10: the unit word beside a number field, written by the view from the
   rider's unit system (the label copy carries no unit of its own). */
.field-unit { display: block; margin-top: 4px; color: var(--text-2); }


.wp-list { list-style: none; margin: 6px 0; padding: 0; }
.wp-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
}
.wp-list li:last-child { border-bottom: none; }
.wp-tag {
  flex: none;
  min-width: 46px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
span.wp-tag { background: var(--surface-2); color: var(--text-2); }
/* Chips: a wash of their own hue over the panel, and the hue pulled toward
   the text colour so the label reads in either chrome. */
span.wp-tag.start {
  background: color-mix(in srgb, var(--good) 25%, var(--surface));
  color: color-mix(in srgb, var(--good) 55%, var(--text));
}
span.wp-tag.end {
  background: color-mix(in srgb, var(--danger) 25%, var(--surface));
  color: color-mix(in srgb, var(--danger) 55%, var(--text));
}
button.wp-tag { cursor: pointer; font: inherit; font-size: 11px; font-weight: 700; min-height: 28px; }
button.wp-tag.break {
  background: color-mix(in srgb, #7db4ec 25%, var(--surface));
  color: color-mix(in srgb, #7db4ec 55%, var(--text));
}
button.wp-tag.via {
  background: color-mix(in srgb, #e8c25a 25%, var(--surface));
  color: color-mix(in srgb, #e8c25a 55%, var(--text));
}
.wp-coords { flex: 1; min-width: 0; color: var(--text-2); font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.wp-remove {
  flex: none;
  width: 34px; height: 34px;
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 15px;
  cursor: pointer;
}
.wp-remove:hover { color: var(--danger); border-color: var(--danger); }
/* Drag handle (D3): pointer-events reorder, so touch drags must not scroll. */
.wp-handle {
  flex: none;
  width: 26px;
  align-self: stretch;
  background: transparent;
  color: var(--text-2);
  border: none;
  font-size: 16px;
  line-height: 1;
  cursor: grab;
  touch-action: none;
}
.wp-handle:active { cursor: grabbing; }
/* Reverse-geocoded label (D4): like .wp-coords but normal text color. */
.wp-label {
  flex: 1;
  min-width: 0;
  color: var(--text);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Drop-position indicator during a list drag (D3). */
.wp-list.wp-dragging { cursor: grabbing; }
.wp-list li.drop-before { box-shadow: inset 0 2px 0 0 var(--accent); }
.wp-list li.drop-after { box-shadow: inset 0 -2px 0 0 var(--accent); }

/* result stats */
.stats-strip {
  display: flex;
  gap: 8px;
  margin: 12px 0;
}
.stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 4px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.stat-value { font-size: 17px; font-weight: 700; color: var(--accent-ink); }
.stat-label { font-size: 11px; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.05em; }

details summary { cursor: pointer; color: var(--text-2); font-weight: 600; padding: 6px 0; }
#plan-instructions-list { margin: 6px 0 0; padding-left: 20px; }
#plan-instructions-list li {
  margin: 5px 0;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
}
#plan-instructions-list li:last-child { border-bottom: none; }
.instruction-dist { display: block; color: var(--text-2); font-size: 11.5px; }

/* planner: check rows */
.check-row {
  display: flex; align-items: center; gap: 8px;
  color: var(--text); font-size: 14px; font-weight: 500; cursor: pointer;
}
.check-row input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }

/* planner: admin "Route lab" — a collapsible panel over the map, in the
   translucent-raised style. Collapsed → a slim
   "Lab ▸" tab. */
#plan-admin-panel {
  position: absolute;
  right: 12px;
  top: 64px;
  width: 320px;
  max-height: calc(100% - 160px);
  overflow: auto;
  z-index: 9; /* above the map canvas, below the side panel (10) */
  padding: 6px 10px 8px;
  background: color-mix(in srgb, var(--surface) 93%, transparent);
  backdrop-filter: blur(6px);
  border: 1px solid var(--line);
  border-radius: var(--r-2);
}
#plan-admin-panel.collapsed {
  width: auto;
  max-height: none;
  overflow: visible;
  padding: 6px 8px;
}
/* Collapsed: hide the body; only the icon toggle stays (css/plan.css). */
#plan-admin-panel.collapsed #plan-admin-body { display: none; }
#plan-admin-head { display: flex; align-items: center; gap: 10px; }
#plan-admin-title {
  flex: 1;
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-2); font-weight: 700;
}
.lab-section { margin-top: 8px; }
.lab-section-title {
  margin: 0 0 6px; font-size: 12px; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-2); font-weight: 700;
}
#plan-lab-seed { margin: 6px 0 0; font-size: 12px; }
.lab-list { margin-top: 8px; font-size: 12px; }
.lab-list .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.lab-row {
  padding: 6px 0; border-bottom: 1px solid var(--line);
}
.lab-row:last-child { border-bottom: none; }
.lab-row-head { display: flex; align-items: center; gap: 6px; }
.lab-swatch {
  display: inline-block; width: 14px; height: 3px; border-radius: 2px;
  vertical-align: middle;
}
.lab-name {
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.lab-metrics { white-space: nowrap; }
.lab-surf { color: var(--text-2); }
.lab-surf-bar {
  display: flex; height: 6px; border-radius: 3px; overflow: hidden;
  margin: 5px 0 3px;
}
.lab-surf-text {
  font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.lab-row.clickable { cursor: pointer; }
.lab-row.clickable:hover { background: color-mix(in srgb, var(--text) 6%, transparent); }
.lab-row.off { opacity: 0.4; }

.pc-grid { stroke: var(--line); stroke-width: 1; }
.pc-label { fill: var(--text-2); font-size: 10px;
            font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.pc-curv-label { fill: color-mix(in srgb, var(--accent) 60%, var(--text)); }
.pc-elev-label { fill: color-mix(in srgb, #539bf5 60%, var(--text)); }
.pc-curv-line { stroke: var(--accent); stroke-width: 1.5; fill: none; }
.pc-elev-line { stroke: #539bf5; stroke-width: 1.5; fill: none; }
.pc-cursor { stroke: var(--text); stroke-width: 1; stroke-dasharray: 3 2; }
.profile-hover-dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--text); border: 2px solid var(--accent);
  box-shadow: 0 0 4px #00000088;
}

/* The connected phone's live position — a brand-orange dot with a pulsing
 * ring, deliberately distinct from the teardrop waypoint markers. */
.phone-marker {
  position: relative;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent);
  border: 2px solid #fff;
  box-shadow: 0 0 4px #00000088;
  cursor: pointer;
}
.phone-marker::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  animation: phone-pulse 1.8s ease-out infinite;
  pointer-events: none;
}
@keyframes phone-pulse {
  0%   { transform: scale(0.6); opacity: 0.8; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* ---------- planner interaction overhaul ---------- */
/* Ghost dot snapped to the route line while hovering/dragging it (D2). It
   must never intercept hit-tests (A5). */
.route-ghost-dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent); border: 2px solid #fff;
  box-shadow: 0 0 4px #00000088;
  pointer-events: none;
}
/* Place-search dropdown (D5): absolute box under the search input. */
.search-wrap { position: relative; }
.search-results {
  position: absolute;
  z-index: 6;
  left: 0;
  right: 0;
  margin-top: 2px;
  max-height: 220px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 6px 20px #0008;
}
.search-results .result-row {
  padding: 7px 10px;
  font-size: 13.5px;
  color: var(--text);
  cursor: pointer;
}
.search-results .result-row.muted { color: var(--text-2); cursor: default; }
.search-results .result-row:not(.muted):hover,
.search-results .result-row.active {
  background: color-mix(in srgb, var(--text) 6%, transparent);
}
/* #179: favourites, custom locations and coordinates name their source. */
.search-results .result-row { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.search-results .result-label { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.search-results .result-kind { flex: none; font-size: 12px; }
/* Custom waypoint pins (D3/D12): a plain wrapper ROOT that MapLibre transforms
   inline every frame carries NO transform/transition of its own (so the
   repositioning is never eased — that easing was the drag lag). The inner
   .plan-pin div owns the teardrop shape, rotate, transition and hover scale;
   the inline transform on the root can no longer clobber that rotate. The
   --pin-color is set per marker in js/views/plan.js. */
.plan-pin-root { cursor: grab; }
.plan-pin-root.dragging, .plan-pin-root:active { cursor: grabbing; }
.plan-pin {
  width: 26px; height: 26px;
  background: var(--pin-color);
  border: 2px solid #0d1117;               /* same halo as chevron/POI badges */
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);               /* sharp corner points down = the tip */
  box-shadow: 0 1px 4px #0009;
  transition: transform .1s ease;
}
.plan-pin-root:hover .plan-pin { transform: rotate(-45deg) scale(1.12); }   /* preserve rotate */
.plan-pin-chip {
  display: grid; place-items: center;
  width: 100%; height: 100%;
  transform: rotate(45deg);                /* counter-rotate so the digit is upright */
  color: #fff; font: 700 12px/1 system-ui, sans-serif;
}
/* A pass-through (decision 5): a smaller disc with a » glyph, center anchor. */
.plan-pin.pass {
  width: 18px; height: 18px;
  border-radius: 50%;
  transform: none;
}
.plan-pin.pass .plan-pin-chip { transform: none; color: #0d1117; font-size: 13px; }
.plan-pin-root.pass:hover .plan-pin { transform: scale(1.18); }
/* List number chip mirroring the pin palette (D3). */
.wp-num {
  flex: none;
  min-width: 22px; height: 22px;
  display: grid; place-items: center;
  border-radius: 50%;
  font: 700 11px/1 system-ui, sans-serif;
  color: #0d1117;
}
.wp-num.start { background: #4cc38a; }
.wp-num.stop  { background: #7db4ec; }
.wp-num.end   { background: #ff6b62; }
.wp-num.via   { background: #e8c25a; }
/* Point / pin popup action buttons (D2/D4): full-width stacked choices. */
.point-actions { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
.point-actions button {
  display: block; width: 100%;
  padding: 7px 10px;
  background: none; border: none; border-radius: 6px;
  color: var(--text); font: inherit; font-size: 13.5px;
  text-align: left; cursor: pointer;
}
.point-actions button:hover { background: color-mix(in srgb, var(--text) 6%, transparent); }
/* Road-block lifetime chips (H9): step 2 of the report picker, inside the
   same popup. One is always pressed (Today), and Confirm files that one. */
.hazard-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.hazard-chips button {
  padding: 4px 10px;
  background: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text); font: inherit; font-size: 12.5px;
  cursor: pointer;
}
.hazard-chips button[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: var(--accent);
}

/* Waypoint list-row context menu (D15): cursor-positioned inside the plan
   view container, above the panel. Full-width left-aligned action buttons. */
.ctx-menu {
  position: absolute;
  z-index: 13;
  min-width: 150px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 6px 20px #0008;
}
.ctx-menu button {
  display: block;
  width: 100%;
  padding: 7px 10px;
  background: none;
  border: none;
  border-radius: 6px;
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  text-align: left;
  cursor: pointer;
}
.ctx-menu button:hover { background: color-mix(in srgb, var(--text) 6%, transparent); }

/* ---------- page views (rides + account) ---------- */

.page-view { padding: 24px 16px 64px; }
.page { max-width: 760px; margin: 0 auto; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.page h2 { margin: 8px 0 12px; }

.doc-list { list-style: none; margin: 14px 0; padding: 0; }
.doc-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  margin: 8px 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-2);
}
.doc-list li.selected { border-color: var(--accent); }
.doc-main { flex: 1; min-width: 0; cursor: pointer; }
.doc-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-meta { color: var(--text-2); font-size: 12.5px; }
.doc-swatch { flex: none; width: 12px; height: 12px; border-radius: 3px; }
.doc-actions { display: flex; gap: 6px; flex: none; }
/* "ridden N times" pill on My Rides rows (route_id back-links). */
.ridden-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-ink);
  background: var(--accent-soft);
  border-radius: 999px;
  vertical-align: 1px;
}
/* "This device" marker on the account devices table. */
td > .badge { margin-left: 8px; }

.page-view .card { margin: 14px 0; }
.card h3 { margin: 0 0 8px; font-size: 15px; }

.account-id { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
#account-avatar { border-radius: 50%; border: 2px solid var(--accent); }
.account-login { font-weight: 700; font-size: 17px; }

/* track details popup (MapLibre) */
.maplibregl-popup-content {
  background: var(--surface) !important;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  padding: 12px 14px;
  font: 13.5px/1.45 system-ui, sans-serif;
  min-width: 220px;
}
.maplibregl-popup-tip { border-top-color: var(--surface) !important; border-bottom-color: var(--surface) !important; }
.maplibregl-popup-close-button { color: var(--text-2); font-size: 18px; }
.popup-title { font-weight: 700; margin: 0 0 4px; padding-right: 14px; }
.popup-meta { color: var(--text-2); margin: 0 0 8px; }

/* WEB-I2: on a phone the same popup is driven by a fingertip. It must fit the
   viewport (a 220px min-width plus maplibre's own padding overflowed a small
   screen) and every row in it has to be a real 44px tap target. `width: 100%`
   is stated explicitly on the action buttons because WebKit derives a flex
   item's cross size from a clamped height through the aspect-ratio, which is
   how a row ends up narrower than its container (memory
   webkit-aspect-ratio-flex-gap). */
@media (max-width: 720px) {
  .maplibregl-popup-content {
    min-width: 0;
    max-width: min(92vw, 360px);
    padding: 12px;
  }
  .maplibregl-popup-close-button { font-size: 24px; padding: 0 8px; min-height: 44px; }
  .point-popup .point-actions { display: flex; flex-direction: column; gap: 6px; }
  .point-popup .point-actions button {
    width: 100%;
    min-height: 44px;
    text-align: left;
  }
}

/* WEB-I5 / WEB-I3: the two hazard lists in the planner panel. One row per
   entry, the text taking the free space and the buttons keeping their size;
   44px rows so a fingertip can hit them. */
.plan-block-list,
.plan-report-list {
  list-style: none;
  margin: 6px 0 8px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.plan-block-list li,
.plan-report-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font-size: 13px;
}
.plan-block-list li > label,
.plan-report-list li > span:first-child {
  flex: 1 1 auto;
  min-width: 0;
}
.plan-block-list li > .btn,
.plan-report-list li > .btn { flex: 0 0 auto; }

/* The plan profile legend's swatch (#plan-profile-legend). */
.legend-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 4px;
  vertical-align: -1px;
}
.stats-wrap { flex-wrap: wrap; }
.stats-wrap .stat { flex: 1 1 110px; }

/* --- share links (profile header; the ride share card in css/rides.css) --- */
/* N3-F17: the share link is a selectable, wrapping field rather than a
   one-line input that showed a third of it on a phone. */
.share-url {
  flex: 1 1 240px;
  min-width: 0;
  display: block;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
  word-break: break-all;
  user-select: all;
}
.shared-badge {
  margin: 0 0 4px;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.shared-by .rider-link, .shared-by a { color: var(--accent-ink); text-decoration: none; }
.shared-by .rider-link:hover, .shared-by a:hover { text-decoration: underline; }

/* ---------- public rider profile (#/rider/:handle) ---------- */
.rider-identity { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; min-width: 0; }
.rider-handle { color: var(--text-2); font-size: 14px; font-weight: 500; }
.doc-link { flex: 1; min-width: 0; display: block; color: inherit; text-decoration: none; }
.doc-link:hover .doc-name { color: var(--accent-ink); }
#view-rider .doc-list li { padding: 12px 14px; }
.empty-note { margin: 10px 0 2px; }
#view-rider .card h3 { color: var(--text-2); text-transform: uppercase; letter-spacing: 0.05em; font-size: 12px; }


/* ---------- responsive ---------- */

@media (max-width: 720px) {
  #topnav { gap: 8px; padding: 0 10px; }
  .brand-name { display: none; }
  /* The brand link collapses to the 22x22 mark once the name hides -
     pad its hit box to 44x44 without moving the mark visually. */
  .brand {
    min-width: 44px;
    min-height: 44px;
    justify-content: center;
    margin: 0 -6px;
  }
  .nav-links a { padding: 8px 9px; font-size: 14px; }

  /* Floating map controls (site UI audit, round 26 section 6): full
     44px targets instead of the desktop-density 40px. */
  .seg-btn { min-height: 44px; }

  /* The bare-map point popup ("Set start" / "Add stop" / "Set end" -
     design section 3's ?at= deep link) is full-width stacked text
     buttons; give each row a real tap height. */
  .point-actions button { min-height: 44px; padding: 10px; }
  .hazard-chips button { min-height: 44px; padding: 10px 14px; }

  /* Waypoint list-row controls sit in a tight flex row with little
     spare width, so grow their HIT area (not their visible box) into
     the row's own gap with an ::after box. */
  .wp-remove,
  .wp-handle,
  button.wp-tag {
    position: relative;
  }
  .wp-remove::after,
  button.wp-tag::after {
    content: '';
    position: absolute;
    inset: -6px -5px;
  }
  /* .wp-handle starts narrower (26px) than the others, so it needs more
     horizontal growth to clear 44px. */
  .wp-handle::after {
    content: '';
    position: absolute;
    inset: -6px -9px;
  }

  /* The checkbox stays a familiar small square (marked allow-small: the
     WCAG target-size "equivalent control" exception applies since the
     whole .check-row label already toggles it), but the row it sits in
     grows to a real 44px tap height. */
  .check-row input[type="checkbox"] { width: 24px; height: 24px; }
  .check-row { min-height: 44px; }


  /* Public rider profile (#/rider/:handle) — tighter spacing for a
     gloved thumb, header + list + stats strip all scaled down. */
  #view-rider.page-view { padding: 16px 12px 48px; }
  #view-rider .rider-identity h2 { font-size: 21px; margin: 6px 0 8px; }
  #view-rider .doc-list li { padding: 10px 12px; gap: 8px; }
  #view-rider .stats-wrap .stat { flex: 1 1 92px; padding: 8px 4px; }
}


/* Get-the-app page (#/get) */
.get-page { max-width: 560px; }
/* Round 227 #260: the store buttons (js/ui/store_buttons.js), one per line so
   a long German label never squeezes its neighbour. */
.store-links { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin: 4px 0 8px; }
.store-links .btn { max-width: 100%; text-align: center; }
.get-fine { margin-top: 18px; }

/* Invite link page (/i/<code>): the lead paragraph of each state carries the
   sentence the visitor reads first, so it is a size up from body copy. */
#view-invite .get-page > p:first-of-type,
#invite-lead,
#invite-done-lead { font-size: 16px; margin: 0 0 14px; }
/* #198: the device step. */
#invite-choice .btn-row { margin: 4px 0 8px; }
#invite-back { margin-top: 12px; }
.admin-detail-remove { margin: 8px 0 12px; }

/* ---- Admin dashboard (#/admin) ---- */
/* D8: the dashboard is a wide operator surface, not a 760px reading column. */
.admin-page { max-width: 1280px; margin: 0 auto; }
.admin-page h2 { margin: 8px 0 12px; }

.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 16px 0 0;
  border-bottom: 1px solid var(--line);
}
.admin-tab {
  padding: 10px 14px;
  min-height: 44px;
  background: transparent;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  color: var(--text-2);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.admin-tab:hover { color: var(--text); }
.admin-tab[aria-selected="true"] {
  color: var(--text);
  background: var(--surface);
  border-color: var(--line);
}
.admin-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* One section at a time; the users section is a two-column grid once there is
   room for the detail panel beside the table. R160 D4: 1200, not 1024 -- at
   1024 the docked panel left the seven-column users table 538px and it
   side-scrolled inside its own card. */
.admin-users-grid { display: grid; gap: 16px; align-items: start; }
.admin-users-main { min-width: 0; } /* or the table's overflow never kicks in */
.admin-detail { margin: 0; }
@media (min-width: 1200px) {
  .admin-users-grid { grid-template-columns: minmax(0, 1fr) minmax(320px, 400px); }
}

/* A sticky header needs a scroll container, so the wrap owns the scroll and
   the header row stays put while a long table scrolls under it. Only the
   list tables are tall; the detail tables keep their natural height. */
.admin-table-wrap { overflow: auto; }
.admin-scroll { max-height: min(70vh, 720px); }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table thead th { position: sticky; top: 0; z-index: 1; background: var(--surface); }
.admin-table th, .admin-table td {
  text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.admin-table th {
  color: var(--text-2); font-weight: 600; text-transform: uppercase;
  font-size: 11px; letter-spacing: 0.04em;
}
.admin-table td.num, .admin-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-user-row { cursor: pointer; }
.admin-user-row:hover, .admin-user-row:focus { background: var(--accent-soft); outline: none; }
.admin-doc-deleted td { color: var(--text-2); text-decoration: line-through; }
/* A revoked invite link stays listed for attribution, dimmed and tagged. */
.admin-link-revoked td { color: var(--text-2); }
.admin-chip { display: inline-block; padding: 1px 7px; margin: 1px 3px 1px 0;
  border: 1px solid var(--line); border-radius: 10px; font-size: 12px; }
.admin-link-url { display: flex; gap: 6px; align-items: center; }
/* The QR keeps its own white quiet zone whatever the livery: the vendor SVG
   paints white modules on transparent, which is unscannable on Night. */
.admin-live-qr { background: #fff; padding: 8px; width: max-content; border-radius: 6px; }

/* R160 D4: an admin form is a TOOLBAR, not a stack. The global rule near the
   top of this file (`input[type=text], input[type=number], select {width:100%}`)
   made a two-option Lifetime select span the whole 1280px card and turned every
   form into a column of full-width fields, so inside .admin-form each control
   states its own content width instead. */
.admin-form { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: flex-end; margin-bottom: 12px; }
.admin-field { display: flex; flex-direction: column; min-width: 0; }
/* `label` carries a global `display:block; margin-top:10px`. Inside a field the
   flex column owns the spacing, and the 10px would push the control off the
   submit button's baseline. */
.admin-field label { margin-top: 0; }
/* The same global rule gives controls `margin: 4px 0 2px`. align-items:flex-end
   aligns MARGIN boxes, so that 2px would float every field above the button. */
.admin-form input, .admin-form select { width: auto; margin: 2px 0 0; }
.admin-form select { min-width: 12ch; }
.admin-form input[type="text"], .admin-form input[type="number"] { min-width: 10ch; }
.admin-form input[type="datetime-local"] { min-width: 22ch; }
#invite-identity { min-width: 28ch; }
/* A note is the one field worth the leftover room; it is the last thing that
   should be clipped when the toolbar wraps. */
.admin-field-note { flex: 1 1 24ch; }
.admin-field-note input { width: 100%; }
/* Status and error lines are full-width sentences BELOW the toolbar, not
   members of it -- they are siblings of .admin-form, so nothing to do here
   beyond saying so. Under 640px the fields wrap on their own; no media query. */

/* Tables wrap where TEXT lives. nowrap stays the default (dates, counts and
   handles must not break), and only the prose-ish cells opt out. */
.admin-table td.wrap { white-space: normal; overflow-wrap: anywhere; }
/* The Link cell is a flex row inside a wrapping cell. The code is one word and
   must never break mid-word, so the URL keeps nowrap and the Copy button wraps
   under it instead; the cell's `wrap` is what lets the "created ..." meta line
   below it break. */
.admin-link-url { flex-wrap: wrap; }
.admin-link-url > .mono { white-space: nowrap; }

/* Card width discipline: a panel may never be wider than its column. .card
   already has box-sizing:border-box and 16px/18px padding, so the table's room
   is the card width less 36px; the wrap classes above are what make six columns
   fit at 1280 and 1024. .admin-table-wrap keeps overflow:auto for phones. */
.admin-panel.card { min-width: 0; }

/* Add dialog: name, icon filter and a wrapping icon grid. */
.location-dialog { max-width: 520px; max-height: calc(100dvh - 32px); overflow: auto; }
.location-dialog-label { display: grid; gap: 6px; margin-top: 10px; font-weight: 600; }
.location-dialog-name, .location-dialog-filter { width: 100%; min-height: 44px; font: inherit; }
.location-dialog-preview { display: flex; align-items: center; gap: 8px; margin-top: 12px; overflow-wrap: anywhere; }
.location-dialog-preview-icon { flex: none; width: 28px; height: 28px; }
.location-dialog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; margin-top: 10px; max-height: min(36dvh, 260px); overflow: auto; }
.location-dialog-icon { display: grid; place-items: center; min-width: 44px; min-height: 44px; padding: 0; border: 1px solid var(--line); border-radius: var(--r-2); background: transparent; color: var(--text); cursor: pointer; }
.location-dialog-icon svg { width: 24px; height: 24px; }
.location-dialog-icon[aria-pressed="true"] { border-color: var(--accent); outline: 2px solid var(--accent); outline-offset: -2px; }
.location-dialog-error { margin-top: 10px; }

/* #258: the Report action on the public rider and share pages, its sheet,
   and the admin rider-report queue. */
.report-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 8px 0; }
.report-bar .report-sign-in { margin: 0; }
.report-bar .report-note { margin: 0; flex-basis: 100%; }
.report-form { display: grid; gap: 12px; }
.report-reasons { border: 0; margin: 0; padding: 0; display: grid; gap: 4px; }
.report-reason, .report-block { display: flex; align-items: flex-start; gap: 10px; min-height: 44px; padding: 6px 0; cursor: pointer; }
.report-reason input, .report-block input { flex: none; margin-top: 3px; width: 18px; height: 18px; }
.report-block-title, .report-block-body { display: block; }
.report-note textarea { width: 100%; font: inherit; resize: vertical; }
.report-visibility { margin: 0; }
.admin-reports { display: grid; gap: 16px; }
.admin-report-group { border-top: 1px solid var(--line); padding-top: 12px; min-width: 0; }
.admin-report { border-left: 3px solid var(--line); padding: 4px 0 4px 12px; margin: 10px 0; overflow-wrap: anywhere; }
.admin-report p { margin: 2px 0; }
.admin-report-head { font-weight: 600; }
.admin-report-note { white-space: pre-wrap; }
.admin-report-shares { list-style: none; margin: 4px 0 8px; padding: 0; display: grid; gap: 4px; }
.admin-report-share { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; overflow-wrap: anywhere; }
.admin-report-lookup { margin-bottom: 12px; }

/* Beta applications (js/views/admin_beta.js): the coverage tables wrap into
   as many columns as fit, the list is one <details> per applicant. */
.admin-beta-counts { font-weight: 600; margin: 0 0 12px; }
.admin-beta-summary { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 12px 16px; margin-bottom: 16px; }
.admin-beta-sum { min-width: 0; overflow-x: auto; }
.admin-beta-list { display: grid; gap: 6px; margin-top: 8px; }
.admin-beta-row { border: 1px solid var(--line); border-radius: 8px; padding: 0 12px; min-width: 0; }
.admin-beta-row[data-status='declined'] .admin-beta-head { color: var(--text-2); }
.admin-beta-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; min-height: 44px; padding: 10px 0; cursor: pointer; overflow-wrap: anywhere; }
.admin-beta-email { font-weight: 600; }
.admin-beta-detail { display: grid; grid-template-columns: minmax(8ch, max-content) minmax(0, 1fr); gap: 4px 12px; margin: 0 0 10px; font-size: 13.5px; }
.admin-beta-detail dt { color: var(--text-2); }
.admin-beta-detail dd { margin: 0; overflow-wrap: anywhere; }
.admin-beta-actions { display: flex; flex-wrap: wrap; gap: 8px; padding-bottom: 12px; }
