/* Route Planner v2.0 — tokens and components from
   docs/mockups/route-planner__design-spec__v2.0__2026-11-22.md (light theme only). */

:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-subtle: #f8fafc;
  --border: #e2e8f0;
  --border-control: #7d8ba1;
  --text-1: #0f172a;
  --text-2: #475569;
  --text-3: #64748b;
  --accent: #1d4ed8;
  --accent-hover: #1e40af;
  --accent-soft: #eff4ff;
  --route-alt: #7d8ba1;
  --ok: #15803d;
  --warn-bg: #fffbeb;
  --warn-border: #f59e0b;
  --warn-text: #92400e;
  --err-bg: #fef2f2;
  --err-border: #ef4444;
  --err-text: #991b1b;
  --map-land: #eef2f5;
  --map-outside: #e3e8ee;
  --map-water: #d6e4f0;
  --skeleton: #e9eef4;

  --radius-control: 8px;
  --radius-panel: 12px;
  --shadow: 0 4px 16px rgb(15 23 42 / 10%);
  --control-h: 44px;
  --topbar-h: 56px;
  --gutter: 16px;
  --panel-w: 400px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --dur: 180ms;

  --font: Inter, "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text-1);
  font-family: var(--font);
  font-size: 14px;
  line-height: 20px;
  -webkit-font-smoothing: antialiased;
}

body.is-planner {
  height: 100dvh;
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

.num {
  font-variant-numeric: tabular-nums;
}

:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.only-mobile {
  display: none;
}

.noscript {
  padding: 24px;
}

/* ------------------------------------------------------------------ top bar */

.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 20;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  color: var(--text-1);
  text-decoration: none;
  font-size: 16px;
  font-weight: 700;
  line-height: 24px;
  padding-right: 4px;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--accent);
  display: inline-grid;
  place-items: center;
}

.brand-mark svg {
  width: 18px;
  height: 18px;
}

.nav {
  display: flex;
  height: 100%;
  gap: 4px;
  margin-left: 32px;
}

.nav a {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-width: 44px;
  padding: 0 12px;
  color: var(--text-2);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}

.nav a:hover {
  color: var(--text-1);
}

.nav a[aria-current="page"] {
  color: var(--accent);
  font-weight: 600;
}

.nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--accent);
}

