:root {
  color-scheme: light;
  --surface-0: #f4f3f0;
  --surface-1: #fcfcfb;
  --surface-2: #f0efec;
  --border: #e2e1dc;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #6f6e69;
  --grid: #e7e6e1;
  --accent: #2a78d6;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;
  --series-5: #e87ba4;
  --good: #0ca30c;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --radius: 12px;
  /* panels floating over the map (layers, legend, drawer buttons) follow the page theme, like the basemap */
  --overlay-bg: rgba(252, 252, 251, .94);
  --overlay-text: #0b0b0b;
  --overlay-muted: #52514e;
  --overlay-faint: #6f6e69;
  --overlay-border: #d6d5d0;
  --overlay-field: #f0efec;
  --overlay-shadow: 0 2px 10px rgba(0, 0, 0, .15);
  --panel-bg: #fcfcfb;
  --panel-line: #e2e1dc;
  --panel-hover: #f0efec;
  --panel-rail: #bdbcb5;
  --panel-note: #9a6200;
  --dl-early: #7c45c9; --dl-ok: #1c8a1c; --dl-minor: #9a6200; --dl-mid: #c2521f; --dl-major: #c42b2b;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --surface-0: #121211;
    --surface-1: #1a1a19;
    --surface-2: #242423;
    --border: #2f2f2d;
    --text-primary: #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted: #9a998f;
    --grid: #2c2c2a;
    --accent: #3987e5;
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-4: #c98500;
    --series-5: #d55181;
    --overlay-bg: rgba(26, 26, 25, .92);
    --overlay-text: #ffffff;
    --overlay-muted: #c3c2b7;
    --overlay-faint: #9a998f;
    --overlay-border: #3a3a37;
    --overlay-field: #242423;
    --overlay-shadow: 0 2px 10px rgba(0, 0, 0, .3);
    --panel-bg: #1a1a19;
    --panel-line: #2f2f2d;
    --panel-hover: #242423;
    --panel-rail: #5a5a55;
    --panel-note: #fab219;
    --dl-early: #c9a3ff; --dl-ok: #3fc93f; --dl-minor: #fab219; --dl-mid: #ec835a; --dl-major: #f07070;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --surface-0: #121211;
  --surface-1: #1a1a19;
  --surface-2: #242423;
  --border: #2f2f2d;
  --text-primary: #ffffff;
  --text-secondary: #c3c2b7;
  --text-muted: #9a998f;
  --grid: #2c2c2a;
  --accent: #3987e5;
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-4: #c98500;
  --series-5: #d55181;
  --overlay-bg: rgba(26, 26, 25, .92);
  --overlay-text: #ffffff;
  --overlay-muted: #c3c2b7;
  --overlay-faint: #9a998f;
  --overlay-border: #3a3a37;
  --overlay-field: #242423;
  --overlay-shadow: 0 2px 10px rgba(0, 0, 0, .3);
  --panel-bg: #1a1a19;
  --panel-line: #2f2f2d;
  --panel-hover: #242423;
  --panel-rail: #5a5a55;
  --panel-note: #fab219;
  --dl-early: #c9a3ff; --dl-ok: #3fc93f; --dl-minor: #fab219; --dl-mid: #ec835a; --dl-major: #f07070;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--surface-0);
  color: var(--text-primary);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--accent); }
.wrap { max-width: 1600px; margin: 0 auto; padding: 0 24px; }
.top .wrap { max-width: none; }
main.wide { max-width: none; }

.top { background: var(--surface-1); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.top-inner { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; padding-top: 14px; flex-wrap: wrap; }
.eyebrow { margin: 0; color: var(--text-secondary); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; font-weight: 600; }
h1 { margin: 2px 0 0; font-size: 26px; line-height: 1.15; }
.beta-badge { display: inline-block; vertical-align: middle; margin-left: 4px; padding: 1px 7px; border: 1px solid var(--accent); border-radius: 999px;
  color: var(--accent); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; line-height: 1.5; text-decoration: none; position: relative; top: -2px; }
.beta-badge:hover, .beta-badge:focus-visible { background: var(--accent); color: #fff; }
.top-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.controls { display: flex; align-items: center; gap: 10px; }
.ctl { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-secondary); }
.ctl select, .lang button {
  font: inherit; font-size: 13px; color: var(--text-primary); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 8px; padding: 4px 8px; cursor: pointer;
}
.lang { display: inline-flex; }
.lang button { border-radius: 0; font-weight: 600; min-width: 36px; }
.lang button:first-child { border-radius: 8px 0 0 8px; }
.lang button:last-child { border-radius: 0 8px 8px 0; border-left: 0; }
.lang button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.ctl select:focus-visible, .lang button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.freshness { font-size: 13px; color: var(--text-secondary); display: flex; align-items: center; gap: 8px; }
.freshness .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--good); flex: none; }
.freshness.stale .dot { background: var(--warning); }
.freshness.error .dot { background: var(--critical); }
.tabs { display: flex; gap: 4px; overflow-x: auto; padding-top: 10px; scrollbar-width: none; }
.tabs button {
  appearance: none; border: 0; background: none; color: var(--text-secondary); font: inherit; font-weight: 600;
  padding: 10px 12px; border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap;
}
.tabs button[aria-selected="true"] { color: var(--text-primary); border-bottom-color: var(--accent); }
.tabs button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

main { padding-top: 16px; padding-bottom: 8px; }
.tab { display: flex; flex-direction: column; gap: 16px; }
.tab[hidden] { display: none; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 900px) { .grid2 { grid-template-columns: minmax(0, 1fr); } }

.card { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; min-width: 0; }
.card h2 { margin: 0; font-size: 16px; }
.card .sub { margin: 2px 0 12px; color: var(--text-muted); font-size: 13px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head input {
  font: inherit; font-size: 14px; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text-primary); min-width: 0; width: 280px; max-width: 100%;
}

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.kpi { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.kpi .label { color: var(--text-secondary); font-size: 13px; }
.kpi .value { font-size: 26px; font-weight: 650; line-height: 1.2; margin-top: 2px; white-space: nowrap; }
.kpi .note { color: var(--text-muted); font-size: 12px; margin-top: 2px; }
.kpi .status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }

/* clip, not only hidden: an overflow:hidden box can still be scrolled by focus() or scrollIntoView on a child that
   sits off-screen (a drawer sliding in), which shifted the whole map left and left an empty black area */
