/* Volttimatka – ulkoasu.
   Rakenne: muuttujat → perusta → yläpalkki → asettelu → reittikortti → kentät → painikkeet → asetusikkunat →
   tulokset → dialogit → kartta → alapalkki → tekstisivut. Värit vain muuttujina (tumma teema). */

/* Inter (OFL-1.1, public/vendor/inter/LICENSE), oma palvelin: CSP sallii vain oman alkuperän. */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("vendor/inter/inter-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("vendor/inter/inter-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #f2f5f3;
  --surface: #ffffff;
  --surface-2: #f3f6f4;
  --surface-3: #e7ece9;
  --text: #0f1a15;
  --text-2: #33413b;
  --muted: #56635d;
  --browse-other: #f0a04b; /* selauskerros: muiden kuin valittujen operaattorien asemat (vaalea oranssi) */
  --border: #e1e7e4;
  --border-strong: #c8d2cd;
  --accent: #0a7457;
  --accent-hover: #075f47;
  --accent-text: #ffffff;
  --accent-soft: #e2f3ec;
  --accent-ink: #065a43;
  --warn: #8f5300;
  --warn-soft: #fff3de;
  --danger: #b3261e;
  --danger-soft: #fdecea;
  --ok: #1d7a3a;
  --ring: 0 0 0 3px rgb(10 116 87 / 0.18);
  --shadow-sm: 0 1px 2px rgb(15 26 21 / 0.06);
  --shadow: 0 1px 2px rgb(15 26 21 / 0.05), 0 10px 30px -12px rgb(15 26 21 / 0.14);
  --shadow-lg: 0 2px 6px rgb(15 26 21 / 0.06), 0 28px 56px -16px rgb(15 26 21 / 0.32);
  --radius: 18px;
  --radius-md: 12px;
  --radius-sm: 9px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c1210;
    --surface: #141b18;
    --surface-2: #1a2320;
    --surface-3: #232e2a;
    --text: #e9efec;
    --text-2: #c9d3cf;
    --muted: #a3b1ab;
    --browse-other: #f2b36b;
    --border: #25302c;
    --border-strong: #36443e;
    --accent: #4cc79e;
    --accent-hover: #6dd6b2;
    --accent-text: #05140e;
    --accent-soft: #143329;
    --accent-ink: #7fdfbf;
    --warn: #f0b45a;
    --warn-soft: #34291a;
    --danger: #f2948c;
    --danger-soft: #3a1f1d;
    --ok: #74d18f;
    --ring: 0 0 0 3px rgb(76 199 158 / 0.25);
    --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4);
    --shadow: 0 1px 2px rgb(0 0 0 / 0.35), 0 10px 30px -12px rgb(0 0 0 / 0.6);
    --shadow-lg: 0 28px 56px -16px rgb(0 0 0 / 0.75);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c1210;
  --surface: #141b18;
  --surface-2: #1a2320;
  --surface-3: #232e2a;
  --text: #e9efec;
  --text-2: #c9d3cf;
  --muted: #a3b1ab;
  --browse-other: #f2b36b;
  --border: #25302c;
  --border-strong: #36443e;
  --accent: #4cc79e;
  --accent-hover: #6dd6b2;
  --accent-text: #05140e;
  --accent-soft: #143329;
  --accent-ink: #7fdfbf;
  --warn: #f0b45a;
  --warn-soft: #34291a;
  --danger: #f2948c;
  --danger-soft: #3a1f1d;
  --ok: #74d18f;
  --ring: 0 0 0 3px rgb(76 199 158 / 0.25);
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4);
  --shadow: 0 1px 2px rgb(0 0 0 / 0.35), 0 10px 30px -12px rgb(0 0 0 / 0.6);
  --shadow-lg: 0 28px 56px -16px rgb(0 0 0 / 0.75);
  color-scheme: dark;
}

/* ---------- Perusta */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.5 var(--font);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: clip;
}
a { color: var(--accent); text-underline-offset: 2px; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { -webkit-tap-highlight-color: transparent; }
h1, h2, h3 { letter-spacing: -0.015em; }
b, strong { font-weight: 650; }
[hidden] { display: none !important; }
.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; }
.muted { color: var(--muted); font-weight: 400; }
.small { font-size: 0.85rem; color: var(--muted); margin: 0; }
.hint { color: var(--muted); font-size: 0.84rem; line-height: 1.5; margin: 10px 0 0; }
.hint b { color: var(--text-2); font-weight: 600; }
.stack { display: flex; flex-direction: column; gap: 16px; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; }

/* ---------- Yläpalkki */
.top {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 64px;
  padding: 10px 20px;
  padding-top: max(10px, env(safe-area-inset-top));
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; min-width: 0; }
.brand img { flex: none; border-radius: 10px; box-shadow: 0 2px 6px rgb(10 116 87 / 0.25); }
.brand > span { min-width: 0; }
.brand .brand-name, .brand strong { display: block; margin: 0; font-size: 1.06rem; font-weight: 700; line-height: 1.25; letter-spacing: -0.02em; }
.brand small { display: block; color: var(--muted); font-size: 0.8125rem; line-height: 1.35; margin-top: 1px; }
.top-actions { display: flex; gap: 6px; align-items: center; flex: none; }
.top-actions .ghost { display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 0 14px; border-color: transparent; background: transparent; color: var(--text-2); font-weight: 550; }
.top-actions .ghost:hover { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.top-actions .ghost svg { flex: none; }
.account-btn { max-width: 240px; border-color: var(--border) !important; }
.account-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-ink); font-size: 0.74rem; font-weight: 700; font-variant-numeric: tabular-nums;
}

.notice {
  margin: 12px 20px 0;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--warn-soft);
  color: var(--text);
  border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent);
  font-size: 0.95rem;
}

/* ---------- Asettelu
   Leveällä näytöllä sivupaneeli (reittikortti ja tulokset) vasemmalla ja kartta oikealla; kapealla allekkain:
   reittikortti, kartta, tulokset. */
.main { flex: 1; width: 100%; }
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  padding: 16px;
  width: 100%;
  margin: 0 auto;
}
.plan-col { min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.results-col { min-width: 0; }
.layout:not(.has-results) .results-col { display: none; }
.map-wrap { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.map-box { position: relative; flex: 1; display: flex; min-height: 0; }
#map {
  flex: 1;
  height: 52vh;
  min-height: 300px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-3);
  box-shadow: var(--shadow-sm);
  z-index: 0;
}

@media (min-width: 1024px) {
  .layout {
    /* Joustava paneeli (käyttäjän pyyntö 6.10.2026): ~365 px 1024 px:n näytöllä, ~405 px 1366:lla, 470 px 1920:lla. */
    grid-template-columns: clamp(360px, calc(12vw + 240px), 470px) minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    align-items: start;
    gap: 20px;
    padding: 20px;
  }
  .plan-col { display: contents; }
  #routeCard { grid-column: 1; grid-row: 1; }
  .results-col { grid-column: 1; grid-row: 2; }
  .map-wrap { grid-column: 2; grid-row: 1 / span 2; position: sticky; top: 84px; height: calc(100vh - 104px); }
  #map { height: 100%; }
  /* Yläpalkki pysyy näkyvissä; kartta täyttää loput näkymästä. */
  .top { position: sticky; top: 0; z-index: 1200; }
  .results { scroll-margin-top: 84px; }
}

/* ---------- Kortit */
.card {
  margin: 0;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  min-width: 0;
}
.card legend { float: left; width: 100%; padding: 0; margin-bottom: 10px; font-weight: 650; font-size: 1.05rem; }
.card legend ~ * { clear: both; }
.card legend.sr-only { float: none; width: 1px; margin: -1px; }

/* ---------- Reittikortti */
.route-bar { container-type: inline-size; display: flex; flex-direction: column; }
.stops { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 10px; align-items: center; }
.stop-fields { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.stop-fields .field { margin: 0; }
.vias { display: flex; flex-direction: column; gap: 12px; }
.vias:empty { display: none; }
.rb-swap { margin-top: 26px; border-radius: 999px; width: 40px; min-width: 40px; height: 40px; min-height: 40px; color: var(--text-2); }
.rb-swap:hover { color: var(--accent); border-color: var(--accent); }
.add-via {
  align-self: flex-start;
  display: inline-flex; align-items: center; gap: 6px;
  margin: 8px 0 0 -4px; padding: 6px 8px; min-height: 36px;
  border: 0; border-radius: var(--radius-sm); background: none; cursor: pointer;
  color: var(--accent); font-weight: 600; font-size: 0.92rem;
}
.add-via:hover { background: var(--accent-soft); }
.trip-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px;
  margin-top: 14px; padding-top: 16px; border-top: 1px solid var(--border);
}
.trip-grid .field { margin: 0; }
.rb-time { grid-column: 1 / -1; }
@container (min-width: 620px) {
  .trip-grid { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1fr); }
  .rb-time { grid-column: auto; }
}
.settings-rows { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; margin-top: 16px; }
@container (min-width: 620px) { .settings-rows { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.set-btn, .row-btn {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px;
  width: 100%; min-height: 60px; padding: 10px 12px 10px 10px;
  border: 1px solid var(--border); border-radius: var(--radius-md);
  background: var(--surface); text-align: left; cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.row-btn { grid-template-columns: minmax(0, 1fr) auto; padding: 10px 12px 10px 14px; margin-top: 4px; }
/* Operaattorit ja hinnat korostettuna Latausasemat-ikkunan alussa (käyttäjän pyyntö 5.10.2026) */
.row-btn.row-feature { grid-template-columns: auto minmax(0, 1fr) auto; padding: 10px 12px 10px 10px; margin: 0 0 14px; border: 2px solid var(--accent); background: var(--accent-soft); }
.row-btn.row-feature .set-title { color: var(--accent-ink); font-weight: 700; }
.row-btn.row-feature .set-ico { background: var(--accent); color: var(--accent-text); }
.row-btn.row-feature:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent-soft) 70%, var(--accent) 12%); }
.set-btn:hover, .row-btn:hover { border-color: var(--border-strong); background: var(--surface-2); }
.set-btn[aria-expanded="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: var(--ring); }
.set-ico { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; background: var(--accent-soft); color: var(--accent); }
.set-btn[aria-expanded="true"] .set-ico { background: var(--accent); color: var(--accent-text); }
.set-text { display: flex; flex-direction: column; min-width: 0; }
.set-title { display: flex; align-items: center; gap: 8px; font-weight: 650; font-size: 0.95rem; }
.set-sum { color: var(--muted); font-size: 0.8125rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.set-chev { color: var(--muted); flex: none; }
.setup-hint {
  display: inline-block; padding: 1px 8px; border-radius: 999px;
  background: var(--danger-soft); color: var(--danger); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.01em;
}
.rb-go { width: 100%; margin-top: 16px; }

/* Tiivis reittikortti laskennan jälkeen (käyttäjän pyyntö 6.10.2026, setRouteCompact app.js): lomakkeen tilalla
   reitti, lähtö ja varaukset sekä Muokkaa; Asetukset ja Latauspysähdykset jäävät näkyviin. */
.route-compact { display: flex; align-items: center; gap: 12px; }
.rc-main { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.rc-route { font-weight: 650; font-size: 1.04rem; line-height: 1.3; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rc-meta { color: var(--muted); font-size: 0.8125rem; line-height: 1.4; font-variant-numeric: tabular-nums; }
.rc-edit { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px; }
.route-bar.compact .stops, .route-bar.compact .add-via, .route-bar.compact .trip-grid, .route-bar.compact .rb-go { display: none; }
.route-bar.compact .settings-rows { margin-top: 14px; }
.route-bar.compact.needs-update .rb-go { display: block; }
.route-bar .progress, .route-bar .error { margin-top: 14px; }

/* ---------- Kentät */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; position: relative; min-width: 0; }
.field:last-child { margin-bottom: 0; }
.field > label, .field .label { font-size: 0.8125rem; font-weight: 600; color: var(--text-2); letter-spacing: 0.005em; }

input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="hidden"]), select, textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  color: var(--text);
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
  appearance: none;
}
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 85%, transparent); }
input:not([type="checkbox"]):not([type="radio"]):hover, select:hover, textarea:hover { border-color: var(--border-strong); }
input:not([type="checkbox"]):not([type="radio"]):focus, select:focus, textarea:focus { border-color: var(--accent); background: var(--surface); box-shadow: var(--ring); outline: none; }
input[aria-invalid="true"] { border-color: var(--danger) !important; background: var(--danger-soft) !important; }
input[type="number"] { font-variant-numeric: tabular-nums; -moz-appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type="datetime-local"] { font-variant-numeric: tabular-nums; }
select {
  padding-right: 40px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6' fill='none' stroke='%235f6d67' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
textarea { min-height: 130px; resize: vertical; line-height: 1.5; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }

.input-wrap { position: relative; }
.input-wrap input { padding-right: 48px !important; }
.in-btn {
  position: absolute; right: 5px; top: 50%; transform: translateY(-50%);
  width: 36px; height: 36px; display: grid; place-items: center;
  border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--muted); cursor: pointer;
}
.in-btn:hover { background: var(--surface-3); color: var(--accent); }
.unit-wrap { position: relative; }
.unit-wrap input { padding-right: 46px !important; }
.unit-wrap.wide-unit input { padding-right: 104px !important; }
.unit {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-size: 0.88rem; pointer-events: none; white-space: nowrap;
}

