:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-subtle: #f1f4f8;
  --surface-hover: #e5ebf3;
  --header-bg: rgba(246, 247, 249, 0.82);
  --tabs-bg: #e9edf3;
  --map-bg: #ffffff;
  --map-region-fill: #dce6f3;
  --map-stroke: #ffffff;
  --map-outline: #a6bdd8;
  --map-shadow: rgba(30, 64, 175, 0.08);
  --map-zoom-fill: #dbeafe;
  --map-zoom-stroke: #2563eb;
  --label-fill: #1e293b;
  --label-halo: rgba(255, 255, 255, 0.85);
  --pin-halo: rgba(255, 255, 255, 0.96);
  --slider-track: #e2e8f0;
  --slider-thumb-bg: #ffffff;
  --ink: #0f172a;
  --ink-secondary: #475569;
  --ink-muted: #64748b;
  --border: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.14);
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: #eff6ff;
  --accent-tint: #dbeafe;
  --positive: #059669;
  --positive-soft: #ecfdf5;
  --negative: #dc2626;
  --negative-soft: #fef2f2;
  --tooltip-bg: rgba(15, 23, 42, 0.9);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.03), 0 12px 32px -12px rgba(15, 23, 42, 0.07);
  --shadow-float: 0 14px 36px -8px rgba(15, 23, 42, 0.18);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --display: "Plus Jakarta Sans", "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* Prawdziwa, gładka czerń (bez fioletowo-neonowej poświaty) */
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0b0d;
  --surface: #131518;
  --surface-subtle: #1b1e23;
  --surface-hover: #242830;
  --header-bg: rgba(10, 11, 13, 0.84);
  --tabs-bg: #1b1e23;
  --map-bg: #0d0f12;
  --map-region-fill: #1f2633;
  --map-stroke: #0d0f12;
  --map-outline: #3f4e66;
  --map-shadow: rgba(0, 0, 0, 0.45);
  --map-zoom-fill: #1b3352;
  --map-zoom-stroke: #60a5fa;
  --label-fill: #f1f5f9;
  --label-halo: rgba(13, 15, 18, 0.92);
  --pin-halo: rgba(13, 15, 18, 0.95);
  --slider-track: #272b33;
  --slider-thumb-bg: #131518;
  --ink: #f3f4f6;
  --ink-secondary: #b4bac6;
  --ink-muted: #7c8494;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.15);
  --accent: #3b82f6;
  --accent-hover: #60a5fa;
  --accent-soft: rgba(59, 130, 246, 0.12);
  --accent-tint: rgba(59, 130, 246, 0.22);
  --positive: #34d399;
  --positive-soft: rgba(16, 185, 129, 0.12);
  --negative: #f87171;
  --negative-soft: rgba(239, 68, 68, 0.12);
  --tooltip-bg: rgba(24, 27, 32, 0.94);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.35), 0 16px 36px -14px rgba(0, 0, 0, 0.55);
  --shadow-float: 0 16px 40px -8px rgba(0, 0, 0, 0.65);
}

*, *::before, *::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  overflow-y: scroll;
  overflow-x: clip;
  scrollbar-gutter: stable;
}

html, body {
  margin: 0;
  padding: 0;
  max-width: 100%;
  overflow-x: clip;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 0.24s var(--ease), color 0.24s var(--ease);
}

.wrap {
  max-width: 1380px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Gładki, lekki header */
.masthead {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--header-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  transition: background-color 0.24s var(--ease), border-color 0.24s var(--ease);
}

.masthead-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-block: 10px;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  color: var(--ink);
  padding: 4px 6px 4px 0;
  border-radius: 8px;
  transition: opacity 0.16s var(--ease);
}

.brand-link:hover {
  opacity: 0.78;
}

.brand-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.brand-title {
  font-family: var(--display);
  font-size: 1.18rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0;
  color: var(--ink);
  white-space: nowrap;
}

.nav-divider {
  width: 1px;
  height: 20px;
  background: var(--border-strong);
  flex-shrink: 0;
}

.primary-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.primary-nav::-webkit-scrollbar {
  display: none;
}

.nav-link {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-secondary);
  font-family: var(--sans);
  font-size: 0.84rem;
  font-weight: 500;
  padding: 6px 11px;
  border-radius: 10px;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  transition: background-color 0.16s var(--ease), color 0.16s var(--ease), border-color 0.16s var(--ease);
}

.nav-link:hover:not(.is-soon) {
  background: var(--surface-subtle);
  color: var(--ink);
}

.nav-link.is-active {
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}

.nav-link.is-soon {
  cursor: default;
  color: var(--ink-muted);
  opacity: 0.62;
  user-select: none;
}

.nav-soon-tag {
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ink-muted);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 999px;
  line-height: 1.25;
}

.brand-tag {
  font-size: 0.74rem;
  font-weight: 500;
  color: var(--ink-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 2px 9px;
  border-radius: 999px;
}

.brand-tag-btn {
  appearance: none;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.18s var(--ease), color 0.18s var(--ease), background 0.18s var(--ease);
}

.brand-tag-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

/* Kompaktowy nagłówek H1 + pasek źródeł danych */
.hero-strip {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.hero-intro {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.page-h1 {
  font-family: var(--display);
  font-size: 1.32rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.2;
  margin: 0;
  color: var(--ink);
}

.page-lead {
  font-size: 0.84rem;
  color: var(--ink-secondary);
  margin: 0;
}

/* Widoczny pasek źródeł danych (buduje zaufanie od pierwszego ekranu) */
.trust-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 9px 14px;
  box-shadow: var(--shadow-sm);
}

.trust-sources {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.trust-lead {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--ink-muted);
  margin-right: 2px;
}

.trust-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink-secondary);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

.trust-check {
  color: var(--positive);
  font-weight: 800;
  font-size: 0.72rem;
}

.trust-right {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.trust-updated {
  font-size: 0.75rem;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

.trust-link-btn {
  appearance: none;
  border: 1px solid var(--border-strong);
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--sans);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.18s var(--ease), color 0.18s var(--ease), border-color 0.18s var(--ease);
}

.trust-link-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.section-head-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.inline-info-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--accent);
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}

