:root{
  --ink:#0e0e0f;
  --ink-2:#1b1b1d;
  --ink-3:#2b2b2e;
  --paper:#faf7f0;
  --paper-2:#f2ecdd;
  --paper-3:#e8e0cb;
  --line:rgba(14,14,15,.12);
  --line-strong:rgba(14,14,15,.28);
  --muted:#6b6458;
  --muted-2:#8a8378;
  --yellow:#ffd400;
  --yellow-deep:#f4c100;
  --yellow-soft:#fff4a8;
  --red:#e5322a;

  --c1:#79BC6A; --c2:#BBCF4C; --c3:#EEC020; --c4:#F29305; --c5:#E8416F; --c0:#c6beac;

  --radius-sm:10px; --radius:16px; --radius-lg:22px;
  --shadow-1: 0 1px 0 rgba(14,14,15,.04), 0 2px 6px rgba(14,14,15,.05);
  --shadow-2: 0 4px 18px rgba(14,14,15,.08);
}
*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
  font-family:'Manrope',system-ui,sans-serif;
  background:var(--paper); color:var(--ink);
  font-size:15px; line-height:1.45;
  -webkit-font-smoothing:antialiased;
}
body[data-theme="dark"]{
  --ink:#f6f1e4; --ink-2:#e9e3d3; --ink-3:#cfc9b9;
  --paper:#0f0f10; --paper-2:#17171a; --paper-3:#20202a;
  --line:rgba(246,241,228,.10); --line-strong:rgba(246,241,228,.26);
  --muted:#a9a294; --muted-2:#847d70;
}
img{max-width:100%;display:block}
a{color:inherit;text-decoration:none}
button{font:inherit;color:inherit;cursor:pointer;border:0;background:transparent}
code{font-family:ui-monospace,'SF Mono',Menlo,monospace; font-size:.92em; background:var(--paper-2); padding:1px 6px; border-radius:6px;}

.wrap{ max-width:1280px; margin:0 auto; padding:0 28px; }
@media (max-width:720px){ .wrap{ padding:0 18px; } }

/* NAV */
.nav{
  position:sticky; top:0; z-index:30;
  background:color-mix(in oklab, var(--paper) 82%, transparent);
  backdrop-filter: blur(10px);
  border-bottom:1px solid var(--line);
}
.nav-row{ display:flex; align-items:center; gap:22px; padding:14px 0; }
.brand{
  display:inline-flex; align-items:center; gap:8px;
  font-family:'Unbounded',sans-serif; font-weight:800; font-size:14px;
  letter-spacing:.02em; line-height:1;
}
.brand .logo-mark{ height:34px; width:34px; display:inline-block; }
.brand .wordmark{ display:inline-grid; gap:0; }
.nav-links{ display:flex; gap:4px; margin-left:10px; }
.nav-links a{
  padding:8px 14px; border-radius:999px;
  font-weight:600; font-size:14px; color:var(--ink-2);
  transition: background .15s;
}
.nav-links a:hover{ background:var(--paper-2); }
.nav-links a.active{ background:var(--ink); color:var(--paper); }
.nav-right{ margin-left:auto; display:flex; gap:8px; align-items:center; }
.icon-btn{
  width:38px; height:38px; border-radius:12px;
  background:var(--paper-2); display:inline-flex; align-items:center; justify-content:center;
  color:var(--ink-2);
}
.icon-btn:hover{ background:var(--paper-3); }
.login-btn{
  padding:9px 16px; border-radius:12px; background:var(--ink); color:var(--paper);
  font-weight:700; font-size:14px; display:inline-flex; align-items:center; gap:8px;
}

/* BREADCRUMBS */
.crumbs{ padding:22px 0 6px; font-size:13px; color:var(--muted); display:flex; gap:8px; align-items:center; }
.crumbs a:hover{ color:var(--ink); }
.crumbs .sep{ opacity:.4; }
.crumbs b{ color:var(--ink); font-weight:600; }

/* HERO */
.hero{
  margin: 18px 0 0;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 40px 44px;
  position: relative; overflow: hidden;
  display:grid; grid-template-columns: 1.25fr 1fr; gap: 36px; align-items: stretch;
}
@media (max-width: 960px){ .hero{ grid-template-columns:1fr; padding:28px 24px; gap:24px; } }
.hero .eyebrow{
  font-size:11px; font-weight:800; letter-spacing:.12em; text-transform:uppercase;
  color:var(--muted);
  display:inline-flex; align-items:center; gap:10px;
  margin-bottom: 14px;
}
.hero .eyebrow .live{
  width:8px; height:8px; border-radius:50%; background: var(--c2);
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--c2) 30%, transparent);
  animation: pulse 1.8s ease-in-out infinite;
}
.hero .eyebrow .live.l1{ background: var(--c1); box-shadow: 0 0 0 4px color-mix(in oklab, var(--c1) 30%, transparent); }
.hero .eyebrow .live.l2{ background: var(--c2); box-shadow: 0 0 0 4px color-mix(in oklab, var(--c2) 30%, transparent); }
.hero .eyebrow .live.l3{ background: var(--c3); box-shadow: 0 0 0 4px color-mix(in oklab, var(--c3) 30%, transparent); }
.hero .eyebrow .live.l4{ background: var(--c4); box-shadow: 0 0 0 4px color-mix(in oklab, var(--c4) 30%, transparent); }
.hero .eyebrow .live.l5{ background: var(--c5); box-shadow: 0 0 0 4px color-mix(in oklab, var(--c5) 30%, transparent); }
@keyframes pulse{ 50%{ opacity:.5; transform:scale(.7); } }

