/* Toksyczni Sąsiedzi — baza ryzyka lokalizacyjnego */

:root {
  /* marka */
  --ink: #0b0b0b;
  --ink-2: #5c5c58;
  --ink-3: #8b8b86;
  --paper: #ffffff;
  --line: rgba(11, 11, 11, 0.10);
  --line-strong: rgba(11, 11, 11, 0.18);

  --green: #1b7a3e;
  --green-dark: #145f30;
  --green-soft: #e9f2ea;
  /* akcent czytelny na czarnym tle (launcher asystenta) */
  --green-light: #7ed39a;
  --orange: #ee7b23;
  --orange-soft: #fdf0e5;
  --red: #d42a25;

  /* kolory warstw danych (bez zmian — spójne z app.js) */
  --c-drob: #2a78d6;
  --c-trzoda: #1baf7a;
  --c-inne: #eda100;
  --c-zgloszenie: #4a3aa7;

  --radius: 16px;
  --radius-sm: 12px;
  --radius-lg: 20px;
  --shadow-card: 0 4px 22px rgba(11, 11, 11, 0.08);
  --shadow-float: 0 8px 30px rgba(11, 11, 11, 0.14);

  --topbar-h: 72px;
  --gutter: 24px;
  --hero-w: 372px;
}

* { box-sizing: border-box; }

/* Atrybut `hidden` chowa element tylko regułą przeglądarki, więc **każda**
   nasza reguła ustawiająca `display` go pokonuje — a ustawiamy go wszędzie
   (`.btn`, `.field`, `.req`). Bez tej linijki element z `hidden` bywa
   widoczny, co złapaliśmy 2026-09-06 na przyciskach kreatora zgłoszenia
   i na podpolach „Inne”. Niżej w pliku zostają starsze reguły punktowe;
   ta zdejmuje problem z całej strony. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  color: var(--ink);
  background: var(--paper);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

h1, h2 { margin: 0; letter-spacing: -0.02em; }
p { margin: 0; }
a { color: var(--green-dark); }

.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;
}

/* ===================== przyciski ===================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 11px 18px;
  font: 600 14px/1.2 inherit;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.btn:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.btn .icon { width: 18px; height: 18px; flex: none; }

.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: #262625; }
.btn-dark.active { background: var(--red); }
.btn-dark.active .icon path { stroke: #fff; }

.btn-secondary { background: var(--green-soft); color: var(--green-dark); border-color: var(--green); }
.btn-ghost { background: transparent; color: var(--ink-2); border-color: var(--line-strong); }
.btn-ghost:hover { background: #f4f4f2; }
.btn-block { width: 100%; }

.btn-close {
  border: 0; background: none; cursor: pointer;
  color: var(--ink-3); font-size: 22px; line-height: 1; padding: 2px 6px;
}
.btn-close:hover { color: var(--ink); }

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}

.pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.pill-warning { background: #fbe9e7; color: #93211c; }
.pill-green { background: var(--green-soft); color: var(--green-dark); }

/* ===================== nagłówek ===================== */

.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 var(--gutter);
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  z-index: 40;
}
.brand { display: flex; align-items: center; margin-right: auto; }
.brand img { display: block; height: 38px; width: auto; }

.topbar-nav { display: flex; align-items: center; gap: 30px; }
.topbar-nav button {
  border: 0; background: none; cursor: pointer; padding: 6px 0;
  font: 500 15px/1 inherit; color: var(--ink);
  border-bottom: 2px solid transparent;
}
.topbar-nav button:hover { border-bottom-color: var(--ink); }

.btn-cta { padding: 12px 20px; border-radius: var(--radius-sm); }

/* ===================== obszar aplikacji ===================== */

.app {
  position: fixed;
  top: var(--topbar-h);
  left: 0; right: 0; bottom: 0;
}

#map { position: absolute; inset: 0; }

/* kontrolki MapLibre — nad launcherem asystenta, w linii z resztą kolumny
   (grupa przycisków ma własny margines 10px, stąd odjęcia) */
.maplibregl-ctrl-bottom-right {
  bottom: 158px;
  right: calc(var(--gutter) - 10px);
}
.maplibregl-ctrl-group {
  border-radius: var(--radius-sm) !important;
  box-shadow: var(--shadow-card) !important;
  border: 1px solid var(--line);
  overflow: hidden;
}
.maplibregl-ctrl-group button { width: 38px; height: 38px; }

/* ===================== wyszukiwarka ===================== */

/* Pasek żyje w pasie między panelem powitalnym a przyciskiem warstw —
   dzięki temu nie nachodzi na żaden z nich przy zmianie szerokości okna. */
.searchbar-wrap {
  position: absolute;
  top: 18px;
  left: calc(var(--gutter) + var(--hero-w) + 20px);
  right: calc(var(--gutter) + 155px);
  width: auto;
  max-width: 680px;
  margin-inline: auto;
  z-index: 24;
}

.searchbar {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 60px;
  padding: 0 8px 0 20px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-float);
}
.searchbar:focus-within { border-color: var(--line-strong); }
.searchbar-icon { width: 22px; height: 22px; flex: none; color: var(--ink-3); }

