/* Labda Trasy 1.1
   Układ: mapa wektorowa na całym ekranie, pływający nagłówek, przesuwany arkusz z przystankami,
   dolna nawigacja (Trasa / Historia / Kilometrówka / Więcej), panele pełnoekranowe.
   Akcent z logo: pochylone numery przystanków i segmenty postępu – jak kursywa w „LABDA”. */
:root {
  --navy: #2C3A63;
  --navy-soft: #E9EDF6;
  --green: #3FAB3C;
  --go: #2E8F2C;
  --on-go: #FFFFFF;
  --green-soft: #E3F3E1;
  --green-text: #22802A;
  --bg: #F3F5F9;
  --surface: #FFFFFF;
  --surface-2: #EEF1F6;
  --line: #E1E5EE;
  --fg: #121A33;
  --muted: #5D6680;
  --faint: #959DB4;
  --bad: #CF3B3B;
  --bad-soft: #FCE8E8;
  --warn: #A86800;
  --warn-soft: #FFF1D6;
  --badge: #2C3A63;
  --wm-b: #2C3A63;
  --glass: rgba(255, 255, 255, .88);
  --seg: #DCE1EB;
  --shadow-1: 0 1px 2px rgba(18, 26, 51, .06), 0 6px 18px rgba(18, 26, 51, .10);
  --shadow-2: 0 -10px 34px rgba(18, 26, 51, .14);
  --font-ui: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Barlow Condensed", "Barlow", "Arial Narrow", system-ui, sans-serif;
  --sheet-h: 280px;
  --tab-h: 64px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --navy-soft: #1D2747; --green: #4CC048; --go: #46B442; --on-go: #061309; --green-soft: #15301E; --green-text: #72D36E;
    --bg: #0B1124; --surface: #131A31; --surface-2: #1B2341; --line: #262F51;
    --fg: #E9EDF7; --muted: #9AA3BF; --faint: #6C7595;
    --bad: #F07A7A; --bad-soft: #3A1D27; --warn: #F2B64D; --warn-soft: #362A12;
    --badge: #3A4B82; --wm-b: #FFFFFF; --glass: rgba(19, 26, 49, .86); --seg: #2A345A;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 22px rgba(0, 0, 0, .35);
    --shadow-2: 0 -10px 34px rgba(0, 0, 0, .45);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --navy-soft: #1D2747; --green: #4CC048; --go: #46B442; --on-go: #061309; --green-soft: #15301E; --green-text: #72D36E;
  --bg: #0B1124; --surface: #131A31; --surface-2: #1B2341; --line: #262F51;
  --fg: #E9EDF7; --muted: #9AA3BF; --faint: #6C7595;
  --bad: #F07A7A; --bad-soft: #3A1D27; --warn: #F2B64D; --warn-soft: #362A12;
  --badge: #3A4B82; --wm-b: #FFFFFF; --glass: rgba(19, 26, 49, .86); --seg: #2A345A;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 22px rgba(0, 0, 0, .35);
  --shadow-2: 0 -10px 34px rgba(0, 0, 0, .45);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--fg);
  font: 400 16px/1.42 var(--font-ui);
  overscroll-behavior: none; overflow: hidden; -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
svg:not([class*="maplibre"]) { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 3px solid var(--green); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
.a1, .a2 { display: block; }

#app { position: fixed; inset: 0; display: flex; flex-direction: column; }
#stage { position: relative; flex: 1; min-height: 0; }

/* ---------- Mapa ---------- */
#mapwrap { position: absolute; inset: 0; overflow: hidden; }
#map { position: absolute; inset: 0; background: var(--surface-2); }
.maplibregl-ctrl-attrib { font-family: var(--font-ui); }
.maplibregl-ctrl-top-left { top: calc(58px + env(safe-area-inset-top, 0px)); left: 6px; }
.maplibregl-ctrl-attrib.maplibregl-compact { background: var(--glass) !important; color: var(--muted); }
.maplibregl-ctrl-attrib a { color: var(--muted) !important; }
.map-fail {
  position: absolute; left: 16px; right: 16px; top: 76px; z-index: 5; max-width: 420px; margin: 0 auto;
  background: var(--surface); color: var(--fg); border-radius: 16px; padding: 14px 16px; box-shadow: var(--shadow-1); font-weight: 500;
}

.topbar {
  position: absolute; z-index: 430; top: calc(10px + env(safe-area-inset-top, 0px));
  left: max(12px, env(safe-area-inset-left, 0px)); right: max(12px, env(safe-area-inset-right, 0px));
  display: flex; align-items: center; gap: 8px; pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.brand-pill {
  display: flex; align-items: center; gap: 9px; padding: 5px 15px 5px 5px; border-radius: 999px;
  background: var(--glass); -webkit-backdrop-filter: blur(14px) saturate(1.4); backdrop-filter: blur(14px) saturate(1.4);
  box-shadow: var(--shadow-1);
}
.brand-pill img { width: 34px; height: 34px; border-radius: 50%; background: #fff; }
.wordmark { font: italic 800 21px/1 var(--font-display); letter-spacing: .015em; display: flex; gap: 5px; white-space: nowrap; }
.wm-a { color: var(--green); }
.wm-b { color: var(--wm-b); }
.net-pill {
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; border-radius: 999px; font-size: 13.5px; font-weight: 600;
  background: var(--glass); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: var(--shadow-1);
}
.net-pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); }
.net-pill.dl::before { background: var(--green); animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .3; } }