.inline-info-btn:hover {
  background: var(--accent-soft);
}

/* Modal: Skąd pochodzą dane i jak liczymy */
.sources-dialog {
  width: min(640px, calc(100vw - 24px));
  max-height: 88dvh;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-float);
  overscroll-behavior: contain;
  overflow: auto;
}

.sources-dialog::backdrop {
  background: rgba(10, 14, 24, 0.56);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.sources-dialog-inner {
  padding: 22px 24px 24px;
}

.sources-dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.sources-dialog-head h2 {
  font-family: var(--display);
  font-size: 1.32rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 2px 0 0;
}

.dialog-close-btn {
  appearance: none;
  border: 1px solid var(--border-strong);
  background: var(--surface-subtle);
  color: var(--ink-secondary);
  width: 36px;
  height: 36px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.92rem;
  flex-shrink: 0;
  transition: background 0.18s var(--ease), color 0.18s var(--ease);
}

.dialog-close-btn:hover {
  background: var(--surface-hover);
  color: var(--ink);
}

.sources-lead {
  font-size: 0.87rem;
  color: var(--ink-secondary);
  margin: 0 0 16px;
  line-height: 1.55;
}

.sources-cards {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.source-card {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 12px 14px;
}

.source-card-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.source-card-top strong {
  font-size: 0.88rem;
  color: var(--ink);
}

.source-card-top a {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}

.source-card-top a:hover {
  text-decoration: underline;
}

.source-card p {
  margin: 0;
  font-size: 0.81rem;
  color: var(--ink-secondary);
  line-height: 1.5;
}

.source-card code {
  font-size: 0.76rem;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: 5px;
  color: var(--ink);
}

.sources-honest-note {
  background: var(--accent-soft);
  border: 1px solid rgba(37, 99, 235, 0.2);
  border-radius: 13px;
  padding: 12px 14px;
}

.sources-honest-note strong {
  display: block;
  font-size: 0.84rem;
  color: var(--ink);
  margin-bottom: 4px;
}

.sources-honest-note p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--ink-secondary);
  line-height: 1.5;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Switch jasny / ciemny */
.theme-switch {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}

.theme-switch-track {
  width: 50px;
  height: 28px;
  border-radius: 999px;
  background: var(--tabs-bg);
  border: 1px solid var(--border);
  padding: 2px;
  display: flex;
  align-items: center;
  transition: background-color 0.24s var(--ease), border-color 0.24s var(--ease);
}

.theme-switch:hover .theme-switch-track {
  border-color: var(--border-strong);
}

.theme-switch-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.16);
  transform: translateX(0);
  transition: transform 0.28s var(--spring), background-color 0.24s var(--ease), color 0.24s var(--ease);
}

.theme-switch .icon-moon {
  display: none;
}

[data-theme="dark"] .theme-switch-thumb {
  transform: translateX(22px);
  background: #242830;
  color: #f3f4f6;
}

[data-theme="dark"] .theme-switch .icon-sun {
  display: none;
}

[data-theme="dark"] .theme-switch .icon-moon {
  display: block;
}

/* Przełącznik trybu (styl iOS/macOS) */
.mode-tabs {
  display: inline-flex;
  padding: 3px;
  border-radius: 11px;
  background: var(--tabs-bg);
  gap: 2px;
}

.mode-tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink-secondary);
  font-family: var(--sans);
  font-size: 0.84rem;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.2s var(--ease), background 0.2s var(--ease), box-shadow 0.2s var(--ease), opacity 0.2s var(--ease);
}

.mode-tab:hover:not(.is-active) {
  color: var(--ink);
  opacity: 0.9;
}

.mode-tab.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 1px rgba(15, 23, 42, 0.04);
}

/* Główna siatka */
.main-content {
  padding-top: 22px;
  padding-bottom: 64px;
}

.atlas-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.22fr) minmax(0, 0.98fr);
  gap: 24px;
  align-items: start;
}

.atlas-grid > * {
  min-width: 0;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-card);
  padding: 22px 24px;
}

.panel-kicker {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--ink-muted);
  letter-spacing: 0.01em;
}

/* Lewa kolumna: Duża, gładka mapa Polski (statyczna — zero pływania i skakania przy zmianie zakładek) */
.map-panel {
  padding: 20px 22px 22px;
}

.map-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.map-status {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 32px;
}

.zoom-back-btn {
  appearance: none;
  border: 1px solid var(--border-strong);
  background: var(--ink);
  color: var(--bg);
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 13px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: transform 0.22s var(--ease), background 0.2s var(--ease), color 0.2s var(--ease), opacity 0.2s var(--ease);
  animation: fadeSlideIn 0.25s var(--ease) both;
}

.zoom-back-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
  transform: translateX(-2px);
}

/* Segmented controls (miękkie, gładkie) */
.segmented {
  display: inline-flex;
  padding: 3px;
  border-radius: 10px;
  background: var(--surface-subtle);
  gap: 2px;
}

.segmented button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink-muted);
  font-family: var(--sans);
  font-size: 0.79rem;
  font-weight: 500;
  padding: 6px 11px;
  border-radius: 7px;
  cursor: pointer;
  transition: color 0.18s var(--ease), background 0.18s var(--ease), box-shadow 0.18s var(--ease), opacity 0.18s var(--ease);
}

.segmented button:hover:not(.is-active) {
  color: var(--ink);
  background: var(--surface-hover);
}

.segmented button.is-active {
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.14);
}

.map-wrap {
  position: relative;
  width: 100%;
  border-radius: 16px;
  background: var(--map-bg);
  border: 1px solid var(--border);
  overflow: hidden;
  padding: 8px;
  transition: background-color 0.24s var(--ease), border-color 0.24s var(--ease);
}