.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px 12px; }
.grid2 .field { margin: 0; }
.addr-row { display: flex; gap: 8px; }
.addr-row input { flex: 1; min-width: 0; }

.suggest {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 1000;
  margin: 6px 0 0; padding: 6px; list-style: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-height: 300px; overflow: auto;
}
.suggest li { padding: 10px 12px; border-radius: var(--radius-sm); cursor: pointer; font-size: 0.95rem; }
.suggest li[aria-selected="true"], .suggest li:hover { background: var(--accent-soft); color: var(--accent-ink); }
.suggest li.info { cursor: default; color: var(--muted); }
.suggest li.info:hover { background: none; color: var(--muted); }

/* ---------- Painikkeet */
.primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 22px;
  border: 0; border-radius: var(--radius-md);
  background: var(--accent);
  background-image: linear-gradient(180deg, rgb(255 255 255 / 0.1), rgb(255 255 255 / 0));
  color: var(--accent-text);
  font-weight: 650; font-size: 1.02rem; letter-spacing: -0.005em;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.12), 0 8px 20px -10px var(--accent);
  cursor: pointer;
  transition: background-color 0.15s, transform 0.05s, box-shadow 0.15s;
  text-decoration: none;
}
.primary:hover { background-color: var(--accent-hover); }
.primary:active { transform: translateY(1px); }
.primary:disabled { opacity: 0.6; cursor: progress; }
.ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 44px; padding: 0 16px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-md);
  background: var(--surface); color: var(--text);
  font-weight: 550; cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background-color 0.15s, border-color 0.15s;
}
.ghost:hover { background: var(--surface-2); border-color: var(--muted); }
.icon-btn {
  min-width: 44px; min-height: 44px;
  display: inline-grid; place-items: center;
  border: 1px solid var(--border); border-radius: var(--radius-md);
  background: var(--surface); color: var(--text-2); cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.close-btn, .dialog-head .icon-btn { min-width: 38px; min-height: 38px; width: 38px; height: 38px; border-radius: 999px; border-color: transparent; background: var(--surface-2); }
.close-btn:hover, .dialog-head .icon-btn:hover { background: var(--surface-3); }
.link-btn { border: 0; background: none; color: var(--accent); padding: 6px 0; cursor: pointer; font-size: 0.9rem; font-weight: 550; }
.link-btn:hover { text-decoration: underline; }
.danger-link { color: var(--danger); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { display: inline-flex; align-items: center; min-height: 40px; padding: 6px 14px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); cursor: pointer; user-select: none; }
.chip input:checked + span { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Segmenttivalitsin (radiopainikkeet) */
.seg { display: inline-flex; padding: 4px; gap: 4px; border-radius: var(--radius-md); background: var(--surface-2); border: 1px solid var(--border); align-self: flex-start; max-width: 100%; overflow-x: auto; }
.seg label { position: relative; display: flex; align-items: center; justify-content: center; min-height: 38px; padding: 0 14px; border-radius: var(--radius-sm); cursor: pointer; font-weight: 550; font-size: 0.92rem; color: var(--text-2); white-space: nowrap; }
.seg label input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { background: var(--surface); color: var(--accent-ink); box-shadow: var(--shadow-sm), 0 0 0 1px var(--border); }
.seg label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 1px; }

details.adv { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 12px; }
details.adv summary { cursor: pointer; font-weight: 600; font-size: 0.92rem; padding: 4px 0; list-style: none; display: flex; align-items: center; gap: 8px; }
details.adv summary::-webkit-details-marker { display: none; }
details.adv summary::before { content: ""; width: 7px; height: 7px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform 0.15s; }
details.adv[open] summary::before { transform: rotate(45deg); }
details.adv[open] summary { margin-bottom: 12px; }

.progress { display: flex; flex-direction: column; gap: 8px; }
.progress .bar { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.progress .bar span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 3px; transition: width 0.2s; }
.progress p { margin: 0; color: var(--muted); font-size: 0.88rem; display: flex; align-items: center; gap: 8px; }

.error, .warn-box, .ok-box {
  padding: 12px 14px; border-radius: var(--radius-md); font-size: 0.93rem; line-height: 1.5;
}
.error { background: var(--danger-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent); }
.warn-box { background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 28%, transparent); }
.warn-box p { margin: 0 0 6px; }
.warn-box p:last-child { margin: 0; }
.ok-box { background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); margin: 0 0 12px; }

/* ---------- Asetusikkunat (Auto, Latausasemat): kartan päällä sivupaneelin vieressä, puhelimessa alhaalta */
.float-panel {
  position: absolute; top: 12px; left: 12px; z-index: 1100;
  width: min(420px, calc(100% - 24px)); max-height: calc(100% - 24px);
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  animation: panel-in 0.16s ease-out;
}
@keyframes panel-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.float-panel[hidden] { display: none; }
.float-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 18px 18px 4px 20px; }
.float-head h2 { margin: 0; font-size: 1.15rem; }
.float-sub { margin: 2px 0 0; color: var(--muted); font-size: 0.84rem; }
.float-body { padding: 14px 20px 16px; overflow: auto; }
.float-foot { padding: 12px 20px 20px; border-top: 1px solid var(--border); }
.float-foot .primary { width: 100%; min-height: 48px; }
.sync-note { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border); }
@media (max-width: 1023px) {
  .float-panel {
    position: fixed; top: auto; left: 0; right: 0; bottom: 0; width: auto;
    max-height: 88vh; border-radius: 22px 22px 0 0; border-bottom: 0;
    padding-bottom: env(safe-area-inset-bottom);
    animation: sheet-in 0.2s ease-out;
  }
  .float-panel::before { content: ""; align-self: center; width: 40px; height: 4px; margin-top: 8px; border-radius: 2px; background: var(--border-strong); }
  .float-head { padding-top: 10px; }
}
@keyframes sheet-in { from { transform: translateY(24px); opacity: 0.6; } to { transform: none; opacity: 1; } }