.hero-left h1{
  font-family:'Unbounded', sans-serif; font-weight:800;
  font-size: clamp(40px, 6.2vw, 84px);
  line-height:.92; letter-spacing:-.025em;
  margin: 0 0 8px; text-wrap: balance;
}
.hero .badge-big{
  display:inline-flex; align-items:center; gap:16px;
  padding: 10px 22px 10px 14px;
  background: var(--c2); color: var(--ink);
  border-radius: 999px;
  font-family:'Unbounded', sans-serif; font-weight:700;
  font-size: clamp(22px, 3vw, 36px);
  letter-spacing:-.01em;
  box-shadow: 0 2px 0 rgba(0,0,0,.08);
  margin: 8px 0 18px;
}
.hero .badge-big.l1{ background: var(--c1); }
.hero .badge-big.l2{ background: var(--c2); }
.hero .badge-big.l3{ background: var(--c3); }
.hero .badge-big.l4{ background: var(--c4); }
.hero .badge-big.l5{ background: var(--c5); color: #fff; }
.hero .badge-big.nd{ background: var(--paper-3); color: var(--muted); }
.hero .badge-big .num{
  font-size: clamp(48px, 7.5vw, 88px);
  font-weight: 800; line-height:.9;
  background: var(--ink); color: var(--paper);
  border-radius: 18px;
  padding: 6px 18px 4px;
  letter-spacing:-.03em;
}
.hero .badge-big .label-stack{ line-height: 1.05; display:flex; flex-direction:column; }
.hero .badge-big .label-stack small{
  font-family:'Manrope', sans-serif; font-weight:600;
  font-size:13px; color: var(--ink-2); opacity:.75; margin-top:3px;
  letter-spacing:0;
}
.hero .badge-big.l5 .label-stack small{ color:#fff; opacity:.85; }

.hero-left p.lead{ font-size: 17px; color: var(--ink-2); margin: 0 0 20px; max-width: 560px; }
.hero-left p.lead b{ font-weight: 700; color: var(--ink); }

.hero-meta{ display:flex; gap:8px; flex-wrap: wrap; margin-top: 4px; }
.chip{
  display:inline-flex; align-items:center; gap:6px;
  padding:6px 12px; border-radius:999px;
  background: var(--paper); border:1px solid var(--line);
  font-size:12px; font-weight:600; color: var(--ink-2);
}
.chip a{ text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.chip.dark{ background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip .d{ width:7px; height:7px; border-radius:50%; background: var(--c2); }

.hero-right{ display:flex; flex-direction:column; gap:16px; }
.gauge-card, .poll-card{
  background: var(--paper); border:1px solid var(--line);
  border-radius: 18px; padding: 18px 20px;
}
.gauge-card .g-head{ display:flex; justify-content:space-between; align-items:baseline; margin-bottom: 14px; }
.gauge-card h4, .poll-card h4{
  font-family:'Unbounded'; font-weight:600; font-size:14px; margin:0;
  letter-spacing:.02em;
}
.gauge-card .g-val{ font-family:'Unbounded'; font-weight:700; font-size:14px; }
.gauge-bar{
  position:relative; height: 14px; border-radius: 8px; overflow: visible;
  background: linear-gradient(to right,
    var(--c1) 0%, var(--c1) 25%,
    var(--c2) 25%, var(--c2) 50%,
    var(--c3) 50%, var(--c3) 75%,
    var(--c4) 75%, var(--c4) 90%,
    var(--c5) 90%, var(--c5) 100%);
}
.gauge-bar .needle{
  position:absolute; top:-6px; bottom:-6px;
  width: 4px; background: var(--ink); border-radius: 2px;
  transform: translateX(-50%);
  transition: left .4s ease;
}
.gauge-bar .needle::before{
  content:""; position:absolute; top:-6px; left:50%; transform:translateX(-50%);
  width:0;height:0;border-left:6px solid transparent;border-right:6px solid transparent;border-top:6px solid var(--ink);
}
.gauge-scale{
  display:flex; justify-content:space-between;
  font-size:11px; font-weight:700; color: var(--muted); letter-spacing:.04em;
  margin-top:10px;
}
.gauge-scale span{ width: 20%; text-align: center; }
.gauge-ends{
  display:flex; justify-content:space-between;
  font-size:10px; color: var(--muted-2); text-transform:uppercase; letter-spacing:.1em;
  margin-top: 4px;
}

.poll-card h4{
  margin: 0 0 14px;
  display:flex; justify-content:space-between; align-items:baseline;
}
.poll-card h4 small{ font-family:'Manrope'; font-weight:600; font-size:11px; color:var(--muted); letter-spacing:.04em; text-transform:uppercase; }
.poll-grid{ display:grid; grid-template-columns: repeat(4,1fr); gap: 8px; }
@media (max-width:560px){ .poll-grid{ grid-template-columns: repeat(2,1fr); } }
.poll{
  border:1px solid var(--line); border-radius:12px;
  padding: 10px 12px; position:relative; background: var(--paper);
  display:flex; flex-direction:column; gap:2px;
}
.poll .nm{ font-size:11px; font-weight:700; color:var(--muted); text-transform:uppercase; letter-spacing:.06em; }
.poll .v{ font-family:'Unbounded'; font-weight:700; font-size:20px; letter-spacing:-.01em; line-height:1.1; }
.poll .u{ font-size:10px; color:var(--muted); }
.poll .dot{ position:absolute; top:10px; right:10px; width:8px; height:8px; border-radius:50%; }
.poll.l1 .dot{ background: var(--c1); }
.poll.l2 .dot{ background: var(--c2); }
.poll.l3 .dot{ background: var(--c3); }
.poll.l4 .dot{ background: var(--c4); }
.poll.l5 .dot{ background: var(--c5); }
.poll.none{ opacity:.55; }
.poll.none .v{ font-size:12px; font-weight:600; color:var(--muted); font-family:'Manrope'; }

/* ACTIONS */
.actions-wrap{ margin-top: 28px; }
.sec-head{
  display:flex; align-items:baseline; gap:16px; justify-content:space-between;
  margin: 0 0 16px; flex-wrap: wrap;
}
.sec-head h2{
  font-family:'Unbounded'; font-weight:700; font-size:28px; letter-spacing:-.01em; margin:0;
}
.sec-head h2 em{ font-style:normal; color: var(--muted); font-weight:500; }
.sec-head .more{ font-weight:700; font-size:13px; color: var(--ink); }
.sec-head .more:hover{ text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 2px; }

.actions{ display:grid; grid-template-columns: repeat(4, 1fr); gap:14px; }
@media (max-width:900px){ .actions{ grid-template-columns: repeat(2, 1fr); } }
@media (max-width:520px){ .actions{ grid-template-columns: 1fr; } }
.act{
  background: var(--paper); border:1px solid var(--line);
  border-radius: 18px; padding: 18px;
  display:flex; gap:14px; align-items:flex-start;
  transition: transform .15s, border-color .15s;
  position:relative; overflow:hidden;
}
.act:hover{ transform: translateY(-2px); border-color: var(--line-strong); }
.act .ico{
  width:44px; height:44px; border-radius:12px;
  display:inline-flex; align-items:center; justify-content:center;
  flex-shrink:0; background: var(--paper-2);
}
.act.ok .ico{ background: color-mix(in oklab, var(--c1) 28%, var(--paper)); }
.act.warn .ico{ background: color-mix(in oklab, var(--c3) 32%, var(--paper)); }
.act.bad  .ico{ background: color-mix(in oklab, var(--c4) 30%, var(--paper)); color: #fff; }
.act.bad  .ico svg{ stroke: #b25500; }
.act h4{ font-family:'Unbounded'; font-weight:600; font-size:15px; margin:0 0 4px; letter-spacing:.01em; }
.act p{ font-size:12px; color: var(--muted); margin:0; line-height:1.45; }
.act .v{
  font-family:'Unbounded'; font-weight:700; font-size:13px;
  margin-top: 6px; display:inline-block;
  padding: 2px 8px; border-radius: 6px;
  background: var(--paper-2); color: var(--ink-2);
}
.act.ok .v{ background: color-mix(in oklab, var(--c1) 24%, var(--paper)); color:#2a7b3a; }
.act.warn .v{ background: color-mix(in oklab, var(--c3) 30%, var(--paper)); color:#b58400; }
.act.bad .v{ background: color-mix(in oklab, var(--c4) 30%, var(--paper)); color:#c4640a; }

/* RANKING */
.ranking-wrap{ margin-top: 52px; }
.rank-toolbar{
  display:flex; align-items:center; gap:12px; flex-wrap: wrap;
  margin-bottom: 16px; padding: 12px 16px;
  background: var(--paper-2); border-radius: 14px;
}
.rank-toolbar .grp, .sec-head .grp, .compare-wrap .grp{
  display:flex; gap:4px; background: var(--paper); border:1px solid var(--line);
  border-radius: 10px; padding: 3px;
}
.rank-toolbar .grp button, .sec-head .grp button, .compare-wrap .grp button{
  padding: 6px 12px; border-radius: 8px;
  font-size: 12px; font-weight: 700; color: var(--muted);
}
.rank-toolbar .grp button.on, .sec-head .grp button.on, .compare-wrap .grp button.on{ background: var(--ink); color: var(--paper); }
.rank-toolbar .spacer{ flex: 1; }
.rank-toolbar .last-upd{ font-size: 12px; color: var(--muted); display:inline-flex; align-items:center; gap:6px; }
.rank-toolbar .last-upd .d{ width:6px; height:6px; border-radius:50%; background: var(--c2); animation: pulse 1.8s ease-in-out infinite; }

.rank-table{
  background: var(--paper); border:1px solid var(--line);
  border-radius: 18px; overflow: hidden;
}
.rank-expand-wrap{
  display: flex; justify-content: center;
  margin-top: 14px;
}
.rank-expand{
  background: var(--paper); border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 10px 22px;
  font: inherit; font-weight: 700; font-size: 13px;
  color: var(--ink); letter-spacing: -.005em;
  cursor: pointer;
  transition: background .12s, border-color .12s, transform .08s;
}
.rank-expand:hover{ background: var(--paper-2); border-color: var(--ink); }
.rank-expand:active{ transform: translateY(1px); }
.rank-expand small{
  font-weight: 500; color: var(--muted); margin-left: 4px;
  font-size: 12px;
}
/* Станція живa, але вибрана метрика не доступна (Oizom + no_ug / pm1) */
.rank-row.no-metric{ opacity: .7; }
.rank-row.no-metric .caqi-pill.nd{
  background: var(--paper-2); color: var(--muted);
  font-size: 18px;
}
.rank-row{
  display:grid;
  grid-template-columns: 44px 72px 1.7fr 120px 1.4fr 110px;
  gap: 18px; padding: 18px 22px; align-items: center;
  border-bottom: 1px solid var(--line);
  transition: background .12s;
  text-decoration:none; color:inherit;
}
.rank-row:last-child{ border-bottom: 0; }
.rank-row:hover:not(.head){ background: var(--paper-2); }
.rank-row.head{
  background: var(--paper-2);
  padding: 10px 22px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted);
}
.rank-row.highlight{
  background: color-mix(in oklab, var(--yellow) 14%, var(--paper)); position: relative;
}
.rank-row.highlight::before{
  content:""; position:absolute; left:0; top:0; bottom:0;
  width: 4px; background: var(--yellow-deep);
}
.rank-row.stale{ opacity:.55; }
.rank-row .rk{ font-family:'Unbounded'; font-weight:700; font-size: 20px; color: var(--muted); letter-spacing: -.02em; }
.rank-row .caqi-pill{
  width: 56px; height: 56px; border-radius: 16px;
  display:inline-flex; align-items:center; justify-content:center;
  font-family:'Unbounded'; font-weight: 800; font-size: 22px;
  color: var(--ink); letter-spacing: -.02em;
}
.rank-row .caqi-pill.l1{ background: var(--c1); }
.rank-row .caqi-pill.l2{ background: var(--c2); }
.rank-row .caqi-pill.l3{ background: var(--c3); }
.rank-row .caqi-pill.l4{ background: var(--c4); }
.rank-row .caqi-pill.l5{ background: var(--c5); color: white; }
.rank-row .caqi-pill.nd{ background: var(--paper-3); color: var(--muted); }

.rank-row .st-name{
  font-family:'Unbounded'; font-weight:600; font-size: 17px; line-height: 1.2;
  letter-spacing:-.005em;
}
.rank-row .st-name .tag-you{
  display:inline-block; font-family:'Manrope'; font-size: 10px; font-weight:800;
  text-transform: uppercase; letter-spacing:.08em;
  background: var(--yellow); color: var(--ink);
  padding: 2px 7px; border-radius: 6px; margin-left: 8px;
  vertical-align: middle;
}
.rank-row .st-name small{
  display:block; font-family:'Manrope'; font-weight:500; font-size: 12px;
  color: var(--muted); margin-top: 3px; letter-spacing: 0;
}
.rank-row .status-lbl{ font-weight: 700; font-size: 13px; }
.rank-row .status-lbl.l1{ color: #2a7b3a; }
.rank-row .status-lbl.l2{ color: #6d7d26; }
.rank-row .status-lbl.l3{ color: #b58400; }
.rank-row .status-lbl.l4{ color: #c4640a; }
.rank-row .status-lbl.l5{ color: var(--red); }
.rank-row .status-lbl .ago{ display:block; font-weight:500; font-size: 11px; color: var(--muted); margin-top: 2px; }

/* Pollutant profile micro-bars (replaces sparkline — practical data we always have) */
.profile{ display:flex; gap: 8px; align-items:flex-end; height: 40px; padding-bottom: 14px; }
.profile .bar{
  flex: 1; max-width: 16px; min-width: 8px;
  height: 100%;
  border-radius: 3px 3px 0 0;
  background: color-mix(in oklab, var(--paper-3) 60%, transparent);
  position: relative;
  display:flex; align-items:flex-end; justify-content:center;
}
.profile .bar .fill{
  width: 100%; min-height: 2px; border-radius: 3px 3px 0 0;
  background: var(--c2); transition: height .3s;
}
.profile .bar .fill.l1{ background: var(--c1); }
.profile .bar .fill.l2{ background: var(--c2); }
.profile .bar .fill.l3{ background: var(--c3); }
.profile .bar .fill.l4{ background: var(--c4); }
.profile .bar .fill.l5{ background: var(--c5); }
.profile .bar .lb{
  position:absolute; bottom:-14px; font-size:9px; font-weight:700;
  color: var(--muted); letter-spacing:.04em;
}

.rank-row .arrow{
  text-align: right;
  font-weight: 700; font-size: 13px; color: var(--ink);
  display:inline-flex; align-items:center; gap:4px; justify-content:flex-end;
}
.rank-row .arrow svg{ width:14px; height:14px; transition: transform .15s; }
.rank-row:hover .arrow svg{ transform: translateX(2px); }

@media (max-width: 900px){
  .rank-row{
    grid-template-columns: 32px 52px 1fr auto;
    padding: 14px 16px; gap: 12px;
  }
  .rank-row .profile, .rank-row .arrow{ display:none; }
  .rank-row.head span:nth-child(5), .rank-row.head span:nth-child(6){ display:none; }
  .rank-row .st-name{ font-size: 15px; }
  .rank-row .caqi-pill{ width:48px; height:48px; font-size:18px; border-radius:12px; }
}

/* MAP */
.map-wrap{ margin-top: 52px; }
.map-card{
  background: var(--paper); border:1px solid var(--line);
  border-radius: 24px; overflow: hidden;
  display: grid; grid-template-columns: 1.6fr 1fr; min-height: 560px;
}
@media (max-width: 980px){ .map-card{ grid-template-columns: 1fr; } }

.map-canvas{
  position: relative; min-height: 560px; overflow: hidden;
  background: var(--paper-2);
}
#map-leaflet{ position: absolute; inset: 0; z-index: 0; }

/* Leaflet marker — використовуємо divIcon */
.station-marker{
  width: 44px; height: 44px; border-radius: 14px;
  display:flex; align-items:center; justify-content:center;
  font-family:'Unbounded'; font-weight: 800; font-size: 16px;
  color: var(--ink);
  box-shadow: 0 4px 12px rgba(0,0,0,.22), 0 0 0 3px #fff;
  transition: transform .15s;
  cursor: pointer;
  background: var(--c2);
}
.station-marker.l1{ background: var(--c1); }
.station-marker.l2{ background: var(--c2); }
.station-marker.l3{ background: var(--c3); }
.station-marker.l4{ background: var(--c4); }
.station-marker.l5{ background: var(--c5); color: #fff; }
.station-marker.nd{ background: var(--paper-3); color: var(--muted); }
.station-marker:hover{ transform: scale(1.1); }
.station-marker.active{ box-shadow: 0 6px 18px rgba(0,0,0,.3), 0 0 0 4px var(--ink); transform: scale(1.12); }

/* Громадські сенсори Oizom — менші, пунктирна рамка, зменшена непрозорість */
.station-marker.citizen{
  width: 28px; height: 28px; border-radius: 10px;
  font-size: 11px;
  box-shadow: 0 2px 6px rgba(0,0,0,.18), 0 0 0 2px #fff;
  border: 1px dashed rgba(14,14,15,.35);
  opacity: .92;
}
.station-marker.citizen.l5{ color: #fff; }
.map-toolbar-sep{
  width: 1px; height: 16px; background: var(--line);
  display: inline-block; margin: 0 4px; align-self: center;
}
.map-toolbar button[data-toggle="citizens"]{
  padding-left: 10px; padding-right: 10px;
  font-size: 11px;
}

/* user location marker */
.me-marker{
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--red); border: 3px solid #fff;
  box-shadow: 0 0 0 3px var(--red), 0 0 0 12px color-mix(in oklab, var(--red) 20%, transparent);
  animation: meAnim 2s ease-in-out infinite;
}
@keyframes meAnim{ 50%{ box-shadow: 0 0 0 3px var(--red), 0 0 0 18px color-mix(in oklab, var(--red) 8%, transparent); } }

/* Leaflet overrides */
.leaflet-container{ font-family:'Manrope', sans-serif; font-size: 13px; background: var(--paper-2); }
.leaflet-popup-content-wrapper{ border-radius: 12px; box-shadow: 0 4px 16px rgba(0,0,0,.14); padding: 0; }
.leaflet-popup-content{ margin: 12px 14px; font-size: 13px; line-height: 1.4; }
.leaflet-popup-content b{ font-family:'Unbounded'; font-weight: 700; font-size: 14px; }
.leaflet-popup-content .pop-caqi{ display:inline-block; padding: 2px 8px; border-radius: 6px; font-family:'Unbounded'; font-weight: 700; margin-right: 6px; }
.leaflet-popup-content .pop-caqi.l1{ background: var(--c1); }
.leaflet-popup-content .pop-caqi.l2{ background: var(--c2); }
.leaflet-popup-content .pop-caqi.l3{ background: var(--c3); }
.leaflet-popup-content .pop-caqi.l4{ background: var(--c4); }
.leaflet-popup-content .pop-caqi.l5{ background: var(--c5); color:#fff; }
.leaflet-popup-content .pop-caqi.nd{ background: var(--paper-3); color: var(--muted); }
.leaflet-control-attribution{ font-size: 10px; background: rgba(250,247,240,.9) !important; }
body[data-theme="dark"] .leaflet-control-attribution{ background: rgba(15,15,16,.9) !important; color: var(--muted); }

/* heat mode: hide markers, show CSS blobs */
.map-canvas.mode-heat .station-marker{ opacity: 0; pointer-events: none; }

.map-controls{
  position:absolute; top: 16px; right: 16px;
  display:flex; flex-direction:column; gap:6px; z-index: 4;
}
.map-controls .c{
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--paper); border:1px solid var(--line);
  box-shadow: 0 2px 6px rgba(0,0,0,.06);
  display:flex; align-items:center; justify-content:center;
  font-family:'Unbounded'; font-weight:700; font-size: 18px; color: var(--ink);
}
.map-controls .c:hover{ background: var(--paper-2); }

.map-toolbar{
  position:absolute; top: 16px; left: 16px;
  display:flex; gap: 6px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px; z-index: 4;
}
.map-toolbar button{
  padding: 6px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 700; color: var(--muted);
}
.map-toolbar button.on{ background: var(--ink); color: var(--paper); }

.map-legend{
  position:absolute; bottom: 16px; left: 16px;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: 14px; padding: 12px 14px;
  display:flex; flex-direction:column; gap: 6px;
  font-size: 12px; max-width: 240px; z-index: 4;
}
.map-legend h5{
  font-family:'Unbounded'; font-weight: 700; font-size: 11px;
  letter-spacing:.1em; text-transform:uppercase; color: var(--muted); margin: 0 0 4px;
}
.map-legend .lg{ display:flex; align-items:center; gap: 8px; font-weight: 600; }
.map-legend .lg .sw{ width: 18px; height: 10px; border-radius: 3px; }
.map-legend .lg .rn{ color: var(--muted); margin-left:auto; font-weight:500; font-size:11px; }
.map-legend .legend-divider{ height:1px; background: var(--line); margin: 4px -2px; }
.map-legend .lg.small{ font-size: 11px; font-weight: 500; color: var(--ink-2); }
.map-legend .lg .lg-big{ width: 14px; height: 14px; border-radius: 4px; background: var(--c2); box-shadow: 0 0 0 2px #fff, 0 0 0 3px rgba(0,0,0,.1); }
.map-legend .lg .lg-small{ width: 10px; height: 10px; border-radius: 3px; background: var(--c2); border: 1px dashed rgba(14,14,15,.4); }

.map-detail{
  border-left: 1px solid var(--line);
  padding: 28px 28px 24px;
  display:flex; flex-direction:column; gap: 18px;
  background: var(--paper); position: relative;
}
@media (max-width: 980px){ .map-detail{ border-left: 0; border-top: 1px solid var(--line); } }

.map-detail .d-placeholder{
  display:flex; align-items:center; justify-content:center;
  height: 100%; text-align: center; color: var(--muted); font-size: 14px;
}
.map-detail .d-placeholder p{ max-width: 280px; margin: 0; }

.map-detail .d-head{ display:flex; align-items:flex-start; gap:14px; }
.map-detail .d-head .caqi-pill{
  width: 64px; height: 64px; border-radius: 16px;
  display:inline-flex; align-items:center; justify-content:center;
  font-family:'Unbounded'; font-weight: 800; font-size: 26px;
  flex-shrink: 0;
}
.map-detail .d-head .caqi-pill.l1{ background: var(--c1); }
.map-detail .d-head .caqi-pill.l2{ background: var(--c2); }
.map-detail .d-head .caqi-pill.l3{ background: var(--c3); }
.map-detail .d-head .caqi-pill.l4{ background: var(--c4); }
.map-detail .d-head .caqi-pill.l5{ background: var(--c5); color:#fff; }
.map-detail .d-head .caqi-pill.nd{ background: var(--paper-3); color: var(--muted); }

.map-detail .d-head .name{
  font-family:'Unbounded'; font-weight:700; font-size: 20px;
  letter-spacing:-.01em; line-height:1.1;
}
.map-detail .d-head .name small{
  display:block; font-family:'Manrope'; font-weight:500; font-size: 12px;
  color: var(--muted); margin-top: 4px;
}
.map-detail .d-head .close{
  margin-left:auto; width:30px; height:30px; border-radius:8px;
  display:flex; align-items:center; justify-content:center;
  background: var(--paper-2); color: var(--muted); flex-shrink:0;
}
.map-detail .d-head .close:hover{ background: var(--paper-3); color: var(--ink); }

.map-detail .verdict{
  padding: 12px 14px; border-radius: 12px;
  background: var(--paper-2);
  font-size: 13px; line-height: 1.5;
}
.map-detail .verdict.l1{ background: color-mix(in oklab, var(--c1) 22%, var(--paper)); }
.map-detail .verdict.l2{ background: color-mix(in oklab, var(--c2) 22%, var(--paper)); }
.map-detail .verdict.l3{ background: color-mix(in oklab, var(--c3) 24%, var(--paper)); }
.map-detail .verdict.l4{ background: color-mix(in oklab, var(--c4) 24%, var(--paper)); }
.map-detail .verdict.l5{ background: color-mix(in oklab, var(--c5) 20%, var(--paper)); }
.map-detail .verdict b{ font-weight: 700; }

.map-detail .d-metrics{
  display:grid; grid-template-columns: repeat(3,1fr); gap: 8px;
}
@media (max-width:560px){ .map-detail .d-metrics{ grid-template-columns: repeat(2,1fr); } }
.d-metrics .dm{
  border:1px solid var(--line); border-radius: 12px;
  padding: 10px 12px; position: relative;
}
.d-metrics .dm .lbl{ font-size: 10px; font-weight:700; text-transform:uppercase; letter-spacing:.08em; color: var(--muted); }
.d-metrics .dm .v{ font-family:'Unbounded'; font-weight:700; font-size: 20px; line-height:1.1; margin-top:4px; letter-spacing:-.01em; }
.d-metrics .dm .u{ font-size:10px; color: var(--muted); }
.d-metrics .dm .lvl{ position:absolute; top: 10px; right: 10px; width: 8px; height: 8px; border-radius: 50%; }
.d-metrics .dm.missing .v{ font-family:'Manrope'; font-size:13px; color: var(--muted); font-weight:600; }

.map-detail .d-meteo{
  border:1px solid var(--line); border-radius: 12px;
  padding: 14px; display:flex; gap: 12px; align-items:center;
  font-size: 13px;
}
.map-detail .d-meteo .w-big{ font-family:'Unbounded'; font-weight:700; font-size: 28px; letter-spacing:-.02em; }
.map-detail .d-meteo .w-det{ color: var(--muted); font-size:12px; line-height:1.5; }
.map-detail .d-meteo .wind{
  margin-left:auto;
  width: 54px; height: 54px; border-radius:50%;
  border:1px solid var(--line); position:relative;
  display:flex; align-items:center; justify-content:center;
  font-size:10px; color: var(--muted); font-weight:600;
}
.map-detail .d-meteo .wind .arr{
  position:absolute; top:4px; left:50%;
  width: 0; height:0;
  border-left: 6px solid transparent; border-right: 6px solid transparent;
  border-bottom: 10px solid var(--ink);
  transform-origin: 50% 22px;
  transform: translateX(-50%) rotate(0deg);
}

.map-detail .d-compare{
  border:1px solid var(--line); border-radius: 12px; padding: 14px;
  font-size: 12px;
}
.map-detail .d-compare h5{
  font-family:'Unbounded'; font-weight:600; font-size: 12px; letter-spacing:.04em;
  margin: 0 0 10px;
  display:flex; justify-content:space-between; align-items:baseline;
}
.map-detail .d-compare h5 small{ color: var(--muted); font-family:'Manrope'; font-weight:500; font-size:11px; }
.cmp-row{
  display:grid; grid-template-columns: 70px 1fr 44px;
  align-items:center; gap: 8px; margin-bottom: 6px;
  font-size: 11px; font-weight:600;
}
.cmp-row:last-child{ margin-bottom: 0; }
.cmp-row .nm{ color: var(--muted); font-size: 11px; }
.cmp-row.you .nm{ color: var(--ink); font-weight: 800; }
.cmp-row .bar{ height: 10px; border-radius: 5px; background: var(--paper-3); overflow: hidden; }
.cmp-row .bar .fill{ height: 100%; background: var(--c2); transition: width .3s; }
.cmp-row .bar .fill.l1{ background: var(--c1); }
.cmp-row .bar .fill.l2{ background: var(--c2); }
.cmp-row .bar .fill.l3{ background: var(--c3); }
.cmp-row .bar .fill.l4{ background: var(--c4); }
.cmp-row .bar .fill.l5{ background: var(--c5); }
.cmp-row .bar .fill.nd{ background: var(--paper-3); }
.cmp-row .vl{ text-align:right; font-family:'Unbounded'; font-size:12px; font-weight:700; }

.map-detail .d-actions{ display:flex; gap: 8px; margin-top: auto; }
.map-detail .d-actions .btn{
  flex: 1; padding: 12px; border-radius: 12px;
  font-weight: 700; font-size: 13px; text-align:center;
}
.map-detail .d-actions .btn.primary{ background: var(--ink); color: var(--paper); }
.map-detail .d-actions .btn.primary:hover{ background: var(--ink-2); }
.map-detail .d-actions .btn.secondary{ background: var(--paper-2); color: var(--ink); border:1px solid var(--line); }
.map-detail .d-actions .btn.secondary:hover{ background: var(--paper-3); }

/* COMPARE SECTION */
.compare-wrap{ margin-top: 52px; }
.compare-card{
  background: var(--paper); border:1px solid var(--line); border-radius: 20px;
  padding: 24px;
}
.compare-row{
  display:grid; grid-template-columns: 260px 1fr 120px;
  gap: 16px; align-items:center;
  padding: 10px 0; border-bottom: 1px dashed var(--line);
}
.compare-row:last-child{ border-bottom: 0; }
.compare-row .cn{
  font-family:'Unbounded'; font-weight: 700; font-size: 14px;
}
.compare-row .cn small{
  display:block; font-family:'Manrope'; font-weight:500;
  font-size: 11px; color: var(--muted); margin-top: 2px;
}
.compare-row .cbar{
  height: 16px; border-radius: 8px;
  background: var(--paper-2); position: relative; overflow: hidden;
}
.compare-row .cbar .cfill{ height: 100%; border-radius: 8px; transition: width .4s; }
.compare-row .cbar .cfill.l1{ background: var(--c1); }
.compare-row .cbar .cfill.l2{ background: var(--c2); }
.compare-row .cbar .cfill.l3{ background: var(--c3); }
.compare-row .cbar .cfill.l4{ background: var(--c4); }
.compare-row .cbar .cfill.l5{ background: var(--c5); }
.compare-row .cbar .cfill.nd{ background: var(--paper-3); }
.compare-row .cval{
  text-align:right; font-family:'Unbounded'; font-weight: 700; font-size: 18px;
}
.compare-row.stale{ opacity: .5; }
.compare-row.stale .cval::after{ content:" · застаріло"; font-size: 9px; font-weight: 500; color: var(--muted); font-family:'Manrope'; }
@media (max-width: 720px){
  .compare-row{ grid-template-columns: 1fr 80px; }
  .compare-row .cbar{ grid-column: 1 / -1; }
}
.compare-note{
  font-size: 12px; color: var(--muted); margin-top: 14px;
  padding: 12px 14px; background: var(--paper-2); border-radius: 12px;
  line-height: 1.55;
}
.compare-note b{ color: var(--ink); }

/* CTA (notifications) */
.notify-cta{
  margin: 64px 0 0;
  background: var(--ink); color: var(--paper);
  border-radius: 28px; padding: 48px 44px;
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: 1.4fr 1fr; gap: 32px; align-items: center;
}
.notify-cta::before{
  content:""; position:absolute; right: -60px; top: -60px;
  width: 240px; height: 240px; border-radius: 50%;
  background: var(--c2); opacity: .9;
}
.notify-cta::after{
  content:""; position:absolute; right: 70px; bottom: -60px;
  width: 140px; height: 140px; border-radius:50%;
  background: var(--yellow);
}
.notify-cta .inner{ position:relative; z-index: 2; }
.notify-cta h2{
  font-family:'Unbounded'; font-weight:700;
  font-size: clamp(26px, 3.2vw, 36px);
  line-height: 1.02; letter-spacing: -.01em;
  margin: 0 0 10px;
}
.notify-cta p{ color: #d4cdba; font-size: 15px; margin: 0 0 20px; max-width: 480px; }
.notify-cta .cta-row{ display:flex; gap:12px; align-items:center; flex-wrap: wrap; }
.notify-cta .btn-y{
  padding: 12px 18px; border-radius: 10px;
  background: var(--yellow); color: var(--ink);
  font-weight: 800; font-size: 14px;
}
.notify-cta .btn-y:hover{ background: var(--yellow-deep); }
.notify-cta .btn-y.granted{ background: var(--c2); }
.notify-cta .btn-y.denied{ background: var(--paper-3); color: var(--muted); cursor: not-allowed; }
.notify-cta .cta-status{ font-size: 12px; color: #d4cdba; }
.notify-cta .cta-tiny{ font-size: 11px; color:#9a9282; margin: 14px 0 0; max-width: 520px; }

.notify-cta .aside{
  position: relative; z-index: 2;
  background: rgba(0,0,0,.2);
  border: 1px solid rgba(255,255,255,.1);
  padding: 18px 20px; border-radius: 18px; font-size: 13px;
}
.notify-cta .aside h5{
  font-family:'Unbounded'; font-weight:700; font-size: 13px;
  margin: 0 0 8px; letter-spacing:.02em;
}
.notify-cta .aside ul{ margin: 0; padding: 0; list-style: none; display:flex; flex-direction:column; gap: 8px; }
.notify-cta .aside ul li{
  display:flex; gap: 10px; align-items:flex-start; color: #d4cdba;
}
.notify-cta .aside ul li::before{
  content:""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--yellow); margin-top: 7px; flex-shrink: 0;
}
.notify-cta .aside a{ text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; color: #fff; }

@media (max-width: 820px){ .notify-cta{ grid-template-columns:1fr; padding: 32px 24px; } }

/* METHODOLOGY */
.methodology{ margin-top: 52px; }
.method-grid{
  display:grid; grid-template-columns: repeat(4,1fr); gap: 14px;
}
@media (max-width:900px){ .method-grid{ grid-template-columns: repeat(2,1fr); } }
@media (max-width:520px){ .method-grid{ grid-template-columns: 1fr; } }
.method-card{
  background: var(--paper); border:1px solid var(--line);
  border-radius: 18px; padding: 18px;
}
.method-card h4{
  font-family:'Unbounded'; font-weight:700; font-size: 14px;
  margin: 0 0 8px; letter-spacing:.02em;
}
.method-card p{ margin: 0; font-size: 13px; color: var(--muted); line-height: 1.55; }
.method-card code{ font-size: 12px; }

/* FOOTER */
footer{
  padding: 56px 0 40px; color: var(--muted); font-size: 13px; margin-top: 40px;
}
.foot-row{
  display:grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 24px;
  padding-top: 28px; border-top: 1px solid var(--line);
}
@media (max-width: 700px){ .foot-row{ grid-template-columns:1fr 1fr; } }
.foot-row h5{ font-size:11px; text-transform:uppercase; letter-spacing:.08em; color:var(--ink); margin: 0 0 12px; font-weight:700; }
.foot-row a{ display:block; padding: 4px 0; }
.foot-row a:hover{ color: var(--ink); }
.foot-bottom{
  margin-top: 24px;
  display:flex; justify-content:space-between; gap:16px; flex-wrap: wrap;
  font-size: 12px;
}

/* HISTORY CHART inside station detail */
.d-history{
  border:1px solid var(--line); border-radius: 12px; padding: 14px;
}
.d-history h5{
  font-family:'Unbounded'; font-weight:600; font-size: 12px; letter-spacing:.04em;
  margin: 0 0 10px;
  display:flex; justify-content: space-between; align-items:baseline;
}
.d-history h5 small{ color:var(--muted); font-family:'Manrope'; font-weight:500; font-size:11px; }
.d-history svg{ width: 100%; height: 90px; display:block; margin-bottom: 8px; }
.d-history-tabs{
  display:flex; gap: 4px; flex-wrap: wrap;
  background: var(--paper-2); border-radius: 8px; padding: 3px;
}
.d-history-tabs button{
  padding: 5px 8px; border-radius: 6px;
  font-size: 11px; font-weight:700; color: var(--muted);
}
.d-history-tabs button.on{ background: var(--ink); color: var(--paper); }
.d-history .empty{ color: var(--muted); font-size: 12px; text-align:center; padding: 16px 8px; }

/* FAQ */
.faq-wrap{ margin-top: 52px; }
.faq-list{
  display: flex; flex-direction: column; gap: 10px;
}
.faq-item{
  background: var(--paper); border: 1px solid var(--line);
  border-radius: 16px; overflow: hidden;
  transition: border-color .15s, background .15s;
}
.faq-item[open]{ border-color: var(--line-strong); background: var(--paper-2); }
.faq-item summary{
  list-style: none; cursor: pointer;
  padding: 18px 22px;
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  font-family:'Unbounded'; font-weight: 600; font-size: 16px; letter-spacing: -.005em;
}
.faq-item summary::-webkit-details-marker{ display: none; }
.faq-item summary:hover{ background: var(--paper-2); }
.faq-item[open] summary:hover{ background: var(--paper-3); }
.faq-item summary span{ flex: 1; }
.faq-chev{
  color: var(--muted); flex-shrink: 0;
  transition: transform .2s;
}
.faq-item[open] .faq-chev{ transform: rotate(180deg); color: var(--ink); }
.faq-answer{
  padding: 0 22px 18px;
  font-size: 14px; line-height: 1.6; color: var(--ink-2);
}
.faq-answer b{ color: var(--ink); }
.faq-answer a{ text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.faq-answer code{ font-size: .88em; }
@media (max-width: 560px){
  .faq-item summary{ padding: 14px 16px; font-size: 14px; }
  .faq-answer{ padding: 0 16px 14px; font-size: 13px; }
}

/* DEMO PANEL — removable block (see HTML comment) */
#demo-panel{
  position: fixed; right: 20px; bottom: 20px; z-index: 100;
  width: 280px;
  background: var(--ink); color: var(--paper);
  border-radius: 16px; padding: 14px 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
  font-size: 12px;
}
#demo-panel[hidden]{ display: none; }
#demo-panel .demo-head{
  display:flex; justify-content:space-between; align-items:center;
  font-family:'Unbounded'; font-weight: 700; font-size: 13px;
  margin-bottom: 8px;
}
#demo-panel #demo-close{
  width: 22px; height: 22px; border-radius: 6px;
  display:inline-flex; align-items:center; justify-content:center;
  background: rgba(255,255,255,.1); color: var(--paper);
  font-size: 18px; line-height: 1;
}
#demo-panel .demo-note{
  color: #a9a294; font-size: 11px; margin: 0 0 10px; line-height: 1.45;
}
#demo-panel .demo-note code{ background: rgba(255,255,255,.08); color: var(--yellow); }
#demo-panel .demo-btns{ display:flex; flex-direction:column; gap: 4px; }
#demo-panel .demo-btns button{
  padding: 7px 10px; border-radius: 8px;
  background: rgba(255,255,255,.06); color: var(--paper);
  font-size: 12px; font-weight: 600; text-align: left;
}
#demo-panel .demo-btns button:hover{ background: rgba(255,255,255,.12); }
#demo-panel .demo-btns button.active{ background: var(--yellow); color: var(--ink); }
body.demo-active::after{
  content: "ДЕМО-РЕЖИМ: дані не реальні";
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 99;
  background: var(--yellow); color: var(--ink);
  font-family:'Unbounded'; font-weight: 700; font-size: 11px;
  text-align: center; padding: 4px; letter-spacing: .08em;
  pointer-events: none;
}

/* small utils */
.hide-mob{}
@media (max-width: 720px){
  .hide-mob{ display:none; }
  .nav-links{ display:none; }
  .hero{ padding: 24px 20px; }
  .hero-left h1{ font-size: 44px; }
}
