:root {
  color-scheme: light;
  --ink: #17211c;
  --muted: #5d675f;
  --line: #ddd4c4;
  --paper: #f4f0e6;
  --card: #fffdf8;
  --header: #14221c;
  --header-ink: #f6f3ea;
  --accent: #0f6e56;
  --accent-ink: #ffffff;
  --warn: #8a4b12;
  --warn-bg: #fff1df;
  --ok-bg: #e5f5ee;
  --danger: #8d1d1d;
  --danger-bg: #fdecec;
}

* { box-sizing: border-box; }

body.theme-dark {
  color-scheme: dark;
  --ink: #f1f5f8;
  --muted: #9ba9b5;
  --line: #26323d;
  --paper: #080d13;
  --card: #101820;
  --header: #0b1118;
  --header-ink: #f1f5f8;
  --accent: #55c6df;
  --accent-ink: #061116;
  --warn: #f2b45b;
  --warn-bg: #2a2114;
  --ok-bg: #12291f;
  --danger: #ffbdc6;
  --danger-bg: #331d24;
  background: var(--paper);
  color: var(--ink);
}

body {
  margin: 0;
  font-family: "Segoe UI", "Ubuntu", "Noto Sans", sans-serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.45;
  font-size: 1rem;
}

a { color: var(--accent); }

.skip {
  position: absolute;
  left: 0.5rem;
  top: -3rem;
  background: white;
  padding: 0.4rem 0.6rem;
}

.skip:focus { top: 0.5rem; }

.top {
  background: var(--header);
  color: var(--header-ink);
}

.top-inner {
  width: min(100% - 1.5rem, 64rem);
  margin: 0 auto;
  min-height: 3.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.wordmark {
  color: inherit;
  font-weight: 750;
  letter-spacing: -0.03em;
  text-decoration: none;
  font-size: 1.2rem;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.who {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 12rem;
  color: #d5ddd6;
  font-size: 0.92rem;
}

.top button {
  width: auto;
  min-height: 2.4rem;
  margin-top: 0;
  background: transparent;
  color: var(--header-ink);
  border: 1px solid #8ea396;
  padding: 0.35rem 0.7rem;
}

.banner {
  margin: 0;
  padding: 0.7rem 1rem;
  background: var(--warn-bg);
  color: var(--warn);
  text-align: center;
}

.shell {
  width: min(100% - 1.5rem, 32rem);
  margin: 0 auto;
  padding: 1.25rem 0 3rem;
}

main h1 {
  margin: 0 0 0.75rem;
  font-size: 2rem;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

h2 { margin: 0 0 0.5rem; font-size: 1.15rem; }

p { margin: 0.55rem 0; }

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--muted);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
  margin-top: 1rem;
}

.steps {
  list-style: none;
  display: flex;
  gap: 0.4rem;
  padding: 0;
  margin: 0 0 1rem;
  overflow-x: auto;
}

.steps li {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.25rem 0.6rem 0.25rem 0.25rem;
  white-space: nowrap;
}

.steps span {
  width: 1.4rem;
  height: 1.4rem;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: #e7e1d4;
  font-size: 0.8rem;
}

.steps .current {
  color: var(--ink);
  border-color: var(--accent);
}

.steps .current span,
.steps .done span {
  background: var(--accent);
  color: white;
}

form { margin: 0.8rem 0 0; }

label {
  display: block;
  margin: 0.8rem 0 0.3rem;
  font-weight: 650;
}

input {
  width: 100%;
  min-height: 48px;
  border: 1px solid #cabbab;
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  font: inherit;
  background: white;
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  margin-top: 0.8rem;
  padding: 0.7rem 1rem;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-ink);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  text-align: center;
}

.button.secondary,
button.secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.actions {
  display: grid;
  gap: 0.25rem;
}

.hint,
.switch { color: var(--muted); }

.error,
.notice {
  padding: 0.7rem 0.8rem;
  border-radius: 10px;
}

.error { background: var(--danger-bg); color: var(--danger); }
.notice { background: var(--ok-bg); color: #145c3a; }

.facts {
  list-style: none;
  padding: 0;
}

.facts li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border-top: 1px solid var(--line);
  padding: 0.45rem 0;
}

.facts span { color: var(--muted); }

.mono {
  font-family: "Ubuntu Mono", "Noto Sans Mono", ui-monospace, monospace;
  font-size: 0.86rem;
  word-break: break-all;
}

.cars {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.75rem;
}