/* ---------- Tulokset */
.results { display: flex; flex-direction: column; gap: 16px; scroll-margin-top: 16px; }
.res-head { display: flex; flex-direction: column; gap: 4px; }
.res-kicker { margin: 0; color: var(--accent); font-size: 0.78rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.results h2 { margin: 0; font-size: 1.2rem; line-height: 1.3; overflow-wrap: anywhere; }
.route-title { font-weight: 650; overflow-wrap: anywhere; }
.res-vias { margin: 0; color: var(--muted); font-size: 0.86rem; }
.hero { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; margin-top: 16px; padding: 16px 18px; border-radius: var(--radius-md); background: linear-gradient(135deg, var(--accent-soft), color-mix(in srgb, var(--accent-soft) 40%, var(--surface))); }
.hero-main b { display: block; font-size: 1.9rem; line-height: 1.1; font-weight: 750; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.hero-main small, .hero-side small { color: var(--text-2); font-size: 0.82rem; }
.hero-side { text-align: right; }
.hero-side b { display: block; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; margin-top: 12px; border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
.stat { padding: 12px 14px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); min-width: 0; }
.stat:nth-child(2n) { border-right: 0; }
.stat:nth-last-child(-n + 2):nth-child(odd), .stat:last-child { border-bottom: 0; }
.stat b { display: block; font-size: 1.08rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.stat small { display: block; color: var(--muted); font-size: 0.8125rem; line-height: 1.35; }
.res-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.res-actions .ghost { min-height: 44px; padding: 0 10px; font-size: 0.9rem; }
.res-actions .ghost svg { flex: none; }
.results .card > .warn-box, .results .card > .ok-box { margin: 12px 0 0; }
.res-note { margin: 12px 0 0; padding: 0 12px; }
.res-nav { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.res-nav .ghost { width: 100%; }
.res-nav .ghost svg { color: var(--accent); }
.res-trip { margin: 12px 0 0; color: var(--muted); font-size: 0.8125rem; text-align: center; }
.res-trip a { color: var(--accent-ink); font-weight: 600; white-space: nowrap; }
.res-strategy { margin-top: 10px; }

/* Valintakortit (latausstrategia) */
.choices { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.choices legend { padding: 0; margin-bottom: 8px; }
.choice { position: relative; display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-md); cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.choice:hover { border-color: var(--border-strong); }
.choice input { margin-top: 3px; width: 18px; height: 18px; flex: none; }
.choice span { display: flex; flex-direction: column; gap: 2px; }
.choice b { font-weight: 600; font-size: 0.95rem; }
.choice small { color: var(--muted); font-size: 0.82rem; line-height: 1.4; }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: var(--ring); }
.trip-fields { display: flex; flex-direction: column; gap: 14px; margin-top: 16px; }
.trip-fields .field { margin: 0; }
.car-profiles { margin-bottom: 16px; }
.weather-check { align-items: flex-start; margin-top: 16px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-md); }
.weather-check input { margin-top: 3px; }
.weather-check span { display: flex; flex-direction: column; gap: 2px; }
.weather-check b { font-weight: 600; font-size: 0.95rem; }
.weather-check small { color: var(--muted); font-size: 0.82rem; line-height: 1.4; }

/* Varauskäyrä */
.chart-card { padding-bottom: 16px; }
.chart-title { margin: 0 0 8px; font-size: 1rem; }
.soc-chart { width: 100%; height: auto; display: block; overflow: visible; }
.ch-elev { fill: var(--surface-3); }
.ch-elev-t { fill: var(--muted); font: 500 11px var(--font); }
.ch-grid { stroke: var(--border); stroke-width: 1; }
.ch-min { stroke: var(--warn); stroke-width: 1.2; stroke-dasharray: 4 4; }
.ch-ax { fill: var(--muted); font: 500 11px var(--font); }
.curve-chart { margin: 4px 0 2px; padding: 10px 12px 8px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface-2); }
.curve-chart svg { display: block; width: 100%; height: auto; }
.curve-area { fill: var(--accent-soft); }
.curve-note { margin: 4px 0 0; font-size: 0.82rem; color: var(--text-2); }
.ch-soc { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.ch-stop { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.ch-stop-t { fill: var(--accent-text); font: 700 10px var(--font); }
.chart-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin: 8px 0 0; color: var(--muted); font-size: 0.8125rem; }
.chart-legend span { display: inline-block; width: 14px; height: 4px; border-radius: 2px; margin-right: -8px; }
.lg-soc { background: var(--accent); }
.lg-elev { background: var(--surface-3); height: 10px !important; }
.lg-min { border-top: 2px dashed var(--warn); height: 0 !important; }
.cond-line { margin-top: 10px; }
.car-profiles .op-sub { margin-bottom: 8px; }
.car-save { margin-top: 14px; }

/* Aikajana: pysähdykset yhdessä kortissa pystyviivalla yhdistettyinä */
.timeline-card { padding: 8px 20px; }
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.tl-item { position: relative; display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 14px; padding: 12px 0; align-items: start; scroll-margin-top: 90px; }
.tl-item + .tl-item { border-top: 1px solid var(--border); }
.tl-item::before { content: ""; position: absolute; left: 16px; top: 0; bottom: 0; width: 2px; background: var(--accent-soft); }
.tl-item:first-child::before { top: 30px; }
.tl-item:last-child::before { bottom: calc(100% - 30px); }
.tl-dot {
  position: relative; z-index: 1;
  width: 34px; height: 34px; border-radius: 50%; margin-top: 1px;
  display: grid; place-items: center;
  background: var(--accent); color: var(--accent-text); font-weight: 700; font-size: 0.9rem;
  box-shadow: 0 0 0 4px var(--surface);
}
.tl-item.endpoint .tl-dot { background: var(--surface); color: var(--accent-ink); border: 2px solid var(--accent); }
.tl-item.via .tl-dot { font-size: 0.78rem; border-style: dashed; }
/* Välietapin pysähdys (reittikortti): pieni rivi osoitekentän alla. */
/* Jatkoaika: kenttä ja ”Lähden nyt” samalla rivillä; kapealla näytöllä nappi rivittyy kentän alle. */
.via-stay { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 6px; }
.via-stay label { flex: 1 0 100%; margin: 0; font-size: 0.82rem; color: var(--text-2); font-weight: 500; }
.via-stay input { flex: 1 1 230px; min-width: 0; padding-top: 6px; padding-bottom: 6px; font-size: 0.9rem; }
.via-stay .small-btn { flex: 0 0 auto; white-space: nowrap; }
.tl-details { min-width: 0; }
.tl-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 36px; }
.tl-head h3 { margin: 0; font-size: 1rem; font-weight: 650; overflow-wrap: anywhere; }
.tl-title { flex: 1; min-width: 0; }
/* Vaihda-nappi latausaseman otsikon vieressä (käyttäjän pyyntö 5.10.2026). */
.tl-name { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.swap-chip { display: inline-grid; place-items: center; width: 26px; height: 26px; padding: 0; border: 1px solid var(--accent); border-radius: 50%; background: var(--surface); color: var(--accent-ink); cursor: pointer; flex: 0 0 auto; }
.swap-chip:hover, .swap-chip[aria-expanded="true"] { background: var(--accent-soft); }
.swap-chip:focus-visible { outline: none; box-shadow: var(--ring); }
.swap-chip.off, .swap-chip.off:hover { border-color: var(--border); color: var(--muted); background: var(--surface-2); cursor: not-allowed; }
.small-btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
.tl-swap { grid-column: 2; margin-top: 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm, 8px); background: var(--surface-2); scroll-margin-top: 90px; }
.tl-km { color: var(--muted); font-size: 0.84rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tl-brief { display: block; color: var(--muted); font-size: 0.82rem; margin-top: 1px; font-variant-numeric: tabular-nums; }
/* Operaattori ja hinta otsikon alla (käyttäjän pyyntö 5.10.2026). */
.tl-op { display: block; color: var(--text-2); font-size: 0.8125rem; font-weight: 500; margin-top: 1px; font-variant-numeric: tabular-nums; }
.topup-badge { display: inline-block; margin-top: 4px; padding: 1px 8px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); font-size: 0.76rem; font-weight: 650; }
.own-badge { display: inline-block; margin: 4px 0 0 4px; padding: 1px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); font-size: 0.76rem; font-weight: 650; }
.topup-badge + .own-badge, .tl-brief + .own-badge { margin-left: 0; }
/* Pysähdyksen asetukset (latauksen tavoite, aseman vaihto) */
.stop-tools { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 12px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.stop-target { display: flex; flex-direction: column; gap: 4px; font-size: 0.82rem; color: var(--muted); font-weight: 550; }
.stop-target select { min-height: 38px; padding: 0 32px 0 10px; font-size: 0.88rem; }
.small-btn { min-height: 38px; padding: 0 12px; font-size: 0.86rem; border-radius: var(--radius-sm); }
.small-btn.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.swap-list { margin-top: 10px; }
.along-list .swap-group { list-style: none; margin: 6px 0 -2px; font-size: 0.8125rem; font-weight: 650; color: var(--text-2); text-transform: none; }
/* Latausasemat reitin varrella */
.along-card > summary { display: flex; align-items: center; gap: 10px; cursor: pointer; list-style: none; font-weight: 650; }
.along-card > summary::-webkit-details-marker { display: none; }
.along-card > summary::after { content: ""; margin-left: auto; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform 0.15s; }
.along-card[open] > summary::after { transform: rotate(-135deg); }
.along-count { padding: 1px 9px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); font-size: 0.8rem; font-weight: 650; }
.along-card[open] > summary { margin-bottom: 8px; }
.along-filters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 10px 0 12px; }
.along-filters label { display: flex; flex-direction: column; gap: 4px; font-size: 0.8125rem; color: var(--muted); font-weight: 550; min-width: 0; }
.along-filters select { min-height: 38px; padding: 0 28px 0 10px; font-size: 0.86rem; width: 100%; }
.along-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.along-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "main btn" "meta btn"; gap: 2px 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); }
.along-row.chosen { border-color: var(--accent); background: var(--accent-soft); }
.along-main { grid-area: main; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; min-width: 0; }
.along-main b { font-weight: 650; font-size: 0.92rem; overflow-wrap: anywhere; }
.along-main span { color: var(--muted); font-size: 0.82rem; }
.along-meta { grid-area: meta; display: flex; flex-wrap: wrap; gap: 2px 12px; color: var(--text-2); font-size: 0.82rem; font-variant-numeric: tabular-nums; }
.along-row .small-btn { grid-area: btn; }
/* Reittivaihtoehdot */
.alt-routes { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin-top: 14px; }
.alt-btn { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-md); background: var(--surface); color: var(--text); text-align: left; cursor: pointer; font: inherit; transition: border-color 0.15s, background-color 0.15s; }
.alt-btn:hover { border-color: var(--muted); }
.alt-btn b { font-size: 0.86rem; font-weight: 650; }
.alt-btn span { font-size: 0.86rem; font-variant-numeric: tabular-nums; }
.alt-btn small { color: var(--muted); font-size: 0.8125rem; }
.alt-btn.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: var(--ring); }
.alt-btn.on small { color: var(--accent-ink); font-weight: 600; }
/* Lisätoiminnot tulosten alla */
.res-more { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 18px; margin-top: 10px; }
.res-more .link-btn { display: inline-flex; align-items: center; gap: 5px; font-size: 0.86rem; }
.res-forced { margin: 10px 0 0; text-align: center; }
.res-forced .link-btn { padding: 0; font-size: inherit; }
/* Taulukko */
.table-scroll { overflow-x: auto; margin: 0 -4px; }
.plan-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; font-variant-numeric: tabular-nums; }
.plan-table th, .plan-table td { padding: 8px 6px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; white-space: nowrap; }
.plan-table thead th { color: var(--muted); font-weight: 600; font-size: 0.8125rem; }
.plan-table tbody th { font-weight: 600; white-space: normal; min-width: 150px; max-width: 240px; }
.plan-table tbody th small { display: block; color: var(--muted); font-weight: 550; font-size: 0.8125rem; }
.plan-table tbody tr:last-child th, .plan-table tbody tr:last-child td { border-bottom: 0; }
/* Latausasemat määränpään lähellä */
.dest-chargers { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.dest-chargers h4 { margin: 0 0 6px; font-size: 0.88rem; font-weight: 650; }
.dest-chargers ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.dest-chargers li { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 0.86rem; }
.dest-chargers li > span:first-child { display: flex; flex-direction: column; min-width: 0; }
.dest-chargers small { color: var(--muted); font-size: 0.8125rem; }
.dc-side { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.dc-side a { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); }
@media (max-width: 600px) {
  .along-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .alt-routes { grid-template-columns: 1fr; }
  .alt-btn { flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
}
.amen-brief { display: inline-flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.amen-brief:empty { display: none; }
.amen-tag { display: inline-block; padding: 0 7px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); font-size: 0.72rem; font-weight: 600; }
.along-main .amen-tag { margin-left: 2px; }
.report-badge { display: inline-block; margin: 4px 0 0 4px; padding: 1px 8px; border-radius: 999px; background: var(--danger-soft); color: var(--danger); font-size: 0.76rem; font-weight: 650; }
.reports { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); }
.reports .small { margin: 0 0 8px; }
.report-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.report-actions select { min-height: 38px; width: auto; padding: 0 32px 0 10px; font-size: 0.86rem; }
.report-actions .small-btn svg { margin-right: 2px; }
.relax-list { display: flex; flex-direction: column; align-items: stretch; gap: 6px; margin-top: 6px; }
.relax-list .small-btn { justify-content: flex-start; white-space: normal; text-align: left; height: auto; padding: 8px 12px; }
.res-tolls { margin: 10px 0 0; color: var(--text-2); }
/* Laivamatka: tiedot ja laivan saapumisajan syöttö (loppureitin aikataulu lasketaan siitä). */
.ferry-note { padding: 10px 12px; border-radius: var(--radius-sm, 10px); background: var(--surface-2); }
.ferry-note p { margin: 0 0 6px; }
.ferry-note p:last-child { margin: 0; }
.lg-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--browse-other); vertical-align: -1px; margin-right: 3px; }
.lg-dot.on { background: var(--accent); }
.lg-dot.s50 { width: 6px; height: 6px; }
.lg-dot.s100 { width: 8px; height: 8px; }
.lg-dot.s150 { width: 10px; height: 10px; }
.lg-dot.s250 { width: 10px; height: 10px; box-shadow: 0 0 0 2px #d62828; }
.ferry-leg + .ferry-leg { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.ferry-time { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 6px 0; font-weight: 600; }
.ferry-time input { font-weight: 400; max-width: 100%; }
.ferry-time .req { font-size: 0.78em; font-weight: 600; color: var(--warn); text-transform: uppercase; letter-spacing: 0.03em; }
/* Pakollinen kenttä korostetaan, kunnes aika on annettu (käyttäjän pyyntö 4.10.2026). */
/* Valitsimen tarkkuus ylittää yleisen input-säännön (input:not(…)×4). */
.ferry-note .ferry-leg.need .ferry-time input[type="datetime-local"] { border: 2px solid var(--warn); background: var(--warn-soft); box-shadow: 0 0 0 4px color-mix(in srgb, var(--warn) 22%, transparent); animation: ferry-pulse 1.6s ease-in-out 4; }
.ferry-leg.ok .ferry-time .req { color: var(--accent); }
.ferry-note .ferry-leg.ok .ferry-time input[type="datetime-local"] { border-color: var(--accent); }
@keyframes ferry-pulse { 0%, 100% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--warn) 22%, transparent); } 50% { box-shadow: 0 0 0 10px color-mix(in srgb, var(--warn) 8%, transparent); } }
@media (prefers-reduced-motion: reduce) { .ferry-note .ferry-leg.need .ferry-time input[type="datetime-local"] { animation: none; } }
.warn-line { color: var(--warn) !important; font-weight: 600; }
.soc { font-weight: 650; }
.soc.low, .soc.topup { color: var(--warn); }
.topup-note { color: var(--warn) !important; }
.tl-sub { color: var(--muted); font-size: 0.88rem; margin: 2px 0 10px; overflow-wrap: anywhere; }
.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 14px; margin: 0; font-size: 0.9rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.tl-details .small { margin-top: 8px; }
.tl-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin-top: 12px; }
.tl-actions a, .tl-actions button { font-size: 0.88rem; font-weight: 600; }
.tl-actions a.nav-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px; border-radius: 999px; background: var(--accent); color: var(--accent-text); text-decoration: none; }
.tl-actions a.nav-btn:hover { background: var(--accent-hover); }
.tl-details > summary { list-style: none; cursor: pointer; border-radius: var(--radius-sm); }
.tl-details > summary::-webkit-details-marker { display: none; }
.tl-details > summary::after {
  content: ""; flex: none; width: 8px; height: 8px; margin: 0 4px 4px 2px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg);
  transition: transform 0.15s;
}
.tl-details[open] > summary::after { transform: rotate(-135deg); margin-bottom: -2px; }
.tl-details > summary:hover h3 { color: var(--accent-ink); }
.tl-details[open] > summary { margin-bottom: 4px; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.actions .ghost, .actions .primary { flex: 1 1 auto; }

/* ---------- Dialogit */
.dialog {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 22px;
  box-shadow: var(--shadow-lg);
  overflow: auto;
  overscroll-behavior: contain;
}
.dialog[open] { display: flex; flex-direction: column; animation: dialog-in 0.18s ease-out; }
@keyframes dialog-in { from { opacity: 0; transform: translateY(8px) scale(0.985); } to { opacity: 1; transform: none; } }
.dialog::backdrop { background: rgb(8 16 12 / 0.5); backdrop-filter: blur(2px); }
.dialog-wide { width: min(660px, calc(100vw - 32px)); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 4px; }
.dialog-head h2 { margin: 0; font-size: 1.25rem; }
.dialog > .hint:first-of-type { margin-top: 4px; }
.dialog .primary { width: 100%; }
.dialog .actions .primary, .dialog .actions .ghost { width: auto; }
@media (max-width: 600px) {
  .dialog { width: 100vw; max-width: 100vw; max-height: 92vh; margin: auto 0 0; border-radius: 22px 22px 0 0; border-bottom: 0; padding: 20px 18px calc(20px + env(safe-area-inset-bottom)); }
  .dialog[open] { animation: sheet-in 0.2s ease-out; }
}
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 0.95rem; }
.check input { width: 18px; height: 18px; flex: none; }