.map-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 720 / 683.9;
  overflow: hidden;
  touch-action: pan-y;
}

#poland-map {
  width: 100%;
  height: 100%;
  display: block;
  user-select: none;
  font-family: inherit;
  shape-rendering: geometricPrecision;
  text-rendering: geometricPrecision;
  touch-action: pan-y;
}

#map-wrap.is-zoomed,
#map-wrap.is-zoomed .map-stage,
#poland-map.is-zoomed {
  touch-action: none;
}

#poland-map .map-regions {
  filter: drop-shadow(0 8px 18px var(--map-shadow));
}

#poland-map.is-zoomed {
  cursor: zoom-out;
}

#poland-map.is-panning {
  cursor: grabbing !important;
}

/* Subtelny, elegancki obrys całej Polski */
.poland-outline path {
  fill: none;
  stroke: var(--map-outline);
  stroke-width: 1.6;
  stroke-linejoin: round;
  stroke-linecap: round;
  pointer-events: none;
  transition: opacity 0.28s var(--ease), stroke 0.24s var(--ease);
}

#poland-map.is-zoomed .poland-outline {
  opacity: 0.16;
}

/* Gładkie województwa + wyraźne hover opacity */
.voivodeship {
  fill: var(--map-region-fill);
  stroke: var(--map-stroke);
  stroke-width: 1.4;
  stroke-linejoin: round;
  stroke-linecap: round;
  cursor: pointer;
  outline: none;
  transition: opacity 0.28s var(--ease), fill 0.24s var(--ease), stroke 0.22s var(--ease), stroke-width 0.22s var(--ease);
}

.voivodeship.is-selected-region {
  stroke: var(--accent);
  stroke-width: 2.2;
}

#poland-map:not(.is-zoomed) .map-regions:hover .voivodeship {
  opacity: 0.38;
}

#poland-map:not(.is-zoomed) .map-regions:hover .voivodeship:hover {
  opacity: 1;
  stroke: var(--accent);
  stroke-width: 2.2;
}

/* Tryb ZOOM: wybrane województwo jasne i czyste, reszta delikatnie wygaszona */
#poland-map.is-zoomed .voivodeship {
  opacity: 0.16;
  stroke-width: 0.85;
}

#poland-map.is-zoomed .voivodeship:hover {
  opacity: 0.45;
}

#poland-map.is-zoomed .voivodeship.is-zoomed-region {
  opacity: 0;
  fill: transparent !important;
  stroke: none !important;
  pointer-events: none;
}

/* Wewnętrzna warstwa 380 powiatów — wyłania się po przybliżeniu województwa */
.map-counties {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s var(--ease);
}

#poland-map.is-zoomed .map-counties.has-counties {
  opacity: 1;
  pointer-events: auto;
}

.county-path {
  vector-effect: non-scaling-stroke;
  stroke: rgba(255, 255, 255, 0.78);
  stroke-width: 1px;
  stroke-linejoin: round;
  stroke-linecap: round;
  cursor: pointer;
  outline: none;
  transition: fill 0.22s var(--ease), stroke 0.15s var(--ease), filter 0.15s var(--ease);
}

[data-theme="dark"] .county-path {
  stroke: rgba(13, 15, 18, 0.72);
}

.county-path:hover {
  stroke: var(--accent);
  stroke-width: 1.5px;
  filter: brightness(0.95);
}

[data-theme="dark"] .county-path:hover {
  filter: brightness(1.15);
}

.county-path.is-active-county {
  stroke: var(--accent);
  stroke-width: 1.8px;
}

.county-path:focus-visible {
  stroke: var(--ink);
  stroke-width: 2px;
}

.voivodeship:focus-visible {
  stroke: var(--ink);
  stroke-width: 2.2;
  opacity: 1 !important;
}

/* Warstwa ostrych etykiet HTML nad mapą (widok całej Polski) */
.map-labels-layer,
.map-pins-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  font-family: inherit;
}

.map-labels-layer.is-hidden {
  opacity: 0;
  transition: opacity 0.2s var(--ease);
}

.map-labels-layer.has-hover .html-region-marker:not(.is-hovered) {
  opacity: 0.3;
}

.html-region-marker {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
  transition: opacity 0.24s var(--ease);
  color: var(--ink);
  -webkit-font-smoothing: auto;
}

.html-region-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink);
  border: 1.5px solid var(--surface);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.25);
  flex-shrink: 0;
  transition: background-color 0.2s var(--ease), transform 0.2s var(--spring);
}

.html-region-name {
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(15, 23, 42, 0.11);
  border-radius: 7px;
  padding: 2px 7px;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.1);
  transition: background-color 0.18s var(--ease), border-color 0.18s var(--ease), color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}

[data-theme="dark"] .html-region-name {
  background: rgba(19, 21, 24, 0.9);
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.42);
}

.html-region-marker.is-hovered {
  z-index: 6;
}

.html-region-marker.is-hovered .html-region-dot {
  background: var(--accent);
  transform: scale(1.2);
}

.html-region-marker.is-hovered .html-region-name {
  border-color: var(--accent);
  color: var(--accent);
}

.html-region-marker.is-selected {
  z-index: 5;
}

.html-region-marker.is-selected .html-region-dot {
  width: 7px;
  height: 7px;
  background: var(--accent);
  border-color: #ffffff;
}

.html-region-marker.is-selected .html-region-name {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.34);
}

/* Interaktywne piny miast HTML pojawiające się po przybliżeniu (czytelne pigułki nad granicami) */
.html-city-pin {
  position: absolute;
  left: 0;
  top: 0;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: transparent;
  border: 0;
  padding: 2px;
  margin: 0;
  cursor: pointer;
  pointer-events: auto;
  font-family: inherit;
  color: var(--ink);
  white-space: nowrap;
  opacity: 0;
  z-index: 4;
  animation: pinPopHtml 0.24s var(--ease) forwards;
  transition: transform 0.16s var(--ease), opacity 0.18s var(--ease);
  -webkit-font-smoothing: auto;
}