.fabs {
  position: absolute; z-index: 425; right: max(12px, env(safe-area-inset-right, 0px));
  bottom: calc(var(--sheet-h) + 12px); display: flex; flex-direction: column; gap: 10px;
  transition: bottom .28s cubic-bezier(.2, .8, .2, 1);
}
#stage.dragging .fabs { transition: none; }
.fab { width: 48px; height: 48px; border-radius: 16px; border: 0; background: var(--surface); color: var(--fg); box-shadow: var(--shadow-1); display: grid; place-items: center; }
.fab:active { transform: scale(.96); }

.pick-banner {
  position: absolute; z-index: 440; top: calc(64px + env(safe-area-inset-top, 0px)); left: 12px; right: 12px; max-width: 520px; margin: 0 auto;
  display: flex; align-items: center; gap: 10px; padding: 11px 12px 11px 14px;
  background: var(--navy); color: #fff; border-radius: 16px; box-shadow: var(--shadow-1); font-weight: 600;
}
.pick-banner span { flex: 1; min-width: 0; }
.pick-banner .btn-text { color: #9BE597; }

/* Pinezki na mapie */
.mk { cursor: pointer; display: flex; flex-direction: column; align-items: center; }
.pin {
  min-width: 30px; height: 28px; padding: 0 6px; border-radius: 8px; transform: skewX(-9deg);
  background: var(--badge); border: 2px solid #fff; box-shadow: 0 2px 7px rgba(10, 16, 36, .35);
  display: grid; place-items: center; color: #fff;
}
.pin > * { transform: skewX(9deg); }
.pin span { font: 700 15px/1 var(--font-display); font-variant-numeric: tabular-nums; }
.pin svg { width: 15px; height: 15px; stroke-width: 2.8; }
.mk::after { content: ""; width: 2px; height: 7px; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .35); border-radius: 0 0 2px 2px; }
.mk.next .pin { background: var(--go); color: var(--on-go); height: 36px; min-width: 40px; border-radius: 10px; }
.mk.next .pin span { font-size: 19px; }
.mk.next::after { height: 9px; }
.mk.done .pin { background: #8C94AA; }
.mk.failed .pin { background: var(--bad); }
.mk.skipped .pin { background: var(--warn); }
.mk.sel .pin { box-shadow: 0 0 0 4px rgba(63, 171, 60, .5), 0 2px 7px rgba(10, 16, 36, .35); }
.mk.se::after { display: none; }
.se-pin { width: 32px; height: 32px; border-radius: 50%; background: var(--surface); color: var(--fg); border: 2px solid var(--navy); display: grid; place-items: center; box-shadow: 0 2px 7px rgba(10, 16, 36, .3); }
.se-pin svg { width: 17px; height: 17px; }
.se-pin.end { border-color: var(--green); }
.me-dot { width: 20px; height: 20px; border-radius: 50%; background: #2F7DF6; border: 3px solid #fff; box-shadow: 0 0 0 7px rgba(47, 125, 246, .2), 0 1px 4px rgba(0, 0, 0, .4); }

/* ---------- Arkusz ---------- */
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; height: var(--sheet-h); z-index: 420;
  background: var(--surface); border-radius: 26px 26px 0 0; box-shadow: var(--shadow-2);
  display: flex; flex-direction: column; transition: height .28s cubic-bezier(.2, .8, .2, 1);
}
#stage.dragging .sheet { transition: none; }
.sheet-grab { flex: none; height: 24px; display: grid; place-items: center; touch-action: none; cursor: grab; }
.grip { width: 40px; height: 5px; border-radius: 3px; background: var(--line); }
.sheet-body {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  padding: 0 max(16px, env(safe-area-inset-right, 0px)) 14px max(16px, env(safe-area-inset-left, 0px));
}
.sheet-foot { flex: none; padding: 10px max(16px, env(safe-area-inset-right, 0px)) 12px max(16px, env(safe-area-inset-left, 0px)); background: var(--surface); }
.sheet-foot:empty { display: none; }
[data-drag] { touch-action: none; }

.sh-head { padding: 0 0 4px; }
.sh-title { display: flex; align-items: center; gap: 6px; }
.sh-title h2 { flex: 1; min-width: 0; margin: 0; font: 700 25px/1.1 var(--font-display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sh-sub { color: var(--muted); font-size: 14.5px; margin: 1px 0 12px; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border: 0; background: none; color: inherit; border-radius: 14px; flex: none; }
.icon-btn:active { background: var(--surface-2); }

.search-field {
  display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 5px 0 15px; width: 100%;
  border-radius: 16px; background: var(--surface-2); border: 0; color: var(--muted); text-align: left; font-size: 16px;
}
.search-field .ph { flex: 1; min-width: 0; }
.search-field .mic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; color: var(--fg); background: var(--surface); border: 0; box-shadow: 0 1px 2px rgba(18, 26, 51, .1); }

.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 16px; margin: 12px 0 2px; }
.metrics > div { padding: 9px 10px 8px; min-width: 0; }
.metrics > div + div { border-left: 1px solid var(--line); }
.metrics b { display: block; font: 700 21px/1.1 var(--font-display); font-variant-numeric: tabular-nums; white-space: nowrap; }
.metrics span { font-size: 12.5px; color: var(--muted); white-space: nowrap; }

.banner { display: flex; gap: 10px; align-items: center; padding: 11px 13px; border-radius: 14px; background: var(--warn-soft); color: var(--warn); font-size: 14.5px; font-weight: 500; margin: 10px 0 2px; }
.banner svg { width: 20px; height: 20px; }
.banner span { flex: 1; min-width: 0; }
.banner.info { background: var(--green-soft); color: var(--green-text); }
.hint { font-size: 13.5px; color: var(--muted); }

.sec-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 18px 0 4px; }
.sec-h h3 { margin: 0; font: 600 15px/1.2 var(--font-ui); color: var(--muted); }