.map-shell { position: relative; border-radius: var(--radius); overflow: hidden; overflow: clip; border: 1px solid var(--border); background: #0e0e0e; }
.map { height: 68vh; min-height: 420px; width: 100%; }
#tab-mapa .map, #tab-izochrony .map { height: calc(100vh - 150px); min-height: 520px; }
.map-small { height: 380px; min-height: 0; border-radius: 8px; overflow: hidden; }
.layers {
  position: absolute; top: 10px; left: 10px; z-index: 2; background: var(--overlay-bg); color: var(--overlay-text);
  border-radius: 10px; padding: 10px 12px; font-size: 13px; max-height: calc(100% - 20px); overflow: auto; width: 220px;
  box-shadow: var(--overlay-shadow);
}
.layers-title { margin: 0; font-weight: 650; cursor: pointer; list-style: none; }
.layers-title::-webkit-details-marker { display: none; }
.layers-title::after { content: ' ▾'; font-size: 11px; color: var(--overlay-muted); }
.layers:not([open]) .layers-title::after { content: ' ▸'; }
.layers[open] .layers-title { margin-bottom: 6px; }
.layers label { display: flex; align-items: center; gap: 8px; padding: 3px 0; cursor: pointer; }
.layers .swatch { width: 14px; height: 4px; border-radius: 2px; flex: none; }
.layers .swatch.round { height: 10px; width: 10px; border-radius: 50%; }
.legend {
  position: absolute; right: 10px; bottom: 30px; z-index: 2; background: var(--overlay-bg); color: var(--overlay-text);
  border-radius: 10px; padding: 10px 12px; font-size: 12px; max-width: 260px; box-shadow: var(--overlay-shadow);
}
.legend:empty { display: none; }
.legend .ttl { font-weight: 650; margin: 6px 0 4px; }
.legend .ttl:first-child { margin-top: 0; }
.legend .ramp { display: flex; height: 8px; border-radius: 4px; overflow: hidden; }
.legend .ramp span { flex: 1; }
.legend .ends { display: flex; justify-content: space-between; color: var(--overlay-muted); }
.legend .steps { display: grid; grid-template-columns: 22px auto; gap: 3px 8px; align-items: center; }
.legend .steps i { height: 5px; border-radius: 3px; }
.legend .steps i.ring { width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 3px solid; box-sizing: border-box; justify-self: center; }
@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  #tab-mapa .map, #tab-izochrony .map { height: 70vh; min-height: 0; }
  .top { position: static; }
  .top-right { align-items: flex-start; }
  h1 { font-size: 22px; }
  .map { height: 70vh; }
  .layers { width: auto; max-width: 200px; font-size: 12px; max-height: 60%; }
  .legend { display: none; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .kpi { padding: 10px 12px; }
  .kpi .value { font-size: 22px; }
}

.table-wrap { overflow: auto; max-height: 520px; border: 1px solid var(--border); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { padding: 7px 10px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { position: sticky; top: 0; background: var(--surface-2); color: var(--text-secondary); font-weight: 600; cursor: pointer; user-select: none; }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
th[aria-sort="ascending"]::after { content: " ▲"; font-size: 10px; }
th[aria-sort="descending"]::after { content: " ▼"; font-size: 10px; }
tbody tr:hover { background: var(--surface-2); }
tbody tr.clickable { cursor: pointer; }
.pill { display: inline-flex; align-items: center; gap: 6px; }
.empty { color: var(--text-muted); padding: 24px; text-align: center; font-size: 14px; }

.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--text-muted); font-size: 11px; }
.chart .lbl { fill: var(--text-secondary); font-size: 12px; }
.chart .val { fill: var(--text-secondary); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .axis { stroke: var(--text-muted); stroke-width: 1; opacity: .5; }
.chart .hover-line { stroke: var(--text-muted); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--text-secondary); margin-bottom: 8px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }

.tooltip {
  position: fixed; z-index: 50; pointer-events: none; background: var(--surface-1); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-size: 12px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .18); max-width: 280px;
}
.tooltip .t-title { font-weight: 650; margin-bottom: 4px; }
.tooltip .t-row { display: flex; align-items: center; gap: 6px; justify-content: space-between; }
.tooltip .t-row b { font-weight: 600; font-variant-numeric: tabular-nums; }

.maplibregl-popup-content { background: var(--surface-1); box-shadow: var(--overlay-shadow); color: var(--overlay-text); border-radius: 10px; padding: 10px 12px; font: 13px/1.4 system-ui, sans-serif; }
.maplibregl-popup-tip { border-top-color: var(--surface-1) !important; border-bottom-color: var(--surface-1) !important; }
.maplibregl-popup-close-button { color: var(--overlay-muted); font-size: 16px; }
.pop-title { font-weight: 650; margin-bottom: 4px; }
.pop-row { color: var(--overlay-muted); }
.pop-row b { color: var(--overlay-text); font-weight: 600; }

.foot { color: var(--text-muted); font-size: 12px; padding-top: 8px; padding-bottom: 24px; }
.foot .author { white-space: nowrap; }
.foot .author a { font-weight: 600; }
.foot .foot-beta { margin-top: 4px; }
.beta-card { border-left: 3px solid var(--accent); scroll-margin-top: 80px; }
.beta-card p { margin: 8px 0 0; font-size: 14px; line-height: 1.5; color: var(--text-secondary); max-width: 80ch; }
.beta-card a { font-weight: 600; }

.info {
  appearance: none; display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 16px; height: 16px; margin-left: 6px; padding: 0; vertical-align: 1px;
  border: 1px solid currentColor; border-radius: 50%; background: transparent; color: var(--text-muted);
  font: 700 10px/1 Georgia, "Times New Roman", serif; font-style: italic; cursor: help; opacity: .8;
}
.info:hover, .info:focus-visible { opacity: 1; color: var(--accent); outline: none; }
.info:focus-visible { box-shadow: 0 0 0 2px var(--accent); }
.card h2 .info { width: 17px; height: 17px; }
.layers .info { color: var(--overlay-muted); margin-left: auto; }
.layers label { padding-right: 2px; }
.tooltip .t-text { font-size: 13px; line-height: 1.45; color: var(--text-primary); }
.tooltip { max-width: 320px; }