.html-city-pin:hover {
  z-index: 10;
}

.html-city-pin.is-active {
  z-index: 12;
}

.html-city-pin.is-instant {
  animation: none;
  opacity: 1;
}

.html-city-pin.is-hidden-pin {
  display: none !important;
}

.html-pin-dot-wrap {
  position: relative;
  width: 10px;
  height: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.html-pin-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink);
  border: 1.5px solid var(--surface);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.28);
  transition: transform 0.2s var(--spring), background-color 0.2s var(--ease);
}

.html-city-pin:hover .html-pin-dot {
  transform: scale(1.25);
  background: var(--accent);
}

.html-city-pin.is-active .html-pin-dot {
  width: 9px;
  height: 9px;
  background: var(--accent);
  border-color: #ffffff;
}

.html-pin-pulse {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid var(--accent);
  background: rgba(59, 130, 246, 0.22);
  opacity: 0;
  pointer-events: none;
}

.html-city-pin.is-active .html-pin-pulse {
  animation: pulseRing 2s var(--ease) infinite;
}

.html-pin-card {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 3px 7px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(15, 23, 42, 0.12);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
  transition: background-color 0.16s var(--ease), border-color 0.16s var(--ease), color 0.16s var(--ease);
}

[data-theme="dark"] .html-pin-card {
  background: rgba(19, 21, 24, 0.92);
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
}

.html-city-pin:hover .html-pin-card {
  border-color: var(--accent);
}

.html-city-pin.is-active .html-pin-card {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.36);
}

.html-pin-name {
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.html-pin-cost {
  font-family: inherit;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  color: var(--ink-secondary);
}

.html-city-pin.is-active .html-pin-name {
  color: #ffffff;
}

.html-city-pin.is-active .html-pin-cost {
  color: rgba(255, 255, 255, 0.88);
}

/* Mniejsze pigułki Tier 2 (miasta powiatowe) — dyskretne, czytelne na każdym kolorze powiatu */
.html-city-pin.is-secondary {
  gap: 2px;
  z-index: 2;
}

.html-city-pin.is-secondary .html-pin-dot {
  width: 5px;
  height: 5px;
  background: var(--ink-secondary);
  border-width: 1px;
}

.html-city-pin.is-secondary .html-pin-card {
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.82);
  border-color: rgba(15, 23, 42, 0.08);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08);
}

[data-theme="dark"] .html-city-pin.is-secondary .html-pin-card {
  background: rgba(19, 21, 24, 0.82);
  border-color: rgba(255, 255, 255, 0.1);
}

.html-city-pin.is-secondary .html-pin-name {
  font-size: 10px;
  font-weight: 600;
  color: var(--ink-secondary);
}

.html-city-pin.is-secondary .html-pin-cost {
  display: none;
}

.html-city-pin.is-secondary:hover .html-pin-name {
  color: var(--accent);
}

/* Odwrócenie etykiety nad kropkę (np. dla Zakopanego przy dolnej granicy Polski),
   dzięki czemu kropka ZAWSZE zostaje w dokładnym punkcie geograficznym! */
.html-city-pin.is-label-top {
  flex-direction: column-reverse;
}

@keyframes pinPopHtml {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes pulseRing {
  0% {
    opacity: 0.85;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(2.9);
  }
}

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Szklany tooltip na mapie */
.map-tooltip {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  background: var(--tooltip-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #ffffff;
  padding: 10px 13px;
  border-radius: 12px;
  font-size: 0.79rem;
  min-width: 180px;
  max-width: 240px;
  white-space: normal;
  z-index: 15;
  box-shadow: var(--shadow-float);
  transition: opacity 0.16s var(--ease);
}

.tip-region {
  font-size: 0.68rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
}

.tip-city {
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 700;
  margin: 1px 0 3px;
}

.tip-val strong {
  color: #93c5fd;
  font-weight: 600;
}

.tip-hint {
  font-size: 0.71rem;
  color: #cbd5e1;
  margin-top: 4px;
}

.map-legend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  font-size: 0.74rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink-muted);
}

.legend-bar {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, #dce8f8 0%, #add0f3 50%, #7cb0eb 100%);
}

[data-theme="dark"] .legend-bar {
  background: linear-gradient(90deg, #1d2b3e 0%, #2b4a73 50%, #3d70b8 100%);
}

/* Pasek miast pod mapą */
.submap-bar {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.submap-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 9px;
}

.submap-toggle-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--accent);
  font-family: var(--sans);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.18s var(--ease), color 0.18s var(--ease);
}

.submap-toggle-btn:hover {
  background: var(--accent-soft);
}

/* Wyszukiwarka całej Polski nad mapą */
.search-wrap {
  position: relative;
  margin-bottom: 12px;
}

.search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: var(--surface-subtle);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 0.87rem;
  font-weight: 500;
  outline: none;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.search-input::placeholder {
  color: var(--ink-muted);
  font-weight: 400;
}

.search-input:focus {
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 40;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  box-shadow: var(--shadow-float);
  padding: 6px;
  max-height: 330px;
  overflow-y: auto;
}

.search-item {
  width: 100%;
  appearance: none;
  border: none;
  background: transparent;
  color: var(--ink);
  font-family: var(--sans);
  text-align: left;
  padding: 9px 11px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  transition: background 0.14s var(--ease);
}

.search-item:hover,
.search-item.is-highlighted {
  background: var(--surface-subtle);
}

.search-item-main {
  min-width: 0;
}

.search-item-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-item-meta {
  font-size: 0.74rem;
  color: var(--ink-muted);
  margin-top: 1px;
}