.car { margin-top: 0; }
.vehicle-list-shell { width: min(100% - 1.5rem, 52rem); padding-top: 1.5rem; }
.vehicle-list-intro { margin: -.25rem 0 1rem; color: var(--muted); }
.vehicle-selected { display: inline-flex; margin: .25rem 0 .15rem; padding: .2rem .55rem; border: 1px solid #347f8e; border-radius: 999px; background: rgba(85,198,223,.1); color: var(--accent); font-size: .76rem; font-weight: 700; }
.vehicle-state { margin: .2rem 0; color: var(--muted); }
.settings-shell { width: min(100% - 1.5rem, 42rem); padding-top: 1.5rem; }
.settings-card { margin-top: .75rem; }
.settings-card h2 { margin-bottom: .4rem; }
.settings-card > p { margin: .3rem 0; }
.settings-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); gap: .6rem; margin-top: .75rem; }
.settings-links .button { min-height: 44px; margin: 0; padding: .6rem .8rem; }
.theme-dark .state-pill { background: #17232c; border: 1px solid var(--line); color: var(--muted); }

.state-pill {
  display: inline-block;
  margin: 0;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: #e7e1d4;
}

.status.paired { color: var(--accent); }
.status.unpaired,
.status.unknown,
.status.none { color: var(--warn); }

/* Dark counterparts for shared controls whose base rules use fixed light colours. */
.theme-dark .notice { color: #a6e3c4; }
.theme-dark input { background: var(--card); border-color: var(--line); color: var(--ink); }
.theme-dark .steps span { background: #17232c; color: var(--muted); }
.theme-dark .steps .current span,
.theme-dark .steps .done span { background: var(--accent); color: var(--accent-ink); }
.theme-dark .banner { background: #16242d; color: var(--muted); }
.theme-dark .skip { z-index: 10; background: var(--card); color: var(--ink); }

.charging-validation { max-width: 42rem; }
.charging-validation h2 { margin: 0.15rem 0 0; font-size: 1.15rem; }
.charging-validation-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem; }
.charging-validation-actions form { min-width: 0; }
.charging-validation-actions button { min-height: 44px; padding: 0.55rem 0.65rem; font-size: 0.92rem; }
.charging-validation-result { margin: 0.75rem 0 0; font-weight: 650; }
.charging-validation-fields { list-style: none; margin: 0.65rem 0 0; padding: 0; }
.charging-validation-fields li { display: flex; justify-content: space-between; gap: 1rem; border-top: 1px solid var(--line); padding: 0.35rem 0; font-size: 0.9rem; }

@media (max-width: 520px) {
  .charging-validation-actions { grid-template-columns: 1fr; }
}

.drive-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem 1rem;
  margin: 0.75rem 0 0;
}

.drive-facts div {
  min-width: 0;
}

.drive-facts dt {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.drive-facts dd {
  margin: 0.15rem 0 0;
  font-weight: 650;
}

.drive-trace {
  margin-top: 1rem;
  width: 100%;
}

.drive-trace svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 14rem;
  border-radius: 12px;
}

.drive-trace-bg {
  fill: #eef4f0;
}

.drive-trace-line {
  stroke: var(--accent);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.drive-trace-start {
  fill: var(--accent);
}

.drive-trace-end {
  fill: var(--header);
}

.drive-detail-shell {
  width: min(100% - 1.5rem, 74rem);
  padding-top: .4rem;
}

.drive-detail-back { margin: 0 0 .35rem; font-size: .875rem; letter-spacing: 0; text-transform: none; }
.drive-detail-back a { display: inline-flex; align-items: center; gap: .65rem; min-height: 2.75rem; color: var(--muted); text-decoration: none; }
.drive-detail-back a::before { content: ""; width: .4rem; height: .4rem; border-left: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); }
.drive-detail-back a:hover { color: var(--ink); }
.drive-detail-back a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.drive-detail { display: grid; min-width: 0; }
.drive-journey { position: relative; min-width: 0; background: var(--paper); }
.drive-journey-meta { position: absolute; z-index: 4; inset: .55rem .75rem auto; pointer-events: none; }
.drive-journey-meta p { margin: 0; font-size: .75rem; font-weight: 600; letter-spacing: .065em; text-transform: uppercase; }
.drive-journey-meta .drive-journey-vehicle { margin-top: .25rem; color: var(--muted); font-size: .875rem; font-weight: 400; letter-spacing: 0; text-transform: none; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* The title has its own reserved space above the MapLibre viewport. Edge fades
   are narrower than its existing 52px fit padding; neither covers the route. */
.drive-map-frame {
  position: relative;
  min-height: 16rem;
  height: clamp(16rem, 66vw, 18rem);
  overflow: hidden;
  background: var(--paper);
  isolation: isolate;
}
.drive-map-host { position: absolute; inset: 3.75rem 0 0; }
.drive-map-host.maplibregl-map { position: absolute; }
.drive-map-frame::after {
  content: "";
  position: absolute;
  z-index: 2;
  inset: 3.75rem 0 0;
  pointer-events: none;
  background: linear-gradient(to bottom, var(--paper), transparent 24px, transparent calc(100% - 32px), var(--paper)), linear-gradient(to right, var(--paper), transparent 12px, transparent calc(100% - 12px), var(--paper));
}
.drive-map-message, .drive-map-unavailable {
  position: absolute;
  z-index: 2;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  color: var(--muted);
  text-align: center;
}
.drive-map-message[hidden] { display: none; }
.drive-map-frame.is-unavailable { min-height: 12rem; height: 12rem; }
.drive-map-attribution {
  position: absolute;
  z-index: 3;
  right: .55rem;
  bottom: .65rem;
  max-width: calc(100% - 1.1rem);
  margin: 0;
  padding: .2rem .4rem;
  border-radius: .35rem;
  background: rgb(8 13 19 / 88%);
  color: #e6edf2;
  font-size: .6875rem;
  line-height: 1.35;
}
.drive-map-attribution a { color: inherit; }
.drive-route-marker {
  display: grid;
  width: 1.2rem;
  height: 1.2rem;
  place-items: center;
  border: 2px solid #f1f5f8;
  border-radius: 50%;
  box-shadow: 0 1px 6px rgb(0 0 0 / 55%);
}
.drive-route-marker.is-start { background: #55c6df; }
.drive-route-marker.is-end { background: #f2b45b; }
.drive-detail-summary { display: grid; gap: .8rem; padding: .35rem .75rem 1.2rem; }
.drive-journey-numbers { display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem 1.25rem; min-width: 0; }
.drive-detail-distance { margin: 0; font-size: clamp(3.25rem, 8vw, 5.25rem); font-weight: 550; letter-spacing: -.055em; line-height: 1; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.drive-detail-distance.is-unavailable { font-size: 1.5rem; letter-spacing: -.025em; }
.drive-distance-unit { margin-left: .35rem; color: var(--muted); font-size: .32em; letter-spacing: 0; font-weight: 400; }
.drive-journey-duration { margin: 0; padding-left: 1.25rem; border-left: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.drive-journey-duration dd { margin: 0; font-size: clamp(1.5rem, 3.4vw, 2.25rem); font-weight: 450; line-height: 1.1; letter-spacing: -.025em; }
.drive-recorded-times { min-width: 0; font-variant-numeric: tabular-nums; }
.drive-recorded-times p { margin: 0 0 .2rem; color: var(--muted); font-size: .75rem; overflow-wrap: anywhere; }
.drive-recorded-times div { display: flex; flex-wrap: wrap; align-items: baseline; gap: .4rem; font-size: 1rem; }
.drive-recorded-times div > span { color: var(--muted); }

/* One instrument band, then one full-width plot. Battery is first on phones;
   on wide screens it shares the same baseline as the speed instrumentation. */
.drive-analysis { --drive-graph-height: 170px; min-width: 0; padding: 0 .75rem; border-top: 1px solid var(--line); }
.drive-instrument-band { display: grid; gap: 1.2rem; padding: 1.15rem 0 .25rem; }
.drive-battery { display: grid; grid-template-columns: 4rem minmax(0, 1fr); gap: .4rem 1rem; align-items: center; min-width: 0; }
.drive-battery-heading { display: contents; }
.drive-battery-heading h2 { grid-column: 1; grid-row: 1 / 3; margin: 0; font-size: .9375rem; font-weight: 500; }
.drive-battery-heading p { grid-column: 2; margin: 0; font-size: 1.3125rem; line-height: 1.15; font-weight: 500; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.drive-battery-graphic { grid-column: 2; display: block; width: 100%; height: .375rem; }
.drive-battery-track { fill: #293640; }
.drive-battery-level { fill: var(--accent); }
.drive-battery-change.is-decreased { fill: #d5a252; }
.drive-battery-change.is-increased { fill: #c3dee5; }

.drive-speed-heading { display: flex; align-items: center; gap: 1rem; min-width: 0; }
.drive-speed-heading > div { flex: 0 0 4rem; }
.drive-speed-heading h2 { margin: 0; font-size: .9375rem; font-weight: 500; }
.drive-speed-metrics { display: flex; flex-wrap: wrap; gap: .75rem 1.25rem; margin: 0; font-variant-numeric: tabular-nums; }
.drive-speed-metrics > div { display: flex; flex-direction: column-reverse; gap: .2rem; }
.drive-speed-metrics dt { color: var(--muted); font-size: .75rem; }
.drive-speed-metrics dd { margin: 0; font-size: 1.375rem; font-weight: 500; line-height: 1.15; letter-spacing: -.025em; }
.drive-speed-section { min-width: 0; }
.drive-speed-chart { display: grid; grid-template-columns: 1.8rem minmax(0, 1fr); gap: .5rem; margin-top: 1.2rem; }
.drive-speed-y-axis { position: relative; height: var(--drive-graph-height); color: var(--muted); font-size: .8125rem; font-variant-numeric: tabular-nums; }
.drive-speed-y-axis span { position: absolute; right: 0; transform: translateY(-50%); }
/* Match y=10/76/142 within the graph's cropped viewBox y=4..148. */
.drive-speed-y-axis span:nth-child(1) { top: 4.1667%; }
.drive-speed-y-axis span:nth-child(2) { top: 50%; }
.drive-speed-y-axis span:nth-child(3) { top: 95.8333%; }
.drive-speed-plot { min-width: 0; }
.drive-speed-graph { display: block; width: 100%; height: var(--drive-graph-height); overflow: visible; }
.drive-speed-grid, .drive-speed-time-grid { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.drive-speed-time-grid { stroke-dasharray: 2 5; }
.drive-speed-series path { fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.drive-speed-series circle { fill: var(--accent); }
/* A continuous trace needs no bead at every vertex. A lone sample stays visible. */
.drive-speed-series:not(.is-single) circle { display: none; }
/* HTML ticks retain their font size when the SVG narrows on phones. */
.drive-speed-x-axis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .35rem; margin-top: .25rem; color: var(--muted); font-size: .8125rem; font-variant-numeric: tabular-nums; }
.drive-speed-x-axis span:nth-child(2) { justify-self: center; }
.drive-speed-x-axis span:nth-child(3) { justify-self: end; }
.drive-speed-axis-label { margin: .6rem 0 0; color: var(--muted); font-size: .75rem; text-align: right; }
.drive-speed-unavailable { margin: 1.2rem 0; color: var(--muted); font-size: .9rem; }
.drive-map-frame .maplibregl-canvas { outline: none; }

@media (min-width: 600px) {
  .drive-map-frame { height: clamp(21rem, 44vw, 26rem); }
  .drive-journey-meta { inset-inline: 1.25rem; }
  .drive-journey-meta p { font-size: .8125rem; }
  .drive-detail-summary { grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 1rem; padding: .25rem 1.25rem 1.4rem; }
  .drive-recorded-times { text-align: right; }
  .drive-recorded-times div { justify-content: flex-end; }
  .drive-analysis { padding-inline: 1.25rem; }
  .drive-instrument-band { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.5rem; padding-top: 1.35rem; }
  .drive-battery { grid-column: 2; grid-row: 1; grid-template-columns: minmax(0, 1fr); align-content: center; gap: .4rem; padding-left: 1.5rem; border-left: 1px solid var(--line); }
  .drive-battery-heading { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .25rem .75rem; }
  .drive-battery-graphic { grid-column: 1; }
  .drive-speed-heading { grid-column: 1; grid-row: 1; display: grid; gap: .5rem; }
  .drive-speed-metrics { column-gap: 1.75rem; }
}
@media (min-width: 960px) {
  .drive-detail-shell { padding-top: .6rem; }
  .drive-journey-meta { inset: .75rem 1.5rem auto; }
  .drive-journey-vehicle { line-height: 1.5; }
  .drive-map-frame { height: clamp(26rem, 33vw, 29rem); }
  .drive-detail-summary { padding: .25rem 1.5rem 1.65rem; }
  .drive-journey-numbers { column-gap: 1.75rem; }
  .drive-journey-duration { padding-left: 1.75rem; }
  .drive-recorded-times div { font-size: 1.125rem; }
  .drive-analysis { --drive-graph-height: 200px; padding-inline: 1.5rem; }
  .drive-instrument-band { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 2rem; }
  .drive-speed-heading { display: flex; gap: 1.5rem; }
  .drive-speed-metrics { column-gap: 2rem; }
  .drive-speed-metrics dd { font-size: 1.625rem; }
  .drive-battery { grid-template-columns: 4rem minmax(0, 1fr); column-gap: 1.25rem; padding-left: 2rem; }
  .drive-battery-heading { display: contents; }
  .drive-battery-graphic { grid-column: 2; }
  .drive-speed-chart { margin-top: 1.75rem; }
}

/* Drive-only compact composition; shared navigation and Explorer stay intact. */
.drive-detail-summary { gap: .8rem; padding-bottom: .85rem; }
.drive-detail-distance { font-size: clamp(2rem, 6vw, 3.25rem); }
.drive-journey-duration dd { font-size: clamp(1.2rem, 3vw, 1.65rem); }
.drive-detail-summary .drive-battery { grid-column: 1 / -1; grid-row: auto; grid-template-columns: 4rem minmax(0, 1fr); padding: .7rem 0 0; border: 0; max-width: 28rem; }
.drive-detail-summary .drive-battery-heading { display: contents; }
.drive-detail-summary .drive-battery-graphic { grid-column: 2; }
.drive-detail-summary .drive-battery-heading p { font-size: 1.125rem; }
.drive-speed-legend { display: flex; flex-wrap: wrap; gap: .3rem .8rem; margin: .25rem .75rem .6rem; padding: 0; list-style: none; color: var(--muted); font-size: .75rem; }
.drive-speed-legend li { white-space: nowrap; }
.drive-speed-legend li::before { content: ""; display: inline-block; width: .75rem; height: .2rem; margin-right: .3rem; vertical-align: middle; background: #8895a0; }
.drive-speed-legend .is-slow::before { background: #72e6a4; }
.drive-speed-legend .is-medium::before { background: #55c6df; }
.drive-speed-legend .is-fast::before { background: #f2b45b; }
.drive-speed-legend .is-high::before { background: #bd9aff; }
.drive-carousel { position: relative; min-width: 0; padding-bottom: .75rem; }
.drive-carousel-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; padding: .7rem 0; }
.drive-carousel-header h2 { margin: 0; font-size: 1.125rem; }
.drive-carousel-controls { display: flex; align-items: center; gap: .6rem; font-size: .8125rem; color: var(--muted); }
.drive-carousel-controls[hidden], .drive-carousel-dots[hidden] { display: none; }
.drive-carousel-controls button { min-width: 44px; min-height: 44px; padding: .35rem; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: .5rem; }
.drive-carousel-controls button:disabled { opacity: .35; }
.drive-carousel button:focus-visible, .drive-carousel-viewport:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.drive-carousel-viewport { min-width: 0; }
.drive-carousel.is-enhanced .drive-carousel-viewport { height: 21rem; overflow-y: auto; overflow-x: hidden; scroll-snap-type: y mandatory; touch-action: pan-y pinch-zoom; overscroll-behavior-y: auto; scrollbar-width: none; }
.drive-carousel.is-enhanced .drive-carousel-viewport::-webkit-scrollbar { display: none; }
.drive-carousel.is-enhanced [data-carousel-view] { height: 100%; min-height: 100%; box-sizing: border-box; scroll-snap-align: start; scroll-snap-stop: always; padding: .4rem 44px .8rem 0; overflow-wrap: anywhere; }
.drive-carousel .drive-speed-heading { display: block; }
.drive-carousel .drive-speed-chart { margin-top: 1rem; }
.drive-carousel.is-enhanced .drive-no-js-title { display: none; }
.drive-carousel-dots { position: absolute; right: 0; top: 50%; display: flex; flex-direction: column; }
.drive-carousel-dots button { display: grid; place-items: center; width: 44px; min-height: 44px; padding: 0; border: 0; background: transparent; }
.drive-carousel-dots button svg { width: 28px; height: 28px; fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.drive-carousel-dots button[aria-current] svg { stroke: var(--accent); }
.drive-tyre-units { margin: 0 0 .6rem; text-align: center; color: var(--muted); font-size: .875rem; }
.drive-tyres { display: grid; grid-template-columns: minmax(0, 1fr) 80px minmax(0, 1fr); grid-template-rows: 1fr 1fr; align-items: center; gap: .6rem; max-width: 26rem; margin: auto; }
.drive-tyre-car { grid-column: 2; grid-row: 1 / 3; width: 80px; height: 160px; fill: none; stroke: var(--muted); stroke-width: 2; }
.drive-tyre-reading { text-align: center; display: grid; gap: .2rem; }
.drive-tyre-reading span { font-size: .8125rem; color: var(--muted); }
.drive-tyre-reading strong { font-size: 1.5rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.drive-tyre-reading.wheel-0 { grid-column: 1; grid-row: 1; }
.drive-tyre-reading.wheel-1 { grid-column: 3; grid-row: 1; }
.drive-tyre-reading.wheel-2 { grid-column: 1; grid-row: 2; }
.drive-tyre-reading.wheel-3 { grid-column: 3; grid-row: 2; }
.drive-tyre-unavailable { margin: .75rem 0; color: var(--muted); text-align: center; font-size: .875rem; }
@media (max-width: 760px) {
  .drive-analysis { padding-inline: 12px; }
  .drive-tyres { column-gap: 8px; }
  .drive-tyre-reading span { display: none; }
  .drive-carousel.is-enhanced .drive-carousel-viewport { height: 20rem; }
  .drive-carousel-controls { display: none; }
  .drive-carousel-controls:focus-within { display: flex; }
  .drive-carousel-header { padding: .75rem 0 .5rem; }
}
@media (min-width: 761px) {
  .drive-carousel-controls button { min-width: 32px; min-height: 32px; border: 0; background: transparent; }
}
@media (prefers-reduced-motion: reduce) { .drive-carousel-viewport { scroll-behavior: auto; } }

.app-nav {
  display: flex;
  flex-wrap: nowrap;
  gap: clamp(.45rem, 1.6vw, 1.25rem);
  align-items: center;
  justify-content: flex-end;
}

.app-nav-link {
  display: inline-flex;
  min-height: 2.75rem;
  align-items: center;
  gap: .4rem;
  padding: .35rem .45rem;
  color: #d5ddd6;
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 650;
  border-radius: .7rem;
}

.app-nav-link.current,
.app-nav-link:hover {
  color: #fff;
}

.app-nav-link.current {
  background: rgba(255,255,255,.1);
}

.app-nav-icon { display: inline-flex; flex: 0 0 auto; }
.app-nav-icon svg { display: block; width: 1.2rem; height: 1.2rem; }
.app-nav-label { white-space: nowrap; }

.more-shell { width: min(100% - 1.5rem, 38rem); }
.more-shell > main > h1 { margin-bottom: 1rem; }
.more-list { display: grid; gap: .55rem; }
.more-row {
  display: flex;
  width: 100%;
  min-width: 0;
  min-height: 3.5rem;
  align-items: center;
  gap: .8rem;
  padding: .75rem .9rem;
  border: 1px solid var(--line);
  border-radius: .9rem;
  background: var(--card);
  color: var(--ink);
  text-align: left;
  text-decoration: none;
  font: inherit;
  cursor: pointer;
}

.more-row:hover { border-color: var(--accent); }
.more-row-icon { display: inline-flex; color: var(--accent); }
.more-row-icon svg { display: block; width: 1.35rem; height: 1.35rem; }
.more-row-copy { display: grid; min-width: 0; gap: .1rem; flex: 1; }
.more-row-copy strong { font-size: .96rem; }
.more-row-copy > span { color: var(--muted); font-size: .8rem; }
.more-chevron { color: var(--muted); font-size: 1.5rem; line-height: 1; }
.more-logout { margin: .35rem 0 0; }
.more-logout .more-row { color: var(--ink); }

@media (max-width: 700px) {
  .top-inner { min-height: 3.25rem; }
  .top-actions { min-width: 0; }
  .app-nav {
    position: fixed;
    z-index: 100;
    inset: auto 0 0;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0;
    padding: .35rem .4rem calc(.35rem + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--line);
    background: #0b1118;
  }
  .app-nav-link {
    display: flex;
    min-width: 0;
    min-height: 3.25rem;
    flex-direction: column;
    justify-content: center;
    gap: .12rem;
    padding: .25rem .1rem;
    border-radius: .65rem;
    font-size: clamp(.64rem, 2.5vw, .72rem);
    line-height: 1.1;
  }
  .app-nav-icon svg { width: 1.3rem; height: 1.3rem; }
  .app-nav-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  body.has-app-nav { padding-bottom: calc(4.25rem + env(safe-area-inset-bottom, 0px)); }
}

@media (max-width: 360px) {
  .top-inner { width: min(100% - 1rem, 64rem); }
  .app-nav { padding-inline: .2rem; }
  .app-nav-link { font-size: .62rem; }
}

.admin-shell { width: min(100% - 1.5rem, 72rem); padding-top: 1.5rem; }
.admin-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .8rem; margin: 1.2rem 0 2rem; }
.admin-metric { min-width: 0; padding: 1rem; border: 1px solid var(--line); border-radius: 14px; background: var(--surface, #171c22); }
.admin-metric .eyebrow { margin: 0 0 .65rem; }
.admin-metric strong { display: block; font-size: clamp(1.4rem, 4vw, 2rem); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.admin-users { margin-top: 1.5rem; }
.admin-users h2 { margin-bottom: .75rem; }
.admin-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; }
.admin-users table { width: 100%; border-collapse: collapse; text-align: left; }
.admin-users th, .admin-users td { padding: .8rem .9rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.admin-users th { color: var(--muted); font-size: .76rem; letter-spacing: .04em; text-transform: uppercase; }
.admin-users td { overflow-wrap: anywhere; }
.admin-users tbody tr:last-child td { border-bottom: 0; }
.admin-telemetry-time { display: block; font-weight: 650; font-variant-numeric: tabular-nums; }
.admin-telemetry-status { display: block; margin-top: .2rem; color: var(--muted); font-size: .86rem; line-height: 1.35; }
.admin-empty { color: var(--muted); }
.admin-note { color: var(--muted); font-size: .85rem; }

@media (max-width: 700px) {
  .admin-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-table-wrap { overflow: visible; border: 0; }
  .admin-users thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
  .admin-users table, .admin-users tbody { display: block; }
  .admin-users tbody { display: grid; gap: .75rem; }
  .admin-users tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); min-width: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--surface, #171c22); overflow: hidden; }
  .admin-users td { padding: .65rem .75rem; border-bottom: 1px solid var(--line); }
  .admin-users td::before { content: attr(data-label); display: block; margin-bottom: .2rem; color: var(--muted); font-size: .68rem; font-weight: 700; text-transform: uppercase; }
  .admin-users td:first-child, .admin-users td:nth-child(4), .admin-users td:last-child, .admin-users .admin-empty { grid-column: 1 / -1; }
  .admin-users td:last-child { border-bottom: 0; }
}

.drives-shell {
  width: min(100% - 1.5rem, 64rem);
  padding-top: 1.5rem;
}

.drive-explorer-header { margin-bottom: .8rem; }
.drive-explorer-header .eyebrow { margin: 0 0 .15rem; color: var(--muted); font-size: .7rem; letter-spacing: .1em; }
.drive-explorer-header h1 { margin: 0; }
.drive-explorer-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(8rem, 1fr)) auto;
  gap: .6rem;
  align-items: end;
  margin: 0 0 1rem;
  padding: .75rem;
  border: 1px solid var(--line);
  border-radius: .95rem;
  background: var(--card);
}
.drive-explorer-filters label { display: grid; min-width: 0; gap: .3rem; color: var(--muted); font-size: .8125rem; font-weight: 650; }
.drive-explorer-filters select { width: 100%; min-height: 2.75rem; padding: .45rem .6rem; border: 1px solid var(--line); border-radius: .65rem; background: #111a22; color: var(--ink); font: inherit; font-size: .875rem; }
.drive-explorer-apply { min-height: 2.65rem; margin: 0; padding-inline: .9rem; }
.drive-explorer-timezone { margin: -.35rem 0 .75rem; color: var(--muted); font-size: .75rem; }
.drive-day-groups { display: grid; gap: .65rem; }
.drive-day { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: .95rem; background: var(--card); }
.drive-day-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  grid-template-areas: "date count totals arrow";
  gap: .8rem;
  align-items: center;
  min-height: 3.8rem;
  padding: .65rem .9rem;
  cursor: pointer;
  list-style: none;
}
.drive-day-heading::-webkit-details-marker { display: none; }
.drive-day-heading::marker { content: ""; }
.drive-day-heading:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }
.drive-day-date { grid-area: date; min-width: 0; font-size: .98rem; font-weight: 720; }
.drive-day-count { grid-area: count; color: var(--muted); font-size: .8125rem; white-space: nowrap; }
.drive-day-totals { grid-area: totals; display: flex; gap: .7rem; color: #d5e0e6; font-size: .875rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.drive-day-chevron { grid-area: arrow; width: .55rem; height: .55rem; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg) translateY(-2px); transition: transform .15s ease; }
.drive-day[open] .drive-day-chevron { transform: rotate(225deg) translate(-2px, -1px); }
.drive-explorer-list { display: grid; margin: 0; padding: 0 .55rem .55rem; list-style: none; }
.drive-explorer-list li { min-width: 0; }
.drive-explorer-list li + li { border-top: 1px solid rgba(139,164,180,.11); }
.drive-explorer-row {
  display: grid;
  grid-template-columns: 4rem minmax(8rem, 1.25fr) 5.2rem 4rem 4.5rem minmax(10rem, 1.2fr) .75rem;
  gap: .7rem;
  align-items: center;
  min-width: 0;
  min-height: 3.25rem;
  padding: .35rem .4rem;
  border-radius: .55rem;
  color: var(--ink);
  text-decoration: none;
  font-size: .875rem;
  font-variant-numeric: tabular-nums;
}
.drive-explorer-row:hover { background: rgba(255,255,255,.045); }
.drive-explorer-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.drive-row-start,.drive-row-end { color: #d3dde2; white-space: nowrap; }
.drive-row-vehicle { min-width: 0; overflow: hidden; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.drive-row-distance { color: #d5eaf0; font-weight: 700; text-align: right; white-space: nowrap; }
.drive-row-duration { color: var(--muted); text-align: right; white-space: nowrap; }
.drive-row-soc { display: grid; min-width: 0; grid-template-columns: minmax(3.5rem, 5.2rem) minmax(0, 1fr); gap: .55rem; align-items: center; }
.drive-soc-graphic { display: block; width: 100%; height: .48rem; overflow: visible; }
.drive-soc-track { fill: #293640; }
.drive-soc-remaining { fill: #65c4d6; }
.drive-soc-gained { fill: #71d9a7; }
.drive-soc-consumed { fill: #d5a252; }
.drive-soc-text { min-width: 0; color: #d5e0e6; font-size: .8125rem; white-space: nowrap; }
.drive-soc-values { display: flex; gap: .25rem; align-items: center; font-variant-numeric: tabular-nums; }
.drive-row-soc.is-unavailable { display: flex; justify-content: center; color: var(--muted); }
.drive-soc-dash { font-size: 1rem; }
.drive-row-chevron { color: var(--muted); font-size: 1.25rem; line-height: 1; text-align: right; }
.drive-explorer-empty { margin: 0; padding: 1.1rem; border: 1px solid var(--line); border-radius: .85rem; color: var(--muted); background: var(--card); }
.drive-explorer-older { margin: .9rem 0 0; text-align: center; }
.drive-explorer-older .button { min-height: 2.8rem; }

@media (max-width: 760px) {
  .drive-explorer-row { grid-template-columns: 3.25rem minmax(3.5rem, 1fr) 4.15rem 7rem .65rem; gap: .35rem; min-height: 2.875rem; padding-inline: .2rem; font-size: .875rem; }
  .drive-row-end,.drive-row-duration { display: none; }
  .drive-row-soc { grid-template-columns: minmax(0, 1fr); justify-items: center; gap: .15rem; }
  .drive-soc-graphic { width: 3.55rem; max-width: 100%; height: .45rem; }
  .drive-soc-text { min-width: 0; font-size: .8125rem; }
  .drive-soc-values { min-width: 0; justify-content: center; gap: .1rem; white-space: nowrap; }
  .drive-row-soc.is-unavailable .drive-soc-text { display: none; }
  .drive-row-soc.is-unavailable { font-size: .875rem; }
}

@media (max-width: 700px) {
  .drive-explorer-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; padding: .6rem; }
  .drive-explorer-apply { grid-column: 1 / -1; }
  .drive-day-heading { grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "date date arrow" "count totals arrow"; gap: .2rem .65rem; }
  .drive-day-date { font-size: 1rem; }
  .drive-day-count { font-size: .84rem; }
  .drive-day-totals { justify-content: end; gap: .45rem; font-size: .84rem; }
  .drive-explorer-list { padding-inline: .35rem; }
}

@media (max-width: 400px) {
  .drives-shell { width: min(100% - 1rem, 64rem); }
  .drive-day-heading { padding-inline: .65rem; }
  .drive-explorer-row { grid-template-columns: 2.8rem minmax(2.5rem, 1fr) 3.25rem 7rem; gap: .25rem; font-size: .875rem; }
  .drive-row-chevron { display: none; }
  .drive-soc-graphic { width: 3.25rem; }
  .drive-soc-values { gap: .1rem; font-size: .8125rem; }
  .drive-soc-start .drive-soc-unit { display: none; }
}

.drives-context { margin-bottom: .15rem; }
.drives-context a { color: var(--muted); text-decoration: none; }
.drives-context a:hover { color: var(--accent); }

.drive-list {
  list-style: none;
  padding: 0;
  margin: 1.25rem 0 0;
  display: grid;
  gap: 1rem;
}

.drive-row {
  display: grid;
  gap: 1rem;
  min-height: 10rem;
  margin-top: 0;
  padding: 1.15rem;
  text-decoration: none;
  color: inherit;
  background: var(--card);
  border-color: var(--line);
  border-radius: 1.1rem;
  transition: border-color .15s ease, background-color .15s ease;
}

.drive-row:hover { border-color: var(--accent); }
.drive-row:focus-visible { outline-offset: 3px; }

.drive-row-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: .75rem;
}

.drive-row-time,
.drive-row-distance { min-width: 0; }
.drive-row-time .eyebrow,
.drive-row-distance .eyebrow { margin: 0 0 .25rem; font-size: .7rem; }
.drive-row-time strong { display: block; font-size: .98rem; font-variant-numeric: tabular-nums; }
.drive-row-distance { text-align: right; }
.drive-row-distance strong {
  display: block;
  color: var(--accent);
  font-size: clamp(1.4rem, 5vw, 1.85rem);
  font-weight: 750;
  line-height: 1.1;
  letter-spacing: -.035em;
  white-space: nowrap;
}

.drive-row-route {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: .6rem;
  padding: .85rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.drive-row-endpoint { min-width: 0; }
.drive-row-endpoint .eyebrow { margin: 0 0 .2rem; font-size: .67rem; }
.drive-row-endpoint strong { display: block; font-size: .94rem; font-weight: 600; overflow-wrap: anywhere; }
.drive-row-arrow { color: var(--muted); font-size: 1rem; }

.drive-row-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
  margin: 0;
}

.drive-row-facts div { min-width: 0; }
.drive-row-facts dt {
  color: var(--muted);
  font-size: .69rem;
  font-weight: 650;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.drive-row-facts dd {
  display: grid;
  gap: .05rem;
  margin: .22rem 0 0;
  font-size: 1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.drive-row-facts dd small {
  color: var(--muted);
  font-size: .76rem;
  font-weight: 600;
}

.drive-row-places,
.drive-places {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.home-shell {
  width: 100%;
  padding: .75rem 0 3rem;
  box-shadow: 0 -1px 0 var(--line);
}

.home-dashboard { overflow: visible; }

.home-hero {
  position: relative;
  isolation: isolate;
  width: 100%;
  min-height: 22rem;
  padding: 1.5rem max(1rem, calc((100% - 72rem) / 2)) 5rem;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 52% 32%, rgba(48, 104, 126, .28), transparent 42%),
    linear-gradient(145deg, #14212c 0%, #101922 50%, #0a1118 100%);
}

.home-map-host {
  position: absolute;
  z-index: 0;
  inset: 0;
  overflow: hidden;
  background: #101922;
}

.home-map-host.maplibregl-map { position: absolute; }

.home-map-frame {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: min(calc(100% - 2rem), 68rem);
  overflow: hidden;
  transform: translateX(-50%);
  border: 1px solid rgba(139, 164, 180, .18);
  border-radius: 1.1rem;
}

.home-map-message {
  position: absolute;
  z-index: 1;
  left: 1rem;
  bottom: 1rem;
  margin: 0;
  padding: .35rem .55rem;
  border-radius: .4rem;
  background: rgba(8, 13, 19, .88);
  color: #d5e1e8;
  font-size: .78rem;
}

.home-map-attribution {
  position: absolute;
  z-index: 2;
  right: 1rem;
  bottom: 5rem;
  max-width: min(78vw, 36rem);
  margin: 0;
  padding: .25rem .45rem;
  border-radius: .3rem;
  background: rgba(8, 13, 19, .96);
  color: #d5e1e8;
  font-size: .66rem;
  line-height: 1.35;
  text-align: right;
}

.home-map-attribution a { color: #83dcec; }

.home-map-marker {
  display: block;
  width: 1.25rem;
  height: 1.25rem;
  border: 3px solid #e2f9ff;
  border-radius: 50%;
  background: #37b8d2;
  box-shadow: 0 0 0 7px rgba(55, 184, 210, .2), 0 2px 12px rgba(0, 0, 0, .7);
}

.home-map-marker.is-stale {
  background: #c79a54;
  box-shadow: 0 0 0 7px rgba(199, 154, 84, .2), 0 2px 12px rgba(0, 0, 0, .7);
}


.home-hero::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  opacity: .32;
  background-image:
    linear-gradient(rgba(134, 169, 183, .12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(134, 169, 183, .12) 1px, transparent 1px),
    radial-gradient(ellipse at 50% 50%, transparent 0 24%, rgba(100, 141, 158, .2) 24.2% 24.5%, transparent 24.7% 40%, rgba(100, 141, 158, .14) 40.2% 40.5%, transparent 40.7%);
  background-size: 56px 56px, 56px 56px, 100% 100%;
  mask-image: linear-gradient(to bottom, black 30%, transparent 100%);
}

.home-hero.has-home-map::before { display: none; }

.home-hero::after {
  content: "";
  position: absolute;
  z-index: 0;
  inset: auto 0 0;
  height: 11rem;
  background: linear-gradient(to bottom, transparent, var(--paper));
  pointer-events: none;
}

.hero-inner {
  position: relative;
  z-index: 1;
  width: min(100%, 72rem);
  margin: 0 auto;
}

.theme-dark .home-hero .eyebrow,
.theme-dark .home-content .eyebrow { color: #8ea2b1; }

.location-surface {
  position: relative;
  display: grid;
  place-items: center;
  height: 14rem;
  margin-top: .6rem;
}

.location-empty {
  color: #a8b7c2;
  padding: .65rem .9rem;
  border: 1px solid rgba(173, 196, 208, .2);
  border-radius: 999px;
  background: rgba(9, 16, 23, .52);
}

.location-freshness {
  position: relative;
  z-index: 1;
  margin: -.2rem 0 0;
  color: #bdcbd4;
  text-align: center;
  font-size: .83rem;
}

.home-content {
  position: relative;
  z-index: 1;
  width: min(100% - 2rem, 68rem);
  margin: -4.1rem auto 0;
}

.vehicle-summary {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.2rem;
  align-items: end;
  margin-bottom: 1rem;
}

.vehicle-title h1 { margin: 0; font-size: clamp(2rem, 7vw, 3rem); }
.vehicle-title .eyebrow { margin-bottom: .25rem; }

.battery-panel,
.home-card,
.weather-card {
  border: 1px solid rgba(139, 164, 180, .18);
  border-radius: 1.1rem;
  background: rgba(16, 24, 32, .94);
  box-shadow: 0 16px 45px rgba(0, 0, 0, .18);
}

.battery-panel { padding: 1rem 1.15rem 1.15rem; }
.card-heading { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.card-heading h2 { margin: 0; }
.battery-reading { display: flex; align-items: baseline; gap: .75rem; margin: .1rem 0 .65rem; }
.battery-reading strong { font-size: clamp(2.4rem, 9vw, 3.5rem); line-height: 1; letter-spacing: -.055em; }
.battery-reading strong span { font-size: 1.45rem; margin-left: .1rem; color: #a9bac5; }
.battery-reading strong.is-stale { color: #e0bd7f; }
.battery-reading .unavailable { color: #8998a3; }
.battery-track { display: block; appearance: none; width: 100%; height: .6rem; overflow: hidden; border: 0; border-radius: 999px; background: #293640; }
.battery-track::-webkit-progress-bar { border-radius: 999px; background: #293640; }
.battery-track::-webkit-progress-value { border-radius: 999px; background: linear-gradient(90deg, #38b8d2, #89e3ca); }
.battery-track::-moz-progress-bar { border-radius: 999px; background: linear-gradient(90deg, #38b8d2, #89e3ca); }
.battery-track.is-stale::-webkit-progress-value,.battery-track.is-stale::-moz-progress-bar { background: linear-gradient(90deg, #b9904e, #d7bd80); }
.battery-track.is-empty { height: .6rem; border: 1px solid #34414b; }

.home-card { padding: 1.1rem 1.2rem; margin-top: 1rem; }
.home-card h2 { margin: .1rem 0 .4rem; }
.home-card a { color: #79d8e8; }
.home-compact-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .85rem; align-items: stretch; }
.weather-card {
  grid-column: 1;
  min-width: 0;
  margin: 0;
  padding: 1rem;
}
.weather-heading-row,.weather-detail-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .35rem; align-items: baseline; }
.weather-card .eyebrow { margin: 0; color: #9baab5; font-size: .72rem; letter-spacing: .08em; }
.weather-extreme { display: flex; align-items: baseline; gap: .25rem; margin: 0; color: #9baab5; font-size: .68rem; line-height: 1.25; white-space: nowrap; }
.weather-extreme strong { color: #c8d4da; font-size: .8rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.weather-detail-row { align-items: end; margin-top: .45rem; }
.weather-main { min-width: 0; }
.weather-current { min-height: 2.35rem; color: #e8f0f4; }
.weather-current strong { font-size: clamp(1.8rem, 8vw, 2.35rem); line-height: 1; letter-spacing: -.05em; white-space: nowrap; }
.weather-condition { margin: .2rem 0 0; min-height: 1.25em; color: #d6e0e6; font-size: .82rem; line-height: 1.25; overflow-wrap: anywhere; }
.weather-low { align-self: end; margin-bottom: .04rem; }
.weather-range { margin-top: 1rem; }
.weather-range-track { position: relative; height: .38rem; border-radius: 999px; background: linear-gradient(90deg, #398dc5 0%, #4bbfc7 27%, #72c69b 50%, #e1ad5e 76%, #cf6668 100%); }
.weather-range-marker { position: absolute; z-index: 2; top: 50%; width: .72rem; height: .72rem; border: 2px solid #f3fbfc; border-radius: 50%; background: #20313a; box-shadow: 0 0 0 2px rgba(12, 20, 27, .78), 0 0 8px rgba(255, 255, 255, .35); transform: translate(-50%, -50%); }
.weather-delayed { margin: .7rem 0 0; color: #e0bd7f; font-size: .69rem; line-height: 1.35; }
.weather-credit { margin: .45rem 0 0; color: #b5c5ce; font-size: .78rem; line-height: 1.4; }
.weather-credit a { color: #79d8e8; }
.weather-disclaimer-footer { margin: 2rem 0 1rem; max-width: 54rem; }
.weather-disclaimer { margin: 0; color: #8797a1; font-size: .72rem; line-height: 1.45; }
@media (max-width: 380px) {
  .weather-card .eyebrow { font-size: .66rem; letter-spacing: .06em; }
  .weather-extreme { gap: .18rem; font-size: .62rem; }
  .weather-extreme strong { font-size: .73rem; }
  .weather-condition { font-size: .78rem; }
}
.home-energy-metrics,.home-drive-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; margin: 1rem 0 0; }
.home-energy-metrics div,.home-drive-facts div { min-width: 0; }
.home-energy-metrics dt,.home-drive-facts dt { color: #9baab5; font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; }
.home-energy-metrics dd,.home-drive-facts dd { margin: .25rem 0 0; font-weight: 650; font-size: 1.08rem; overflow-wrap: anywhere; }
.home-energy-metrics dd { font-size: 1.2rem; }
.drive-time { color: var(--muted); font-size: .9rem; margin-top: .9rem; }
.drive-card-link { display: inline-block; margin-top: .35rem; }
.home-card .hint { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.drive-places {
  display: grid;
  gap: 0.25rem;
  margin-bottom: 0.75rem;
}

.analytics-shell { width: min(100% - 1.5rem, 64rem); padding: 1.25rem 0 3rem; }
.analytics-header { margin-bottom: 1rem; }
.analytics-header .eyebrow { margin: 0 0 .2rem; color: #8ea2b1; font-size: .72rem; letter-spacing: .09em; }
.analytics-header h1 { margin: 0; font-size: clamp(1.8rem, 7vw, 2.5rem); letter-spacing: -.04em; }
.analytics-period-context { margin: .25rem 0 0; color: var(--muted); font-size: .84rem; }
.analytics-period-selector { display: flex; flex-wrap: wrap; gap: .4rem; margin: 1rem 0 1.25rem; }
.analytics-period-option { display: inline-flex; min-height: 2.45rem; align-items: center; justify-content: center; padding: .45rem .8rem; border: 1px solid var(--line); border-radius: .75rem; background: var(--card); color: var(--muted); font-size: .84rem; font-weight: 600; line-height: 1.2; text-align: center; text-decoration: none; white-space: nowrap; }
.analytics-period-option.is-selected { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.analytics-timezone-note,.analytics-empty { margin: .75rem 0; color: #d4bd91; font-size: .85rem; }
.analytics-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
.analytics-summary > :first-child { grid-column: 1 / -1; }
.analytics-primary-metric,.analytics-supporting-metric { min-width: 0; padding: 1rem; border: 1px solid var(--line); border-radius: 1rem; background: var(--card); }
.analytics-primary-metric .eyebrow { margin: 0 0 .3rem; color: #9baab5; font-size: .69rem; letter-spacing: .075em; }
.analytics-primary-metric:first-child > strong { font-size: clamp(1.55rem, 8vw, 2.25rem); }
.analytics-metric-note { display: block; margin-top: .3rem; color: var(--muted); font-size: .78rem; }
.analytics-primary-metric > strong { display: block; font-size: clamp(1.3rem, 6vw, 2.25rem); letter-spacing: -.035em; font-variant-numeric: tabular-nums; line-height: 1.1; overflow-wrap: anywhere; }
.analytics-trend-section { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.analytics-section-heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: .6rem; }
.analytics-section-heading .eyebrow { margin: 0 0 .15rem; color: #8ea2b1; font-size: .68rem; letter-spacing: .08em; }
.analytics-section-heading h2 { margin: 0; font-size: 1.12rem; letter-spacing: -.02em; }
.analytics-section-heading > p { margin: 0; color: var(--muted); font-size: .75rem; }
.analytics-chart { display: block; width: 100%; max-width: 35rem; height: auto; margin-inline: auto; overflow: visible; }
.analytics-grid { stroke: var(--line); stroke-width: 1; }
.analytics-axis-label { fill: #9ba9b5; font: 13px "Segoe UI", "Ubuntu", sans-serif; }
.analytics-bar { fill: #55c6df; opacity: .9; }
.analytics-bar.is-zero { fill: transparent; stroke: #31414c; stroke-width: 1; }
.analytics-empty-trend { margin: .8rem 0 1.1rem; padding: 1rem; border: 1px solid var(--line); border-radius: .85rem; color: var(--muted); font-size: .86rem; }
.analytics-today-drives { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.analytics-today-drives li { display: flex; justify-content: space-between; gap: 1rem; padding: .8rem .15rem; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.analytics-today-drives time { color: var(--muted); }
.analytics-today-drives span { font-weight: 650; }
.analytics-more-drives { color: var(--muted); font-size: .76rem; }
.analytics-supporting { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; margin-top: 1.25rem; }
.analytics-supporting-metric { padding: .75rem; }
.analytics-supporting-metric .eyebrow { margin: 0 0 .3rem; color: #9baab5; font-size: .66rem; letter-spacing: .065em; line-height: 1.25; }
.analytics-supporting-metric > strong { display: block; font-size: clamp(1.05rem, 4vw, 1.4rem); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; line-height: 1.15; }
.charging-demo-shell { width: min(100% - 1.5rem, 52rem); padding: 1.25rem 0 3rem; }
.charging-demo-shell { width: min(100% - 1.5rem, 52rem); padding: 1.25rem 0 3rem; }
.charging-demo-header { margin-bottom: 1rem; }
.charging-demo-header h1 { margin: 0; font-size: clamp(1.8rem, 7vw, 2.5rem); letter-spacing: -.04em; }
.charging-demo-heading { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; }
.charging-demo-count { color: var(--muted); font-size: .85rem; }
.charging-demo-gain { margin: .4rem 0 0; color: var(--muted); font-size: .8rem; }
.charging-episodes { margin-top: .8rem; border-top: 1px solid var(--line); }
.charging-episodes summary { cursor: pointer; min-height: 44px; padding: .8rem 0 .4rem; font-weight: 650; font-size: .9rem; }
.charging-episodes ol { list-style: none; padding: 0 0 0 .65rem; margin: .4rem 0; border-left: 2px solid var(--accent); }
.charging-episodes li { padding: .35rem 0 .6rem .55rem; min-width: 0; }
.charging-episode-heading { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .4rem; font-size: .86rem; }
.charging-episode-times { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .35rem; color: var(--muted); font-size: .8rem; }
.charging-episode-battery { margin: .35rem 0 0; font-size: .86rem; }
.charging-episode-battery > span:first-child { color: var(--muted); margin-right: .4rem; }
.charging-demo-demo-label { margin: 0 0 .25rem; color: var(--muted); font-size: .76rem; }
.charging-demo-list { display: grid; gap: .8rem; }
.charging-demo-session,.charging-demo-empty { min-width: 0; padding: 1rem; border: 1px solid var(--line); border-radius: 1rem; background: var(--card); }
.charging-demo-session-header { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; padding-bottom: .7rem; border-bottom: 1px solid var(--line); }
.charging-demo-session h2 { margin: 0; font-size: 1.12rem; }
.charging-demo-date { flex: 0 0 auto; color: var(--muted); font-size: .84rem; font-variant-numeric: tabular-nums; }
.charging-demo-times { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; margin: .8rem 0; }
.charging-demo-times div { min-width: 0; }
.charging-demo-times dt,.charging-demo-energy > span,.charging-demo-battery-heading > span { color: var(--muted); font-size: .78rem; }
.charging-demo-times dd { margin: .18rem 0 0; font-size: .92rem; font-weight: 650; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.charging-demo-battery { margin: .9rem 0; }
.charging-demo-battery-heading { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; }
.charging-demo-battery-heading strong { font-size: clamp(1.35rem, 5vw, 1.75rem); font-variant-numeric: tabular-nums; }
.charging-demo-battery-bar { width: 100%; height: .8rem; margin-top: .45rem; overflow: hidden; border: 1px solid #48545d; border-radius: 999px; background: #273139; }
.charging-demo-battery-bar svg { display: block; width: 100%; height: 100%; }
.charging-demo-battery-unavailable { margin: .85rem 0; }
.charging-demo-battery-unavailable span { display: block; color: var(--muted); font-size: .78rem; }
.charging-demo-battery-unavailable strong { display: block; margin-top: .2rem; font-size: .92rem; }
.charging-demo-energy { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; padding-top: .7rem; border-top: 1px solid var(--line); }
.charging-demo-energy strong { font-size: 1.15rem; }
.charging-demo-empty h2 { margin: 0; font-size: 1rem; }
.charging-demo-empty p { margin: .35rem 0 0; color: var(--muted); font-size: .86rem; }
@media (min-width: 600px) {
  .analytics-shell { width: min(100% - 3rem, 64rem); padding-top: 1.75rem; }
  .analytics-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .9rem; }
  .analytics-summary > :first-child { grid-column: auto; }
  .analytics-primary-metric { padding: 1.1rem; }
  .analytics-primary-metric:first-child > strong { font-size: clamp(1.3rem, 6vw, 2.25rem); }
  .analytics-supporting { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .9rem; }
  .analytics-supporting-metric { padding: 1rem; }
}

@media (max-width: 520px) {
  .charging-demo-session { padding: .85rem; }
  .charging-demo-times { gap: .5rem; }
  .charging-demo-session-header { align-items: flex-start; }
  .charging-demo-date { font-size: .78rem; }
}

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

@media (min-width: 900px) {
  .vehicle-summary { grid-template-columns: minmax(0, 1fr); gap: .75rem; align-items: stretch; }
  .home-drive-facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .home-hero { min-height: 27rem; padding-top: 2rem; }
  .location-surface { height: 17rem; }
  .home-content { margin-top: -4.6rem; }
  .shell.with-steps {
    width: min(100% - 3rem, 64rem);
    display: grid;
    grid-template-columns: 14rem minmax(0, 1fr);
    gap: 1.5rem;
    align-items: start;
    padding-top: 2rem;
  }

  .steps {
    display: grid;
    overflow: visible;
  }

  .steps li { border-radius: 12px; }

  .actions { grid-template-columns: auto auto; justify-content: start; }

  button,
  .button { width: auto; }

  .cars { grid-template-columns: 1fr 1fr; }

  .who { max-width: 22rem; }

  .drive-facts {
    grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr));
  }

  .drive-trace svg {
    max-height: 16rem;
  }

  .drive-places {
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
  }

  .drive-row { gap: 1.05rem; padding: 1.35rem; }
  .drive-row-time strong { font-size: 1.05rem; }
  .drive-row-route { gap: 1rem; padding: 1rem 0; }
  .drive-row-endpoint strong { font-size: 1rem; }
  .drive-row-facts { grid-template-columns: repeat(2, minmax(10rem, 1fr)); max-width: 30rem; gap: 1.5rem; }
}

/* Independent thermistor instrumentation; fixture Celsius is explicitly labelled. */
.drive-temperature-section { min-width: 0; }
.temperature-legend { display: flex; flex-wrap: wrap; gap: .6rem 1rem; font-size: .85rem; color: var(--muted); margin: .5rem 0; }
.temperature-minimum { color: var(--accent); }
.temperature-maximum { color: #eab875; }
.drive-temperature-graph { display: block; width: 100%; height: 200px; overflow: visible; }
.drive-temperature-graph path { fill: none; stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.drive-temperature-graph .temperature-minimum { stroke: var(--accent); fill: var(--accent); }
.drive-temperature-graph .temperature-maximum { stroke: #eab875; fill: #eab875; }
.temperature-grid { stroke: var(--line); stroke-width: .5; }
@media (max-width: 760px) { .drive-temperature-graph { height: 170px; } }

.drive-temperature-section .drive-speed-chart { margin-top: .7rem; }
.drive-temperature-section .drive-speed-x-axis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.drive-temperature-section .drive-speed-x-axis span:nth-child(2) { justify-self: end; }

/* Drive-associated nominal energy and independently reported tyre readings. */
.drive-energy-summary { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; margin: 0; }
.drive-energy-summary div { min-width: 0; }
.drive-energy-summary dt, .drive-energy-units { font-size: .875rem; color: var(--muted); }
.drive-energy-summary dd { margin: .15rem 0 0; font-variant-numeric: tabular-nums; font-size: 1rem; }
.drive-tyre-reading time { font-size: .8125rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.drive-energy-section { min-width: 0; }
.drive-energy-section .drive-speed-chart { margin-top: .7rem; }
.drive-energy-section .drive-speed-x-axis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.drive-energy-section .drive-speed-x-axis span:last-child { justify-self: end; }
.drive-energy-graph { display: block; width: 100%; height: 200px; overflow: visible; }
.drive-energy-graph path { fill: none; stroke: var(--accent); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.drive-energy-graph circle { fill: var(--accent); }
@media (max-width: 760px) { .drive-energy-graph { height: 170px; } }

@media (max-width: 400px) {
  .drive-tyres { grid-template-columns: minmax(0, 1fr) 40px minmax(0, 1fr); column-gap: 4px; }
  .drive-tyre-car { width: 40px; height: 100px; }
  .drive-tyre-reading strong { font-size: 1rem; white-space: nowrap; }
  .drive-tyre-reading time { font-size: .75rem; white-space: nowrap; }
}
.drive-carousel-dots { transform: translateY(-50%); }
@media (max-width: 400px) {
  /* Keep recorded endpoint ticks readable when text is enlarged. */
  .drive-carousel .drive-speed-section .drive-speed-x-axis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .drive-carousel .drive-speed-section .drive-speed-x-axis span { white-space: nowrap; }
  .drive-carousel .drive-speed-section .drive-speed-x-axis span:nth-child(2) { display: none; }
}

/* Public entry pages: keep setup and authenticated surfaces unchanged. */
.public-page .top { background: transparent; }
.public-page .top-inner { width: min(100% - 2.5rem, 64rem); min-height: 4.5rem; }
.public-page .wordmark { font-size: 1.35rem; }
.public-page .banner { background: #16242d; color: var(--muted); font-size: .875rem; }
.public-page .public-shell { width: min(100% - 2.5rem, 27rem); padding: clamp(2.5rem, 8vh, 6rem) 0 max(3rem, env(safe-area-inset-bottom)); }
.public-page .landing-shell { width: min(100% - 2.5rem, 48rem); padding-top: clamp(3rem, 12vh, 8rem); }
.landing-intro h1 { max-width: 12ch; font-size: clamp(2.75rem, 7vw, 4.75rem); line-height: 1.06; letter-spacing: -.045em; font-weight: 650; margin-bottom: 1.5rem; }
.landing-summary { max-width: 31rem; color: var(--muted); font-size: 1.125rem; line-height: 1.65; }
.landing-actions { display: grid; gap: .75rem; margin-top: 2rem; max-width: 24rem; }
.landing-actions .button { margin: 0; }
.public-page .button.secondary { border-color: var(--line); color: var(--ink); }
.auth-page h1 { font-size: 2rem; margin-bottom: 1.75rem; }
.auth-page form { margin: 0; }
.auth-page label { margin-top: 1.25rem; }
.auth-page input { background: var(--card); border-color: var(--line); color: var(--ink); caret-color: var(--accent); }
.auth-page input:autofill { box-shadow: inset 0 0 0 1000px var(--card); -webkit-text-fill-color: var(--ink); }
.auth-page form button { margin-top: 1.5rem; }
.auth-page .hint { font-size: .875rem; line-height: 1.6; margin-top: .65rem; }
.auth-page .switch { margin-top: 1.5rem; font-size: .9375rem; }
.public-page .error { background: #331d24; color: #ffbdc6; margin-bottom: 1rem; }
.public-page a:focus-visible, .public-page button:focus-visible, .public-page input:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.public-page input:focus-visible { border-color: var(--accent); outline-offset: 2px; }
.public-page .skip { z-index: 10; background: var(--card); color: var(--ink); }
@media (min-width: 600px) {
  .landing-actions { grid-template-columns: 1fr 1fr; max-width: 26rem; }
}

/* Tyre pressure screen. */
.tyre-shell { width: min(100% - 1.5rem, 32rem); padding: 1.25rem 0 3rem; }
.tyre-header { margin-bottom: 1rem; }
.tyre-header h1 { margin: 0; font-size: clamp(1.8rem, 7vw, 2.5rem); letter-spacing: -.04em; }
.tyre-demo-label { margin: 0 0 .25rem; color: var(--muted); font-size: .76rem; }
.tyre-card { padding: 1rem; border: 1px solid var(--line); border-radius: 1rem; background: var(--card); }
.tyre-units { margin: 0 0 .6rem; text-align: center; color: var(--muted); font-size: .875rem; }
.tyre-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(70px, 110px) minmax(0, 1fr); grid-template-rows: 1fr 1fr; align-items: center; gap: .6rem; max-width: 26rem; margin: auto; }
.tyre-car { grid-column: 2; grid-row: 1 / 3; width: 100%; height: auto; fill: none; stroke: var(--muted); stroke-width: 2; }
.tyre-car .tyre-wheel { fill: var(--muted); stroke: none; }
.tyre-reading { display: grid; gap: .2rem; min-width: 0; text-align: center; }
.tyre-reading span { color: var(--muted); font-size: .8125rem; }
.tyre-reading strong { font-size: 1.75rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.tyre-reading time { color: var(--muted); font-size: .8125rem; font-variant-numeric: tabular-nums; }
.tyre-reading.is-stale strong, .tyre-reading.is-stale time { opacity: .55; }
.tyre-reading.is-missing strong, .tyre-reading.is-invalid strong { color: var(--muted); }
.tyre-reading.wheel-fl { grid-column: 1; grid-row: 1; }
.tyre-reading.wheel-fr { grid-column: 3; grid-row: 1; }
.tyre-reading.wheel-rl { grid-column: 1; grid-row: 2; }
.tyre-reading.wheel-rr { grid-column: 3; grid-row: 2; }
.tyre-empty { margin: .75rem 0 0; text-align: center; color: var(--muted); font-size: .875rem; }
@media (max-width: 400px) {
  .tyre-reading strong { font-size: 1.35rem; white-space: nowrap; }
  .tyre-grid { gap: .4rem; }
}