.iso-opts { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; }
.iso-opts fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; }
.iso-opts legend { float: left; margin-right: 10px; font-size: 13px; color: var(--text-secondary); padding: 0; }
.iso-opts fieldset label { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }
.iso-status { margin: 0; font-size: 13px; color: var(--text-muted); flex-basis: 100%; }
.iso-status.warn { color: var(--text-secondary); }
.iso-status.warn::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--warning); margin-right: 6px; }
.layers .swatch-icon { width: 18px; height: 18px; flex: none; margin: -2px -2px; }

.iso-find { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.iso-search { position: relative; flex: 1 1 320px; max-width: 520px; }
.iso-search input {
  width: 100%; font: inherit; font-size: 14px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text-primary);
}
.iso-search input:focus-visible, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.iso-results {
  position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; right: 0; margin: 0; padding: 4px; list-style: none;
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.2);
  max-height: 320px; overflow: auto;
}
.iso-results li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 8px; border-radius: 6px; cursor: pointer; font-size: 14px; }
.iso-results li[aria-selected="true"], .iso-results li:hover { background: var(--surface-2); }
.iso-results .kind { color: var(--text-muted); font-size: 12px; white-space: nowrap; }
.iso-results .note { color: var(--text-muted); font-size: 12px; cursor: default; }
.iso-results .note:hover { background: none; }
.btn {
  display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  padding: 8px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-primary);
}
.btn:hover { border-color: var(--accent); }
.btn[aria-busy="true"] { opacity: .6; cursor: progress; }