.saved-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.saved-item { border: 1px solid var(--border); border-radius: var(--radius-md); padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; background: var(--surface); }
.saved-item:hover { border-color: var(--border-strong); }
.saved-item strong { overflow-wrap: anywhere; }
.saved-item .row { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.small-btn { min-height: 38px !important; padding: 0 14px !important; font-size: 0.88rem !important; width: auto !important; box-shadow: none !important; }
.saved-item .row .link-btn { margin-left: auto; }
.saved-head { margin: 14px 0 0; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.saved-empty { margin: 10px 0 0; padding: 18px; border: 1px dashed var(--border-strong); border-radius: var(--radius-md); text-align: center; color: var(--muted); font-size: 0.9rem; }

/* Operaattorit ja hinnat */
.op-summary { margin: 0 0 6px; font-size: 0.92rem; overflow-wrap: anywhere; }
.op-table { max-height: min(40vh, 420px); overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-md); padding: 4px; background: var(--surface); }
.op-table .group { padding: 10px 10px 4px; color: var(--muted); font-size: 0.74rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.op-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 10px; border-radius: var(--radius-sm); }
.op-row:hover { background: var(--surface-2); }
.op-row label { display: flex; align-items: center; gap: 10px; min-width: 0; cursor: pointer; flex: 1; }
.op-row label input { width: 18px; height: 18px; flex: none; }
.op-row label span { display: flex; flex-direction: column; min-width: 0; }
.op-row b { font-weight: 600; overflow-wrap: anywhere; }
.op-row small { color: var(--muted); font-size: 0.8125rem; letter-spacing: 0.03em; }
.mode-all .op-row label input { display: none; }
.mode-all .op-row label { cursor: default; }
#authBody .error, #authBody .warn-box, #authBody .ok-box { margin: 0 0 14px; }

/* Operaattorit: Kaikki / Valitut järjestyksessä, järjestettävä lista ja tallennetut listat */
.op-stack { gap: 14px; margin-top: 14px; }
#opDialog:not(.mode-all) .op-table { max-height: min(32vh, 300px); }
.seg-full { display: grid; grid-template-columns: 1fr 1fr; align-self: stretch; }
.op-mode-hint { margin: -4px 0 0; }
.op-sub { display: block; font-size: 0.74rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.op-sub small { text-transform: none; letter-spacing: 0; font-weight: 500; font-size: 0.8125rem; }
.op-sub-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.op-sub-row .link-btn { padding: 0; font-size: 0.85rem; }
.op-lists .op-sub { margin-bottom: 8px; }
.op-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.op-chip { display: inline-flex; align-items: center; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface); overflow: hidden; }
.op-chip button { border: 0; background: none; cursor: pointer; color: var(--text); font-weight: 600; font-size: 0.9rem; min-height: 36px; }
.op-chip button:first-child { padding: 0 6px 0 14px; display: inline-flex; align-items: center; gap: 6px; }
.op-chip button small { color: var(--muted); font-weight: 600; font-size: 0.74rem; background: var(--surface-2); border-radius: 999px; padding: 0 6px; }
.op-chip .op-chip-x { width: 30px; display: grid; place-items: center; color: var(--muted); }
.op-chip .op-chip-x:hover { color: var(--danger); }
.op-chip:hover { border-color: var(--accent); }
.op-chip.active { background: var(--accent-soft); border-color: var(--accent); }
.op-chip.active button:first-child { color: var(--accent-ink); }
.op-order { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.op-item {
  display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto auto; align-items: center; gap: 10px;
  padding: 8px 8px 8px 6px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface);
}
.op-item:first-child { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); background: color-mix(in srgb, var(--accent-soft) 45%, var(--surface)); }
.op-item.dragging { opacity: 0.45; }
.op-item.drop { box-shadow: 0 -3px 0 var(--accent); }
.op-grip { color: var(--border-strong); cursor: grab; display: grid; }
.op-rank { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: var(--accent-text); font-weight: 700; font-size: 0.8rem; }
.op-item:not(:first-child) .op-rank { background: var(--surface-3); color: var(--text-2); }
.op-name { display: flex; flex-direction: column; min-width: 0; }
.op-name b { font-weight: 600; overflow-wrap: anywhere; }
.op-name small { color: var(--muted); font-size: 0.8125rem; }
.op-move { display: flex; gap: 2px; }
.op-btn { width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent; color: var(--text-2); cursor: pointer; }
.op-btn:hover:not(:disabled) { background: var(--surface-2); color: var(--accent); }
.op-btn:disabled { opacity: 0.25; cursor: default; }
.op-btn.op-del:hover { color: var(--danger); }
.op-empty { padding: 16px; border: 1px dashed var(--border-strong); border-radius: var(--radius-md); text-align: center; color: var(--muted); font-size: 0.9rem; }
.op-save { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.op-save .ghost { min-height: 46px; }
.op-label { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.op-label b { font-weight: 600; overflow-wrap: anywhere; }
.op-label small { color: var(--muted); font-size: 0.8125rem; }
.op-add-row { padding: 2px; }
.op-add { display: flex; align-items: center; gap: 12px; width: 100%; padding: 6px 8px; border: 0; border-radius: var(--radius-sm); background: none; cursor: pointer; text-align: left; }
.op-add:hover { background: var(--accent-soft); }
.op-add span:last-child { display: flex; flex-direction: column; min-width: 0; }
.op-add b { font-weight: 600; }
.op-add small { color: var(--muted); font-size: 0.8125rem; }
.op-plus { flex: none; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; border: 1.5px solid var(--accent); color: var(--accent); font-weight: 700; line-height: 1; }
.op-add:hover .op-plus { background: var(--accent); color: var(--accent-text); }
.rank-tag { display: inline-block; margin-left: 4px; padding: 0 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); font-size: 0.74rem; font-weight: 650; }
@media (max-width: 600px) {
  .op-item { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "rank name move" "rank price price"; row-gap: 6px; }
  .op-item .op-grip { display: none; }
  .op-item .op-rank { grid-area: rank; align-self: start; margin-top: 4px; }
  .op-item .op-name { grid-area: name; }
  .op-item .op-move { grid-area: move; }
}
.label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.label-row label { font-size: 0.8125rem; font-weight: 600; color: var(--text-2); }
.label-row .link-btn { padding: 0; font-size: 0.82rem; }
.auth-alt { margin: 4px 0 0; padding-top: 14px; border-top: 1px solid var(--border); text-align: center; color: var(--muted); font-size: 0.9rem; }
.account-card { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: var(--radius-md); background: var(--surface-2); }
.avatar { flex: none; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: var(--accent-text); font-weight: 700; font-size: 1.1rem; }
.account-id { display: flex; flex-direction: column; min-width: 0; }
.account-id b { overflow-wrap: anywhere; }
.account-id small { color: var(--muted); font-size: 0.82rem; }

/* Kirjautumiskehotus ja kokeilureitin raja */
.nudge-list { margin: 4px 0 12px; padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.nudge-list li, .gate-list li { position: relative; padding-left: 28px; }
.nudge-list li::before, .gate-list li::before {
  content: ""; position: absolute; left: 0; top: 2px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m6 12.5 4 4 8-9' fill='none' stroke='%230a7457' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 12px no-repeat;
}
.gate-intro { margin: 0 0 10px; font-weight: 600; color: var(--text); }
.gate-list { gap: 8px !important; }
/* Ominaisuudet-ikkuna (5.10.2026) */
.features-dialog .feat-lead { margin: 10px 0 8px; color: var(--text-2); line-height: 1.5; }
.features-dialog .feat-legend { margin: 0 0 6px; font-size: 0.84rem; color: var(--muted); }
/* Ominaisuudet taulukkona (käyttäjän pyyntö 5.10.2026): ei lihavointeja, ryhmät väliotsikkoriveinä. */
.feat-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; margin-top: 6px; }
.feat-table th, .feat-table td { padding: 8px 10px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); font-weight: 400; }
.feat-table thead th { font-size: 0.74rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--border-strong); }
.feat-table .ft-group th { padding: 16px 10px 6px; color: var(--accent-ink); font-size: 0.86rem; border-bottom: 1px solid var(--border); background: none; }
.feat-table tbody:first-of-type .ft-group th { padding-top: 10px; }
.feat-table .ft-n { color: var(--text); width: 32%; }
.feat-table .ft-d { color: var(--text-2); }
.feat-table .ft-a { width: 1%; white-space: nowrap; text-align: right; }
.feat-table .ft-dm { display: none; }
.ft-tag { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 0.74rem; font-weight: 500; }
.ft-tag.free { background: var(--accent-soft); color: var(--accent-ink); }
.ft-tag.lock { background: var(--warn-soft); color: var(--warn); }
@media (max-width: 600px) {
  .feat-table .ft-d { display: none; }
  .feat-table .ft-n { width: auto; }
  .feat-table .ft-dm { display: block; margin-top: 2px; color: var(--text-2); font-size: 0.82rem; line-height: 1.4; }
  .feat-table th, .feat-table td { padding: 8px 6px; }
}
.lock-tag { display: inline-flex; align-items: center; gap: 3px; margin-left: 6px; padding: 0 7px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); font-size: 0.72rem; font-weight: 650; white-space: nowrap; vertical-align: 1px; }
.feat-cta { margin-top: 18px; }
.gate-list { list-style: none; padding-left: 0; display: flex; flex-direction: column; gap: 10px; }
.dialog.gate { padding: 0; overflow: auto; }
.dialog.gate > :not(.gate-hero) { margin-left: 22px; margin-right: 22px; }
.dialog.gate > .actions { margin-bottom: 22px; }
.gate-hero {
  display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: start;
  padding: 22px; margin-bottom: 16px;
  background: radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--accent) 80%, #2fd3a0), var(--accent) 45%, color-mix(in srgb, var(--accent) 60%, #022a1f));
  color: #fff;
}
.gate-hero h2 { margin: 0 0 4px; font-size: 1.25rem; }
.gate-hero p { margin: 0; opacity: 0.92; }
.gate-hero .icon-btn { background: rgb(255 255 255 / 0.14); color: inherit; border-color: transparent; }