.searchbar input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  font: 400 15.5px/1.3 inherit;
  color: var(--ink);
}
.searchbar input::placeholder { color: var(--ink-3); }
.searchbar input:focus { outline: none; }
.searchbar input::-webkit-search-cancel-button { -webkit-appearance: none; }

.searchbar-submit {
  flex: none;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border: 0; border-radius: 50%;
  background: var(--ink); color: #fff;
  cursor: pointer;
  transition: background .15s, transform .15s;
}
/* §7e. „Użyj mojej lokalizacji” stoi obok wysyłki, ale wyraźnie drugoplanowo:
   głównym sposobem podania miejsca zostaje wpisany adres. */
.searchbar-geo {
  flex: none;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border: 0; border-radius: 50%;
  background: transparent; color: var(--ink-2);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.searchbar-geo:hover { background: var(--green-soft); color: var(--green-dark); }
.searchbar-geo:disabled { color: var(--ink-3); cursor: progress; }
.searchbar-geo svg { width: 20px; height: 20px; }

.searchbar-submit:hover { background: #262625; }
.searchbar-submit:disabled { background: var(--ink-3); cursor: progress; }
.searchbar-submit svg { width: 20px; height: 20px; }

/* wyniki */
.search-results {
  margin-top: 8px;
  padding: 6px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-float);
  max-height: min(46vh, 380px);
  overflow-y: auto;
}
.search-results[hidden] { display: none; }

.search-option {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: none;
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  font: inherit;
}
.search-option:hover, .search-option:focus-visible { background: #f4f5f3; outline: none; }
.search-option strong { display: block; font-weight: 600; font-size: 14px; }
.search-option span { display: block; margin-top: 2px; color: var(--ink-2); font-size: 12.5px; }
/* Znacznik „obiekt w bazie” siedzi w <strong>, więc musi przebić regułę
   `.search-option span` ustawiającą span na blok — stąd dwa człony selektora. */
.search-option strong .search-kind {
  display: inline;
  margin-top: 0;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-2);
  background: #eef1ee;
  border-radius: 999px;
  padding: 2px 7px;
  vertical-align: 1px;
}

.search-message { padding: 12px 14px; font-size: 13.5px; color: var(--ink-2); line-height: 1.5; }
.search-message strong { color: var(--ink); }
.search-message .btn { margin-top: 10px; }

/* znacznik wyszukanego miejsca */
.search-pin {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--ink);
  border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.35);
}
.search-label .maplibregl-popup-content {
  background: var(--ink);
  color: #fff;
  border-radius: 8px;
  padding: 6px 11px;
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: 0 2px 10px rgba(0,0,0,.3);
}
.search-label .maplibregl-popup-tip { display: none; }

/* ===================== panel powitalny ===================== */

.hero {
  position: absolute;
  top: 62px;
  left: var(--gutter);
  width: var(--hero-w);
  max-height: calc(100% - 62px - 116px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(11, 11, 11, .18) transparent;
  z-index: 18;
}
.hero::-webkit-scrollbar { width: 6px; }
.hero::-webkit-scrollbar-thumb { background: rgba(11, 11, 11, .18); border-radius: 3px; }
.hero::-webkit-scrollbar-track { background: transparent; }
.hero-body { display: grid; gap: 12px; }

.hero-toggle {
  display: none;
  position: absolute;
  top: 10px; right: 10px;
  width: 30px; height: 30px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--paper);
  color: var(--ink-2);
  cursor: pointer;
  z-index: 2;
}
.hero-toggle svg { width: 18px; height: 18px; flex: none; }
.hero.is-collapsed .hero-toggle svg { transform: rotate(180deg); }
.hero.is-collapsed .hero-body { display: none; }

.hero-card { padding: 22px 22px 20px; }

.eyebrow {
  color: var(--green);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.hero-card h1 {
  margin: 10px 0 12px;
  font-size: clamp(26px, 2.1vw, 32px);
  font-weight: 800;
  line-height: 1.1;
}
.lead { color: var(--ink-2); font-size: 14px; line-height: 1.55; }

.hero-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}
.tile {
  position: relative;
  display: block;
  text-align: left;
  border: 0;
  border-radius: 14px;
  padding: 14px 14px 34px;
  cursor: pointer;
  font: inherit;
  transition: transform .15s, box-shadow .15s;
}
.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-card); }
.tile-green { background: var(--green-soft); }
.tile-orange { background: var(--orange-soft); }

.tile-icon {
  display: grid; place-items: center;
  width: 38px; height: 38px;
  border-radius: 50%;
  color: #fff;
}
.tile-icon svg { width: 20px; height: 20px; }
.tile-green .tile-icon { background: var(--green); }
.tile-orange .tile-icon { background: var(--orange); }

.tile-title { display: block; margin: 12px 0 6px; font-size: 14.5px; font-weight: 700; line-height: 1.25; }
.tile-desc { display: block; color: var(--ink-2); font-size: 12.5px; line-height: 1.45; }
.tile-arrow {
  position: absolute; left: 14px; bottom: 12px;
  font-size: 16px; line-height: 1;
}
.tile-green .tile-arrow { color: var(--green); }
.tile-orange .tile-arrow { color: var(--orange); }