/* Oś czasu przystanków */
.tl { list-style: none; margin: 0; padding: 0; }
.tl > li { position: relative; }
.tl > li::before { content: ""; position: absolute; left: 18px; top: 0; bottom: 0; width: 2px; background: var(--line); }
.tl > li:first-child::before { top: 50%; }
.tl > li:last-child::before { bottom: 50%; }
.tl > li:only-child::before { display: none; }
.tl > li.ok::before { background: var(--green); opacity: .55; }
.row {
  position: relative; display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 0;
  background: none; border: 0; text-align: left; color: inherit;
}
.row .main { flex: 1; min-width: 0; }
.row .a1 { font-weight: 600; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .a2 { font-size: 13.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .a2 .tag { margin-left: 4px; }
.row .eta { text-align: right; flex: none; font: 700 18px/1.1 var(--font-display); font-variant-numeric: tabular-nums; }
.row .eta small { display: block; font: 500 12.5px/1.25 var(--font-ui); color: var(--muted); }
.row .eta.late { color: var(--bad); }
.row.dim .a1 { color: var(--muted); }
.row > svg { color: var(--faint); width: 18px; height: 18px; }
.bcol { width: 38px; flex: none; display: grid; place-items: center; position: relative; z-index: 1; }
.bdg {
  min-width: 34px; height: 30px; padding: 0 6px; border-radius: 8px; transform: skewX(-9deg);
  display: grid; place-items: center; background: var(--badge); color: #fff;
  font: 700 17px/1 var(--font-display); font-variant-numeric: tabular-nums;
}
.bdg > * { transform: skewX(9deg); }
.bdg svg { width: 17px; height: 17px; stroke-width: 2.4; }
.bdg.done { background: var(--green-soft); color: var(--green-text); }
.bdg.failed { background: var(--bad-soft); color: var(--bad); }
.bdg.skipped, .bdg.nogeo { background: var(--warn-soft); color: var(--warn); }
.bdg.next { background: var(--go); color: var(--on-go); }
.bdg.ep { width: 30px; min-width: 30px; height: 30px; border-radius: 50%; transform: none; background: var(--surface); color: var(--fg); border: 2px solid var(--line); }
.bdg.ep > * { transform: none; }
.bdg.ep svg { width: 16px; height: 16px; stroke-width: 2; }
.badge { min-width: 34px; height: 32px; padding: 0 7px; border-radius: 9px; flex: none; display: grid; place-items: center; background: var(--badge); color: #fff; font: 700 17px/1 var(--font-display); font-variant-numeric: tabular-nums; }
.badge svg { width: 17px; height: 17px; }
.badge.done { background: var(--green-soft); color: var(--green-text); }
.badge.failed { background: var(--bad-soft); color: var(--bad); }
.badge.skipped, .badge.nogeo { background: var(--warn-soft); color: var(--warn); }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 7px; font-size: 12.5px; font-weight: 600; background: var(--surface-2); color: var(--muted); white-space: nowrap; vertical-align: 1px; }
.tag svg { width: 14px; height: 14px; }
.tag.prio { background: var(--warn-soft); color: var(--warn); }
.tag.first { background: var(--green-soft); color: var(--green-text); }
.tag.pick { background: var(--navy-soft); color: var(--fg); }
.reorder { display: flex; gap: 6px; }
.reorder button { width: 40px; height: 40px; border-radius: 12px; border: 0; background: var(--surface-2); display: grid; place-items: center; }

/* ---------- Tryb jazdy ---------- */
.segs { display: flex; gap: 3px; padding: 0 3px; }
.segs i { flex: 1; min-width: 2px; height: 9px; border-radius: 3px; background: var(--seg); transform: skewX(-24deg); }
.segs i.done { background: var(--green); }
.segs i.failed { background: var(--bad); }
.segs i.skipped { background: var(--warn); }
.segs i.next { background: transparent; box-shadow: inset 0 0 0 2px var(--go); }
.drive-meta { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 10px 0 2px; font-size: 14.5px; color: var(--muted); }
.drive-meta b { color: var(--fg); font: 700 18px/1 var(--font-display); font-variant-numeric: tabular-nums; }
.km-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; background: var(--surface-2); color: var(--fg); font-weight: 600; font-size: 13.5px; }
.km-chip svg { width: 16px; height: 16px; color: var(--green-text); }
.next { padding: 14px 0 4px; }
.next-head { display: flex; align-items: flex-start; gap: 14px; }
.hero-num { font: italic 800 58px/.82 var(--font-display); color: var(--go); font-variant-numeric: tabular-nums; min-width: 40px; letter-spacing: -.02em; padding-top: 2px; }
.next-addr { flex: 1; min-width: 0; }
.next-addr .a1 { font: 700 23px/1.12 var(--font-ui); text-wrap: balance; }
.next-addr .a2 { color: var(--muted); font-size: 15px; margin-top: 3px; }
.next-eta { text-align: right; flex: none; }
.next-eta b { display: block; font: 700 28px/1 var(--font-display); font-variant-numeric: tabular-nums; }
.next-eta b.late { color: var(--bad); }
.next-eta small { color: var(--muted); font-size: 13px; display: block; margin-top: 3px; }
.next-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 0; }
.next-meta .tag { font-size: 14px; padding: 5px 10px; border-radius: 10px; color: var(--fg); }
.next-meta .tag.loc { background: var(--navy); color: #fff; font-family: var(--font-display); font-size: 15px; letter-spacing: .03em; }
.next-note { margin: 12px 0 0; padding: 11px 13px; border-radius: 14px; background: var(--surface-2); font-size: 15px; }
.here { display: inline-flex; align-items: center; gap: 8px; color: var(--green-text); font-weight: 700; font-size: 14.5px; margin-top: 12px; }
.here::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 5px rgba(63, 171, 60, .22); }
.qa { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 16px 0 4px; }
.qa button { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 11px 4px 9px; border-radius: 16px; background: var(--surface-2); border: 0; font-size: 13px; font-weight: 600; color: var(--fg); }
.qa button[disabled] { opacity: .4; }
.foot-stack { display: flex; flex-direction: column; gap: 10px; }
.outcome-row { display: grid; grid-template-columns: 1.3fr 1fr; gap: 10px; }
.done-card { text-align: center; padding: 10px 0 4px; }
.done-card h2 { margin: 0; font: italic 800 34px/1.05 var(--font-display); color: var(--green-text); }