.cta-stack { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; }
.cta-stack .primary, .cta-stack .ghost { width: 100%; }
.cta-stack .link-btn { align-self: center; color: var(--muted); padding: 10px; }
.cta-check { justify-content: center; margin-top: 4px; color: var(--muted); font-size: 0.88rem; }
.dialog.gate > .gate-cta { margin-bottom: 22px; }

/* Palaute */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
#fbCount { align-self: flex-end; font-size: 0.8125rem; }

/* ---------- Kartta */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(0.88) contrast(0.9) saturate(0.6); }
}
:root[data-theme="dark"] .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(0.88) contrast(0.9) saturate(0.6); }
.leaflet-container { font: inherit; background: var(--surface-3); }
.leaflet-bar { border: 0 !important; box-shadow: var(--shadow) !important; border-radius: var(--radius-md) !important; overflow: hidden; }
.leaflet-bar a { width: 38px !important; height: 38px !important; line-height: 38px !important; background: var(--surface) !important; color: var(--text) !important; border-color: var(--border) !important; font-weight: 500; }
.leaflet-bar a:hover { background: var(--surface-2) !important; }
.fit-ctl a { display: grid !important; place-items: center; }
.map-locked .fit-ctl { visibility: hidden; }
.leaflet-top.leaflet-left { margin: 4px; }
.leaflet-popup-content-wrapper { border-radius: var(--radius-md); box-shadow: var(--shadow-lg); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--surface); color: var(--text); }
.leaflet-popup-content { margin: 14px 16px; font-size: 0.9rem; line-height: 1.45; }
.leaflet-popup-content h4 { margin: 0 0 4px; font-size: 0.98rem; }
.leaflet-popup-content p { margin: 2px 0; }
.leaflet-container a.leaflet-popup-close-button { color: var(--muted); }
.leaflet-control-attribution { background: color-mix(in srgb, var(--surface) 88%, transparent) !important; color: var(--muted); border-radius: 8px 0 0 0; font-size: 0.72rem !important; }
.leaflet-control-attribution a { color: var(--accent); }
.pin {
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent); color: var(--accent-text);
  border: 2px solid var(--surface);
  box-shadow: 0 2px 6px rgb(0 0 0 / 0.35);
  font: 700 13px/1 var(--font);
}
.pin.start, .pin.end { background: var(--surface); color: var(--text); border: 3px solid var(--accent); }
/* Latauspysähdys: pyöristetty neliö, ei pallo – erottuu latausasemien ryhmäpalloista (laaja testaus 6.10.2026, ehdotus 4). */
.pin.stop { border-radius: 8px; }
.pin.via { background: var(--surface); color: var(--text); border: 3px solid var(--muted); width: 28px; height: 28px; font-size: 11px; letter-spacing: -0.02em; }
/* Pysähdyslistasta kohdistettu merkki (focusPin): sykkivä rengas hetken ajan. */
.pin.pin-focus { animation: pin-focus 0.9s ease-out 3; }
@keyframes pin-focus { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 70%, transparent), 0 2px 6px rgb(0 0 0 / 0.35); } 100% { box-shadow: 0 0 0 16px transparent, 0 2px 6px rgb(0 0 0 / 0.35); } }
[data-focus-pin] { cursor: pointer; }
.tl-title h3[data-focus-pin]:hover, .sp-head b[data-focus-pin]:hover { text-decoration: underline; text-underline-offset: 3px; }
/* Sääennuste reitin pisteissä (4.10.2026): pieni laatikko, klikkaus avaa tarkemmat tiedot. */
.wx-box {
  position: relative; width: 56px; height: 26px; box-sizing: border-box; padding: 2px 6px 2px 3px;
  display: flex; align-items: center; justify-content: center; gap: 4px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 7px;
  box-shadow: 0 1px 4px rgb(0 0 0 / 0.22); font: 700 12px/1 var(--font); cursor: pointer; white-space: nowrap;
}
/* Kärki osoittaa reitin pisteeseen sivulta (laatikko viivan vieressä, 6.10.2026). */
.wx-box::after { content: ""; position: absolute; top: 50%; width: 8px; height: 8px; background: var(--surface); transform: translateY(-50%) rotate(45deg); }
.wx-box.right::after { left: -5px; border-left: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.wx-box.left::after { right: -5px; border-right: 1px solid var(--border); border-top: 1px solid var(--border); }
.wx-badge { flex: none; display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: linear-gradient(160deg, #eaf2fb, #cfdcea); box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.06); }
.wx-badge.big { width: 34px; height: 34px; margin-right: 8px; vertical-align: middle; }
.wx-pop h4 { display: flex; align-items: center; }
.wx-pop h4 { margin: 0 0 4px; }
.wx-pop .kv { margin: 6px 0; }


/* ---------- Esittely ja UKK */
.about { border-top: 1px solid var(--border); background: var(--surface); margin-top: 8px; }
.about-inner { max-width: 1180px; margin: 0 auto; padding: 40px 20px 28px; display: grid; gap: 16px 56px; grid-template-columns: minmax(0, 1fr); color: var(--text-2); font-size: 0.96rem; line-height: 1.65; }
@media (min-width: 900px) { .about-inner { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.about h2 { font-size: 1.2rem; margin: 0 0 10px; color: var(--text); }
.about ul { padding-left: 0; list-style: none; margin: 12px 0 16px; display: flex; flex-direction: column; gap: 8px; }
.about li { position: relative; padding-left: 26px; }
.about li::before { content: ""; position: absolute; left: 0; top: 0.45em; width: 14px; height: 14px; border-radius: 50%; background: var(--accent-soft); box-shadow: inset 0 0 0 4px var(--accent-soft), inset 0 0 0 7px var(--accent); }
.about details { border-bottom: 1px solid var(--border); padding: 12px 0; }
.about details:first-of-type { border-top: 1px solid var(--border); }
.about summary { cursor: pointer; font-weight: 600; color: var(--text); list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.about summary::-webkit-details-marker { display: none; }
.about summary::after { content: "+"; flex: none; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); color: var(--accent); font-weight: 600; transition: transform 0.15s; }
.about details[open] summary::after { transform: rotate(45deg); }
.about details p { margin: 8px 0 2px; color: var(--muted); }

/* ---------- Alapalkki */
.foot {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 16px;
  padding: 16px 20px;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  color: var(--muted); font-size: 0.8125rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.foot-right { text-align: right; white-space: nowrap; margin-left: auto; }
.credits { line-height: 1.7; }
.credits a, .foot a { color: inherit; }
.foot a:hover { color: var(--accent); }
.version { font-variant-numeric: tabular-nums; }

/* ---------- Puhelin */
@media (max-width: 600px) {
  .top { padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top)); gap: 8px; min-height: 58px; }
  .brand { gap: 10px; }
  .brand img { width: 32px; height: 32px; }
  .brand .brand-name { font-size: 0.95rem; hyphens: auto; -webkit-hyphens: auto; }
  .brand small { font-size: 0.72rem; }
  .top-actions { gap: 2px; }
  .top-actions .ghost { min-height: 40px; width: 40px; padding: 0; justify-content: center; position: relative; }
  .top-actions .ghost > span:not(.badge), .saved-label { display: none; }
  .account-btn { max-width: 40px; border-color: transparent !important; }
  #savedCount { position: absolute; top: 2px; right: 0; min-width: 17px; height: 17px; font-size: 0.66rem; padding: 0 4px; box-shadow: 0 0 0 2px var(--surface); }
  .layout { padding: 12px; gap: 12px; }
  .card { padding: 16px; border-radius: 16px; }
  .timeline-card { padding: 4px 16px; }
  #map { height: 46vh; min-height: 280px; }
  .notice { margin: 10px 12px 0; }
  .foot { flex-direction: column; align-items: stretch; padding: 16px; }
  .foot-right { text-align: left; margin-left: 0; }
  .about-inner { padding: 28px 16px 20px; }
  .res-actions .ghost { font-size: 0.85rem; }
  .hero-main b { font-size: 1.7rem; }
  .hero-side { text-align: left; }
  .leaflet-control-attribution { font-size: 0.62rem !important; line-height: 1.35; }
  #map { height: 54vh; min-height: 300px; }
  /* Aikajana: kapeampi sisennys ja tiedot allekkain (otsikko rivin yläpuolella), jotta arvot mahtuvat. */
  .timeline-card { padding: 4px 12px; }
  .tl-item { grid-template-columns: 28px minmax(0, 1fr); gap: 10px; }
  .tl-item::before { left: 13px; }
  .tl-item:first-child::before { top: 26px; }
  .tl-item:last-child::before { bottom: calc(100% - 26px); }
  .tl-dot { width: 28px; height: 28px; font-size: 0.8rem; }
  .tl-item.via .tl-dot { font-size: 0.68rem; }
  .tl-details .kv { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .tl-details .kv dt { margin-top: 8px; font-size: 0.76rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
  .tl-details .kv dt:first-child { margin-top: 2px; }
  /* Ajotila koko leveydelle (.drive-dialog-leveys ohitti puhelimen alapaneelin leveyden). */
  .dialog.drive-dialog { width: 100vw; max-width: 100vw; }
}
@media (max-width: 380px) {
  .grid2 { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ---------- Tekstisivut (tietosuojaseloste) */
.doc { max-width: 760px; margin: 24px auto 40px; padding: 28px 32px; line-height: 1.65; }
.doc h1 { margin-top: 0; font-size: 1.7rem; letter-spacing: -0.025em; }
.doc h2 { font-size: 1.1rem; margin: 26px 0 6px; }
.doc ul { padding-left: 20px; }
.doc li { margin: 6px 0; }
@media (max-width: 640px) { .doc { margin: 12px; padding: 20px; } }
.privacy-body { overflow-y: auto; line-height: 1.6; margin-top: 8px; }
.privacy-body h2 { font-size: 1.05rem; margin: 18px 0 6px; }
.privacy-body ul { padding-left: 20px; }
.privacy-body li { margin: 6px 0; }
/* Latausasemien selaus kartalla (4.10.2026) */
.browse-ctl { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; margin: 4px 4px 0 0 !important; }
/* Kolme samankokoista symbolinappia kaikilla näytöillä (käyttäjän pyyntö 5.10.2026); teksti vihjeenä vasemmalla. */
.browse-ctl .browse-btn { position: relative; width: 40px; height: 40px; min-height: 40px; padding: 0; justify-content: center; }
.browse-ctl .browse-btn svg { width: 20px; height: 20px; }
.browse-ctl .browse-btn[data-tip]:hover::after, .browse-ctl .browse-btn[data-tip]:focus-visible::after {
  content: attr(data-tip); position: absolute; right: calc(100% + 8px); top: 50%; transform: translateY(-50%);
  padding: 5px 10px; border-radius: var(--radius-sm); background: var(--text); color: var(--surface);
  font: 600 0.8rem var(--font); white-space: nowrap; box-shadow: var(--shadow); pointer-events: none; z-index: 1;
}
@media (hover: none) { .browse-ctl .browse-btn[data-tip]:hover::after { display: none; } }
.browse-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); color: var(--text-2); font: 600 0.85rem var(--font); box-shadow: var(--shadow); cursor: pointer; }
.browse-btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.browse-btn:hover { filter: brightness(0.97); }
.browse-msg .nowrap { white-space: nowrap; }
.browse-msg .browse-warn { display: flex; align-items: center; justify-content: flex-end; gap: 6px; margin: 4px -5px -1px; padding: 4px 7px; border-radius: var(--radius-sm); background: var(--warn-soft); color: var(--warn); font-weight: 600; text-align: left; }
.browse-msg .browse-warn:only-child { margin: -1px -5px; }
.browse-msg .bw-icon { flex: none; width: 15px; height: 15px; }
.browse-msg a { color: var(--accent); font-weight: 600; text-decoration: underline; }
.browse-msg { margin: 0; max-width: 220px; padding: 4px 9px; border-radius: var(--radius-sm); background: var(--surface); color: var(--text-2); font-size: 0.8125rem; line-height: 1.35; text-align: right; box-shadow: var(--shadow-sm); }
.browse-msg[hidden] { display: none; }
/* Kehysohje vain Näytä latausasemat -napin vihjeenä (hiiri napin päällä). */
.browse-msg.on-hover { display: none; }
.browse-ctl:has(#browseToggle:hover) .browse-msg.on-hover:not([hidden]) { display: block; }
/* Tieliikennekamerat (käyttäjän pyyntö 4.10.2026): kamerasymboli kartalla ja tietoikkuna 1–2 kuvalla. */
.cam-pin { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: #1d4ed8; color: #fff; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35); --surface: #1d4ed8; }
.cam-pin svg { width: 15px; height: 15px; }
.cam-pop { max-height: var(--pop-max, 70vh); overflow: auto; }
.cam-pop h4 { margin: 0 0 6px; font-size: 1rem; }
.cam-imgs { display: grid; gap: 8px; }
.cam-imgs figure { margin: 0; }
.cam-imgs img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--radius-sm); background: var(--surface-3); }
.cam-imgs figcaption { margin-top: 2px; color: var(--muted); font-size: 0.8125rem; }
.browse-btn svg { flex: none; }
/* Fintrafficin reaaliaikainen tila ja latauspisteet tehoittain (public/afir.js) */
.live-badge { display: inline-block; margin: 4px 0 0 4px; padding: 1px 8px; border-radius: 999px; font-size: 0.76rem; font-weight: 650; white-space: nowrap; background: var(--surface-2); color: var(--text-2); }
.live-badge.free { background: var(--accent-soft); color: var(--accent-ink); }
.live-badge.busy { background: var(--warn-soft); color: var(--warn); }
.live-badge.down { background: var(--danger-soft); color: var(--danger); }
.along-main .live-badge, .dest-chargers .live-badge { margin: 0 0 0 2px; }
.leaflet-popup .live-badge { margin: 0 0 0 4px; }
.afir-box { margin: 2px 0; }
.afir-box p { margin: 2px 0 0; }
.st-free { color: var(--accent-ink); font-weight: 600; }
.st-busy { color: var(--warn); }
.st-down { color: var(--danger); }

/* Kirjautumista vaativat toiminnot (data-needs-login) ja kokeilureittien määrä */
.lock-ic { display: inline-flex; margin-right: 6px; vertical-align: -2px; }
.trial-note { margin-top: 10px; }
.trial-note .link-btn { padding: 0; min-height: 0; font-size: inherit; }

/* Arvioitu hinta (asemalle ei saatu hintaa luotettavasta lähteestä) */
.est-tag { display: inline-block; padding: 0 6px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); font-size: 0.72rem; font-weight: 650; vertical-align: 1px; }
.est-tag.ft-tag { background: var(--accent-soft); color: var(--accent-ink); }
/* Keskihinta (Fintrafficilla ei hintaa): huomioväri (käyttäjän toive 4.10.2026). */
.est-tag.avg-tag { background: var(--warn-soft); color: var(--warn); border: 1px solid var(--warn); border-radius: 8px; padding: 1px 6px; }
.ag-price { font-weight: 600; }
.ag-price .est-tag { font-weight: 600; }
.ag-price.muted { font-weight: 400; }

/* Aseman tietoikkuna ABRP:n tapaan: latauspisteet numeroittain tiloineen (afirDetailsHtml, stationPopup) */
.st-pop h4 { margin: 0 0 2px; font-size: 1rem; }
.st-pop h4 .swap-chip { margin-left: 6px; vertical-align: -6px; }
.st-pop p { margin: 4px 0; }
.afir-group { margin: 8px 0 6px; }
.ag-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.ag-count { font-size: 0.8rem; font-weight: 650; color: var(--text-2); white-space: nowrap; }
.ag-count.free { color: var(--accent-ink); }
.ag-count.busy { color: var(--warn); }
.ag-count.down { color: var(--danger); }
.stalls { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.stall { min-width: 26px; height: 22px; padding: 0 5px; display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; font-size: 0.72rem; font-weight: 650; border: 1px solid transparent; background: var(--surface-2); color: var(--text-2); }
.stall.free { background: var(--accent-soft); color: var(--accent-ink); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.stall.busy { background: var(--warn-soft); color: var(--warn); }
.stall.down { background: var(--danger-soft); color: var(--danger); text-decoration: line-through; }
.afir-total { font-weight: 600; margin: 6px 0 2px !important; }
.afir-info { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 6px 0; font-size: 0.86rem; }
.afir-info dt { color: var(--muted); }
.afir-info dd { margin: 0; }
.afir-links { font-size: 0.86rem; }
.sp-price b { font-size: 1rem; }
.sp-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px !important; }
.st-pop a.nav-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 12px; border-radius: 999px; background: var(--accent); color: var(--accent-text); font-size: 0.86rem; text-decoration: none; }
.leaflet-popup-content .st-pop a.nav-btn { color: var(--accent-text); }
.sp-stop { margin: 0 0 6px !important; padding: 6px 8px; border-radius: 8px; background: var(--accent-soft); color: var(--accent-ink); font-size: 0.84rem; }
.st-pop { max-height: var(--pop-max, 70vh); overflow-y: auto; overscroll-behavior: contain; padding-right: 2px; }

/* Kartan merkkien tekstit ”vapaat/paikat · kW” (stationLabel; näkyvät zoomitasolla ≥ LABEL_MIN_ZOOM) */
.leaflet-tooltip.st-label { padding: 0 4px; border: 1px solid var(--border); border-radius: 4px; background: var(--surface); color: var(--text-2); box-shadow: none; font: 650 10.5px/15px Inter, system-ui, sans-serif; white-space: nowrap; }
.leaflet-tooltip.st-label::before { display: none; }
.leaflet-tooltip.st-label.free { color: var(--accent-ink); }
.leaflet-tooltip.st-label.busy { color: var(--warn); }
.leaflet-tooltip.st-label.down { color: var(--danger); }
/* Selauskerroksen tekstit (st-always) näkyvät aina, kun pallo näkyy (käyttäjän pyyntö 6.10.2026); klikkaus avaa tietoikkunan. */
.leaflet-container:not(.st-labels) .leaflet-tooltip.st-label:not(.st-always) { display: none; }
.leaflet-tooltip.st-label.leaflet-interactive { cursor: pointer; }

/* Automallin haku (Auto-ikkuna) */
.car-model-field { position: relative; margin-bottom: 14px; }
.car-model-field .suggest li small { font-size: 0.8125rem; }

/* Ajotila (#driveDialog) */
.drive-btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; margin-top: 10px; min-height: 46px; }
.drive-dialog { width: min(560px, 100vw - 24px); }
.drive-geo { margin: 10px 0 8px; font-size: 0.88rem; }
.drive-next { padding: 14px; border-radius: var(--radius-md); background: var(--surface-2); }
.drive-next h3 { margin: 2px 0 2px; font-size: 1.25rem; }
.drive-label { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--accent-ink); }
.drive-big { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 12px 0; }
.drive-big div { display: flex; flex-direction: column; padding: 10px; border-radius: var(--radius-sm); background: var(--surface); }
.drive-big b { font-size: 1.35rem; line-height: 1.2; }
.drive-big small { color: var(--muted); font-size: 0.8125rem; }
.drive-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 10px; }
.drive-actions a.nav-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 18px; border-radius: 999px; background: var(--accent); color: var(--accent-text); font-weight: 650; text-decoration: none; }
.drive-actions .ghost { min-height: 48px; }
.drive-rest { margin: 12px 0 0; padding-left: 22px; font-size: 0.9rem; }
.drive-rest li { margin: 4px 0; }
.drive-soc { margin-top: 16px; }
.drive-soc label { font-weight: 600; }
.drive-soc-row { display: flex; gap: 8px; margin-top: 6px; }
.drive-soc-row .unit-wrap { flex: 0 0 120px; }
.drive-soc-row .primary { flex: 1; min-height: 46px; }
.drive-install { margin-top: 12px; font-size: 0.9rem; }
.warn-text { color: var(--danger); }
@media (max-width: 600px) { .drive-big b { font-size: 1.15rem; } }

/* Ruuhkaennuste (busyHtml) */
.busy-box p { margin: 2px 0; }
.busy-tag { display: inline-block; padding: 0 7px; border-radius: 999px; font-size: 0.76rem; font-weight: 650; background: var(--surface-2); color: var(--text-2); }
.busy-tag.free { background: var(--accent-soft); color: var(--accent-ink); }
.busy-tag.busy { background: var(--warn-soft); color: var(--warn); }
.busy-tag.down { background: var(--danger-soft); color: var(--danger); }
.busy-bars { display: flex; align-items: flex-end; gap: 2px; height: 30px; margin: 6px 0 2px; }
.busy-bars .bb { flex: 1; min-width: 3px; border-radius: 2px 2px 0 0; background: color-mix(in srgb, var(--accent) 45%, transparent); }
.busy-bars .bb.now { background: var(--accent); }
.busy-bars .bb.na { background: var(--border); }
.sp-busy { margin: 6px 0; }
/* Asetukset-ikkuna (5.10.2026): Auto, Reitti ja ajotapa, Latausasemat ja Latausvarmuus yhden napin takana */
.settings-hub { display: grid; gap: 10px; }
.stops-btn { width: 100%; margin-top: 10px; }
.stops-btn[hidden] { display: none; }
.set-lock { display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); font-size: 0.72rem; font-weight: 600; vertical-align: 2px; }
.set-lock svg { width: 11px; height: 11px; }
.set-btn.locked .set-ico { background: var(--surface-2); color: var(--text-2); }
.settings-hub .set-btn { width: 100%; }
.back-btn { display: inline-flex; align-items: center; gap: 2px; margin: 0 0 4px -6px; padding: 2px 8px 2px 2px; min-height: 28px; border: 0; border-radius: 999px; background: none; color: var(--accent-ink); font: inherit; font-size: 0.84rem; font-weight: 600; cursor: pointer; }
.back-btn:hover { background: var(--accent-soft); }
.grid2 .field.wide { grid-column: 1 / -1; }
.browse-msg:empty { display: none; }
/* Tiedoksi-rivit tuloksissa (ei varoituslaatikkoa) */
.info-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 4px; font-size: 0.82rem; color: var(--muted); }
.info-list li { position: relative; padding-left: 20px; }
.info-list li::before { content: "i"; position: absolute; left: 0; top: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--surface-2); color: var(--text-2); font: 700 10px/14px var(--font, inherit); text-align: center; font-style: italic; }
/* Varalaturi pysähdyksen tiedoissa */
#reliabBody .hint { margin: 6px 0 18px; }
.tl-details .kv dd.backup { grid-column: 1 / -1; }
.backup-card { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface-2); }
.backup-head { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; }
.backup-head .live-badge { margin: 0; }
.backup-meta { color: var(--text-2); font-size: 0.86rem; }
.backup-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 4px; }
.backup-actions a.nav-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 12px; border-radius: 999px; background: var(--accent); color: var(--accent-text); font-size: 0.84rem; font-weight: 600; text-decoration: none; }
.backup-actions a.nav-btn:hover { background: var(--accent-hover); }
.backup-card p { margin: 2px 0 0; }
#alongCard .along-list { max-height: 560px; overflow-y: auto; overscroll-behavior: contain; padding-right: 2px; }
/* Toimintavarmuus ja varalaturi (5.10.2026) */
.rel-badge { display: inline-block; margin: 4px 0 0 4px; padding: 1px 8px; border-radius: 999px; background: var(--danger-soft); color: var(--danger); font-size: 0.76rem; font-weight: 650; white-space: nowrap; }
.sp-rel { margin: 6px 0; }
.drive-backup { margin-top: 10px; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--surface-2); }
/* Ajokeli ja liikennetiedotteet (5.10.2026) */
.road-card h3 { margin: 0 0 8px; font-size: 1rem; }
.road-list { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 8px; }
.road-item { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--surface-2); }
.road-tag { align-self: flex-start; display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 0.76rem; font-weight: 650; background: var(--accent-soft); color: var(--accent-ink); }
.road-tag.lvl1, .road-tag.lvl2 { background: var(--warn-soft); color: var(--warn); }
.road-tag.lvl3, .road-tag.msg { background: var(--danger-soft); color: var(--danger); }
.road-pin { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: #d97706; color: #fff; font-weight: 800; font-size: 14px; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35); }
.road-pop h4 { margin: 0 0 4px; font-size: 0.95rem; }
.road-pop p { margin: 4px 0; }

/* Latauspysähdykset-ikkuna (#stopsPanel, renderStopsPanel) */
.sp-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.sp-item { padding: 12px; border-radius: var(--radius-md); background: var(--surface-2); }
.sp-head { display: flex; gap: 10px; align-items: flex-start; }
.sp-head .tl-dot { position: static; flex: none; }
.sp-head small { display: block; color: var(--text-2); font-size: 0.82rem; margin-top: 2px; }
.sp-item .stop-tools { margin-top: 8px; }
.sp-sub { margin: 18px 0 6px; font-size: 0.95rem; }
#stopsPanel .along-list { max-height: none; }

/* Tietoikkunan ollessa auki kartta on lukittu (lockMap): säätimet piiloon, jotta ne eivät peitä ikkunaa tai
   sen sulkemisruksia. */
.map-locked .leaflet-control-zoom, .map-locked .leaflet-top.leaflet-right { visibility: hidden; }

/* Puhelin: kartan selite pienempänä (napit ovat symboleita kaikilla näytöillä). */
@media (max-width: 600px) {
  .browse-msg { max-width: 170px; font-size: 0.72rem; padding: 3px 7px; }
}
/* Hyvin kapea puhelin (≤ 380 px): yläpalkissa neljä kuvakenappia (Palaute, Tallennetut, Ominaisuudet, Kirjaudu). */
@media (max-width: 380px) {
  .top-actions .ghost { width: 36px; }
}

/* Tilin poiston vahvistussivu public/poista-tili.html (5.10.2026) */
.del-page .del-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-top: 18px; }
.del-page .del-btn { background: #b3261e; background-image: none; color: #fff; width: auto; padding-inline: 20px; box-shadow: none; }
.del-page .del-btn:hover { background: #93201a; }
.del-page .del-home { display: inline-block; width: auto; padding: 10px 20px; text-decoration: none; }
.del-page .ok-box { padding: 12px 14px; border-radius: var(--radius-md); }

/* Latausasemien ryhmät kartalla (käyttäjän pyyntö 5.10.2026): isompi pallo, numero = asemien määrä; vihreä, jos
   ryhmässä on valittujen operaattorien asemia, muuten oranssi kuten yksittäiset pallot. */
.st-cluster {
  display: grid;
  place-items: center;
  border-radius: 50%;
  /* Läpikuultava täyttö ja värillinen rengas: erottuu reitin numeroiduista pysähdyksistä (umpinaiset pallot). */
  background: rgba(240, 160, 75, 0.28);
  background: color-mix(in srgb, var(--browse-other) 30%, transparent);
  border: 3px solid var(--browse-other);
  color: var(--text, #1d1d1b);
  font-weight: 700;
  font-size: 0.8rem;
  text-shadow: 0 0 3px var(--surface, #fff), 0 0 3px var(--surface, #fff);
  cursor: pointer;
}
.st-cluster.chosen {
  background: rgba(10, 116, 87, 0.22);
  background: color-mix(in srgb, var(--accent) 24%, transparent);
  border-color: var(--accent);
}

/* Mobiilitarkastus 5.10.2026 */
/* Pitkien ikkunoiden otsikko ja sulkemisruksi pysyvät näkyvissä vieritettäessä. */
.dialog-head { position: sticky; top: -22px; z-index: 3; margin: -22px -22px 4px; padding: 22px 22px 8px; background: var(--surface); }
/* Taulukon ensimmäinen sarake pysyy paikallaan vaakavierityksessä, ja reunan varjo kertoo, että sisältöä on lisää. */
.plan-table thead th:first-child, .plan-table tbody th { position: sticky; left: 0; z-index: 1; background: var(--surface); }
.table-scroll { background: linear-gradient(to left, var(--surface) 30%, transparent) right / 24px 100% no-repeat local, radial-gradient(farthest-side at 100% 50%, rgb(0 0 0 / 0.16), transparent) right / 10px 100% no-repeat scroll; }
.ghost svg, a.ghost svg { flex-shrink: 0; }
/* Pienet napit: näkymätön, isompi osuma-alue kosketukselle. */
.swap-chip, .tl-dot[data-focus-pin] { position: relative; }
.swap-chip::after, .tl-dot[data-focus-pin]::after, .in-btn::after { content: ""; position: absolute; inset: -8px; }
.about summary { padding-block: 8px; }
@media (max-width: 600px) {
  .dialog-head { top: -20px; margin: -20px -18px 4px; padding: 20px 18px 8px; }
}

/* Aseman tietoikkunan yhteenvetotaulukko (käyttäjän pyyntö 5.10.2026: sama muoto kaikissa korteissa, ei toistoa) */
.sp-table { width: 100%; border-collapse: collapse; margin: 8px 0 4px; font-size: 0.86rem; }
.sp-table th, .sp-table td { padding: 5px 0; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.sp-table th { width: 1%; padding-right: 10px; white-space: nowrap; color: var(--muted); font-weight: 550; }
.sp-table tr:last-child th, .sp-table tr:last-child td { border-bottom: 0; }
.sp-table .est-tag { margin-left: 4px; }
.sp-table .busy-tag { font-size: 0.78rem; }
.sp-sub { margin: 10px 0 0 !important; font-size: 0.78rem; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.afir-box.compact .afir-group { margin: 4px 0 6px; }
.sp-source { font-size: 0.8125rem; margin-top: 6px !important; }
.sp-op .muted { font-weight: 400; }

/* Latausasemien hakuilmaisin (käyttäjän pyyntö 6.10.2026): pyörivä rengas napin ympärillä ja teksti vieressä. */
.browse-wrap { position: relative; display: inline-flex; }
.browse-busy { position: absolute; right: calc(100% + 8px); top: 50%; transform: translateY(-50%); display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 999px; background: var(--surface); color: var(--text); font: 650 0.84rem var(--font); white-space: nowrap; border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border)); box-shadow: var(--shadow); animation: bb-in 0.2s ease-out; pointer-events: none; }
.browse-busy[hidden] { display: none; }
.bb-spin { width: 14px; height: 14px; border-radius: 50%; border: 2.5px solid color-mix(in srgb, var(--accent) 25%, transparent); border-top-color: var(--accent); animation: bb-spin 0.8s linear infinite; flex: none; }
.browse-ctl .browse-btn.busy::before { content: ""; position: absolute; inset: -5px; border-radius: calc(var(--radius-md) + 4px); border: 3px solid transparent; border-top-color: var(--accent); border-right-color: var(--accent); animation: bb-spin 0.9s linear infinite; pointer-events: none; }
.browse-ctl .browse-btn.busy:hover::after { display: none; }
@keyframes bb-spin { to { transform: rotate(360deg); } }
@keyframes bb-in { from { opacity: 0; transform: translate(6px, -50%); } }
@media (prefers-reduced-motion: reduce) { .bb-spin, .browse-ctl .browse-btn.busy::before { animation-duration: 2.4s; } }

/* Yhtenäinen latausilmaisin (käyttäjän pyyntö 6.10.2026): sama pyörivä rengas kaikissa kestävissä toiminnoissa
   (napit, ”haetaan…”-tekstit, ilmoitukset). Sama ulkoasu kuin latausasemien haun ilmaisimessa (.bb-spin). */
.spin { display: inline-block; width: 1em; height: 1em; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--accent) 25%, transparent); border-top-color: var(--accent); animation: bb-spin 0.8s linear infinite; flex: none; vertical-align: -0.15em; box-sizing: border-box; }
.loading { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); }
.is-busy { cursor: progress; }
button.is-busy, a.is-busy { pointer-events: none; }
.is-busy > .busy-spin { margin-right: 6px; border-color: color-mix(in srgb, currentColor 30%, transparent); border-top-color: currentColor; }
.toast .spin { border-color: color-mix(in srgb, currentColor 30%, transparent); border-top-color: currentColor; }
@media (prefers-reduced-motion: reduce) { .spin { animation-duration: 2.4s; } }

/* Kirjautumattoman oletusauto (ehdotus 5) ja vaihtolistan kokonaishinta (ehdotus 2), laaja testaus 6.10.2026. */
.guest-car { margin: 12px 0 0; padding: 9px 12px; border-radius: var(--radius-md); background: var(--surface-2); color: var(--text-2); font-size: 0.88rem; line-height: 1.45; }
.guest-car .link-btn { padding: 0; font-size: inherit; }
.swap-cost { font-weight: 600; color: var(--text-2); }
.swap-cost.up { color: var(--danger); }
.swap-cost.down { color: var(--accent); }

/* Kartan paikkahaku ja pikasuodatin (laaja testaus 6.10.2026, ehdotus 3). Tietokoneella paneeli zoom-nappien ja
   oikean reunan nappien välissä, puhelimessa koko leveydellä kartan yläreunassa. */
.map-search { position: absolute; z-index: 1001; top: 10px; left: 56px; right: 60px; max-width: 420px; padding: 8px 10px 6px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); }
.map-search[hidden] { display: none; }
.map-search .ms-row { display: flex; gap: 6px; align-items: center; }
.map-search input[type=search] { flex: 1; min-width: 0; min-height: 40px; }
.map-search .ms-list { position: static; margin-top: 6px; max-height: 220px; box-shadow: none; }
.map-search .ms-filters { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; margin-top: 8px; font-size: 0.86rem; }
.map-search .ms-filters label { display: inline-flex; align-items: center; gap: 6px; }
.map-search .ms-filters select { min-height: 34px; padding: 4px 30px 4px 8px; font-size: 0.86rem; } /* tilaa alasvetonuolelle */
.map-search .ms-hint { margin: 6px 0 0; font-size: 0.8125rem; color: var(--muted); }
.browse-ctl .browse-btn.has-filter::before { content: ""; position: absolute; top: 5px; right: 5px; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 0 2px var(--surface); }
@media (max-width: 600px) {
  .map-search { left: 8px; right: 54px; top: 8px; max-width: none; }
  .map-search .ms-hint { display: none; }
}