.search-item-cost {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.search-empty {
  padding: 12px;
  font-size: 0.82rem;
  color: var(--ink-muted);
  text-align: center;
}

.city-subtitle {
  font-size: 0.78rem;
  color: var(--ink-muted);
  margin-top: 3px;
}

/* Siatka oficjalnych danych z API (GUS / NBP / Open-Meteo) */
.api-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.api-stat-card {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
}

.api-stat-label {
  font-size: 0.72rem;
  color: var(--ink-muted);
  font-weight: 500;
}

.api-stat-value {
  font-family: var(--display);
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}

.api-stat-sub {
  font-size: 0.7rem;
  color: var(--ink-muted);
  margin-top: 1px;
}

.city-pills {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  gap: 6px;
  padding-bottom: 2px;
}

.city-pills::-webkit-scrollbar {
  display: none;
}

.city-pills.is-expanded {
  flex-wrap: wrap;
  overflow-x: visible;
}

.city-pill {
  appearance: none;
  flex: 0 0 auto;
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  color: var(--ink-secondary);
  font-family: var(--sans);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.2s var(--ease), opacity 0.2s var(--ease);
}

.city-pill:hover {
  background: var(--surface-hover);
  color: var(--ink);
  transform: translateY(-1px);
}

.city-pill.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 4px 12px -2px rgba(37, 99, 235, 0.35);
}

.city-pill .pill-cost {
  font-size: 0.72rem;
  opacity: 0.82;
  font-variant-numeric: tabular-nums;
}

/* Prawa kolumna: Kalkulator + Karta miasta (zero podskakiwania przy zmianie miasta) */
.city-panel.is-switching {
  animation: none;
}

.city-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.city-header-main {
  min-width: 0;
}

.city-header h2 {
  font-family: var(--display);
  font-size: 1.85rem;
  font-weight: 700;
  line-height: 1.15;
  margin: 2px 0 0;
  letter-spacing: -0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.city-subtitle {
  font-size: 0.78rem;
  color: var(--ink-muted);
  margin-top: 3px;
  min-height: 1.2em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Zakładki szczegółów wewnątrz prawego panelu — stabilna wysokość strony */
.detail-tabs-wrap {
  margin-top: 16px;
}

.detail-tab-panels {
  min-height: 495px;
}

.section-block.first-in-tab {
  margin-top: 14px;
  padding-top: 0;
  border-top: none;
}

/* Edytowalna kwota dochodu obok etykiety suwaka */
.salary-input-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--surface-subtle);
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  padding: 2px 8px;
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}

.salary-input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: var(--surface);
}

.salary-number-input {
  width: 68px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--display);
  font-size: 0.92rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: right;
  outline: none;
  -moz-appearance: textfield;
}

.salary-number-input::-webkit-outer-spin-button,
.salary-number-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.salary-unit {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-muted);
}

/* Wzór obliczeń pod każdą kategorią budżetu */
.breakdown-item {
  display: grid;
  gap: 2px;
  padding: 4px 0;
}

.bd-formula {
  font-size: 0.72rem;
  color: var(--ink-muted);
  padding-left: 17px;
  line-height: 1.35;
}

.bd-custom-pill {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 0 6px;
  border-radius: 999px;
  margin-left: 6px;
  vertical-align: middle;
}

/* Tryb zaawansowany — własne miesięczne kwoty */
.custom-lead {
  font-size: 0.79rem;
  color: var(--ink-muted);
  margin: 4px 0 12px;
  line-height: 1.45;
}

.custom-costs-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.custom-field {
  display: grid;
  gap: 4px;
}

.custom-field-wide {
  grid-column: 1 / -1;
}

.custom-field-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink-secondary);
}

.custom-input-box {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-subtle);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 7px 10px;
  transition: border-color 0.16s var(--ease), background-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}

.custom-input-box:focus-within {
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.custom-input-box.is-filled {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.custom-input-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--display);
  font-size: 0.92rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  outline: none;
}

.custom-input-box input::placeholder {
  color: var(--ink-muted);
  font-weight: 500;
}

.custom-input-box span {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-muted);
}

.custom-field-hint {
  font-size: 0.7rem;
  color: var(--ink-muted);
}

.county-summary-card {
  display: grid;
  gap: 10px;
}

.county-summary-box {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 12px 14px;
  font-size: 0.84rem;
  color: var(--ink-secondary);
  line-height: 1.5;
}

.county-summary-box strong {
  color: var(--ink);
}

.county-towns-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.county-town-chip {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--ink-secondary);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 2px 9px;
  border-radius: 999px;
}

.copy-btn {
  appearance: none;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink-secondary);
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 7px 13px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.18s var(--ease);
}

.copy-btn:hover {
  background: var(--surface-subtle);
  color: var(--ink);
  border-color: rgba(15, 23, 42, 0.22);
}

.kpi-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.kpi-card {
  background: var(--surface-subtle);
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 13px 14px;
  transition: background 0.28s var(--ease), border-color 0.28s var(--ease);
}

.kpi-label {
  font-size: 0.74rem;
  font-weight: 500;
  color: var(--ink-muted);
  margin-bottom: 4px;
}

.kpi-value {
  font-family: var(--display);
  font-size: 1.42rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.kpi-card.is-positive {
  background: var(--positive-soft);
  border-color: rgba(5, 150, 105, 0.18);
}

.kpi-card.is-positive .kpi-value {
  color: var(--positive);
}

.kpi-card.is-negative {
  background: var(--negative-soft);
  border-color: rgba(220, 38, 38, 0.18);
}

.kpi-card.is-negative .kpi-value {
  color: var(--negative);
}

/* Kontrolki i gładkie suwaki z wypełnionym torem */
.controls {
  display: grid;
  gap: 16px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.control-row {
  display: grid;
  gap: 7px;
}

.control-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.84rem;
}

.control-head label {
  font-weight: 600;
  color: var(--ink-secondary);
}

.control-val {
  font-family: var(--display);
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: var(--slider-track);
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--slider-thumb-bg);
  border: 2.5px solid var(--accent);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.22);
  cursor: pointer;
  transition: transform 0.18s var(--spring), box-shadow 0.18s var(--ease);
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.16);
  box-shadow: 0 0 0 6px rgba(59, 130, 246, 0.18), 0 3px 10px rgba(15, 23, 42, 0.24);
}

