/* Monitor Ewidencji Drogowej — interfejs webowy */

:root {
  /* Redesign 2026-10-06 (etap 1: tokeny) - paleta z makiety
     propozycja_redesign/. Nazwy zmiennych bez zmian, zmienione wartości. */
  --bg: #10171e;
  --surface: #172029;
  --surface-rgb: 23, 32, 41;
  --surface-2: #1d2832;
  --border: #2a3642;
  --text: #e4eaf0;
  --muted: #8d9aa7;
  --accent: #6e95f0;
  --accent-soft: rgba(110, 149, 240, .14);
  --green: #3db894;
  --amber: #f0b429;
  --red: #ef5a54;
  --shadow: 0 1px 2px rgba(0,0,0,.35), 0 6px 18px rgba(0,0,0,.25);
  --radius: 12px;
  /* tablica z numerem drogi wojewódzkiej (jak znak E-15c) */
  --plate: #f5c400;
  --plate-ink: #14202b;
  /* stałe kolory etapów: liniowy / poligonowy / punktowy */
  --s1: #3db894;
  --s2: #6e95f0;
  --s3: #e072a8;
}

:root[data-theme="light"] {
  --bg: #edf0f2;
  --surface: #ffffff;
  --surface-rgb: 255, 255, 255;
  --surface-2: #f5f7f8;
  --border: #d9dee3;
  --text: #14202b;
  --muted: #5e6b78;
  --accent: #3366d6;
  --accent-soft: rgba(51, 102, 214, .1);
  --green: #1e8c6e;
  --amber: #c98a12;
  --red: #c7302b;
  --shadow: 0 1px 2px rgba(20,32,43,.06), 0 4px 14px rgba(20,32,43,.06);
  --s1: #1e8c6e;
  --s2: #3366d6;
  --s3: #b8457e;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  display: flex;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 "Overpass", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

h1 { font-size: 20px; margin: 0; font-weight: 650; letter-spacing: -.2px; }
h2 { font-size: 14px; margin: 0 0 14px; font-weight: 620; letter-spacing: .1px; }
p { margin: 0 0 14px; }
code {
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 1px 5px; border-radius: 5px; font-size: 12px;
}
.muted { color: var(--muted); font-size: 12.5px; }

/* ---------------- Sidebar ---------------- */
.sidebar {
  width: 232px; flex: 0 0 232px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 18px 14px;
  position: sticky; top: 0; height: 100vh;
}
/* Redesign etap 2 (2026-10-06): blok marki w wierszu (logo obok nazwy) -
   w kolumnie zajmował ~170 px i dolne grupy zakładek nie mieściły się
   na ekranie 900 px. */
.brand {
  display: flex; flex-direction: row; align-items: center; gap: 12px;
  padding: 0 6px 14px; margin-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.brand-logo { height: 58px; width: auto; object-fit: contain; flex: none; }
.brand-text { min-width: 0; text-align: left; }
.brand-name { font-weight: 640; font-size: 14px; line-height: 1.2; }
.brand-sub {
  color: var(--muted); font-size: 10.5px; margin-top: 4px; line-height: 1.35;
}
/* wariant logo zależny od motywu — dotyczy paska bocznego i ekranu logowania */
:root[data-theme="dark"] .logo-on-light,
:root[data-theme="light"] .logo-on-dark { display: none !important; }

.nav {
  display: flex; flex-direction: column; gap: 2px;
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
  scrollbar-width: thin;   /* widoczny pasek: przy niskim oknie widać, że jest więcej zakładek */
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 7px 12px; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted);
  font: inherit; font-size: 13.5px; text-align: left; cursor: pointer;
  transition: background .15s, color .15s;
}
.nav-item { position: relative; }
.nav-item .ico {
  width: 18px; height: 18px; flex: 0 0 18px; opacity: .85;
  fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
/* aktywna zakładka: żółty znacznik jak tablica DW (redesign 2026-10-06) */
.nav-item.active { background: var(--surface-2); color: var(--text); font-weight: 700; }
.nav-item.active::before {
  content: ""; position: absolute; left: -14px; top: 7px; bottom: 7px; width: 4px;
  border-radius: 0 3px 3px 0; background: var(--plate);
}
.nav-group { display: flex; flex-direction: column; gap: 1px; }
.nav-group + .nav-group { margin-top: 12px; }
.nav-group-label {
  font-size: 11.5px; font-weight: 600; color: var(--muted);
  padding: 0 12px 3px; opacity: .85;
}
/* grupa bez żadnej widocznej pozycji (uprawnienia) znika razem z nagłówkiem */
.nav-group:not(:has(.nav-item:not([hidden]))) { display: none; }

.sidebar-foot { margin-top: auto; display: grid; gap: 8px; padding-bottom: 4px; }
.version { color: var(--muted); font-size: 11px; text-align: center; }
.readonly-note { color: var(--muted); font-size: 10.5px; text-align: center; padding: 0 8px; line-height: 1.3; }

/* ---------------- Layout ---------------- */
.main { flex: 1; min-width: 0; padding: 22px 26px 40px; }

.topbar {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 20px; margin-bottom: 22px; flex-wrap: wrap;
  /* baner z filmem w tle (2026-10-04) */
  position: relative; overflow: hidden; isolation: isolate;
  padding: 18px 20px; border-radius: var(--radius, 14px);
  background: #10141b; color: #fff;
}
.topbar-bg {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; z-index: -2; pointer-events: none;
}
/* ciemna nakładka - mocniejsza z lewej, gdzie jest tytuł i opis */
.topbar::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(90deg, rgba(10, 13, 19, .86) 0%, rgba(10, 13, 19, .66) 55%, rgba(10, 13, 19, .45) 100%);
}
.topbar #view-title { color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, .5); }
.topbar .snap-info, .topbar .view-intro { color: rgba(255, 255, 255, .82); text-shadow: 0 1px 2px rgba(0, 0, 0, .5); }
.snap-info { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
/* Wstep zakladki (VIEW_INFO w app.js) - zawsze widoczny pod tytulem, bez
   klikania (na wyrazna prosbe 2026-09-24: "nie po kliknieciu ani nie pod
   pytajnikiem"). Max-width utrzymuje linie czytelnej dlugosci przy szerokim
   oknie. */
.view-intro {
  max-width: 640px; margin-top: 8px; font-size: 13px; line-height: 1.5;
}
.view-intro p { margin: 0 0 4px; }
.view-intro .view-intro-q { color: var(--muted); }
.snap-age {
  display: inline-block; margin-left: 8px; padding: 1px 8px;
  border-radius: 10px; font-size: 11px; font-weight: 700;
}
.snap-age.ok { background: var(--green); color: #fff; }
.snap-age.warn { background: var(--amber); color: #1a1a1a; }
.snap-age.bad { background: var(--red); color: #fff; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.focus-bar {
  display: flex; align-items: center; gap: 11px;
  background: var(--accent-soft); border: 1px solid var(--accent);
  border-radius: 10px; padding: 7px 13px; font-size: 12.5px;
}
.focus-bar[hidden] { display: none; }
.focus-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.ghost-btn.small { padding: 4px 10px; font-size: 12px; }
.sync-msg { color: var(--muted); font-size: 12px; max-width: 380px; }

.view { display: none; }
.view.active { display: block; animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } }

/* Delikatny znak wodny na KAZDEJ zakladce — samo logo w tle, za kartami
   (z-index ujemny w kontekscie danej sekcji dziala tylko wzgledem jej
   wlasnych potomkow w normalnym przeplywie, wiec karty i tak zostaja na
   wierzchu). Na widoku Mapy logo bedzie w praktyce niewidoczne (przykryte
   przez Leaflet), ale zostaje dla spojnosci - nie szkodzi. */
.view { position: relative; }
.view::before {
  content: ""; position: absolute; z-index: -1; pointer-events: none;
  top: 10px; left: 50%; transform: translateX(-50%);
  width: 420px; height: 900px;
  background: url("/logo") no-repeat center / contain;
  opacity: .32;
}
/* Karty nieco przezroczyste, zeby znak wodny prześwitywał TEZ pod nimi,
   nie tylko w szparach miedzy nimi. Scope do .view - karta logowania (poza
   systemem zakladek) ma zostac w pelni kryjaca. */
.view .card { background: rgba(var(--surface-rgb), .86); }

/* Zakladka Drogi BEZ znaku wodnego (2026-09-23, na wyrazna prosbe: "usunac
   znak wodny spod tabeli") - gesta tabela z naprzemiennym tlem wierszy
   (patrz #road-table wyzej) czyta sie gorzej na prześwitujacym logo. Karty
   wracaja do pelnej nieprzezroczystosci, bo przezroczystosc byla tylko po
   to, zeby znak wodny bylo widac przez nie. */
#view-roads::before { content: none; }
#view-roads .card { background: var(--surface); }

/* ---------------- Buttons ---------------- */
.primary-btn, .ghost-btn {
  font: inherit; font-size: 13px; font-weight: 550;
  padding: 8px 15px; border-radius: 9px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  text-decoration: none; transition: background .15s, border-color .15s, opacity .15s;
}
.primary-btn {
  background: var(--accent); color: #fff; border: 1px solid transparent;
}
.primary-btn:hover { filter: brightness(1.08); }
.ghost-btn {
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
}
.ghost-btn:hover { background: var(--surface-2); border-color: var(--accent); }
button:disabled { opacity: .55; cursor: default; }
/* Kazde przejscie do Asystenta GIS (kafelek-launcher na Analizach GIS,
   przycisk w szczegolach drogi, ...) w tym samym zielonym kolorze - jedno
   spojne oznaczenie "to prowadzi do asystenta" w calej aplikacji
   (2026-09-23, na wyrazna prosbe). */
.ai-cta-btn {
  font: inherit; font-size: 13px; font-weight: 550;
  padding: 8px 15px; border-radius: 9px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none; transition: background .15s, border-color .15s, opacity .15s;
  background: var(--green); color: #fff; border: 1px solid var(--green);
}
.ai-cta-btn:hover { filter: brightness(1.08); }

.spin {
  width: 13px; height: 13px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.35); border-top-color: #fff;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.btn-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---------------- Cards ---------------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px;
  box-shadow: var(--shadow); margin-bottom: 18px;
}

/* ------------- Wejscie kafelkow (animacja "morph" przy otwarciu) -------------
   Kazdy kafelek (.card) na KAZDEJ zakladce wjezdza z lekkim "wyrastaniem"
   (skala + przesuniecie), nie tylko na Pulpicie (2026-09-23, na wyrazna
   prosbe: "morph" tez w pozostalych zakladkach monitora) - dziala tez przy
   powrocie na zakladke: .view bez .active ma display:none, a przywrocenie
   wyswietlania uruchamia animacje CSS od nowa - nie trzeba do tego zadnego
   kodu w app.js. Z TEGO SAMEGO powodu efekt dziala rowniez przy KLIKNIECIU
   kafelka, ktore odslania wlasny kafelek-szczegol (np. #kpi-detail-card,
   .an-details-card - oba maja klase .card, a JS przelacza je przez atrybut
   [hidden]; przejscie [hidden] -> widoczny to dla przegladarki ten sam
   rodzaj "wejscia w drzewo renderowania" co powrot na zakladke, wiec
   animacja odpala sie sama, bez osobnej obslugi w JS dla kazdego przypadku
   z osobna). Dziala tez dla kafelkow dopisanych do DOM juz PO wejsciu na
   zakladke (np. Kontrola jakosci renderuje .quality-card dopiero po
   pobraniu danych) - nowo wstawiony element pasujacy do selektora animacji
   odpala ja od razu, tak samo jak element odslonie przez display:none.

   WAZNE - dwie pulapki, ktore tu omijamy:
   1. Klatka `to` celowo nie istnieje. Animacja konczy sie na WLASNYCH
      wartosciach elementu, wiec nie zabetonowuje transformacji; gdyby wpisac
      `to { transform: none }` razem z fill-mode forwards, zepsulaby sie
      transformacja przy najechaniu (patrz .stage nizej).
   2. fill-mode `backwards`, a nie domyslny `none` - bez tego kafelek z
      opoznieniem byl przez chwile widoczny w docelowym miejscu, a dopiero
      potem skakal na start animacji. */
@keyframes kafelek-wjazd {
  from { opacity: 0; transform: translateY(10px) scale(.96); }
}
.view.active .card {
  animation: kafelek-wjazd .38s cubic-bezier(.22, .7, .3, 1) backwards;
}
/* Stopniowanie oparte o pozycje kafelka WSROD RODZENSTWA W JEGO WLASNYM
   kontenerze (dowolna siatka: kpi-grid, stage-grid, quality-grid, ...) -
   dziala jednakowo w kazdej zakladce, bez wypisywania nazwy kazdej siatki
   z osobna. Powyzej 6. kafelka w jednej siatce brak dodatkowego opoznienia
   (nadal wjezdzaja, tylko bez dalszego stopniowania) - w praktyce siatki w
   tej aplikacji maja co najwyzej kilka kafelkow. */
.view.active .card:nth-child(2) { animation-delay: .055s; }
.view.active .card:nth-child(3) { animation-delay: .11s; }
.view.active .card:nth-child(4) { animation-delay: .165s; }
.view.active .card:nth-child(5) { animation-delay: .22s; }
.view.active .card:nth-child(6) { animation-delay: .275s; }

/* Szanujemy systemowe ustawienie ograniczenia animacji - dla czesci osob ruch
   na ekranie jest meczacy, a tresc musi byc dostepna tak samo. */
@media (prefers-reduced-motion: reduce) and (max-width: 0px) {
  .view.active .card { animation: none; }
  .view.active { animation: none; }
}

.kpi-grid {
  display: grid; gap: 16px; margin-bottom: 4px;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}
.kpi { margin-bottom: 0; }
.kpi-label {
  color: var(--muted); font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .6px;
}
.kpi-value {
  font-size: 30px; font-weight: 680; letter-spacing: -.8px;
  margin: 8px 0 10px; color: var(--accent);
}
.kpi-value.ok { color: var(--green); }
.kpi-value.acc { color: #9b7cff; }
.kpi-value.warn { color: var(--amber); }
.kpi-sub { color: var(--muted); font-size: 11.5px; margin-top: 8px; }

/* kafelek "drogi zmienione" jest przyciskiem — wejście w widok zmian */
.kpi.clickable {
  text-align: left; font: inherit; color: inherit;
  cursor: pointer; position: relative;
  transition: border-color .15s, transform .15s;
}
.kpi.clickable:hover { border-color: var(--accent); transform: translateY(-2px); }
.kpi.clickable:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.kpi.clickable:hover .stage-cta, .kpi.clickable:focus-visible .stage-cta { opacity: 1; }

.bar {
  height: 6px; border-radius: 99px; background: var(--surface-2);
  overflow: hidden; border: 1px solid var(--border);
}
.bar > span {
  display: block; height: 100%; width: 0;
  background: var(--accent); border-radius: 99px;
  transition: width .5s cubic-bezier(.4,0,.2,1);
}

.stage-grid {
  display: grid; gap: 16px; margin: 16px 0 18px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
/* kafelek etapu jest przyciskiem — wejście w widok jednego etapu */
.stage {
  margin-bottom: 0; text-align: left; font: inherit; color: inherit;
  cursor: pointer; position: relative;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.stage:hover { border-color: var(--accent); transform: translateY(-2px); }
.stage:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.stage.focused {
  border-color: var(--accent);
  box-shadow: var(--shadow), 0 0 0 2px var(--accent-soft) inset;
}
.stage.dimmed { opacity: .5; }
.stage-cta {
  color: var(--accent); font-size: 11px; margin-top: 9px;
  opacity: 0; transition: opacity .15s;
}
.stage:hover .stage-cta { opacity: 1; }
.stage.focused .stage-cta { opacity: 1; }

.stage-head { display: flex; justify-content: space-between; align-items: center; }
.stage-head b { font-size: 13px; font-weight: 620; }
.pill {
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--muted); font-size: 10.5px; padding: 2px 8px; border-radius: 99px;
}
.stage-val { font-size: 24px; font-weight: 660; margin: 10px 0 9px; letter-spacing: -.5px; }
.stage-sub { color: var(--muted); font-size: 11.5px; margin-top: 9px; }

/* rozbicie Etapu 3 na podkategorie */
.stage-split { display: grid; gap: 4px; margin-top: 10px; }
.stage-split span {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 11.5px; color: var(--muted);
}
.stage-split b { font-variant-numeric: tabular-nums; font-weight: 620; }

.sub-toggle { display: inline-flex; gap: 2px; }
.sub-toggle[hidden] { display: none; }
.sub-toggle button {
  font: inherit; font-size: 11.5px; padding: 3px 10px; cursor: pointer;
  background: var(--surface); color: var(--muted);
  border: 1px solid var(--border); border-radius: 7px;
  transition: background .15s, color .15s, border-color .15s;
}
.sub-toggle button:hover { color: var(--text); border-color: var(--accent); }
.sub-toggle button.active {
  background: var(--accent); border-color: var(--accent);
  color: #fff; font-weight: 600;
}

.chart-grid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
}
/* elementy siatki nie mogą się rozpychać ponad dostępną szerokość */
.chart-grid > .card, .kpi-grid > .card, .stage-grid > .card { min-width: 0; }

/* canvas pozycjonowany bezwzględnie — nie wpływa na szerokość rodzica,
   dzięki czemu Chart.js mierzy stabilny kontener zamiast siebie samego */
.chart-wrap { position: relative; width: 100%; height: 230px; }
.chart-wrap.tall { height: 320px; }
.chart-wrap > canvas { position: absolute; top: 0; left: 0; }
.chart-empty {
  position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: center; text-align: center; padding: 0 24px;
}
.chart-empty[hidden] { display: none; }

/* Podglad na mapie + wykres drogi, jeden wiersz pol na pol (2026-09-23, na
   wyrazna prosbe). Gdy #road-map-card ma [hidden] (brak zawezenia do
   drogi), flexbox pomija ja calkowicie - druga karta z flex:1 rosnie sama
   do pelnej szerokosci, bez zadnego kodu w JS. min-width:0 na dzieciach -
   inaczej canvas Chart.js (position:absolute, ale mierzony wzgledem
   .chart-wrap) potrafi rozepchac flex-item ponad dostepna szerokosc. */
.road-map-chart-row { display: flex; gap: 18px; flex-wrap: wrap; }
.road-map-chart-row > .card { flex: 1 1 320px; min-width: 0; }
/* Mapa WYPELNIA cala wysokosc kafelka (dotychczas miala sztywne 260px, wiec
   przy wyrownaniu wysokosci do sasiedniego kafelka wykresu zostawala pusta
   przestrzen pod podpisem - zgloszone 2026-09-23 jako "zajmuje tylko 2/3").
   Karta staje sie kolumna flex: mapa rosnie (flex:1) i wypelnia dokladnie
   tyle, ile karta faktycznie ma wysokosci, podpis zostaje przy naturalnej
   wysokosci na dole.
   UWAGA - `:not([hidden])` jest tu KONIECZNE: `display: flex` na samym
   `#road-map-card` (selektor ID) ma WYZSZY priorytet w kaskadzie niz
   domyslna regula przegladarki `[hidden] { display: none }` (pochodzi z
   arkusza uzytkownika, kazda regula autorska ja przebija niezaleznie od
   specyficznosci) - bez tego zastrzezenia karta byla widoczna ZAWSZE,
   rowniez z atrybutem hidden, wiec mapa pojawiala sie na Pulpicie mimo
   braku zawezenia do drogi, a wykres obok NIE rozszerzal sie do pelnej
   szerokosci (zgloszone 2026-09-23). */
#road-map-card:not([hidden]) { display: flex; flex-direction: column; }
#road-map { flex: 1 1 auto; min-height: 200px; margin-bottom: 0; }
.road-map-caption { margin: 12px 0 0; flex: none; }

/* ---------------- Tables ---------------- */
.table-toolbar {
  display: flex; gap: 14px; align-items: center;
  flex-wrap: wrap; margin-bottom: 14px;
}
.table-toolbar input[type="search"] {
  flex: 0 1 240px; padding: 7px 12px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text); font: inherit; font-size: 13px;
}
.table-scroll { overflow-x: auto; }

table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th {
  text-align: left; font-weight: 600; color: var(--muted);
  font-size: 11px; text-transform: uppercase; letter-spacing: .5px;
  padding: 9px 12px; border-bottom: 1px solid var(--border);
  white-space: nowrap; position: sticky; top: 0; background: var(--surface);
}
table.data th[data-sort] { cursor: pointer; user-select: none; }
table.data th[data-sort]:hover { color: var(--accent); }
table.data th.sorted::after { content: " ↓"; color: var(--accent); }
table.data th.sorted.asc::after { content: " ↑"; }
table.data td {
  padding: 9px 12px; border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.data tbody tr:hover td { background: var(--surface-2); }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }
/* Wiersz drogi (zakladka Drogi) klikalny - otwiera boczna karte statystyk. */
#road-table tbody tr.road-row { cursor: pointer; }
#road-table tbody tr.road-row .executor-cell { cursor: text; }

/* Tabela Drogi - wiekszy, czytelniejszy tekst (2026-09-23, na wyrazna
   prosbe: "tekst 14-16 px, numer drogi 16 px i pogrubiony, wysokosc wiersza
   ok. 52 px"). Scope'owane do #road-table (NIE do generycznego table.data),
   zeby nie zmienic innych tabel (Zmiany, Kontrola jakosci, Zgloszenia). */
#road-table { font-size: 15px; }
#road-table td { padding: 16px 14px; }
#road-table .road-name { font-size: 16px; font-weight: 700; }

/* Naprzemienne tlo wierszy - zastepuje usuniety znak wodny pod tabela
   (patrz #view-roads::before nizej). */
#road-table tbody tr:nth-child(even) td { background: rgba(var(--surface-rgb), .4); }
#road-table tbody tr.road-row.selected td { background: var(--accent-soft); }

/* Status wg reguly (STAGE_DONE_THRESHOLD) - plakietka tekstowa, odrebna od
   kolorowanego % w kolumnach etapow (2026-09-23, na wyrazna prosbe: status
   "nie moze wynikac tylko z zielonego koloru procentu"). */
.status-badge {
  display: inline-block; padding: 3px 10px; border-radius: 99px;
  font-size: 11px; font-weight: 700; white-space: nowrap;
}
.status-badge.status-done { background: rgba(46, 194, 107, .16); color: var(--green); }
.status-badge.status-progress { background: rgba(240, 180, 41, .16); color: var(--amber); }
.status-badge.status-none { background: var(--surface-2); color: var(--muted); }

.road-details-link { color: var(--accent); font-size: 13px; font-weight: 600; white-space: nowrap; }
#road-table tbody tr.road-row:hover .road-details-link { text-decoration: underline; }

/* ---------------- Następna droga ---------------- */
.status-badge.rel-high { background: rgba(46, 194, 107, .16); color: var(--green); }
.status-badge.rel-medium { background: rgba(240, 180, 41, .16); color: var(--amber); }
.status-badge.rel-low { background: rgba(214, 69, 65, .14); color: var(--red); }
#rp-table tbody tr { cursor: pointer; }
#rp-table tbody tr:hover { background: var(--surface-2); }
.rp-basis-note {
  margin: 0 0 12px; padding: 7px 12px; border-radius: 8px;
  background: var(--accent-soft); color: var(--text); font-size: 12.5px;
}
.rp-reason { color: var(--muted); font-size: 12px; max-width: 420px; }
/* Trzy etapy = trzy geometrie: kolor + ikona w naglowku i cienki pasek w
   komorkach kolumny, zeby kolumny byly wyraznie rozdzielone. */
/* kolory etapów wspólne dla całej aplikacji (2026-10-07) */
.rp-st-1 { --rp-st: var(--s1); }
.rp-st-2 { --rp-st: var(--s2); }
.rp-st-3 { --rp-st: var(--s3); }
table.data th.rp-stage-th { color: var(--rp-st); border-bottom: 2px solid var(--rp-st); }
table.data td.rp-stage-td { border-left: 3px solid color-mix(in srgb, var(--rp-st) 45%, transparent); min-width: 150px; }
.rp-stage-name { display: inline-flex; align-items: center; gap: 6px; font-weight: 650; }
.rp-stage-name svg { width: 15px; height: 15px; flex: none; }
.rp-stage-done { color: var(--green); font-weight: 600; }
.rp-stage-none { color: var(--muted); font-weight: 600; }
.rp-cell-sub { color: var(--muted); font-size: 11.5px; line-height: 1.35; margin-top: 2px; max-width: 230px; }
#rp-stage-table td { vertical-align: top; }
.rp-total {
  margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border);
  font-size: 13px; line-height: 1.6;
}
.rp-total b { font-size: 15px; }

.rp-summary-grid {
  display: grid; gap: 14px; margin: 14px 0 4px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.rp-summary-item { }
.rp-summary-label {
  color: var(--muted); font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .5px;
}
.rp-summary-value { font-size: 19px; font-weight: 680; margin-top: 4px; }
.rp-summary-value .muted { font-size: 12px; font-weight: 400; }

.rp-materials-list { display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.rp-materials-list .ok { color: var(--green); }
.rp-materials-list .bad { color: var(--red); }

.rp-methodology-box {
  font-size: 13px; line-height: 1.6;
}
ul.rp-methodology-box { margin: 0; padding-left: 18px; }
ul.rp-methodology-box li { margin-bottom: 6px; }
.rp-methodology-box dt { color: var(--muted); font-size: 11.5px; margin-top: 8px; }
.rp-methodology-box dd { margin: 2px 0 0; font-weight: 600; }
.rp-compared-roads { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.rp-compared-roads span {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 6px; padding: 2px 8px; font-size: 12px;
}
table.data.compact td { padding: 6px 8px; }
table.data.compact input {
  width: 100%; padding: 6px 9px; border-radius: 7px;
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text); font: inherit; font-size: 12.5px;
}
.road-name { font-weight: 620; }
/* Tablica z numerem drogi (redesign 2026-10-06) - żółta z czarnym numerem,
   jak znak E-15c drogi wojewódzkiej. Używana w tabelach zamiast "DW 123". */
.road-plate {
  display: inline-grid; place-items: center; min-width: 42px; height: 24px;
  padding: 2px 6px 0; border-radius: 3px; line-height: 1;
  background: var(--plate); color: var(--plate-ink);
  box-shadow: inset 0 0 0 1.5px var(--plate-ink);
  font-weight: 800; font-size: 14px; white-space: nowrap;
}
#road-table .road-plate { min-width: 52px; height: 28px; font-size: 16px; }

.executor-cell { cursor: pointer; min-width: 160px; }
.executor-cell:hover .executor-view { color: var(--accent); }
.executor-input {
  width: 100%; padding: 6px 9px; border-radius: 7px;
  border: 1px solid var(--accent); background: var(--surface-2);
  color: var(--text); font: inherit; font-size: 12.5px;
}

/* pasek postępu w komórce tabeli */
.cell-progress { display: flex; align-items: center; gap: 9px; min-width: 148px; }
.cell-progress .bar { flex: 1; height: 5px; }
.cell-progress span.val {
  font-variant-numeric: tabular-nums; font-size: 12px;
  min-width: 44px; text-align: right; font-weight: 560;
}

.legend, .map-legend {
  display: flex; gap: 16px; align-items: center;
  color: var(--muted); font-size: 12px; flex-wrap: wrap;
}
.legend { margin-left: auto; }
.dot { width: 9px; height: 9px; border-radius: 3px; display: inline-block; margin-right: 6px; }
.dot.red { background: var(--red); }
.dot.amber { background: var(--amber); }
.dot.green { background: var(--green); }

.pos { color: var(--green); }
.neg { color: var(--red); }
.delta-summary { margin-left: auto; color: var(--muted); font-size: 12.5px; }

/* ---------------- Mapa ---------------- */
.map-card { padding: 14px; }
.map-legend { margin-bottom: 12px; padding: 0 4px; }
.map-search {
  display: flex; gap: 6px; align-items: center; margin-left: auto;
}
.map-search input[type="search"] {
  width: 170px; padding: 6px 10px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text); font: inherit; font-size: 12.5px;
}
.map-search input[type="search"]:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.map-wrap { position: relative; }
#map {
  height: calc(100vh - 230px); min-height: 420px;
  border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-2);
}
/* Podpowiedz przyblizenia (Mapa) - widoczna dopoki uzytkownik nie dotrze do
   zoomu, od ktorego doladowuja sie Etap 1/2/3 (odcinki + znaki), znika sama
   po przekroczeniu progu (patrz updateMapZoomHint w app.js). */
.map-zoom-hint {
  /* dol, wysrodkowane - gora jest zajeta przez wlasne kontrolki Leaflet
     (zoom w lewym gornym rogu, przelacznik warstw w prawym), wiec u gory
     pigulka nachodzilaby na nie przy waskiej mapie */
  position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%);
  z-index: 1000; display: flex; align-items: center; gap: 10px;
  background: var(--surface-2); border: 1px solid var(--accent);
  color: var(--text); font-size: 12.5px;
  padding: 8px 10px 8px 14px; border-radius: 99px;
  box-shadow: var(--shadow);
  max-width: calc(100% - 28px);
}
.map-zoom-hint button { flex: none; padding: 5px 12px; font-size: 12px; }
.map-zoom-hint[hidden] { display: none; }
@media (max-width: 480px) {
  .map-zoom-hint { flex-wrap: wrap; justify-content: center; border-radius: 14px; font-size: 12px; }
}

.pzdw-iframe {
  width: 100%; height: calc(100vh - 260px); min-height: 420px;
  border-radius: 10px; border: 1px solid var(--border);
  background: #fff;
}

.an-result-bar { display: flex; gap: 8px; margin-bottom: 10px; }

/* Kilometraż (styl km.qml, sparsowany 2026-08-11) - kreska co pelny km
   (wewnetrzny div obracany wg pola "angle" z bazy - patrz app.js, komentarz
   przy kmPreview) i czerwona gwiazdka na wezlach. Wrapper przezroczysty,
   bez wlasnego tla/obramowania - to on ma explicite iconSize w L.divIcon,
   wiec Leaflet centruje go automatycznie (inaczej niz .road-number-label/
   .sign-pikietaz-label, ktore NIE ustawiaja iconSize i dlatego potrzebuja
   wlasnego transform:translate(-50%,-50%) + width:auto!important). */
.km-node-wrap, .km-full-wrap, .km-tiny-wrap {
  /* NIE dotykac width/height - Leaflet i tak ustawia je inline z iconSize
     podanego w L.divIcon(); nadpisanie ich na "100%" (poprzedni blad, patrz
     historia commitow) liczylo sie wzgledem .leaflet-marker-pane (caly
     obszar mapy), nie wzgledem rozmiaru ikony ktory tu chcemy - wrapper
     robil sie ogromny i przesuwal tresc daleko od faktycznego punktu,
     wygladajac jak "nic sie nie wyswietla". */
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: none;
}
/* Kreska + podpis PELNEGO kmglob (np. "76+300") OBOK, w jednym obracanym
   kontenerze (.km-full-inner) - zeby liczba biegla rownolegle do kreski,
   nie zawsze poziomo. flex+gap zamiast marginesu, zeby dzialalo tak samo
   niezaleznie od kierunku obrotu. Pelny km (.km-tick-big/.km-num) WIEKSZY/
   GRUBSZY niz zwykle 100m (.km-tick/.km-num-small) - na zyczenie
   uzytkownika 2026-08-11. */
/* 2026-10-06 (na prosbe - "przy przyblizeniu kilometry nie do odczytania"):
   kreska nadal obrocona w poprzek drogi (.km-tick-rot), ale PODPIS ZAWSZE
   POZIOMO, w ciemnej pastylce obok kreski - czytelny na OSM i ortofotomapie.
   Etykieta wychodzi poza iconSize (24x24) - celowo, pozycja absolutna
   wzgledem srodka punktu. */
/* absolute (NIE relative): znacznik Leaflet musi być pozycjonowany absolutnie -
   przy relative każda kolejna kreska km spadała w dół o wysokość poprzednich
   i kilometraż "rozjeżdżał się" z osią drogi (wykryte 2026-10-08). Absolute
   nadal jest punktem odniesienia dla podpisu .km-lbl. */
.km-full-wrap { position: absolute; overflow: visible; }
/* w trakcie animacji przybliżania kreski km są ukryte (patrz app.js, map-zooming) */
.map-zooming .km-node-wrap, .map-zooming .km-full-wrap, .map-zooming .km-tiny-wrap { visibility: hidden; }
.km-tick-rot { display: flex; align-items: center; justify-content: center; }
/* mniejsze kreski i podpisy (2026-10-08, na prośbę - po naprawie pozycji
   wszystkie znaczniki są widoczne naraz i były za duże) */