/* Automaattisen tallennuksen ilmoitus asetusikkunoissa (käyttäjän pyyntö 6.10.2026). */
.save-note { display: flex; align-items: flex-start; gap: 6px; margin: 0 0 10px; padding: 8px 10px; border-radius: var(--radius-md); background: var(--accent-soft); color: var(--text); font-size: 0.84rem; line-height: 1.4; }
.save-note[hidden] { display: none; }
.save-note .save-ok { color: var(--accent); font-weight: 800; }
.save-note .spin { margin-top: 2px; }
.save-note.error { background: var(--warn-soft, #fff4e5); }

.browse-ctl .browse-btn[hidden] { display: none; }

/* ---------- Suuret näytöt (6.10.2026, käyttäjä päätti säilyttää)
   D: sisältö (yläpalkki ja asettelu) enintään 2000 px leveä ja keskellä, jotta logo ja napit eivät leviä reunoille.
   E: hyvin leveällä näytöllä (≥ 2200 px) tulokset omana sarakkeenaan lomakkeen ja kartan välissä; lomake pysyy
      silloin auki (tiivistystä ei tarvita). */
@media (min-width: 2040px) {
  .top { padding-inline: max(20px, calc((100% - 2000px) / 2 + 20px)); }
  .layout { max-width: 2000px; }
}
@media (min-width: 2200px) {
  .layout.has-results { grid-template-columns: 440px minmax(460px, 560px) minmax(0, 1fr); }
  .layout.has-results #routeCard { grid-column: 1; grid-row: 1 / span 2; }
  .layout.has-results .results-col { grid-column: 2; grid-row: 1 / span 2; }
  .layout.has-results .map-wrap { grid-column: 3; grid-row: 1 / span 2; }
  .route-bar.compact .route-compact { display: none; }
  .route-bar.compact .stops { display: grid; }
  .route-bar.compact .add-via { display: inline-flex; }
  .route-bar.compact .trip-grid { display: grid; }
  .route-bar.compact .rb-go { display: block; }
}


/* ---------- Yhtenäiset asemakortit (6.10.2026): pysähdys, vaihtolista, reitin varren lista ja tietoikkuna samalla
   taulukolla (.sp-table); listoissa tiivis yhteenveto ja laventuvat tiedot, vain yksi auki kerrallaan. */
.tl-details > .sp-table { margin-top: 10px; }
.tl-details .sp-table td { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.sp-table .backup-card { margin-top: 2px; }
.st-card { grid-template-areas: "card btn"; align-items: start; }
.st-card > .sc-details { grid-area: card; min-width: 0; }
.st-card > .small-btn { grid-area: btn; }
.sc-head { list-style: none; cursor: pointer; display: flex; flex-direction: column; gap: 3px; position: relative; padding-right: 20px; }
.sc-head::-webkit-details-marker { display: none; }
.sc-head::after { content: ""; position: absolute; right: 2px; top: 6px; width: 7px; height: 7px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform 0.15s; }
.sc-details[open] > .sc-head::after { transform: rotate(45deg); }
.sc-head:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.sc-details > .sp-table { margin-top: 10px; }
.sc-cost { gap: 2px 8px; }
.over-badge { display: inline-block; padding: 1px 7px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); font-size: 0.78rem; font-weight: 600; }
.over-limit { margin-top: 6px; padding: 6px 9px; border-radius: 8px; background: var(--warn-soft); color: var(--warn); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); font-size: 0.8125rem; line-height: 1.4; }
.sc-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 8px 0 0; }
.swap-more { list-style: none; display: flex; justify-content: center; padding: 4px 0; }
.sp-more { margin: 4px 0 6px; }
.sp-more > summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: 0.86rem; padding: 4px 0; }
.sp-more[open] > summary { margin-bottom: 2px; }
@media (max-width: 600px) {
  .st-card { grid-template-columns: minmax(0, 1fr); grid-template-areas: "card" "btn"; }
  .st-card > .small-btn { width: 100%; min-height: 40px; margin-top: 8px; }
}
/* Kapeassa kortissa (vaihtolista on sisennetty) otsikko solun yläpuolelle, jotta arvoille jää tilaa. */
.st-card { container-type: inline-size; }
@container (max-width: 360px) {
  .sc-details .sp-table tr { display: block; padding: 5px 0; border-bottom: 1px solid var(--border); }
  .sc-details .sp-table tr:last-child { border-bottom: 0; }
  .sc-details .sp-table th, .sc-details .sp-table td { display: block; width: auto; padding: 0; border: 0; white-space: normal; }
  .sc-details .sp-table th { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 1px; }
}