input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--slider-thumb-bg);
  border: 2.5px solid var(--accent);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.22);
  cursor: pointer;
  transition: transform 0.18s var(--spring), box-shadow 0.18s var(--ease);
}

.segmented.full {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  width: 100%;
}

.segmented.full button {
  padding: 8px 6px;
  font-size: 0.81rem;
}

/* Rozkład budżetu */
.section-block {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.section-block:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.section-title {
  font-family: var(--display);
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 0 0 12px;
}

.breakdown-bar {
  display: flex;
  height: 10px;
  width: 100%;
  overflow: hidden;
  border-radius: 999px;
  gap: 2px;
  margin-bottom: 13px;
}

.bar-seg {
  height: 100%;
  border-radius: 999px;
  transition: width 0.36s var(--ease), opacity 0.2s var(--ease);
}

.bar-seg:hover {
  opacity: 0.78;
}

.breakdown-list {
  display: grid;
  gap: 8px;
}

.breakdown-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.87rem;
  font-variant-numeric: tabular-nums;
}

.bd-name {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink-secondary);
}

.bd-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.bd-meta {
  display: inline-flex;
  gap: 10px;
  align-items: baseline;
}

.bd-pct {
  font-size: 0.76rem;
  color: var(--ink-muted);
}

/* Ceny jednostkowe */
.unit-prices {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.unit-prices > div {
  background: var(--surface-subtle);
  border-radius: 12px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: background 0.2s var(--ease), transform 0.2s var(--ease);
}

.unit-prices > div:hover {
  background: var(--surface-hover);
  transform: translateY(-1px);
}

.unit-prices span {
  font-size: 0.71rem;
  color: var(--ink-muted);
}

.unit-prices strong {
  font-family: var(--display);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

/* Wskaźniki 1-10 */
.scores-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px 18px;
}

.score-head {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  margin-bottom: 5px;
  color: var(--ink-secondary);
}

.score-head strong {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.score-track {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-subtle);
  overflow: hidden;
}

.score-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.38s var(--ease);
}

/* Atrakcje */
.attractions-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}

.attraction-item {
  display: grid;
  grid-template-columns: 124px 1fr;
  gap: 12px;
  padding: 11px 14px;
  background: var(--surface-subtle);
  border-radius: 12px;
  transition: transform 0.22s var(--ease), background 0.22s var(--ease);
}

.attraction-item:hover {
  transform: translateX(3px);
  background: var(--surface-hover);
}

.attr-cat {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent);
  padding-top: 2px;
}

.attr-text {
  font-size: 0.86rem;
  color: var(--ink-secondary);
}

/* Plusy i minusy */
.pros-cons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.pros-box, .cons-box {
  background: var(--surface-subtle);
  border-radius: 14px;
  padding: 13px 15px;
}

.pros-box h4, .cons-box h4 {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0 0 8px;
}

.pros-box h4 { color: var(--positive); }
.cons-box h4 { color: var(--negative); }

.pros-box ul, .cons-box ul {
  margin: 0;
  padding-left: 16px;
  font-size: 0.83rem;
  color: var(--ink-secondary);
  display: grid;
  gap: 5px;
}

/* Widok porównania 2 miast */
.compare-box {
  max-width: 840px;
  margin: 0 auto;
  animation: fadeSlideIn 0.26s var(--ease);
}

.compare-controls {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: end;
  margin-bottom: 18px;
}

.compare-controls select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 0.9rem;
  font-weight: 500;
}

.swap-btn {
  appearance: none;
  border: 1px solid var(--border-strong);
  background: var(--surface-subtle);
  color: var(--ink);
  width: 40px;
  height: 40px;
  border-radius: 11px;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.2s var(--ease), transform 0.2s var(--spring);
}

.swap-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  transform: rotate(180deg);
}

.verdict-box {
  font-family: var(--display);
  font-size: 1.32rem;
  line-height: 1.45;
  padding: 20px 22px;
  background: var(--accent-soft);
  border: 1px solid rgba(37, 99, 235, 0.16);
  border-radius: 16px;
  margin: 18px 0 22px;
}

.verdict-highlight {
  color: var(--accent);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.verdict-badge {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--ink);
  color: var(--bg);
  padding: 3px 10px;
  border-radius: 999px;
  vertical-align: middle;
  margin-left: 6px;
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.89rem;
  font-variant-numeric: tabular-nums;
}

.compare-table th, .compare-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.compare-table th {
  font-size: 0.76rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
}

.compare-table td:not(:first-child),
.compare-table th:not(:first-child) {
  text-align: right;
  font-weight: 600;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding-block: 20px;
  font-size: 0.78rem;
  color: var(--ink-muted);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.footer-links {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.footer-links a {
  color: var(--ink-secondary);
  text-decoration: none;
  font-weight: 500;
}

.footer-links a:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* Sekcja wiedzy SEO / GEO / AEO (pod kalkulatorem) */
.seo-knowledge {
  margin-top: 28px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
}

.seo-knowledge > *,
.seo-directory-card > *,
.seo-regions-grid > *,
.faq-list > *,
.panel {
  min-width: 0;
}

.seo-h2 {
  font-family: var(--display);
  font-size: 1.38rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin: 4px 0 10px;
  color: var(--ink);
}

.seo-h3 {
  font-family: var(--display);
  font-size: 1.02rem;
  font-weight: 700;
  margin: 0;
  color: var(--ink);
}

.aeo-direct-answer {
  font-size: 0.94rem;
  line-height: 1.65;
  color: var(--ink-secondary);
  margin: 0 0 20px;
  max-width: 92ch;
}

.aeo-direct-answer strong {
  color: var(--ink);
}

.seo-table-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.seo-table-hint {
  font-size: 0.76rem;
  color: var(--ink-muted);
}

.seo-table-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: 14px;
}

.seo-capitals-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  min-width: 640px;
}