.km-tick { width: 8px; height: 2px; background: #D5B43C; border-radius: 1px; flex: 0 0 auto;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .4); }
.km-tick-big { width: 14px; height: 3px; background: #D5B43C; border-radius: 1px; flex: 0 0 auto;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .5); }
.km-lbl {
  position: absolute; left: calc(50% + 9px); top: 50%; transform: translateY(-50%);
  white-space: nowrap; pointer-events: none;
  background: rgba(17, 20, 26, .86); color: #fff;
  border: 1px solid rgba(213, 180, 60, .9); border-radius: 6px;
  font-family: "Overpass", "Segoe UI", system-ui, sans-serif; font-variant-numeric: tabular-nums;
  line-height: 1; box-shadow: 0 1px 3px rgba(0, 0, 0, .35);
}
.km-lbl-full { font-size: 10.5px; font-weight: 700; padding: 2px 5px; border-radius: 4px; color: #FFE08A; }
.km-lbl-100 { font-size: 9.5px; font-weight: 600; padding: 1px 4px; border-radius: 4px; }
.km-hide-100 .km-lbl-100 { display: none; }
/* przy mniejszym przybliżeniu same pełne kilometry - kreski co 100 m dopiero bliżej */
.km-hide-100tick .km-100 { display: none; }
/* Pojedyncze metry (tryb dense, KM_DENSE_MIN_ZOOM+) - najmniejsza kreska,
   bez podpisu (patrz app.js, komentarz przy kmPreview). Przezroczystosc
   nizsza - to "wypelnienie" miedzy podpisanymi wielokrotnosciami 100 m,
   ma byc widoczne ale nie odciagac uwagi od nich. */
.km-tick-tiny { width: 6px; height: 1px; background: #D5B43C; opacity: .75; }
/* siatka metrowa (2026-10-08): co 10 m dłuższa kreska i numer metra */
.km-tiny-wrap { overflow: visible; }
.km-tick-10 { width: 10px; height: 2px; background: #D5B43C; box-shadow: 0 0 0 1px rgba(0, 0, 0, .35); }
.km-lbl-10 { font-size: 9px; font-weight: 600; padding: 1px 3px; border-radius: 3px; left: calc(50% + 7px); }
.km-hide-10 .km-10:not(.km-50) .km-lbl-10 { display: none; }
.km-node {
  width: 14px; height: 14px; background: #B80808;
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%,
                     21% 91%, 32% 57%, 2% 35%, 39% 35%);
}

.an-map {
  height: 380px; margin-bottom: 14px;
  border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-2);
}
/* Karta "Droga"/"Obręb" w wynikach analizy niesie tylko krotki tytul (2-3
   linie tekstu) - wyciagnieta POZA .kpi-grid, zeby domyslne align-items:
   stretch w CSS Grid nie rozciagalo jej do wysokosci sasiedniej karty Etapu
   (ktora ma dlugą tabelę rozkladu) - to byla przyczyna ogromnej pustej
   przestrzeni pod tytulem drogi. Odzyskana szerokosc trafia do kart Etapow:
   szerszy minmax = mniej kart w rzedzie, mniej przewijania w tabelach
   (.an-breakdown-wrap). */
.an-label-card { max-width: 320px; }
/* Etap 1 (8 kolumn z farba) potrzebuje wiecej miejsca niz zmiesci sie obok
   Etap 2/3 w jednym rzedzie bez przewijania - stad wlasny pelnoszerokosciowy
   wiersz (ograniczony max-width, zeby nie rozciagal sie absurdalnie przy
   malej liczbie wierszy). Etap 2 (3 kolumny, statystyki malowania usuniete
   2026-08-13) i Etap 3 (2 kolumny) dzielą wezszy wiersz ponizej. */
.an-stage1-row > .card.kpi { max-width: 640px; }
.an-stage-grid { grid-template-columns: minmax(230px, 1fr) minmax(190px, 0.8fr); }
@media (max-width: 860px) {
  .an-stage-grid { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
}
.ai-sql {
  white-space: pre-wrap; word-break: break-word; font-size: 12px;
  background: var(--surface-2); border-radius: 8px; padding: 8px 10px;
  margin: 6px 0; color: var(--muted);
}
.an-breakdown-wrap { overflow-x: auto; max-width: 100%; margin-top: 6px; }
.an-breakdown { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.an-breakdown th, .an-breakdown td { text-align: left; padding: 4px 8px; }
.an-breakdown th { color: var(--muted); font-weight: 600; }
.an-breakdown td.num, .an-breakdown th.num { text-align: right; }
.an-breakdown tr:nth-child(even) { background: var(--surface-2); }

#kpi-detail-card { position: relative; }
.kpi-detail-collapse-btn {
  position: absolute; top: 12px; right: 12px;
  background: var(--surface-2); color: var(--muted);
  border: 1px solid var(--border); border-radius: 6px;
  font-size: 12px; padding: 4px 10px; cursor: pointer;
}
.kpi-detail-collapse-btn:hover { color: var(--text); border-color: var(--muted); }
.leaflet-popup-content-wrapper {
  background: var(--surface); color: var(--text);
  border-radius: 12px; box-shadow: var(--shadow);
}
.leaflet-popup-tip { background: var(--surface); }
/* Zolta tabliczka z numerem drogi na warstwie "Pokrycie ewidencja" - jak
   na referencyjnej mapie podzialu RDW. Zwykly L.marker/divIcon (patrz
   initMap w app.js), nie tooltip - szerokosc jest automatyczna (rozna
   dlugosc numeru drogi), wiec wlasny transform centruje etykiete na
   punkcie niezaleznie od jej faktycznej szerokosci po wyrenderowaniu. */
.road-number-label {
  /* L.DivIcon domyslnie ma iconSize:[12,12] (patrz app.js - nie
     nadpisujemy go explicite), a Leaflet ustawia to jako INLINE
     width/height na elemencie - bez !important to zawsze wygrywa z
     paddingiem/font-size ponizej, tnac tabliczke do ciasnego 12x12 px
     kwadratu niezaleznie od dlugosci numeru drogi. */
  width: auto !important; height: auto !important;
  background: var(--plate); color: var(--plate-ink); font-weight: 800; font-size: 12px;
  border: 1.5px solid var(--plate-ink); border-radius: 3px; padding: 3px 7px 1px;
  white-space: nowrap; transform: translate(-50%, -50%);
  line-height: normal; display: inline-block;
}
.road-number-click { cursor: pointer; }
.sign-pikietaz-label {
  /* Ta sama pulapka co .road-number-label wyzej (domyslny iconSize L.DivIcon
     tnie tabliczke do 12x12px bez tego !important). */
  width: auto !important; height: auto !important;
  background: rgba(255, 255, 255, 0.72); color: #1a1a1a; font-weight: 700; font-size: 10px;
  border: 1px solid rgba(122, 98, 0, 0.5); border-radius: 3px; padding: 2px 5px;
  white-space: nowrap; transform: translate(-50%, -130%);
  line-height: 1.25; display: inline-block; text-align: center;
}

/* ---------------- Dymki przy najechaniu na obiekty mapy ---------------- */
/* Leaflet domyslnie rysuje dymek jako bialy prostokat z ciemnym tekstem.
   Problem: w tresci uzywamy klasy .muted (patrz bindStageTooltip i dymek
   warstwy "Pokrycie ewidencja" w app.js), a w ciemnym motywie --muted to
   #8b98a5 - na bieli daje to kontrast ok. 2,6:1, czyli tekst ledwo czytelny.
   Dlatego dymek przejmuje powierzchnie i kolory aplikacji, wtedy .muted
   dziala tak, jak zostal zaprojektowany. Strzalka musi dostac ten sam kolor
   osobno - Leaflet rysuje ja borderem, nie tlem. */
.leaflet-tooltip {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 7px;
  box-shadow: var(--shadow); font: inherit; font-size: 12.5px;
  padding: 7px 10px; line-height: 1.45;
}
.leaflet-tooltip-top::before { border-top-color: var(--surface); }
.leaflet-tooltip-bottom::before { border-bottom-color: var(--surface); }
.leaflet-tooltip-left::before { border-left-color: var(--surface); }
.leaflet-tooltip-right::before { border-right-color: var(--surface); }

/* Recznie dorobione grupowanie w kontrolce warstw (Leaflet tego nie ma) —
   patrz initMap() w app.js. Kolory dobrane pod domyslny, jasny wyglad
   kontrolki Leaflet (nie pod ciemny motyw aplikacji). */
.leaflet-control-layers-overlays label.layer-group-label {
  display: block; font-weight: 700; font-size: 12px; color: #333;
  margin: 6px 0 1px; padding-left: 2px; cursor: pointer;
}
.leaflet-control-layers-overlays label.layer-group-label input {
  margin-right: 4px;
}
.leaflet-control-layers-overlays label.layer-indent { padding-left: 18px; }
.leaflet-control-layers-overlays label.layer-indent-2 { padding-left: 34px; }
.popup h3 { margin: 0 0 8px; font-size: 15px; }
.popup table { width: 100%; font-size: 12px; border-collapse: collapse; }
.popup td { padding: 3px 0; }
.popup td:last-child { text-align: right; font-weight: 600; }
.popup .sep { border-top: 1px solid var(--border); }

/* Domyslny znacznik Etapu 3 dla obiektow bez wlasnej ikonki (kod spoza
   ~403 pokrytych piktogramow) - element DOM (nie ksztalt na canvasie),
   zeby najechanie mysza i podpowiedz dzialaly tak samo niezawodnie jak
   dla znacznikow z prawdziwymi piktogramami. */
.stage3-dot-icon {
  width: 12px; height: 12px; border-radius: 50%;
  background: #85B66F; border: 1.5px solid #232323;
  box-sizing: border-box;
}

/* ---------------- Formularze ---------------- */
.form-grid {
  display: grid; gap: 13px 18px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.form-grid label {
  display: flex; flex-direction: column; gap: 5px;
  font-size: 12px; color: var(--muted); font-weight: 550;
}
.form-grid label.wide { grid-column: 1 / -1; }
.form-grid input, select {
  padding: 8px 11px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text); font: inherit; font-size: 13px;
}
.form-grid input:focus, select:focus, .table-toolbar input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.ollama-model-row { display: flex; gap: 8px; align-items: stretch; }
.ollama-model-row select { flex: 1; min-width: 0; }
.test-result { font-size: 12.5px; }
.test-result.ok { color: var(--green); }
.test-result.err { color: var(--red); }

.tables-list {
  margin-top: 12px; max-height: 240px; overflow: auto;
  font-size: 12px; color: var(--muted);
  display: grid; gap: 3px;
}
.tables-list b { color: var(--text); }

/* ---------------- Toast ---------------- */
.toast {
  /* right 120px: prawy dolny rog zajmuje od 2026-10-06 ikona Asystenta GIS
     (right 40 + 68 + 12) */
  position: fixed; bottom: 24px; right: 120px; z-index: 999;
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 10px; padding: 12px 18px; box-shadow: var(--shadow);
  font-size: 13px; opacity: 0; transform: translateY(10px);
  pointer-events: none; transition: opacity .25s, transform .25s;
  max-width: 460px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.err { border-left-color: var(--red); }
.toast.ok { border-left-color: var(--green); }

/* ---------------- Ekran logowania ---------------- */
.login-body {
  display: grid; place-items: center; min-height: 100vh;
  padding: 24px; background: var(--bg);
}
/* ekran logowania na czerni — logo w wersji kontrowej */
:root[data-theme="dark"] .login-body { background: #000; }
:root[data-theme="dark"] .login-card { background: #0a0d11; border-color: #1e262f; }

.login-wrap { width: 100%; max-width: 380px; display: grid; gap: 14px; }
.login-card { margin: 0; padding: 30px 30px 24px; }

.login-head { text-align: center; margin-bottom: 22px; }
.login-logo {
  height: 200px; width: auto; max-width: 100%; object-fit: contain;
  display: block; margin: 0 auto 18px;
}
.login-org {
  font-size: 14px; font-weight: 650; line-height: 1.35;
  letter-spacing: -.1px; color: var(--text);
}
.login-app {
  margin-top: 7px; font-size: 12px; color: var(--muted);
  text-transform: uppercase; letter-spacing: .9px; font-weight: 600;
}

/* atrybut hidden musi wygrywać z display ustawionym poniżej */
.login-form[hidden], .user-box[hidden] { display: none !important; }

.login-form { display: grid; gap: 13px; }
.login-form label {
  display: flex; flex-direction: column; gap: 5px;
  font-size: 12px; color: var(--muted); font-weight: 550;
}
.login-form input {
  padding: 9px 12px; border-radius: 9px; font: inherit; font-size: 13.5px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
}
.login-form input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.login-btn { justify-content: center; margin-top: 5px; padding: 10px; }

.login-note {
  font-size: 12px; line-height: 1.5; color: var(--muted);
  background: var(--accent-soft); border: 1px solid var(--accent);
  border-radius: 9px; padding: 10px 12px;
}
.login-msg { font-size: 12.5px; min-height: 17px; color: var(--muted); }
.login-msg.err { color: var(--red); }
.login-foot {
  margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--border);
  font-size: 11px; color: var(--muted); text-align: center;
}
.login-theme { justify-self: center; }

/* ---------------- Kto jest online (dolna czesc paska bocznego) ---------------- */
/* Ten sam sygnal co .chat-online w panelu czatu (odpytywane razem, patrz
   renderOnline w app.js), ale zawsze widoczny w pasku bocznym, nie tylko
   po otwarciu czatu. */
.sidebar-online:empty { display: none; }
.sidebar-online-label {
  font-size: 10.5px; font-weight: 650; text-transform: uppercase;
  letter-spacing: .5px; color: var(--muted); margin-bottom: 6px;
}
.sidebar-online-chip {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 2px; font-size: 12px; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---------- Nieobecni / na zdalnym (arkusz Google, patrz absence.py) ---------- */
.sidebar-absence:empty { display: none; }
.sidebar-absence-label {
  font-size: 10.5px; font-weight: 650; text-transform: uppercase;
  letter-spacing: .5px; color: var(--muted); margin-bottom: 6px;
}
.sidebar-absence-label:not(:first-child) { margin-top: 8px; }
.sidebar-absence-chip {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 2px; font-size: 12px; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sidebar-absence-dot {
  width: 7px; height: 7px; border-radius: 50%; flex: 0 0 7px;
}
.sidebar-absence-chip.absent .sidebar-absence-dot { background: var(--red); }
.sidebar-absence-chip.remote .sidebar-absence-dot { background: var(--accent); }

/* ---------------- Konto zalogowanego użytkownika ---------------- */
.user-box {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 10px; border-radius: 9px;
  background: var(--surface-2); border: 1px solid var(--border);
}
.user-avatar {
  width: 26px; height: 26px; flex: 0 0 26px; border-radius: 50%;
  display: grid; place-items: center; font-size: 11px; font-weight: 700;
  background: var(--accent); color: #fff; text-transform: uppercase;
}
.user-meta { min-width: 0; flex: 1; }
.user-name {
  font-size: 12px; font-weight: 600; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-role { font-size: 10.5px; color: var(--muted); }
.user-logout {
  background: none; border: 0; cursor: pointer; padding: 3px 5px;
  color: var(--muted); font: inherit; font-size: 14px; border-radius: 6px;
}
.user-logout:hover { color: var(--red); background: var(--surface); }

/* elementy widoczne tylko dla administratora */
.admin-only[hidden] { display: none !important; }
/* bez tej reguly .nav-item (display:flex) zaslanial atrybut hidden i konta
   podgladu widzialy zakladki Zmiany/Kontrola jakosci/Raporty/Zgloszenia */
.staff-only[hidden] { display: none !important; }

table.data.users td { vertical-align: middle; }
.role-badge {
  display: inline-block; font-size: 10.5px; font-weight: 650;
  padding: 2px 9px; border-radius: 99px;
  background: var(--accent-soft); color: var(--accent);
  border: 1px solid var(--accent);
}
.role-badge.viewer {
  background: var(--surface-2); color: var(--muted); border-color: var(--border);
}
.role-badge.operator {
  background: rgba(217, 164, 6, .15); color: var(--yellow, #d9a406);
  border-color: var(--yellow, #d9a406);
}
.logo-swatch {
  display: grid; place-items: center; width: 72px; height: 72px;
  border-radius: 10px; border: 1px solid var(--border); padding: 7px;
}
.logo-swatch img { max-width: 100%; max-height: 100%; object-fit: contain; }
.btn-danger {
  background: none; border: 1px solid var(--border); color: var(--muted);
  font: inherit; font-size: 12px; padding: 4px 10px; border-radius: 7px;
  cursor: pointer;
}
.btn-danger:hover { color: var(--red); border-color: var(--red); }

@media (max-width: 860px) {
  .sidebar { width: 64px; flex: 0 0 64px; padding: 16px 8px; }
  .brand { justify-content: center; padding: 2px 0 14px; }
  .brand-text, .nav-label, .nav-group-label, .version, .readonly-note { display: none; }
  .nav-group + .nav-group { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border); }
  .nav-item.active::before { left: -8px; }
  .nav-item .chat-badge { position: absolute; top: 2px; right: 2px; }
  .user-meta { display: none; }
  .user-box { justify-content: center; padding: 8px 4px; }
  .nav-item { justify-content: center; }
  .main { padding: 18px 14px 32px; }
}

/* ---------------- Czat zespołu ---------------- */
/* Wpięty w pasek boczny jako zwykła pozycja nawigacji (patrz #chat-toggle w
   index.html) — panel wysuwa się obok paska, nie jako oddzielny pływający
   przycisk na stronie. */
.nav-item .chat-badge {
  margin-left: auto;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px;
  background: var(--red); color: #fff; font-size: 10.5px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.chat-badge[hidden] { display: none; }
/* Licznik trwających utrudnień - sama liczba czerwoną czcionką, bez kółka
   i tła (2026-10-20, na prośbę) */
.nav-item #utr-badge {
  min-width: 0; height: auto; padding: 0; border-radius: 0; background: none; flex: 0 0 auto;
  color: var(--red); font-size: 12.5px; font-weight: 700;
}
@media (max-width: 860px) {
  .nav-item #utr-badge { top: 0; right: 2px; font-size: 10.5px; }
}
/* liczba + „N nowe” muszą się zmieścić w szerokości paska (2026-10-20) */
.nav-item[data-view="utrudnienia"] { gap: 7px; }
.nav-item[data-view="utrudnienia"] .nav-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item[data-view="utrudnienia"] .utr-new-badge { margin-left: 0; padding: 3px 5px; flex: 0 0 auto; }

.chat-panel {
  position: fixed; left: 248px; bottom: 24px; z-index: 900;
  width: 340px; max-width: calc(100vw - 272px);
  height: 460px; max-height: calc(100vh - 48px);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  display: flex; flex-direction: column; overflow: hidden;
}
.chat-panel[hidden] { display: none; }
.chat-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 13.5px;
}
.chat-close {
  background: none; border: none; color: var(--muted); cursor: pointer;
  font-size: 14px; padding: 2px 6px; border-radius: 6px;
}
.chat-close:hover { color: var(--text); background: var(--surface-2); }

.chat-online {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 9px 14px; border-bottom: 1px solid var(--border);
}
.chat-online:empty::before {
  content: "nikt nie jest teraz online";
  color: var(--muted); font-size: 11.5px;
}
.chat-online-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 99px; padding: 3px 9px 3px 6px; font-size: 11.5px;
}
.chat-online-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--green);
  box-shadow: 0 0 0 2px rgba(46,194,107,.2);
}

.chat-messages {
  flex: 1; overflow-y: auto; padding: 12px 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.chat-messages:empty::before {
  content: "Brak wiadomości — napisz pierwszą.";
  color: var(--muted); font-size: 12.5px;
}
.chat-msg { font-size: 13px; line-height: 1.4; }
.chat-msg-meta {
  display: flex; gap: 7px; align-items: baseline; margin-bottom: 2px;
}
.chat-msg-user { font-weight: 650; color: var(--accent); font-size: 12px; }
.chat-msg.own .chat-msg-user { color: var(--green); }
.chat-msg-time { color: var(--muted); font-size: 10.5px; }
.chat-msg-text { white-space: pre-wrap; word-break: break-word; }

.chat-form {
  display: flex; gap: 8px; padding: 10px 12px;
  border-top: 1px solid var(--border);
}
.chat-form input {
  flex: 1; min-width: 0; background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 9px; padding: 8px 11px;
  font: inherit; font-size: 13px;
}
.chat-form input:focus { outline: none; border-color: var(--accent); }

@media (max-width: 860px) {
  .chat-panel { left: 76px; max-width: calc(100vw - 88px); }
}

/* ---------------- Kontrola jakości danych ---------------- */
.quality-grid {
  display: grid; gap: 14px; margin: 0 0 18px;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}
.quality-card { margin-bottom: 0; border-left: 3px solid var(--border); }
.quality-card.bad { border-left-color: var(--amber); }
.quality-card.ok { border-left-color: var(--green); }
.quality-card-label {
  color: var(--text); font-size: 13px; font-weight: 700; padding-right: 34px;
}
.quality-card-value {
  font-size: 26px; font-weight: 680; margin: 8px 0 6px; letter-spacing: -.5px;
}
.quality-card.bad .quality-card-value { color: var(--amber); }
.quality-card.ok .quality-card-value { color: var(--green); }
.quality-card-desc { color: var(--muted); font-size: 11.5px; }
.quality-card.clickable { cursor: pointer; }
.quality-card.clickable:hover { border-color: var(--accent); transform: translateY(-2px); }
.quality-card.clickable:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.quality-card.pinned {
  border-left-color: var(--accent);
  box-shadow: var(--shadow), 0 0 0 2px var(--accent-soft) inset;
}

#quality-table tbody tr { cursor: pointer; }
#quality-table tbody tr:hover { background: var(--surface-2); }

/* ---------------- Modal: szczegóły błędu jakości ---------------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 950;
  background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.modal-overlay[hidden] { display: none; }
.modal {
  width: 100%; max-width: 480px; max-height: calc(100vh - 48px);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  display: flex; flex-direction: column; overflow: hidden;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--border); font-size: 14px;
}
.modal-body { padding: 14px 16px; overflow-y: auto; font-size: 13px; }
.modal-body p { margin: 0 0 10px; }
.modal-meta { color: var(--muted); font-size: 12px; margin-bottom: 12px; }
.sample-list { display: grid; gap: 6px; }
.sample-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 11px; font-size: 12.5px;
}
.sample-row a { color: var(--accent); text-decoration: none; font-weight: 600; }
.sample-row a:hover { text-decoration: underline; }
.qgis-copy-btn {
  background: none; border: 0; color: var(--accent); font: inherit;
  font-weight: 600; font-size: 12.5px; cursor: pointer; padding: 0;
  white-space: nowrap;
}
.qgis-copy-btn:hover { text-decoration: underline; }

/* ==========================================================================
   ANALIZY GIS — przebudowa 2026-09-22
   Cala sekcja jest ZAKRESOWANA do #view-analizy. To celowe: reszta zakladek
   ma zostac nietknieta, a ta jedna dostaje wlasne, spojne pola formularzy
   (domyslne <select>/<input> renderowaly sie bialo na ciemnym motywie, bo
   aplikacja nie miala dotad globalnych stylow kontrolek).
   ========================================================================== */

/* Znak wodny z logo przeszkadzal w czytaniu formularzy i liczb - tylko tutaj
   go zdejmujemy, na pozostalych zakladkach zostaje. */
#view-analizy::before { display: none; }
#view-analizy .card { background: var(--surface); }

/* Atrybut `hidden` musi wygrywac z wlasnym display elementu. Bez tego pola
   filtrow (.an-field to flex), podzial mapa/tabela (.an-split to grid) i
   plakietka "przelicz ponownie" (.an-badge to inline-flex) pokazywaly sie
   mimo ustawionego hidden — znalezione na makiecie ukladu 2026-09-22.
   Specyficznosc (1,1,0) wygrywa tez z `.an-pane { display: block !important }`
   z zapytania medialnego nizej. */
#view-analizy [hidden] { display: none !important; }

/* ------------------------------------------------------------- naglowek */
.an-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 18px; flex-wrap: wrap; margin-bottom: 16px;
}
.an-title { font-size: 22px; font-weight: 680; letter-spacing: -.3px; margin: 0 0 4px; }
.an-lead { color: var(--muted); font-size: 13px; margin: 0; max-width: 62ch; }
.an-head-side { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.an-badge {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 11.5px; font-weight: 600; padding: 6px 12px; border-radius: 99px;
  background: var(--accent-soft); color: var(--accent);
  border: 1px solid var(--accent); white-space: nowrap;
}
.an-badge::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: currentColor; flex: 0 0 auto;
}
/* Bursztyn, nie czerwien - to ostrzezenie "przelicz ponownie", nie blad.
   Czerwony w tej zakladce jest zarezerwowany wylacznie dla bledow. */
.an-badge-stale { background: rgba(210, 153, 34, .14); color: var(--amber); border-color: var(--amber); }

/* ------------------------------------------------- wejscie do asystenta */
/* Asystent to jedno z glownych narzedzi tej zakladki, wiec dostaje wlasny,
   szeroki przycisk-kafelek w kolorze akcentu, a nie drobny przycisk w rogu
   naglowka (zgloszone 2026-09-22: "jest malo widoczny"). Sam panel nadal
   wysuwa sie z boku, zeby nie zajmowac gory strony na stale. */
.an-ai-launcher {
  display: flex; align-items: center; gap: 16px; width: 100%;
  margin: 0 0 16px; padding: 15px 18px; cursor: pointer; text-align: left;
  font: inherit; color: var(--text);
  background: var(--accent-soft); border: 1px solid var(--accent);
  border-radius: var(--radius);
  transition: background .15s, box-shadow .15s;
}
.an-ai-launcher:hover { background: rgba(76, 141, 255, .22); box-shadow: var(--shadow); }
.an-ai-icon {
  flex: 0 0 auto; width: 48px; height: 58px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  font-size: 19px;
  overflow: hidden;
}
.an-ai-icon img { width: 100%; height: 100%; object-fit: fill; }
.an-ai-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1 1 auto; }
.an-ai-text b { font-size: 15px; font-weight: 650; }
.an-ai-text span { color: var(--muted); font-size: 12.5px; }
/* Zielony, tak jak plakietka wieku migawki (.snap-age.ok) - na wyrazna
   prosbe 2026-09-23. */
.an-ai-cta {
  flex: 0 0 auto; font-size: 13px; font-weight: 600; color: #fff;
  border: 1px solid var(--green); border-radius: 9px; padding: 9px 15px;
  background: var(--green); white-space: nowrap;
}
@media (max-width: 760px) {
  .an-ai-launcher { flex-wrap: wrap; }
  .an-ai-cta { width: 100%; text-align: center; }
}

/* -------------------------------------------------- przelacznik widokow */
.an-viewtabs {
  display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 12px; padding: 5px;
}
.an-viewtab {
  flex: 1 1 auto; min-width: 140px; min-height: 40px;
  font: inherit; font-size: 13px; font-weight: 560;
  padding: 9px 16px; border-radius: 9px; border: 1px solid transparent;
  background: transparent; color: var(--muted); cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.an-viewtab:hover { color: var(--text); background: rgba(var(--surface-rgb), .6); }
.an-viewtab.is-active {
  background: var(--accent); color: #fff; border-color: var(--accent);
}

/* ------------------------------------------------------ pola formularzy */
.an-card-head { margin-bottom: 14px; }
.an-card-head h2 { margin: 0 0 4px; }
.an-card-head p { margin: 0; }

.an-field-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  align-items: end;
}
.an-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.an-field > label {
  font-size: 11.5px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .5px;
  display: flex; align-items: center; gap: 6px;
}

/* Jedna wysokosc dla WSZYSTKICH kontrolek i przyciskow tej zakladki (42 px).
   Wczesniej selecty mialy wysokosc systemowa, a przyciski wlasna - rzad
   filtrow wygladal jak poszarpany. */
#view-analizy .an-input,
#view-analizy .primary-btn,
#view-analizy .ghost-btn {
  min-height: 42px;
}
#view-analizy .ghost-btn.small { min-height: 34px; }

#view-analizy .an-input {
  width: 100%; box-sizing: border-box;
  padding: 9px 12px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text); font: inherit; font-size: 13px;
  appearance: none; -webkit-appearance: none;
}
#view-analizy select.an-input {
  /* wlasna strzalka - natywna znika razem z appearance:none */
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) center, calc(100% - 12px) center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 32px;
}
#view-analizy .an-input::placeholder { color: var(--muted); }
#view-analizy .an-input:hover { border-color: var(--muted); }
#view-analizy .an-input:focus-visible,
#view-analizy .primary-btn:focus-visible,
#view-analizy .ghost-btn:focus-visible,
#view-analizy .an-viewtab:focus-visible,
#view-analizy .an-pane-btn:focus-visible,
#view-analizy .an-tip:focus-visible,
#view-analizy table.data th[data-sort]:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
  border-color: var(--accent);
}
#view-analizy .an-input:disabled { opacity: .5; cursor: not-allowed; }

.an-input-unit { display: flex; align-items: center; gap: 8px; }
.an-input-unit .an-input { flex: 1 1 auto; }
.an-unit { color: var(--muted); font-size: 12px; white-space: nowrap; flex: 0 0 auto; }

.an-filters-actions {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 16px;
}
.an-km-hint { margin: 12px 0 0; }
.an-inline-note {
  margin: 10px 0 0; font-size: 12.5px; color: var(--amber);
}
.an-inline-err {
  margin: 10px 0 0; font-size: 12.5px; color: var(--red);
}

/* podpowiedz "?" przy etykiecie */
.an-tip {
  width: 16px; height: 16px; border-radius: 50%; flex: 0 0 auto;
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--muted); font-size: 10px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: help; position: relative; text-transform: none; letter-spacing: 0;
}
.an-tip::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 8px); left: 0;
  width: 280px; padding: 9px 11px; border-radius: 9px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  box-shadow: var(--shadow); font-size: 12px; font-weight: 400; line-height: 1.45;
  text-transform: none; letter-spacing: 0; text-align: left;
  opacity: 0; visibility: hidden; transition: opacity .12s; z-index: 50;
}
.an-tip:hover::after, .an-tip:focus-visible::after { opacity: 1; visibility: visible; }

/* ----------------------------------------------- lista wyszukiwalna (combo) */
.an-combo { position: relative; }
.an-combo-list {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 40;
  max-height: 260px; overflow-y: auto; margin: 0; padding: 4px; list-style: none;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: var(--shadow);
}
.an-combo-list[hidden] { display: none; }
.an-combo-opt {
  padding: 8px 10px; border-radius: 7px; font-size: 13px; cursor: pointer;
  display: flex; justify-content: space-between; gap: 10px; align-items: baseline;
}
.an-combo-opt small { color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.an-combo-opt:hover, .an-combo-opt.is-active { background: var(--accent-soft); color: var(--accent); }
.an-combo-empty { padding: 8px 10px; color: var(--muted); font-size: 12.5px; }

/* ---------------------------------------- materialy: grupy parametrow */
.an-param-groups {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.an-param-group {
  border: 1px solid var(--border); border-radius: 11px;
  padding: 14px 16px 16px; margin: 0; min-width: 0;
  display: flex; flex-direction: column; gap: 12px;
  background: rgba(var(--surface-rgb), .5);
}
.an-param-group legend {
  font-size: 11.5px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .6px; padding: 0 6px;
}
.an-dict-actions {
  display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-top: 14px;
}
.an-dict-actions .an-field { flex: 0 1 150px; }

/* ------------------------------------------------------------- wyniki */
.an-results-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.an-results-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.an-state { padding: 4px 0; }
.an-state-err p { color: var(--red); margin: 0; font-size: 13px; }

.an-spinner {
  width: 22px; height: 22px; border-radius: 50%; margin-bottom: 10px;
  border: 2.5px solid var(--border); border-top-color: var(--accent);
  animation: an-spin .7s linear infinite;
}
@keyframes an-spin { to { transform: rotate(360deg); } }

/* Stan "asystent mysli" - wyrazniejsza animacja niz maly obracajacy sie
   pierscien, bo ta pojawia sie na dluzej (model potrafi liczyc kilkanascie
   sekund) i ma byc od razu widoczna tuz pod pytaniem (zgloszone 2026-09-23). */
.ai-thinking {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 18px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--border);
}
.ai-thinking-dot {
  width: 9px; height: 9px; border-radius: 50%; background: var(--accent);
  animation: ai-thinking-bounce 1s ease-in-out infinite;
}
.ai-thinking-dot:nth-child(2) { animation-delay: .15s; }
.ai-thinking-dot:nth-child(3) { animation-delay: .3s; }
@keyframes ai-thinking-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .5; }
  30% { transform: translateY(-6px); opacity: 1; }
}
.ai-thinking-text { font-size: 13px; color: var(--text); font-weight: 550;
  animation: ai-thinking-pulse 1.8s ease-in-out infinite; transition: opacity .3s; }