/* czarna lista powiatów */
.ranking-card { padding: 18px 20px 14px; }
.ranking-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.ranking-head h2 { font-size: 17px; font-weight: 700; }
.link-more {
  border: 0; background: none; padding: 0; cursor: pointer;
  font: 600 12.5px/1 inherit; color: var(--green-dark); white-space: nowrap;
}
.link-more:hover { text-decoration: underline; }
.ranking-sub { margin-top: 4px; color: var(--green-dark); font-size: 12.5px; }

.ranking { list-style: none; margin: 12px 0 0; padding: 0; }
.ranking li { border-top: 1px solid var(--line); }
.ranking li:first-child { border-top: 0; }
.ranking button {
  display: grid;
  grid-template-columns: 18px 1fr auto 16px;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0; background: none;
  padding: 9px 4px;
  cursor: pointer;
  font: inherit;
  text-align: left;
  border-radius: 8px;
}
.ranking button:hover { background: #f5f6f4; }
.ranking .rank-no { color: var(--ink-3); font-size: 12.5px; }
.ranking .rank-name { font-size: 13.5px; }
.ranking .rank-count { font-weight: 700; font-size: 13.5px; }
.ranking .rank-go { color: var(--ink-3); font-size: 13px; }
.ranking-empty { padding: 10px 4px; color: var(--ink-3); font-size: 13px; }

/* ===================== warstwy ===================== */

.layers { position: absolute; top: 18px; right: var(--gutter); z-index: 22; }
.layers-btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  height: 48px;
  padding: 0 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card);
  cursor: pointer;
  font: 600 14px/1 inherit;
  color: var(--ink);
}
.layers-btn .icon { width: 19px; height: 19px; }
.layers-btn .chevron { width: 16px; height: 16px; color: var(--ink-2); transition: transform .18s; }
.layers-btn[aria-expanded="true"] .chevron { transform: rotate(180deg); }

.layers-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 288px;
  /* Po dołożeniu filtrów panel jest znacznie wyższy niż sama lista warstw
     i na niskim oknie sięgałby poza ekran. */
  max-height: calc(100vh - 150px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 12px 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-float);
  font-size: 13px;
}
.layers-panel[hidden] { display: none; }

.layer-row { display: flex; align-items: center; gap: 8px; padding: 5px 0; cursor: pointer; }
.swatch { width: 14px; height: 14px; border-radius: 3px; border: 1px solid var(--line); flex: none; }
.swatch-multi { background: linear-gradient(135deg, #2a78d6 50%, #c2185b 50%); }
.swatch-triangle { background: var(--c-zgloszenie); clip-path: polygon(50% 0, 100% 100%, 0 100%); border: none; }

.layer-legend {
  display: flex; flex-wrap: wrap; gap: 4px 10px;
  padding: 0 0 6px 22px;
  color: var(--ink-2); font-size: 12px;
}
.legend-item { display: inline-flex; align-items: center; gap: 4px; }
.legend-note { flex-basis: 100%; font-size: 11px; color: var(--ink-3); }
.dot {
  width: 9px; height: 9px; border-radius: 50%;
  border: 1.5px solid #fff; box-shadow: 0 0 0 1px var(--line);
}

/* ---------- filtry mapy ---------- */

.filters { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 10px; }
.filters-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 8px;
}
.filters-head strong { font-size: 13px; }

.filter-field { display: block; margin-bottom: 10px; }
.filter-field > span {
  display: block; margin-bottom: 4px;
  font-size: 12px; font-weight: 600; color: var(--ink-2);
}
.filter-field select {
  width: 100%; padding: 7px 9px;
  border: 1px solid var(--line-strong); border-radius: 9px;
  font: inherit; font-size: 13px; background: #fff;
}
.filter-field select:focus { outline: 2px solid var(--green); outline-offset: 1px; }

.filter-kategorie { border: 0; margin: 0; padding: 0; }
.filter-kategorie legend {
  padding: 0; margin-bottom: 5px;
  font-size: 12px; font-weight: 600; color: var(--ink-2);
}
.filter-kategoria {
  display: flex; align-items: center; gap: 8px;
  padding: 3px 0; font-size: 13px; cursor: pointer;
}
.filter-kategoria-nazwa { flex: 1; }
.filter-kategoria-licznik {
  font-size: 11px; font-variant-numeric: tabular-nums;
  color: var(--ink-3);
}
/* Kategoria bez obiektów zostaje widoczna — brak danych to też informacja —
   ale jest wyraźnie stonowana, żeby nie obiecywała zawartości. */
.filter-kategoria.is-empty { color: var(--ink-3); }
.filter-kategoria.is-empty input { opacity: .5; }

/* ===================== panel zgłoszenia ===================== */

.report-panel {
  position: absolute;
  top: 62px;
  left: var(--gutter);
  z-index: 26;
  width: 340px;
  max-width: calc(100vw - 2 * var(--gutter));
  max-height: calc(100% - 62px - 116px);
  overflow-y: auto;
  padding: 16px 18px;
}
.report-panel[hidden] { display: none; }
/* ---------------------------------------------------------------------------
   Wynik „Sprawdź lokalizację” (§14e)

   Panel siada po PRAWEJ, bo po lewej stoją hero i panel zgłaszania. Dzięki temu
   da się mieć wynik sprawdzenia otwarty razem z kartą obiektu.
   --------------------------------------------------------------------------- */
.check-panel {
  position: absolute;
  top: 62px;
  right: var(--gutter);
  z-index: 26;
  width: 360px;
  max-width: calc(100vw - 2 * var(--gutter));
  max-height: calc(100% - 62px - 116px);
  overflow-y: auto;
  padding: 16px 18px;
}
.check-panel-head { display: flex; justify-content: space-between; align-items: start; gap: 10px; margin-bottom: 12px; }
.check-eyebrow {
  display: block; font-size: 11px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--green-dark); margin-bottom: 2px;
}
.check-panel-head strong { font-size: 15px; line-height: 1.35; }