.seo-capitals-table th,
.seo-capitals-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: right;
  white-space: nowrap;
}

.seo-capitals-table th:first-child,
.seo-capitals-table td:first-child {
  text-align: left;
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--surface);
  box-shadow: 1px 0 0 var(--border);
}

.seo-capitals-table th:first-child {
  background: var(--surface-subtle);
  z-index: 2;
}

.seo-capitals-table tbody tr:hover td:first-child {
  background: var(--accent-soft);
}

.seo-capitals-table th {
  font-size: 0.73rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ink-muted);
  background: var(--surface-subtle);
}

.seo-capitals-table tbody tr {
  cursor: pointer;
  transition: background-color 0.14s var(--ease);
}

.seo-capitals-table tbody tr:last-child td {
  border-bottom: 0;
}

.seo-capitals-table tbody tr:hover {
  background: var(--accent-soft);
}

.seo-capitals-table tbody tr:hover td:first-child strong {
  color: var(--accent);
}

.faq-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.faq-item {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 12px 15px;
  transition: border-color 0.16s var(--ease);
}

.faq-item[open] {
  border-color: var(--border-strong);
  background: var(--surface);
}

.faq-item summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: '+';
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--ink-muted);
  flex-shrink: 0;
  transition: transform 0.18s var(--ease);
}

.faq-item[open] summary::after {
  content: '−';
  color: var(--accent);
}

.faq-item summary h3 {
  font-family: var(--display);
  font-size: 0.94rem;
  font-weight: 700;
  margin: 0;
  color: var(--ink);
  line-height: 1.35;
}

.faq-item p {
  margin: 10px 0 2px;
  font-size: 0.86rem;
  line-height: 1.6;
  color: var(--ink-secondary);
}

/* Okruszki (breadcrumbs) i katalog linków wewnętrznych SEO */
.seo-breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--ink-muted);
  margin-bottom: 2px;
}

.seo-breadcrumbs a {
  color: var(--ink-secondary);
  text-decoration: none;
  font-weight: 500;
}

.seo-breadcrumbs a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.seo-city-link {
  color: inherit;
  text-decoration: none;
}

.seo-city-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

.seo-directory-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.seo-links-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.seo-link-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--ink-secondary);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  padding: 5px 11px;
  border-radius: 999px;
  text-decoration: none;
  transition: border-color 0.15s var(--ease), color 0.15s var(--ease), background-color 0.15s var(--ease);
}

.seo-link-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.seo-regions-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 8px;
}

.seo-regions-col {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  min-width: 0;
}

.seo-region-details {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 13px;
}

.seo-region-details summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
}

.seo-region-details summary::-webkit-details-marker {
  display: none;
}

.seo-region-details summary::after {
  content: '+';
  color: var(--ink-muted);
  font-weight: 700;
}

.seo-region-details[open] summary::after {
  content: '−';
  color: var(--accent);
}