/* tekst oczekiwania gaśnie i zapala się, kolejne etapy zmieniają się co kilka sekund */
@keyframes ai-thinking-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
/* odpowiedź "pisana na bieżąco" - migający kursor na końcu */
.ai-typing::after { content: "▍"; margin-left: 1px; animation: ai-caret 1s steps(1) infinite; color: var(--accent); }
@keyframes ai-caret { 50% { opacity: 0; } }


/* Karty wynikow - wartosc ma byc najwieksza rzecza na ekranie. */
.an-kpi-row {
  display: grid; gap: 14px; margin-bottom: 4px;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}
.an-kpi {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 12px; padding: 16px 18px; min-width: 0;
}
.an-kpi-label {
  font-size: 11px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .6px; margin-bottom: 8px;
}
.an-kpi-value {
  font-size: 27px; font-weight: 700; letter-spacing: -.5px; line-height: 1.15;
  font-variant-numeric: tabular-nums; overflow-wrap: anywhere;
}
.an-kpi-value .an-kpi-unit { font-size: 15px; font-weight: 600; color: var(--muted); margin-left: 4px; }
.an-kpi-value.is-empty { font-size: 18px; color: var(--muted); font-weight: 600; }
.an-kpi-sub { font-size: 12px; color: var(--muted); margin-top: 6px; }

.an-section-title {
  font-size: 13px; font-weight: 640; margin: 22px 0 10px;
  padding-top: 16px; border-top: 1px solid var(--border);
}
.an-chart-wrap { height: 260px; margin-top: 4px; }
#view-analizy details.an-details { margin-top: 14px; }
#view-analizy details.an-details > summary {
  cursor: pointer; font-size: 12.5px; color: var(--accent);
  padding: 8px 0; list-style: none; font-weight: 550;
}
#view-analizy details.an-details > summary::-webkit-details-marker { display: none; }
#view-analizy details.an-details > summary::before { content: "▸ "; }
#view-analizy details.an-details[open] > summary::before { content: "▾ "; }

.an-skipped { color: var(--amber); font-size: 12.5px; margin: 10px 0 0; }

/* Model nie zwrocil SQL (prosi o doprecyzowanie / pytanie poza zakresem
   danych) - to NADAL odpowiedz asystenta, nie cisza, wiec dostaje ta sama
   wyrazna karta co zwykly wynik, a nie szary, latwy do przeoczenia akapit
   (zgloszone 2026-09-23). */
.ai-answer-clarify { border-color: var(--amber); }
.ai-clarify-label {
  display: block; margin-bottom: 8px;
  font-size: 11px; font-weight: 700; color: var(--amber);
  text-transform: uppercase; letter-spacing: .5px;
}
/* "Brak danych" - pytanie poza zakresem bazy. Celowo NIE amber (to nie jest
   cos do doprecyzowania/naprawienia przez uzytkownika) i bez sugestii -
   inna sytuacja niz niejasne pytanie, patrz komentarz w app.js. */
.ai-answer-nodata { border-color: var(--muted); }
.ai-clarify-label-nodata { color: var(--muted); }

.ai-disclaimer {
  font-size: 12px; color: var(--muted); line-height: 1.5;
  margin: 0 0 12px; padding: 9px 12px;
  background: var(--surface-2); border-left: 3px solid var(--border);
  border-radius: 6px;
}

/* Zglaszanie bledu odpowiedzi. */
/* "Zgłoś błędną odpowiedź" przy prawej krawędzi (2026-10-04) */
.ai-report-row { margin-top: 14px; display: flex; flex-direction: column; align-items: flex-end; }
.ai-report-row .ai-report-box { align-self: stretch; }
.ai-report-box {
  margin-top: 10px; padding: 14px 16px; border-radius: 11px;
  background: var(--surface-2); border: 1px solid var(--accent);
}
.ai-report-box > label {
  display: block; margin-bottom: 6px;
  font-size: 11.5px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .5px;
}
.ai-report-context {
  margin: 10px 0; padding: 10px 12px; border-radius: 8px;
  background: var(--surface); border: 1px solid var(--border);
  font-size: 12px; color: var(--muted);
}
.ai-report-context summary { cursor: pointer; color: var(--text); font-weight: 600; }
.ai-report-context pre { white-space: pre-wrap; word-break: break-word; margin: 8px 0 0; }
.ai-report-ok { color: var(--green); font-size: 13px; font-weight: 600; }
.ai-suggest-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 12px; font-size: 12.5px; color: var(--muted);
}

/* Kafelki propozycji - to one sa GLOWNA akcja tej karty (kliknij i gotowe),
   wiec dostaja wieksza, wyrazniejsza forme niz maly przycisk-widget (zgloszone
   2026-09-23: poprzednia wersja "nie rzucala sie w oczy"). */
.ai-clarify-lead { font-size: 13.5px; color: var(--text); margin: 4px 0 12px; }
.ai-suggest-grid { display: grid; gap: 10px; }
.ai-suggest-btn {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; text-align: left; font: inherit; font-size: 13.5px; font-weight: 600;
  color: var(--text); background: var(--surface); cursor: pointer;
  border: 1.5px solid var(--accent); border-radius: 11px; padding: 13px 16px;
  transition: background .15s, transform .1s, box-shadow .15s;
}
.ai-suggest-btn:hover {
  background: var(--accent-soft); transform: translateX(2px);
  box-shadow: 0 2px 10px rgba(76, 141, 255, .18);
}
.ai-suggest-btn:active { transform: translateX(2px) scale(.99); }
.ai-suggest-arrow {
  color: var(--accent); font-size: 16px; font-weight: 700; flex: none;
}

/* "Kolejne pytanie" pod UDANA odpowiedzia - w odroznieniu od .ai-suggest-btn
   (jedyna akcja przy niejasnym pytaniu) to DODATKOWE, drugorzedne skroty,
   wiec male "pigulki" w rzedzie, nie pelnoszerokie kafelki (2026-09-23,
   "drabinka wiedzy" sekcja 8 - "1-3 krotkie przyciski"). */
.ai-nextstep-grid { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.ai-nextstep-btn {
  font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer;
  color: var(--accent); background: var(--accent-soft);
  border: 1px solid var(--accent); border-radius: 99px; padding: 6px 14px;
  transition: background .15s, transform .1s;
}
.ai-nextstep-btn:hover { background: var(--accent); color: #fff; transform: translateY(-1px); }
.ai-nextstep-btn:active { transform: translateY(0) scale(.98); }

/* ------------------------------------------------------ mapa i tabela */
.an-split { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); }
.an-pane-switch {
  display: flex; gap: 5px; padding: 5px; border-radius: 11px;
  background: var(--surface-2); border: 1px solid var(--border);
}
.an-pane-btn {
  flex: 1 1 0; min-height: 38px; font: inherit; font-size: 13px; font-weight: 550;
  border: 0; border-radius: 8px; background: transparent; color: var(--muted);
  cursor: pointer; transition: background .15s, color .15s;
}
.an-pane-btn.is-active { background: var(--accent); color: #fff; }
.an-pane { margin-bottom: 0; }
.an-pane-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.an-pane-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.an-table-scroll { max-height: 520px; overflow-y: auto; }
#view-analizy #an-map { height: 460px; margin-bottom: 10px; }
.an-pagination { display: flex; gap: 10px; align-items: center; margin-top: 12px; }

#view-analizy table.data tbody tr.is-picked td { background: var(--accent-soft); }
#view-analizy table.data tbody tr { cursor: pointer; }
#view-analizy table.data tfoot td {
  font-weight: 650; border-top: 2px solid var(--border); border-bottom: 0;
}

/* Od 1320 px mapa i tabela stoja obok siebie (przy pasku bocznym 232 px daje
   to ok. 550 px na kolumne przy ekranie 1366). Ponizej - przelacznik. */
@media (min-width: 1320px) {
  .an-split { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  .an-pane-switch { display: none; }
  .an-pane { display: block !important; }
  .an-split.is-map-expanded { grid-template-columns: minmax(0, 1fr); }
  .an-split.is-map-expanded #view-analizy #an-map,
  .an-split.is-map-expanded #an-map { height: calc(100vh - 260px); min-height: 520px; }
}

/* --------------------------------------------- rozwijany panel asystenta */
/* Panel rozwija sie POD przyciskiem "Zapytaj o dane" (zmiana 2026-09-22 -
   wczesniej byla to boczna szuflada). Animacja wysokosci przez
   grid-template-rows 0fr -> 1fr: to jedyny sposob na plynne rozwiniecie do
   WYSOKOSCI TRESCI bez zgadywania max-height. Sztywny max-height byby tu
   szczegolnie zly, bo tresc rosnie po odpowiedzi modelu - albo ucinalby
   wynik, albo psul tempo animacji. Silniki bez obslugi 0fr pokaza panel od
   razu, bez animacji - degradacja lagodna.
   Zwiniety panel zostaje w DOM (stad visibility, zeby nie lapal fokusu). */
.ai-panel {
  display: grid; grid-template-rows: 0fr; opacity: 0;
  transition: grid-template-rows .3s cubic-bezier(.22, .7, .3, 1), opacity .22s ease;
}
.ai-panel-inner { overflow: hidden; min-height: 0; visibility: hidden; }
.ai-panel.is-open { grid-template-rows: 1fr; opacity: 1; }
.ai-panel.is-open .ai-panel-inner { visibility: visible; }
.ai-panel-card { border-color: var(--accent); }
.ai-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 10px;
}
.ai-panel-head h2 { margin: 0; font-size: 15px; }
/* Gdy panel jest otwarty, przycisk i panel maja tworzyc jedna calosc. */
.an-ai-launcher.is-open { margin-bottom: 10px; }
@media (prefers-reduced-motion: reduce) and (max-width: 0px) { .ai-panel { transition: none; } }

.ai-textarea { resize: vertical; min-height: 84px; line-height: 1.5; }
/* "Zamknij" w prawym dolnym rogu panelu asystenta */
.ai-panel-foot { display: flex; justify-content: flex-end; margin-top: 12px; }
/* "Wyczyść pytanie" w prawym dolnym rogu pola pytania */
.ai-textarea-wrap { position: relative; }
.ai-textarea-wrap .ai-textarea { width: 100%; display: block; margin: 0; }
/* przyciski tuż pod polem pytania, bez dużego odstępu (2026-10-04) */
.ai-textarea-wrap + .an-filters-actions { margin-top: 6px; }
/* prawa krawędź w jednej linii z "Zwiń asystenta" i "Wyczyść wynik" */
.ai-textarea-clear { position: absolute; bottom: 8px; right: 0; }
/* "Wyczyść wynik" przy prawej krawedzi panelu - pod przyciskiem "Zamknij" z
   naglowka, zeby akcje sprzatajace byly po tej samej stronie. */
#btn-ai-clear { margin-left: auto; }
/* jedna wspólna prawa krawędź dla "Dane na żywo z PostGIS", "Zwiń asystenta",
   "Wyczyść pytanie" i "Zgłoś błędną odpowiedź" = wnętrze karty panelu
   (ramka 1 px + padding 20 px), 2026-10-04 */
#view-analizy .an-head-side { margin-right: 21px; }
#btn-ai-drawer { padding-right: 20px; }
/* jeden wspólny odstęp w pionie (12 px) między: "Dane na żywo" → kartą
   asystenta → panelem → polem pytania i przyciskami → wynikiem → "Zgłoś" */
#view-analizy .an-head { margin-bottom: 12px; }
#btn-ai-drawer { margin-bottom: 12px; }
.ai-textarea-wrap + .an-filters-actions { margin-top: 12px; }
#ai-query-result:not(:empty) { margin-top: 12px; }
.ai-report-row { margin-top: 12px; }
.ai-result-foot { display: flex; justify-content: flex-end; margin-top: 10px; }
/* eksport odpowiedzi asystenta (2026-10-07) */
.ai-export { display: inline-flex; align-items: center; gap: 6px; margin-right: 8px; }
.ai-export[hidden] { display: none; }
.ai-export > span { font-size: 12px; color: var(--muted); }
.ai-answer .ai-export { margin-top: 10px; }
.mini-ai-export { display: inline-flex; align-items: center; gap: 5px; }
.mini-ai-export > span { font-size: 12px; color: var(--muted); }
.ai-answer { position: relative; }
/* w rogu karty, w tej samej odległości co jej zawartość (padding 16/18 px) */
#btn-ai-clear-result.in-card { position: absolute; right: 18px; bottom: 16px; }
.ai-suggest-panel { margin: 16px 0 4px; }
.ai-templates-hint { font-size: 12.5px; color: var(--muted); margin: 0 0 10px; }
/* Dwa glowne szablony - duze, czytelne kafelki (tytul + opis + akcja),
   zamiast tonac w rzedzie drobnych chipsow (zgloszone 2026-09-23). */
.ai-templates {
  display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.ai-template-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 5px;
  text-align: left; font: inherit; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 13px;
  padding: 15px 16px; transition: border-color .15s, background .15s, transform .1s;
}
.ai-template-card:hover {
  border-color: var(--accent); background: var(--accent-soft); transform: translateY(-1px);
}
.ai-template-icon { color: var(--accent); margin-bottom: 2px; }
.ai-template-title { font-size: 14.5px; font-weight: 700; color: var(--text); }
.ai-template-desc { font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.ai-template-action { font-size: 12.5px; font-weight: 600; color: var(--accent); margin-top: 4px; }
.ai-templates-own { margin: 12px 0 0; }

.ai-more-examples { margin-top: 14px; }
.ai-more-examples > summary {
  cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--muted);
  list-style: none; display: flex; align-items: center; gap: 6px;
}
.ai-more-examples > summary::-webkit-details-marker { display: none; }
.ai-more-examples > summary::before { content: "▸"; transition: transform .15s; }
.ai-more-examples[open] > summary::before { transform: rotate(90deg); }
.ai-more-examples > summary:hover { color: var(--accent); }
.ai-examples-list { display: flex; flex-wrap: wrap; gap: 7px; margin: 10px 0 4px; }
.ai-example {
  font: inherit; font-size: 12px; padding: 6px 11px; border-radius: 99px;
  background: var(--surface-2); color: var(--muted);
  border: 1px solid var(--border); cursor: pointer; text-align: left;
}
.ai-example:hover { color: var(--accent); border-color: var(--accent); }

/* Doprecyzowanie zamiast przepisywania pytania: gdy model zle zgadnie, wina
   lezy po stronie jego domyslu, nie pytania uzytkownika. */
.ai-hint-box {
  margin-top: 12px; padding: 12px 14px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--accent);
}
.ai-hint-box > label {
  display: block; margin-bottom: 6px;
  font-size: 11.5px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .5px;
}
.ai-hint-box p { margin: 10px 0 0; }
.ai-hints {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 12px; padding: 8px 12px; border-radius: 9px;
  background: var(--accent-soft); border: 1px solid var(--accent);
  font-size: 12.5px; color: var(--text);
}
.ai-hints b {
  color: var(--accent); font-size: 11px;
  text-transform: uppercase; letter-spacing: .5px;
}

/* Odpowiedz asystenta: pytanie + liczba. Sama nazwa kolumny z SQL nie mowi
   uzytkownikowi, na co patrzy - nad wartoscia staje wiec tresc pytania, a
   nazwa kolumny schodzi pod spod jako drobny szczegol do weryfikacji. */
.ai-answer {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 12px; padding: 16px 18px;
}
.ai-answer-q {
  /* jak opis zapytania pod wynikiem (.ai-answer-method) - prośba 2026-10-04 */
  font-size: 12px; font-weight: 400; color: var(--muted);
  margin-bottom: 10px; line-height: 1.45;
}
.ai-answer-v {
  font-size: 30px; font-weight: 700; letter-spacing: -.5px; line-height: 1.1;
  font-variant-numeric: tabular-nums; overflow-wrap: anywhere;
}
.ai-answer-u { font-size: 16px; font-weight: 600; color: var(--muted); margin-left: 5px; }
/* Odpowiedz slowna modelu - wytluszczona, bo to ona wyjasnia, co oznacza
   liczba powyzej. Ta sama klasa dziala tez poza karta (odpowiedzi tabelaryczne). */
.ai-answer-exp {
  font-size: 13px; font-weight: 640; color: var(--text);
  line-height: 1.5; margin: 10px 0 0;
}
/* Odpowiedz zdaniem (pytania lokalizacyjne) + drobny opis metody/ograniczen */
.ai-answer-text { font-size: 15px; font-weight: 400; line-height: 1.5; margin: 0; color: var(--text); }
/* ---------------- Mini Asystent GIS (dymek na kazdej zakladce) ---------------- */
.mini-ai-bubble {
  /* prawy DOLNY róg (2026-10-06, na prośbę - wcześniej prawy górny, pod
     "Najnowsze"); okno asystenta i chmurka zachęt liczone od tej pozycji */
  /* 40/48 px od krawedzi (2026-10-06, poprawka: odsuniete od rogu, nie
     nachodzi na os wykresow przy samym dole) */
  position: fixed; right: 40px; bottom: 48px; z-index: 920;
  width: 68px; height: 68px; border-radius: 50%; border: 0;
  background: rgba(255, 255, 255, .12);
  backdrop-filter: blur(3px); cursor: pointer; box-shadow: 0 6px 18px rgba(0, 0, 0, .35);
  display: grid; place-items: center; transition: transform .15s;
  animation: mini-ai-pulse 2s ease-out infinite;
}
/* pulsujący pierścień wokół dymku - żeby był widoczny na każdej zakładce */
@keyframes mini-ai-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(255, 255, 255, .75), 0 6px 18px rgba(0, 0, 0, .35); }
  70%  { box-shadow: 0 0 0 14px rgba(255, 255, 255, 0), 0 6px 18px rgba(0, 0, 0, .35); }
  100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0), 0 6px 18px rgba(0, 0, 0, .35); }
}
.mini-ai-bubble:hover { transform: scale(1.08); }
.mini-ai-bubble[hidden] { display: none; }
.mini-ai-bubble[aria-expanded="true"] { animation: none; }
.mini-ai-bubble:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
/* ikona wyższa o 20 % niż szeroka (prośba 2026-10-04), potem całość
   powiększona proporcjonalnie o 20 % */
.mini-ai-bubble img { width: 46px; height: 55px; object-fit: fill; }
/* Zachety obok ikony (2026-10-06, wyglad poprawiony tego samego dnia na
   prosbe): biala chmurka rozmowy NIEZALEZNA od motywu (jasna takze w trybie
   ciemnym - czytelna na prezentacji). Na lewo od ikony z odstepem 12 px,
   wysrodkowana na jej wysokosci (ikona: bottom 24, wys. 68 -> srodek 58 px
   od dolu; right 24 + 68 + 12 = 104 px).
   Wejscie: przenikanie + przesuniecie o 6 px; bez migania i poswiat. */
/* Poprawka 2026-10-06 (zrzut uzytkownika): chmurka przesunieta w gore i w
   lewo - dolna krawedz na wysokosci gornej krawedzi ikony (48 + 68 = 116 px
   od dolu), ogonek w prawym dolnym rogu skierowany na ikone. Tlo lekko
   przezroczyste z rozmyciem tla pod spodem (czytelnosc tekstu zostaje). */
.mini-ai-teaser {
  position: fixed; right: 124px; bottom: 116px; z-index: 919;
  display: grid; grid-template-columns: auto 1fr auto; column-gap: 10px; row-gap: 2px; align-items: center;
  width: max-content; max-width: min(260px, calc(100vw - 172px));
  padding: 12px 12px 12px 16px; box-sizing: border-box;
  background: rgba(255, 255, 255, .86); color: #1f2937;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  border: 1px solid rgba(227, 230, 235, .9); border-radius: 18px;
  box-shadow: 0 6px 20px rgba(15, 23, 42, .14);
  cursor: pointer; text-align: left;
  opacity: 0; transform: translate(6px, 6px);
  transition: opacity .35s ease, transform .35s ease;
}
.mini-ai-teaser.show { opacity: 1; transform: none; }
.mini-ai-teaser[hidden] { display: none; }
.mini-ai-teaser:focus-visible { outline: 2px solid #3b82f6; outline-offset: 2px; }
/* ogonek - sam trojkat POD chmurka (clip-path), skosnie w dol-prawo na
   ikone. Obrocony kwadrat przy przezroczystym tle przeswitywal polowa przez
   chmurke i wygladal jak osobny romb. */
.mini-ai-teaser::after {
  content: ""; position: absolute; right: 16px; bottom: -9px; width: 16px; height: 9px;
  background: rgba(255, 255, 255, .86);
  clip-path: polygon(0 0, 100% 0, 85% 100%);
}
/* znak drogowy zamiast podpisu (2026-10-07) - inny przy każdej zachęcie */
.mini-ai-teaser-sign { grid-column: 1; grid-row: 1; width: 30px; height: 30px; display: grid; }
.mini-ai-teaser-sign svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .2)); }
.mini-ai-teaser-text {
  grid-column: 2; grid-row: 1; font-size: 14.5px; line-height: 1.35; color: #1f2937;
  /* maksymalnie dwie linie */
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.mini-ai-teaser-close {
  grid-column: 3; grid-row: 1; align-self: start;
  width: 18px; height: 18px; padding: 0; margin: -4px -4px 0 0;
  background: none; border: 0; border-radius: 50%;
  color: #9aa3af; font-size: 10px; line-height: 18px; cursor: pointer;
}
.mini-ai-teaser-close:hover { color: #4b5563; background: #f1f3f6; }
/* Male ekrany: obok ikony brak miejsca - chmurka NAD ikona (12 px odstepu:
   48 + 68 + 12 = 128 px od dolu), ogonek w dol, na srodek ikony
   (srodek ikony 40 + 34 = 74 px od prawej krawedzi ekranu; 74 - 16 - 8 = 50). */
@media (max-width: 560px) {
  .mini-ai-teaser {
    right: 16px; bottom: 128px; max-width: calc(100vw - 32px);
    transform: translateY(6px);
  }
  .mini-ai-teaser.show { transform: none; }
  .mini-ai-teaser::after { right: 50px; clip-path: polygon(0 0, 100% 0, 50% 100%); }
}
.mini-ai-panel {
  /* nad ikona (48 + 68 + 12 = 128 px od dolu), wyrownane do jej prawej krawedzi */
  position: fixed; right: 40px; bottom: 128px; z-index: 921;
  width: min(360px, calc(100vw - 32px)); max-height: min(520px, calc(100vh - 152px));
  display: flex; flex-direction: column; background: var(--surface);
  border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow);
  animation: mini-ai-in .18s ease-out;
}
.mini-ai-panel[hidden] { display: none; }
@keyframes mini-ai-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.mini-ai-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px;
  border-bottom: 1px solid var(--border); font-size: 13px; }
.mini-ai-body { padding: 12px 14px; overflow-y: auto; display: grid; gap: 10px; font-size: 13px; }
.mini-ai-hint { color: var(--muted); margin: 0; }
.mini-ai-q { font-weight: 400; color: var(--muted); font-size: 12px; }
.mini-ai-a { line-height: 1.5; margin: 0; }
.ai-answer-text b { font-weight: 700; }
.mini-ai-v { font-size: 22px; font-weight: 700; }
.mini-ai-v span { font-size: 13px; color: var(--muted); margin-left: 4px; }
.mini-ai-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.mini-ai-link { font-size: 12px; color: var(--accent); background: none; border: 0; padding: 0; cursor: pointer; text-align: left; }
.mini-ai-form { display: flex; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--border); }
.mini-ai-form input { flex: 1; min-width: 0; padding: 8px 10px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font: inherit; font-size: 13px; }
.mini-ai-form input:focus { outline: none; border-color: var(--accent); }
.mini-ai-panel .ai-thinking { padding: 4px 0; }

.ai-followup { font-size: 12px; color: var(--muted); margin: -4px 0 10px; }
.ai-answer-method { font-size: 12px; color: var(--muted); line-height: 1.5; margin: 10px 0 0; }
.ai-answer + .an-breakdown-wrap { margin-top: 12px; }
.ai-answer-col { font-size: 12px; color: var(--muted); margin-top: 10px; }
/* równe odstępy (10 px) między drobnymi wierszami karty odpowiedzi */
#ai-query-result .ai-answer .an-details { margin-top: 10px; }
#ai-query-result .ai-answer .an-details > summary { padding-top: 0; padding-bottom: 0; }
.ai-answer-col code { font-size: 12px; }
/* ten sam naglowek nad tabela wynikowa */
.ai-answer-q + .an-breakdown-wrap { margin-top: 0; }

/* Mapka z przebiegiem drogi, ktorej dotyczy odpowiedz - miedzy wynikiem a
   notka "Skad ten wynik". Pusta, gdy pytanie nie dotyczy jednej drogi. */
.ai-map-wrap { margin-top: 14px; }
.ai-map-wrap:empty { display: none; }
.ai-map-label {
  font-size: 11px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px;
}
.ai-map {
  height: 220px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface-2);
}

/* Odpowiedz z mapa - uklad jak Pulpit po zawezeniu do drogi (2026-10-06):
   odpowiedz po lewej, mapa po prawej na pelna wysokosc wiersza, wykres
   etapow pod spodem. Ten sam .road-map-chart-row co na Pulpicie (pol na pol,
   zawija sie pod siebie na waskim ekranie). */
.ai-road-row { margin-top: 4px; align-items: stretch; }
/* padding-bottom: miejsce na "Wyczyść wynik" (absolutnie w rogu .ai-answer) */
.ai-road-answer > .ai-answer { background: none; border: 0; padding: 0 0 48px; }
.ai-road-mapcard { display: flex; flex-direction: column; }
.ai-road-mapcard .ai-map-wrap {
  margin-top: 0; flex: 1 1 auto; display: flex; flex-direction: column;
}
.ai-road-mapcard .ai-map { flex: 1 1 auto; height: auto; min-height: 320px; }
/* drugi wiersz: wykres etapow po lewej, "Skąd ten wynik" po prawej */
.ai-road-row2 { margin-top: 18px; }
.ai-road-chart h2 { margin-top: 0; }
.ai-road-notecard > .ai-note { margin: 0; padding: 0; background: none; border: 0; }

/* Notka kontekstowa pod odpowiedzia asystenta: skad wynik i co to za droga.
   Cel: zeby dalo sie liczbe zweryfikowac, a nie tylko przyjac na wiare. */
.ai-note {
  margin-top: 14px; padding: 12px 14px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: 12.5px; color: var(--muted);
}
.ai-note b { color: var(--text); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
.ai-note ul { margin: 7px 0 0; padding-left: 18px; }
.ai-note li { margin-bottom: 4px; line-height: 1.5; }
.ai-note li:last-child { margin-bottom: 0; }
.ai-note #ai-road-note { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.ai-note #ai-road-note:empty { display: none; }
.ai-note-ok { color: var(--green); }
.ai-note-warn { color: var(--amber); }

/* czytane przez czytnik ekranu, niewidoczne wzrokowo */
.an-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;
}

@media (prefers-reduced-motion: reduce) and (max-width: 0px) {
  .an-spinner { animation-duration: 2s; }
}

/* Boczna karta drogi (zakladka Drogi) - prawdziwa szuflada wsuwana z prawej
   krawedzi ekranu (w odroznieniu od .ai-panel, ktory rozwija sie w miejscu). */
.road-drawer-overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 950;
}
.road-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 951;
  width: 420px; max-width: 92vw;
  background: var(--surface); border-left: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .22s ease;
}
.road-drawer.is-open { transform: translateX(0); }
.road-drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; border-bottom: 1px solid var(--border); flex: none;
}
.road-drawer-head h2 { margin: 0; }
.road-drawer-body { padding: 16px 18px; overflow-y: auto; flex: 1 1 auto; }
.road-drawer-body .card { margin-bottom: 14px; }
.road-drawer-body .card h3 { margin: 0 0 10px; font-size: 13.5px; }
#road-drawer-map { height: 200px; }
.road-drawer-analyze-btn { width: 100%; justify-content: center; margin-bottom: 14px; }
.rd-stage-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 6px 0; font-size: 13px;
}
.rd-stage-row + .rd-stage-row { border-top: 1px solid var(--border); }
.rd-quality-list { margin: 0; padding-left: 18px; font-size: 13px; }
.rd-quality-list li { margin-bottom: 4px; }

@media (max-width: 640px) { .road-drawer { width: 100vw; max-width: 100vw; } }

/* Zachęta do kliknięcia słupka w "Pokrycie wg numerów dróg" (2026-10-04):
   wyróżniona plakietka zamiast szarego napisu + kilka delikatnych pulsów po
   wczytaniu, żeby przyciągnęła wzrok, i podświetlenie wykresu po najechaniu. */
.chart-roads-hint {
  display: inline-flex; align-items: center; gap: 8px; margin: 4px 0 12px;
  padding: 7px 14px; border-radius: 99px; font-size: 13px; color: var(--text);
  background: var(--accent-soft); border: 1px solid var(--accent);
  animation: chart-hint-pulse 1.6s ease-in-out 3;
}
.chart-roads-hint[hidden] { display: none; }
.chart-roads-hint b { color: var(--accent); }
.chart-roads-hint-ico { font-size: 16px; display: inline-block; animation: chart-hint-tap 1.6s ease-in-out 3; }
@keyframes chart-hint-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(76, 141, 255, 0); }
  50% { box-shadow: 0 0 0 6px rgba(76, 141, 255, .25); }
}
@keyframes chart-hint-tap { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(3px); } }
#chart-roads-wrap { cursor: pointer; }