/* ---------- Pysähdyksen kortti (6.10.2026): sama sisältö ja ulkoasu reittisuunnitelman aikajanalla ja kartan
   tietoikkunassa (stopCardHtml). */
.stop-card { min-width: 0; }
.stop-card p { margin: 4px 0; }
.stop-card .sp-stop { margin: 0 0 6px !important; }
.stop-card .sc-title { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.stop-card .sc-name { margin: 0; font-size: 1rem; font-weight: 650; overflow-wrap: anywhere; }
.stop-card h3.sc-name { cursor: pointer; }
.stop-card h3.sc-name:hover { color: var(--accent-ink); }
.stop-card .sp-op { margin: 2px 0 0; color: var(--text-2); font-size: 0.86rem; font-weight: 500; }
.stop-card .sc-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.stop-card .sc-badges > span:not(.amen-brief), .stop-card .sc-badges .amen-brief { margin: 4px 0 0; }
.stop-card .sc-badges:not(:has(> :not(:empty))) { display: none; }
.stop-card .sp-table td { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stop-card .stop-tools { margin-top: 10px; padding-top: 10px; }
.stop-card .reports { margin-top: 6px; }
.stop-card .sc-backup { margin: 8px 0; }
.stop-card .sc-label { margin: 0 0 4px !important; color: var(--muted); font-size: 0.86rem; font-weight: 550; }
.stop-card a.nav-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 12px; border-radius: 999px; background: var(--accent); color: var(--accent-text); font-size: 0.86rem; font-weight: 600; text-decoration: none; }
.stop-card a.nav-btn:hover { background: var(--accent-hover); }

/* Yläpalkin nimi (käyttäjän pyyntö 6.10.2026): ”Volttimatka” lihavoituna ja perässä iskulause tavallisena. */
.brand .brand-name b { font-weight: 750; }
.brand .brand-tag { font-weight: 450; color: var(--text-2); }
/* Puhelimessa iskulause omalle rivilleen ilman viivaa ja kattavuus lyhyesti, jotta yläpalkki pysyy matalana. */
@media (max-width: 600px) {
  .brand .brand-tag { display: block; font-size: 0.78rem; line-height: 1.3; letter-spacing: 0; }
  .brand .brand-dash, .brand .brand-cov { display: none; }
}