.seo-region-links {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.seo-region-links a {
  font-size: 0.76rem;
  color: var(--ink-secondary);
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 3px 8px;
  border-radius: 8px;
}

.seo-region-links a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

@media (max-width: 780px) {
  .seo-regions-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1060px) {
  .atlas-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }
  .map-panel {
    position: static;
  }
  .unit-prices {
    grid-template-columns: repeat(3, 1fr);
  }
  .pros-cons, .scores-grid {
    grid-template-columns: 1fr;
  }
  .attraction-item {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

@media (max-width: 640px) {
  .wrap {
    padding-inline: 14px;
  }

  .masthead-inner {
    position: relative;
    padding-block: 10px;
    gap: 8px;
    flex-wrap: wrap;
  }

  .nav-left {
    width: 100%;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px;
  }

  .nav-divider {
    display: none;
  }

  .brand-title {
    font-size: 1.08rem;
  }

  .header-actions {
    position: absolute;
    right: 14px;
    top: 12px;
    gap: 8px;
  }

  .header-actions .brand-tag {
    display: none;
  }

  .primary-nav {
    width: 100%;
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 4px;
    background: var(--tabs-bg);
    padding: 3px 20px 3px 3px;
    border-radius: 12px;
    -webkit-mask-image: linear-gradient(90deg, #000 0%, #000 88%, transparent 100%);
    mask-image: linear-gradient(90deg, #000 0%, #000 88%, transparent 100%);
  }

  .nav-link {
    justify-content: center;
    min-height: 36px;
    padding: 6px 10px;
    font-size: 0.79rem;
    border-radius: 9px;
  }

  .main-content {
    padding-top: 14px;
    padding-bottom: 40px;
  }

  .hero-strip {
    gap: 8px;
    margin-bottom: 12px;
  }

  .page-h1 {
    font-size: 1.12rem;
  }

  .page-lead {
    font-size: 0.78rem;
  }

  .trust-strip {
    padding: 9px 11px;
    gap: 8px;
    border-radius: 13px;
  }

  .trust-lead {
    display: none;
  }

  .trust-chip {
    font-size: 0.7rem;
    padding: 2px 7px;
  }

  .trust-right {
    width: 100%;
    margin-left: 0;
    justify-content: space-between;
    padding-top: 6px;
    border-top: 1px solid var(--border);
  }

  .trust-link-btn {
    min-height: 34px;
    padding: 6px 12px;
  }

  .sources-dialog-inner {
    padding: 16px 16px 20px;
  }

  .sources-dialog-head h2 {
    font-size: 1.15rem;
  }

  .panel,
  .map-panel {
    padding: 14px;
    border-radius: 16px;
  }

  .map-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    margin-bottom: 10px;
  }

  .map-status {
    justify-content: space-between;
    min-height: auto;
  }

  .map-toolbar .segmented {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    width: 100%;
  }

  .map-toolbar .segmented button {
    padding: 6px 4px;
    font-size: 0.76rem;
    text-align: center;
  }

  .map-wrap {
    padding: 4px;
    border-radius: 12px;
  }

  /* Kompaktowe etykiety stolic województw widoczne też na mobilce */
  .html-region-marker {
    gap: 1.5px;
  }

  .html-region-name {
    font-size: 9px;
    padding: 1px 4px;
    border-radius: 5px;
    line-height: 1.15;
  }

  .html-region-dot {
    width: 4.5px;
    height: 4.5px;
    border-width: 1px;
  }

  .html-pin-name {
    font-size: 11px;
  }

  .html-pin-cost {
    font-size: 9.5px;
  }

  /* Pigułki miast na mobile: jedna zgrabna przewijana linia zamiast 5 rzędów zasłaniających ekran */
  .submap-bar {
    margin-top: 10px;
    padding-top: 10px;
  }

  .city-pills {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
    gap: 6px;
  }

  .city-pills.is-expanded {
    flex-wrap: wrap;
    overflow-x: visible;
  }

  .city-pills::-webkit-scrollbar {
    display: none;
  }

  .city-pill {
    flex: 0 0 auto;
    min-height: 36px;
    font-size: 0.78rem;
    padding: 7px 12px;
  }

  .city-header {
    margin-bottom: 14px;
    align-items: flex-start;
  }

  .copy-btn {
    min-height: 38px;
    padding: 8px 14px;
  }

  .city-header h2 {
    font-size: 1.38rem;
    white-space: normal;
    word-break: break-word;
  }

  .city-subtitle {
    white-space: normal;
  }

  .detail-tab-panels {
    min-height: 240px;
  }

  .detail-tabs.segmented.full {
    grid-template-columns: repeat(2, 1fr);
  }

  .custom-costs-grid {
    grid-template-columns: 1fr;
  }

  .custom-input-box input,
  .salary-number-input {
    font-size: 16px;
  }

  .search-input {
    font-size: 16px;
    padding: 10px 12px 10px 36px;
  }

  .api-stats-grid {
    gap: 6px;
  }

  .api-stat-card {
    padding: 9px 10px;
  }

  .api-stat-value {
    font-size: 0.94rem;
  }

  .compare-controls select {
    font-size: 16px;
  }

  /* Kompaktowy 3-kolumnowy pasek KPI mieszczący się w jednym rzędzie na telefonie */
  .kpi-strip {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-bottom: 16px;
  }

  .kpi-card {
    padding: 9px 8px;
    border-radius: 11px;
  }

  .kpi-label {
    font-size: 0.66rem;
    line-height: 1.2;
  }

  .kpi-value {
    font-size: 1.05rem;
  }

  /* Przełącznik 4 opcji (Mieszkanie) łamie się czysto w 2x2 na wąskim ekranie */
  .segmented.full {
    grid-auto-flow: row;
    grid-template-columns: repeat(2, 1fr);
  }

  .segmented.full[data-cols="3"] {
    grid-template-columns: repeat(3, 1fr);
  }

  .segmented.full button {
    min-height: 40px;
    padding: 9px 8px;
    font-size: 0.8rem;
  }

  .unit-prices {
    grid-template-columns: repeat(2, 1fr);
  }

  .compare-controls {
    grid-template-columns: 1fr;
  }

  .swap-btn {
    width: 100%;
    height: 36px;
  }

  .verdict-box {
    font-size: 1.1rem;
    padding: 14px;
  }

  .compare-table {
    font-size: 0.8rem;
  }

  .compare-table th, .compare-table td {
    padding: 8px 6px;
  }

  .seo-knowledge {
    margin-top: 18px;
    gap: 14px;
  }

  .seo-h2 {
    font-size: 1.15rem;
    line-height: 1.25;
  }

  .seo-h3 {
    font-size: 0.94rem;
  }

  .aeo-direct-answer {
    font-size: 0.85rem;
    line-height: 1.55;
    margin-bottom: 14px;
  }

  .seo-capitals-table {
    font-size: 0.78rem;
    min-width: 560px;
  }

  .seo-capitals-table th,
  .seo-capitals-table td {
    padding: 8px 9px;
  }

  .seo-capitals-table th:first-child,
  .seo-capitals-table td:first-child {
    white-space: normal;
    max-width: 155px;
    line-height: 1.25;
  }

  .faq-item {
    padding: 10px 12px;
  }

  .faq-item summary h3 {
    font-size: 0.86rem;
  }

  .faq-item p {
    font-size: 0.82rem;
  }

  .site-footer {
    font-size: 0.73rem;
    padding-top: 16px;
    padding-bottom: 24px;
  }
}

/* ==========================================================================
   Podstrona E-E-A-T: /o-projekcie/
   ========================================================================== */
.about-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.about-card {
  display: grid;
  gap: 10px;
  align-content: start;
}

.about-card p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.62;
  color: var(--ink-secondary);
}

.about-card strong {
  color: var(--ink);
}

.about-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
  font-size: 0.88rem;
  line-height: 1.58;
  color: var(--ink-secondary);
}

.about-list code {
  font-size: 0.82rem;
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  color: var(--ink);
}

.about-cta-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 6px;
}

.about-cta-primary,
.about-cta-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 15px;
  border-radius: 10px;
  font-size: 0.86rem;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.14s var(--ease), background-color 0.16s var(--ease), border-color 0.16s var(--ease);
}

.about-cta-primary {
  background: var(--accent);
  color: #ffffff;
  border: 1px solid var(--accent);
}

.about-cta-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.about-cta-secondary {
  background: var(--surface-subtle);
  color: var(--ink);
  border: 1px solid var(--border);
}

.about-cta-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

@media (max-width: 820px) {
  .about-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