/* Historia asystenta (admin) */
.aih-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.aih-filters .an-input { flex: 1 1 260px; min-width: 200px; }
.aih-filters label { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.aih-filters input[type="date"], .aih-filters select { padding: 7px 9px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font: inherit; font-size: 13px; }
#aih-table .aih-row { cursor: pointer; }
#aih-table .aih-answer { max-width: 420px; }
#aih-table .aih-detail td { background: var(--surface-2); font-size: 12.5px; line-height: 1.5; }
.aih-more { display: flex; justify-content: center; margin-top: 12px; }

/* ================= Utrudnienia PZDW (2026-10-06) =================
   Mapa na większość ekranu, jasne panele nałożone na mapę - celowo jasne
   także w motywie ciemnym (czytelność na projektorze, prezentacja). */
#view-utrudnienia {
  --utr-ink: #1d2733; --utr-muted: #5d6b7a; --utr-line: #dde3ea;
  --utr-bg: rgba(255, 255, 255, .96); --utr-soft: #f3f6f9;
  --utr-red: #d93b3b; --utr-orange: #f08c1a; --utr-blue: #2f7fd8;
}
.utr-wrap { position: relative; }
.utr-map {
  height: calc(100vh - 210px); min-height: 480px;
  border-radius: var(--radius); border: 1px solid var(--border); background: #e9eef2;
}
.utr-panel {
  position: absolute; z-index: 500; background: var(--utr-bg); color: var(--utr-ink);
  border: 1px solid var(--utr-line); border-radius: 12px;
  box-shadow: 0 6px 22px rgba(20, 30, 45, .18);
}
/* pasek źródła na prawo od panelu filtrów, nie nachodzi na niego */
.utr-source {
  top: 12px; left: 366px; right: 64px; width: max-content; max-width: calc(100% - 430px);
  display: flex; align-items: center; gap: 12px; padding: 7px 14px; font-size: 12.5px;
}
.utr-side.is-collapsed ~ .utr-source { left: 300px; }
.utr-source.is-error { border-color: #e7a33b; background: #fff8ec; }
.utr-source-txt b { font-weight: 650; }
.utr-warn { color: #a35a00; font-weight: 600; }
.utr-btn {
  border: 1px solid var(--utr-line); background: #fff; color: var(--utr-ink); border-radius: 8px;
  padding: 5px 11px; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.utr-btn:hover { border-color: var(--utr-blue); color: var(--utr-blue); }
.utr-btn[hidden] { display: none; }

.utr-side {
  top: 12px; left: 12px; bottom: 12px; width: 340px;
  display: flex; flex-direction: column; overflow: hidden;
}
.utr-side.is-collapsed { bottom: auto; width: auto; }
.utr-side.is-collapsed .utr-side-body { display: none; }
.utr-side-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 14px; border-bottom: 1px solid var(--utr-line); font-size: 13.5px;
}
.utr-side.is-collapsed .utr-side-head { border-bottom: 0; }
.utr-icon-btn {
  width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--utr-line); background: #fff;
  color: var(--utr-ink); cursor: pointer; font-size: 16px; line-height: 1;
}
.utr-side.is-collapsed .utr-icon-btn { transform: rotate(180deg); }
.utr-side-body { display: flex; flex-direction: column; gap: 12px; padding: 12px 14px; min-height: 0; flex: 1; }
.utr-filter { display: flex; flex-direction: column; gap: 6px; }
.utr-filter-label { font-size: 11.5px; color: var(--utr-muted); font-weight: 600; }
.utr-seg { display: flex; border: 1px solid var(--utr-line); border-radius: 9px; overflow: hidden; }
.utr-seg button {
  flex: 1; border: 0; background: #fff; color: var(--utr-ink); padding: 7px 4px; font: inherit;
  font-size: 12.5px; cursor: pointer; border-right: 1px solid var(--utr-line);
}
.utr-seg button:last-child { border-right: 0; }
.utr-seg button.active { background: var(--utr-ink); color: #fff; font-weight: 600; }
.utr-kinds { display: flex; flex-direction: column; gap: 4px; }
.utr-kind { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.utr-kind input { accent-color: var(--utr-ink); }
.utr-kind .utr-kind-n { margin-left: auto; color: var(--utr-muted); font-size: 12px; }
#utr-road {
  padding: 7px 9px; border-radius: 9px; border: 1px solid var(--utr-line); background: #fff;
  color: var(--utr-ink); font: inherit; font-size: 13px;
}
.utr-count { font-size: 12px; color: var(--utr-muted); }
.utr-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; min-height: 0;
  display: flex; flex-direction: column; gap: 6px; }
.utr-item {
  display: grid; grid-template-columns: 30px 1fr; gap: 9px; align-items: start;
  padding: 9px 10px; border: 1px solid var(--utr-line); border-radius: 10px; background: #fff;
  cursor: pointer; text-align: left; width: 100%; font: inherit; color: var(--utr-ink);
}
.utr-item:hover, .utr-item:focus-visible { border-color: var(--utr-blue); outline: none;
  box-shadow: 0 0 0 3px rgba(47, 127, 216, .15); }
.utr-item.is-active { border-color: var(--utr-ink); }
.utr-item-title { font-size: 13px; font-weight: 650; }
.utr-item-sub { font-size: 12px; color: var(--utr-muted); margin-top: 2px; line-height: 1.4; }
.utr-item-flag { display: inline-block; margin-top: 4px; font-size: 11px; font-weight: 600; color: #8a5300;
  background: #fff1d9; border-radius: 6px; padding: 1px 6px; }
.utr-item-flag.is-none { color: #6b4a00; background: #f3eee2; }
.utr-empty { font-size: 12.5px; color: var(--utr-muted); padding: 8px 2px; }

/* legenda na lewo od dymku mini-asystenta (prawy dolny róg ekranu) */
.utr-legend {
  right: 124px; bottom: 26px; padding: 10px 13px; font-size: 12px;
  display: flex; flex-direction: column; gap: 6px;
}
.utr-legend b { font-size: 12px; }
.utr-legend-row { display: flex; align-items: center; gap: 8px; }
.utr-legend-row .utr-sym { width: 20px; height: 20px; }
.utr-legend-line { width: 22px; height: 5px; background: repeating-linear-gradient(90deg, #f08c1a 0 7px, #1f2933 7px 11px); border: 2px solid #fff; border-radius: 3px; box-shadow: 0 0 0 1px #c9ced3; }

/* symbole utrudnień (wspólne: zakładka Utrudnienia i Mapa) */
.utr-sym {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .35);
}
.utr-sym svg { width: 62%; height: 62%; }
.utr-sym.is-approx { border-style: dashed; opacity: .85; }
.utr-marker { background: none; border: 0; }

/* karta szczegółów (popup) */
/* karta zawsze jasna - także na Mapie, gdzie dymki mają ciemny styl aplikacji */
.leaflet-container .utr-popup .leaflet-popup-content-wrapper,
.leaflet-container .utr-popup .leaflet-popup-tip { background: #fff; color: #1d2733; border: 0; }
.utr-popup .leaflet-popup-content-wrapper { border-radius: 12px; box-shadow: 0 8px 28px rgba(20, 30, 45, .28); }
.leaflet-container .utr-popup a.leaflet-popup-close-button { color: #5d6b7a; }
.utr-popup .leaflet-popup-content { margin: 14px 16px; width: 330px !important; }
.utr-card { font: 13px/1.5 "Overpass", "Segoe UI", system-ui, sans-serif; color: #1d2733; }
.utr-card-head { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.utr-card-title { font-size: 15px; font-weight: 700; }
.utr-card-badges { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; }
.utr-badge { font-size: 11.5px; font-weight: 600; border-radius: 6px; padding: 2px 7px; background: #eef2f6; color: #2a3846; }
.utr-badge.st-trwajace { background: #e5f4ea; color: #16683a; }
.utr-badge.st-planowane { background: #e6effb; color: #1e5aa8; }
.utr-badge.st-zakonczone { background: #eceff2; color: #4c5866; }
.utr-badge.warn { background: #fff1d9; color: #8a5300; }
.utr-card dl { margin: 0; display: grid; grid-template-columns: 96px 1fr; gap: 4px 10px; }
.utr-card dt { color: #5d6b7a; font-size: 12px; }
.utr-card dd { margin: 0; }
.utr-card-desc p { margin: 0 0 6px; }
.utr-card-note { margin-top: 8px; font-size: 12px; color: #8a5300; background: #fff8ec; border-radius: 8px; padding: 6px 8px; }
.utr-card-src { margin-top: 10px; font-size: 12px; color: #5d6b7a; }
.utr-card a { color: #1e5aa8; }
/* wiersze "… (PZDW)" w drzewku warstw Mapy: checkbox, symbol i nazwa w jednej linii */
.leaflet-control-layers .utr-ov { display: inline-flex; align-items: center; gap: 6px; vertical-align: middle; }
.leaflet-control-layers .utr-ov .utr-sym { display: inline-grid; flex: none; border-width: 1.5px; box-shadow: none; }

/* gdy karta utrudnienia jest otwarta, legenda przygasa i nie zasłania karty */
.utr-legend { transition: opacity .15s; }
.utr-wrap.has-popup .utr-legend { opacity: .12; pointer-events: none; }

/* ================= Schemat liniowy sieci + panel drogi =================
   Redesign etap 3 (2026-10-06), wg makiety propozycja_redesign/. */
.sld-card { margin-bottom: 16px; }
.sld-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.sld-head h2 { margin: 0; }
.sld-legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); }
.sld-legend span { display: inline-flex; align-items: center; gap: 6px; }
.sld-legend i { width: 18px; height: 4px; border-radius: 2px; display: inline-block; }
.sld-sort { display: inline-flex; margin-left: auto; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.sld-sort button {
  border: 0; border-right: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-size: 12.5px; padding: 5px 11px; cursor: pointer;
}
.sld-sort button:last-child { border-right: 0; }
.sld-sort button.active { background: var(--text); color: var(--surface); font-weight: 700; }
.sld-card .chart-roads-hint { margin: 12px 0 6px; }
.sld { list-style: none; margin: 0 -20px; padding: 0; }
.sld-row {
  display: grid; grid-template-columns: 58px 1fr 96px; gap: 14px; align-items: center;
  width: 100%; padding: 6px 20px; border: 0; background: none; color: inherit;
  font: inherit; text-align: left; cursor: pointer;
}
.sld-row:hover, .sld-row:focus-visible { background: var(--surface-2); outline: none; }
.sld-row.is-sel { background: var(--surface-2); box-shadow: inset 3px 0 0 var(--plate); }
.sld-lines { display: grid; gap: 2px; min-width: 6px; }
.sld-line { height: 4px; border-radius: 2px; overflow: hidden; background: var(--border); }
.sld-line i { display: block; height: 100%; }
.sld-line.s1 i { background: var(--s1); }
.sld-line.s2 i { background: var(--s2); }
.sld-line.s3 i { background: var(--s3); }
.sld.has-focus .sld-line { opacity: .28; }
.sld.has-focus .sld-line.is-focus { opacity: 1; height: 6px; }
.sld-num { text-align: right; line-height: 1.15; }
.sld-num b { font-size: 15px; font-weight: 800; }
.sld-num small { display: block; font-size: 11.5px; color: var(--muted); }
/* bez zawezenia do drogi karta z wykresem kolowym jest pusta - schowana */
#road-chart-card[hidden] { display: none; }

.road-sheet-backdrop {
  position: fixed; inset: 0; z-index: 1150; background: rgba(10, 16, 22, .45);
}
.road-sheet-backdrop[hidden], .road-sheet[hidden] { display: none; }
.road-sheet {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 1160;
  width: min(1180px, 94vw); background: var(--bg);
  border-left: 1px solid var(--border); box-shadow: -14px 0 40px rgba(0, 0, 0, .25);
  display: flex; flex-direction: column;
  animation: road-sheet-in .22s ease;
}
@keyframes road-sheet-in { from { transform: translateX(40px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) and (max-width: 0px) { .road-sheet { animation: none; } }
.road-sheet-head {
  display: flex; align-items: center; gap: 14px; padding: 14px 22px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.road-sheet-titles h2 { margin: 0; font-size: 17px; }
.road-sheet-head .ghost-btn { margin-left: auto; }
.road-plate.road-plate-lg { min-width: 70px; height: 38px; font-size: 22px; }
.road-sheet-body { flex: 1; overflow-y: auto; padding: 18px 22px 40px; display: grid; gap: 16px; align-content: start; }
.road-sheet-body > * { margin: 0 !important; }
/* stała wysokość mapy w panelu (w siatce Pulpitu brała ją z wiersza) */
.road-sheet-body #road-map { height: 340px; }
@media (max-width: 760px) {
  .road-sheet { width: 100vw; }
  .road-sheet-body { padding: 14px 14px 40px; }
  .sld-row { grid-template-columns: 50px 1fr 74px; gap: 10px; }
  .sld-sort { margin-left: 0; }
}

/* ================= Pulpit wg makiety (2026-10-06) ================= */
#view-dashboard > .stage-grid, #view-dashboard > .kpi-grid { display: none; }
.dash-summary {
  display: grid; grid-template-columns: minmax(240px, 1fr) 2fr; gap: 28px; align-items: end;
  padding: 4px 2px 20px; margin-bottom: 20px; border-bottom: 1px solid var(--border);
}
.dash-big { font-size: 64px; font-weight: 800; line-height: .9; letter-spacing: -.03em; }
.dash-big small { font-size: 28px; font-weight: 700; }
.dash-big-label { margin-top: 8px; color: var(--muted); font-size: 14px; }
.dash-big-label b { color: var(--text); }
.dash-meters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.dash-meter { border: 0; background: none; color: inherit; font: inherit; text-align: left; padding: 6px 8px; margin: -6px -8px; border-radius: 8px; cursor: pointer; }
.dash-meter:hover { background: var(--surface-2); }
.dash-meter[aria-pressed="true"] { background: var(--surface-2); box-shadow: inset 0 -3px 0 var(--plate); }
.dash-meter-name { display: block; font-size: 13px; color: var(--muted); font-weight: 600; }
.dash-meter-val { display: block; font-size: 28px; font-weight: 800; line-height: 1.05; white-space: nowrap; }
.dash-meter-bar { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; margin-top: 7px; }
.dash-meter-bar i { display: block; height: 100%; border-radius: 4px; transition: width .6s ease; }
.dash-meter-note { font-size: 12px; color: var(--muted); margin-top: 6px; line-height: 1.4; }

.dash-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; margin-bottom: 16px; }
.dash-grid .sld-card { margin-bottom: 0; }
.dash-rail { display: grid; gap: 16px; position: sticky; top: 16px; }   /* kolumna zostaje w zasięgu przy długim schemacie */
.dash-rail-card { padding: 16px 18px; }
.dash-rail-card h3 { margin: 0 0 10px; font-size: 14px; font-weight: 700; }
.dash-near { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.dash-near button {
  display: grid; grid-template-columns: 50px 1fr auto; gap: 10px; align-items: center; width: 100%;
  border: 0; background: none; color: inherit; font: inherit; font-size: 13px; padding: 4px 6px; margin: 0 -6px;
  border-radius: 6px; cursor: pointer; text-align: left;
}
.dash-near button:hover { background: var(--surface-2); }
.dash-near .road-plate { min-width: 46px; }
.dash-mini-bar { height: 5px; background: var(--border); border-radius: 3px; overflow: hidden; }
.dash-mini-bar i { display: block; height: 100%; background: var(--text); }
.dash-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.dash-stat { background: var(--surface-2); border-radius: 8px; padding: 8px 10px; border: 0; color: inherit; font: inherit; text-align: left; }
button.dash-stat { cursor: pointer; }
button.dash-stat:hover { box-shadow: inset 0 0 0 1px var(--border); }
.dash-stat b { display: block; font-size: 20px; font-weight: 800; line-height: 1.15; }
.dash-stat span { font-size: 12px; color: var(--muted); }
.dash-rail-links { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; margin-top: 12px; }
.link-btn { border: 0; background: none; padding: 0; color: var(--accent); font: inherit; font-weight: 700; font-size: 13px; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.link-btn.is-on { color: var(--text); }
.dash-utr { display: grid; gap: 6px; font-size: 13px; margin-bottom: 12px; }
.dash-utr div { display: flex; align-items: center; gap: 8px; }
.dash-utr b { margin-left: auto; font-size: 15px; }
.dash-utr .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
@media (max-width: 1180px) {
  .dash-grid { grid-template-columns: 1fr; }
  .dash-rail { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); position: static; }
}
@media (max-width: 900px) {
  .dash-summary { grid-template-columns: 1fr; gap: 18px; }
}
@media (max-width: 640px) {
  .dash-meters { grid-template-columns: 1fr; gap: 14px; }
  .dash-big { font-size: 52px; }
}

/* Utrudnienia PZDW w panelu drogi i na schemacie (2026-10-06) */
.road-utr-card h3 { margin: 0 0 10px; font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.road-utr-card h3 .utr-count { font-size: 12px; font-weight: 600; color: var(--muted); }
.road-utr-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.road-utr-item {
  display: grid; grid-template-columns: 28px 1fr auto; gap: 12px; align-items: start;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2);
}
.road-utr-item .utr-sym { width: 26px; height: 26px; }
.road-utr-title { font-weight: 700; font-size: 13.5px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.road-utr-st { font-size: 11.5px; font-weight: 600; border-radius: 6px; padding: 1px 7px; background: var(--surface); border: 1px solid var(--border); }
.road-utr-st.st-trwajace { color: var(--green); border-color: var(--green); }
.road-utr-st.st-planowane { color: var(--accent); border-color: var(--accent); }
.road-utr-meta { font-size: 12.5px; color: var(--muted); margin-top: 3px; line-height: 1.45; }
.road-utr-desc { font-size: 12.5px; margin-top: 4px; line-height: 1.45; }
.road-utr-empty { font-size: 13px; color: var(--muted); }
.road-utr-src { font-size: 12px; color: var(--muted); margin-top: 10px; }
.sld-utr { color: var(--amber); font-weight: 700; }

/* ================= Asystent GIS jako panel boczny (redesign etap 4) =================
   Nadpisuje wcześniejsze okienko nad ikoną (.mini-ai-panel wyżej). */
.mini-ai-panel {
  top: 0; right: 0; bottom: 0; z-index: 1170;
  width: min(440px, 100vw); max-height: none;
  border-radius: 0; border: 0; border-left: 1px solid var(--border);
  box-shadow: -14px 0 40px rgba(0, 0, 0, .22);
  animation: mini-ai-slide .22s ease;
}
@keyframes mini-ai-slide { from { transform: translateX(40px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) and (max-width: 0px) { .mini-ai-panel { animation: none; } }
/* otwarty panel zasłoniłby ikona i zachęty - chowamy je na ten czas */
.mini-ai-bubble[aria-expanded="true"] { display: none; }
body.mini-ai-open .mini-ai-teaser { display: none; }
.mini-ai-head { gap: 10px; justify-content: flex-start; padding: 14px 18px; font-size: 16px; flex-shrink: 0; }
.mini-ai-head .ghost-btn { margin-left: auto; }
.mini-ai-head #mini-ai-close { margin-left: 0; }
.mini-ai-head-ico { height: 30px; width: auto; }
/* pole pytania na dole, jak w komunikatorze (2026-10-20) */
.mini-ai-form { flex-direction: column; gap: 8px; padding: 10px 18px 14px; border-top: 1px solid var(--border); flex-shrink: 0; }
.mini-ai-form textarea {
  width: 100%; min-height: 52px; max-height: 30vh; resize: vertical; padding: 10px 12px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit; font-size: 14px;
}
.mini-ai-form textarea:focus { outline: none; border-color: var(--accent); }
.mini-ai-form-btns { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mini-ai-kbd { margin-right: auto; font-size: 11.5px; color: var(--muted); }
.mini-ai-examples { padding: 2px 0 10px; display: grid; gap: 4px; }
.mini-ai-examples[hidden] { display: none; }
.mini-ai-examples-label { font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
.mini-ai-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.mini-ai-chip {
  border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 14px;
  padding: 4px 10px; font: inherit; font-size: 12.5px; cursor: pointer;
}
.mini-ai-chip:hover { border-color: var(--accent); color: var(--accent); }
.mini-ai-body { flex: 1; min-height: 0; display: block; padding: 14px 18px 16px; font-size: 14px; overscroll-behavior: contain; }
/* wątek rozmowy: pytania po prawej, odpowiedzi po lewej (2026-10-20) */
.mini-ai-thread { display: flex; flex-direction: column; gap: 10px; }
.mini-ai-msg { display: grid; gap: 8px; min-width: 0; max-width: 88%; padding: 9px 13px; overflow-wrap: anywhere;
  animation: mini-ai-msg-in .18s ease-out; }
@keyframes mini-ai-msg-in { from { opacity: 0; transform: translateY(6px); } }
.mini-ai-msg-user { align-self: flex-end; background: var(--text); color: var(--surface);
  border-radius: 16px 16px 4px 16px; font-weight: 600; }
.mini-ai-msg-user .mini-ai-text { white-space: pre-wrap; }
.mini-ai-msg-bot { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--border);
  border-left: 3px solid var(--plate); border-radius: 16px 16px 16px 4px; }
.mini-ai-msg-bot:has(.mini-ai-answer) { max-width: 94%; }
.mini-ai-msg-bot.mini-ai-wait { padding: 6px 13px; }
.mini-ai-msg .an-inline-err { margin: 0; }
.mini-ai-msg .ai-answer-method { margin: 0; }
.mini-ai-msg .mini-ai-actions button:disabled { opacity: .5; cursor: default; }
.mini-ai-answer { display: grid; gap: 10px; min-width: 0; }
.mini-ai-sql summary { cursor: pointer; font-size: 12.5px; color: var(--muted); }
.mini-ai-sql pre {
  margin: 6px 0 0; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px; font-size: 12px; white-space: pre-wrap; overflow-x: auto;
}
.mini-ai-answer-foot { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.mini-ai-answer-foot .mini-ai-link { margin-right: auto; }
.road-sheet-head #road-sheet-ask { margin-left: auto; }
.road-sheet-head #road-sheet-ask + .ghost-btn { margin-left: 0; }

/* ================= Mapa (redesign etap 5, 2026-10-06) =================
   5 klas postępu na osiach dróg - te same granice 30/70 co colorFor(),
   dodatkowo osobno "nierozpoczęte" (0 %) i "praktycznie gotowe" (>= 95 %). */
/* paleta jak w makiecie (2026-10-06, poprawka): szary / żółty / pomarańczowy /
   morski / zielony - bez czerwieni, która na mapie wyglądała jak alarm */
:root { --ramp0: #8592a0; --ramp1: #e8c35a; --ramp2: #e0962a; --ramp3: #5fbf9c; --ramp4: #3db894; }
:root[data-theme="light"] { --ramp0: #a9b3bd; --ramp1: #e1b44a; --ramp2: #c98a12; --ramp3: #3f9b7d; --ramp4: #1e8c6e; }
.ramp-sw { width: 20px; height: 5px; border-radius: 3px; display: inline-block; margin-right: 6px; vertical-align: middle; }
/* podkład OSM wyszarzony - kolor na mapie niosą tylko osie dróg i obiekty
   ewidencji; ortofotomapa bez zmian */
.basemap-grey { filter: grayscale(.9) contrast(.92) brightness(1.03); }
:root[data-theme="dark"] .basemap-grey { filter: grayscale(1) invert(.92) contrast(.86) brightness(.92); }

/* Panel "Warstwy" na mapie (wg makiety, 2026-10-06) - zawsze widoczny,
   jasny także w ciemnym motywie; pełne drzewko warstw zostaje pod ikoną. */
.map-quick {
  background: #fff; color: #14202b; border-radius: 12px; padding: 12px 14px; width: 250px;
  box-shadow: 0 4px 16px rgba(20, 32, 43, .2); font: 13px/1.4 "Overpass", "Segoe UI", sans-serif;
}
.map-quick h4 { margin: 0 0 8px; font-size: 14px; font-weight: 700; display: flex; align-items: center; }
.map-quick h4 button { margin-left: auto; border: 0; background: none; color: #5e6b78; cursor: pointer; font: inherit; font-size: 12px; padding: 0; }
.map-quick h4 button:hover { color: #14202b; text-decoration: underline; }
.map-quick label { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13.5px; margin: 0; }
.map-quick label input { width: 16px; height: 16px; accent-color: #14202b; margin: 0; }
.map-quick label .n { margin-left: auto; color: #5e6b78; font-size: 12.5px; }
.map-quick-ramp { display: grid; grid-template-columns: repeat(5, 1fr); gap: 3px; margin: 8px 0 12px; font-size: 11px; color: #5e6b78; text-align: center; }
.map-quick-ramp i { display: block; height: 7px; border-radius: 2px; margin-bottom: 3px; }
.map-quick.is-min .map-quick-body { display: none; }
.map-quick.is-min h4 { margin: 0; }

/* ================= Zakładka Utrudnienia wg makiety (2026-10-06) ================= */
.utr-section { display: flex; flex-direction: column; gap: 6px; padding-bottom: 12px; border-bottom: 1px solid var(--utr-line); }
.utr-section-h { margin: 0; font-size: 13.5px; font-weight: 700; color: var(--utr-ink); display: flex; align-items: baseline; gap: 8px; }
.utr-section-h .utr-count { font-weight: 400; }
.utr-ramp { margin: 2px 0 6px; }
.utr-side { width: 320px; }
.utr-side-body { gap: 10px; overflow-y: auto; }
.utr-side-body .utr-list { overflow: visible; flex: none; }
/* pozycja listy: tablica z numerem drogi + rodzaj, jak w makiecie */
.utr-item { grid-template-columns: 50px 1fr; gap: 10px; }
.utr-item .road-plate { min-width: 46px; height: 24px; font-size: 13px; }
.utr-item-plates { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.utr-item-more { font-size: 11px; color: var(--utr-muted); }
.utr-item-title { display: flex; align-items: center; gap: 6px; }
.utr-item-title .utr-sym { width: 16px; height: 16px; border-width: 1.5px; box-shadow: none; flex: none; }

/* ================= Stopka paska bocznego wg makiety (2026-10-06) ================= */
.sb-status { display: flex; flex-wrap: wrap; gap: 6px; }
.sb-status .sidebar-absence, .sb-status .sidebar-online { display: contents; }
.sb-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 99px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-size: 12px; cursor: pointer; white-space: nowrap;
}
.sb-pill:hover, .sb-pill[aria-expanded="true"] { border-color: var(--text); }
.sb-pill .sidebar-absence-dot, .sb-pill .chat-online-dot { width: 7px; height: 7px; flex: 0 0 7px; }
.sb-pill.absent .sidebar-absence-dot { background: var(--red); }
.sb-pill.remote .sidebar-absence-dot { background: var(--accent); }
.sb-names {
  font-size: 12px; color: var(--text); background: var(--surface-2); border-radius: 8px;
  padding: 6px 10px; display: grid; gap: 2px; max-height: 140px; overflow-y: auto;
}
.sb-names[hidden] { display: none; }
.sb-names b { font-size: 11px; color: var(--muted); font-weight: 600; margin-top: 2px; }
/* konto: ciemne kółko z inicjałami, imię i rola, przyciski ikon po prawej */
.sidebar-foot { gap: 10px; padding-top: 12px; border-top: 1px solid var(--border); }
.user-box { background: none; border: 0; padding: 2px 4px; gap: 10px; }
.user-avatar { width: 34px; height: 34px; flex: 0 0 34px; font-size: 13px; background: var(--text); color: var(--surface); }
.user-name { font-size: 13.5px; font-weight: 700; }
.user-role { font-size: 12px; }
.user-icon-btn, .user-box .user-logout {
  width: 32px; height: 32px; flex: none; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); display: grid; place-items: center; cursor: pointer; padding: 0;
}
.user-icon-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.user-icon-btn:hover, .user-box .user-logout:hover { border-color: var(--text); }
.readonly-note { font-size: 10.5px; text-align: left; padding: 0 4px; opacity: .8; }
@media (max-width: 860px) {
  .sb-status, .sb-names { display: none; }
  .user-box { flex-direction: column; }
}

/* ================= Nagłówek wg makiety (2026-10-06) =================
   Pasek z nagraniem z drona od krawędzi do krawędzi obszaru treści, ostre
   krawędzie, tytuł 26 px; "Stan z dnia" i "Synchronizuj" jak w makiecie. */
.main { --main-pt: 22px; --main-px: 26px; }
.topbar {
  margin: calc(-1 * var(--main-pt)) calc(-1 * var(--main-px)) 22px;
  border-radius: 0; min-height: 96px; align-items: flex-end;
  padding: 18px 28px 14px;
}
.topbar::after {
  background: linear-gradient(90deg, rgba(12, 20, 28, .82) 0%, rgba(12, 20, 28, .45) 60%, rgba(12, 20, 28, .25) 100%);
}
.topbar #view-title { font-size: 26px; font-weight: 800; line-height: 1; letter-spacing: -.01em; }
.topbar .view-intro { margin-top: 6px; }
.topbar .snap-info[hidden] { display: none; }
.topbar-actions { align-self: flex-end; }
.topbar #snap-picker {
  background: rgba(255, 255, 255, .14); color: #fff; border: 1px solid rgba(255, 255, 255, .3);
  border-radius: 6px; padding: 6px 10px; font: inherit; font-size: 13px; cursor: pointer;
  backdrop-filter: blur(4px);
}
.topbar #snap-picker option { color: #14202b; background: #fff; }
.topbar #btn-sync {
  background: var(--plate); color: var(--plate-ink); border: 0; border-radius: 6px;
  padding: 7px 14px; font-weight: 700; font-size: 13px;
}
.topbar #btn-sync:hover { filter: brightness(1.05); }
@media (max-width: 860px) {
  .main { --main-pt: 18px; --main-px: 14px; }
  .topbar { padding: 14px 16px 12px; }
}
/* opis schematu jak w makiecie (2026-10-06): szary tekst pod nagłówkiem,
   kreska oddziela nagłówek karty od listy dróg */
.sld-desc { margin: 10px 0 0; padding-bottom: 14px; border-bottom: 1px solid var(--border); color: var(--muted); font-size: 13px; }
.sld-card .sld { padding-top: 6px; }
/* Pasek boczny bez przewijania (2026-10-06, na prośbę): całe menu zawsze
   widoczne - odstępy kurczą się razem z wysokością okna (vh), a lista
   zakładek nie ma paska przewijania. */
.sidebar { padding: clamp(10px, 1.6vh, 16px) 12px; }
.brand { padding-bottom: clamp(8px, 1.2vh, 14px); margin-bottom: clamp(4px, .8vh, 10px); }
.brand-logo { height: clamp(40px, 5.5vh, 58px); }
.nav { overflow: hidden; gap: 0; }
.nav-item { padding: clamp(3px, .55vh, 7px) 12px; font-size: 13.5px; line-height: 1.35; }
.nav-group + .nav-group { margin-top: clamp(4px, .9vh, 12px); }
.nav-group-label { padding-bottom: 1px; font-size: 11.5px; }
.sidebar-foot { gap: clamp(6px, 1vh, 10px); padding-top: clamp(8px, 1.2vh, 12px); }

/* Migawka w stopce paska bocznego, nad nieobecnymi/online i użytkownikiem (2026-10-06) */
.sb-snap { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 0 4px 8px;
  border-bottom: 1px solid var(--border); font-size: 12px; color: var(--muted); line-height: 1.35; }
.sb-snap b { color: var(--text); font-weight: 700; }
.sb-snap .snap-age { margin-left: 4px; }
.sb-snap-l2 { font-size: 11.5px; }
@media (max-width: 860px) { .sb-snap { display: none; } }

/* ================= Znak drogowy przy tytule zakładki (2026-10-07) ================= */
.view-title-row { display: flex; align-items: center; gap: 10px; }
.view-sign { width: 34px; height: 34px; flex: none; display: inline-grid; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .45)); }
.view-sign:empty { display: none; }
.view-sign svg { width: 100%; height: 100%; display: block; }
.view-sign.pop { animation: sign-pop .45s cubic-bezier(.2, .9, .3, 1.3); }
@keyframes sign-pop { from { transform: scale(.4) rotate(-12deg); opacity: 0; } }
/* ================= Zakładka Drogi wg nowego stylu (2026-10-07) ================= */
.stage-sw { width: 18px; height: 4px; border-radius: 2px; display: inline-block; margin-right: 6px; vertical-align: middle; }
.legend-sep { width: 1px; height: 14px; background: var(--border); }
#road-status-filter button .cnt {
  display: inline-block; min-width: 20px; margin-left: 6px; padding: 0 6px; border-radius: 9px;
  background: var(--surface-2); color: var(--muted); font-size: 11px; font-weight: 700; text-align: center;
}
#road-status-filter button.active .cnt { background: rgba(255, 255, 255, .22); color: inherit; }
/* trzy etapy: liczba + cienka kreska w kolorze etapu (jak schemat liniowy) */
.stage-cell { display: inline-flex; flex-direction: column; align-items: flex-end; gap: 4px; min-width: 64px; }
.stage-mini { display: block; width: 64px; height: 4px; border-radius: 2px; background: var(--border); overflow: hidden; }
.stage-mini i { display: block; height: 100%; border-radius: 2px; }
.stage-mini.s1 i { background: var(--s1); } .stage-mini.s2 i { background: var(--s2); } .stage-mini.s3 i { background: var(--s3); }
#road-table .road-name { white-space: nowrap; }
.road-utr-badge {
  display: inline-block; margin-left: 8px; font-size: 12px; font-weight: 700; color: var(--amber);
  vertical-align: middle;
}
#road-table tbody tr.road-row:hover td { background: var(--surface-2); }
#road-table tbody tr.road-row:hover td:first-child { box-shadow: inset 3px 0 0 var(--plate); }
#road-table thead th { position: sticky; top: 0; z-index: 1; background: var(--surface); }

/* ================= Następna droga wg nowego stylu (2026-10-07) ================= */
.rp-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.rp-sum {
  display: grid; grid-template-columns: auto 1fr; gap: 2px 14px; align-items: center; text-align: left;
  padding: 14px 18px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface);
  box-shadow: var(--shadow); color: inherit; font: inherit; cursor: pointer; position: relative; overflow: hidden;
}
.rp-sum:hover { border-color: var(--text); }
.rp-sum.active { box-shadow: inset 0 -3px 0 var(--plate), var(--shadow); }
.rp-sum b { grid-row: span 2; font-size: 34px; font-weight: 800; line-height: 1; }
.rp-sum span { font-size: 13.5px; font-weight: 700; }
.rp-sum small { font-size: 12px; color: var(--muted); }
/* pasek jak odcinek drogi: wypełnienie = udział kilometrów w sieci */
.rp-sum i { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--rp-sum, var(--muted)); opacity: .8; }
.rp-sum.st-not_started { --rp-sum: var(--muted); }
.rp-sum.st-started { --rp-sum: var(--amber); }
.rp-sum.st-done { --rp-sum: var(--green); }
#rp-status-filter button .cnt {
  display: inline-block; min-width: 20px; margin-left: 6px; padding: 0 6px; border-radius: 9px;
  background: var(--surface-2); color: var(--muted); font-size: 11px; font-weight: 700; text-align: center;
}
#rp-status-filter button.active .cnt { background: rgba(255, 255, 255, .22); color: inherit; }
.rp-prog { display: inline-flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.rp-prog .stage-mini i { background: var(--text); }
#rp-table tbody tr:hover td:first-child { box-shadow: inset 3px 0 0 var(--plate); }
.rp-d-title { display: flex; align-items: center; gap: 12px; }
@media (max-width: 760px) { .rp-summary { grid-template-columns: 1fr; } }

/* ================= Prognozowanie wg nowego stylu (2026-10-07) ================= */
.fc-grid { display: grid; gap: 14px; }
.fc-row { display: grid; grid-template-columns: 220px minmax(0, 1fr) 260px; gap: 22px; align-items: center; }
.fc-row.is-overall { border-left: 4px solid var(--plate); }
.fc-name { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; }
.fc-name i { width: 18px; height: 5px; border-radius: 3px; background: var(--fc); flex: none; }
.fc-now { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.fc-now .anim-pct { color: var(--text); font-weight: 800; font-size: 20px; }
/* pas jezdni: asfalt + przerywana linia osi, wypełnienie = obecny stan */
.fc-track {
  position: relative; height: 16px; border-radius: 4px; overflow: visible;
  background: #39424c;
}
.fc-track::before {
  content: ""; position: absolute; left: 6px; right: 26px; top: 7px; height: 2px;
  background: repeating-linear-gradient(90deg, rgba(255, 255, 255, .85) 0 12px, transparent 12px 22px);
}
.fc-fill {
  position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px 0 0 4px;
  background: color-mix(in srgb, var(--fc) 82%, transparent); width: 0;
  transition: width 1.1s cubic-bezier(.22, .7, .3, 1);
}
/* meta: biało-czarna szachownica jak na końcu odcinka */
.fc-track::after {
  content: ""; position: absolute; right: 0; top: 0; bottom: 0; width: 18px; border-radius: 0 4px 4px 0;
  background: conic-gradient(#fff 25%, #14202b 0 50%, #fff 0 75%, #14202b 0) 0 0 / 8px 8px;
}
.fc-ticks { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 5px; padding-right: 20px; }
.fc-body .kpi-value { font-size: 24px; }
.fc-body .kpi-sub { margin-top: 2px; }
@media (max-width: 1100px) { .fc-row { grid-template-columns: 1fr; gap: 10px; } }

/* ================= Kontrola jakości wg nowego stylu (2026-10-07) ================= */
.qc-readout { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 26px; align-items: center; }
.qc-readout[hidden] { display: none; }
.qc-total b { display: block; font-size: 44px; font-weight: 800; line-height: 1; }
.qc-total span { font-size: 12.5px; color: var(--muted); }
.qc-sum { font-size: 14px; font-weight: 700; margin-bottom: 8px; }
.qc-sum small { font-weight: 400; color: var(--muted); margin-left: 6px; }
/* pasek 8 kontroli */
.qc-bar { position: relative; display: grid; grid-template-columns: repeat(8, 1fr); gap: 3px; overflow: hidden; border-radius: 4px; }
.qc-seg { height: 12px; background: var(--green); opacity: .85; }
.qc-seg.bad { background: var(--amber); }
.qc-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 8px; font-size: 11.5px; color: var(--muted); }
.qc-legend span::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; background: var(--green); vertical-align: middle; }
.qc-legend span.bad::before { background: var(--amber); }
.quality-card { position: relative; }
.quality-sign { position: absolute; top: 12px; right: 12px; width: 26px; height: 26px; }
.quality-sign svg { width: 100%; height: 100%; display: block; }
@media (max-width: 700px) { .qc-readout { grid-template-columns: 1fr; } }

/* ================= Raporty wg nowego stylu (2026-10-07) ================= */
.rep-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 6px 0 14px; }
.rep-tile {
  display: grid; grid-template-columns: 40px 1fr; grid-template-rows: auto 1fr; gap: 2px 12px; align-items: start;
  padding: 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2);
  color: var(--text); text-decoration: none; transition: transform .15s, border-color .15s;
}
.rep-tile svg { grid-row: span 2; width: 34px; height: 42px; color: var(--muted); }
.rep-tile b { font-size: 14px; }
.rep-tile span { font-size: 12px; color: var(--muted); line-height: 1.4; }
.rep-tile:hover { border-color: var(--text); transform: translateY(-2px); }
.rep-tile:hover svg { animation: rep-drop .6s ease; }
@keyframes rep-drop { 40% { transform: translateY(3px); } }
/* migawki jako oś czasu ze słupkami pikietażowymi */
.snap-timeline tbody td:first-child { position: relative; padding-left: 30px; font-weight: 700; white-space: nowrap; }
.snap-timeline tbody td:first-child::before {
  content: ""; position: absolute; left: 12px; top: 0; bottom: 0; width: 2px;
  background: repeating-linear-gradient(180deg, var(--border) 0 6px, transparent 6px 10px);
}
.snap-timeline tbody td:first-child::after {
  content: ""; position: absolute; left: 8px; top: 50%; width: 10px; height: 10px; margin-top: -5px; border-radius: 2px;
  background: #fff; border: 2px solid var(--muted);
}
.snap-timeline tbody tr:first-child td:first-child::after { background: var(--plate); border-color: var(--plate-ink); }

/* ================= Zmiany wg nowego stylu (2026-10-07) ================= */
.delta-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.delta-tiles:empty { display: none; }
.delta-tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; border-top: 3px solid var(--dt, var(--plate)); }
.delta-tile b { display: block; font-size: 26px; font-weight: 800; line-height: 1.1; }
.delta-tile span { font-size: 12.5px; color: var(--muted); }
#delta-head th:nth-child(2), #delta-head th:nth-child(5) { box-shadow: inset 0 -2px 0 var(--s1); }
#delta-head th:nth-child(3), #delta-head th:nth-child(6) { box-shadow: inset 0 -2px 0 var(--s2); }
#delta-head th:nth-child(4), #delta-head th:nth-child(7) { box-shadow: inset 0 -2px 0 var(--s3); }

/* ================= Analizy GIS - akcenty dziedzinowe (2026-10-07) ================= */
/* plakietka "na żywo": pulsująca kropka jak dioda pracującego skanera */
.an-badge:not(.an-badge-stale)::before { animation: live-dot 1.8s ease-in-out infinite; }
@keyframes live-dot { 50% { box-shadow: 0 0 0 4px rgba(51, 102, 214, .18); opacity: .55; } }
.an-viewtab { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.an-vt-ico { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.an-viewtab.is-active { background: var(--text); border-color: var(--text); color: var(--surface); box-shadow: inset 0 -3px 0 var(--plate); }

/* ================= Ustawienia wg nowego stylu (2026-10-07) ================= */
.set-nav {
  position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: 6px;
  padding: 10px 0 12px; margin-bottom: 4px; background: var(--bg);
}
.set-nav:empty { display: none; }
.set-nav button {
  display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); border-radius: 16px; padding: 5px 12px; font: inherit; font-size: 12.5px; cursor: pointer;
}
.set-nav button::before { content: ""; width: 10px; height: 3px; border-radius: 2px; background: var(--border); }
.set-nav button:hover { border-color: var(--text); }
.set-nav button.active { background: var(--text); color: var(--surface); border-color: var(--text); }
.set-nav button.active::before { background: var(--plate); }
#view-settings > .card { scroll-margin-top: 64px; position: relative; }

/* ================= Prognozowanie - faza 2 (2026-10-07) ================= */
.fc-plan { margin-bottom: 14px; }
.fc-plan-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 10px; }
.fc-plan-head h2 { margin: 0; }
.fc-ctrls { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-left: auto; }
.fc-ctrl { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.fc-ctrl select { padding: 5px 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit; font-size: 12.5px; }
.fc-seg { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; font-size: 12.5px; }
.fc-seg span { padding: 5px 9px; color: var(--muted); background: var(--surface-2); border-right: 1px solid var(--border); }
.fc-seg button { border: 0; border-right: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: 12.5px; padding: 5px 10px; cursor: pointer; }
.fc-seg button:last-child { border-right: 0; }
.fc-seg button.active { background: var(--text); color: var(--surface); font-weight: 700; }
.fc-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin-bottom: 12px; }
.fc-fact { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; border-left: 3px solid var(--ff, var(--border)); }
.fc-fact b { display: block; font-size: 20px; font-weight: 800; line-height: 1.15; }
.fc-fact span { font-size: 12px; color: var(--muted); line-height: 1.35; display: block; margin-top: 2px; }
.fc-fact.ok { --ff: var(--green); } .fc-fact.warn { --ff: var(--amber); } .fc-fact.bad { --ff: var(--red); }
.fc-note { font-size: 12px; margin: 8px 0 0; }

/* ================= Prace terenowe (2026-10-07, web/teren.js) =================
   Ten sam układ i jasne panele co zakładka Utrudnienia. Mapa na większość
   ekranu; u góry trzy przyciski dodawania; z prawej karta/formularz (na
   telefonie arkusz od dołu). Statusy: kolor + kształt + znak (✓ ! ?). */
#view-teren {
  --utr-ink: #1d2733; --utr-muted: #5d6b7a; --utr-line: #dde3ea;
  --utr-bg: rgba(255, 255, 255, .97); --utr-soft: #f3f6f9; --utr-blue: #2f7fd8;
  --tr-accent: #14202b; --tr-plate: #f5c400;
}
.tr-wrap { position: relative; }
.tr-map {
  height: calc(100vh - 210px); min-height: 520px;
  border-radius: var(--radius); border: 1px solid var(--border); background: #e9eef2;
}
.tr-toolbar {
  position: absolute; z-index: 560; top: 12px; left: 344px; right: 60px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; pointer-events: none;
}
.tr-toolbar > * { pointer-events: auto; }
.tr-side.is-collapsed ~ .tr-toolbar { left: 230px; }
.tr-adds { display: flex; gap: 8px; flex-wrap: wrap; }
.tr-adds[hidden] { display: none; }
.tr-add {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 16px 6px 8px;
  border-radius: 10px; border: 2px solid var(--tr-accent); background: var(--tr-plate); color: var(--tr-accent);
  font: inherit; font-size: 14px; font-weight: 800; cursor: pointer; box-shadow: 0 4px 14px rgba(20, 30, 45, .25);
  transition: transform .12s, box-shadow .12s;
}
.tr-add:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(20, 30, 45, .3); }
.tr-add:focus-visible { outline: 3px solid #2f7fd8; outline-offset: 2px; }
.tr-add-ico { width: 28px; height: 28px; display: grid; place-items: center; background: #fff; border-radius: 7px; border: 1.5px solid var(--tr-accent); }
.tr-add-ico svg { width: 20px; height: 20px; }
.tr-readonly { background: var(--utr-bg); color: var(--utr-ink); border: 1px solid var(--utr-line); border-radius: 10px; padding: 8px 12px; font-size: 12.5px; }
.tr-readonly[hidden] { display: none; }
.tr-mode { margin-left: auto; display: flex; background: var(--utr-bg); border: 1px solid var(--utr-line); border-radius: 10px; padding: 3px; box-shadow: 0 4px 14px rgba(20, 30, 45, .15); }
.tr-mode button { border: 0; background: none; color: var(--utr-ink); font: inherit; font-size: 13px; font-weight: 600; padding: 8px 12px; border-radius: 8px; cursor: pointer; min-height: 38px; }
.tr-mode button.active { background: var(--tr-accent); color: #fff; }

.tr-side { top: 12px; left: 12px; bottom: 12px; width: 320px; z-index: 550; }
.tr-side { overflow: hidden; }
.tr-side .utr-side-body { overflow-y: auto; min-height: 0; }
.tr-tree { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.tr-tree-row { min-height: 32px; }
.tr-tree-row input { width: 16px; height: 16px; }
.tr-tree-sym { width: 22px; display: inline-grid; place-items: center; }
.tr-tree-axis { width: 20px; height: 0; border-top: 3px solid #8b97a4; }
.tr-tree-note { font-size: 11px; color: var(--utr-muted); margin: -2px 0 2px 46px; }
.tr-filters { gap: 8px; }
.tr-field { display: flex; flex-direction: column; gap: 3px; font-size: 11.5px; font-weight: 600; color: var(--utr-muted); }
.tr-field select, .tr-field input { padding: 7px 9px; border-radius: 9px; border: 1px solid var(--utr-line); background: #fff; color: var(--utr-ink); font: inherit; font-size: 13px; min-height: 36px; }
.tr-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tr-check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--utr-ink); }
.tr-check[hidden] { display: none; }
.tr-link { border: 0; background: none; color: #1e5aa8; font: inherit; font-size: 12px; cursor: pointer; padding: 0; text-decoration: underline; margin-left: auto; }
.tr-list-wrap { display: flex; flex-direction: column; gap: 6px; }
.tr-list-head { display: flex; justify-content: space-between; align-items: center; border: 0; background: none; padding: 2px 0; font: inherit; font-size: 13.5px; font-weight: 700; color: var(--utr-ink); cursor: pointer; }
.tr-list-head.is-closed .tr-chev { transform: rotate(-90deg); }
.tr-list[hidden] { display: none; }
.tr-list { overflow: visible; flex: none; }
.tr-item { grid-template-columns: 30px 1fr; }
.tr-item-sym { display: grid; place-items: center; padding-top: 2px; }
.tr-item.is-arch { opacity: .6; border-style: dashed; }
.tr-dw { background: var(--tr-plate); border: 1px solid var(--tr-accent); border-radius: 3px; padding: 0 4px; font-size: 11px; font-weight: 800; margin-right: 6px; }

.tr-marker { background: none; border: 0; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .35)); }
.tr-marker.is-arch { opacity: .45; }
.tr-marker.tr-draft { filter: drop-shadow(0 3px 6px rgba(0, 0, 0, .45)); }

.tr-legend { right: 124px; bottom: 26px; z-index: 540; padding: 8px 12px; font-size: 12px; max-width: min(640px, calc(100% - 480px)); }
.tr-legend-toggle { border: 0; background: none; font: inherit; font-weight: 700; font-size: 12.5px; color: var(--utr-ink); cursor: pointer; padding: 2px 0; }
.tr-legend-toggle::after { content: " ▴"; }
.tr-legend.is-open .tr-legend-toggle::after { content: " ▾"; }
.tr-legend-body { display: grid; grid-template-columns: repeat(3, auto); gap: 4px 18px; margin-top: 6px; }
.tr-legend-body[hidden] { display: none; }
.tr-leg-col { display: flex; flex-direction: column; gap: 4px; }
.tr-leg-sym { width: 28px; display: inline-grid; place-items: center; }
.tr-wrap.has-sheet .tr-legend { right: 444px; }
/* otwarta karta/formularz nie zasłania przybliżania, podkładu ani skali */
.tr-wrap.has-sheet .leaflet-right { right: 432px; }
.tr-wrap.has-sheet .tr-toolbar { right: 492px; }
.tr-wrap.has-sheet .tr-add { padding: 6px; }
.tr-wrap.has-sheet .tr-add-txt, .tr-wrap.has-sheet .tr-mode { display: none; }
/* przy otwartej karcie: legenda zwinięta (nie wchodzi pod panele), dymek
   asystenta schowany - inaczej zasłaniał przycisk Zapisz */
.tr-wrap.has-sheet .tr-legend-body { display: none; }
body.tr-sheet-open .mini-ai-bubble, body.tr-summary-open .mini-ai-bubble { display: none !important; }

.tr-pickbar {
  position: absolute; z-index: 1100; top: 66px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: center;
  background: var(--tr-accent); color: #fff; border-radius: 12px; padding: 10px 14px; font-size: 14px; font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .35); max-width: calc(100% - 24px);
}
.tr-pickbar[hidden] { display: none; }
.tr-pick-btns { display: flex; gap: 6px; }
.tr-pickbar .utr-btn { min-height: 36px; }

.tr-sheet {
  position: absolute; z-index: 1050; top: 12px; right: 12px; bottom: 12px; width: 420px;
  display: flex; flex-direction: column; background: #fff; color: var(--utr-ink);
  border: 1px solid var(--utr-line); border-radius: 14px; box-shadow: 0 12px 36px rgba(20, 30, 45, .28);
  font-size: 13.5px; animation: tr-sheet-in .18s ease-out;
}
.tr-sheet[hidden] { display: none; }
@keyframes tr-sheet-in { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
.tr-sheet-grip { display: none; }
.tr-sheet-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--utr-line); }
.tr-sheet-head h2 { margin: 0; font-size: 16px; font-weight: 800; flex: 1; line-height: 1.25; }
.tr-sheet-sym:empty { display: none; }
.tr-sheet-close { width: 36px; height: 36px; }
.tr-sheet-body { flex: 1; overflow-y: auto; padding: 12px 16px 16px; overscroll-behavior: contain; }
.tr-sheet-foot { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; padding: 10px 14px; border-top: 1px solid var(--utr-line); background: var(--utr-soft); border-radius: 0 0 14px 14px; }
.tr-sheet-foot:empty { display: none; }
.tr-sheet-foot .utr-btn, .tr-primary { min-height: 40px; padding: 8px 14px; font-size: 13px; }
.tr-primary { border: 2px solid var(--tr-accent); background: var(--tr-accent); color: #fff; border-radius: 9px; font: inherit; font-weight: 700; cursor: pointer; }
.tr-primary:hover { filter: brightness(1.15); }
.tr-danger { min-height: 40px; padding: 8px 14px; font: inherit; font-size: 13px; font-weight: 700; border-radius: 9px;
  border: 1.5px solid #c7302b; background: #fff; color: #c7302b; cursor: pointer; margin-right: auto; }
.tr-danger:hover { background: #c7302b; color: #fff; }
.tr-danger:focus-visible { outline: 3px solid #2f7fd8; outline-offset: 2px; }
.tr-primary:disabled { opacity: .6; cursor: progress; }
.tr-primary:focus-visible, #view-teren .utr-btn:focus-visible { outline: 3px solid #2f7fd8; outline-offset: 2px; }

.tr-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.tr-badge { --c: #555; font-size: 12px; font-weight: 700; border-radius: 6px; padding: 3px 8px; color: var(--c); background: color-mix(in srgb, var(--c) 13%, #fff); border: 1px solid color-mix(in srgb, var(--c) 35%, #fff); }
.tr-badge-plain { --c: #3f4b58; }
.tr-badge-arch { --c: #7a5b00; }
.tr-src { display: inline-block; font-size: 12px; font-weight: 700; border-radius: 6px; padding: 3px 8px; margin: 0; }
.tr-src-own { color: #5b2bb5; background: #f1eafe; border: 1px solid #d9c7fb; }
.utr-badge.src-pzdw { background: #fff; color: #1d2733; border: 1px solid #c7d0d9; }
/* zgłoszenia pracowników (aplikacja „Teren”, 2026-10-07) - fiolet jak trójkąt „nowe”, wyraźnie inne niż PZDW */
.utr-badge.src-own { background: #f2ebff; color: #5b22c4; border: 1px solid #d5c2fb; }
.utr-section-own { border-top: 1px solid var(--border, #d8dee5); margin-top: 6px; padding-top: 4px; }
.utr-item.is-own { border-left: 4px solid #8a3ffc; }
.utr-own-tag { display: inline-block; font-size: 11px; font-weight: 700; color: #5b22c4; background: #f2ebff; border-radius: 4px; padding: 1px 5px; margin-left: 4px; }
.tr-dl { display: grid; grid-template-columns: 132px 1fr; gap: 5px 12px; margin: 0 0 6px; }
.tr-dl dt { color: var(--utr-muted); font-size: 12.5px; }
.tr-dl dd { margin: 0; overflow-wrap: anywhere; }
.tr-h3 { font-size: 13.5px; font-weight: 800; margin: 14px 0 6px; padding-top: 10px; border-top: 1px solid var(--utr-line); }
.tr-note { font-size: 12.5px; color: var(--utr-muted); margin: 0 0 6px; line-height: 1.45; }
.tr-muted { color: var(--utr-muted); font-size: 12px; }
.tr-warn { color: #a34a00; }
.tr-error { background: #fdecea; color: #8a1f17; border: 1px solid #f3b7b1; border-radius: 9px; padding: 9px 11px; font-size: 13px; margin-bottom: 10px; }
.tr-error[hidden] { display: none; }
.tr-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.tr-photos figure { margin: 0; }
.tr-photos img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; border: 1px solid var(--utr-line); display: block; }
.tr-photos figcaption { font-size: 11px; color: var(--utr-muted); margin-top: 2px; }
.tr-photos .tr-link { font-size: 11px; }
.tr-hist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; }
.tr-hist > li { border-left: 3px solid var(--utr-line); padding-left: 8px; }
.tr-hist ul { margin: 2px 0 0; padding-left: 16px; color: var(--utr-muted); }
.tr-hist s { color: #9aa5b1; }
.tr-chips { display: flex; flex-direction: column; gap: 6px; }
.tr-chip { text-align: left; border: 1px solid var(--utr-line); background: var(--utr-soft); border-radius: 8px; padding: 7px 9px; font: inherit; font-size: 12.5px; cursor: pointer; color: var(--utr-ink); }
.tr-chip:hover { border-color: var(--utr-blue); }

/* formularz */
#tr-form { display: flex; flex-direction: column; gap: 11px; }
.tr-ff { display: flex; flex-direction: column; gap: 4px; }
.tr-ff-l { font-size: 12.5px; font-weight: 700; color: var(--utr-ink); }
.tr-ff-h { font-size: 11.5px; color: var(--utr-muted); font-weight: 400; }
.tr-ff input:not([type="checkbox"]):not([type="file"]), .tr-ff select, .tr-ff textarea, .tr-kmrow input {
  width: 100%; padding: 9px 10px; border-radius: 9px; border: 1px solid #c9d2db; background: #fff; color: var(--utr-ink);
  font: inherit; font-size: 15px; min-height: 42px;
}
.tr-ff textarea { min-height: 64px; resize: vertical; }
.tr-ff input:focus, .tr-ff select:focus, .tr-ff textarea:focus, .tr-kmrow input:focus { outline: 2px solid #2f7fd8; outline-offset: 0; border-color: #2f7fd8; }
.tr-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tr-fs { border: 1px solid var(--utr-line); border-radius: 10px; padding: 9px 11px 11px; margin: 0; background: var(--utr-soft); }
.tr-fs legend, .tr-fs > summary { font-size: 12.5px; font-weight: 800; padding: 0 4px; }
.tr-fs > summary { cursor: pointer; padding: 2px 0; }
details.tr-fs[open] > summary { margin-bottom: 8px; }
details.tr-fs .tr-grid2 { margin-top: 8px; }
.tr-btnrow { display: flex; flex-wrap: wrap; gap: 6px; }
.tr-btnrow .utr-btn { min-height: 40px; font-size: 12.5px; }
.tr-file-btn { display: inline-flex; align-items: center; }
.tr-geo-sum { font-size: 12.5px; margin-top: 8px; line-height: 1.45; }
.tr-kmrow { display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px; margin-top: 8px; }
.tr-kmrow[hidden] { display: none; }
.tr-seg { display: flex; flex-wrap: wrap; gap: 6px; }
.tr-seg button {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 11px; border-radius: 9px;
  border: 1.5px solid #c9d2db; background: #fff; color: var(--utr-ink); font: inherit; font-size: 13px; cursor: pointer;
}
.tr-seg button.active { border-color: var(--tr-accent); background: var(--tr-accent); color: #fff; font-weight: 700; }
.tr-seg button:focus-visible { outline: 3px solid #2f7fd8; outline-offset: 1px; }
.tr-file { font: inherit; font-size: 13px; }
.tr-thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.tr-thumbs:empty { display: none; }
.tr-thumbs figure { margin: 0; position: relative; }
.tr-thumbs img { width: 84px; height: 64px; object-fit: cover; border-radius: 8px; border: 1px solid var(--utr-line); display: block; }
.tr-thumb-x { position: absolute; top: -6px; right: -6px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: var(--tr-accent); color: #fff; cursor: pointer; font-size: 12px; }
.tr-similar { border: 2px solid #e7a33b; background: #fff8ec; border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.tr-similar.is-empty { border-color: var(--utr-line); background: var(--utr-soft); }
.tr-sim-row { display: grid; grid-template-columns: auto 22px 1fr; gap: 8px; align-items: start; font-size: 12.5px; cursor: pointer; }
.tr-sim-row input { width: 18px; height: 18px; margin-top: 2px; }

/* podsumowanie */
.tr-summary {
  position: absolute; z-index: 600; inset: 66px 60px 12px 344px; overflow: auto; background: #fff; color: var(--utr-ink);
  border: 1px solid var(--utr-line); border-radius: 14px; box-shadow: 0 12px 36px rgba(20, 30, 45, .22); padding: 16px 18px;
}
.tr-summary[hidden] { display: none; }
.tr-side.is-collapsed ~ .tr-summary { left: 12px; }
.tr-sum-head { display: flex; gap: 14px; align-items: flex-start; justify-content: space-between; }
.tr-sum-head h2 { font-size: 17px; font-weight: 800; margin: 0 0 4px; }
.tr-sum-head .tr-note { max-width: 78ch; }
.tr-sum-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin: 12px 0; }
.tr-tile { border: 1px solid var(--utr-line); border-left: 5px solid var(--tr-plate); border-radius: 10px; padding: 9px 12px; display: flex; flex-direction: column; gap: 1px; }
.tr-tile span { font-size: 12px; color: var(--utr-muted); font-weight: 600; }
.tr-tile b { font-size: 22px; font-weight: 800; }
.tr-tile small { font-size: 11.5px; color: var(--utr-muted); }
.tr-sum-scroll { overflow-x: auto; }
.tr-sum-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.tr-sum-table th, .tr-sum-table td { padding: 7px 8px; border-bottom: 1px solid var(--utr-line); text-align: right; vertical-align: top; white-space: nowrap; }
.tr-sum-table th:first-child, .tr-sum-table td:first-child { text-align: left; }
.tr-sum-table thead th { font-size: 11.5px; color: var(--utr-muted); font-weight: 700; background: var(--utr-soft); }
.tr-sum-table th.tr-grp { text-align: center; color: var(--utr-ink); border-left: 2px solid #fff; }
.tr-sum-table .tr-link { margin: 0; }
.tr-pct { font-weight: 800; }
.tr-noplan { display: inline-block; font-size: 11.5px; font-weight: 700; color: #6b4a00; background: #f3eee2; border-radius: 6px; padding: 1px 6px; }
.tr-empty-big { padding: 24px 4px; color: var(--utr-muted); }
.tr-plan { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--utr-line); display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; font-size: 12.5px; }
.tr-plan b { width: 100%; font-size: 13.5px; }
.tr-plan label { display: flex; flex-direction: column; gap: 3px; color: var(--utr-muted); font-weight: 600; }
.tr-plan input, .tr-plan select { padding: 8px 10px; border-radius: 9px; border: 1px solid #c9d2db; font: inherit; font-size: 14px; min-height: 40px; width: 150px; }

.tr-notice { position: absolute; z-index: 700; top: 50%; left: 50%; transform: translate(-50%, -50%); background: #fff; color: var(--utr-ink); border: 2px solid #e7a33b; border-radius: 14px; padding: 18px 20px; max-width: min(520px, calc(100% - 32px)); box-shadow: 0 12px 36px rgba(0,0,0,.25); }
.tr-notice[hidden] { display: none; }
.tr-notice p { margin: 6px 0 0; font-size: 13px; color: var(--utr-muted); }
.leaflet-control-layers .tr-ov svg { vertical-align: middle; }

/* mapa nie może być zasłonięta dymkiem asystenta - na wąskich ekranach w
   tej zakładce dymek się chowa (asystent dostępny w innych zakładkach) */
/* chmurka zachęt asystenta zasłaniała legendę i narzędzia mapy - w tej
   zakładce jej nie pokazujemy (sam dymek zostaje w rogu, poza panelami) */
body.is-teren .mini-ai-teaser { display: none !important; }
@media (max-width: 860px) {
  body.is-teren .mini-ai-bubble { display: none !important; }
  .tr-map { height: calc(100vh - 150px); min-height: 440px; }
  .tr-toolbar { left: 8px; right: 8px; top: 8px; }
  .tr-side.is-collapsed ~ .tr-toolbar { left: 8px; }
  .tr-adds { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; width: calc(100% - 52px); }
  .tr-add { flex-direction: column; gap: 3px; font-size: 11.5px; line-height: 1.15; padding: 6px 4px; min-height: 56px; text-align: center; justify-content: center; }
  .tr-add-ico { width: 24px; height: 24px; }
  .tr-mode { margin-left: 0; }
  .tr-mode button { font-size: 12px; padding: 6px 10px; min-height: 36px; }
  .tr-side { top: auto; bottom: 8px; left: 8px; right: 8px; width: auto; max-height: 46%; }
  .tr-side.is-collapsed { right: auto; }
  .tr-legend { right: 8px; left: auto; bottom: auto; top: 172px; max-width: calc(100% - 16px); }
  .tr-legend-body { grid-template-columns: 1fr; }
  .tr-wrap.has-sheet .tr-legend, .tr-wrap.has-sheet .tr-side { display: none; }
  .tr-wrap.has-sheet .leaflet-right { right: 0; }
  .tr-wrap.has-sheet .tr-toolbar { right: 8px; }
  .tr-sheet { top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 82%; border-radius: 16px 16px 0 0; animation-name: tr-sheet-up; }
  .tr-sheet.is-peek { max-height: 30%; }
  .tr-sheet-grip { display: block; width: 44px; height: 5px; border-radius: 3px; background: #c9d2db; margin: 8px auto 0; }
  .tr-wrap.is-picking .tr-sheet { display: none; }
  .tr-pickbar { top: auto; bottom: 16px; }
  .tr-summary { inset: 112px 8px 8px 8px; }
  .tr-grid2 { grid-template-columns: 1fr; }
  .tr-dl { grid-template-columns: 110px 1fr; }
}
@keyframes tr-sheet-up { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) and (max-width: 0px) { .tr-sheet { animation: none; } .tr-add { transition: none; } }

/* Eksport wyników w podsumowaniu zakładki Przejazdy (2026-10-07) */
.tr-sum-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex: none; }
/* eksport na dole po prawej (2026-10-07) */
.tr-sum-foot { display: flex; justify-content: flex-end; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--utr-line); }
.tr-export { display: flex; align-items: center; background: var(--utr-soft); border: 1px solid var(--utr-line); border-radius: 10px; padding: 3px; }
.tr-export span { font-size: 12px; color: var(--utr-muted); padding: 0 8px 0 6px; }
.tr-export button { border: 0; background: none; color: var(--utr-ink); font: inherit; font-size: 13px; font-weight: 600; padding: 8px 11px; border-radius: 8px; cursor: pointer; min-height: 38px; }
.tr-export button:hover { background: #fff; }
.tr-export button:disabled { opacity: .55; cursor: progress; }
@media (max-width: 860px) { .tr-export span { display: none; } }

/* ================= Analizy GIS - nowa szata (2026-10-07, wg makiety) =================
   Tylko wygląd: znaki drogowe, oznakowanie poziome i motyw mobilnego
   skanowania (statyczna chmura punktów). Zakres analizy bez zmian. */
:root { --asphalt: #2c343d; }
:root[data-theme="dark"] { --asphalt: #0d1318; }
/* wejście do asystenta: pas jezdni z linią P-1, po prawej chmura punktów */
.an-ai-launcher {
  position: relative; overflow: hidden; background: var(--asphalt); border: 0; color: #fff;
  padding: 18px 22px 26px; border-radius: 14px;
}
.an-ai-launcher:hover { background: var(--asphalt); box-shadow: 0 6px 22px rgba(20, 32, 43, .28); }
.an-ai-launcher::before {
  content: ""; position: absolute; left: 22px; right: 22px; bottom: 10px; height: 3px; pointer-events: none;
  background: repeating-linear-gradient(90deg, #fff 0 22px, transparent 22px 36px); opacity: .55;
}
.an-ai-launcher::after {
  content: ""; position: absolute; right: 0; top: 0; bottom: 0; width: 46%; pointer-events: none;
  background: radial-gradient(circle, rgba(140, 220, 255, .6) 0 1px, transparent 1.6px) 0 0 / 9px 9px;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 70%); mask-image: linear-gradient(90deg, transparent, #000 70%);
  opacity: .5;
}
.an-ai-launcher > * { position: relative; z-index: 1; }
.an-ai-text b { font-size: 18px; font-weight: 800; color: #fff; }
.an-ai-text span { color: rgba(255, 255, 255, .75); }
.an-ai-cta { background: var(--plate); border-color: var(--plate); color: var(--plate-ink); font-weight: 800; }
.an-ai-cta::after { content: " →"; }
/* panel asystenta */
.ai-panel-card { border-color: var(--border); border-left: 4px solid var(--plate); }
.ai-textarea-wrap { display: flex; gap: 12px; align-items: flex-start; }
.ai-q-sign { width: 34px; height: 34px; flex: none; margin-top: 4px; }
.ai-q-sign svg, .ai-ex-sign svg, .an-vt-sign svg { width: 100%; height: 100%; display: block; }
.ai-textarea-wrap .ai-textarea { flex: 1; font-size: 15px; }
.ai-example { display: inline-flex; align-items: center; gap: 7px; padding: 4px 11px 4px 5px; color: var(--text); background: var(--surface); }
.ai-example:hover { color: var(--text); border-color: var(--text); }
.ai-ex-sign { width: 20px; height: 20px; flex: none; }
/* oczekiwanie: trajektoria przejazdu - punkty zapalają się po kolei */
.ai-thinking-dot { width: 7px; height: 7px; background: var(--plate); animation: ai-traj 1.4s ease-in-out infinite; }
@keyframes ai-traj { 0%, 100% { opacity: .25; transform: none; } 40% { opacity: 1; transform: scale(1.3); } }
/* odpowiedź */
.ai-answer { background: var(--surface-2); border-color: var(--border); }
/* rodzaj analizy jako kafelki ze znakami */
.an-viewtabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; background: none; border: 0; padding: 0; }
.an-viewtab {
  display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center; text-align: left; justify-content: stretch;
  padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); box-shadow: var(--shadow); position: relative; overflow: hidden; min-height: 64px;
}
.an-viewtab:hover { background: var(--surface); border-color: var(--text); color: var(--text); }
.an-vt-sign { width: 40px; height: 40px; }
.an-vt-txt b { display: block; font-size: 14.5px; font-weight: 700; }
.an-vt-txt small { display: block; font-size: 12px; color: var(--muted); font-weight: 400; }
.an-viewtab.is-active, .an-viewtab.is-active:hover { background: var(--asphalt); color: #fff; border-color: var(--asphalt); box-shadow: var(--shadow); }
.an-viewtab.is-active .an-vt-txt small { color: rgba(255, 255, 255, .7); }
.an-viewtab.is-active::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: 6px; height: 2px;
  background: repeating-linear-gradient(90deg, var(--plate) 0 14px, transparent 14px 24px);
}
@media (max-width: 900px) { .an-viewtabs { grid-template-columns: 1fr; } }
/* zakres analizy: znaczki przy etykietach pól */
.an-field > label { display: flex; align-items: center; gap: 7px; }
.an-field[data-an-field="road"] > label::before {
  content: "DW"; display: inline-grid; place-items: center; height: 15px; padding: 1px 4px 0; border-radius: 2px;
  background: var(--plate); color: var(--plate-ink); box-shadow: inset 0 0 0 1px var(--plate-ink); font-size: 9px; font-weight: 800; line-height: 1;
}
.an-field[data-an-field="km"] > label::before {   /* słupek pikietażowy */
  content: ""; width: 7px; height: 14px; border: 1.5px solid var(--plate-ink); border-radius: 2px 2px 1px 1px;
  background: linear-gradient(var(--red) 0 4px, #fff 4px);
}
.an-field[data-an-field="stage"] > label::before {
  content: ""; width: 18px; height: 5px; border-radius: 3px;
  background: linear-gradient(90deg, var(--s1) 0 33%, var(--s2) 33% 66%, var(--s3) 66%);
}
.an-field[data-an-field="symbol"] > label::before {   /* linia na jezdni */
  content: ""; width: 14px; height: 14px; border-radius: 3px;
  background: repeating-linear-gradient(180deg, #fff 0 3px, transparent 3px 5px) center / 2px 100% no-repeat, #3a434d;
}
.an-field[data-an-field="adminLevel"] > label::before, .an-field[data-an-field="adminUnit"] > label::before {
  content: ""; width: 16px; height: 11px; border-radius: 2px; background: var(--info, #1d5fbf);
}
/* wyniki: pasek koloru u góry kafelków */
.an-kpi { border-top: 4px solid var(--text); background: var(--surface); }
.an-kpi:nth-child(4n+1) { border-top-color: var(--s1); }
.an-kpi:nth-child(4n+2) { border-top-color: var(--plate); }
.an-kpi:nth-child(4n+3) { border-top-color: var(--s2); }
.an-kpi-label { text-transform: none; letter-spacing: 0; font-size: 12.5px; font-weight: 700; }
/* mapa: tło jak podgląd chmury punktów (widać przed wczytaniem podkładu) */
.an-map { background: radial-gradient(circle, color-mix(in srgb, var(--muted) 45%, transparent) 0 1px, transparent 1.4px) 0 0 / 10px 10px, var(--surface-2); }
/* tabela obiektów */
#an-table thead th { border-bottom: 2px solid var(--text); }
#an-table tbody tr:hover td:first-child { box-shadow: inset 3px 0 0 var(--plate); }
/* ================= Mapa: panel szczegółów z boku zamiast dymka (2026-10-08) ================= */
.map-wrap { position: relative; }
#map .leaflet-popup { visibility: hidden; }   /* treść dymka przenoszona do panelu */
.map-sheet {
  position: absolute; z-index: 650; top: 12px; right: 12px; bottom: 12px; width: 380px; max-width: calc(100% - 24px);
  display: flex; flex-direction: column; background: #fff; color: #1d2733;
  border: 1px solid #dde3ea; border-radius: 14px; box-shadow: 0 12px 36px rgba(20, 30, 45, .25);
  animation: map-sheet-in .2s ease-out;
}
.map-sheet[hidden] { display: none; }
@keyframes map-sheet-in { from { opacity: 0; transform: translateX(12px); } }
.map-sheet-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid #e3e8ee; }
.map-sheet-head b { font-size: 16px; font-weight: 800; flex: 1; min-width: 0; }
.map-sheet-sym { min-width: 28px; height: 28px; flex: none; display: grid; place-items: center; }
.map-sheet-sym:empty { display: none; }
.map-sheet-sym svg { width: 100%; height: 100%; display: block; }
.map-sheet-sym .road-plate { min-width: 46px; height: 24px; font-size: 13px; }
.map-sheet-close { width: 34px; height: 34px; border-radius: 10px; border: 1px solid #dde3ea; background: #fff; color: #1d2733; font-size: 16px; cursor: pointer; flex: none; }
.map-sheet-close:hover { border-color: #1d2733; }
.map-sheet-body { flex: 1; overflow-y: auto; padding: 14px 16px; font-size: 13.5px; }
.map-sheet-body .popup table { width: 100%; border-collapse: collapse; }
.map-sheet-body .popup td { padding: 6px 0; border-bottom: 1px solid #eef1f4; }
.map-sheet-body .popup td:last-child { text-align: right; font-weight: 700; }
.map-sheet-body .popup tr.sep td { border-bottom: 2px solid #dde3ea; padding: 2px 0; }
.map-sheet-body .utr-card { font-size: 13px; }
/* przyciski od lewej - prawy dolny róg zajmuje ikona asystenta */
.map-sheet-foot { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-start; padding: 12px 84px 12px 16px; border-top: 1px solid #e3e8ee; }
.map-sheet-foot[hidden] { display: none; }
.map-sheet-foot button { border: 1px solid #dde3ea; background: #fff; color: #1d2733; border-radius: 10px; padding: 8px 12px; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.map-sheet-foot button.primary { background: #1d2733; color: #fff; border-color: #1d2733; }
/* przyciski mapy (warstwy, zoom po prawej) odsuwają się, gdy panel jest otwarty */
.map-wrap.has-sheet .leaflet-right { right: 392px; }
@media (max-width: 760px) {
  .map-sheet { top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; max-height: 60%; }
  .map-wrap.has-sheet .leaflet-right { right: 0; }
}

/* ===== Narzędzia mapy: Orbit 3D, pomiar, rysowanie, raport... (2026-10-08) ===== */
.map-tools { width: 250px; pointer-events: none; }
.map-tools > * { pointer-events: auto; }
.mt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.mt-btn {
  display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 8px; min-width: 0;
  border: 0; border-radius: 4px; background: #fff; color: #14202b; cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,.3); font: 600 12.5px/1 "Overpass", "Segoe UI", sans-serif; text-align: left;
}
.mt-btn svg { flex: none; }
.mt-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-btn:hover { background: #f1f4f7; }
.mt-btn:focus-visible { outline: 2px solid #3366d6; outline-offset: 2px; }
.mt-btn.is-active { background: #3366d6; color: #fff; }
/* tryb wskazywania/rysowania: celownik, obiekty mapy nie przechwytują kliknięcia */
.map-picking, .map-picking .leaflet-grab, .map-picking .leaflet-interactive { cursor: crosshair !important; }
.map-picking .leaflet-overlay-pane .leaflet-interactive,
.map-picking .leaflet-marker-pane .leaflet-interactive,
.map-picking canvas.leaflet-interactive { pointer-events: none !important; }
.orbit-pin { background: none; border: 0; }
.orbit-pin span {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg); background: #3366d6; border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.4);
}
.orbit-pin svg { transform: rotate(45deg); color: #fff; }
.map-tool-card {
  position: absolute; top: 10px; left: 270px; z-index: 1001; width: 280px; max-height: calc(100% - 20px);
  overflow: auto; box-sizing: border-box; padding: 10px 12px; border-radius: 10px; background: #fff; color: #14202b;
  box-shadow: 0 4px 16px rgba(20, 32, 43, .25); font: 13px/1.45 "Overpass", "Segoe UI", sans-serif; cursor: auto;
}
@media (max-width: 760px) {
  .map-tool-card { top: auto; bottom: 8px; left: 8px; right: 8px; width: auto; max-height: 50%; }
  /* wąska mapa: same ikony (podpis w podpowiedzi i aria-label) */
  .map-tools { width: auto; }
  .mt-grid { grid-template-columns: repeat(2, 34px); }
  .mt-btn { justify-content: center; padding: 0; height: 34px; }
  .mt-btn span { display: none; }
}
body.print-map > #map .map-tool-card, body.print-map > #map .orbit-ctx { display: none !important; }
.map-tool-card[hidden] { display: none !important; }
.map-tool-card p { margin: 0 24px 8px 0; }
.map-tool-card .muted { color: #5e6b78; font-size: 12px; }
.map-tool-card code { font-size: 11.5px; }
.orbit-x {
  position: absolute; top: 4px; right: 6px; width: 24px; height: 24px; border: 0; border-radius: 4px;
  background: none; color: #5e6b78; cursor: pointer; font-size: 18px; line-height: 1;
}
.orbit-x:hover { background: #f1f4f7; color: #14202b; }
.orbit-choice {
  display: flex; align-items: center; gap: 8px; width: 100%; margin: 0 0 6px; padding: 7px 9px; border: 1px solid #d9dee3;
  border-radius: 6px; background: #fff; color: #14202b !important; text-decoration: none; text-align: left; cursor: pointer; font: inherit;
}
.orbit-choice:last-child { margin-bottom: 0; }
.orbit-choice:hover, .orbit-choice:focus-visible, .orbit-choice.on { border-color: #3366d6; background: #eef3fd; }
.orbit-choice svg { color: #3366d6; flex: none; }
.orbit-choice span { display: flex; flex-direction: column; min-width: 0; }
.orbit-choice small { color: #5e6b78; font-size: 11.5px; }
.orbit-clear { margin-top: 6px; padding: 0; border: 0; background: none; color: #5e6b78; cursor: pointer; font: inherit; font-size: 12px; text-decoration: underline; }
.orbit-ctx {
  position: absolute; z-index: 1100; padding: 4px; border-radius: 8px; background: #fff;
  box-shadow: 0 6px 22px rgba(20, 30, 45, .3);
}
.orbit-ctx button {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px; border: 0; border-radius: 5px;
  background: none; color: #14202b; cursor: pointer; font: 600 13px/1.2 "Overpass", "Segoe UI", sans-serif; white-space: nowrap;
}
.orbit-ctx button:hover, .orbit-ctx button:focus-visible { background: #eef3fd; color: #3366d6; outline: none; }
.mt-seg { display: flex; margin: 0 0 8px; border: 1px solid #d9dee3; border-radius: 6px; overflow: hidden; }
.mt-seg button { flex: 1; padding: 6px 4px; border: 0; background: #fff; color: #14202b; cursor: pointer; font: 600 12px/1.2 "Overpass", "Segoe UI", sans-serif; }
.mt-seg button + button { border-left: 1px solid #d9dee3; }
.mt-seg button.on { background: #3366d6; color: #fff; }
.mt-row { display: flex; gap: 6px; margin: 6px 0; }
.mt-row > * { flex: 1; }
.mt-act {
  padding: 6px 8px; border: 1px solid #c5ccd3; border-radius: 6px; background: #fff; color: #14202b; cursor: pointer;
  font: 600 12px/1.2 "Overpass", "Segoe UI", sans-serif;
}
.mt-act:hover:not(:disabled) { border-color: #3366d6; color: #3366d6; }
.mt-act.primary { background: #3366d6; border-color: #3366d6; color: #fff; }
.mt-act.primary:hover:not(:disabled) { background: #2853b4; color: #fff; }
.mt-act:disabled { opacity: .45; cursor: default; }
.mt-wide { width: 100%; margin-top: 6px; }
.mt-result { margin: 4px 0 6px; padding: 6px 8px; border-radius: 6px; background: #f3f6f9; }
.mt-hint b { color: #14202b; }
.mt-coords { width: 100%; border-collapse: collapse; margin-bottom: 6px; font-size: 12px; }
.mt-coords th { text-align: left; font-weight: 500; color: #5e6b78; padding: 2px 4px 2px 0; }
.mt-coords td { padding: 2px 0; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mt-coords button { padding: 1px 6px; border: 1px solid #d9dee3; border-radius: 4px; background: #fff; cursor: pointer; font-size: 11px; color: #3366d6; }
.mt-search { display: flex; gap: 6px; margin-bottom: 8px; }
.mt-search input { flex: 1; min-width: 0; padding: 6px 8px; border: 1px solid #c5ccd3; border-radius: 6px; font: inherit; color: #14202b; background: #fff; }
.mt-field { display: flex; flex-direction: column; gap: 3px; margin-bottom: 8px; font-size: 12px; color: #5e6b78; }
.mt-field input { padding: 6px 8px; border: 1px solid #c5ccd3; border-radius: 6px; font: inherit; color: #14202b; background: #fff; }
.mt-label {
  background: #fff; border: 1px solid #e8590c; border-radius: 4px; padding: 2px 6px; white-space: nowrap;
  color: #14202b; font: 700 12px/1.3 "Overpass", "Segoe UI", sans-serif; box-shadow: 0 1px 4px rgba(0,0,0,.25);
  width: auto !important; height: auto !important;
}
.mt-props th { text-align: left; padding-right: 8px; color: var(--muted); font-weight: 500; vertical-align: top; }
/* druk: mapa przeniesiona do <body> w rozmiarze strony A4 */
body.print-map #map-print-head {
  position: fixed; top: 0; left: 0; z-index: 10001; display: flex; justify-content: space-between; align-items: baseline;
  padding: 8px 0 6px; background: #fff; color: #14202b; font: 14px "Overpass", "Segoe UI", sans-serif;
}
body.print-map #map-print-head span { font-size: 11px; color: #5e6b78; }
body.print-map > #map { position: fixed !important; top: 36px; left: 0; z-index: 10000; background: #fff; }
body.print-map > #map .leaflet-top { display: none; }
@media print {
  body.print-map > *:not(#map):not(#map-print-head) { display: none !important; }
  body.print-map #map-print-head, body.print-map > #map { position: static !important; }
  body.print-map { background: #fff !important; }
}
/* pasek u dołu mapy: skala + współrzędne kursora, na prawo od panelu „Warstwy” (2026-10-09) */
.map-statusbar {
  position: absolute; left: 272px; bottom: 8px; z-index: 1000; display: flex; align-items: center; gap: 10px;
  max-width: calc(100% - 290px); padding: 3px 8px; border-radius: 6px; background: rgba(255, 255, 255, .88);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .2); color: #14202b; font: 12px/1.3 "Overpass", "Segoe UI", sans-serif; cursor: default;
}
.map-statusbar .leaflet-control-scale { margin: 0; float: none; }
.map-statusbar .leaflet-control-scale-line { background: transparent; }
.map-cursor-pos { display: flex; flex-direction: column; white-space: nowrap; font-variant-numeric: tabular-nums; line-height: 1.25; }
.map-cursor-pos b { font-weight: 600; }
.map-cursor-pos .wgs { color: #5e6b78; font-size: 11px; }
@media (max-width: 760px) {
  .map-statusbar { left: auto; right: 8px; max-width: calc(100% - 16px); }
  .map-cursor-pos { display: none; }   /* dotyk: brak kursora */
}
body.print-map > #map .map-cursor-pos { display: none; }
@media (min-width: 761px) and (max-width: 1200px) {
  .map-statusbar { bottom: 22px; }   /* wąska mapa: nad atrybucją OSM w prawym dolnym rogu */
}

/* ================= Pulpit: wyższy pasek z nagraniem i statystyki na nim (2026-10-10) ================= */
.topbar.topbar-hero { min-height: 300px; align-content: flex-start; }
/* mocniejsze przyciemnienie u dołu - tam stoją liczby */
.topbar.topbar-hero::after {
  background:
    linear-gradient(180deg, rgba(10, 14, 20, .45) 0%, rgba(10, 14, 20, .35) 35%, rgba(10, 14, 20, .82) 100%),
    linear-gradient(90deg, rgba(10, 14, 20, .55) 0%, rgba(10, 14, 20, 0) 60%);
}
.topbar-hero .dash-summary {
  flex: 1 1 100%; order: 10; margin: 18px 0 0; padding: 18px 0 2px; border: 0;
  border-top: 1px solid rgba(255, 255, 255, .22);
  /* jaśniejsze kolory etapów - czytelne na ciemnym nagraniu */
  --s1: #4fd1a5; --s2: #7fa6ff; --s3: #f08cbd;
}
.topbar-hero .dash-big { color: #fff; text-shadow: 0 2px 10px rgba(0, 0, 0, .55); }
.topbar-hero .dash-big small { color: rgba(255, 255, 255, .85); }
.topbar-hero .dash-big-label { color: rgba(255, 255, 255, .8); text-shadow: 0 1px 3px rgba(0, 0, 0, .6); }
.topbar-hero .dash-big-label b { color: #ffe08a; }
.topbar-hero .dash-meter { color: #fff; }
.topbar-hero .dash-meter:hover, .topbar-hero .dash-meter[aria-pressed="true"] { background: rgba(255, 255, 255, .1); }
.topbar-hero .dash-meter-name { color: rgba(255, 255, 255, .78); }
.topbar-hero .dash-meter-val { color: #fff; text-shadow: 0 2px 6px rgba(0, 0, 0, .55); }
.topbar-hero .dash-meter-bar { background: rgba(255, 255, 255, .22); }
.topbar-hero .dash-meter-note { color: rgba(255, 255, 255, .72); text-shadow: 0 1px 2px rgba(0, 0, 0, .6); }
@media (max-width: 900px) { .topbar.topbar-hero { min-height: 0; } }
/* kadr nagrania przesunięty niżej (2026-10-10, na prośbę) - widać drogę i samochód ze skanerem */
.topbar-bg { object-position: 50% 68%; }

/* ================= Przejazdy: filtr podsumowania (2026-10-08) ================= */
.tr-sum-filter { display: flex; flex-wrap: wrap; border: 1px solid var(--utr-line); border-radius: 10px; overflow: hidden; background: #fff; }
.tr-sum-filter button { border: 0; border-right: 1px solid var(--utr-line); background: #fff; color: var(--utr-ink); font: inherit; font-size: 12.5px; font-weight: 600; padding: 7px 11px; cursor: pointer; }
.tr-sum-filter button:last-child { border-right: 0; }
.tr-sum-filter button.active { background: var(--utr-ink); color: #fff; }
/* kafelki wg rodzaju prac */
.tr-summary .c-zg-only { display: none; }
.tr-summary.only-zgloszenia .c-zg-only { display: flex; }
.tr-summary.only-znaczniki .c-pr, .tr-summary.only-zgloszenia .c-pr, .tr-summary.only-zgloszenia .c-zn,
.tr-summary.only-przejazdy .c-zn { display: none; }
/* kolumny tabeli: 1 droga | 2-4 znaczniki | 5-9 skanowanie | 10 zgłoszenia */
.tr-summary.only-znaczniki .tr-sum-table tbody td:nth-child(n+5),
.tr-summary.only-znaczniki .tr-sum-table thead tr:first-child th:nth-child(n+3),
.tr-summary.only-znaczniki .tr-sum-table thead tr:nth-child(2) th:nth-child(n+4) { display: none; }
.tr-summary.only-przejazdy .tr-sum-table tbody td:nth-child(n+2):nth-child(-n+4),
.tr-summary.only-przejazdy .tr-sum-table tbody td:nth-child(10),
.tr-summary.only-przejazdy .tr-sum-table thead tr:first-child th:nth-child(2),
.tr-summary.only-przejazdy .tr-sum-table thead tr:first-child th:nth-child(4),
.tr-summary.only-przejazdy .tr-sum-table thead tr:nth-child(2) th:nth-child(-n+3) { display: none; }
.tr-summary.only-zgloszenia .tr-sum-table tbody td:nth-child(n+2):nth-child(-n+9),
.tr-summary.only-zgloszenia .tr-sum-table thead tr:first-child th:nth-child(2),
.tr-summary.only-zgloszenia .tr-sum-table thead tr:first-child th:nth-child(3),
.tr-summary.only-zgloszenia .tr-sum-table thead tr:nth-child(2) { display: none; }
.tr-road-lbl { cursor: pointer; }   /* tabliczka drogi w Przejazdach wybiera drogę */
/* filtr podsumowania: tylko drogi, których dotyczy wybrany rodzaj prac (2026-10-10) */
.tr-summary.only-znaczniki .tr-sum-table tbody tr:not([data-zn]),
.tr-summary.only-przejazdy .tr-sum-table tbody tr:not([data-pr]),
.tr-summary.only-zgloszenia .tr-sum-table tbody tr:not([data-zg]) { display: none; }

/* ================= Asystent Drogowy (2026-10-13) ================= */
/* w zakladce panel jest zawsze otwarty - przycisk "Zamknij" zbedny */
#view-asystent .ai-panel-foot { display: none; }
#view-asystent .ai-panel { transition: none; }
/* naglowek Analiz Drogowych */
.an-head-main { display: flex; align-items: center; gap: 12px; }
.an-head-ico { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.an-head-ico svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.an-head-title { display: block; font-size: 16px; font-weight: 800; }
.an-head-sub { display: block; font-size: 12.5px; color: var(--muted); }

/* ================= Asystent Drogowy - rozmowa (2026-10-13) =================
   Wg makiety propozycja_redesign/analizy_asystent.html: wątek pytań i
   odpowiedzi, pole pytania przyklejone na dole, lista pytań i przykłady z
   lewej. Odpowiedź = JEDEN blok (wcześniej 4 osobne kafelki). */
#view-asystent .ai-panel { display: block; opacity: 1; }
#view-asystent .ai-panel-inner { overflow: visible; visibility: visible; }
.as-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 20px; align-items: start; }
.as-side { position: sticky; top: 16px; display: grid; gap: 14px; max-height: calc(100vh - 32px); overflow-y: auto; }
.as-side-card { padding: 14px; }
.as-new { width: 100%; justify-content: center; background: var(--plate); color: var(--plate-ink); border-color: var(--plate); font-weight: 800; }
.as-side-h { margin: 14px 0 6px; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.as-turns { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.as-turns li.muted { font-size: 12.5px; padding: 2px 4px; }
.as-turns button { width: 100%; text-align: left; border: 0; background: none; color: var(--text); padding: 6px 8px; border-radius: 8px;
  cursor: pointer; font: inherit; font-size: 13px; line-height: 1.35; display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.as-turns button:hover, .as-turns button.on { background: var(--surface-2); }
.as-turns small { color: var(--muted); font-size: 11.5px; }
/* przyklady i szablony w bocznej kolumnie - zawsze widoczne */
#view-asystent #ai-examples-top[hidden] { display: block; }
#view-asystent .ai-more-examples > summary { font-weight: 700; font-size: 13px; }
#view-asystent .ai-examples-list { display: grid; gap: 2px; margin-top: 6px; }
#view-asystent .ai-example { width: 100%; justify-content: flex-start; text-align: left; border-radius: 8px; }
#view-asystent .ai-templates { grid-template-columns: 1fr; margin-top: 10px; }

.as-chat { display: flex; flex-direction: column; min-height: calc(100vh - 210px); min-width: 0; }
.as-thread, .as-live { display: grid; gap: 14px; }
.as-thread:not(:empty) { margin-bottom: 18px; }
.as-turn { display: grid; gap: 10px; scroll-margin-top: 16px; }
.as-q-row { display: flex; justify-content: flex-end; }
.as-q-row[hidden] { display: none; }
.as-q-bubble { max-width: 72%; background: var(--text); color: var(--surface); padding: 10px 14px;
  border-radius: 14px 14px 4px 14px; font-weight: 600; white-space: pre-wrap; }
.as-q-bubble small { display: block; font-weight: 400; opacity: .7; font-size: 11.5px; margin-top: 2px; }
/* w wątku pytanie jest w dymku - powtórzenie nad odpowiedzią zbędne */
#view-asystent .ai-answer-q { display: none; }

/* odpowiedź: jeden blok z żółtą kreską */
.as-answer { padding: 0; overflow: hidden; border-left: 4px solid var(--plate); }
.as-answer-head { display: flex; align-items: center; gap: 8px; padding: 12px 18px 0; font-size: 12px; color: var(--muted); }
.as-answer-head::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(30,140,110,.15); }
.as-answer-main { padding: 6px 18px 12px; }
.as-answer-main .ai-answer { border: 0; background: none; padding: 0; margin: 0; box-shadow: none; }
.as-answer-main .an-details { margin-top: 8px; }
/* pojedyncza liczba: duża wartość obok zdania */
.ai-answer.ai-answer-num { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 22px; align-items: center; }
.ai-answer.ai-answer-num > * { grid-column: 1 / -1; }
.ai-answer.ai-answer-num > .ai-answer-v { grid-column: 1; grid-row: 1; font-size: 44px; font-weight: 800; line-height: 1; letter-spacing: -.02em; white-space: nowrap; }
.ai-answer.ai-answer-num > .ai-answer-text { grid-column: 2; grid-row: 1; }
.ai-answer.ai-answer-num .ai-answer-u { font-size: 20px; }
#view-asystent .ai-answer-col { display: none; }
#view-asystent .ai-answer-text { font-size: 15.5px; line-height: 1.55; }
.as-tabs { display: flex; gap: 2px; padding: 0 12px; border-top: 1px solid var(--border); background: var(--surface-2); overflow-x: auto; }
.as-tabs button { border: 0; background: none; padding: 10px 12px; font: inherit; font-size: 13px; font-weight: 600; color: var(--muted);
  cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.as-tabs button.on { color: var(--text); border-bottom-color: var(--plate); }
.as-pane { padding: 14px 18px; border-top: 1px solid var(--border); }
.as-pane[hidden] { display: none; }
.as-pane .ai-map-wrap { margin: 0; }
.as-pane .chart-wrap { height: 240px; }
.as-answer-foot { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 14px; border-top: 1px solid var(--border); }
.as-answer-foot .ai-report-row { margin: 0 0 0 auto; }
.as-answer .ai-nextstep-grid { padding: 0 18px 14px; margin: 0; }
.as-answer .ai-hints { margin: 10px 18px 0; }
/* dopytanie / brak danych: karta z niebieską kreską */
#view-asystent .ai-answer-clarify, #view-asystent .ai-answer-nodata { border-left: 4px solid var(--accent); }
#view-asystent .ai-answer-nodata { border-left-color: var(--muted); }
/* stopka eksportu pod BIEŻĄCĄ odpowiedzią */
#view-asystent .ai-result-foot { justify-content: flex-end; }
#view-asystent .ai-result-foot:not(:has(:not([hidden]))) { display: none; }

/* liczenie: przesuwające się oznakowanie zamiast kropek */
.as-thinking { padding: 16px 18px; border-left: 4px solid var(--border); }
.as-thinking-top { display: flex; gap: 10px; align-items: baseline; }
.as-thinking-top b { font-size: 14.5px; }
.as-lane { position: relative; height: 10px; border-radius: 5px; background: #3a434d; overflow: hidden; margin: 10px 0 0; }
.as-lane::before { content: ""; position: absolute; left: -40px; right: 0; top: 4px; height: 2px;
  background: repeating-linear-gradient(90deg, #fff 0 22px, transparent 22px 40px); animation: as-lane 1s linear infinite; }
@keyframes as-lane { to { transform: translateX(40px); } }

/* pole pytania przyklejone na dole */
.as-composer { position: sticky; bottom: 0; z-index: 30; margin-top: auto; padding: 14px 0 6px;
  background: linear-gradient(to top, var(--bg) 72%, transparent); }
.as-composer-card { padding: 8px 8px 8px 14px; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 6px; align-items: end; }
#view-asystent #ai-question { border: 0; background: none; resize: none; min-height: 44px; max-height: 180px; outline: none;
  font: inherit; font-size: 15px; padding: 10px 0; color: var(--text); box-shadow: none; }
.as-clear-q { align-self: center; }
.as-send { width: 44px; height: 44px; border-radius: 10px; border: 0; background: var(--plate); color: var(--plate-ink);
  cursor: pointer; display: grid; place-items: center; }
.as-send:disabled { opacity: .5; cursor: progress; }
.as-send svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.as-ctx { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); padding-bottom: 2px; }
.as-ctx[hidden] { display: none; }
.as-ctx-chip { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--border); border-radius: 99px; padding: 1px 4px 1px 3px; background: var(--surface); }
.as-ctx-chip .road-plate { min-width: 34px; height: 20px; font-size: 12px; }
.as-ctx-chip button { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0 3px; font-size: 12px; }
.as-hint { display: flex; justify-content: space-between; gap: 10px; font-size: 11.5px; color: var(--muted); padding: 5px 4px 0; }

@media (max-width: 1100px) {
  .as-layout { grid-template-columns: 1fr; }
  .as-side { position: static; max-height: none; grid-template-columns: 1fr 1fr; order: 2; }
}
@media (max-width: 680px) {
  .as-side { grid-template-columns: 1fr; }
  .as-q-bubble { max-width: 88%; }
  .ai-answer.ai-answer-num { grid-template-columns: 1fr; }
  .ai-answer.ai-answer-num > .ai-answer-text { grid-column: 1; grid-row: 2; }
  .ai-answer.ai-answer-num > .ai-answer-v { font-size: 36px; }
  .as-hint span:last-child { display: none; }
}
/* w rozmowie "Wyczyść wynik" zastępuje "Nowa rozmowa" w bocznej kolumnie */
#view-asystent #btn-ai-clear-result { display: none !important; }
/* elementy siatki wątku nie mogą rozpychać kolumny (długi SQL, mapa) */
.as-thread > *, .as-live > *, .as-turn > *, .as-answer, .as-answer-main { min-width: 0; max-width: 100%; }
.as-answer pre { white-space: pre-wrap; word-break: break-word; }

/* ================= Analizy Drogowe wg makiety (2026-10-13) =================
   propozycja_redesign/analizy_asystent.html: rodzaj analizy jako kafelki,
   wszystkie ustawienia w jednym pasku, ostatnie analizy, kafelki etapów w
   kolorach, mapa i lista obok siebie, zmiany w czasie. */
#view-analizy .an-viewtabs { margin-bottom: 14px; }
#view-analizy .an-viewtab.is-active, #view-analizy .an-viewtab.is-active:hover {
  background: var(--surface); color: var(--text); border-color: var(--text);
  box-shadow: inset 0 -3px 0 var(--plate), var(--shadow); }
#view-analizy .an-viewtab.is-active .an-vt-txt small { color: var(--muted); }
#view-analizy .an-viewtab.is-active::after { display: none; }
/* pasek zapytania */
#view-analizy .an-filters { padding: 14px 16px; }
#view-analizy .an-filters .an-card-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
#view-analizy .an-filters .an-card-head h2 { font-size: 14px; margin: 0; }
#view-analizy .an-filters .an-card-head p { margin: 0; font-size: 12.5px; }
#view-analizy .an-field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; align-items: end; }
#view-analizy .an-field-grid .an-field[hidden] { display: none; }
#view-analizy .an-field > label { font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 5px; text-transform: none; letter-spacing: 0; }
#view-analizy .an-input, #view-analizy .an-combo-input { height: 38px; border-radius: 8px; }
#view-analizy .an-field[data-an-field="road"] .an-combo-input { font-weight: 800; font-size: 15px; }
#view-analizy .an-seg-src { display: none; }
.an-seg { display: flex; height: 38px; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--surface-2); }
.an-seg button { flex: 1; border: 0; border-right: 1px solid var(--border); background: none; color: var(--text);
  font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; padding: 0 8px; white-space: nowrap; }
.an-seg button:last-child { border-right: 0; }
.an-seg button[aria-pressed="true"] { background: var(--text); color: var(--surface); }
.an-seg button:disabled { opacity: .45; cursor: not-allowed; }
.an-seg-stage { border: 0; background: none; gap: 6px; overflow: visible; }
.an-seg-stage button { border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.an-seg-stage button:last-child { border-right: 1px solid var(--border); }
.an-seg-stage button i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); flex: none; }
.an-seg-stage button[aria-pressed="true"] { background: var(--surface); color: var(--text); border-color: var(--text); box-shadow: inset 0 -3px 0 var(--c); }
#view-analizy .an-filters-actions { margin-top: 12px; }
#view-analizy #btn-an-run { background: var(--plate); color: var(--plate-ink); border-color: var(--plate); font-weight: 800; padding-inline: 22px; }
/* ostatnie analizy */
.an-recent { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 10px 2px 16px; font-size: 12.5px; color: var(--muted); }
.an-recent[hidden] { display: none; }
.an-recent button { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--surface);
  border-radius: 99px; padding: 3px 11px 3px 4px; font: inherit; font-size: 12.5px; color: var(--text); cursor: pointer; }
.an-recent button:hover { border-color: var(--accent); color: var(--accent); }
.an-recent .road-plate { min-width: 34px; height: 19px; font-size: 11.5px; }
.an-recent button.no-plate { padding-left: 11px; }
/* wyniki */
#view-analizy .an-results { padding: 14px 16px; }
#view-analizy .an-results-head h2 { font-size: 17px; }
.an-badge.an-live { color: var(--green); background: none; border: 0; font-weight: 700; display: inline-flex; align-items: center; gap: 6px; }
.an-badge.an-live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(30,140,110,.15); }
#view-analizy .an-kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
#view-analizy .an-kpi { border-top: 0; border-left: 4px solid var(--text); border-radius: 12px; padding: 12px 14px; }
#view-analizy .an-kpi.an-kpi-s1 { border-left-color: var(--s1); }
#view-analizy .an-kpi.an-kpi-s2 { border-left-color: var(--s2); }
#view-analizy .an-kpi.an-kpi-s3 { border-left-color: var(--s3); }
#view-analizy .an-kpi.an-kpi-ref { border-left-color: var(--plate); }
#view-analizy .an-kpi-value { font-size: 28px; font-weight: 800; line-height: 1.1; }
/* zmiany w czasie (z migawek) */
.an-trend { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-top: 6px; }
.an-trend-card { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: var(--surface-2); }
.an-trend-card b { font-size: 13px; }
.an-trend-card svg { display: block; width: 100%; height: 56px; margin: 6px 0 4px; }
.an-trend-meta { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); }
.an-trend-delta { font-weight: 700; color: var(--text); }
@media (max-width: 680px) {
  .an-seg-stage { flex-wrap: wrap; height: auto; }
  .an-seg-stage button { height: 36px; flex: 1 1 100%; }
}
#view-analizy .an-field[data-an-field="stage"] { grid-column: span 2; min-width: 0; }
#view-analizy .an-seg-stage button { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 680px) { #view-analizy .an-field[data-an-field="stage"] { grid-column: auto; } }
/* szerokie tabele rozbicia przewijają się w karcie, nie rozpychają strony */
#view-analizy #an-extra { overflow-x: auto; }
/* nazwy powiatów na mapkach dróg (2026-10-13) */
.powiat-label { width: auto !important; height: auto !important; transform: translate(-50%, -50%);
  font: 700 11px/1.2 "Overpass", "Segoe UI", sans-serif; color: #14202b; background: rgba(255, 255, 255, .82);
  border: 1px solid rgba(20, 32, 43, .25); border-radius: 4px; padding: 2px 6px 1px; white-space: nowrap; pointer-events: none; }

/* logo PZDW Rzeszów (2026-10-13): w pasku bocznym po drugiej stronie nazwy, przy logowaniu obok logo PBGiTR */
.brand-logo-pzdw { height: clamp(34px, 4.6vh, 46px); width: auto; margin-left: auto; flex: none; opacity: .9; }
:root[data-theme="dark"] .brand-logo-pzdw, :root[data-theme="dark"] .login-logo-pzdw { filter: brightness(1.6); }
@media (max-width: 860px) { .brand-logo-pzdw { display: none; } }
.login-logos { display: flex; align-items: center; justify-content: center; gap: 18px; }
.login-logos-sep { width: 1px; align-self: stretch; background: var(--border); }
.login-logos .login-logo { margin: 0; }
.login-logos { margin-bottom: 18px; }
.login-logo.login-logo-pzdw { width: auto; height: 120px; }
/* nazwa i podpis wyśrodkowane między dwoma logami (2026-10-13) */
.brand { gap: 10px; }
.brand-text { flex: 1 1 auto; min-width: 0; text-align: center; }
.brand-logo-pzdw { margin-left: 0; }

/* ================= Wersja na telefon (2026-10-13) =================
   Do 760 px: pasek boczny wysuwany z lewej (przycisk "Menu"), dolne menu z
   najważniejszymi zakładkami, układ jednokolumnowy, miejsce na wycięcie
   ekranu (env(safe-area-inset-*)). */
.mob-nav, .mob-backdrop { display: none; }
@media (max-width: 760px) {
  body { display: block; }
  .main { padding: 0 12px calc(78px + env(safe-area-inset-bottom)); --main-pt: 0px; --main-px: 12px; }
  /* pasek boczny jako szuflada - z pełnymi nazwami (zdejmujemy tryb ikon z 860 px) */
  .sidebar { position: fixed; top: 0; bottom: 0; left: 0; z-index: 1400; width: min(300px, 86vw); height: 100%;
    padding: calc(14px + env(safe-area-inset-top)) 14px calc(14px + env(safe-area-inset-bottom));
    transform: translateX(-105%); transition: transform .22s ease; box-shadow: 10px 0 30px rgba(0, 0, 0, .25); overflow-y: auto; }
  .sidebar.mob-open { transform: none; }
  .sidebar .brand { justify-content: flex-start; }
  .sidebar .brand-text, .sidebar .nav-label, .sidebar .nav-group-label { display: block; }
  .sidebar .nav-label { display: inline; }
  .sidebar .nav-item { justify-content: flex-start; padding: 10px 12px; font-size: 15px; }
  .sidebar .nav { overflow: visible; flex: none; }
  .sidebar .user-box { flex-direction: row; }
  .sidebar .sidebar-foot { margin-top: 16px; }
  .sidebar .user-meta { display: block; }
  .sidebar .user-box { justify-content: flex-start; }
  .sidebar .sb-status { display: flex; }
  .sidebar .brand-logo-pzdw { display: block; }
  .mob-backdrop { display: block; position: fixed; inset: 0; z-index: 1390; background: rgba(10, 16, 22, .45); }
  .mob-backdrop[hidden] { display: none; }
  /* dolne menu */
  .mob-nav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 1300;
    background: var(--surface); border-top: 1px solid var(--border); padding: 4px 4px env(safe-area-inset-bottom);
    box-shadow: 0 -6px 20px rgba(20, 32, 43, .08); }
  .mob-item { border: 0; background: none; color: var(--muted); font: inherit; font-size: 11px; font-weight: 600;
    display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px 5px; cursor: pointer; position: relative; }
  .mob-item svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .mob-item.active { color: var(--text); }
  .mob-item.active::before { content: ""; position: absolute; top: 0; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: var(--plate); }
  /* nagłówek z nagraniem: od krawędzi do krawędzi, niższy */
  .topbar { margin: 0 -12px 14px; padding: calc(12px + env(safe-area-inset-top)) 14px 12px; min-height: 0; gap: 8px; }
  .topbar #view-title { font-size: 21px; }
  .topbar .view-intro { font-size: 12.5px; }
  .topbar .view-intro-q { display: none; }
  .topbar-actions { width: 100%; }
  .topbar #snap-picker { flex: 1; min-width: 0; }
  /* elementy pływające ponad dolnym menu */
  .mini-ai-bubble { right: 14px; bottom: calc(86px + env(safe-area-inset-bottom)); width: 56px; height: 56px; }
  .mini-ai-bubble img { width: 38px; height: 45px; }
  .mini-ai-teaser { right: 80px; bottom: calc(92px + env(safe-area-inset-bottom)); }
  .mini-ai-panel { bottom: calc(62px + env(safe-area-inset-bottom)); height: auto; }
  .mini-ai-head { padding: 10px 12px; gap: 8px; font-size: 15px; }
  .mini-ai-head b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mini-ai-head .ghost-btn { white-space: nowrap; padding-inline: 10px; }
  .mini-ai-body { padding: 12px 12px 14px; }
  .mini-ai-form { padding: 8px 12px 10px; }
  .mini-ai-kbd { display: none; }
  .mini-ai-form-btns { justify-content: flex-end; }
  .toast { left: 12px; right: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); }
  #view-asystent .as-composer { bottom: calc(60px + env(safe-area-inset-bottom)); }
  .road-sheet { bottom: calc(60px + env(safe-area-inset-bottom)); }
  .chat-panel { left: 8px; right: 8px; width: auto; max-width: none; bottom: calc(70px + env(safe-area-inset-bottom)); }
  /* przyciski i pola wygodne pod palec */
  .primary-btn, .ghost-btn { min-height: 40px; }
  .ghost-btn.small { min-height: 34px; }
  select, input[type="text"], input[type="search"], textarea { font-size: 16px; }   /* iOS nie przybliża przy pisaniu */
}

@media (max-width: 760px) {
  /* mapy na telefonie: wysokość ekranu minus nagłówek i dolne menu */
  #map { height: calc(100dvh - 330px); min-height: 340px; }
  .map-legend > .muted { display: none; }
  .map-card { padding: 8px; }
  .utr-map { height: calc(100dvh - 280px); min-height: 360px; }
  #view-utrudnienia .utr-source, #view-utrudnienia .utr-side.is-collapsed ~ .utr-source {
    left: 8px; right: 8px; top: auto; bottom: 30px; transform: none; max-width: none; width: auto; font-size: 11.5px; padding: 6px 10px; }
  .utr-source-txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
  .utr-legend { display: none; }
  .utr-side { top: 8px; left: 8px; right: 8px; width: auto; bottom: 48px; }
  .utr-side.is-collapsed { right: auto; bottom: auto; }
}
/* zwinięty panel Przejazdów chowa treść (jak w Utrudnieniach) - 2026-10-13 */
.tr-side.is-collapsed { bottom: auto; width: auto; max-height: none; }
.tr-side.is-collapsed .utr-side-body { display: none; }
/* mapka w odpowiedzi asystenta nie wchodzi na pole pytania */
#view-asystent .ai-map-wrap, #view-asystent .ai-map { position: relative; z-index: 0; isolation: isolate; }
@media (max-width: 860px) { .tr-side.is-collapsed { top: auto; bottom: 8px; } }
@media (max-width: 760px) { .tr-map { height: calc(100dvh - 300px); min-height: 380px; } }
/* "+ Zgłoś remont" w panelu Utrudnień (2026-10-13) */
.utr-side-head .utr-report-btn { margin-left: auto; padding: 5px 10px; font-size: 12.5px; white-space: nowrap; }
.utr-side-head .utr-report-btn[hidden] { display: none; }
#view-utrudnienia .utr-wrap.tr-wrap .tr-sheet { z-index: 700; }

/* "Zgłoś utrudnienie" na mapie Utrudnień (2026-10-13) */
.utr-map-report { display: inline-flex; align-items: center; gap: 8px; border: 0; border-radius: 10px; cursor: pointer;
  background: var(--plate); color: var(--plate-ink); font: 800 14px/1 "Overpass", "Segoe UI", sans-serif;
  padding: 11px 16px; box-shadow: 0 4px 14px rgba(20, 32, 43, .3); }
.utr-map-report[hidden] { display: none; }
.utr-map-report svg { width: 20px; height: 20px; color: var(--plate-ink); }
.utr-map-report:hover { filter: brightness(1.05); }
/* przycisk zgłoszenia odsunięty od dymku asystenta w prawym dolnym rogu */
/* legenda Utrudnień zwijana (2026-10-13) - na telefonie też widoczny sam przycisk */
.utr-legend-body { display: flex; flex-direction: column; gap: 6px; }
.utr-legend-body[hidden] { display: none; }
#utr-legend.is-open .tr-legend-toggle::after { content: " ▾"; }
@media (max-width: 760px) { #view-utrudnienia .utr-legend { display: flex; top: 120px; bottom: auto; right: 8px; } }
/* Utrudnienia (2026-10-13): "Zgłoś utrudnienie" u góry mapy, źródło PZDW na dole */
#view-utrudnienia .utr-map-report { position: absolute; z-index: 560; top: 12px; left: 366px; }
#view-utrudnienia .utr-side.is-collapsed ~ .utr-map-report { left: 300px; }
#view-utrudnienia .utr-source { top: auto; bottom: 12px; }
@media (max-width: 760px) {
  #view-utrudnienia .utr-map-report { top: auto; left: auto; right: 8px; bottom: 74px; padding: 10px 14px; }
}
/* mapy wydłużone do dołu ekranu (2026-10-13): strona i telefon (nad dolnym menu) */
.utr-map { height: calc(100vh - 174px); }
.tr-map { height: calc(100vh - 192px); }
#map { height: calc(100vh - 228px); }
@media (max-width: 760px) {
  .utr-map { height: calc(100dvh - 272px - env(safe-area-inset-bottom)); }
  .tr-map { height: calc(100dvh - 266px - env(safe-area-inset-bottom)); }
  #map { height: calc(100dvh - 292px - env(safe-area-inset-bottom)); }
}
/* panel Przejazdów: kolumna z przewijaną treścią - lista obiektów dostępna suwakiem (2026-10-13) */
.tr-side { display: flex; flex-direction: column; }
.tr-side .utr-side-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
/* kilka obiektów w klikniętym miejscu (Przejazdy, 2026-10-13) */
.tr-multi { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 10px; }
.tr-multi-item { border: 1px solid var(--utr-line, #dde3ea); border-radius: 10px; padding: 10px 12px; display: grid; gap: 8px; }
.tr-multi-head { display: flex; align-items: center; gap: 8px; }
.tr-multi-dl { display: grid; grid-template-columns: 90px 1fr; gap: 3px 10px; margin: 0; font-size: 13px; }
.tr-multi-dl dt { color: var(--utr-muted, #5d6b7a); }
.tr-multi-dl dd { margin: 0; }
.tr-multi-item .utr-btn { justify-self: start; }
/* zwinięty panel Utrudnień: tylko tytuł w jednej linii i przycisk rozwinięcia (2026-10-13) */
/* zwinięty pasek mały, jak w Przejazdach - sama krótka nazwa i strzałka;
   przycisk "Zgłoś utrudnienie" zostaje w tym samym miejscu (2026-10-13) */
#view-utrudnienia .utr-side.is-collapsed { width: max-content; }
#view-utrudnienia .utr-side.is-collapsed .utr-side-head b { white-space: nowrap; }
.utr-side-head .utr-side-short { display: none; }
#view-utrudnienia .utr-side.is-collapsed .utr-side-head .utr-side-long { display: none; }
#view-utrudnienia .utr-side.is-collapsed .utr-side-head .utr-side-short { display: inline; }
#view-utrudnienia .utr-map-report, #view-utrudnienia .utr-side.is-collapsed ~ .utr-map-report { left: 344px; }
/* "Zgłoś utrudnienie" na środku górnej krawędzi widocznej mapy (obok panelu) - 2026-10-13 */
#view-utrudnienia .utr-map-report, #view-utrudnienia .utr-side.is-collapsed ~ .utr-map-report {
  left: calc(344px + (100% - 344px - 60px) / 2); transform: translateX(-50%); }
@media (max-width: 760px) { #view-utrudnienia .utr-map-report, #view-utrudnienia .utr-side.is-collapsed ~ .utr-map-report { left: auto; transform: none; } }
/* telefon: "Zgłoś utrudnienie" na środku u góry mapy, pod zwiniętym panelem "Filtry i lista" (2026-10-13) */
@media (max-width: 760px) {
  #view-utrudnienia .utr-map-report, #view-utrudnienia .utr-side.is-collapsed ~ .utr-map-report {
    top: 70px; bottom: auto; right: auto; left: 50%; transform: translateX(-50%); padding: 9px 14px; white-space: nowrap; }
  #view-utrudnienia .utr-side:not(.is-collapsed) ~ .utr-map-report { display: none; }
}
/* telefon: przyciski Przejazdów na środku u góry mapy (symetrycznie względem przycisków warstw/zoomu) (2026-10-13) */
@media (max-width: 760px) {
  #view-teren .tr-toolbar { left: 60px; right: 60px; justify-content: center; }
  #view-teren .tr-adds { justify-content: center; }
}

/* ===== zakładka „Na drodze” (2026-10-13) ===== */
.nd-layout { display: grid; grid-template-columns: minmax(0, 1fr) 372px; gap: 20px; align-items: start; }
.nd-main { display: grid; gap: 16px; min-width: 0; }
.nd-hero { display: flex; gap: 18px; align-items: flex-start; }
.nd-hero-ico { width: 64px; height: 64px; border-radius: 16px; flex: none; box-shadow: var(--shadow); }
.nd-h { margin: 0 0 6px; font-size: 20px; }
.nd-lead { margin: 0; max-width: 72ch; line-height: 1.55; }
.nd-lead a { color: var(--accent); font-weight: 600; }
.nd-flow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
.nd-flow span { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border); font-size: 13.5px; font-weight: 600; }
.nd-flow b { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%;
  background: var(--plate); color: var(--plate-ink); font-size: 12px; }
.nd-flow i { font-style: normal; color: var(--muted); }
.nd-grid { display: grid; grid-template-columns: minmax(240px, 300px) minmax(0, 1fr); gap: 16px; }
.nd-sub { margin: 0 0 10px; font-size: 15px; }
.nd-muted { color: var(--muted); }
.nd-small { font-size: 12.5px; line-height: 1.45; }
.nd-qr-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; }
.nd-qr { width: 168px; height: 168px; border-radius: 10px; border: 1px solid var(--border); background: #fff; padding: 6px; }
.nd-qr-card .nd-muted { margin: 0; }
.nd-url { display: flex; align-items: center; gap: 6px; width: 100%; }
.nd-url code { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 12px; padding: 6px 8px; border-radius: 8px;
  background: var(--surface-2); border: 1px solid var(--border); text-align: left; }
.nd-open { width: 100%; justify-content: center; text-align: center; text-decoration: none; min-height: 44px;
  display: inline-flex; align-items: center; }
.nd-tabs { display: inline-flex; gap: 4px; padding: 3px; border-radius: 10px; background: var(--surface-2);
  border: 1px solid var(--border); margin-bottom: 10px; }
.nd-tabs button { border: 0; background: transparent; color: var(--text); font: inherit; font-size: 13.5px;
  padding: 6px 14px; border-radius: 8px; cursor: pointer; min-height: 32px; }
.nd-tabs button.active { background: var(--surface); box-shadow: var(--shadow); font-weight: 600; }
.nd-steps { margin: 0 0 16px; padding-left: 22px; display: grid; gap: 6px; line-height: 1.5; }
.nd-steps[hidden] { display: none; }
.nd-how { margin: 0; padding-left: 18px; display: grid; gap: 5px; line-height: 1.5; }
.nd-recent-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.nd-recent-head .nd-sub { margin: 0; }
.nd-recent { list-style: none; margin: 0; padding: 0; }
.nd-recent-item { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--border); }
.nd-recent-item:first-child { border-top: 0; }
.nd-recent-sym { flex: none; display: inline-flex; }
.nd-recent-txt { flex: 1; min-width: 0; }
.nd-recent-txt small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.nd-recent-st { flex: none; font-size: 12.5px; }
.nd-phone-col { position: sticky; top: 16px; display: grid; justify-items: center; gap: 10px; }
.nd-phone { position: relative; width: 360px; height: 740px; max-height: calc(100vh - 210px); min-height: 520px;
  border-radius: 44px; background: #14202b; padding: 14px; box-shadow: 0 18px 40px rgba(20, 32, 43, .28); }
.nd-phone-notch { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); width: 110px; height: 22px;
  border-radius: 0 0 14px 14px; background: #14202b; z-index: 2; }
.nd-frame { width: 100%; height: 100%; border: 0; border-radius: 32px; background: #fff; display: block; }
.nd-phone-cap { max-width: 340px; text-align: center; margin: 0; }
@media (max-width: 1099px) {
  .nd-layout { grid-template-columns: 1fr; }
  .nd-phone-col { display: none; }
}
@media (max-width: 760px) {
  .nd-grid { grid-template-columns: 1fr; }
  .nd-hero { flex-direction: column; gap: 12px; }
  .nd-hero-ico { width: 52px; height: 52px; }
}
.nd-url { flex-direction: column; align-items: stretch; }
.nd-url code { text-align: center; }
/* Utrudnienia: odnośnik do zakładki „Na drodze” (2026-10-13) */
.utr-nd-link { display: flex; align-items: center; gap: 10px; margin: 4px 0 14px; padding: 9px 10px; border-radius: 10px;
  border: 1px solid var(--utr-line, #dde3ea); background: var(--utr-soft, #f3f6f9); color: var(--utr-ink, #1d2733);
  text-decoration: none; min-height: 44px; }
.utr-nd-link:hover { border-color: var(--utr-blue, #2f7fd8); }
.utr-nd-link:focus-visible { outline: 2px solid var(--utr-blue, #2f7fd8); outline-offset: 2px; }
.utr-nd-link img { width: 34px; height: 34px; border-radius: 9px; flex: none; }
.utr-nd-link span { flex: 1; min-width: 0; font-size: 13px; line-height: 1.35; }
.utr-nd-link small { display: block; color: var(--utr-muted, #5d6b7a); font-size: 12px; margin-top: 1px; }
.utr-nd-link i { font-style: normal; font-size: 20px; color: var(--utr-muted, #5d6b7a); flex: none; }
/* „Na drodze”: podgląd aplikacji także na telefonie / wąskim ekranie - zaraz pod opisem (2026-10-13) */
@media (max-width: 1099px) {
  #view-nadrodze .nd-main { display: contents; }
  #view-nadrodze .nd-hero { order: 1; }
  #view-nadrodze .nd-phone-col { display: grid; order: 2; position: static; }
  #view-nadrodze .nd-grid { order: 3; }
  #view-nadrodze .nd-recent-card { order: 4; }
  #view-nadrodze .nd-layout { gap: 16px; }
}
@media (max-width: 760px) {
  #view-nadrodze .nd-phone { width: 100%; max-width: 420px; height: calc(100dvh - 190px); max-height: 760px; min-height: 480px;
    padding: 8px; border-radius: 28px; }
  #view-nadrodze .nd-phone-notch { display: none; }
  #view-nadrodze .nd-frame { border-radius: 22px; }
}

/* ===== zakładka Kody QR (2026-10-13) ===== */
.qr-toolbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.qr-lead { margin: 0; max-width: 78ch; color: var(--muted); line-height: 1.55; }
.qr-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 420px)); gap: 20px; }
.qr-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; }
.qr-head { display: flex; align-items: center; gap: 12px; align-self: stretch; text-align: left; }
.qr-app-ico { width: 48px; height: 48px; border-radius: 12px; flex: none; }
.qr-name { margin: 0; font-size: 17px; }
.qr-sub { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.qr-code { width: 220px; height: 220px; padding: 8px; border-radius: 12px; background: #fff; border: 1px solid var(--border); }
.qr-url { font-size: 12.5px; padding: 6px 10px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border);
  overflow-wrap: anywhere; }
.qr-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.qr-actions a { text-decoration: none; display: inline-flex; align-items: center; min-height: 36px; }
.qr-note { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.45; max-width: 36ch; }
/* ===== zakładka „Monitor w 60 s” (2026-10-21): ciemna „scena kinowa”, film, pas rozdziałów ===== */
.f60-stage { border-radius: 16px; padding: 22px 26px 18px; color: #f4f7fb;
  background: radial-gradient(ellipse at 50% 0%, #11274a 0%, #0b1b33 45%, #071223 100%); box-shadow: var(--shadow); }
.f60-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.f60-kicker { margin: 0 0 6px; font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: #7fa6ff; }
.f60-title { margin: 0; font-size: 28px; line-height: 1.15; color: #fff; }
.f60-vo { min-height: 44px; display: inline-flex; align-items: center; gap: 8px; font-weight: 600; flex: none;
  background: rgba(255, 255, 255, .08); color: #f4f7fb; border-color: rgba(127, 166, 255, .45); }
.f60-vo:hover { background: rgba(255, 255, 255, .14); border-color: #7fa6ff; }
.f60-vo svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.f60-vo[aria-pressed="false"] .f60-wave { opacity: .3; }
.f60-vo[aria-pressed="true"] { background: #3d7bff; border-color: #3d7bff; color: #fff; }
.f60-player { aspect-ratio: 16 / 9; max-width: 1240px; margin: 0 auto; border-radius: 12px; overflow: hidden; background: #071223;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .55), 0 0 0 1px rgba(127, 166, 255, .2); }
.f60-player video { width: 100%; height: 100%; display: block; background: #071223; }
.f60-err { max-width: 1240px; margin: 10px auto 0; color: #ff8a85; font-size: 13px; }
.f60-strip { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 10px; max-width: 1240px; margin: 16px auto 0; }
.f60-ch { display: grid; gap: 4px; padding: 0 0 6px; border: 0; border-radius: 8px; background: transparent; color: #cfe0ff;
  text-align: left; cursor: pointer; font: inherit; opacity: .72; transition: opacity .15s ease; }
.f60-ch img { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; border: 2px solid transparent; display: block; }
.f60-ch:hover, .f60-ch.is-current { opacity: 1; }
.f60-ch.is-current img { border-color: #3d7bff; }
.f60-ch-time { font-size: 11px; font-weight: 700; color: #7fa6ff; padding: 0 2px; }
.f60-ch-name { font-size: 13px; font-weight: 600; padding: 0 2px; line-height: 1.25; }
.f60-ch:focus-visible, .f60-vo:focus-visible { outline: 3px solid #7fa6ff; outline-offset: 2px; }
.f60-info { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 16px; padding: 0 4px; }
.f60-info p { margin: 0; max-width: 90ch; color: var(--muted); line-height: 1.55; }
.f60-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.f60-chips li { padding: 4px 10px; border-radius: 999px; background: var(--accent-soft); font-size: 13px; font-weight: 600; white-space: nowrap; }
@media (max-width: 1100px) { .f60-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .f60-head, .f60-info { flex-direction: column; align-items: flex-start; }
  .f60-stage { padding: 16px; }
  .f60-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) { .f60-ch { transition: none; } }
@media (max-width: 760px) {
  .qr-toolbar { flex-direction: column; }
  .qr-grid { grid-template-columns: 1fr; }
}
/* wydruk: tylko karty z kodami */
@media print {
  body.print-qr * { visibility: hidden; }
  body.print-qr #view-qr .qr-grid, body.print-qr #view-qr .qr-grid * { visibility: visible; }
  body.print-qr #view-qr .qr-grid { position: absolute; left: 0; top: 0; width: 100%; display: grid;
    grid-template-columns: 1fr 1fr; gap: 24px; }
  body.print-qr .qr-actions { display: none; }
  body.print-qr .qr-card { box-shadow: none; border: 1px solid #999; break-inside: avoid; }
}
/* schemat liniowy na Pulpicie: paski etapów rosną od zera (2026-10-13) */
.sld-line i { transition: width .9s cubic-bezier(.2, .8, .2, 1); }
@media (prefers-reduced-motion: reduce) and (max-width: 0px) { .sld-line i { transition: none; } }

/* ===== Animacja treści w KAŻDEJ zakładce (2026-10-13) =====
   Animacje działają zawsze - także gdy w Windows wyłączono "Efekty animacji"
   (prefers-reduced-motion: reduce), na wyraźną prośbę użytkownika; dawne bloki
   reduced-motion mają dopisek "and (max-width: 0px)", więc nie działają.
   Karty (.card) wjeżdżały już wcześniej (kafelek-wjazd wyżej); tu dochodzą
   elementy, które kartami nie są: podsumowanie Pulpitu, kafelki zmian,
   zakładki Analiz, panele nad mapami, listy i pierwsze wiersze tabel.
   `translate` (osobna właściwość) zamiast `transform` - nie nadpisuje
   transformów, którymi te elementy są ustawiane (np. wyśrodkowanie). */
@keyframes tresc-wjazd { from { opacity: 0; translate: 0 10px; } }
@keyframes panel-wjazd { from { opacity: 0; translate: -14px 0; } }
@keyframes panel-wjazd-gora { from { opacity: 0; translate: 0 -10px; } }
@keyframes wiersz-wjazd { from { opacity: 0; translate: 0 6px; } }

.view.active :is(.dash-summary, .dash-rail > *, .delta-tile, .rp-summary, .an-viewtabs, .an-recent,
  .qr-toolbar, .set-nav, .nd-phone-col, .ai-panel, .fc-grid > *, .tr-summary) {
  animation: tresc-wjazd .42s cubic-bezier(.22, .7, .3, 1) backwards;
}
.view.active :is(.dash-rail > *, .delta-tile, .fc-grid > *):nth-child(2) { animation-delay: .06s; }
.view.active :is(.dash-rail > *, .delta-tile, .fc-grid > *):nth-child(3) { animation-delay: .12s; }
.view.active :is(.dash-rail > *, .delta-tile, .fc-grid > *):nth-child(4) { animation-delay: .18s; }
.view.active :is(.dash-rail > *, .delta-tile, .fc-grid > *):nth-child(5) { animation-delay: .24s; }
.view.active .dash-summary ~ .stage-grid .card { animation-delay: .08s; }

/* zakładki z mapą: panele boczne wjeżdżają z lewej, przyciski i legenda z góry */
.view.active :is(.utr-side, .tr-side) { animation: panel-wjazd .45s cubic-bezier(.22, .7, .3, 1) .08s backwards; }
.view.active :is(.tr-toolbar, .utr-map-report, .utr-legend, .tr-legend, .utr-source, .map-quick, .map-legend) {
  animation: panel-wjazd-gora .4s cubic-bezier(.22, .7, .3, 1) .18s backwards;
}

/* listy i wiersze tabel - kolejno, pierwsze 15 (dalej bez opóźnienia);
   odtwarzane przy każdym renderze listy, także po odświeżeniu danych */
.view.active :is(#sld, .utr-list, .nd-recent, .tr-list, .an-recent-list) > li,
.view.active tbody tr {
  animation: wiersz-wjazd .32s ease-out backwards;
}
.view.active :is(#sld, .utr-list, .nd-recent, .tr-list, .an-recent-list) > li:nth-child(2), .view.active tbody tr:nth-child(2) { animation-delay: 0.025s; }
.view.active :is(#sld, .utr-list, .nd-recent, .tr-list, .an-recent-list) > li:nth-child(3), .view.active tbody tr:nth-child(3) { animation-delay: 0.050s; }
.view.active :is(#sld, .utr-list, .nd-recent, .tr-list, .an-recent-list) > li:nth-child(4), .view.active tbody tr:nth-child(4) { animation-delay: 0.075s; }
.view.active :is(#sld, .utr-list, .nd-recent, .tr-list, .an-recent-list) > li:nth-child(5), .view.active tbody tr:nth-child(5) { animation-delay: 0.100s; }
.view.active :is(#sld, .utr-list, .nd-recent, .tr-list, .an-recent-list) > li:nth-child(6), .view.active tbody tr:nth-child(6) { animation-delay: 0.125s; }
.view.active :is(#sld, .utr-list, .nd-recent, .tr-list, .an-recent-list) > li:nth-child(7), .view.active tbody tr:nth-child(7) { animation-delay: 0.150s; }
.view.active :is(#sld, .utr-list, .nd-recent, .tr-list, .an-recent-list) > li:nth-child(8), .view.active tbody tr:nth-child(8) { animation-delay: 0.175s; }
.view.active :is(#sld, .utr-list, .nd-recent, .tr-list, .an-recent-list) > li:nth-child(9), .view.active tbody tr:nth-child(9) { animation-delay: 0.200s; }
.view.active :is(#sld, .utr-list, .nd-recent, .tr-list, .an-recent-list) > li:nth-child(10), .view.active tbody tr:nth-child(10) { animation-delay: 0.225s; }
.view.active :is(#sld, .utr-list, .nd-recent, .tr-list, .an-recent-list) > li:nth-child(11), .view.active tbody tr:nth-child(11) { animation-delay: 0.250s; }
.view.active :is(#sld, .utr-list, .nd-recent, .tr-list, .an-recent-list) > li:nth-child(12), .view.active tbody tr:nth-child(12) { animation-delay: 0.275s; }
.view.active :is(#sld, .utr-list, .nd-recent, .tr-list, .an-recent-list) > li:nth-child(13), .view.active tbody tr:nth-child(13) { animation-delay: 0.300s; }
.view.active :is(#sld, .utr-list, .nd-recent, .tr-list, .an-recent-list) > li:nth-child(14), .view.active tbody tr:nth-child(14) { animation-delay: 0.325s; }
.view.active :is(#sld, .utr-list, .nd-recent, .tr-list, .an-recent-list) > li:nth-child(15), .view.active tbody tr:nth-child(15) { animation-delay: 0.350s; }
.view.active :is(#sld, .utr-list, .nd-recent, .tr-list, .an-recent-list) > li:nth-child(n+16),
.view.active tbody tr:nth-child(n+16) { animation-delay: .375s; }
/* Pulpit: paski etapów i „Najbliżej ukończenia” rosną od zera (2026-10-14) */
.dash-meter-bar > i, .dash-mini-bar > i { transition: width .9s cubic-bezier(.2, .8, .2, 1); }

/* ================= Telefon - poprawki dostępności przycisków (2026-10-14) =================
   Audyt na 375 px: (1) znak wodny .view::before (420 px) rozpychał stronę na
   szerokość - przeglądarka poszerzała układ do 399 px i dolne menu (z „Menu”)
   wychodziło poza ekran; (2) tabele szersze niż ekran chowały ostatnie kolumny
   (np. „Szczegóły”, przyciski w Ustawieniach) - na telefonie wiersz = karta,
   nagłówki zostają jako przyciski sortowania; (3) koniec szuflady drogi pod
   dolnym menu; (4) chmurka asystenta wychodziła za lewą krawędź; (5) małe
   przyciski (20-28 px) - minimum 40 px pod palec. */
@media (max-width: 760px) {
  .main { overflow-x: clip; }
  /* (4) chmurka zachęty mieści się między lewą krawędzią a ikoną asystenta */
  .mini-ai-teaser { left: 12px; right: 80px; max-width: none; width: auto; }
  .mini-ai-teaser::after { right: 10px; }
  .mini-ai-teaser-close { width: 32px; height: 32px; line-height: 32px; font-size: 12px; margin: -10px -8px 0 0; }
  /* (3) treść szuflady drogi kończy się nad dolnym menu */
  .road-drawer-body { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
  /* (5) przyciski pod palec */
  .sld-sort button, .fc-seg button, .nd-tabs button, .set-nav button, .link-btn,
  .tr-legend-toggle, #tr-side-toggle, #utr-side-toggle, #btn-ai-clear { min-height: 40px; }
  .link-btn { display: inline-flex; align-items: center; }
  #tr-side-toggle, #utr-side-toggle { min-width: 40px; }
  #view-forecast #fc-key, #aih-q, #map-search-input { min-height: 40px; }
  #view-forecast summary, #view-asystent summary { min-height: 40px; display: flex; align-items: center; }
  .leaflet-touch .leaflet-bar a { width: 38px; height: 38px; line-height: 38px; }
  /* Mapa: podpowiedź „Przybliż mapę” nad panelem Warstwy, obok przycisków zoomu - nie zasłania panelu */
  .map-zoom-hint { left: 64px; right: 10px; bottom: 84px; transform: none; max-width: none;
    flex-wrap: nowrap; justify-content: space-between; border-radius: 12px; padding: 6px 6px 6px 12px; font-size: 11.5px; line-height: 1.3; }
  .map-zoom-hint button { min-height: 36px; }
  .map-quick h4 button { min-height: 36px; padding: 0 6px; margin-right: -6px; }
  .ai-example { min-height: 40px; }
  #utr-refresh { min-height: 40px; }
  .view table.data.compact input { min-height: 40px; }
  /* Ustawienia: zakładki w jednym przewijanym wierszu zamiast 6 linii */
  .set-nav { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; padding-bottom: 4px; }
  .set-nav::-webkit-scrollbar { display: none; }
  .set-nav button { flex: none; white-space: nowrap; }

  /* (2) tabele jako karty */
  .view .table-scroll > table.data, .view table.data.compact { display: block; width: 100%; min-width: 0; }
  .view .table-scroll > table.data thead, .view table.data.compact thead { display: block; }
  .view .table-scroll > table.data thead tr, .view table.data.compact thead tr {
    display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; }
  .view .table-scroll > table.data thead tr::-webkit-scrollbar { display: none; }
  .view .table-scroll > table.data th, .view table.data.compact th { position: static; flex: none; border: 0; padding: 0; background: none; }
  /* tylko kolumny sortowalne jako przyciski; pozostałe nagłówki są w etykietach kart */
  .view .table-scroll > table.data th:not([data-sort]), .view table.data.compact th { display: none; }
  .view .table-scroll > table.data th[data-sort] {
    display: inline-flex; align-items: center; min-height: 36px; padding: 0 12px; border-radius: 999px;
    border: 1px solid var(--border); background: var(--surface); font-size: 11px; }
  .view .table-scroll > table.data th.sorted { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
  .view .table-scroll > table.data :is(tbody, tfoot), .view table.data.compact tbody { display: grid; gap: 10px; }
  .view .table-scroll > table.data :is(tbody, tfoot) tr, .view table.data.compact tbody tr {
    display: block; border: 1px solid var(--border); border-radius: 12px; padding: 8px 12px;
    background: rgba(var(--surface-rgb), .92); }
  .view .table-scroll > table.data :is(tbody, tfoot) td, .view table.data.compact td {
    display: grid; grid-template-columns: minmax(92px, 38%) minmax(0, 1fr); gap: 10px; align-items: center;
    padding: 6px 0 !important; border: 0 !important; background: none !important; text-align: left; min-width: 0;
    overflow-wrap: anywhere; }
  .view .table-scroll > table.data :is(tbody, tfoot) td::before, .view table.data.compact td::before {
    content: attr(data-label); color: var(--muted); font-size: 11.5px; font-weight: 600; line-height: 1.3;
    text-transform: none; letter-spacing: 0; }
  /* pierwsza kolumna = tytuł karty; komórki bez nagłówka (np. „Szczegóły →”) na całą szerokość */
  .view .table-scroll > table.data :is(tbody, tfoot) td:first-child, .view .table-scroll > table.data td:not([data-label]),
  .view .table-scroll > table.data td[data-label=""], .view table.data.compact td[data-label=""] {
    grid-template-columns: minmax(0, 1fr); font-weight: 700; }
  .view .table-scroll > table.data :is(tbody, tfoot) td:first-child::before, .view .table-scroll > table.data td:not([data-label])::before,
  .view .table-scroll > table.data td[data-label=""]::before, .view table.data.compact td[data-label=""]::before { display: none; }
  .view .table-scroll > table.data td[colspan] { grid-template-columns: minmax(0, 1fr); font-weight: 400; }
  .view .table-scroll > table.data td.num { text-align: left; }
  .view .table-scroll > table.data td > :not(.cell-progress, .stage-cell), .view table.data.compact td > * {
    justify-self: start; max-width: 100%; }
  .view .table-scroll > table.data .stage-cell { width: 100%; }
  /* karty rosną z treścią - bez wewnętrznego przewijania (poza listami Analiz z max-height) */
  .view:not(#view-analizy) .table-scroll { overflow: visible; }
  .view table.data.compact input, .view table.data.compact select { width: 100%; min-width: 0; }
  .view .table-scroll > table.data td :is(button, select, input) { min-height: 38px; }
  /* tabela Drogi: pasek postępu na całą szerokość komórki, link „Szczegóły” jak przycisk */
  .view .table-scroll > table.data :is(tbody, tfoot) td:first-child { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
  #road-table .cell-progress { width: 100%; }
  /* karta drogi: trzy etapy obok siebie, status i „Szczegóły” w jednym wierszu */
  #road-table tbody tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 12px; }
  #road-table tbody td { grid-column: 1 / -1; }
  #road-table tbody td:is([data-label="Linie"], [data-label="Powierzchnie"], [data-label="Punkty"]) {
    grid-column: auto; grid-template-columns: minmax(0, 1fr); gap: 2px; align-content: start; }
  #road-table tbody td[data-label="Status"] { grid-column: 1 / 3; grid-template-columns: minmax(0, 1fr); }
  #road-table tbody td[data-label="Status"]::before { display: none; }
  #road-table tbody td[data-label=""] { grid-column: 3; justify-items: end; }
  #road-table td { font-size: 14px; }
  #road-table .road-details-link { display: inline-flex; align-items: center; min-height: 36px; }
  #rp-table td.rp-stage-td, table.data td.rp-stage-td { border-left: 0 !important; min-width: 0; }
  /* oś czasu migawek: na karcie bez słupków pikietażowych */
  .snap-timeline tbody td:first-child { padding-left: 0 !important; }
  .snap-timeline tbody td:first-child::after { display: none; }
}

/* Podgląd zdjęcia zgłoszenia (2026-10-14) - teren.js trLightbox* */
.tr-lightbox { position: fixed; inset: 0; z-index: 3000; background: rgba(8, 12, 16, .92); display: grid; place-items: center;
  padding: calc(56px + env(safe-area-inset-top)) 12px calc(64px + env(safe-area-inset-bottom)); }
.tr-lightbox[hidden] { display: none; }
.tr-lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; box-shadow: 0 10px 40px rgba(0, 0, 0, .5); }
.tr-lb-close { position: absolute; top: calc(10px + env(safe-area-inset-top)); right: 10px; width: 48px; height: 48px; border-radius: 50%;
  border: 0; background: rgba(255, 255, 255, .95); color: #14202b; font-size: 22px; line-height: 1; cursor: pointer; box-shadow: 0 2px 10px rgba(0, 0, 0, .4); }
.tr-lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 64px; border: 0; border-radius: 12px;
  background: rgba(255, 255, 255, .18); color: #fff; font-size: 34px; line-height: 1; cursor: pointer; }
.tr-lb-nav[hidden] { display: none; }
.tr-lb-prev { left: 8px; }
.tr-lb-next { right: 8px; }
.tr-lb-bar { position: absolute; left: 0; right: 0; bottom: calc(14px + env(safe-area-inset-bottom)); display: flex; justify-content: center;
  align-items: center; gap: 16px; color: #fff; font-size: 14px; }
/* telefon: rozwinięty panel Utrudnień zostawia wolną prawą kolumnę - przyciski
   warstw i zoomu mapy pozostają klikalne (2026-10-14) */
@media (max-width: 760px) {
  #view-utrudnienia .utr-side:not(.is-collapsed) { right: 60px; }
  /* „Legenda” pod przyciskami zoomu, nie na „−” */
  /* „Legenda” w lewym dolnym rogu mapy; po rozwinięciu rośnie w górę (2026-10-14) */
  #view-utrudnienia .utr-legend { top: auto; right: auto; left: 8px; bottom: 10px; max-width: calc(100% - 80px); }
  /* pasek „Źródło: PZDW · Odśwież teraz” zbędny na telefonie - dane odświeżają się same (2026-10-14) */
  #view-utrudnienia .utr-source { display: none !important; }
}

/* ===== zakładka Logowania (2026-10-15) ===== */
.lg-toolbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.lg-since { margin: 0; flex: 1; }
.lg-seg { display: inline-flex; gap: 3px; padding: 3px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.lg-seg button { border: 0; background: transparent; color: var(--text); font: inherit; font-size: 13px; padding: 6px 12px;
  border-radius: 8px; cursor: pointer; min-height: 32px; }
.lg-seg button.active { background: var(--surface); box-shadow: var(--shadow); font-weight: 600; }
.lg-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 14px; }
.lg-kpi { display: grid; gap: 2px; }
.lg-kpi-t { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.lg-kpi-v { font-size: 30px; line-height: 1.1; font-weight: 800; }
.lg-kpi-n { font-size: 12.5px; color: var(--muted); }
.lg-kpi.is-warn .lg-kpi-v { color: var(--red); }
.lg-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.lg-card-head h2 { margin: 0; }
.lg-chart { display: flex; align-items: flex-end; gap: 4px; height: 150px; padding-top: 6px; overflow-x: auto; }
.lg-bar { flex: 1 0 18px; max-width: 40px; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.lg-bar i { display: block; width: 100%; min-height: 2px; border-radius: 4px 4px 0 0; background: var(--accent);
  transition: height .8s cubic-bezier(.2, .8, .2, 1); }
.lg-bar span { font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.lg-table tbody tr[data-user] { cursor: pointer; }
.lg-table tbody tr.is-sel { background: var(--accent-soft); }
.lg-table tbody tr.is-idle td { color: var(--muted); }
.lg-chip { display: inline-block; font-size: 11.5px; padding: 2px 8px; border-radius: 99px; background: var(--surface-2);
  border: 1px solid var(--border); white-space: nowrap; margin: 1px 0; }
.lg-chip.is-net { background: transparent; }
.lg-fail { color: var(--red); }
.lg-res { font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.lg-res.is-ok { color: var(--green); }
.lg-res.is-fail { color: var(--red); }
.lg-res.is-old { color: var(--muted); }
.lg-filters { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.lg-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.lg-note { font-size: 12.5px; margin: 10px 0 0; }

/* Menu boczne bez paska przewijania (2026-10-15, na prośbę): gdy się nie
   mieści, przesuwa się samo powoli w dół i wraca na górę (initNavAutoScroll
   w app.js); kółko myszy działa. Na telefonie (szuflada) bez zmian. */
@media (min-width: 761px) {
  .sidebar .nav { overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; -ms-overflow-style: none; }
  .sidebar .nav::-webkit-scrollbar { display: none; width: 0; height: 0; }
  /* delikatne cieniowanie krawędzi, gdy menu ma ukryte pozycje wyżej / niżej */
  .sidebar .nav { -webkit-mask-image: linear-gradient(#000, #000); mask-image: linear-gradient(#000, #000); }
  .sidebar.nav-more-down .nav { -webkit-mask-image: linear-gradient(#000 calc(100% - 28px), transparent);
    mask-image: linear-gradient(#000 calc(100% - 28px), transparent); }
  .sidebar.nav-more-up .nav { -webkit-mask-image: linear-gradient(transparent, #000 28px);
    mask-image: linear-gradient(transparent, #000 28px); }
  .sidebar.nav-more-up.nav-more-down .nav { -webkit-mask-image: linear-gradient(transparent, #000 28px, #000 calc(100% - 28px), transparent);
    mask-image: linear-gradient(transparent, #000 28px, #000 calc(100% - 28px), transparent); }
}

/* ===== Logowanie Monitora na telefonie - wariant B (2026-10-15) =====
   Jasny ekran: logo kłosa i PZDW obok siebie, nazwa na żółtej tabliczce „ME”,
   pola z etykietami, „Zapamiętaj mnie”, żółta linia jezdni na dole.
   Na komputerze (powyżej 760 px) logowanie bez zmian - elementy .mob-only ukryte. */
.mob-only, .login-form label.mob-only { display: none; }
@media (max-width: 760px) {
  .login-body { background: #f4f6f8; align-items: stretch; padding: 0; }
  :root[data-theme="dark"] .login-body { background: #0a0d11; }
  .login-wrap { max-width: none; min-height: 100dvh; gap: 0; }
  .login-card { border: 0; border-radius: 0; box-shadow: none; background: transparent; min-height: 100dvh;
    display: flex; flex-direction: column; padding: calc(28px + env(safe-area-inset-top, 0px)) 22px calc(14px + env(safe-area-inset-bottom, 0px)); }
  :root[data-theme="dark"] .login-card { background: transparent; }
  .login-head { margin-bottom: 18px; }
  .login-logos { gap: 16px; margin-bottom: 18px; }
  .login-logos .login-logo, .login-logo.login-logo-pzdw { height: 58px; width: auto; }
  .login-org, .login-app { display: none; }
  .mob-only { display: block; }
  .login-plate { display: inline-flex; align-items: center; gap: 10px; }
  .login-plate b { background: #f5c400; color: #111; border: 2.5px solid #111; border-radius: 7px; padding: 1px 10px;
    font-weight: 900; font-size: 19px; letter-spacing: .02em; }
  .login-plate span { font-weight: 800; font-size: 19px; }
  .login-plate-sub { color: var(--muted); font-size: 13px; margin-top: 4px; }
  .login-form { gap: 14px; }
  .login-form label { font-size: 13px; font-weight: 700; }
  .login-form input:not([type="checkbox"]) { height: 50px; font-size: 16px; border-radius: 12px; padding: 0 14px; background: #fff; }
  :root[data-theme="dark"] .login-form input:not([type="checkbox"]) { background: var(--surface-2); }
  .login-form label.login-remember { display: flex; flex-direction: row; align-items: center; gap: 10px; font-size: 14px;
    font-weight: 600; min-height: 44px; color: var(--text); }
  .login-remember input { width: 22px; height: 22px; margin: 0; accent-color: var(--accent); flex: none; }
  .login-btn { min-height: 54px; font-size: 17px; font-weight: 800; border-radius: 14px; margin-top: 2px; }
  .login-lane { height: 6px; margin: auto 0 14px; border-radius: 3px;
    background: repeating-linear-gradient(90deg, #f5c400 0 26px, transparent 26px 44px); }
  .login-foot { font-size: 11px; }
  .login-theme { position: fixed; top: calc(10px + env(safe-area-inset-top, 0px)); right: 10px; }
}

/* białe ikony aplikacji (2026-10-15) - cienka ramka, żeby nie zlewały się z jasnymi kartami */
.qr-app-ico, .utr-nd-link img, .nd-hero-ico { box-shadow: 0 0 0 1px var(--border); border-radius: 12px; }

/* Miganie zakładki Utrudnienia - nowe zgłoszenie z terenu (2026-10-15) */
@keyframes nav-alert-blink {
  0%, 100% { background: transparent; box-shadow: none; }
  50% { background: rgba(124, 58, 237, .16); box-shadow: inset 3px 0 0 #7c3aed; }
}
/* 3 mignięcia, nie bez końca (2026-10-20) - ponowne uruchamia utrAlertBlink() */
.nav-item.nav-alert { animation: nav-alert-blink 1.2s ease-in-out 3; border-radius: 8px; }
.nav-item.nav-alert .nav-label { color: #6d28d9; font-weight: 700; }
/* Asystent Drogowy: 3 niebieskie mignięcia (2026-10-20) - patrz navAiBlink() */
@keyframes nav-ai-blink {
  0%, 100% { background: transparent; box-shadow: none; color: inherit; }
  50% { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); color: var(--accent); }
}
.nav-item.nav-ai-blink, .mob-item.nav-ai-blink { animation: nav-ai-blink 1.2s ease-in-out 3; }
.nav-item.nav-ai-blink { border-radius: 8px; }
.mob-item.nav-ai-blink { border-radius: 10px; }
/* na stałe niebieski i pogrubiony napis - wyróżnia się jak Utrudnienia (2026-10-20, na prośbę) */
.nav-item[data-view="asystent"] .nav-label, .nav-item[data-view="asystent"] .ico,
.mob-item[data-view="asystent"] { color: var(--accent); }
.nav-item[data-view="asystent"] .nav-label, .mob-item[data-view="asystent"] span { font-weight: 700; }
.nav-item.nav-alert .ico { color: #7c3aed; }
.utr-new-badge { margin-left: 6px; font-size: 10.5px; font-weight: 700; line-height: 1; padding: 3px 6px; border-radius: 99px;
  background: #7c3aed; color: #fff; white-space: nowrap; }
.mob-item.nav-alert { animation: nav-alert-blink 1.2s ease-in-out 3; border-radius: 10px; }

/* ---------------- Następna droga: kolejka wolnych dróg (2026-10-19) ---------------- */
.rq-wrap { max-width: 980px; }
.rq-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.rq-toolbar .muted { flex: 1 1 auto; }
.rq-h { margin: 22px 0 10px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }
.rq-note { margin: -4px 0 10px; }
.rq-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.rq-item {
  display: grid; grid-template-columns: 150px 1fr auto; gap: 14px; align-items: start;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px;
}
.rq-mine-card .rq-item, .rq-next-card .rq-item { border: 0; padding: 0; background: none; }
.rq-mine-card .rq-list { gap: 14px; }
.rq-road .road-plate { font-size: 15px; }
.rq-powiaty { margin-top: 6px; font-size: 12px; color: var(--muted); line-height: 1.35; }
.rq-stage { font-weight: 620; }
.rq-stage-no {
  display: inline-block; margin-right: 4px; padding: 0 7px; border-radius: 6px;
  background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 700;
}
.rq-tag { margin-left: 6px; font-size: 11.5px; font-weight: 500; color: var(--amber); }
.rq-scope { margin-top: 3px; font-size: 13px; }
.rq-unsure-why { margin-top: 4px; font-size: 12.5px; color: var(--amber); }
.rq-photo { margin-top: 6px; font-size: 12.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.rq-photo b { color: var(--text); font-weight: 600; }
.rq-age { padding: 1px 7px; border-radius: 999px; font-size: 11.5px; font-weight: 600; }
.rq-age-current { background: rgba(61, 184, 148, .16); color: var(--green); }
.rq-age-previous { background: rgba(240, 180, 41, .16); color: var(--amber); }
.rq-age-older { background: rgba(239, 90, 84, .14); color: var(--red); }
.rq-pub { color: var(--accent); text-decoration: none; font-weight: 600; }
.rq-pub:hover { text-decoration: underline; }
.rq-claim-who { margin-top: 6px; font-size: 12px; color: var(--muted); }
.rq-actions { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.primary-btn.small { padding: 4px 10px; font-size: 12px; }
.rq-next-card { border: 2px solid var(--accent); }
.rq-next-label { font-size: 12px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .6px; margin-bottom: 10px; }
.rq-item-next .road-plate { font-size: 20px; }
.rq-item-next .rq-stage { font-size: 15.5px; }
.rq-item-next .rq-scope { font-size: 14px; }
.rq-later { opacity: .92; }
.rq-is-unsure { border-style: dashed; }
@media (max-width: 760px) {
  .rq-item { grid-template-columns: 1fr; gap: 8px; }
  .rq-actions { flex-direction: row; flex-wrap: wrap; }
}
.rq-stages { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 4px 6px; }
.rq-st { display: inline-flex; flex-direction: column; padding: 3px 8px; border-radius: 8px; font-size: 11.5px;
  background: var(--surface-2); border: 1px solid var(--border); line-height: 1.3; }
.rq-st b { font-weight: 700; }
.rq-st small { color: var(--muted); font-size: 10.5px; }
.rq-st-done { border-color: rgba(61, 184, 148, .45); }
.rq-st-done b { color: var(--green); }
.rq-st-started b, .rq-st-unsure b { color: var(--amber); }
.rq-st-none b { color: var(--muted); }
.rq-st-next { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.rq-activity { margin-top: 6px; font-size: 12px; color: var(--muted); }
.rq-scope > div + div { margin-top: 2px; }
.rq-sub { padding-left: 14px; position: relative; color: var(--muted); }
.rq-sub::before { content: "–"; position: absolute; left: 3px; }
.rq-is-busy { opacity: .85; }
.rq-st-note { font-style: normal; font-size: 10.5px; color: var(--text); opacity: .75; }

/* Tryb asystenta Auto / Rozmowa / Drogi i oznaczenie, kto odpowiedział (Groq, 2026-10-20) */
.ai-mode { display: inline-flex; gap: 2px; margin: 0 0 6px; padding: 2px; border-radius: 999px;
  background: var(--surface-2, rgba(127,127,127,.12)); }
.ai-mode[hidden] { display: none; }
.ai-mode button { border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 12px;
  padding: 3px 12px; border-radius: 999px; cursor: pointer; }
.ai-mode button[aria-checked="true"] { background: var(--card, #fff); color: var(--text, inherit);
  box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.ai-engine { font-size: 11px; color: var(--muted); margin: 8px 0 0; opacity: .85; }
.ai-engine-notice { display: block; margin-top: 2px; }

/* formularz Przejazdów otwierany z zakładki Utrudnienia (2026-10-20): kolory formularza
   były zdefiniowane tylko w #view-teren - zaznaczone przyciski i „Zapisz” wychodziły białe na białym */
.tr-sheet, .tr-pickbar { --tr-accent: #14202b; --tr-plate: #f5c400; --utr-ink: #1d2733; --utr-muted: #5d6b7a;
  --utr-line: #dde3ea; --utr-soft: #f3f6f9; --utr-blue: #2f7fd8; }

/* nowe zgłoszenia pracowników na górze listy Utrudnień (2026-10-20) */
.utr-new-head .utr-section-h { color: #6d28d9; }
.utr-item.is-own.is-new { border-left: 4px solid #7c3aed; background: rgba(124, 58, 237, .07); }

/* odnośnik „Aplikacja Na drodze” w panelu Utrudnień - większa ikona, krótki tekst (2026-10-20) */
.utr-nd-link { padding: 10px 12px; gap: 12px; }
.utr-nd-link img { width: 52px; height: 52px; border-radius: 13px; }
.utr-nd-link span { font-size: 15px; line-height: 1.3; }
.utr-nd-link span b { font-weight: 800; }
.utr-nd-link small { font-size: 13px; margin-top: 2px; }

/* rodzaj utrudnień na górze listy po kliknięciu nazwy (2026-10-20) */
.utr-kind-top { display: inline-flex; align-items: center; gap: 8px; border: 0; background: none; padding: 3px 6px; margin: -3px 0 -3px -6px;
  border-radius: 7px; font: inherit; color: inherit; cursor: pointer; text-align: left; }
.utr-kind-top:hover { background: var(--utr-soft, #f3f6f9); }
.utr-kind.is-top .utr-kind-top { background: #e8eefc; box-shadow: inset 0 0 0 1.5px #3366d6; font-weight: 700; }
.utr-kind.is-top .utr-kind-top::after { content: "↑ na górze"; font-size: 10.5px; font-weight: 700; color: #3366d6; margin-left: 2px; }

/* kadr filmu w nagłówku: samochód ze skanerem bliżej środka paska (2026-10-21, na prośbę) -
   auto jest na ok. 52% szerokości i 54-70% wysokości klatki; 63% centruje je w pasku Pulpitu i w niskim pasku */
.topbar-bg { object-position: 52% 63%; }

/* ===== Zmiany: statystyka zmian obiektów i atrybutów (2026-11-12) ===== */
.obj-chg-note { margin: 8px 0 4px; padding: 8px 12px; border-radius: 8px; font-size: 13px; line-height: 1.5;
  background: color-mix(in srgb, #e8900c 12%, transparent); border: 1px solid color-mix(in srgb, #e8900c 40%, transparent); }
.obj-chg-note[hidden] { display: none; }
.obj-chg-btn { display: inline-flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; padding: 3px 6px;
  border: 1px solid var(--border, #ccd); border-radius: 8px; background: transparent; color: inherit; cursor: pointer; font: inherit; }
.obj-chg-btn:hover, .obj-chg-btn.open { border-color: var(--accent, #3366d6); }
.obj-chg-btn:focus-visible { outline: 2px solid var(--accent, #3366d6); outline-offset: 2px; }
.obj-chip { display: inline-block; padding: 1px 6px; border-radius: 6px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.obj-chip.add { background: color-mix(in srgb, #2a9d4b 18%, transparent); color: #2a9d4b; }
.obj-chip.del { background: color-mix(in srgb, #d33 18%, transparent); color: #d33; }
.obj-chip.attr { background: color-mix(in srgb, #3366d6 16%, transparent); color: var(--accent, #3366d6); }
.obj-chip.geom { background: color-mix(in srgb, #e8900c 20%, transparent); color: #c27400; }
.obj-chip.move { background: color-mix(in srgb, #7b5cc4 18%, transparent); color: #7b5cc4; }
.obj-chg-row > td { background: color-mix(in srgb, var(--accent, #3366d6) 5%, transparent); padding: 12px !important; }
.obj-chg-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.obj-chg-map { height: 320px; border-radius: 8px; border: 1px solid var(--border, #ccd); }
.obj-chg-h { font-weight: 600; margin: 10px 0 6px; }
.obj-chg-list { margin: 0 0 6px; padding-left: 18px; }
.obj-chg-trans { font-size: 12.5px; }
.obj-chg-items { max-height: 360px; overflow: auto; }
.obj-chg-items tr.obj-it { cursor: pointer; }
.obj-chg-items tr.obj-it.deleted td:first-child { color: #d33; font-weight: 600; }
.obj-chg-items tr.obj-it.added td:first-child { color: #2a9d4b; font-weight: 600; }
.obj-chg-items tr.obj-it.changed td:first-child { color: #c27400; font-weight: 600; }
.obj-legend { font-weight: 400; font-size: 12px; margin-left: 10px; }
.obj-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin: 0 4px 0 10px; vertical-align: -1px; }
.obj-legend i.del { background: #d33; } .obj-legend i.chg { background: #e8900c; } .obj-legend i.add { background: #2a9d4b; }
@media (max-width: 900px) { .obj-chg-grid { grid-template-columns: 1fr; } }

/* ===== Powiadomienia o pobieraniu danych (2026-11-23) ===== */
.notif-wrap { position: relative; }
.notif-wrap[hidden] { display: none; }
.notif-btn { position: relative; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px;
  border: 1px solid rgba(255,255,255,.35); background: rgba(0,0,0,.25); color: #fff; cursor: pointer; }
.notif-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.notif-btn:hover { background: rgba(0,0,0,.4); }
.notif-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.notif-badge { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: #3366d6; color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
.notif-badge.is-error { background: #d33; }
.notif-badge[hidden] { display: none; }
.notif-panel { position: fixed; top: 64px; right: 16px; z-index: 4000; width: min(420px, calc(100vw - 32px));
  max-height: 70vh; display: flex; flex-direction: column; border-radius: 12px; border: 1px solid var(--border, #d9dee3);
  background: var(--surface); color: var(--text); box-shadow: 0 12px 32px rgba(0,0,0,.22); }
.notif-panel[hidden] { display: none; }
.notif-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px;
  border-bottom: 1px solid var(--border, #d9dee3); }
.notif-x { border: 0; background: transparent; color: inherit; font-size: 22px; line-height: 1; cursor: pointer; padding: 0 4px; }
.notif-list { list-style: none; margin: 0; padding: 4px 0; overflow: auto; }
.notif-item { display: flex; gap: 10px; padding: 9px 14px; border-bottom: 1px solid color-mix(in srgb, var(--border, #d9dee3) 60%, transparent); }
.notif-item.is-unread { background: color-mix(in srgb, #3366d6 7%, transparent); }
.notif-ico { flex: 0 0 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px;
  font-weight: 700; color: #fff; background: #2a9d4b; margin-top: 1px; }
.notif-item.is-warn .notif-ico { background: #e8900c; }
.notif-item.is-error .notif-ico { background: #d33; }
.notif-title { font-weight: 600; font-size: 13.5px; }
.notif-detail { font-size: 12.5px; margin-top: 2px; overflow-wrap: anywhere; }
.notif-meta { font-size: 11.5px; opacity: .7; margin-top: 3px; }
.notif-empty { padding: 14px; font-size: 13px; opacity: .75; }
.notif-opts { border-top: 1px solid var(--border, #d9dee3); padding: 8px 14px; font-size: 13px; }
.notif-opts summary { cursor: pointer; font-weight: 600; }
.notif-pref { display: flex; align-items: center; gap: 8px; margin: 6px 0; cursor: pointer; }

/* ===== Zmiany: filtr osoby (2026-11-27) ===== */
.delta-person-wrap { display: inline-flex; align-items: center; gap: 6px; }
.delta-person-wrap input { width: 190px; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--border, #d9dee3);
  background: var(--surface, #fff); color: var(--text, #14202b); font: inherit; }