/* ---------- Przyciski i pola ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 0 18px;
  border-radius: 15px; border: 0; background: var(--surface-2); color: var(--fg); font-weight: 600; font-size: 16px; text-decoration: none;
}
.btn:active { transform: scale(.985); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn-go { background: var(--go); color: var(--on-go); font-size: 17px; min-height: 56px; border-radius: 17px; }
.btn-navy { background: var(--navy); color: #fff; }
.btn-bad { background: var(--bad-soft); color: var(--bad); }
.btn-ok { background: var(--green-soft); color: var(--green-text); }
.btn-line { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line); }
.btn-ghost { background: transparent; }
.btn-block { width: 100%; }
.btn-sm { min-height: 38px; padding: 0 13px; font-size: 14.5px; border-radius: 12px; }
.btn-text { background: none; border: 0; color: var(--green-text); font-weight: 700; padding: 8px 4px; font-size: 15px; }
.btn-row { display: flex; gap: 10px; }
.btn-row > * { flex: 1; min-width: 0; }
.btn-split { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.field { display: flex; flex-direction: column; gap: 7px; }
.field > label, .label { font-size: 14.5px; font-weight: 600; color: var(--muted); }
.input, .textarea, select.input {
  width: 100%; min-height: 50px; padding: 12px 14px; border-radius: 14px;
  border: 1.5px solid var(--line); background: var(--surface); color: var(--fg); font-size: 16px;
}
.textarea { min-height: 92px; resize: vertical; line-height: 1.45; }
.input:focus, .textarea:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(63, 171, 60, .2); }
.input.big { font: 700 24px/1 var(--font-display); font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.form { display: flex; flex-direction: column; gap: 20px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 40px; padding: 0 15px; border-radius: 999px; border: 0; background: var(--surface-2);
  color: var(--fg); font-weight: 600; font-size: 15px; display: inline-flex; align-items: center; gap: 6px;
}
.chip[aria-pressed="true"] { background: var(--navy); color: #fff; }
:root[data-dark="1"] .chip[aria-pressed="true"] { background: var(--go); color: var(--on-go); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface-2); border-radius: 15px; padding: 4px; gap: 4px; }
.seg button { min-height: 42px; border: 0; border-radius: 11px; background: none; font-weight: 600; font-size: 15px; color: var(--muted); padding: 0 6px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.seg button svg { width: 18px; height: 18px; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--fg); box-shadow: 0 1px 4px rgba(15, 22, 45, .14); }
.seg.outcome button[aria-pressed="true"].ok { background: var(--go); color: var(--on-go); }
.seg.outcome button[aria-pressed="true"].bad { background: var(--bad); color: #fff; }
.toggle-row { display: flex; align-items: center; gap: 12px; min-height: 56px; }
.toggle-row .txt { flex: 1; min-width: 0; }
.toggle-row .txt b { display: block; font-weight: 600; }
.toggle-row .txt small { color: var(--muted); font-size: 13.5px; }
.switch { position: relative; width: 52px; height: 32px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--seg); transition: background .2s; }
.switch span::after { content: ""; position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .2s; }
.switch input:checked + span { background: var(--go); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 3px solid var(--green); outline-offset: 2px; }
.stepper { display: inline-flex; align-items: center; background: var(--surface-2); border-radius: 14px; overflow: hidden; }
.stepper button { width: 48px; height: 48px; border: 0; background: none; font-size: 22px; font-weight: 600; }
.stepper output { min-width: 48px; text-align: center; font: 700 21px/1 var(--font-display); font-variant-numeric: tabular-nums; }
.radio-list { display: flex; flex-direction: column; border-radius: 16px; overflow: hidden; background: var(--surface); border: 1px solid var(--line); }
.radio-list label { display: flex; align-items: center; gap: 12px; min-height: 54px; padding: 8px 14px; border-top: 1px solid var(--line); }
.radio-list label:first-child { border-top: 0; }
.radio-list input { width: 20px; height: 20px; accent-color: var(--go); flex: none; margin: 0; }
.radio-list .txt { flex: 1; min-width: 0; }
.radio-list .txt small { display: block; color: var(--muted); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Dolna nawigacja ---------- */
.tabbar {
  flex: none; display: grid; grid-template-columns: repeat(4, 1fr); background: var(--surface); border-top: 1px solid var(--line);
  padding: 6px max(6px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(6px, env(safe-area-inset-left, 0px));
  position: relative; z-index: 600;
}
.tabbar button { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 3px 0 2px; border: 0; background: none; color: var(--muted); font-size: 12.5px; font-weight: 600; min-width: 0; }
.tabbar .ic { width: 58px; height: 30px; border-radius: 15px; display: grid; place-items: center; transition: background .2s; }
.tabbar button[aria-current="page"] { color: var(--fg); }
.tabbar button[aria-current="page"] .ic { background: var(--green-soft); color: var(--green-text); }

/* ---------- Strony zakładek ---------- */
.page { position: absolute; inset: 0; z-index: 450; background: var(--bg); overflow-y: auto; overscroll-behavior: contain; }
.page-in { max-width: 680px; margin: 0 auto; padding: calc(18px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 32px max(16px, env(safe-area-inset-left, 0px)); }
.page-h { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.page-h h1 { flex: 1; min-width: 0; margin: 0; font: 700 32px/1.05 var(--font-display); letter-spacing: -.005em; }
.group-h { margin: 26px 0 8px; font: 600 15px/1.2 var(--font-ui); color: var(--muted); }
.card { background: var(--surface); border-radius: 18px; padding: 14px 16px; }
.list-group { background: var(--surface); border-radius: 18px; padding: 2px 16px; }
.list-group > * + * { border-top: 1px solid var(--line); }
.menu-item { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 56px; padding: 0; background: none; border: 0; text-align: left; font-size: 16px; font-weight: 600; color: inherit; }
.menu-item svg { color: var(--muted); }
.menu-item .grow { flex: 1; min-width: 0; }
.menu-item small { display: block; font-weight: 500; font-size: 13.5px; color: var(--muted); }
.menu-item.danger, .menu-item.danger svg { color: var(--bad); }

.route-card { display: flex; flex-direction: column; gap: 9px; width: 100%; text-align: left; color: inherit; background: var(--surface); border: 0; border-radius: 18px; padding: 14px 14px 14px 16px; margin-bottom: 10px; }
.route-card.active { box-shadow: inset 0 0 0 2px var(--green); }
.route-card .top { display: flex; align-items: center; gap: 10px; }
.route-card .name { flex: 1; min-width: 0; font-weight: 700; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.route-card .meta { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); font-size: 14px; }
.pill { font-size: 12.5px; font-weight: 700; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.pill.planning { background: var(--surface-2); color: var(--muted); }
.pill.active, .pill.ok { background: var(--green-soft); color: var(--green-text); }
.pill.done { background: var(--navy-soft); color: var(--fg); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }

/* Kilometrówka */
.month { display: flex; align-items: center; gap: 4px; background: var(--surface); border-radius: 16px; padding: 4px; }
.month b { flex: 1; text-align: center; font: 600 17px/1 var(--font-ui); }
.km-hero { margin-top: 12px; background: var(--navy); color: #fff; border-radius: 22px; padding: 18px 18px 16px; position: relative; overflow: hidden; }
.km-hero .big { font: italic 800 52px/.95 var(--font-display); letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.km-hero .big small { font-size: 24px; font-weight: 700; margin-left: 4px; }
.km-hero .sub { opacity: .82; font-size: 14.5px; margin-top: 6px; }
.km-hero .odo { display: inline-flex; gap: 8px; margin-top: 12px; padding: 6px 11px; border-radius: 10px; background: rgba(255, 255, 255, .12); font-weight: 600; font-size: 14px; font-variant-numeric: tabular-nums; }
.km-hero::after { content: ""; position: absolute; right: -40px; top: -20px; width: 180px; height: 160%; background: linear-gradient(90deg, transparent, rgba(63, 171, 60, .32)); transform: skewX(-18deg); pointer-events: none; }
.live { display: flex; align-items: center; gap: 12px; margin-top: 12px; padding: 13px 15px; border-radius: 18px; background: var(--green-soft); color: var(--green-text); font-weight: 600; }
.live b { font: 700 22px/1 var(--font-display); }
.trip { display: flex; gap: 14px; align-items: flex-start; width: 100%; padding: 13px 0; background: none; border: 0; text-align: left; color: inherit; }
.trip .km { width: 74px; flex: none; text-align: right; font: italic 800 25px/1 var(--font-display); font-variant-numeric: tabular-nums; padding-top: 2px; }
.trip .km small { display: block; font: 500 12px/1.3 var(--font-ui); font-style: normal; color: var(--muted); }
.trip .main { flex: 1; min-width: 0; }
.trip .a1 { font-weight: 600; }
.trip .a2 { font-size: 13.5px; color: var(--muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.trip .a3 { font-size: 13px; color: var(--faint); margin-top: 3px; font-variant-numeric: tabular-nums; }
.veh-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; background: none; border: 0; text-align: left; color: inherit; padding: 6px 0; }
.plate { display: inline-flex; align-items: center; justify-content: center; min-width: 92px; height: 32px; padding: 0 9px; border-radius: 6px; border: 2px solid var(--fg); background: var(--surface); font: 700 16px/1 var(--font-display); letter-spacing: .06em; white-space: nowrap; }
.plate::before { content: "PL"; font: 700 9px/1 var(--font-ui); color: #fff; background: #1F4FB4; border-radius: 2px; padding: 2px 2px; margin-right: 6px; letter-spacing: 0; }

/* ---------- Panele ---------- */
.panel { position: fixed; inset: 0; z-index: 900; background: var(--bg); display: flex; flex-direction: column; animation: panelIn .22s cubic-bezier(.2, .8, .2, 1); }
.panel.closing { animation: panelOut .17s ease-in forwards; }
@keyframes panelIn { from { transform: translateX(26px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes panelOut { to { transform: translateX(26px); opacity: 0; } }
.panel-h {
  flex: none; display: flex; align-items: center; gap: 4px; min-height: 62px;
  padding: calc(7px + env(safe-area-inset-top, 0px)) max(8px, env(safe-area-inset-right, 0px)) 7px max(6px, env(safe-area-inset-left, 0px));
  background: var(--bg);
}
.panel-h h2 { flex: 1; min-width: 0; margin: 0; font: 700 24px/1.1 var(--font-display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.panel-h .search-input { flex: 1; min-width: 0; height: 48px; border: 0; background: var(--surface); border-radius: 15px; padding: 0 14px; font-size: 17px; box-shadow: var(--shadow-1); }
.panel-h .search-input:focus { outline: 2px solid var(--green); }
.panel-b { flex: 1; min-height: 0; overflow-y: auto; padding: 10px max(16px, env(safe-area-inset-right, 0px)) 30px max(16px, env(safe-area-inset-left, 0px)); }
.panel-b.flush { padding: 0 0 30px; }
.panel-f { flex: none; padding: 12px max(16px, env(safe-area-inset-right, 0px)) calc(14px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); background: var(--surface); box-shadow: var(--shadow-2); display: flex; gap: 10px; }
.panel-f > * { flex: 1; }
.inner { max-width: 680px; margin: 0 auto; }

.result-list { list-style: none; margin: 0; padding: 0 max(10px, env(safe-area-inset-right, 0px)) 0 max(10px, env(safe-area-inset-left, 0px)); }
.result {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 8px; margin: 2px 0;
  border: 0; border-radius: 14px; background: none; text-align: left; color: inherit;
}
.result:active { background: var(--surface); }
.result .ico { width: 40px; height: 40px; border-radius: 13px; background: var(--surface); display: grid; place-items: center; color: var(--muted); flex: none; }
.result .ico.g { background: var(--green-soft); color: var(--green-text); }
.result .main { flex: 1; min-width: 0; }
.result .a1 { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result .a2 { font-size: 13.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result .dist { font: 600 14px/1 var(--font-display); color: var(--muted); font-variant-numeric: tabular-nums; }
.added-bar { display: flex; align-items: center; gap: 10px; margin: 6px max(16px, env(safe-area-inset-right, 0px)) 6px max(16px, env(safe-area-inset-left, 0px)); padding: 8px 8px 8px 14px; border-radius: 16px; background: var(--green-soft); color: var(--green-text); font-weight: 600; font-size: 14.5px; }
.added-bar span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty-note { padding: 28px 20px; text-align: center; color: var(--muted); }

.addr-card { display: flex; gap: 12px; align-items: center; }
.addr-card .main { flex: 1; min-width: 0; }
.addr-card .a1 { font-weight: 700; font-size: 18px; }
.addr-card .a2 { color: var(--muted); font-size: 14.5px; }
.loc-grid { display: flex; flex-direction: column; gap: 8px; }
.loc-code { font: 700 15px/1 var(--font-display); letter-spacing: .04em; color: var(--muted); }

.photo-row { display: flex; flex-wrap: wrap; gap: 10px; }
.photo-row .ph { width: 88px; height: 88px; border-radius: 14px; overflow: hidden; position: relative; background: var(--surface-2); }
.photo-row .ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-row .ph button { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(10, 15, 30, .7); color: #fff; display: grid; place-items: center; }
.photo-row .ph button svg { width: 15px; height: 15px; }
.photo-add { width: 88px; height: 88px; border-radius: 14px; border: 2px dashed var(--line); background: var(--surface); color: var(--muted); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 13px; font-weight: 600; position: relative; overflow: hidden; }
.photo-add input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.sig-wrap { position: relative; border-radius: 16px; background: #FFFFFF; overflow: hidden; border: 1.5px solid var(--line); }
.sig-wrap canvas { display: block; width: 100%; height: 180px; touch-action: none; }
.sig-wrap .sig-line { position: absolute; left: 18px; right: 18px; bottom: 40px; border-bottom: 1.5px dashed #B8BFD0; pointer-events: none; }
.sig-wrap .sig-ph { position: absolute; left: 18px; bottom: 14px; font-size: 13px; color: #8A93AD; pointer-events: none; }
.sig-wrap .sig-clear { position: absolute; top: 8px; right: 8px; background: #EEF1F6; color: #121A33; }

.stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.stat { background: var(--surface); border-radius: 16px; padding: 12px 13px; }
.stat b { display: block; font: 700 30px/1 var(--font-display); font-variant-numeric: tabular-nums; }
.stat span { font-size: 13px; color: var(--muted); }
.stat.ok b { color: var(--green-text); }
.stat.bad b { color: var(--bad); }
.report-row { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); align-items: flex-start; }
.report-row .main { flex: 1; min-width: 0; }
.report-row .a1 { font-weight: 600; }
.report-row .a2 { font-size: 13.5px; color: var(--muted); }
.report-row .t { font: 700 16px/1.2 var(--font-display); font-variant-numeric: tabular-nums; text-align: right; }
.thumbs { display: flex; gap: 6px; margin-top: 6px; }
.thumbs img { width: 46px; height: 46px; border-radius: 9px; object-fit: cover; background: #fff; }

.import-table { overflow-x: auto; border-radius: 14px; background: var(--surface); }
.import-table table { border-collapse: collapse; font-size: 13.5px; min-width: 100%; }
.import-table th, .import-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.import-table th { background: var(--surface-2); font-weight: 600; color: var(--muted); font-size: 12.5px; }
.col-map { display: grid; gap: 10px; }
.col-map .row2 { display: grid; grid-template-columns: 110px 1fr; gap: 10px; align-items: center; }
.colpick { display: flex; flex-wrap: wrap; gap: 6px; }
.progress { height: 10px; border-radius: 5px; background: var(--seg); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--green); border-radius: 5px; transition: width .3s; }
.file-drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 150px; border: 2px dashed var(--line); border-radius: 18px; background: var(--surface); color: var(--muted); text-align: center; padding: 18px; position: relative; font-weight: 600; }
.file-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file-drop svg { width: 30px; height: 30px; color: var(--green-text); }

.about { display: flex; gap: 14px; align-items: center; }
.about img { width: 78px; height: 78px; border-radius: 50%; background: #fff; padding: 5px; }

/* ---------- Modal / toast ---------- */
.modal-back { position: fixed; inset: 0; z-index: 1200; background: rgba(8, 12, 26, .5); display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal {
  width: 100%; max-width: 560px; background: var(--surface); border-radius: 26px 26px 0 0;
  padding: 22px max(18px, env(safe-area-inset-right, 0px)) calc(18px + env(safe-area-inset-bottom, 0px)) max(18px, env(safe-area-inset-left, 0px));
  box-shadow: var(--shadow-2); animation: up .22s cubic-bezier(.2, .8, .2, 1); max-height: 90vh; overflow-y: auto;
}
@keyframes up { from { transform: translateY(40px); opacity: .5; } }
.modal h3 { margin: 0 0 6px; font: 700 25px/1.12 var(--font-display); }
.modal p { margin: 0 0 16px; color: var(--muted); }
.modal .btn-row { margin-top: 8px; }
.modal .list-group { background: var(--surface-2); }
.toast {
  position: fixed; left: 0; right: 0; margin: 0 auto; width: max-content; max-width: min(calc(100% - 32px), 520px);
  bottom: calc(var(--toast-b, 24px) + env(safe-area-inset-bottom, 0px)); z-index: 1300;
  display: flex; align-items: center; gap: 14px; background: #1A2240; color: #fff; padding: 12px 16px; border-radius: 15px;
  box-shadow: var(--shadow-1); font-weight: 500; font-size: 15px; animation: up .2s;
}
.toast button { background: none; border: 0; color: #9BE597; font-weight: 700; padding: 4px; font-size: 15px; }
.empty-hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 8px 6px 6px; }
.empty-hero h3 { margin: 4px 0 0; font: 700 25px/1.12 var(--font-display); }
.empty-hero p { margin: 0; color: var(--muted); max-width: 34ch; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--seg); border-top-color: var(--green); animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.busy { display: flex; align-items: center; gap: 12px; padding: 14px 4px; color: var(--muted); font-weight: 600; }

@media (min-width: 900px) {
  .sheet { left: 16px; right: auto; width: 430px; bottom: 16px; border-radius: 24px; height: calc(100% - 92px) !important; }
  .sheet-grab { display: none; }
  .fabs { bottom: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- Konto firmowe, role, synchronizacja ---------- */
.tb-gap { flex: 1; }
.sync-pill { border: 0; color: inherit; font-family: inherit; white-space: nowrap; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.sync-pill::before { background: var(--muted); }
.sync-pill.warn::before { background: var(--warn); }
.sync-pill.busy::before { background: var(--green); animation: blink 1.2s infinite; }
.bell { position: relative; width: 44px; height: 44px; border-radius: 50%; border: 0; display: grid; place-items: center; color: var(--fg);
  background: var(--glass); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: var(--shadow-1); }
.bell svg { width: 23px; height: 23px; }
.bell-n { position: absolute; top: -3px; right: -4px; min-width: 21px; height: 21px; padding: 0 5px; border-radius: 11px; background: var(--bad); color: #fff;
  font: 700 12.5px/21px var(--font-ui); text-align: center; font-variant-numeric: tabular-nums; box-shadow: 0 0 0 2px var(--surface); }
.drv-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: -4px 0 12px; }
.drv-chip { display: inline-flex; align-items: center; gap: 7px; min-height: 34px; padding: 0 12px 0 10px; border-radius: 11px; border: 0;
  background: var(--navy-soft); color: var(--fg); font: 600 14.5px/1 var(--font-ui); max-width: 100%; }
.drv-chip svg { width: 18px; height: 18px; flex: none; }
.drv-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drv-chip.static { background: var(--surface-2); }
.tag.drv { background: var(--navy-soft); color: var(--fg); }
.monitor-foot { display: flex; align-items: center; gap: 12px; min-height: 56px; }
.monitor-foot > span { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 600; font-size: 14.5px; }
.monitor-foot > span svg { width: 20px; height: 20px; flex: none; }
.av { width: 40px; height: 40px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--navy); color: #fff;
  font: 700 16px/1 var(--font-display); letter-spacing: .03em; }
.av svg { width: 22px; height: 22px; }
.av.off { background: var(--surface-2); color: var(--muted); }
.drv-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 64px; padding: 8px 0; background: none; border: 0; text-align: left; color: inherit; }
.drv-row[disabled] { opacity: 1; }
.drv-row[disabled] .av { background: var(--surface-2); color: var(--muted); }
.drv-row .main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.drv-row .a1 { font-weight: 600; }
.drv-row .a2 { font-size: 13.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-bar { display: block; height: 5px; border-radius: 3px; background: var(--surface-2); overflow: hidden; margin-top: 4px; }
.mini-bar i { display: block; height: 100%; background: var(--green); border-radius: 3px; }
.acc-card { display: flex; gap: 14px; align-items: flex-start; }
.acc-card .main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.acc-card .main b { font-size: 17px; }
.km-split { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; margin-top: 14px; border-radius: 14px; overflow: hidden; background: rgba(255, 255, 255, .14); position: relative; z-index: 1; }
.km-split > div { background: rgba(10, 16, 40, .28); padding: 9px 10px; min-width: 0; }
.km-split b { display: block; font: 700 19px/1.1 var(--font-display); font-variant-numeric: tabular-nums; white-space: nowrap; }
.km-split span { font-size: 12.5px; opacity: .8; }
.km-table { padding: 4px 14px; }
.kt-row { display: grid; grid-template-columns: minmax(0, 1.4fr) 1fr .9fr .9fr; gap: 8px; align-items: center; width: 100%; min-height: 46px; padding: 6px 0;
  background: none; border: 0; text-align: left; color: inherit; font-size: 14.5px; }
.kt-row + .kt-row { border-top: 1px solid var(--line); }
.kt-row > span:first-child { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kt-row b { font: 700 18px/1 var(--font-display); }
.kt-h { min-height: 34px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.kt-h > span:first-child { font-weight: 600; }
.day-sum { display: flex; justify-content: space-between; gap: 10px; }
.trip .km.none { color: var(--faint); }
.result.notif.unread .a1 { font-weight: 700; }
.result.notif.unread::after { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--green); flex: none; align-self: center; }
.result .ico.bad { background: var(--bad-soft); color: var(--bad); }
.result.audit { cursor: default; align-items: flex-start; }
.result.audit .t { width: 46px; flex: none; color: var(--muted); font-weight: 600; padding-top: 1px; }
.pw-show { margin: 4px 0 16px; padding: 14px; border-radius: 14px; background: var(--surface-2); text-align: center; font: 700 26px/1.1 var(--font-display); letter-spacing: .06em; user-select: all; }
@media (max-width: 380px) { .kt-row { grid-template-columns: minmax(0, 1.2fr) 1fr .8fr; } .kt-row > span:nth-child(4) { display: none; } }