.check-tiles { display: flex; gap: 8px; margin-bottom: 14px; }
.check-tile {
  flex: 1 1 0; min-width: 0; text-align: center;
  background: var(--green-soft); border-radius: var(--radius-sm); padding: 9px 6px;
}
.check-tile b { display: block; font-size: 20px; line-height: 1.1; color: var(--green-dark); }
.check-tile span { font-size: 10.5px; line-height: 1.3; color: var(--ink-2); display: block; margin-top: 3px; }

.check-title { margin: 16px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); }
.check-band { margin-bottom: 10px; }
.check-band-head {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 12px; font-weight: 700; color: var(--green-dark);
  padding-bottom: 4px; border-bottom: 1px solid var(--line);
}
.check-band-head span { font-weight: 600; color: var(--ink-2); }

.check-list { list-style: none; margin: 0; padding: 0; }
.check-item { padding: 8px 0; border-bottom: 1px solid var(--line); }
.check-item:last-child { border-bottom: none; }
.check-item-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; font-size: 13.5px; }
.check-dist { white-space: nowrap; color: var(--green-dark); font-weight: 700; font-size: 12.5px; }
.check-dist abbr { text-decoration: none; cursor: help; }
.check-item-meta { font-size: 12px; color: var(--ink-2); line-height: 1.45; margin-top: 2px; }

.check-problems { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.check-problems li { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px solid var(--line); }
.check-problems li span { font-weight: 700; color: var(--c-zgloszenie); }

.check-historic { margin-top: 14px; }
.check-historic summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--ink-2); }
/* Poziom gęstości pasa — ta sama trójka kolorów co na mapie, żeby panel
   i mapa mówiły to samo. */