.kpi-foot { margin: -6px 0 0; font-size: 12px; color: var(--text-muted); }
.kpi .delta { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.events-card { padding-bottom: 8px; }
.events { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 6px 16px; }
.events li { min-width: 0; }
.events button {
  appearance: none; width: 100%; display: flex; align-items: flex-start; gap: 10px; text-align: left; font: inherit; font-size: 14px;
  color: var(--text-primary); background: none; border: 0; border-radius: 8px; padding: 7px 8px; cursor: pointer;
}
.events button:hover, .events button:focus-visible { background: var(--surface-2); outline: none; }
.events button:disabled { cursor: default; }
.events button:disabled:hover { background: none; }
.events .status-dot { margin-top: 6px; }
.events .ev-go { margin-left: auto; color: var(--text-muted); font-size: 12px; white-space: nowrap; padding-top: 2px; }
.events .ev-toggle { grid-column: 1 / -1; }
.events button.ev-more { width: auto; color: var(--accent); font-size: 13px; font-weight: 600; padding: 5px 8px; }
.events .ev-time { display: block; color: var(--text-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.events .calm { color: var(--text-secondary); padding: 7px 8px; font-size: 14px; }
.follow {
  position: absolute; left: 10px; top: 56px; bottom: 34px; z-index: 3; width: 370px; max-width: calc(100% - 20px);
  display: flex; flex-direction: column; background: var(--panel-bg); color: var(--overlay-text); box-shadow: var(--overlay-shadow); border-radius: 12px; padding: 12px 0 10px;
  font-size: 13px; box-shadow: 0 8px 24px rgba(0,0,0,.35);
}
.follow[hidden] { display: none; }
.follow > .follow-head, .follow > .follow-row, .follow > .follow-foot { padding-left: 14px; padding-right: 14px; }
.follow .note { color: var(--panel-note); }
.timeline { list-style: none; margin: 10px 0 0; padding: 0; overflow-y: auto; flex: 1; border-top: 1px solid var(--panel-line); }
.tl { display: grid; grid-template-columns: 46px 22px minmax(0, 1fr) auto; gap: 0 8px; padding: 0 14px 0 10px; cursor: pointer; min-height: 46px; }
.tl:hover { background: #20201f; }
.tl.current { background: rgba(57, 135, 229, .14); }
.tl-time { text-align: right; font-variant-numeric: tabular-nums; padding: 7px 0; line-height: 1.25; }
.tl-time .sch { font-size: 11px; color: var(--overlay-faint); text-decoration: line-through; }
.tl-time .exp { font-weight: 700; }
.tl.passed .tl-time .exp { color: var(--overlay-faint); font-weight: 600; }
.tl-rail { position: relative; }
.tl-rail::before { content: ''; position: absolute; left: 50%; top: 0; bottom: 50%; width: 4px; margin-left: -2px; background: var(--seg); border-radius: 2px; }
.tl-rail::after { content: ''; position: absolute; left: 50%; top: 50%; bottom: 0; width: 4px; margin-left: -2px; background: var(--next, transparent); }
.tl-rail.future::before { background: repeating-linear-gradient(to bottom, var(--seg) 0 5px, transparent 5px 9px); }
.tl-rail.next-future::after { background: repeating-linear-gradient(to bottom, var(--next) 0 5px, transparent 5px 9px); }
.tl-dot { position: absolute; left: 50%; top: 50%; width: 11px; height: 11px; margin: -5.5px 0 0 -5.5px; border-radius: 50%; background: #fff; border: 2px solid #0d0d0c; z-index: 1; }
.tl.passed .tl-dot { background: #6f6e69; }
.tl.current .tl-dot { width: 24px; height: 24px; margin: -12px 0 0 -12px; border: 0; background: none; }
.tl-dot img { width: 24px; height: 24px; display: block; }
.tl-name { padding: 7px 0; min-width: 0; }
.tl-name .nm { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl.passed .tl-name .nm { color: var(--overlay-faint); font-weight: 500; }
.tl-name .ss { font-size: 11px; margin-top: 1px; }
.tl-name .ss.muted { color: #8a897f; }
.tl-cd { align-self: center; font-size: 12px; color: var(--overlay-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.dl-early { color: var(--dl-early) !important; } .dl-ok { color: var(--dl-ok) !important; } .dl-minor { color: var(--dl-minor) !important; }
.dl-mid { color: var(--dl-mid) !important; } .dl-major { color: var(--dl-major) !important; }
.lg-note { color: var(--overlay-muted); margin-top: 4px; }
.follow-head { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 650; }
.follow-head img { width: 26px; height: 26px; }
.follow-head > span:not(.hs) { white-space: nowrap; }
.follow-head .hs { font-weight: 400; color: var(--overlay-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.follow-close { margin-left: auto; appearance: none; border: 0; background: none; color: var(--overlay-muted); font-size: 20px; line-height: 1; cursor: pointer; padding: 0 2px; }
.follow-close:hover, .follow-close:focus-visible { color: var(--overlay-text); outline: none; }
.follow-row { color: var(--overlay-muted); margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.follow-row b { color: var(--overlay-text); font-weight: 600; }
.follow-stops { list-style: none; margin: 10px 0 0; padding: 0; border-top: 1px solid var(--panel-line); }
.follow-stops li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--panel-line); }
.follow-stops .eta { color: var(--overlay-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.follow-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 8px; color: var(--overlay-faint); font-size: 12px; }
.follow-foot button { font: inherit; font-size: 12px; font-weight: 600; color: var(--overlay-text); background: var(--overlay-field); border: 0; border-radius: 6px; padding: 5px 9px; cursor: pointer; }
.pop-actions { margin-top: 8px; }
.pop-actions button { font: inherit; font-size: 12px; font-weight: 600; color: #fff; background: #3987e5; border: 0; border-radius: 6px; padding: 6px 10px; cursor: pointer; }
@media (max-width: 640px) {
  .events { grid-template-columns: minmax(0, 1fr); }
  .follow { left: 8px; right: 8px; top: auto; bottom: 30px; width: auto; max-height: 60%; }
}

.how summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; }
.how summary::-webkit-details-marker { display: none; }
.how summary::before { content: '▸'; color: var(--text-muted); font-size: 13px; }
.how[open] summary::before { content: '▾'; }
.how summary h2 { display: inline; }
.how-body { margin-top: 12px; font-size: 14px; line-height: 1.55; color: var(--text-secondary); max-width: 900px; }
.how-body h3 { font-size: 14px; color: var(--text-primary); margin: 18px 0 6px; }
.how-body h3:first-child { margin-top: 4px; }
.how-body p { margin: 0 0 8px; }
.how-body ul, .how-body ol { margin: 0 0 8px; padding-left: 22px; }
.how-body li { margin: 3px 0; }
.how-body b { color: var(--text-primary); font-weight: 600; }
.how-body .table-wrap { max-width: 640px; margin: 6px 0 10px; }

.board {
  position: absolute; top: 10px; right: 52px; bottom: 34px; z-index: 4; width: 380px; max-width: calc(100% - 64px);
  display: flex; flex-direction: column; background: var(--panel-bg); color: var(--overlay-text); box-shadow: var(--overlay-shadow); border-radius: 12px;
  box-shadow: 0 8px 28px rgba(0,0,0,.4); overflow: hidden;
}
.board[hidden] { display: none; }
.board-head { padding: 12px 14px 10px; border-bottom: 1px solid var(--panel-line); }
.board-title { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 650; }
.board-title svg { flex: none; }
.board-title .follow-close { margin-left: auto; }
.board-lines { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.board-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.board-chips button { font: inherit; font-size: 12px; font-weight: 600; color: var(--overlay-muted); background: var(--panel-hover); border: 1px solid var(--overlay-border); border-radius: 999px; padding: 3px 10px; cursor: pointer; }
.board-chips button[aria-pressed="true"] { color: #fff; background: #3987e5; border-color: #3987e5; }
.lbadge { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 22px; padding: 0 6px; border-radius: 6px; color: #fff; font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums; }
.lbadge.sm { min-width: 24px; height: 18px; font-size: 11px; padding: 0 4px; border-radius: 4px; }
.board-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.board-list li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 9px 14px; border-bottom: 1px solid #262624; }
.board-list li.clickable { cursor: pointer; }
.board-list li.clickable:hover { background: var(--panel-hover); }
.board-list li.at-stop { background: rgba(57, 135, 229, .12); }
.board-dest { min-width: 0; }
.board-dest .hs { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board-dest .st { font-size: 12px; margin-top: 2px; display: flex; align-items: center; gap: 6px; color: var(--overlay-faint); }
.board-dest .pf { font-size: 11px; color: var(--overlay-faint); border: 1px solid var(--overlay-border); border-radius: 4px; padding: 0 4px; }
.board-time { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.board-time .exp { font-size: 16px; font-weight: 700; }
.board-time .sch { font-size: 11px; color: var(--overlay-faint); text-decoration: line-through; margin-right: 4px; }
.board-time .cd { font-size: 12px; color: var(--overlay-muted); }
.st-late { color: #ec835a !important; }
.st-very-late { color: #f08080 !important; }
.st-early { color: #fab219 !important; }
.st-ok { color: #3fc93f !important; }
.st-at { color: #6da7ec !important; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: #3fc93f; box-shadow: 0 0 0 0 rgba(63, 201, 63, .6); animation: pulse 1.8s infinite; flex: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(63,201,63,.6); } 70% { box-shadow: 0 0 0 7px rgba(63,201,63,0); } 100% { box-shadow: 0 0 0 0 rgba(63,201,63,0); } }
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }
.board-foot { padding: 8px 14px; font-size: 11px; color: var(--overlay-faint); border-top: 1px solid var(--panel-line); }
.board-empty { padding: 20px 14px; color: var(--overlay-faint); font-size: 13px; }
@media (max-width: 640px) {
  .board { top: auto; left: 8px; right: 8px; bottom: 30px; width: auto; max-width: none; max-height: 62%; }
}

/* about page */
.home-link { color: inherit; text-decoration: none; }
.about { display: flex; flex-direction: column; gap: 20px; padding-top: 24px; padding-bottom: 12px; max-width: 1400px; }
.about .part p, .about .why p, .about .flow li, .about .see { max-width: 75ch; }
.about h2 { font-size: 18px; margin: 0 0 4px; }
.about .sec-h { margin: 0 0 10px; }
.hero { padding: 12px 0 4px; max-width: 900px; }
.hero .kicker { margin: 0; color: var(--accent); font-weight: 650; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; }
.hero h2 { font-size: clamp(24px, 3.4vw, 36px); line-height: 1.15; margin: 8px 0 12px; }
.hero .lead { font-size: 17px; line-height: 1.55; color: var(--text-secondary); margin: 0; }
.hero-cta { margin-top: 18px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; text-decoration: none; }
a.btn { text-decoration: none; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.stat { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.stat .v { font-size: 28px; font-weight: 700; line-height: 1.15; }
.stat .l { color: var(--text-secondary); font-size: 13px; margin-top: 4px; }
.arch-wrap { margin-top: 12px; }
.arch { width: 100%; height: auto; display: block; }
.arch-t { fill: var(--text-primary); font-size: 14px; font-weight: 650; }
.arch-s { fill: var(--text-secondary); font-size: 12px; }
.arch-fabric { fill: var(--accent); font-size: 12px; font-weight: 650; }
.arch-lane { fill: var(--text-secondary); font-size: 12px; font-weight: 650; }
.arch-e { fill: var(--text-muted); font-size: 11px; font-style: italic; }
.files-wrap { overflow-x: auto; margin-top: 10px; }
.files th { cursor: default; position: static; }
.files td { white-space: normal; vertical-align: top; line-height: 1.45; }
.files td.when { font-weight: 700; color: var(--accent); white-space: nowrap; font-variant-numeric: tabular-nums; }
.files code { font-size: 12px; color: var(--text-primary); white-space: normal; }
.files td.size { color: var(--text-secondary); font-size: 12px; min-width: 200px; font-variant-numeric: tabular-nums; }
/* phones: each row becomes a block (interval + files, description, size) instead of four narrow columns */
@media (max-width: 640px) {
  .files thead { display: none; }
  .files, .files tbody, .files tr, .files td { display: block; width: auto; }
  .files tr { padding: 10px 0; border-bottom: 1px solid var(--border); }
  .files td { border: 0; padding: 2px 0; }
  .files td.when { display: inline-block; margin-right: 8px; }
  .files td.when + td { display: inline; }
  .files td.size { min-width: 0; margin-top: 4px; }
}
.files tbody tr:hover { background: none; }
.parts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 1000px) { .parts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .parts { grid-template-columns: minmax(0, 1fr); } }
.part h3, .why h3 { margin: 0 0 6px; font-size: 15px; }
.part p, .why p { margin: 0; color: var(--text-secondary); line-height: 1.5; font-size: 14px; }
.flow { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 10px; }
.flow li { display: grid; grid-template-columns: 96px 1fr; gap: 12px; align-items: baseline; line-height: 1.5; }
.flow .when { font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.code { margin: 10px 0 0; padding: 14px; border-radius: 10px; background: #111110; color: #e8e7e1; overflow-x: auto; font: 12.5px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.why { display: grid; gap: 14px; margin-top: 8px; }
.see { margin: 10px 0 0; padding-left: 18px; line-height: 1.7; color: var(--text-secondary); }
.see a { font-weight: 600; }
@media (max-width: 640px) { .flow li { grid-template-columns: 70px 1fr; } .hero .lead { font-size: 15px; } }

.map-toggles { position: absolute; top: 10px; right: 52px; z-index: 3; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; max-width: calc(100% - 300px); }
.drawer-toggle {
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  font: inherit; font-size: 13px; font-weight: 650; color: var(--overlay-text); background: var(--overlay-bg); border: 1px solid var(--overlay-border);
  border-radius: 8px; padding: 7px 12px; cursor: pointer; box-shadow: var(--overlay-shadow);
}
.drawer-toggle:hover, .drawer-toggle:focus-visible { border-color: var(--accent); outline: none; }
.drawer-toggle .count { background: var(--accent); color: #fff; border-radius: 999px; padding: 0 7px; font-size: 12px; line-height: 18px; }
.drawer {
  position: absolute; top: 0; right: 0; bottom: 0; z-index: 5; width: 520px; max-width: 100%;
  display: flex; flex-direction: column; gap: 10px; padding: 14px 14px 10px;
  background: var(--surface-1); color: var(--text-primary); border-left: 1px solid var(--border); box-shadow: -10px 0 30px rgba(0,0,0,.35);
  transform: translateX(105%); visibility: hidden; transition: transform .25s ease, visibility 0s linear .25s;
}
.drawer.open { transform: none; visibility: visible; transition: transform .25s ease; }
@media (prefers-reduced-motion: reduce) { .drawer, .drawer.open { transition: none; } }
.drawer-head { display: flex; align-items: center; gap: 8px; }
.drawer-head h2 { margin: 0; font-size: 16px; display: flex; align-items: center; }
.drawer-close { margin-left: auto; appearance: none; border: 0; background: none; color: var(--text-secondary); font-size: 22px; line-height: 1; cursor: pointer; padding: 0 4px; }
.drawer-close:hover, .drawer-close:focus-visible { color: var(--text-primary); outline: none; }
.drawer input[type=search] { font: inherit; font-size: 14px; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-primary); }
.drawer-body { flex: 1; overflow: auto; border: 1px solid var(--border); border-radius: 8px; }
.drawer-body table { font-size: 12.5px; }
.drawer-body th, .drawer-body td { padding: 6px 8px; }
.drawer-body .trunc { display: inline-block; max-width: 128px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.drawer-body table { table-layout: auto; }
@media (max-width: 640px) {
  .drawer { width: 100%; }
  .drawer { padding: 12px 8px 8px; }
  .drawer-body table { font-size: 12px; }
  .drawer-body .trunc { max-width: 74px; }
  .drawer-body th, .drawer-body td { padding: 6px 6px; }
  .map-toggles { top: auto; bottom: 36px; right: 8px; max-width: calc(100% - 16px); }
  .drawer-toggle { padding: 6px 10px; font-size: 12px; }
}
.drawer-toggle .status-dot { width: 9px; height: 9px; }
.drawer-toggle .count[hidden] { display: none; }
.drawer-events { width: 420px; }
.drawer-events .drawer-body { border: 0; }
.drawer .events { grid-template-columns: minmax(0, 1fr); gap: 2px; }
@media (max-width: 640px) { .drawer-events { width: 100%; } }
/* full-screen map: the shell fills the screen and the map fills the shell (pseudo variant for iOS Safari) */
.map-shell:fullscreen { border-radius: 0; border: 0; }
.map-shell:fullscreen #map { height: 100vh; min-height: 0; }
.map-shell.maplibregl-pseudo-fullscreen { position: fixed !important; inset: 0; z-index: 100; border-radius: 0; border: 0; width: 100% !important; height: 100% !important; }
.map-shell.maplibregl-pseudo-fullscreen #map { height: 100%; min-height: 0; }
/* Desktop: the map tab (KPIs + map) fits the window below the sticky header, so the whole map is visible without
   scrolling the page. --header-h is measured in app.js (the header wraps to two rows on narrower windows).
   24px = main top padding (16) + bottom padding (8). On very short windows min-height wins and the page scrolls. */
@media (min-width: 641px) {
  #tab-mapa:not([hidden]) {
    height: calc(100vh - var(--header-h, 120px) - 24px);
    height: calc(100dvh - var(--header-h, 120px) - 24px);
    min-height: 560px;
  }
  #tab-mapa .map-shell { flex: 1 1 auto; min-height: 320px; display: flex; flex-direction: column; }
  #tab-mapa .map { flex: 1 1 auto; height: auto; min-height: 0; }
}

.layers .basemap { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 0 8px; margin-bottom: 4px; border-bottom: 1px solid var(--overlay-border); cursor: default; }
.layers .basemap:has(+ .basemap) { border-bottom: 0; padding-bottom: 4px; margin-bottom: 0; }
.layers .basemap select { font: inherit; font-size: 12px; color: var(--overlay-text); background: var(--overlay-field); border: 1px solid var(--overlay-border); border-radius: 6px; padding: 3px 6px; }

.layers[open] { z-index: 6; }
.layers-group { margin: 8px 0 2px; font-size: 11px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--overlay-faint); }
.layers-group:first-child { margin-top: 2px; }

.follow-foot .foot-btns { display: flex; gap: 6px; }
.follow-foot button.toggle[aria-pressed="true"] { background: #3987e5; color: #fff; }
.follow-foot button.toggle[aria-pressed="true"]::before { content: '● '; font-size: 9px; vertical-align: 1px; }

/* ---------- archive tab ("Dane archiwalne") ---------- */
.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; }
.ar-date { display: flex; align-items: center; gap: 6px; }
.ar-date .btn { padding: 6px 12px; font-size: 16px; line-height: 1; }
.ar-date .btn:disabled { opacity: .4; cursor: default; border-color: var(--border); }
.ar-date select { font: inherit; font-size: 14px; color: var(--text-primary); background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; }
.ar-cats { display: grid; gap: 12px; }
.ar-cat h3 { margin: 0 0 6px; font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.ar-tiles { display: flex; flex-wrap: wrap; gap: 6px; }
.ar-tile {
  position: relative; min-width: 44px; height: 34px; padding: 0 8px 3px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-primary);
  font: inherit; font-size: 13px; font-weight: 650; font-variant-numeric: tabular-nums;
}
/* bar in the colour of the line's median delay of the day */
.ar-tile::after { content: ''; position: absolute; left: 7px; right: 7px; bottom: 4px; height: 3px; border-radius: 2px; background: var(--ar-c, transparent); }
.ar-tile:hover { border-color: var(--accent); }
.ar-tile[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.ar-tile:focus-visible, .ar-trip:focus-visible, .ar-matrix:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.ar-msg { margin: 0; color: var(--text-muted); font-size: 14px; }

.ar-view { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(340px, 1fr); gap: 16px; align-items: start; }
.ar-view[hidden], .ar-matrix[hidden] { display: none; }
.ar-map-shell { position: sticky; top: calc(var(--header-h, 110px) + 12px); }
#tab-archiwum .map, #tab-pojazdy .map { height: calc(100vh - var(--header-h, 110px) - 40px); min-height: 380px; }
.ar-head { display: grid; gap: 8px; margin-bottom: 10px; }
.ar-head .sub { margin: 0; }
.ar-title { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.ar-title h2 { font-size: 20px; }
.ar-dirs { display: flex; flex-wrap: wrap; gap: 6px; }
.ar-dirs .btn { padding: 6px 12px; font-size: 13px; }
.ar-dirs .btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.ar-hint { font-size: 12px !important; }

.ar-matrix { overflow: auto; max-height: calc(100vh - var(--header-h, 110px) - 200px); min-height: 240px; border: 1px solid var(--border); border-radius: 8px; }
.ar-grid { width: auto; border-collapse: separate; border-spacing: 2px; font-size: 11px; font-variant-numeric: tabular-nums; }
.ar-grid th, .ar-grid td { padding: 0; border: 0; cursor: default; }
.ar-grid tbody tr:hover { background: none; }
.ar-grid td { min-width: 34px; height: 22px; text-align: center; border-radius: 3px; font-weight: 600; }
.ar-grid thead th { position: sticky; top: 0; z-index: 2; background: var(--surface-1); height: 26px; }
.ar-grid .ar-stop {
  position: sticky; left: 0; z-index: 1; background: var(--surface-1); color: var(--text-primary);
  width: 190px; min-width: 190px; max-width: 190px; padding-right: 8px; text-align: left; font-size: 12px; font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ar-grid .ar-med { position: sticky; left: 192px; z-index: 1; min-width: 46px; box-shadow: -2px 0 0 var(--surface-1), 2px 0 0 var(--surface-1); }
.ar-grid thead .ar-stop, .ar-grid thead .ar-med { z-index: 3; color: var(--text-secondary); font-weight: 600; background: var(--surface-1); }
.ar-grid thead .ar-med { font-size: 11px; }
.ar-trip {
  font: inherit; font-size: 11px; font-weight: 600; color: var(--text-secondary); background: none; border: 1px solid transparent;
  border-radius: 4px; padding: 3px 2px; width: 100%; cursor: pointer;
}
.ar-trip:hover { color: var(--text-primary); border-color: var(--accent); }
.ar-trip[aria-pressed="true"] { background: var(--accent); color: #fff; }
/* the same colours as the trip view (DELAY_CATS in app.js); dark text except on red */
.ar-grid td.c-early { background: #b07cf5; color: #111; }
.ar-grid td.c-ok { background: #3fc93f; color: #111; }
.ar-grid td.c-minor { background: #fab219; color: #111; }
.ar-grid td.c-mid { background: #ec835a; color: #111; }
.ar-grid td.c-major { background: #d03b3b; color: #fff; }
.ar-grid td.nodata { background: var(--surface-2); color: var(--text-muted); }
.ar-grid td.sel { outline: 2px solid var(--text-primary); outline-offset: -1px; }
.ar-grid td.none.sel { outline-color: var(--border); }
.ar-grid tr.flash > * { animation: ar-flash 1.2s ease-out; }
@keyframes ar-flash { from { box-shadow: inset 0 0 0 2px var(--accent); } to { box-shadow: inset 0 0 0 2px transparent; } }
@media (prefers-reduced-motion: reduce) { .ar-grid tr.flash > * { animation: none; outline: 2px solid var(--accent); } }
.ar-lg-btn { margin-top: 8px; padding: 4px 10px; font-size: 12px; }

@media (max-width: 1000px) {
  .ar-view { grid-template-columns: minmax(0, 1fr); }
  .ar-map-shell { position: relative; top: 0; order: -1; }
  #tab-archiwum .map, #tab-pojazdy .map { height: 340px; min-height: 0; }
  .ar-matrix { max-height: 70vh; }
}
@media (max-width: 640px) {
  .ar-grid .ar-stop { width: 120px; min-width: 120px; max-width: 120px; font-size: 11px; }
  .ar-grid .ar-med { left: 122px; }
  .card-head .ar-date { width: 100%; }
  /* below the map instead of over it */
  #tab-archiwum .legend, #tab-pojazdy .legend { display: block; position: static; max-width: none; border-radius: 0; box-shadow: none; padding: 8px 12px; font-size: 11px; }
  #tab-archiwum .legend .steps, #tab-pojazdy .legend .steps { display: flex; flex-wrap: wrap; gap: 4px 10px; }
  #tab-archiwum .legend .steps i, #tab-pojazdy .legend .steps i { width: 14px; margin-right: -6px; }
}

/* bunching in the archive matrix: dark corner on the cell (the trip caught up with the previous one) */
.ar-grid td.bunch { background-image: linear-gradient(135deg, #111 0 8px, transparent 8px); }
.ar-bunch-key { display: inline-block; width: 12px; height: 12px; border-radius: 2px; vertical-align: -2px; margin-right: 5px; background: linear-gradient(135deg, #111 0 7px, #3fc93f 7px); }
.ar-bunch-note { white-space: nowrap; }

/* line diagram (bunching): vehicles of one line on a straight strip per direction */
.linediag { bottom: auto; max-height: calc(100% - 44px); background: var(--panel-bg); }
.linediag .ld-hint { margin: 6px 0 0; font-size: 12px; color: var(--overlay-muted); line-height: 1.4; }
.ld-body { overflow: auto; padding: 8px 14px 14px; }
.ld-dir { padding: 8px 0 10px; border-bottom: 1px solid var(--panel-line); }
.ld-dir:last-child { border-bottom: 0; }
.ld-dir h3 { margin: 0 0 2px; font-size: 13px; font-weight: 650; color: var(--overlay-text); }
.ld-svg { display: block; width: 100%; height: auto; overflow: visible; }
.ld-base { stroke: var(--panel-rail); stroke-width: 4; stroke-linecap: round; }
.ld-arrow { fill: var(--panel-rail); }
.ld-tick { stroke: var(--overlay-muted); stroke-width: 1.5; cursor: default; }
.ld-pair { stroke-width: 8; stroke-linecap: round; }
.ld-hole { stroke: var(--overlay-faint); stroke-width: 4; stroke-dasharray: 3 5; stroke-linecap: round; }
.ld-lbl { fill: var(--overlay-text); font-size: 11px; font-weight: 600; text-anchor: middle; paint-order: stroke; stroke: var(--surface-1); stroke-width: 3px; }
.ld-lbl-pair { fill: var(--overlay-text); }
.ld-lead { stroke: var(--overlay-faint); stroke-width: 1; }
.ld-veh { stroke-width: 2; cursor: pointer; }
.ld-veh.bunched { stroke-width: 3.5; }
.ld-veh:focus-visible { outline: none; stroke: #3987e5; stroke-width: 4; }
.ld-ends { display: flex; justify-content: space-between; gap: 12px; font-size: 11px; color: var(--overlay-faint); margin-top: -6px; }
.ld-ends span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 48%; }
.ld-sum { margin: 6px 0 0; font-size: 12px; color: var(--overlay-muted); }

/* ---------- vehicles tab ---------- */
.vh-search { display: grid; gap: 12px; margin-top: 12px; }
.vh-search input {
  font: inherit; font-size: 15px; width: 100%; max-width: 520px; box-sizing: border-box; padding: 9px 12px;
  color: var(--text-primary); background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px;
}
.vh-search input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.vh-results { display: grid; gap: 12px; }
.vh-group h3 { margin: 0 0 6px; font-size: 13px; font-weight: 650; color: var(--text-secondary); }
.vh-hits { display: flex; flex-wrap: wrap; gap: 6px; }
.vh-hit {
  display: inline-flex; align-items: baseline; gap: 8px; padding: 6px 10px; cursor: pointer; text-align: left;
  font: inherit; font-size: 13px; color: var(--text-primary); background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px;
}
.vh-hit:hover { border-color: var(--accent); }
.vh-hit[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.vh-hit:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.vh-plate { font-weight: 700; font-variant-numeric: tabular-nums; }
.vh-mode, .vh-sub { color: var(--text-muted); font-size: 12px; }
.vh-live { display: inline-flex; align-items: center; gap: 5px; color: var(--good); font-size: 12px; font-weight: 600; }
.vh-live i { width: 7px; height: 7px; border-radius: 50%; background: var(--good); }
.vh-lines { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.vh-lines .sub { margin: 0 4px 0 0; }
.vh-now { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; font-size: 14px; }
.vh-btn { padding: 4px 10px; font-size: 12px; }
.vh-trips { max-height: calc(100vh - var(--header-h, 110px) - 220px); min-height: 200px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; }
.vh-list { list-style: none; margin: 0; padding: 0; }
.vh-trip {
  display: grid; grid-template-columns: 96px auto minmax(0, 1fr) auto 22px; align-items: center; gap: 8px;
  padding: 7px 10px; border-bottom: 1px solid var(--border); cursor: pointer; font-size: 13px;
}
.vh-trip:hover { background: var(--surface-2); }
.vh-trip.sel { background: color-mix(in srgb, var(--accent) 14%, transparent); box-shadow: inset 3px 0 0 var(--accent); }
.vh-trip:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.vh-time { font-variant-numeric: tabular-nums; font-weight: 600; }
.vh-hs { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vh-dl { font-size: 12px; color: var(--text-secondary); white-space: nowrap; }
.vh-dl.muted { color: var(--text-muted); }
.vh-arch { color: var(--text-muted); text-decoration: none; text-align: center; font-size: 14px; }
.vh-arch:hover, .vh-arch:focus-visible { color: var(--accent); }
.vh-gap { padding: 4px 10px 4px 114px; font-size: 11px; color: var(--text-muted); border-bottom: 1px dashed var(--border); background: var(--surface-0); }
@media (max-width: 640px) {
  .vh-trip { grid-template-columns: 84px auto minmax(0, 1fr) 22px; }
  .vh-trip .vh-dl { grid-column: 3 / 4; }
  .vh-gap { padding-left: 10px; }
}
/* a vehicle with a story (VH_SPECIAL): tag in the results, note under the title */
.vh-tag { font-size: 11px; font-weight: 600; color: var(--text-primary); background: color-mix(in srgb, var(--warning) 28%, transparent); border-radius: 999px; padding: 1px 8px; }
.vh-note { flex-basis: 100%; margin: 4px 0 0; padding: 8px 12px; font-size: 13px; line-height: 1.45; color: var(--text-secondary); background: var(--surface-2); border-left: 3px solid var(--warning); border-radius: 0 8px 8px 0; }
/* vehicles tab: search + history in the left column, the map sticks on the right from the top of the tab */
.vh-left { display: grid; gap: 16px; min-width: 0; align-content: start; }
.vh-left > .card { margin: 0; }
#vh-view[hidden] { display: none; }
@media (max-width: 1000px) { .vh-layout > .ar-map-shell { order: 0; } }
/* ZTP notices in the follow panel and on the departure board */
.al-note { margin: 8px 14px 0; padding: 7px 10px; font-size: 12px; line-height: 1.4; color: var(--overlay-text); background: var(--panel-hover); border-left: 3px solid var(--warning); border-radius: 0 6px 6px 0; }
.board-head .al-note { margin: 8px 0 0; }
.al-since { color: var(--overlay-faint); font-weight: 400; }
.board-zone { font-size: 12px; font-weight: 600; color: var(--overlay-muted); border: 1px solid var(--overlay-border); border-radius: 999px; padding: 0 8px; }
.vh-brig { color: var(--text-muted); font-size: 12px; }
.vh-brigs { margin-left: 10px !important; }
/* archive: trips missing from the data */
/* detours (detour_log.json): trips that left their GTFS route; the time of such a trip is underlined in DET_COLOR (app.js) */
.ar-trip.det { text-decoration: underline dashed #ff3fd2; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.ar-det { font-size: 13px; }
.ar-det ul { margin: 4px 0 0; padding-left: 18px; font-variant-numeric: tabular-nums; }
.ar-lg-det { margin-top: 6px; font-size: 12px; max-width: 260px; }
.ar-lg-det i { display: inline-block; width: 18px; height: 0; border-top: 3px dashed; vertical-align: middle; margin-right: 6px; }
.ar-missing { font-size: 13px; }
.ar-missing summary { cursor: pointer; color: var(--text-secondary); }
.ar-missing summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ar-missing .sub { margin: 4px 0; font-size: 12px; }
.ar-missing ul { margin: 4px 0 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; font-variant-numeric: tabular-nums; }
.ar-missing .muted { color: var(--text-muted); }
/* where delay builds up: ranking across the congestion grid, gain column in the archive matrix */
.span2 { grid-column: 1 / -1; }
.ar-grid .ar-gain { position: sticky; left: 240px; z-index: 1; min-width: 42px; font-weight: 600; color: var(--text-primary);
  background: color-mix(in srgb, var(--g, transparent) 30%, var(--surface-1)); box-shadow: 2px 0 0 var(--surface-1); }
.ar-grid .ar-gain.nodata { color: var(--text-muted); background: var(--surface-1); }
.ar-grid thead .ar-gain { z-index: 3; color: var(--text-secondary); font-size: 11px; background: var(--surface-1); }
@media (max-width: 640px) { .ar-grid .ar-gain { left: 170px; } }
/* delay anomalies (Eventhouse) */
.an-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.an-list li { display: grid; grid-template-columns: auto minmax(0, 1fr) 180px; align-items: center; gap: 12px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; }
.an-txt { display: grid; gap: 2px; font-size: 14px; }
.an-txt .sub { margin: 0; font-size: 12px; }
.an-spark { width: 180px; height: 44px; }
.an-line { fill: none; stroke: var(--critical); stroke-width: 2; stroke-linejoin: round; }
.an-base { fill: none; stroke: var(--text-muted); stroke-width: 1.5; stroke-dasharray: 4 3; }
@media (max-width: 640px) { .an-list li { grid-template-columns: auto minmax(0, 1fr); } .an-spark { grid-column: 1 / -1; width: 100%; } }
.al-stale { margin-top: 4px; font-size: 11px; color: var(--overlay-faint); font-style: italic; }
/* ---------- journey planner ---------- */
.jp-form { display: grid; gap: 8px; margin-top: 10px; }
.jp-row { display: flex; align-items: center; gap: 8px; }
.jp-row .iso-search { flex: 1; min-width: 0; }
.jp-pin { flex: none; width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 12px; font-weight: 700; }
.jp-pin.a { background: #1f9e4a; } .jp-pin.b { background: #d03b3b; }
.jp-icon { flex: none; padding: 7px 10px; font-size: 15px; line-height: 1; }
.jp-opts { flex-wrap: wrap; gap: 12px; }
.jp-opts input[type="time"] { font: inherit; color: var(--text-primary); background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 5px 8px; }
.jp-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.jp-card { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; cursor: pointer; }
.jp-card:hover { border-color: var(--accent); }
.jp-card.sel { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.jp-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.jp-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.jp-times { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.jp-dur { font-weight: 600; color: var(--text-secondary); }
.jp-lines { display: inline-flex; gap: 4px; }
.jp-head .sub { margin: 0; font-size: 12px; }
.jp-legs { list-style: none; margin: 10px 0 0; padding: 0 0 0 14px; border-left: 2px solid var(--border); display: grid; gap: 8px; font-size: 13px; }
.jp-walk { color: var(--text-secondary); }
.jp-ride { display: grid; gap: 3px; }
.jp-ride-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-weight: 600; }
.jp-stop { font-variant-numeric: tabular-nums; }
.jp-rt { font-size: 12px; font-weight: 600; }
.jp-risk { font-size: 12px; font-weight: 600; color: var(--dl-mid); }
.jp-legs .al-note { margin: 4px 0 0; color: var(--text-primary); background: var(--surface-2); }
.jp-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 10px; }
.jp-foot .sub { margin: 0; font-size: 12px; }
.jp-pop { display: flex; gap: 6px; }
.jp-pop .btn { padding: 5px 10px; font-size: 12px; }
#tab-polaczenia .map { height: calc(100vh - var(--header-h, 110px) - 40px); min-height: 380px; }
@media (max-width: 1000px) { #tab-polaczenia .map { height: 340px; min-height: 0; } }