.topbar-end {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.avatar-button {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid var(--border-control);
  background: var(--surface);
  display: inline-grid;
  place-items: center;
  color: var(--text-2);
  text-decoration: none;
  overflow: hidden;
  padding: 0;
}

.avatar-button img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ------------------------------------------------------------------ buttons */

.btn {
  min-height: var(--control-h);
  border-radius: var(--radius-control);
  padding: 0 16px;
  border: 1px solid var(--border-control);
  background: var(--surface);
  color: var(--text-1);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover {
  background: var(--surface-subtle);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-primary:disabled,
.btn:disabled {
  background: var(--border);
  border-color: var(--border);
  color: var(--text-3);
  cursor: not-allowed;
}

.btn-block {
  width: 100%;
}

.btn-ghost {
  border-color: transparent;
  background: transparent;
  color: var(--accent);
  font-weight: 500;
  padding: 0 8px;
}

.btn-ghost:hover {
  background: var(--accent-soft);
}

.btn-link {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-weight: 500;
  min-height: 44px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: var(--radius-control);
}

.btn-link:hover {
  text-decoration: underline;
}

.icon-btn {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: 999px;
  border: 1px solid var(--border-control);
  background: var(--surface);
  color: var(--text-1);
  display: inline-grid;
  place-items: center;
  padding: 0;
}

.icon-btn:disabled {
  color: var(--text-3);
  border-color: var(--border);
  cursor: not-allowed;
}

button svg,
a svg {
  width: 20px;
  height: 20px;
  flex: none;
}

.btn-link svg {
  width: 18px;
  height: 18px;
}

/* ------------------------------------------------------------------- layout */

.planner {
  position: relative;
  height: calc(100dvh - var(--topbar-h));
  display: grid;
  grid-template-columns: var(--panel-w) 1fr;
  gap: var(--gutter);
  padding: var(--gutter);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-panel);
  padding: 16px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden auto;
}

.panel-title {
  font-size: 20px;
  line-height: 28px;
  font-weight: 700;
  margin-bottom: 8px;
}

.section-title {
  font-size: 16px;
  line-height: 24px;
  font-weight: 700;
}

.divider {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 6px 0;
}

.map-area {
  position: relative;
  min-height: 0;
  border-radius: var(--radius-panel);
  overflow: hidden;
  background: var(--map-outside);
  border: 1px solid var(--border);
}

/* ------------------------------------------------------------------- fields */

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.label {
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  color: var(--text-2);
}

.hint {
  font-size: 12px;
  line-height: 16px;
  color: var(--text-3);
}

.hint-error {
  color: var(--err-text);
}

.input,
.select {
  height: var(--control-h);
  width: 100%;
  border: 1px solid var(--border-control);
  border-radius: var(--radius-control);
  background: var(--surface);
  padding: 0 12px;
  font-size: 14px;
  color: var(--text-1);
  min-width: 0;
}

.input::placeholder {
  color: var(--text-3);
}

.input:focus-visible,
.select:focus-visible {
  outline-offset: 0;
  border-color: var(--accent);
}

.input[aria-invalid="true"] {
  border-color: var(--err-border);
  box-shadow: inset 0 0 0 1px var(--err-border);
}

.select {
  appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%230F172A' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 8l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 18px 18px;
  text-overflow: ellipsis;
}

.select:disabled,
.input:disabled {
  background-color: var(--surface-subtle);
  color: var(--text-3);
  border-color: var(--border);
  cursor: not-allowed;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: stretch;
  border: 1px solid var(--border-control);
  border-radius: var(--radius-control);
  background: var(--surface);
  height: var(--control-h);
  min-width: 0;
}

.input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.input-wrap.is-invalid {
  border-color: var(--err-border);
  box-shadow: inset 0 0 0 1px var(--err-border);
}

.input-wrap .input {
  border: 0;
  height: 44px;
  margin: -1px 0 -1px -1px;
  padding-left: 13px;
  background: transparent;
}

.input-wrap .input:focus-visible {
  outline: none;
}

.input-suffix {
  align-self: center;
  padding-right: 12px;
  color: var(--text-2);
  white-space: nowrap;
}

.trail-btn {
  width: 44px;
  min-width: 44px;
  height: 44px;
  margin: -1px -1px -1px 0;
  border: 0;
  border-left: 1px solid var(--border);
  background: transparent;
  color: var(--text-1);
  display: grid;
  place-items: center;
  border-radius: 0 var(--radius-control) var(--radius-control) 0;
  margin: 0;
}

.trail-btn[aria-pressed="true"] {
  background: var(--accent-soft);
  color: var(--accent);
}

.trail-btn svg {
  width: 20px;
  height: 20px;
}

.spinner {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
  align-self: center;
  margin-right: 8px;
  flex: none;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* place fields */

.trip {
  display: grid;
  grid-template-columns: 1fr 44px;
  column-gap: 12px;
  row-gap: 6px;
}

.trip .field {
  grid-column: 1;
}

.swap {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  margin-top: 18px;
}

.combo {
  position: relative;
}

.listbox {
  position: absolute;
  z-index: 30;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  box-shadow: var(--shadow);
  max-height: 264px;
  overflow: auto;
}

.listbox-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.listbox-group {
  padding: 6px 8px 2px;
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  color: var(--text-2);
}

.option {
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  line-height: 18px;
}

.option-name {
  flex: 1;
  min-width: 0;
}

.option-cc {
  flex: none;
  margin-left: 8px;
  font-size: 11px;
  line-height: 16px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-3);
}

.option[aria-selected="true"] .option-cc {
  color: inherit;
  opacity: 0.8;
}

.option[aria-selected="true"] {
  background: var(--accent-soft);
  color: var(--accent);
}

.listbox-state {
  padding: 10px 8px;
  color: var(--text-3);
}

.stops {
  display: flex;
  flex-direction: column;
  gap: 8px;
  grid-column: 1 / span 2;
}

.stop-row {
  display: grid;
  grid-template-columns: 24px 1fr 44px;
  gap: 4px;
  align-items: end;
}

.drag-handle {
  height: 44px;
  display: grid;
  place-items: center;
  color: var(--text-3);
  cursor: grab;
}

.add-stop {
  align-self: flex-start;
  margin-left: -8px;
}

.depart-row {
  display: grid;
  grid-template-columns: 1fr 112px;
  gap: 12px;
  align-items: end;
}

/* vehicle */

.vehicle {
  position: relative;
}

.vehicle-picker {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.vehicle-helper {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0 8px;
  min-height: 44px;
}

.vehicle-helper .hint {
  flex: 1 1 160px;
  min-width: 0;
}

.about-btn {
  margin-right: -8px;
  font-size: 12px;
  white-space: nowrap;
}

.about-pop {
  position: absolute;
  z-index: 40;
  left: 0;
  right: 0;
  bottom: calc(100% - 4px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  box-shadow: var(--shadow);
  padding: 8px 12px;
  font-size: 12px;
  line-height: 16px;
  color: var(--text-2);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* powertrain filter chips (toggle buttons, single select) */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.chip {
  min-height: 44px;
  min-width: 44px;
  padding: 0 10px;
  border: 1px solid var(--border-control);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.chip:hover {
  background: var(--surface-subtle);
}

.chip[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
  color: var(--accent);
  font-weight: 600;
}

/* suggestion list and variant step */

.vehicle-pop {
  position: absolute;
  z-index: 30;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  box-shadow: var(--shadow);
  padding: 4px;
  max-height: min(300px, 38vh);
  overflow: auto;
}

.vehicle-pop[hidden] {
  display: none;
}

.vehicle-option {
  gap: 8px;
  padding-top: 6px;
  padding-bottom: 6px;
}

.option-name {
  display: flex;
  flex-direction: column;
}

.option-main {
  font-weight: 500;
}

.option-sub {
  font-size: 12px;
  line-height: 16px;
  color: var(--text-2);
}

.option[aria-selected="true"] .option-sub {
  color: inherit;
  opacity: 0.85;
}

.option-go {
  display: inline-flex;
  color: var(--text-3);
}

.option[aria-selected="true"] .option-go {
  color: inherit;
}

.step-error {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
}

.step-head {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 4px 0 0;
}

.step-head h3 {
  font-size: 14px;
  line-height: 20px;
  font-weight: 700;
}

.variant-cards {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.variant-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-height: 52px;
  padding: 6px 12px;
  text-align: left;
  border: 1px solid var(--border-control);
  border-radius: var(--radius-control);
  background: var(--surface);
}

.variant-card:hover {
  background: var(--accent-soft);
}

.variant-card-title {
  font-weight: 600;
}

.variant-card-specs {
  font-size: 12px;
  line-height: 16px;
  color: var(--text-2);
}

.override-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: start;
}

.vehicle-row {
  height: var(--control-h);
  width: 100%;
  border: 1px solid var(--border-control);
  border-radius: var(--radius-control);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  text-align: left;
}

.vehicle-row .placeholder {
  color: var(--text-3);
}

.vehicle-row-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inline-alert {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  font-size: 12px;
  line-height: 16px;
  color: var(--warn-text);
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  border-radius: var(--radius-control);
  padding: 6px 4px 6px 10px;
}

.inline-alert.is-error {
  color: var(--err-text);
  background: var(--err-bg);
  border-color: var(--err-border);
}

.inline-alert .btn {
  min-height: 36px;
}

/* segmented control */

.segmented {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border: 1px solid var(--border-control);
  border-radius: var(--radius-control);
  background: var(--surface-subtle);
  padding: 0;
  height: var(--control-h);
  overflow: hidden;
}

.segmented.is-three {
  grid-template-columns: repeat(3, 1fr);
}

.seg {
  border: 0;
  background: transparent;
  color: var(--text-2);
  font-weight: 500;
  height: 44px;
  margin: -1px 0;
  border-radius: var(--radius-control);
}

.seg[aria-checked="true"] {
  background: var(--surface);
  color: var(--accent);
  font-weight: 600;
  box-shadow: inset 0 0 0 2px var(--accent);
}

.seg:focus-visible {
  outline-offset: -4px;
}

/* price + toggle */

.price-row {
  display: grid;
  grid-template-columns: 176px 1fr;
  gap: 12px;
  align-items: end;
}

.price-row.is-hybrid {
  grid-template-columns: 1fr 1fr;
}

.price-row.is-hybrid .toggle {
  grid-column: 1 / -1;
}

/* Battery charge at start (BEV / plug-in hybrid) shares the price row. */
.price-row.has-soc {
  grid-template-columns: 1fr 1fr;
}

.price-row.has-soc .toggle {
  grid-column: auto;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  border: 0;
  background: transparent;
  padding: 0 4px;
  font-weight: 500;
  border-radius: var(--radius-control);
  text-align: left;
}

.toggle-track {
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: var(--border-control);
  position: relative;
  flex: none;
  transition: background var(--dur) var(--ease);
}

.toggle-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #fff;
  transition: transform var(--dur) var(--ease);
}

.toggle[aria-checked="true"] .toggle-track {
  background: var(--accent);
}

.toggle[aria-checked="true"] .toggle-track::after {
  transform: translateX(16px);
}

/* more options */

.more-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  border: 0;
  background: transparent;
  padding: 0 4px;
  width: 100%;
  text-align: left;
  border-radius: var(--radius-control);
}

.more-toggle strong {
  font-size: 14px;
  font-weight: 600;
}

.more-toggle svg {
  width: 20px;
  height: 20px;
  transition: transform var(--dur) var(--ease);
}

.more-toggle[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.more-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 0 8px;
}

.speeds {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.vehicle-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 44px;
}

.vehicle-line {
  min-width: 0;
  font-weight: 500;
  /* One line: long EU variant labels (name, years) must not break the no-scroll budget;
     the full text is in the title tooltip and in the accessible description. */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* CTA */

.cta {
  margin-top: auto;
  padding-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cta-hint {
  font-size: 13px;
  line-height: 18px;
  color: var(--text-2);
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ------------------------------------------------------------ trip summary */

.summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  padding: 8px 8px 8px 12px;
  min-height: 60px;
}

.summary-title {
  font-size: 16px;
  line-height: 24px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.summary-sub {
  font-size: 12px;
  line-height: 16px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.summary-text {
  min-width: 0;
}

.tag-muted {
  display: inline-block;
  margin-top: 4px;
  font-size: 12px;
  line-height: 16px;
  color: var(--text-2);
  background: var(--border);
  border-radius: 999px;
  padding: 2px 8px;
}

/* ------------------------------------------------------------------ results */

.results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 16px 0 12px;
}

.results-head .select {
  width: 190px;
}

.cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
  /* Short viewports: the list scrolls inside the panel so the actions below stay reachable. */
  min-height: 0;
  overflow-y: auto;
  padding: 2px;
  margin: -2px;
  flex: 0 1 auto;
}

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius-panel);
  background: var(--surface);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.card:hover {
  border-color: var(--border-control);
}

.card.is-selected {
  border: 2px solid var(--accent);
}

.card-main {
  padding: 12px 14px;
  border-radius: var(--radius-panel);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card.is-selected .card-main {
  padding: 13px 13px 8px;
}

.card-main:focus-visible {
  outline-offset: -2px;
}

.card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  flex-wrap: wrap;
}

.badge {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  border: 2px solid var(--route-alt);
  color: var(--text-2);
  background: var(--surface);
  flex: none;
}

.badge.is-selected {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.card-name {
  font-size: 16px;
  line-height: 24px;
  font-weight: 700;
  margin-right: 4px;
}

.tag {
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
  border-radius: 999px;
  padding: 4px 10px;
  background: var(--surface-subtle);
  color: var(--text-2);
  border: 1px solid var(--border);
}

.tag.is-accent {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: transparent;
}

.tag.is-warn {
  background: var(--warn-bg);
  color: var(--warn-text);
  border-color: var(--warn-border);
}

.kpis {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.16fr) minmax(0, 0.92fr);
  gap: 12px 4px;
}

.kpi {
  min-width: 0;
  /* Lets .kpi-value shrink to its column: round-trip totals such as
     "102.2 kWh" are wider than one-way values. */
  container-type: inline-size;
}

.kpi-label {
  font-size: 12px;
  line-height: 16px;
  color: var(--text-2);
}

.kpi-value {
  /* ~5.4em of text must fit the column (17cqi keeps "102.2 kWh" inside). */
  font-size: min(20px, 17cqi);
  line-height: 28px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.kpi-value.is-warn {
  color: var(--warn-text);
}

.kpi-sub {
  font-size: 12px;
  line-height: 16px;
  letter-spacing: -0.01em;
  color: var(--text-3);
  overflow-wrap: anywhere;
}

.kpi-battery {
  white-space: nowrap;
  color: var(--text-2);
}

.card-foot {
  border-top: 1px solid var(--border);
  margin: 0 13px;
  padding: 2px 0;
}

.card-foot .btn-link {
  margin-left: -8px;
}

.card-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 2px 8px;
}

.card-line strong {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.card-delta {
  margin-left: auto;
  font-size: 12px;
  line-height: 16px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.results-foot {
  margin-top: auto;
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footnote {
  font-size: 12px;
  line-height: 16px;
  color: var(--text-2);
}

.saved-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  color: var(--text-2);
}

.prompt {
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--surface-subtle);
}

.prompt-actions {
  display: flex;
  gap: 8px;
}

/* skeleton */

.skeleton-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-panel);
  background: var(--surface-subtle);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sk {
  height: 12px;
  border-radius: 999px;
  background: var(--skeleton);
}

.sk-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px 24px;
  margin-top: 8px;
}

.loading-head {
  margin: 16px 0 12px;
}

/* ------------------------------------------------------------------ banners */

.banner {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 4px 10px;
  padding: 10px 12px 10px 14px;
  border-radius: var(--radius-control);
  border: 1px solid;
  border-left-width: 4px;
  margin-top: 12px;
}

.banner svg {
  width: 22px;
  height: 22px;
  margin-top: 1px;
}

.banner-title {
  font-weight: 700;
  font-size: 14px;
  line-height: 22px;
}

.banner-body {
  grid-column: 2;
  font-size: 13px;
  line-height: 18px;
  color: var(--text-1);
}

.banner-actions {
  grid-column: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 6px;
}

.banner-warn {
  background: var(--warn-bg);
  border-color: var(--warn-border);
  color: var(--warn-text);
}

.banner-err {
  background: var(--err-bg);
  border-color: var(--err-border);
  color: var(--err-text);
}

.after-banner {
  margin-top: 12px;
  font-size: 12px;
  line-height: 16px;
  color: var(--text-2);
}

/* ---------------------------------------------------------------- map stuff */

.map-canvas {
  position: absolute;
  inset: 0;
  background: var(--map-outside);
  font: inherit;
}

.map-canvas.is-picking,
.map-canvas.is-picking .maplibregl-canvas-container.maplibregl-interactive,
.map-canvas.is-picking .maplibregl-canvas {
  cursor: crosshair !important;
}

/* The basemap is muted in map.js (same look the raster tiles had via a CSS
   filter); routes share its WebGL canvas, so no filter here. */
.maplibregl-map {
  font-family: var(--font);
  background: var(--map-outside);
}

.maplibregl-ctrl.maplibregl-ctrl-attrib {
  font-size: 11px;
  background: rgb(255 255 255 / 85%);
  color: var(--text-2);
}

.maplibregl-ctrl-attrib a {
  color: var(--text-2);
}

.map-dim {
  position: absolute;
  inset: 0;
  background: rgb(244 246 249 / 55%);
  z-index: 450;
  pointer-events: none;
}

.map-overlay {
  position: absolute;
  z-index: 500;
}

.map-card {
  background: var(--surface);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow);
  padding: 12px 16px;
}

.map-empty {
  top: 16px;
  left: 16px;
  max-width: 360px;
}

.map-empty strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
}

.map-controls {
  top: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.map-btn-group {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--radius-control);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.map-btn {
  width: 44px;
  height: 44px;
  border: 0;
  background: var(--surface);
  display: grid;
  place-items: center;
  color: var(--text-1);
  padding: 0;
}

.map-btn + .map-btn {
  border-top: 1px solid var(--border);
}

.map-btn:hover {
  background: var(--surface-subtle);
}

.map-btn[aria-pressed="true"] {
  color: var(--accent);
  background: var(--accent-soft);
}

.map-btn:focus-visible {
  outline-offset: -3px;
}

.map-btn svg {
  width: 20px;
  height: 20px;
}

.map-legend {
  left: 16px;
  bottom: 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 13px;
  color: var(--text-1);
  padding: 10px 16px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.legend-line {
  width: 28px;
  height: 4px;
  border-radius: 4px;
  background: var(--route-alt);
}

.legend-line.is-selected {
  height: 5px;
  background: var(--accent);
}

.pick-banner {
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 8px 8px 16px;
  white-space: nowrap;
}

.map-progress {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 340px;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.progress-track {
  height: 6px;
  border-radius: 999px;
  background: var(--skeleton);
  overflow: hidden;
  position: relative;
}

.progress-bar {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 40%;
  border-radius: 999px;
  background: var(--accent);
  animation: indeterminate 1.4s var(--ease) infinite;
}

@keyframes indeterminate {
  from {
    left: -40%;
  }
  to {
    left: 100%;
  }
}

.tiles-note {
  left: 16px;
  bottom: 24px;
  font-size: 12px;
  color: var(--text-2);
}

/* Map markers (MapLibre positions them; later DOM order paints on top) */

.pin-icon {
  width: 20px;
  height: 20px;
  z-index: 1;
}

.pin-icon.is-destination {
  z-index: 2;
}

.route-badge-icon {
  width: 44px;
  height: 44px;
  z-index: 3;
}

.pin {
  display: block;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: 3px solid #fff;
  box-shadow: 0 1px 4px rgb(15 23 42 / 35%);
}

.pin-origin {
  background: var(--text-1);
}

.pin-destination {
  background: var(--accent);
}

.pin-stop {
  background: #fff;
  border: 4px solid var(--text-1);
  width: 16px;
  height: 16px;
  margin: 2px;
}

.stop-label {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
  background: var(--surface);
  border-radius: var(--radius-control);
  box-shadow: var(--shadow);
  color: var(--text-1);
  font-weight: 600;
  font-size: 14px;
  line-height: 20px;
  padding: 4px 12px;
}

.route-badge {
  width: 44px;
  height: 44px;
  border: 0;
  padding: 0;
  background: transparent;
  display: grid;
  place-items: center;
  border-radius: 999px;
}

.route-badge span {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-2);
  background: #fff;
  border: 2px solid var(--route-alt);
  box-shadow: 0 1px 3px rgb(15 23 42 / 25%);
}

.is-selected .route-badge span {
  background: var(--accent);
  border-color: #fff;
  color: #fff;
  width: 32px;
  height: 32px;
  font-size: 13px;
}

/* ------------------------------------------------------------ details sheet */

.details {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  height: min(432px, calc(100% - 140px));
  z-index: 600;
  background: var(--surface);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  animation: sheet-in var(--dur) var(--ease);
}

@keyframes sheet-in {
  from {
    transform: translateY(16px);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

.details-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px 8px 24px;
  border-bottom: 1px solid var(--border);
  min-height: 60px;
}

.details-head h2 {
  font-size: 16px;
  line-height: 24px;
  font-weight: 700;
}

.details-head .hint {
  font-size: 13px;
  color: var(--text-2);
}

.details-head .icon-btn {
  margin-left: auto;
  border-radius: var(--radius-control);
}

.details-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  grid-template-rows: minmax(0, 1fr);
  gap: 0;
  overflow: auto;
}

.chart-col {
  padding: 12px 24px 12px;
  border-right: 1px solid var(--border);
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chart-head {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.chart-head h3 {
  font-size: 14px;
  font-weight: 700;
}

.chart-legend {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-2);
}

.swatch-line {
  width: 20px;
  height: 3px;
  background: var(--accent);
  border-radius: 2px;
}

.swatch-line.is-battery {
  background: repeating-linear-gradient(90deg, #0f766e 0 7px, transparent 7px 11px);
}

.swatch-area {
  width: 16px;
  height: 10px;
  background: #e2e8f0;
  border: 1px solid #94a3b8;
  border-radius: 2px;
}

.chart-wrap {
  position: relative;
  flex: 1;
  /* Measured by the app; the SVG is out of flow so it never sizes the box. */
  min-height: 160px;
}

.chart-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

.chart-svg text {
  font-size: 11px;
  fill: var(--text-2);
  font-family: var(--font);
  font-variant-numeric: tabular-nums;
}

.chart-readout {
  position: absolute;
  top: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  box-shadow: var(--shadow);
  padding: 6px 10px;
  font-size: 12px;
  line-height: 16px;
  white-space: nowrap;
  pointer-events: none;
}

.chart-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.data-table th,
.data-table td {
  text-align: right;
  padding: 4px 8px;
  border-bottom: 1px solid var(--border);
}

.data-table th:first-child,
.data-table td:first-child {
  text-align: left;
}

.energy-col {
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.energy-col h3 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 4px;
}

.energy-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 14px;
  line-height: 22px;
}

.energy-row .num {
  font-weight: 600;
}

.energy-row .is-ok {
  color: var(--ok);
}

.energy-total {
  border-top: 1px solid var(--border);
  padding-top: 8px;
  margin-top: 4px;
  font-size: 13px;
  color: var(--text-2);
}

.energy-total .num {
  font-weight: 600;
}

.energy-total-hint {
  margin-top: 0;
}

.road-bar {
  display: flex;
  gap: 3px;
  height: 12px;
  margin: 6px 0 4px;
}

.road-bar span {
  border-radius: 3px;
}

.road-town {
  background: #93c5fd;
}

.road-rural {
  background: #3b82f6;
}

.road-motorway {
  background: var(--accent);
}

.road-other {
  background: var(--route-alt);
}

/* ---------------------------------------------------------- utility pages */

.page {
  max-width: 880px;
  margin: 0 auto;
  padding: 24px 16px 48px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.page h1 {
  font-size: 20px;
  line-height: 28px;
  font-weight: 700;
}

.page-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-panel);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.page-card h2 {
  font-size: 16px;
  line-height: 24px;
  font-weight: 700;
}

.page-card p {
  color: var(--text-2);
}

/* About data: one block per source; the licence notices are shown in full. */
.data-sources {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0;
}

.data-source dt {
  font-weight: 700;
}

.data-source dd {
  margin: 2px 0 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: var(--text-2);
}

.data-source .data-use {
  color: var(--text-1, inherit);
}

.data-source .data-notice {
  font-size: 13px;
  line-height: 18px;
}

.data-source a,
.page-card p a {
  color: var(--accent);
  font-weight: 500;
  align-self: flex-start;
}

.data-source a:hover,
.page-card p a:hover {
  color: var(--accent-hover);
}

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

.fact span {
  display: block;
  font-size: 12px;
  line-height: 16px;
  color: var(--text-2);
}

.fact strong {
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.chips li {
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  border-radius: 999px;
  padding: 4px 12px;
}

.dev-note {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12px;
  color: var(--text-2);
}

/* --------------------------------------------------------------- dialogs */

.fullscreen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--surface);
  display: flex;
  flex-direction: column;
}

.fullscreen-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 8px 2px 16px;
  min-height: 56px;
  border-bottom: 1px solid var(--border);
}

.fullscreen-head h2 {
  font-size: 16px;
  font-weight: 700;
  margin-right: auto;
}

.fullscreen-body {
  flex: 1;
  overflow: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.fullscreen .vehicle-pop,
.fullscreen .about-pop {
  position: static;
  max-height: none;
  box-shadow: none;
  border: 0;
  padding: 0;
}

.fullscreen .about-pop {
  padding: 8px 0 0;
}

/* ------------------------------------------------------------------ tablet */

@media (max-width: 1279px) {
  :root {
    --panel-w: 360px;
  }
  .details-body {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none;
  }
  .chart-col {
    border-right: 0;
    border-bottom: 1px solid var(--border);
    min-height: 260px;
  }
}

/* ------------------------------------------------------------------ mobile */

@media (max-width: 767px) {
  :root {
    --topbar-h: 48px;
  }
  .topbar {
    padding: 0 8px 0 12px;
  }
  .nav,
  .only-desktop {
    display: none;
  }
  .only-mobile {
    display: contents;
  }
  .planner {
    display: block;
    padding: 0;
    height: calc(100dvh - var(--topbar-h));
  }
  .map-area {
    position: absolute;
    inset: 0;
    border-radius: 0;
    border: 0;
    /* Keep the map's own z-indexes below the bottom sheet… */
    isolation: isolate;
  }
  /* …except while the full-screen details dialog is open. */
  .map-area:has(.details) {
    z-index: 1200;
  }
  /* The bottom sheet covers the map's lower edge, so keep the OSM attribution
     (required by the data licence) visible in the free top-left corner. */
  .map-area .maplibregl-ctrl-bottom-right {
    top: 0;
    bottom: auto;
    right: auto;
    left: 0;
  }
  .sheet {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 700;
    background: var(--surface);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 16px rgb(15 23 42 / 12%);
    display: flex;
    flex-direction: column;
    transition: height var(--dur) var(--ease);
    border: 0;
    padding: 0;
  }
  .sheet-handle {
    height: 44px;
    min-height: 44px;
    margin-bottom: -12px;
    width: 100%;
    border: 0;
    background: transparent;
    display: grid;
    place-items: center;
    touch-action: none;
    cursor: grab;
    padding: 0;
  }
  .sheet-handle:focus-visible {
    outline-offset: -4px;
  }
  .sheet-handle span {
    width: 36px;
    height: 4px;
    border-radius: 4px;
    background: var(--border-control);
  }
  .cards {
    overflow: visible;
    min-height: auto;
    padding: 0;
    margin: 0;
  }
  .sheet .panel-body {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 0 16px 16px;
    display: flex;
    flex-direction: column;
  }
  .panel-title {
    font-size: 28px;
    line-height: 36px;
  }
  .map-empty,
  .map-legend {
    display: none;
  }
  .map-controls {
    top: 12px;
    right: 12px;
  }
  .pick-banner {
    top: 12px;
    left: 12px;
    right: 12px;
    transform: none;
    white-space: normal;
  }
  .map-progress {
    top: 24%;
    width: calc(100% - 48px);
  }
  .details {
    position: fixed;
    inset: 0;
    height: auto;
    border-radius: 0;
    z-index: 1000;
  }
  .details-head {
    padding-left: 16px;
  }
  .chart-col,
  .energy-col {
    padding: 12px 16px;
  }
  .kpi-value {
    font-size: min(18px, 17cqi);
  }
}

/* Short desktop viewports (e.g. 1280x800): tighter rhythm; Departure moves
   under More options so the panel still never scrolls. */
@media (min-width: 768px) and (max-height: 860px) {
  .field {
    gap: 2px;
  }
  .divider {
    margin: 4px 0;
  }
  .panel-title {
    margin-bottom: 4px;
  }
  .results-head {
    margin: 12px 0 8px;
  }
  /* The battery charge field adds a hint line (remembered / error): win it back. */
  .price-row.has-soc {
    row-gap: 4px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .progress-bar {
    animation: none;
    left: 0;
    width: 100%;
    opacity: 0.35;
  }
}

.chart-view {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.skip-link {
  position: absolute;
  left: 8px;
  top: -64px;
  z-index: 3000;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 0 16px;
  background: var(--surface);
  color: var(--accent);
  border: 2px solid var(--accent);
  border-radius: var(--radius-control);
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus {
  top: 8px;
}

#main:focus {
  outline: none;
}

.fact-sub {
  display: block;
  font-size: 12px;
  line-height: 16px;
  color: var(--text-3);
}

/* ------------------------------------------------------ motorway vignettes */

.vignette-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.vignette {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: var(--control-h);
  min-height: 44px;
  border: 1px solid var(--border-control);
  border-radius: var(--radius-control);
  background: var(--surface);
  color: var(--text-2);
  font-weight: 500;
  padding: 0 12px;
}

.vignette:hover {
  background: var(--surface-subtle);
}

.vignette[aria-pressed="true"] {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
  font-weight: 600;
}

/* Fixed-width slot, so the label does not jump when the check appears. */
.vignette-check {
  display: inline-flex;
  width: 16px;
  height: 16px;
}

.vignette-check svg {
  width: 16px;
  height: 16px;
}

.vignettes-title {
  margin-top: 12px;
}

.vignette-list {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  line-height: 18px;
  color: var(--text-2);
}

/* Muted note under the "N routes" header (fewer than three distinct routes). */
.results-note {
  margin: -6px 0 10px;
}

/* Calculate and "Back to results" share one row, so Edit mode needs no extra height. */
.cta-actions {
  display: flex;
  gap: 8px;
}

.cta-actions .btn-primary {
  flex: 1 1 auto;
  width: auto;
}

.cta-actions .btn-ghost {
  flex: none;
}

/* -------------------------------------------------------------- round trip */

.round-trip {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.round-trip .toggle {
  align-self: flex-start;
}

.round-trip-options {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stay-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* A checkbox that is a real 44px target (a native one is 16px). */
.check-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  align-self: flex-start;
  min-height: 44px;
  border: 0;
  background: transparent;
  padding: 0 4px;
  font-weight: 500;
  border-radius: var(--radius-control);
  text-align: left;
}

.check-box {
  width: 20px;
  height: 20px;
  flex: none;
  display: inline-grid;
  place-items: center;
  border: 1.5px solid var(--border-control);
  border-radius: 5px;
  background: var(--surface);
  color: #fff;
}

.check-box svg {
  width: 14px;
  height: 14px;
}

.check-row[aria-checked="true"] .check-box {
  background: var(--accent);
  border-color: var(--accent);
}

/* Helper copy under the checkbox label (20px box + 10px gap + 4px padding). */
.check-hint {
  margin: -8px 0 0 34px;
}

.tag.is-trip {
  background: var(--surface);
  color: var(--text-1);
  border-color: var(--border-control);
  font-weight: 600;
}

.leg-line {
  font-size: 12px;
  line-height: 16px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

.leg-line span {
  white-space: nowrap;
}

.legend-line.is-dashed {
  background: repeating-linear-gradient(90deg, var(--accent) 0 8px, transparent 8px 12px);
}

.details-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.details-tab {
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--border-control);
  border-radius: var(--radius-control);
  background: var(--surface);
  color: var(--text-2);
  font-weight: 500;
}

.details-tab:hover {
  background: var(--surface-subtle);
}

.details-tab[aria-selected="true"] {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}

.details-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.legs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.legs-table th,
.legs-table td {
  padding: 2px 8px;
  line-height: 18px;
  text-align: right;
  border-bottom: 1px solid var(--border);
}

.legs-table thead th {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
}

.legs-table th:first-child {
  text-align: left;
  padding-left: 0;
  font-weight: 500;
  color: var(--text-2);
}

.legs-table td.legs-total {
  color: var(--text-2);
}

.leg-warning {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 4px 8px;
  font-size: 12px;
  line-height: 16px;
  color: var(--warn-text);
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  border-radius: var(--radius-control);
}

.leg-warning svg {
  width: 16px;
  height: 16px;
  flex: none;
}

/* Desktop: the switch shares the "Add stop" row, so a one-way trip gains no height. */
.stops-row {
  position: relative;
}

.stops-row .round-trip {
  position: absolute;
  right: 0;
  bottom: 0;
}

.round-trip.is-options:empty {
  display: none;
}

.stops-row:not(:has(.add-stop)) {
  padding-bottom: 44px;
}

/* Account: trips on Saved / History, My cars (Account page and vehicle picker). */
.trip-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.trip-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}

.trip-item:first-child {
  border-top: 0;
  padding-top: 0;
}

.trip-item h3 {
  font-size: 15px;
  line-height: 22px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.car-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.car-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  overflow-wrap: anywhere;
}

.my-cars {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 8px 0 4px;
}

/* Sign-in: Google button and/or the email + password form. */
.sign-in {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 360px;
}

.sign-in-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sign-in-or {
  font-size: 12px;
  line-height: 16px;
  color: var(--text-2);
  text-align: center;
}

.sign-in-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
}
