: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; --st-at: #1f69c4;
}
@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; --st-at: #6da7ec;
  }
}
: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; --st-at: #6da7ec;
}

* { 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); white-space: nowrap; }
.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: 2px; 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 9px; 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: 46px;   /* above the map credits button (i), bottom-right */ 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; }
.pop-note { margin: 6px 0 0; font-size: 12px; color: var(--overlay-muted); max-width: 250px; }

.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; }
/* severity: colour and shape (critical square with "!", serious disc, warning ring) */
.sev-mark { position: relative; flex: none; width: 13px; height: 13px; border-radius: 50%; box-sizing: border-box; display: inline-block; }
.events .sev-mark { margin-top: 4px; }
.sev-mark.sev-critical { background: #c1121f; border-radius: 3px; }
.sev-mark.sev-critical::after { content: '!'; position: absolute; inset: 0; color: #fff; font: 800 10px/13px system-ui, sans-serif; text-align: center; }
.sev-mark.sev-serious { background: #ff7a00; }
.sev-mark.sev-warning { background: transparent; border: 3px solid #e8b400; }
.sev-mark.sev-good { background: #1f9a35; }
.sev-mark.sev-none { background: #8a897f; }
.ev-filter { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.ev-filter[hidden] { display: none; }
.ev-filter button { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 12px; font-weight: 600; color: var(--text-secondary);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; cursor: pointer; }
.ev-filter button .n { color: var(--text-muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.ev-filter button[aria-pressed="true"] { color: var(--text-primary); border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.ev-filter button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.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: var(--overlay-field); }
.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; }
.lg-toggle { display: block; padding: 0; border: 0; background: none; color: inherit; font: inherit; font-weight: 650; cursor: pointer; }
.lg-toggle[aria-expanded="true"] { margin-bottom: 6px; }
.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: 52%; }
  /* the drawer buttons sit where the panel's buttons are: hidden while a vehicle is followed */
  .map-shell:has(.follow:not([hidden])) .map-toggles { display: none; }
}
.follow-min { display: none; appearance: none; border: 0; background: var(--overlay-field); color: var(--overlay-text); border-radius: 6px; font-size: 14px; line-height: 1; padding: 4px 9px; cursor: pointer; margin-left: auto; }
/* the collapse button exists on phones only: there it takes the right edge and × sits next to it; elsewhere × stays right */
@media (max-width: 640px) { .follow-min { display: inline-block; } .follow-size + .follow-close { margin-left: 4px; } .follow.collapsed .follow-foot { margin-top: 6px; } }
.follow-size { display: inline-flex; gap: 4px; margin-left: auto; }
.follow-size .follow-min { margin-left: 0; }
.follow-min:disabled { opacity: .35; cursor: default; }
/* "whole screen": over the page header too */
@media (max-width: 640px) { .follow.full { position: fixed; top: 8px; left: 8px; right: 8px; bottom: 8px; max-height: none; z-index: 40; } }
/* phones: the whole panel scrolls as one (two scroll areas inside a 52 % high panel did not take touch scrolling, 02.10) */
@media (max-width: 640px) {
  .follow { overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
  .follow .timeline { flex: none; overflow: visible; }
  .follow .ride { max-height: none; overflow: visible; flex: none; }
  .follow-min { font-size: 18px; padding: 4px 12px; }
}
.ride-mini { margin: 6px 14px 0; color: var(--overlay-text); }

.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: var(--dl-mid) !important; }   /* theme colours: the bright ones are unreadable on the light panel */
.st-very-late { color: var(--dl-major) !important; }
.st-early { color: var(--dl-minor) !important; }
.st-ok { color: var(--dl-ok) !important; }
.st-at { color: var(--st-at) !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); }
  .fav-wrap .fav-list { top: auto; bottom: calc(100% + 6px); max-height: 50vh; }   /* toggles sit at the bottom of the map: open upwards */
  .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]) {   /* minus the folded footer too (--foot-h, 03.10): no page scroll */
    height: calc(100vh - var(--header-h, 120px) - 0px - var(--foot-h, 0px));
    height: calc(100dvh - var(--header-h, 120px) - 0px - var(--foot-h, 0px));   /* measured 03.10: no room left for padding below the map */
    min-height: 380px;   /* was 560: low laptop windows scrolled (03.10) */
  }
  #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; }
.tl-ar { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 13px; font-weight: 600; text-decoration: none; color: var(--accent, inherit); }
.tl-ar:hover, .tl-ar:focus-visible { text-decoration: underline; }
.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; } }

/* stop board: history and "Czy zdążę?" (os.czyjedzie.live, data-api="1") */
.board-modes { display: inline-flex; margin-top: 8px; border: 1px solid var(--overlay-border); border-radius: 999px; overflow: hidden; }
.board-modes button { font: inherit; font-size: 12px; font-weight: 600; color: var(--overlay-muted); background: transparent; border: 0; padding: 4px 12px; cursor: pointer; }
.board-modes button[aria-pressed="true"] { color: #fff; background: #3987e5; }
.board-line-btn { all: unset; cursor: pointer; border-radius: 6px; }
.board-line-btn:hover { outline: 2px solid #3987e5; }
.board-line-btn:focus-visible { outline: 2px solid #3987e5; }
.hist-body, .rel-body { display: flex; flex-direction: column; min-height: 0; flex: 1; overflow-y: auto; }
.hist-ctl { display: flex; flex-wrap: wrap; align-items: end; gap: 8px 12px; padding: 10px 14px; border-bottom: 1px solid var(--panel-line); font-size: 12px; color: var(--overlay-muted); }
.hist-ctl label { display: flex; flex-direction: column; gap: 3px; }
.hist-ctl input, .rel-title input { font: inherit; font-size: 13px; color: inherit; background: var(--panel-hover); border: 1px solid var(--overlay-border); border-radius: 6px; padding: 3px 6px; }
.hist-nav { display: flex; gap: 6px; }
.btn.sm { padding: 4px 9px; font-size: 12px; border-radius: 6px; }
.hist-body .board-list { overflow: visible; }
.rel-body { padding: 10px 14px 12px; gap: 10px; }
.rel-ctl { display: flex; }
.rel-title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 14px; }
.rel-title .muted { color: var(--overlay-faint); font-size: 12px; }
.rel-body .board-chips { margin-top: 0; }
.rel-p { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 13px; }
.rel-p b { display: inline-block; min-width: 38px; font-size: 15px; font-variant-numeric: tabular-nums; }
.rel-hist { display: grid; grid-template-columns: repeat(13, 1fr); gap: 3px; height: 90px; align-items: end; }
.rel-bar { display: flex; flex-direction: column; justify-content: flex-end; height: 100%; text-align: center; }
.rel-bar span { display: block; background: #4fa36d; border-radius: 2px 2px 0 0; min-height: 1px; }
.rel-bar.early span { background: #9b7ad8; }
.rel-bar.late3 span { background: #e0a23a; }
.rel-bar.late5 span { background: #d9534f; }
.rel-bar i { font-style: normal; font-size: 10px; color: var(--overlay-faint); margin-top: 3px; font-variant-numeric: tabular-nums; }
.rel-sum { margin: 0; font-size: 12px; color: var(--overlay-muted); line-height: 1.45; }
.rel-list summary { cursor: pointer; font-size: 12px; font-weight: 600; color: var(--overlay-muted); }
.rel-list ol { list-style: none; margin: 6px 0 0; padding: 0; font-size: 12px; font-variant-numeric: tabular-nums; }
.rel-list li { display: grid; grid-template-columns: 74px 44px minmax(0, 1fr) auto; gap: 6px; padding: 3px 0; border-bottom: 1px solid var(--panel-line); }
.rel-list .hs { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--overlay-muted); }
.rel-few { color: #e0a23a; font-weight: 600; }
.rel-body > *, .hist-body > * { flex-shrink: 0; }
.rel-hist-t { font-size: 12px; font-weight: 600; color: var(--overlay-muted); margin-bottom: -4px; }

/* line timetable (os.czyjedzie.live) */
.tt-pick { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.tt-find { max-width: 260px; font: inherit; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-primary); }
.tt-group { display: flex; gap: 10px; align-items: flex-start; }
.tt-gname { flex: none; width: 130px; font-size: 12px; font-weight: 600; color: var(--text-muted); padding-top: 4px; }
.tt-lines { display: flex; flex-wrap: wrap; gap: 4px; }
.tt-line { all: unset; cursor: pointer; border-radius: 6px; outline-offset: 1px; }
.tt-line:hover, .tt-line:focus-visible { outline: 2px solid #3987e5; }
.tt-line[aria-pressed="true"] { outline: 2px solid var(--text-primary); }
.tt-head { display: flex; align-items: center; gap: 10px; margin: 6px 0 2px; }
.tt-head h3 { margin: 0; font-size: 17px; }
.tt-dirs { margin: 6px 0 12px; }
.tt-main { display: grid; grid-template-columns: minmax(200px, 300px) minmax(0, 1fr); gap: 16px; align-items: start; }
.tt-side .tt-gname { width: auto; margin-bottom: 4px; }
.tt-stops { list-style: none; margin: 0; padding: 0; max-height: 70vh; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; }
.tt-stops li { display: flex; justify-content: space-between; gap: 8px; padding: 5px 10px; font-size: 13px; cursor: pointer; border-bottom: 1px solid var(--border); }
.tt-stops li:hover { background: var(--surface-2); }
.tt-stops li.sel { background: rgba(57, 135, 229, .18); font-weight: 650; }
.tt-stops small { color: var(--text-muted); font-weight: 400; }
.tt-stops .dt { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.tt-grid { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
.tt-grid th, .tt-grid td { border-bottom: 1px solid var(--border); padding: 4px 8px; text-align: left; vertical-align: top; }
.tt-grid thead th { font-size: 13px; white-space: nowrap; }
.tt-grid thead small { display: block; font-weight: 400; color: var(--text-muted); font-size: 11px; }
.tt-grid tbody th { width: 34px; text-align: right; font-size: 15px; color: var(--text-secondary); }
.tt-m { display: inline-block; min-width: 22px; margin: 1px 3px 1px 0; padding: 0 3px; border-radius: 4px; font-size: 14px; font-style: normal; }
.tt-m sup { font-size: 9px; margin-left: 1px; }
.tt-m.u0 { background: rgba(79, 163, 109, .22); }
.tt-m.u1 { background: rgba(224, 162, 58, .28); }
.tt-m.u2 { background: rgba(217, 109, 79, .32); }
.tt-m.u3 { background: rgba(217, 83, 79, .5); }
.tt-notes, .tt-legend { margin-top: 8px; font-size: 12px; color: var(--text-secondary); display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; }
@media (max-width: 760px) { .tt-main { grid-template-columns: 1fr; } .tt-stops { max-height: 240px; } }
.tabs button[hidden] { display: none; }
.tt-pick > summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--text-secondary); margin-bottom: 4px; }
.tt-pick:not([open]) { margin-bottom: 4px; }
/* timetable line list: more air between badges and groups */
.tt-pick { gap: 0; }
.tt-pick > summary { margin-bottom: 10px; }
.tt-find { margin-bottom: 14px; }
.tt-group { gap: 16px; padding: 12px 0; border-top: 1px solid var(--border); }
.tt-gname { width: 150px; padding-top: 5px; font-size: 13px; line-height: 1.35; }
.tt-lines { gap: 8px 8px; }
.tt-line .lbadge { min-width: 46px; height: 28px; padding: 0 8px; font-size: 14px; border-radius: 7px; }
@media (max-width: 640px) { .tt-group { flex-direction: column; gap: 8px; } .tt-gname { width: auto; padding-top: 0; } .tt-line .lbadge { min-width: 40px; } }

/* what's new */
.news-btn { position: relative; }
.news-dot { position: absolute; top: 4px; right: 4px; width: 8px; height: 8px; border-radius: 50%; background: #d95926; }
.news-dot[hidden] { display: none; }
/* phones: "What's new" as a small pill next to the beta badge, "How it works" only in the footer */
.news-mini { display: none; position: relative; vertical-align: middle; margin-left: 2px; padding: 1px 9px; border: 1px solid var(--border);
  border-radius: 999px; background: var(--surface-2); color: var(--text-primary); font: inherit; font-size: 12px; font-weight: 600;
  line-height: 1.5; cursor: pointer; top: -2px; white-space: nowrap; }
.news-mini .news-dot { top: -3px; right: -3px; }
.news-mini:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.foot-about { display: none; }
@media (max-width: 640px) {
  .news-mini { display: inline-block; }
  .foot-about { display: inline; }
  .controls .news-btn, .controls a.btn[href^="about.html"] { display: none; }
}
.news-dlg { width: min(640px, calc(100vw - 32px)); max-height: min(80vh, 760px); padding: 0; border: 1px solid var(--border); border-radius: 12px; background: var(--panel-bg); color: var(--text-primary); box-shadow: 0 12px 40px rgba(0,0,0,.45); }
.news-dlg::backdrop { background: rgba(0, 0, 0, .45); }
.news-head { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; background: var(--panel-bg); border-bottom: 1px solid var(--border); }
.news-head h2 { margin: 0; font-size: 18px; }
#news-body { padding: 4px 18px 16px; overflow-y: auto; }
.news-day h3 { font-size: 14px; margin: 16px 0 6px; color: var(--text-secondary); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.news-fresh { font-size: 11px; font-weight: 700; color: #fff; background: #d95926; border-radius: 999px; padding: 1px 8px; }
.news-day ul { margin: 0; padding-left: 18px; }
.news-day li { margin: 6px 0; font-size: 14px; line-height: 1.5; }
.ewt-tbl { max-height: 420px; }  #ewt-card h3 { margin: 18px 0 8px; }

/* live map: the numbers in one low strip above the map */
.kpi-strip { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; padding: 8px 14px; background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); font-variant-numeric: tabular-nums; }
.kpi-strip .ks { display: inline-flex; align-items: baseline; gap: 5px; white-space: nowrap; cursor: help; }
.kpi-strip .ks b { font-size: 17px; font-weight: 700; }
.kpi-strip .ks-l { font-size: 13px; color: var(--text-secondary); }
.kpi-strip .ks-d { font-size: 12px; font-weight: 650; color: var(--text-muted); }
.kpi-strip .ks-d.s-good { color: #2f9e5b; }
.kpi-strip .ks-d.s-serious { color: #d9534f; }
.kpi-strip .ks-note { margin-left: auto; }
@media (max-width: 640px) { .kpi-strip { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; gap: 14px; } .kpi-strip .ks-note { margin-left: 0; } }
/* vehicle floor (os.): low-floor green, partly / low-entry amber, high-floor muted red */
.floor { font-size: 11px; font-weight: 700; border-radius: 999px; padding: 1px 8px; }
.floor-low { color: #fff; background: #2f9e5b; }
.floor-partial, .floor-entry { color: #1d1d1b; background: #e0a23a; }
.floor-high { color: #fff; background: #b4483f; }
.vh-model { font-size: 11px; color: var(--text-muted); }
.vh-modelrow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 4px; font-size: 14px; }
/* vehicles tab: the author's photos of the vehicle (tools/photos.py), side by side, scrolled sideways on a phone */
.vh-photos { display: flex; gap: 10px; margin-top: 10px; overflow-x: auto; }
.vh-photos figure { margin: 0; flex: none; }
.vh-photos img { display: block; width: auto; height: 180px; border-radius: 8px; background: var(--border, #ddd); }
.vh-photos figcaption { margin-top: 3px; font-size: 11px; color: var(--text-muted); }
@media (max-width: 640px) { .vh-photos img { height: 140px; } }
/* board: floor of the vehicle running the departure (os.) */
.bfloor { font-size: 15px; font-weight: 700; line-height: 1; cursor: help; background: none !important; padding: 0; }
.bfloor.floor-low, .bfloor.floor-entry { color: #3d8bfd; }
.bfloor.floor-partial { color: #e0a23a; }
.bfloor.floor-high { color: var(--overlay-faint); font-size: 11px; font-weight: 600; }
/* is the timetable realistic (os.) */
.sr-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.sr-tbl { max-height: 330px; }
.sr-two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
#sr-detail h3.sr-secs-h { margin-top: 0; }
.sr-pick select { font: inherit; padding: 4px 8px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-primary); max-width: 100%; }
.sr-pick { margin: 6px 0 10px; font-size: 13px; color: var(--text-secondary); }
#sr-detail h3 { display: flex; align-items: center; gap: 6px; margin: 12px 0 6px; font-size: 15px; }
.sr-secs { margin: 0; padding-left: 20px; font-size: 13px; }
.sr-secs li { margin: 4px 0; }
.sr-sec { font-weight: 600; }
.sr-note { margin-top: 10px; font-size: 12px; color: var(--text-muted); }
@media (max-width: 1000px) { .sr-two { grid-template-columns: minmax(0, 1fr); } }
.sr-two table th { white-space: normal; line-height: 1.25; vertical-align: bottom; }
/* brigade view: layover at the terminus (os.) */
.vh-carry.late { color: var(--text-primary); background: color-mix(in srgb, #e5484d 12%, var(--surface-0)); }
/* shared line picker (timetable, archive): badge + median-delay bar under it */
.tt-line { display: inline-flex; flex-direction: column; align-items: center; gap: 3px; }
.lp-bar { display: block; width: 70%; height: 3px; border-radius: 2px; background: transparent; }
#ar-tiles .tt-group:first-of-type { border-top: 0; }
#ar-tiles .tt-find { margin-bottom: 6px; }
/* timetable map above the stop list */
.tt-right { min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.tt-map { height: 420px; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); }
@media (max-width: 760px) { .tt-map { height: 320px; } }
.tt-hov-pop .maplibregl-popup-content { padding: 4px 8px; font-weight: 600; }
/* timetable: one departure day by day (click on a minute) */
.tt-click { cursor: pointer; }
.tt-click:hover, .tt-click:focus-visible { outline: 2px solid #3987e5; outline-offset: 0; }
.tt-m.sel { outline: 2px solid var(--text-primary); outline-offset: 0; }
.tt-dep { margin-top: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-0); }
.tt-dep-h { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.tt-dep-h h3 { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 15px; flex: 1 1 320px; }
.tt-dep-h .board-chips { margin: 0; }
.tt-dep-x { all: unset; cursor: pointer; font-size: 20px; line-height: 1; padding: 0 4px; color: var(--text-muted); }
.tt-dep-x:hover, .tt-dep-x:focus-visible { color: var(--text-primary); }
.tt-dep-sum { margin: 10px 0 4px; font-size: 14px; }
.tt-dep-early { margin: 4px 0; font-size: 13px; color: var(--dl-early); }
.tt-dep-tbl { border-collapse: collapse; font-size: 13px; margin-top: 6px; }
.tt-dep-tbl td { padding: 3px 14px 3px 0; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tt-dep-veh { color: var(--text-secondary); white-space: normal !important; }
.tt-dep-pw { margin-top: 12px; }
.tt-dep-prof { width: 100%; max-width: 680px; height: auto; display: block; }
.tt-dep-prof .grid { stroke: var(--border); stroke-width: 1; }
.tt-dep-prof .ax { fill: var(--text-muted); font-size: 11px; }
.tt-dep-prof .ln { fill: none; stroke: #3987e5; stroke-width: 2; }
.tt-dep-prof .pt { fill: #3987e5; }
.tt-dep-prof .here { fill: var(--text-primary); stroke: #3987e5; stroke-width: 2; }
.tt-dep .tt-gname { width: auto; padding-top: 0; }
.tt-dep-tbl { width: auto; }
.tt-dep-prof .hit { fill: transparent; cursor: crosshair; }
.tt-dep-prof .hov { fill: none; stroke: #ffcc33; stroke-width: 2.5; pointer-events: none; }
/* timetable: typical delay by day of week x hour */
.tt-heat { border-collapse: separate; border-spacing: 2px; font-size: 11px; width: auto !important; }
.tt-heat th, .tt-heat td { border: 0 !important; background-clip: padding-box; }
.tt-heat th { font-weight: 500; color: var(--text-muted); padding: 0 2px; text-align: center; }
.tt-heat tbody th { text-align: right; padding-right: 6px; }
.tt-heat td { width: 22px; height: 18px; border-radius: 3px; cursor: default; }
.tt-heat td.u0 { background: rgba(79, 163, 109, .55); } .tt-heat td.u1 { background: rgba(224, 162, 58, .65); }
.tt-heat td.u2 { background: rgba(217, 109, 79, .75); } .tt-heat td.u3 { background: rgba(217, 83, 79, .95); }
.tt-heat td.nd { background: var(--surface-2); opacity: .4; }
.tt-heat-h { width: auto; margin: 4px 0 6px; }
.tt-heatwrap .note { font-size: 12px; color: var(--text-muted); margin: 6px 0 0; }
/* favourite stops */
.fav-wrap { position: relative; }
.fav-list { position: absolute; right: 0; top: calc(100% + 6px); z-index: 6; list-style: none; margin: 0; padding: 6px; min-width: 200px; max-height: 60vh; overflow-y: auto;
  background: var(--overlay-bg); color: var(--overlay-text); border-radius: 10px; box-shadow: var(--overlay-shadow); }
.fav-list button { all: unset; display: block; width: 100%; box-sizing: border-box; padding: 6px 10px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.fav-list button:hover, .fav-list button:focus-visible { background: var(--overlay-field); }
.fav-star { appearance: none; border: 0; background: none; color: var(--overlay-muted); font-size: 18px; line-height: 1; cursor: pointer; padding: 0 2px; }
.fav-star.on { color: #f5b301; }
.fav-star:hover, .fav-star:focus-visible { color: #f5b301; outline: none; }
.board-title .fav-star { margin-left: auto; }
.board-title .fav-star + .follow-close { margin-left: 6px; }
.jp-low { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.jp-ride-head .bfloor { margin-left: 2px; }

/* "my journey" (prototype, os.): a section of the follow panel */
.ride { flex: none; max-height: 42%; overflow-y: auto; margin: 8px 14px 0; padding: 8px 10px; border: 1px solid var(--accent); border-radius: 10px; background: color-mix(in srgb, var(--accent) 7%, var(--panel-bg)); font-size: 13px; }
.ride-head { display: flex; align-items: center; gap: 8px; }
.ride-proto { font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); border: 1px solid var(--accent); border-radius: 999px; padding: 0 6px; cursor: help; }
.ride-end { margin-left: auto; appearance: none; border: 0; background: none; color: var(--overlay-muted); font: inherit; font-size: 12px; cursor: pointer; text-decoration: underline; }
.ride-hint { color: var(--overlay-muted); margin-top: 4px; }
.ride-eta { margin-top: 6px; font-weight: 600; }
.ride-alert { margin-top: 6px; padding: 5px 8px; border-radius: 6px; background: #c1121f; color: #fff; font-weight: 700; }
@media (prefers-reduced-motion: no-preference) { .ride-alert { animation: ride-blink 1.2s ease-in-out 3; } }
@keyframes ride-blink { 50% { opacity: .55; } }
.ride-sub { margin-top: 8px; font-weight: 600; color: var(--overlay-text); }
.ride-trs, .ride-js { list-style: none; margin: 4px 0 0; padding: 0; }
.ride-tr { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; padding: 3px 0; border-top: 1px solid var(--panel-line); }
.ride-tr .h { color: var(--overlay-muted); flex: 1 1 120px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ride-tr .buf { width: 100%; font-size: 11px; color: var(--dl-ok); }
.ride-tr.tight .buf { color: var(--dl-minor); }
.ride-target-btn { margin-top: 8px; appearance: none; font: inherit; font-size: 12px; font-weight: 600; color: var(--accent); background: none; border: 1px dashed var(--accent); border-radius: 8px; padding: 4px 10px; cursor: pointer; }
.ride-j { padding: 5px 0; border-top: 1px solid var(--panel-line); }
.ride-j-parts { display: flex; flex-wrap: wrap; gap: 4px 10px; color: var(--overlay-muted); margin-top: 2px; }
.ride-j-leg { display: inline-flex; align-items: center; gap: 4px; color: var(--overlay-text); }
.ride-start { font-weight: 700; color: var(--accent) !important; }
.ride-pick { margin-top: 3px; appearance: none; font: inherit; font-size: 11px; font-weight: 600; color: var(--accent); background: none; border: 1px solid var(--accent); border-radius: 999px; padding: 0 8px; cursor: pointer; }
.ride-pick.on { color: #fff; background: var(--accent); }
.ride-pick.sug { border-style: dashed; background: color-mix(in srgb, var(--accent) 15%, transparent); }
.tl.ride-dest { box-shadow: inset 3px 0 0 var(--accent); }
.ride-dlg-body { padding: 0 16px 16px; display: flex; flex-direction: column; gap: 8px; position: relative; }
.ride-dlg-body input { font: inherit; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-1); color: var(--text-primary); }
.ride-dlg-body .iso-results { position: static; }
.ride-dlg-body .btn { align-self: flex-start; }
/* ride simulator (os.) */
.sim-panel { position: absolute; right: 52px; top: 56px; z-index: 6; width: 320px; max-width: calc(100% - 70px); background: var(--panel-bg); color: var(--overlay-text);
  border-radius: 12px; box-shadow: var(--overlay-shadow); padding: 10px 12px; font-size: 13px; }
.sim-panel[hidden] { display: none; }
.sim-head { display: flex; align-items: center; gap: 8px; }
.sim-btns { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.sim-note { color: var(--overlay-muted); font-size: 12px; margin: 8px 0 0; }
@media (max-width: 640px) { .sim-panel { right: 8px; top: auto; bottom: 80px; max-width: calc(100% - 16px); } }
.ride-steps { list-style: none; margin: 8px 0 0; padding: 0 0 0 14px; border-left: 3px solid var(--accent); }
.ride-steps .rs { position: relative; padding: 3px 0 5px 4px; }
.ride-steps .rs::before { content: ''; position: absolute; left: -21px; top: 7px; width: 9px; height: 9px; border-radius: 50%; background: var(--panel-bg); border: 2px solid var(--accent); }
.ride-steps .rs.rs-walk { color: var(--overlay-muted); }
.ride-steps .rs.rs-walk::before { border-style: dotted; }
.ride-steps .rs.rs-arrive::before { background: var(--accent); }
.rs-line { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.rs-buf.ok { color: var(--dl-ok); } .rs-buf.tight { color: var(--dl-minor); font-weight: 600; }
.rs-next { font-size: 11px; color: var(--overlay-muted); }
/* "which vehicle am I on?" (prototype, os.) */
.det-banner { position: absolute; left: 50%; transform: translateX(-50%); top: 56px; z-index: 7; width: min(440px, calc(100% - 20px)); background: var(--panel-bg); color: var(--overlay-text);
  border: 2px solid var(--accent); border-radius: 12px; box-shadow: var(--overlay-shadow); padding: 10px 12px; font-size: 13px; }
.det-banner[hidden] { display: none; }
.det-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.det-row { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-top: 1px solid var(--panel-line); }
.det-row .h { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.det-row .d { color: var(--overlay-muted); font-variant-numeric: tabular-nums; }
.det-row .btn { padding: 3px 10px; font-size: 12px; }
.det-row .det-yes { color: #fff; background: var(--accent); border-color: var(--accent); }
@media (max-width: 640px) { .det-banner { top: 8px; } }
/* the footer folds to one line - on phones since 02.10, everywhere since 03.10 (the data sources made it long) */
.foot-toggle { display: inline-flex; align-items: center; gap: 4px; appearance: none; border: 0; background: none; padding: 2px 0; font: inherit; font-size: 12px; line-height: 1.3; color: var(--text-muted); cursor: pointer; }
.foot-toggle::after { content: '▸'; }
.foot.open .foot-toggle::after { content: '▾'; }
.foot:not(.open) > p { display: none; }
.foot { padding-top: 2px; padding-bottom: 4px; }   /* folded: one thin line under the map (03.10: the dark band was too tall) */
.foot.open { padding-bottom: 16px; }
/* "Analyses ▾": the analysis tabs in a menu (02.10) */
.tabs-more { display: flex; flex: none; }
.tabs-more-btn { appearance: none; border: 0; background: none; color: var(--text-secondary); font: inherit; font-weight: 600;
  padding: 10px 9px; border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; }
.tabs-more-btn[aria-selected="true"] { color: var(--text-primary); border-bottom-color: var(--accent); }
.tabs-more-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.tabs-more-btn .more-cur { font-weight: 500; }
.tabs-menu { position: fixed; z-index: 60; min-width: 240px; display: flex; flex-direction: column; padding: 6px; background: var(--surface-1);
  border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.tabs-menu[hidden] { display: none; }
/* the menu only on phones; on computers all tabs stay in the bar (user, 03.10) */
@media (min-width: 641px) {
  .tabs-more { display: contents; }
  .tabs-more-btn { display: none; }
  .tabs-menu, .tabs-menu[hidden] { display: contents; }
}
@media (max-width: 640px) {
  .tabs .tabs-menu button[data-tab] { text-align: left; border-bottom: 0; border-radius: 6px; padding: 8px 10px; }
  .tabs .tabs-menu button[data-tab]:hover { background: var(--surface-2); }
  .tabs .tabs-menu button[aria-selected="true"] { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--text-primary); }
}
/* phones: the nearest stops on opening (only with the location permission given before) */
.near-card { position: absolute; left: 8px; right: 8px; bottom: 84px; z-index: 6; background: var(--panel-bg); color: var(--overlay-text);
  border-radius: 12px; box-shadow: var(--overlay-shadow); padding: 8px 10px; font-size: 14px; }
.near-card[hidden] { display: none; }
.near-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.near-stop { display: flex; align-items: center; gap: 8px; width: 100%; appearance: none; border: 0; border-top: 1px solid var(--panel-line);
  background: none; color: inherit; font: inherit; text-align: left; padding: 8px 2px; cursor: pointer; }
.near-stop .n { flex: 1; font-weight: 600; }
.near-stop .d { color: var(--overlay-muted); font-variant-numeric: tabular-nums; }
/* the map's search field (stop or line), top left; the layers panel moves under it (02.10) */
.map-search { position: absolute; top: 10px; left: 10px; z-index: 8; width: 260px; }   /* above the layers panel (its z-index is raised elsewhere) */
.map-search input { width: 100%; box-sizing: border-box; font: inherit; font-size: 14px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--overlay-border);
  background: var(--overlay-bg); color: var(--overlay-text); box-shadow: var(--overlay-shadow); }
.map-search input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.map-q-results { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 5; background: var(--overlay-bg); color: var(--overlay-text);
  box-shadow: var(--overlay-shadow); border-radius: 10px; list-style: none; margin: 0; padding: 4px; max-height: 320px; overflow-y: auto; }
.map-q-results .mq-l { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
#tab-mapa .layers { top: 56px; max-height: calc(100% - 66px); }
@media (max-width: 640px) {
  .map-search { left: 8px; right: 52px; width: auto; top: 8px; }
  #tab-mapa .layers { top: 52px; }
}

/* stop board on phones: three heights (02.10) */
.board-size { display: none; }
@media (max-width: 640px) {
  .board-size { display: inline-flex; margin-left: 4px; }
  .board-title .fav-star { margin-left: auto; }
  .board.collapsed { max-height: none; }
  .board.collapsed .board-head > :not(.board-title), .board.collapsed .board-head ~ * { display: none; }
  .board.collapsed .board-head { border-bottom: 0; }
  .board.full { position: fixed; top: 8px; left: 8px; right: 8px; bottom: 8px; max-height: none; z-index: 40; }
}
/* our map buttons (★ favourites, find my vehicle) in MapLibre's control column (02.10) */
.kmk-ctl:not(:has(> :not([hidden]))) { display: none; }
.kmk-ctl .kmk-ctl-btn { display: flex; align-items: center; justify-content: center; font-size: 16px; line-height: 1; color: #333; }
.kmk-ctl .fav-wrap { position: relative; }
.kmk-ctl .fav-wrap[hidden] { display: none; }
.kmk-ctl .fav-list { top: 0; bottom: auto; right: calc(100% + 8px); max-height: 60vh; }
.drawer-toggle .t-short { display: none; }
@media (max-width: 640px) {
  .kmk-ctl .fav-wrap .fav-list { top: 0; bottom: auto; right: calc(100% + 8px); }
  /* "what is happening" and "fleet" as one segmented bar with short names */
  .map-toggles { gap: 0; flex-wrap: nowrap; }
  .map-toggles > .drawer-toggle { border-radius: 0; box-shadow: none; }
  .map-toggles > .drawer-toggle:first-child { border-radius: 999px 0 0 999px; }
  .map-toggles > .drawer-toggle:last-child { border-radius: 0 999px 999px 0; border-left: 0; }
  .map-toggles { border-radius: 999px; box-shadow: var(--overlay-shadow); }
  .drawer-toggle .t-long { display: none; }
  .drawer-toggle .t-short { display: inline; }
}
.maplibregl-ctrl-top-right:has(.fav-list:not([hidden])) { z-index: 10; }   /* the open list over the legend */

/* phones: "which vehicle am I on?" banner under the search field, not over it (03.10) */
@media (max-width: 640px) { .det-banner { top: 56px; } }
.eyebrow { text-transform: none; letter-spacing: .02em; }
/* phones: the drawers ("what is happening", fleet) cover the map width - the search field must not sit over them (03.10) */
@media (max-width: 640px) { .map-shell:has(.drawer.open) .map-search { display: none; } }
/* phones: the grab bar of the follow panel and the stop board (03.10); replaces the ▴/▾ buttons there */
.sheet-handle { display: none; }
@media (max-width: 640px) {
  .sheet-handle { display: flex; justify-content: center; align-items: center; height: 20px; margin: -10px 0 2px; flex: none; cursor: grab; touch-action: none; }
  .sheet-handle span { width: 44px; height: 5px; border-radius: 3px; background: var(--overlay-muted); opacity: .55; }
  .sheet-handle:focus-visible span { outline: 2px solid var(--accent); outline-offset: 3px; }
  .follow-size, .board-size { display: none !important; }
  .board .sheet-handle { margin: 4px 0 0; }
  .follow, .board { transition: transform .15s ease-out; }
}
@media (prefers-reduced-motion: reduce) { .follow, .board { transition: none; } }
.ar-grid td.skip { color: #d42fb3; font-weight: 700; text-align: center; }   /* a stop skipped by a detour (dashed track colour) */
/* phones: × always at the right edge of the panel heads; a long headsign or stop name shrinks instead (03.10: with the
   ▴/▾ buttons hidden the × slid after the text and a long name pushed it out of the panel) */
@media (max-width: 640px) {
  .follow-head .hs, .board-title > span:nth-child(2) { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .follow-head .follow-close, .board-title .follow-close { flex: none; margin-left: auto !important; font-size: 24px; padding: 0 4px; }
  .board-title .fav-star { margin-left: 0; flex: none; }
}
/* phones, half height: the whole panel scrolls as one - in the stop board the header (lines, posts, tabs) could take
   almost all of the half and leave the list a few pixels that would not scroll (03.10); children keep their size */
@media (max-width: 640px) {
  .board { overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
  .board > *, .follow > * { flex: none; }
  .board .board-list { overflow: visible; }
}
/* phones: the bar sticks to the top of the panel and carries the × (03.10); the × in the title row is hidden */
@media (max-width: 640px) {
  .sheet-handle { position: sticky; top: 0; z-index: 2; background: var(--panel-bg); height: 34px; margin: -12px 0 0; padding-top: 4px; }
  .board .sheet-handle { margin: 0; }
  .sheet-close { position: absolute; right: 6px; top: 2px; appearance: none; border: 0; background: none; color: var(--overlay-muted);
    font-size: 26px; line-height: 1; padding: 2px 8px; cursor: pointer; }
  .sheet-close:focus-visible { outline: 2px solid var(--accent); }
  .follow-head .follow-close, .board-title .follow-close { display: none; }
}
@media (max-width: 640px) {
  .follow { padding-top: 0; }   /* nothing scrolls into a gap above the sticky bar */
  .follow .sheet-handle { margin: 0; }
}
/* phones: a folded panel sticks to the bottom of the screen, not of the map - the map ends below the fold and the folded
   stop board hid behind the browser's toolbar (03.10) */
@media (max-width: 640px) {
  .board.collapsed, .follow.collapsed { position: fixed; top: auto; left: 8px; right: 8px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); z-index: 40; max-height: none; }
}
/* phones: "add to home screen" suggestion (03.10) */
.inst-banner { position: fixed; left: 8px; right: 8px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); z-index: 45; display: grid;
  grid-template-columns: 40px 1fr; gap: 6px 10px; align-items: center; padding: 10px 12px; background: var(--panel-bg); color: var(--overlay-text);
  border: 1px solid var(--accent); border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.3); font-size: 13px; }
.inst-banner img { border-radius: 9px; }
.inst-txt { display: flex; flex-direction: column; gap: 2px; }
.inst-txt span, .inst-how { color: var(--overlay-muted); margin: 0; }
.inst-btns { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 8px; }
.inst-btns .btn { font-size: 13px; padding: 5px 12px; }
.inst-go { color: #fff !important; background: var(--accent) !important; border-color: var(--accent) !important; }
/* ★ and "find my vehicle" as two separate buttons, not one joined group (03.10) */
.maplibregl-ctrl-group.kmk-ctl { background: none; box-shadow: none; display: flex; flex-direction: column; gap: 10px; }
.kmk-ctl > .fav-wrap > .kmk-ctl-btn, .kmk-ctl > .kmk-ctl-btn { background: #fff; border-radius: 4px; box-shadow: 0 0 0 2px rgba(0,0,0,.1); border: 0 !important; }
/* "live fleet": full stop and headsign names, wrapped instead of cut to a few letters; numbers stay narrow (03.10) */
#tbl-fleet .trunc { max-width: none; white-space: normal; overflow: visible; display: inline; }
#tbl-fleet td, #tbl-fleet th { vertical-align: middle; }
#tbl-fleet td.num, #tbl-fleet th.num { width: 1%; white-space: nowrap; }
#tbl-fleet td:first-child, #tbl-fleet th:first-child { width: 1%; white-space: nowrap; }
@media (max-width: 640px) {
  #tbl-fleet table { font-size: 12px; }
  #tbl-fleet td, #tbl-fleet th { padding: 6px 4px; }
  #tbl-fleet .trunc { overflow-wrap: anywhere; }
}
@media (max-width: 640px) {
  #tbl-fleet .trunc { overflow-wrap: normal; }
  #tbl-fleet table { table-layout: fixed; }
  #tbl-fleet th:nth-child(1) { width: 40px !important; }
  #tbl-fleet th:nth-child(2) { width: 31% !important; }
  #tbl-fleet th:nth-child(4) { width: 78px !important; }   /* "Opóźn." + ⓘ */
  #tbl-fleet th { white-space: normal; }
}
/* ---- UX pass 03.10 ---- */
.fresh-row { display: flex; align-items: center; gap: 8px; }
.set-btn { display: none; }
.tabs-more-btn.has-cur [data-i18n="tab_more"] { }
.table-wrap.more-r { -webkit-mask-image: linear-gradient(to left, transparent 0, #000 32px); mask-image: linear-gradient(to left, transparent 0, #000 32px); }
@media (max-width: 640px) {
  /* header: freshness + ⚙ in one row, theme and language only after ⚙ */
  .top-inner { gap: 6px; padding-top: 10px; }
  .top-right { flex-direction: column; align-items: stretch; gap: 4px; width: 100%; }
  .fresh-row { justify-content: space-between; }
  .freshness { font-size: 12px; }
  .set-btn { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 30px; border: 1px solid var(--border); border-radius: 8px;
    background: var(--surface-2); color: var(--text-primary); font-size: 16px; cursor: pointer; }
  .top:not(.set-open) .controls { display: none; }
  /* settings on phones: captions over the selects so theme, start screen and language fit one row (wrap if not) */
  .controls { flex-wrap: wrap; row-gap: 8px; align-items: flex-end; }
  .controls .ctl { flex-direction: column; align-items: flex-start; gap: 2px; font-size: 12px; }
  /* tabs: only the open analysis' name */
  .tabs-more-btn.has-cur [data-i18n="tab_more"] { display: none; }
  .tabs-more-btn .more-cur { font-weight: 600; }
  /* timetable / archive line groups as folding rows */
  .tt-gtoggle { all: unset; box-sizing: border-box; width: 100%; display: flex; justify-content: space-between; align-items: center; padding: 10px 2px;
    font-weight: 650; cursor: pointer; }
  .tt-gtoggle::after { content: '▸'; color: var(--text-muted); }
  .tt-gtoggle[aria-expanded="true"]::after { content: '▾'; }
  .tt-gtoggle:focus-visible { outline: 2px solid var(--accent); }
}
/* grid columns may shrink below their content: wide tables scroll inside instead of overflowing the card (03.10) */
.grid2 > *, .sr-grid > *, .card { min-width: 0; }
@media (max-width: 640px) { .tabs button, .tabs-more-btn { padding: 10px 7px; } }
.board-list li.sel { box-shadow: inset 4px 0 0 var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
/* the follow panel and the stop board the same width (03.10): computers 380 px; phones - a folded panel (fixed to the
   screen) keeps the map's side margins (16 px page + 1 px border + 8 px) like the half-height one */
@media (min-width: 641px) { .follow { width: 380px; } }
@media (max-width: 640px) {
  .board.collapsed, .follow.collapsed { left: 25px; right: 25px; }
}
@media (max-width: 640px) { .follow { max-width: none; } }
/* stop signs D-15 / D-17 (stopIcon): one or two side by side */
.stop-signs { display: inline-flex; gap: 2px; flex: none; vertical-align: middle; }
.stop-signs svg { display: block; }
/* stop signs (os., 03.10): small in the layer tree, one per row in the legend */
.layers label .stop-signs { gap: 1px; margin: -2px 0; }
.layers label .stop-signs svg { width: 15px; height: 15px; }
.legend .steps .stop-signs { justify-self: center; }
.legend .steps .stop-signs svg { width: 16px; height: 16px; }
/* legend of vehicle delays: the map's bus icon in each colour (03.10) */
.legend .steps img.lg-veh { width: 18px; height: 18px; justify-self: center; }
/* post chips on the departure board: sign + number (03.10) */
.board-chips .pf-chip { display: inline-flex; align-items: center; gap: 4px; padding-left: 5px; }
.board-chips .pf-chip .stop-signs svg { width: 16px; height: 16px; }
/* follow panel: stops off a detour (03.10) - skipped struck through, possibly skipped in italics */
.tl.detour .tl-name .nm { color: var(--overlay-faint); font-weight: 500; }
.tl.detour.skipped .tl-name .nm { text-decoration: line-through; }
.tl.detour.maybe .tl-name .ss { font-style: italic; }
.tl.detour .tl-dot { background: var(--panel-bg, #fff); border-style: dashed; }
/* KM stops and stations in the layer list: station ring + D-15 sign (03.10) */
.layers label .km-stop-sw { display: inline-flex; align-items: center; gap: 3px; flex: none; }
.layers label .km-stop-sw .stop-signs svg { width: 15px; height: 15px; }
/* header as a grid (03.10): row 1 = the site's address | the live status (+ ⚙ on phones), row 2 = the title | the
   settings; one line less than the two stacked columns. Phones: the title on its own row, the settings under ⚙ below it */
.top-inner { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; column-gap: 16px; row-gap: 4px; }
.top-inner > div:first-child, .top-inner > .top-right { display: contents; }
.top-inner .eyebrow { grid-column: 1; grid-row: 1; }
.top-inner .fresh-row { grid-column: 2; grid-row: 1; justify-content: flex-end; gap: 8px; min-width: 0; }
.top-inner .freshness { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-inner h1 { grid-column: 1; grid-row: 2; }
.top-inner .controls { grid-column: 2; grid-row: 2; justify-self: end; }
@media (max-width: 900px) {   /* not enough width for the title and the settings side by side */
  .top-inner h1 { grid-column: 1 / -1; }
  .top-inner .controls { grid-column: 1 / -1; grid-row: 3; justify-self: start; }
}
@media (max-width: 640px) { .top-inner { column-gap: 10px; } }
/* journey planner: a journey with Koleje Małopolskie needs its own ticket (03.10) */
.jp-km-ticket { font-size: 11px; font-weight: 600; color: #c2185b; border: 1px solid currentColor; border-radius: 999px; padding: 0 7px; white-space: nowrap; }
/* "guide me" (04.10): the journey from the planner step by step - one card at the bottom of the screen on every tab */
.jp-guide { margin-top: 10px; }
.guide { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(14px + env(safe-area-inset-bottom, 0px)); z-index: 44;
  width: min(460px, calc(100% - 16px)); max-height: 60vh; overflow-y: auto; overscroll-behavior: contain; box-sizing: border-box;
  padding: 10px 12px; background: var(--panel-bg); color: var(--overlay-text); border: 1px solid var(--accent); border-radius: 12px;
  box-shadow: var(--overlay-shadow); font-size: 14px; }
.guide .g-head { display: flex; align-items: center; gap: 8px; }
.guide .g-arr { color: var(--overlay-muted); font-size: 13px; }
.guide .g-nav { margin-left: auto; display: flex; align-items: center; gap: 2px; color: var(--overlay-muted); font-size: 12px; }
.guide .g-ib { appearance: none; border: 0; background: none; color: var(--overlay-text); font-size: 20px; line-height: 1; padding: 0 6px; cursor: pointer; }
.guide .g-ib:disabled { opacity: .3; cursor: default; }
.guide .g-ib:focus-visible, .guide .g-more:focus-visible { outline: 2px solid var(--accent); }
.guide .follow-close { margin-left: 4px; font-size: 22px; }
.guide .g-cur { margin-top: 6px; }
.guide .g-main { font-weight: 700; font-size: 15px; line-height: 1.35; }
.guide .g-sub { margin-top: 3px; line-height: 1.4; }
.guide .g-line { white-space: nowrap; }
.guide .g-cd { color: var(--overlay-muted); }
.guide .g-veh { color: var(--overlay-muted); font-size: 13px; }
.guide .g-show { padding: 2px 8px; font-size: 12px; }
.guide .g-warn { margin-top: 6px; padding: 5px 8px; border-radius: 6px; background: color-mix(in srgb, var(--dl-minor) 18%, transparent); font-weight: 600; }
.guide .g-warn.bad { background: #c1121f; color: #fff; }
.guide .g-alt { margin-top: 6px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.guide .g-lines { display: inline-flex; gap: 3px; }
.guide .g-miss { margin-top: 8px; font-size: 13px; }
.guide .g-more { display: block; margin-top: 8px; appearance: none; border: 0; background: none; padding: 0; color: var(--accent); font: inherit; font-size: 13px; cursor: pointer; text-decoration: underline; }
.guide .g-list { list-style: none; margin: 6px 0 0; padding: 0; border-top: 1px solid var(--border); }
.guide .g-list li { padding: 6px 0 6px 10px; border-bottom: 1px solid var(--border); cursor: pointer; font-size: 13px; }
.guide .g-list li .g-main { font-size: 13px; }
.guide .g-list li.past { opacity: .5; }
.guide .g-list li.cur { box-shadow: inset 3px 0 0 var(--accent); }
/* keep the page's end readable under the card - not on the map tab, which fits the window (04.10: a blank band under the map) */
body.has-guide:not(:has(#tab-mapa:not([hidden]))) main { padding-bottom: 170px; }
.guide .g-pill { display: none; }
.guide .g-minb { font-size: 18px; }
/* the pill: minimised by hand, or on phones while a vehicle panel / stop board is open on the map (then it sits at the top
   and a panel opened to the whole screen moves below it, so its × stays reachable) */
.guide.mini { width: auto; max-width: calc(100% - 16px); padding: 0; border-radius: 999px; overflow: hidden; }
.guide.mini > :not(.g-pill) { display: none; }
.guide.mini .g-pill, .guide .g-pill:focus-visible { outline-offset: -2px; }
.guide.mini .g-pill { display: flex; }
.guide .g-pill { align-items: center; gap: 8px; width: 100%; appearance: none; border: 0; background: none; color: var(--overlay-text); font: inherit; font-size: 13px;
  padding: 8px 14px; cursor: pointer; white-space: nowrap; text-align: left; }
.guide .g-pill .g-short { overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1 1 auto; }
@media (max-width: 640px) {
  .guide { left: 8px; right: 8px; width: auto; transform: none; max-height: 50vh; }
  .guide.mini { right: auto; }
  body:has(#tab-mapa:not([hidden]) #follow:not([hidden])) .guide:not(.expand), body:has(#tab-mapa:not([hidden]) #board:not([hidden])) .guide:not(.expand) {
    top: calc(8px + env(safe-area-inset-top, 0px)); bottom: auto; right: auto; z-index: 46; padding: 0; border-radius: 999px; overflow: hidden; max-width: calc(100% - 16px); }
  body:has(#tab-mapa:not([hidden]) #follow:not([hidden])) .guide:not(.expand) > :not(.g-pill),
  body:has(#tab-mapa:not([hidden]) #board:not([hidden])) .guide:not(.expand) > :not(.g-pill) { display: none; }
  body:has(#tab-mapa:not([hidden]) #follow:not([hidden])) .guide:not(.expand) .g-pill,
  body:has(#tab-mapa:not([hidden]) #board:not([hidden])) .guide:not(.expand) .g-pill { display: flex; }
  /* expanded over an open panel: at the top, the whole card */
  body:has(#tab-mapa:not([hidden]) #follow:not([hidden])) .guide.expand, body:has(#tab-mapa:not([hidden]) #board:not([hidden])) .guide.expand {
    top: calc(8px + env(safe-area-inset-top, 0px)); bottom: auto; z-index: 46; }
  body:has(#guide:not([hidden]):not(.expand)) .follow.full, body:has(#guide:not([hidden]):not(.expand)) .board.full { top: calc(54px + env(safe-area-inset-top, 0px)); }
}
/* floating "my journey": the header and the pill are the grips (touch-action none: a drag moves the card, not the page) */
.guide .g-head, .guide .g-pill { touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
.guide .g-head button { cursor: pointer; }
.guide { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.guide.dragging { box-shadow: 0 10px 30px rgba(0, 0, 0, .35); opacity: .96; cursor: grabbing; }
@media (prefers-reduced-motion: no-preference) { .guide.dragging { transition: box-shadow .1s; } }
#jp-results { scroll-margin-top: calc(var(--header-h, 110px) + 8px); }   /* scrolled to after a search: below the sticky header */
.guide .g-alts { margin-top: 6px; }
.guide .g-alts .g-alt { margin-top: 4px; }
.guide .g-alts .g-alt .btn { margin-left: auto; padding: 3px 10px; font-size: 13px; }
/* phones / narrow windows: the map tab fills the window below the header - the map at least 70vh as before, but it grows
   into a tall window instead of leaving a blank band under it (05.10, a tall narrow desktop window) */
@media (max-width: 640px) {
  #tab-mapa:not([hidden]) { min-height: calc(100dvh - var(--header-h, 120px) - var(--foot-h, 0px) - 24px); }
  #tab-mapa .map-shell { flex: 1 1 auto; display: flex; flex-direction: column; }
  #tab-mapa .map { flex: 1 1 auto; height: auto; min-height: 70vh; }
}
/* phones: the line diagram (bunching window) has no grab bar, so it keeps its × in the title row; the search field would
   sit over its title (05.10) */
@media (max-width: 640px) {
  .linediag .board-title .follow-close { display: inline-block; }
  .map-shell:has(.linediag:not([hidden])) .map-search { display: none; }
}