.check-level {
  display: inline-block; margin-left: 6px; padding: 1px 7px;
  border-radius: 999px; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em;
}
.check-level-malo { background: var(--green-soft); color: var(--green-dark); }
.check-level-srednio { background: var(--orange-soft); color: #b4590f; }
.check-level-duzo { background: #fdeceb; color: var(--red); }

/* Podgląd sondy pod kursorem. */
.probe-hint {
  position: absolute; z-index: 30; pointer-events: none;
  background: rgba(11, 11, 11, .88); color: #fff;
  padding: 7px 10px; border-radius: 8px;
  font-size: 11.5px; line-height: 1.5; white-space: nowrap;
  box-shadow: var(--shadow-float);
}
.probe-hint .poziom-malo { color: var(--green-light); }
.probe-hint .poziom-srednio { color: #ffb872; }
.probe-hint .poziom-duzo { color: #ff8b86; }

/* Aktywna sonda — jak aktywny tryb zgłaszania, żeby stan był widoczny. */
#btn-probe.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.check-empty { font-size: 13px; line-height: 1.55; color: var(--ink-2); }
.check-note { font-size: 11.5px; line-height: 1.5; color: var(--ink-2); margin: 10px 0 0; }

.report-panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.report-panel-head strong { font-size: 15px; }
.report-hint { color: var(--ink-2); font-size: 13px; line-height: 1.5; }

.duplicate-warning {
  background: #fdf6e6;
  border: 1px solid var(--c-inne);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin: 10px 0;
  font-size: 13px;
  line-height: 1.5;
}
.duplicate-actions { display: grid; gap: 7px; margin-top: 10px; }
.duplicate-actions .btn { padding: 9px 14px; font-size: 13px; }

.report-fields .field { display: block; margin: 12px 0; }
.report-fields .field span {
  display: block; margin-bottom: 5px;
  font-size: 12px; font-weight: 600; color: var(--ink-2);
}
.report-fields textarea,
.report-fields select,
.report-fields input {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  font: inherit;
  background: #fff;
}
.report-fields textarea:focus,
.report-fields select:focus,
.report-fields input:focus { outline: 2px solid var(--green); outline-offset: 1px; }
.privacy-note { margin: 6px 0 12px; font-size: 12px; color: var(--ink-3); line-height: 1.5; }

/* Formularz zgłoszenia (§15) — grupy pól, listy wyboru i skala uciążliwości.
   Reguła `.report-fields .field span` robi z każdego spana etykietę bloku,
   więc spany w środku list i liczników muszą ją tu cofnąć. */
.report-fields fieldset.field-group {
  display: block; margin: 12px 0; padding: 0; border: 0;
}
.report-fields fieldset.field-group legend {
  padding: 0; margin-bottom: 6px;
  font-size: 12px; font-weight: 600; color: var(--ink-2);
}
/* Dwie klasy plus element w `.report-fields .field span` biją samo `.req` —
   gwiazdka musi mieć wyższą specyficzność, inaczej spada do własnej linii. */
.report-fields .field .req,
.report-fields legend .req { display: inline; margin: 0; color: var(--red); font-weight: 600; }

.choice-list { display: grid; gap: 2px; }
.report-fields .choice {
  display: flex; align-items: flex-start; gap: 8px;
  margin: 0; padding: 5px 6px;
  border-radius: 8px; cursor: pointer;
}
.report-fields .choice:hover { background: var(--green-soft); }
.report-fields .choice input[type="checkbox"] {
  width: auto; flex: none; margin-top: 2px; accent-color: var(--green);
}
.report-fields .choice span {
  display: inline; margin: 0;
  font-size: 13px; font-weight: 400; color: var(--ink); line-height: 1.35;
}

/* Podpole odsłaniane po wyborze „Inne” — wcięcie pokazuje, do czego należy. */
.report-fields .field-sub {
  margin-left: 10px; padding-left: 10px; border-left: 2px solid var(--line);
}

.report-fields .field-check {
  display: flex; align-items: flex-start; gap: 8px; margin: 10px 0;
}
.report-fields .field-check input { width: auto; flex: none; margin-top: 2px; accent-color: var(--green); }
.report-fields .field-check span {
  display: inline; margin: 0; font-size: 12px; font-weight: 400; color: var(--ink-2); line-height: 1.4;
}

/* §15f. Skala 1–5 jako pięć przycisków: na telefonie trafia się w nie palcem,
   a wybrana wartość jest widoczna bez rozwijania listy. */
.scale { display: flex; gap: 6px; }
.scale-btn {
  flex: 1; padding: 9px 0;
  border: 1px solid var(--line-strong); border-radius: 10px;
  background: #fff; font: inherit; font-weight: 600; color: var(--ink-2);
  cursor: pointer; transition: background .12s, color .12s, border-color .12s;
}
.scale-btn:hover { border-color: var(--green); color: var(--green); }
.scale-btn.is-selected {
  background: var(--green); border-color: var(--green); color: #fff;
}
.scale-btn:focus-visible { outline: 2px solid var(--green); outline-offset: 1px; }
.scale-hint { margin: 6px 0 0; font-size: 12px; color: var(--ink-3); }

/* §14b. Zakres sprawdzenia — zwinięty, bo domyślnie obowiązuje „wszystkie
   ryzyka” i zawężenie jest opcją, a nie krokiem do przejścia. */
.check-zakres {
  margin: 0 0 12px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--green-soft);
}
.check-zakres > summary {
  cursor: pointer; font-size: 12px; font-weight: 600; color: var(--ink-2);
  list-style: none;
}
.check-zakres > summary::-webkit-details-marker { display: none; }
.check-zakres > summary::before { content: "▸ "; color: var(--ink-3); }
.check-zakres[open] > summary::before { content: "▾ "; }
.check-zakres #check-zakres-opis { color: var(--green-dark); }
.check-zakres .choice-list { margin-top: 8px; }
.check-zakres .choice {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 4px 2px; font-size: 13px; cursor: pointer;
}
.check-zakres .choice input { flex: none; margin-top: 2px; accent-color: var(--green); }
.check-zakres .btn { margin-top: 6px; }

/* §15i. Krok „Dodaj materiał”: pole pliku chowamy pod etykietą-przyciskiem,
   bo natywne `input[type=file]` wygląda inaczej w każdej przeglądarce. */
.field-hint { margin: 0 0 8px; font-size: 12px; color: var(--ink-3); line-height: 1.45; }
.report-fields .btn-plik { display: flex; margin-bottom: 10px; cursor: pointer; }
.report-fields .btn-plik input[type="file"] {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0;
}
.link-wiersz { display: flex; gap: 6px; }
.report-fields .link-wiersz input { flex: 1; }
.report-fields .link-wiersz .btn { flex: none; padding: 9px 14px; }

.materialy { list-style: none; margin: 10px 0 6px; padding: 0; display: grid; gap: 6px; }
.material {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--green-soft);
}
.material-opis {
  flex: 1; min-width: 0;
  font-size: 12px; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.material-usun {
  flex: none; width: 22px; height: 22px;
  border: 0; border-radius: 50%; background: transparent;
  color: var(--ink-2); font-size: 17px; line-height: 1; cursor: pointer;
}
.material-usun:hover { background: #fff; color: var(--red); }

/* §18g. Materiały na karcie zgłoszenia — tylko dopuszczone przez moderatora. */
.popup-materialy-lista {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 5px; align-items: center;
}
.material-miniatura {
  width: 64px; height: 64px; object-fit: cover;
  border-radius: 8px; border: 1px solid var(--line); display: block;
}
.material-link {
  font-size: 12px; color: var(--green-dark);
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* §26a. Widget captchy ma stałą wysokość; rezerwujemy ją, żeby pojawienie się
   ramki nie przesuwało przycisku „Zapisz zgłoszenie” pod kursorem. */
.captcha { min-height: 68px; margin: 12px 0 4px; font-size: 12px; color: var(--ink-3); }

.report-warning {
  margin: 10px 0 0; padding: 9px 11px;
  border-radius: 10px; background: var(--orange-soft);
  font-size: 12px; color: var(--ink); line-height: 1.45;
}

/* §20h. Kreator: licznik u góry, nawigacja przyklejona do dołu panelu, żeby
   „Dalej” było pod kciukiem bez przewijania na każdym kroku. */
.krok-licznik {
  margin: 0 0 10px;
  font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--ink-3);
}
.krok-nawigacja {
  position: sticky; bottom: 0;
  display: flex; gap: 8px; margin-top: 16px; padding: 12px 0 2px;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0), #fff 22%);
}
.krok-nawigacja .btn { flex: 1; }
.krok-nawigacja #btn-krok-wstecz { flex: 0 0 96px; }

.report-fields .field-counter {
  display: block; margin-top: 4px;
  font-size: 11px; font-weight: 400; color: var(--ink-3); text-align: right;
}
.report-linked {
  margin: 10px 0 0;
  padding: 9px 11px;
  background: var(--green-soft);
  border-radius: var(--radius-sm);
  font-size: 12.5px; line-height: 1.5; color: var(--green-dark);
}
.report-linked[hidden] { display: none; }
.report-saved { font-size: 13px; color: var(--green-dark); line-height: 1.55; }
.report-error {
  margin-top: 10px; padding: 9px 11px; border-radius: 8px;
  background: #fdeceb; border: 1px solid var(--red);
  font-size: 12.5px; line-height: 1.5; color: var(--red);
}

/* ===================== pasek statystyk ===================== */

.statsbar {
  position: absolute;
  left: var(--gutter);
  right: var(--gutter);
  bottom: 18px;
  z-index: 16;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 30px;
  padding: 16px 22px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}
.stat { display: flex; align-items: center; gap: 14px; padding-right: 30px; border-right: 1px solid var(--line); }
.stat-icon { display: grid; place-items: center; width: 42px; height: 42px; flex: none; }
.stat-icon svg { width: 32px; height: 32px; }
.stat-icon-green { color: var(--green); }
.stat-text strong { display: block; font-size: 26px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.stat-text span { display: block; color: var(--ink-2); font-size: 13px; }

.statsbar-note { margin-left: auto; text-align: right; color: var(--ink-2); font-size: 12.5px; line-height: 1.5; }
/* Kredyt licencyjny (OSM/ODbL, EEA CC BY 4.0) musi być widoczny bez klikania —
   pełne wyjaśnienie zostaje w modalu „Metodologia” pod ikoną obok. */
.statsbar-sources { margin-top: 2px; font-size: 11px; color: var(--ink-3); }
.statsbar-sources a { color: var(--ink-2); text-decoration: none; border-bottom: 1px solid var(--line-strong); }
.statsbar-sources a:hover { color: var(--ink); border-bottom-color: var(--ink); }
.btn-info {
  flex: none;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border: 0; border-radius: 50%;
  background: none; color: var(--ink-3);
  cursor: pointer;
}
.btn-info:hover { color: var(--ink); background: #f3f3f1; }
.btn-info svg { width: 24px; height: 24px; }

/* ===================== popupy mapy ===================== */

.maplibregl-popup-content {
  font-family: inherit;
  font-size: 13px;
  line-height: 1.45;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-float);
  max-width: 300px;
}
.popup-title { font-size: 14.5px; font-weight: 700; margin: 0 0 3px; padding-right: 14px; }
.popup-row { color: var(--ink-2); }
.popup-row b { color: var(--ink); font-weight: 600; }
.popup-note {
  margin-top: 9px; padding: 7px 9px;
  border-radius: 8px; background: #fdf4e7;
  color: #8a5a12; font-size: 12px; line-height: 1.4;
}
.popup-source {
  margin-top: 9px; padding-top: 9px;
  border-top: 1px solid var(--line); font-size: 12px;
}
.popup-source a { color: #1c5cab; }
.badge {
  display: inline-block; margin-bottom: 7px;
  padding: 3px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 700;
}
.badge-official { background: var(--green-soft); color: var(--green-dark); }
.badge-unverified { background: #ece9f7; color: var(--c-zgloszenie); border: 1px dashed var(--c-zgloszenie); }
/* §13b: zgłoszenie potwierdzone przez fundację — ciągła ramka zamiast
   przerywanej, bo to już nie jest sama deklaracja mieszkańca. */
.badge-verified { background: var(--green-soft); color: var(--green-dark); border: 1px solid var(--green); }

/* §12: „istnieje teraz” i „może powstać” muszą różnić się na pierwszy rzut oka. */
.badge-status { margin-right: 5px; }
.badge-istniejacy { background: #e7f0fb; color: #1c4e86; }
.badge-planowany,
.badge-w_budowie { background: #fff5e0; color: #8a5b00; border: 1px dashed #c9922a; }
.badge-historyczny { background: var(--line); color: var(--ink-3); }
.badge-nieznany { background: var(--line); color: var(--ink-3); }

.popup-uciazliwosci { margin-top: 6px; }
/* Dane z rejestru, nie domysł redakcyjny — stąd inny kolor niż uciążliwości. */
.popup-emisje { margin-top: 6px; color: var(--ink); }
.popup-cta { width: 100%; margin-top: 10px; padding: 8px 12px; font-size: 13px; }

/* ===================== asystent ===================== */

.chat-launcher {
  position: fixed;
  right: var(--gutter);
  bottom: 116px;
  z-index: 28;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border: 0;
  border-radius: 999px;
  padding: 12px 20px 12px 16px;
  background: var(--ink);
  color: #fff;
  font: 600 14px/1 inherit;
  cursor: pointer;
  box-shadow: var(--shadow-float);
}
.chat-launcher:hover { background: #262625; }

/* Dymek = rozmowa, iskra = to jest asystent AI, a nie zwykły formularz. */
.icon-assistant { width: 21px; height: 21px; flex: none; }
.icon-assistant .sparkle { fill: var(--green-light); }
.chat-head-icon {
  display: grid; place-items: center;
  width: 34px; height: 34px; flex: none;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
}
.chat-head-icon .icon-assistant { width: 19px; height: 19px; }

.chat-panel {
  position: fixed;
  right: var(--gutter);
  bottom: 18px;
  z-index: 32;
  display: grid;
  grid-template-rows: auto minmax(120px, 1fr) auto auto;
  width: min(390px, calc(100vw - 2 * var(--gutter)));
  height: min(570px, calc(100vh - var(--topbar-h) - 40px));
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-float);
  overflow: hidden;
}
.chat-panel[hidden] { display: none; }
.chat-head { display: flex; align-items: center; gap: 11px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.chat-head > div { margin-right: auto; }
.chat-head strong, .chat-head span { display: block; }
.chat-head span { margin-top: 2px; color: var(--ink-3); font-size: 11px; }
.chat-head .chat-status-error { color: #9b241d; }
.chat-messages { overflow-y: auto; padding: 14px; background: #f6f7f5; }
.chat-message {
  width: fit-content; max-width: 88%; margin: 0 0 10px;
  padding: 9px 12px; border-radius: 12px;
  font-size: 13px; line-height: 1.45; white-space: pre-wrap;
}
.chat-message-agent { background: #fff; border: 1px solid var(--line); }
.chat-message-user { margin-left: auto; background: var(--ink); color: #fff; }
.chat-message-pending { color: var(--ink-2); background: #e9eae7; }
.chat-message-error { color: #8f1d18; background: #f9e9e7; border: 1px solid #e5b8b4; }
.chat-report-confirm {
  margin: 0 0 10px; padding: 11px;
  border: 1px solid #d59b22; border-radius: var(--radius-sm);
  background: #fff8e8; font-size: 12px;
}
.chat-report-confirm p { margin: 0 0 8px; font-weight: 600; }
.chat-report-confirm .btn { width: 100%; font-size: 12px; white-space: normal; }
.chat-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 10px; border-top: 1px solid var(--line); }
.chat-form textarea {
  resize: none; width: 100%; padding: 9px 10px;
  border: 1px solid var(--line-strong); border-radius: 10px; font: inherit;
}
.chat-form textarea:focus { outline: 2px solid var(--green); outline-offset: 1px; }
.chat-form .btn { align-self: stretch; }
.chat-disclaimer { margin: 0; padding: 0 12px 10px; color: var(--ink-3); font-size: 10.5px; }

/* ===================== modale ===================== */

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(8, 12, 10, .62);
  backdrop-filter: blur(3px);
}
.modal[hidden] { display: none; }
.modal-card {
  position: relative;
  width: min(620px, 100%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  padding: 28px 30px;
  background: var(--paper);
  border-radius: var(--radius-lg);
  box-shadow: 0 22px 70px rgba(0,0,0,.4);
  line-height: 1.55;
}
.modal-close { position: absolute; top: 16px; right: 16px; }
.modal-card h1 { margin: 12px 0 14px; font-size: clamp(22px, 3.6vw, 28px); font-weight: 800; line-height: 1.15; }
.modal-card p { margin: 12px 0; }
.modal-meta { color: var(--ink-2); font-size: 13px; }
.modal-list { margin: 14px 0; padding-left: 18px; color: var(--ink-2); font-size: 13.5px; }
.modal-list li { margin: 9px 0; }
.modal-list strong { color: var(--ink); }
.callout {
  padding: 12px 14px;
  border-left: 4px solid var(--red);
  border-radius: 0 10px 10px 0;
  background: #fbeeed;
  font-weight: 600;
}
.modal-card .btn-block { margin-top: 18px; padding: 13px 18px; }

/* ===================== bramka hasłowa ===================== */

.access-gate {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: #0d1712;
}
.access-gate[hidden] { display: none; }
.access-gate-card {
  width: min(390px, 100%);
  padding: 32px;
  background: var(--paper);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 70px rgba(0,0,0,.45);
}
.access-gate-label {
  color: var(--green); font-size: 11.5px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
}
.access-gate h1 { margin: 8px 0 4px; font-size: 26px; font-weight: 800; }
.access-gate p { margin: 0 0 18px; color: var(--ink-2); }
.access-gate input {
  width: 100%; padding: 12px;
  border: 1px solid var(--line-strong); border-radius: 10px; font: inherit;
}
.access-gate input:focus { outline: 2px solid var(--green); outline-offset: 1px; }
.access-gate-error { min-height: 20px; margin: 8px 0 4px; color: #a5221c; font-size: 13px; }
.access-gate .btn { width: 100%; padding: 12px 16px; }

/* tryb zgłaszania: kursor celownika */
.reporting #map .maplibregl-canvas-container { cursor: crosshair; }

/* ===================== responsywność ===================== */

@media (max-width: 1180px) {
  :root { --gutter: 16px; --hero-w: 328px; }
}

@media (max-width: 900px) {
  .topbar-nav { display: none; }
  .brand img { height: 32px; }
  .btn-cta span { display: none; }
  .btn-cta { padding: 12px; }

  .searchbar-wrap { top: 12px; left: var(--gutter); right: var(--gutter); max-width: none; }
  .searchbar { height: 52px; padding-left: 16px; }
  .searchbar input { font-size: 15px; }

  /* Dolny pas kontrolek: statystyki, nad nimi rząd asystent + warstwy,
     nad nimi kontrolki mapy. Panel powitalny kończy się powyżej tego pasa. */
  .layers { top: auto; bottom: 130px; right: var(--gutter); }
  .layers-panel { top: auto; bottom: calc(100% + 8px); }
  .layers-btn { height: 42px; }

  .maplibregl-ctrl-bottom-right { bottom: 168px; right: calc(var(--gutter) - 10px); }
  .chat-launcher { bottom: 130px; left: var(--gutter); right: auto; padding: 12px 14px; font-size: 13px; }
  .chat-panel { bottom: 12px; height: min(520px, calc(100vh - var(--topbar-h) - 30px)); }

  /* panel powitalny staje się wysuwaną kartą nad pasem kontrolek */
  .hero {
    top: auto;
    bottom: 184px;
    left: var(--gutter);
    right: var(--gutter);
    width: auto;
    max-height: calc(100% - 260px);
  }
  .hero-toggle { display: grid; place-items: center; }
  .hero-card { padding: 18px 18px 16px; }
  .hero-card h1 { font-size: 24px; }

  /* Rozwinięta karta zakrywa całą mapę — pływające kontrolki byłyby wtedy
     nieklikalne, więc chowamy je aż do zwinięcia panelu. */
  body.hero-otwarty .layers,
  body.hero-otwarty .maplibregl-ctrl-bottom-right { display: none; }

  /* zwinięty panel zostaje jako pigułka „Wprowadzenie” */
  .hero.is-collapsed { right: auto; }
  .hero.is-collapsed .hero-toggle {
    position: static;
    width: auto; height: 38px;
    padding: 0 14px;
    gap: 6px;
    border-radius: 999px;
    box-shadow: var(--shadow-card);
    color: var(--ink);
    font: 600 13px/1 inherit;
  }
  .hero.is-collapsed .hero-toggle::after { content: "Wprowadzenie"; }

  .report-panel { top: 76px; bottom: auto; max-height: calc(100% - 190px); }
  /* Na wąskim ekranie panel sprawdzenia zajmuje szerokość kolumny — obok hero
     nie ma już miejsca na dwie karty. */
  .check-panel {
    top: 76px; right: var(--gutter); left: var(--gutter);
    width: auto; max-height: calc(100% - 190px);
  }

  /* Statystyki zostają w jednym rzędzie (dzielą szerokość po równo),
     linia źródeł schodzi pod nie jako osobny wiersz. */
  .statsbar { gap: 8px 12px; padding: 12px 14px; bottom: 12px; }
  .stat { flex: 1 1 0; min-width: 0; gap: 8px; padding-right: 12px; }
  .stat-icon { width: 32px; height: 32px; }
  .stat-icon svg { width: 26px; height: 26px; }
  .stat-text strong { font-size: 20px; }
  .stat-text span { font-size: 11.5px; }
  /* Źródła zostają widoczne także na wąskim ekranie — schodzą do drugiego
     wiersza, a zastrzeżenie „dane informacyjne” zostaje w modalu. */
  .statsbar-note { order: 3; flex-basis: 100%; margin-left: 0; text-align: left; }
  .statsbar-disclaimer { display: none; }
  .statsbar-sources { margin-top: 0; font-size: 10.5px; line-height: 1.45; }
  .btn-info { order: 2; margin-left: auto; }
}

@media (max-width: 560px) {
  .hero-actions { grid-template-columns: 1fr; }
  .modal-card { padding: 22px 20px; }
  .statsbar { gap: 12px; }
  .stat-text span { font-size: 11px; }
}
