/* ============================================================
   The Last-Kilometre Protocol — City of Tallinn edition
   Tokens from tallinn.ee: Tallinn blue #0072CE, pale blue #CCE3F5,
   black text, greys #666 / #E6E6E6, white surfaces, pill controls.
   Citizen portal follows Google Maps conventions: floating search,
   category chips, left place/directions panel over a full-bleed map.
   ============================================================ */

:root {
  --blue: #0072CE;
  --blue-dark: #005AA3;
  --blue-deep: #003F73;
  --blue-light: #CCE3F5;
  --blue-pale: #EAF3FB;
  --ink: #000;
  --text: #1F1F1F;
  --grey: #666;
  --line: #E6E6E6;
  --bg: #F3F6F9;
  --red: #D2232A;
  --red-light: #FBE5E6;
  --green: #1E8E3E;
  --green-light: #E3F4E8;
  --orange: #F28C00;
  --font: "Lab Grotesque", "Inter", Arial, "Helvetica Neue", Helvetica, sans-serif;
  --r-card: 12px; --r-md: 10px; --r-pill: 999px;
  --gap: 12px;
  --header-h: 64px;
  --panel-w: 408px;
  --shadow: 0 2px 6px rgba(60,64,67,.28), 0 1px 2px rgba(60,64,67,.15);
  --shadow-lg: 0 10px 30px rgba(0,40,80,.16), 0 1px 3px rgba(0,0,0,.08);
  --ease: cubic-bezier(.2,.8,.2,1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font-family: var(--font); font-size: 16px; line-height: 1.5; color: var(--text); background: var(--bg); height: 100vh; overflow: hidden; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4 { line-height: 1.2; letter-spacing: -0.01em; color: var(--ink); }
a { color: var(--blue); }
[hidden] { display: none !important; }
svg { flex-shrink: 0; }

/* ---------- Header ---------- */
.topbar { position: absolute; top: 0; left: 0; right: 0; z-index: 1200; background: #fff; border-bottom: 1px solid var(--line); }
.topbar-row { height: 64px; padding: 0 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; min-width: 0; flex-shrink: 0; }
.portals { display: flex; gap: 4px; background: var(--blue-pale); padding: 4px; border-radius: var(--r-pill); }
.portal-tab { background: transparent; color: var(--blue); border: 0; border-radius: var(--r-pill); padding: 8px 18px; font-weight: 700; font-size: .9rem; white-space: nowrap; transition: background .2s var(--ease), color .2s; }
.portal-tab.active { background: var(--blue); color: #fff; }
.portal-tab:hover:not(.active) { background: var(--blue-light); }
.topbar-right { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: var(--r-pill); font-size: .78rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 320px; background: var(--green-light); color: var(--green); }
.pill-alert { background: var(--red); color: #fff; animation: pulse-r 1.8s infinite; }
.pill-net { background: #fff; border: 1px solid var(--line); color: var(--grey); }
.pill-net { background: var(--red-light); color: var(--red); border-color: transparent; }
.btn-ghost { background: transparent; color: var(--grey); border: 1px solid var(--line); padding: 6px 12px; border-radius: var(--r-pill); font-size: .78rem; font-weight: 700; }
.btn-ghost:hover { border-color: var(--blue); color: var(--blue); }
.logo { display: flex; align-items: center; margin-left: 10px; padding-left: 16px; border-left: 1px solid var(--line); height: 40px; }
.logo img { height: 34px; width: auto; display: block; }
.logo-left { margin-left: 0; padding-left: 0; border-left: 0; }
.logo-left img { height: 38px; }

/* Municipality subtabs (second header row) */
.subtabs { display: flex; gap: 4px; padding: 0 16px; height: 46px; align-items: stretch; border-top: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.subtabs::-webkit-scrollbar { display: none; }
.subtab { position: relative; background: transparent; border: 0; padding: 0 14px; font-weight: 700; font-size: .88rem; color: var(--grey); white-space: nowrap; display: inline-flex; align-items: center; gap: 7px; transition: color .15s; }
.subtab:hover { color: var(--blue); }
.subtab.active { color: var(--blue); }
.subtab.active::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--blue); }
.subtab .count { font-size: .7rem; background: var(--blue-pale); color: var(--blue); border-radius: var(--r-pill); padding: 1px 7px; }
.subtab .count.red { background: var(--red); color: #fff; }
.subtab .dot-red { width: 8px; height: 8px; border-radius: 50%; background: var(--red); animation: pulse-r 1.6s infinite; }

@keyframes pulse-r { 0%,100% { box-shadow: 0 0 0 0 rgba(210,35,42,.45); } 50% { box-shadow: 0 0 0 7px rgba(210,35,42,0); } }
@keyframes pulse-b { 0%,100% { box-shadow: 0 0 0 0 rgba(0,114,206,.5); } 50% { box-shadow: 0 0 0 9px rgba(0,114,206,0); } }

/* ---------- Stage ---------- */
#app { position: absolute; left: 0; right: 0; bottom: 0; top: var(--header-h); }
.map-wrap { position: absolute; inset: 0; }
#map { position: absolute; inset: 0; background: #e9eef2; }
.leaflet-tile-pane { filter: saturate(.75) brightness(1.03); }
.leaflet-container { font-family: var(--font); }
.leaflet-bottom.leaflet-right { margin-bottom: 8px; }
.leaflet-bar { border: 0 !important; border-radius: var(--r-md) !important; overflow: hidden; box-shadow: var(--shadow) !important; }
.leaflet-bar a { background: #fff !important; color: #444 !important; border-bottom: 1px solid var(--line) !important; width: 40px !important; height: 40px !important; line-height: 40px !important; font-weight: 400; font-size: 20px !important; }
.leaflet-bar a:hover { background: #f5f5f5 !important; }
.leaflet-bar a:last-child { border-bottom: 0 !important; }
.leaflet-control-attribution { background: rgba(255,255,255,.85) !important; font-size: 10px; }
.leaflet-popup-content-wrapper { border-radius: var(--r-md); box-shadow: var(--shadow-lg); }
.leaflet-popup-content { font-size: .84rem; line-height: 1.45; margin: 12px 14px; }
.leaflet-popup-content b { display: block; font-size: .92rem; }
.leaflet-popup-content .muted { display: block; color: var(--grey); }
.map-hint { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); z-index: 1150; background: var(--ink); color: #fff; padding: 9px 16px; border-radius: var(--r-pill); font-weight: 700; font-size: .85rem; box-shadow: var(--shadow-lg); }

.portal-citizen .gov-panel, .portal-citizen .legend { display: none; }
.portal-gov .citizen-ui { display: none; }

/* ---------- Citizen: Google-Maps-style overlay ---------- */
.citizen-ui { position: absolute; inset: 0; z-index: 1100; pointer-events: none; }
.citizen-ui > * { pointer-events: auto; }
.c-top { position: absolute; top: var(--gap); left: var(--gap); right: 70px; display: flex; align-items: center; gap: 10px; pointer-events: none; }
.c-top > * { pointer-events: auto; }
.searchbar { width: var(--panel-w); flex-shrink: 0; height: 52px; background: #fff; border-radius: 26px; box-shadow: var(--shadow); display: flex; align-items: center; padding: 0 6px 0 6px; gap: 2px; }
.searchbar input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 1rem; padding: 0 6px; color: var(--text); }
.searchbar input::placeholder { color: #70757a; }
.searchbar input::-webkit-search-cancel-button { display: none; }
.sb-icon { width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent; color: #5f6368; display: grid; place-items: center; flex-shrink: 0; }
.sb-icon:hover { background: #f1f3f4; }
.sb-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sb-sep { width: 1px; height: 26px; background: var(--line); margin: 0 4px; }
.sb-dir { width: 40px; height: 40px; border: 0; background: transparent; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; }
.sb-dir:hover { background: var(--blue-pale); }
.dir-ic { width: 30px; height: 30px; }
.dir-ic rect { fill: var(--blue); stroke: none; }
.dir-ic path { fill: none; stroke: #fff; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

.chips-wrap { position: relative; flex: 1; min-width: 0; display: flex; align-items: center; }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 6px 44px 6px 2px; scroll-behavior: smooth; }
.chips::-webkit-scrollbar { display: none; }
.chip { height: 38px; padding: 0 16px 0 12px; border-radius: 19px; background: #fff; border: 0; box-shadow: var(--shadow); display: inline-flex; align-items: center; gap: 7px; font-weight: 600; font-size: .9rem; color: #202124; white-space: nowrap; flex-shrink: 0; transition: background .15s, color .15s; }
.chip svg { width: 18px; height: 18px; fill: none; stroke: #3c4043; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chip:hover { background: #f8f9fa; }
.chip.active { background: var(--c); color: #fff; }
.chip.active svg { stroke: #fff; }
.chips-more { position: absolute; right: 0; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; border-radius: 50%; border: 0; background: #fff; box-shadow: var(--shadow); display: grid; place-items: center; color: #3c4043; }
.chips-more svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

.alert-banner { position: absolute; top: calc(var(--gap) + 62px); left: var(--gap); width: var(--panel-w); background: var(--red); color: #fff; border-radius: 16px; padding: 12px 12px 12px 14px; display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; align-items: start; box-shadow: var(--shadow-lg); }
.alert-banner.heat { background: #C2410C; }
.alert-banner.flood { background: #1557A6; }
.alert-banner.storm { background: #3F3F46; }
.alert-banner > svg { width: 26px; height: 26px; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; margin-top: 2px; }
.ab-text b { display: block; font-size: .92rem; letter-spacing: .01em; }
.ab-text span { display: block; font-size: .8rem; opacity: .92; line-height: 1.35; }
.btn-alert { grid-column: 2; justify-self: start; margin-top: 6px; background: #fff; color: var(--ink); border: 0; border-radius: var(--r-pill); padding: 7px 14px; font-weight: 700; font-size: .84rem; }

.cpanel { position: absolute; top: calc(var(--gap) + 62px); left: var(--gap); width: var(--panel-w); max-height: calc(100% - 86px); overflow-y: auto; background: #fff; border-radius: 16px; box-shadow: var(--shadow); padding: 6px 14px 14px; }
body.has-alert .cpanel { top: calc(var(--gap) + 62px + var(--banner-h, 118px)); max-height: calc(100% - 86px - var(--banner-h, 118px)); }
.cpanel p { color: var(--grey); font-size: .9rem; margin-bottom: 8px; }
.cpanel h4 { color: var(--ink); font-size: .95rem; margin: 10px 0 4px; }
.phead { display: flex; align-items: center; gap: 6px; padding: 8px 0 8px; border-bottom: 1px solid var(--line); margin: 0 -14px 6px; padding-left: 10px; padding-right: 8px; position: sticky; top: -6px; background: #fff; z-index: 2; }
.ptitle { flex: 1; min-width: 0; padding-left: 4px; }
.ptitle b { display: block; font-size: 1rem; color: var(--ink); }
.ptitle span { display: block; font-size: .76rem; color: var(--grey); }
.icon-btn { width: 36px; height: 36px; border-radius: 50%; border: 0; background: transparent; display: grid; place-items: center; color: #5f6368; flex-shrink: 0; }
.icon-btn:hover { background: #f1f3f4; }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

.plist { display: flex; flex-direction: column; }
.plabel { font-size: .74rem; font-weight: 700; color: var(--grey); padding: 10px 0 4px; text-transform: uppercase; letter-spacing: .04em; }
.prow { display: grid; grid-template-columns: 36px 1fr auto; gap: 12px; align-items: center; text-align: left; background: transparent; border: 0; border-bottom: 1px solid var(--line); padding: 10px 2px; width: 100%; }
.prow:hover { background: #f8f9fa; }
.picon { width: 36px; height: 36px; border-radius: 50%; background: var(--c); display: grid; place-items: center; }
.picon svg { width: 18px; height: 18px; fill: none; stroke: #fff; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.ptext { min-width: 0; }
.ptext b { display: block; font-size: .92rem; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ptext span { display: block; font-size: .78rem; color: var(--grey); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pdist { text-align: right; font-size: .84rem; font-weight: 700; color: var(--ink); white-space: nowrap; }
.pdist small { display: block; font-size: .72rem; font-weight: 400; color: var(--grey); }
.src { font-size: .72rem !important; color: #8a8a8a !important; margin-top: 10px; }
.linkbtn { background: none; border: 0; color: var(--blue); font-weight: 700; font-size: .86rem; padding: 10px 0 0; }
.empty { text-align: center; color: var(--grey); font-size: .86rem; padding: 18px 0; }

.place h3 { font-size: 1.35rem; font-weight: 700; margin: 8px 0 2px; }
.place .addr { color: var(--text); margin-bottom: 2px; }
.place .row { margin: 12px 0; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); font-size: .86rem; }
.kv span { color: var(--grey); }
.kv b { text-align: right; }

.dir-head { display: flex; align-items: center; gap: 6px; margin: 4px -6px 10px -8px; }
.dir-route { flex: 1; min-width: 0; background: #f1f3f4; border-radius: 12px; padding: 8px 12px; }
.dir-row { display: flex; align-items: center; gap: 10px; font-size: .9rem; min-width: 0; }
.dir-row b, .dir-row span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dir-line { width: 2px; height: 10px; margin: 2px 0 2px 5px; background-image: linear-gradient(#9aa0a6 50%, transparent 50%); background-size: 2px 4px; }
.rdot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.rdot.you { background: var(--blue); box-shadow: 0 0 0 3px #fff inset, 0 0 0 1px var(--blue); }
.rdot.to { background: var(--c); }
.dir-note { font-size: .8rem !important; margin: -4px 0 10px !important; }

.modes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-bottom: 12px; }
.mode { background: transparent; color: #3c4043; border: 0; border-radius: 18px; padding: 8px 4px 6px; display: flex; flex-direction: column; align-items: center; gap: 1px; text-align: center; transition: background .2s var(--ease), color .2s; }
.mode:hover { background: #f1f3f4; }
.mode svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.mode .lbl { font-size: .7rem; font-weight: 600; opacity: .8; }
.mode .time { font-size: .9rem; font-weight: 700; }
.mode.active { background: var(--blue-pale); color: var(--blue); }

.proto-box { border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; background: var(--red-light); }
.proto-box.flood { background: #E6F0FB; }
.proto-box.heat { background: #FFF1E6; }
.proto-box.storm { background: #F1F1F3; }
.pb-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.pb-head svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pb-head b { font-size: .95rem; color: var(--ink); }
.proto-box.airstrike .pb-head { color: var(--red); }
.proto-box.flood .pb-head { color: #1557A6; }
.proto-box.heat .pb-head { color: #C2410C; }
.proto-box.storm .pb-head { color: #3F3F46; }
.proto-box p { font-size: .84rem; margin-bottom: 6px; }
.proto-box p b { color: var(--ink); }
.proto-box p.ok { color: #14532D; }
.proto-box p.bad { color: #7F1D1D; font-weight: 600; }
.proto-box p.loading { color: var(--grey); }
.proto-box p.loading::before { content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 8px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -1px; }
@keyframes spin { to { transform: rotate(360deg); } }
.meter { height: 8px; border-radius: 4px; background: #F28C00; overflow: hidden; margin: 6px 0 8px; }
.meter span { display: block; height: 100%; background: #1B7F3B; border-radius: 4px 0 0 4px; }
.meter.risk { background: #0072CE; }
.meter.risk span { background: var(--red); }
.seg { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin: 4px 0 8px; font-size: .78rem; color: var(--grey); }
.seg span { margin-right: 4px; font-weight: 700; }
.seg button { border: 1px solid #F3C9A6; background: #fff; color: #9A3412; border-radius: var(--r-pill); padding: 3px 10px; font-size: .76rem; font-weight: 700; }
.seg button.on { background: #C2410C; border-color: #C2410C; color: #fff; }
.tips { margin: 6px 0 0 18px; font-size: .8rem; color: var(--grey); }
.tips li { margin-bottom: 2px; }

.sheet { padding: 2px 0 4px; }
.sheet.flat { padding-top: 6px; }
.sheet .big-time { font-size: 1.7rem; font-weight: 700; line-height: 1.1; letter-spacing: -0.02em; margin-bottom: 6px; color: var(--ink); }
.sheet .big-time small { font-size: .85rem; font-weight: 400; color: var(--grey); margin-left: 8px; letter-spacing: 0; }
.warn { background: #FFF4E5; border-left: 4px solid var(--orange); padding: 9px 12px; border-radius: 6px; font-size: .84rem; color: #5A3A00; margin: 8px 0; }
.warn .row { margin-top: 6px; }
.warn.work b { display: block; color: #7A4A00; margin-bottom: 2px; }
.opt { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); font-size: .86rem; }
.opt .meta { color: var(--grey); font-size: .74rem; display: block; }
.opt b { color: var(--ink); }
.menu { display: flex; flex-direction: column; }
.mitem { display: flex; gap: 14px; align-items: center; text-align: left; background: transparent; border: 0; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.mitem:hover { background: #f8f9fa; }
.mitem svg { width: 22px; height: 22px; fill: none; stroke: #5f6368; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.mitem b { display: block; font-size: .92rem; color: var(--ink); }
.mitem small { display: block; font-size: .78rem; color: var(--grey); }

/* ---------- Buttons & forms (shared) ---------- */
.btn-y, .btn-y-outline, .btn-dark, .btn { border-radius: var(--r-pill); font-weight: 700; font-size: .88rem; white-space: nowrap; transition: transform .15s var(--ease), background .2s, box-shadow .2s; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn-y svg, .btn svg { width: 18px; height: 18px; }
.btn-y .dir-ic rect { fill: #fff; } .btn-y .dir-ic path { stroke: var(--blue); }
.btn-y, .btn-green { background: var(--blue); color: #fff; border: 1px solid var(--blue); padding: 9px 18px; }
.btn-y:hover, .btn-green:hover { background: var(--blue-dark); border-color: var(--blue-dark); }
.btn-y-outline, .btn-outline { background: #fff; color: var(--blue); border: 1px solid #BFD6EE; padding: 8px 16px; }
.btn-y-outline:hover, .btn-outline:hover { background: var(--blue-pale); }
.btn-dark, .btn-grey { background: var(--blue-pale); color: var(--blue); border: 1px solid transparent; padding: 7px 14px; font-size: .84rem; }
.btn-dark:hover, .btn-grey:hover { background: var(--blue-light); }
.btn { padding: 10px 18px; border: 1px solid transparent; }
.btn-alert { }
.btn.btn-alert { background: var(--red); color: #fff; padding: 11px 18px; }
.btn.btn-alert svg { fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn.btn-alert:hover { background: #B11C22; }
.btn-sm { padding: 6px 12px; font-size: .8rem; }
.btn-block, .btn-full { width: 100%; }
.btn:active, .btn-y:active, .btn-y-outline:active, .btn-dark:active { transform: scale(.98); }
.btn:disabled, .btn-y:disabled, .btn-y-outline:disabled { opacity: .5; cursor: default; transform: none; }
.code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 1.5rem; font-weight: 700; letter-spacing: .08em; }
.matched { background: var(--blue); color: #fff; border-radius: var(--r-card); padding: 14px; }
.matched b { display: block; font-size: 1.05rem; color: #fff; }
.matched .code { color: #fff; font-size: 1.15rem; }
.matched .btn-y-outline { background: transparent; color: #fff; border-color: rgba(255,255,255,.7); }
.tag { display: inline-block; padding: 2px 8px; border-radius: var(--r-pill); font-size: .7rem; font-weight: 700; }
.tag-y { background: var(--blue); color: #fff; }
.tag-dark { background: var(--line); color: var(--text); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.muted { color: var(--grey); font-size: .8rem; }
.small { font-size: .82rem; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.field label { font-size: .78rem; font-weight: 700; color: var(--text); }
.check { display: flex; align-items: center; gap: 8px; font-size: .86rem; color: var(--text); margin-bottom: 10px; }
.check input { width: 18px; height: 18px; accent-color: var(--blue); }
.cpanel select, .cpanel input:not([type=checkbox]), .cpanel textarea, .card select, .card input[type=text], .card input[type=number], .card input[type=date], .card textarea { background: #fff; color: var(--text); border: 1px solid #BFC7D0; border-radius: var(--r-md); padding: 9px 12px; width: 100%; outline: none; }
.cpanel select:focus, .cpanel input:focus, .cpanel textarea:focus, .card select:focus, .card input:focus, .card textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,114,206,.18); }
select { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--blue) 50%), linear-gradient(135deg, var(--blue) 50%, transparent 50%) !important; background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55% !important; background-size: 5px 5px, 5px 5px !important; background-repeat: no-repeat !important; padding-right: 34px !important; }
.lst { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: .85rem; align-items: center; }
.lst:first-of-type { border-top: 0; }
.lst .meta { color: var(--grey); font-size: .74rem; display: block; }

/* ---------- Municipality panel ---------- */
.gov-panel { position: absolute; top: var(--gap); left: var(--gap); bottom: var(--gap); width: 430px; z-index: 1100; overflow-y: auto; background: var(--blue-pale); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 12px; display: flex; flex-direction: column; gap: 12px; }
.gov-panel > * { flex-shrink: 0; }
.card { background: #fff; border-radius: var(--r-card); padding: 16px; box-shadow: 0 1px 3px rgba(0,40,80,.08); }
.card h2 { font-size: 1.15rem; font-weight: 700; margin-bottom: 6px; }
.card h3 { font-size: .98rem; font-weight: 700; margin-bottom: 6px; }
.card p { font-size: .88rem; margin-bottom: 10px; color: var(--text); }
.card p.muted { color: var(--grey); }
.card p:last-child { margin-bottom: 0; }
.eyebrow { font-size: .74rem; font-weight: 700; color: var(--blue); margin-bottom: 2px; }
.card textarea { resize: vertical; min-height: 70px; }
.range { display: flex; align-items: center; gap: 10px; }
.range input { flex: 1; accent-color: var(--blue); }
.status-box { border-radius: var(--r-card); padding: 14px 16px; background: var(--blue-pale); margin-bottom: 12px; }
.status-box.live { background: var(--red); color: #fff; animation: pulse-r 2s infinite; }
.status-box.live .muted { color: rgba(255,255,255,.85); }
.status-box .big-time { font-size: 1.7rem; font-weight: 700; line-height: 1.1; letter-spacing: -0.02em; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: var(--blue-pale); border-radius: var(--r-md); padding: 10px 12px; }
.stat b { display: block; font-size: 1.45rem; font-weight: 700; color: var(--blue); line-height: 1.1; letter-spacing: -0.02em; }
.stat span { font-size: .7rem; color: var(--grey); line-height: 1.3; display: block; }
.badge { display: inline-block; padding: 2px 9px; border-radius: var(--r-pill); font-size: .7rem; font-weight: 700; white-space: nowrap; }
.badge-green { background: var(--blue); color: #fff; }
.badge-grey { background: var(--line); color: var(--text); }
.badge-outline { border: 1px solid var(--blue); color: var(--blue); }
.badge-orange { background: var(--orange); color: #fff; }
.badge-red { background: var(--red); color: #fff; }
.steps { display: flex; flex-direction: column; gap: 10px; }
.step { display: flex; gap: 10px; align-items: flex-start; font-size: .86rem; }
.step .num { width: 26px; height: 26px; border-radius: 50%; background: var(--blue); color: #fff; font-weight: 700; font-size: .82rem; display: grid; place-items: center; flex-shrink: 0; }
.step.pending .num { background: var(--line); color: var(--grey); }
.step b { display: block; }
.step span { color: var(--grey); font-size: .8rem; }
.ops { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.op { border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px 12px; font-size: .78rem; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.op .op-head { display: flex; align-items: center; gap: 8px; font-weight: 700; min-width: 80px; }
.op .letter { width: 26px; height: 26px; border-radius: 50%; background: var(--blue); color: #fff; display: grid; place-items: center; font-size: .78rem; flex-shrink: 0; }
.op dl { display: flex; gap: 14px; flex: 1; flex-wrap: wrap; }
.op dl div { display: flex; flex-direction: column; }
.op dt { color: var(--grey); font-size: .68rem; line-height: 1.2; }
.op dd { font-weight: 700; line-height: 1.3; }
.op .ack { flex-basis: 100%; }
.log { display: flex; flex-direction: column; gap: 6px; max-height: 60vh; overflow: auto; margin-top: 8px; }
.log-e { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .7rem; background: var(--bg); border-radius: 8px; padding: 6px 8px; line-height: 1.45; }
.log-e .a { display: inline-block; padding: 0 6px; border-radius: 4px; background: var(--blue); color: #fff; font-weight: 700; margin-right: 6px; }
.log-e .a.prov { background: #444; }
.log-e .m { font-weight: 700; color: var(--blue); }
.log-e .st { float: right; color: var(--grey); }
.log-e summary { cursor: pointer; color: var(--grey); margin-top: 2px; }
.log-e pre, pre.json { white-space: pre-wrap; word-break: break-word; margin-top: 4px; color: var(--text); }
pre.json { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .7rem; background: var(--bg); padding: 10px; border-radius: 8px; max-height: 320px; overflow: auto; }
details summary { cursor: pointer; font-weight: 700; font-size: .86rem; color: var(--blue); }
.tbl { width: 100%; border-collapse: collapse; font-size: .78rem; margin-top: 8px; }
.tbl th, .tbl td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { color: var(--grey); font-weight: 700; }
.tbl tr.mine td { background: var(--blue-pale); }
.col-foot { font-size: .7rem; color: var(--grey); text-align: center; padding: 2px 0; }
.sub-form { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }

/* Protocol picker */
.protos { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0 14px; }
.proto { text-align: left; background: #fff; border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 3px; transition: border-color .15s, background .15s; }
.proto svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; margin-bottom: 2px; }
.proto b { font-size: .9rem; color: var(--ink); }
.proto span { font-size: .72rem; color: var(--grey); line-height: 1.35; }
.proto.airstrike { color: var(--red); } .proto.flood { color: #1557A6; } .proto.heat { color: #C2410C; } .proto.storm { color: #3F3F46; }
.proto:hover:not(:disabled) { border-color: currentColor; }
.proto.active { border-color: currentColor; background: color-mix(in srgb, currentColor 8%, #fff); box-shadow: 0 0 0 1px currentColor inset; }
.proto:disabled:not(.active) { opacity: .45; cursor: default; }
.proto:disabled.active { cursor: default; }

/* ---------- Everyday: home card, where-to, reports ---------- */
.home-card { position: absolute; left: var(--gap); bottom: 22px; width: 360px; background: #fff; border-radius: 16px; box-shadow: var(--shadow); padding: 10px 10px 6px; }
.hc-title { font-size: .74rem; font-weight: 700; color: var(--grey); text-transform: uppercase; letter-spacing: .05em; padding: 2px 6px 6px; }
.hc-row { display: grid; grid-template-columns: 32px 1fr; gap: 10px; align-items: center; width: 100%; text-align: left; background: transparent; border: 0; border-radius: 10px; padding: 7px 6px; }
.hc-row:hover { background: #f5f7f9; }
.hc-row .picon { width: 32px; height: 32px; }
.hc-row .picon svg { width: 16px; height: 16px; }
.hc-row b { font-size: .88rem; }
.fab { position: absolute; left: 50%; bottom: 28px; transform: translateX(-50%); display: inline-flex; align-items: center; gap: 8px; background: #6D4C41; color: #fff; border: 0; border-radius: var(--r-pill); padding: 12px 20px; font-weight: 700; font-size: .92rem; box-shadow: 0 6px 18px rgba(0,0,0,.28); }
.fab svg { width: 20px; height: 20px; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.fab:hover { background: #5D4037; }
.rtypes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 12px; }
.rtype { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; background: #fff; border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 6px; }
.rtype b { font-size: .8rem; color: var(--ink); }
.rtype small { font-size: .68rem; color: var(--grey); line-height: 1.3; }
.rtype.on { border-color: #6D4C41; background: #F6F0EE; }
.info-box { border-radius: 12px; padding: 10px 14px; margin-bottom: 12px; background: #FFF4E5; }
.info-box p { font-size: .84rem; margin: 0; color: #5A3A00 !important; }
.info-box p b { color: #5A3A00; }
.info-box p.loading { color: var(--grey) !important; }
.info-box p.loading::before { content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 8px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -1px; }
.seg.blue { margin: 8px 0 4px; }
.seg.blue button { border-color: #BFD6EE; color: var(--blue); }
.seg.blue button.on { background: var(--blue); border-color: var(--blue); color: #fff; }
.linkbtn.inline { padding: 0; font-size: inherit; }
.tips.big { font-size: .86rem; color: var(--text); }
.tips.big li { margin-bottom: 4px; }
.picon.sm { width: 28px; height: 28px; }
.picon.sm svg { width: 15px; height: 15px; }
.rhead { display: flex; gap: 10px; align-items: center; }
.wrow { border-top: 1px solid var(--line); padding: 10px 0; }
.wrow:first-of-type { border-top: 0; }
.wrow.editing { background: var(--blue-pale); margin: 0 -8px; padding: 10px 8px; border-radius: 8px; }
.wtop { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; font-size: .85rem; }
.wtop .meta { color: var(--grey); font-size: .74rem; display: block; }
.wact { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.pop-actions { display: flex; gap: 6px; margin-top: 8px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.card input[type=datetime-local] { background: #fff; color: var(--text); border: 1px solid #BFC7D0; border-radius: var(--r-md); padding: 8px 8px; width: 100%; outline: none; font-size: .82rem; }
.badge-purple { background: #6A1B9A; color: #fff; }
.btn.btn-purple { background: #6A1B9A; color: #fff; }
.btn.btn-purple:hover { background: #561580; }
.mk-report.unconfirmed > span { border-style: dashed; }
.mk-wind { background: none; border: 0; pointer-events: none; display: flex; flex-direction: column; align-items: center; }
.wind-arrow { width: 40px; height: 40px; border-radius: 50%; background: rgba(106,27,154,.9); display: grid; place-items: center; box-shadow: 0 2px 8px rgba(0,0,0,.3); }
.wind-arrow svg { width: 24px; height: 24px; fill: none; stroke: #fff; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.wind-lbl { margin-top: 4px; background: rgba(255,255,255,.95); border-radius: 8px; padding: 3px 8px; font-size: .72rem; color: #4A148C; text-align: center; white-space: nowrap; box-shadow: 0 1px 4px rgba(0,0,0,.2); }
.wind-lbl b { display: block; font-size: .78rem; }

/* ---------- Contribute ---------- */
.btn-contribute { display: inline-flex; align-items: center; gap: 6px; background: var(--blue); color: #fff; border: 0; border-radius: var(--r-pill); padding: 7px 14px 7px 10px; font-weight: 700; font-size: .84rem; box-shadow: 0 2px 6px rgba(0,114,206,.3); }
.btn-contribute svg { width: 16px; height: 16px; fill: none; stroke: #fff; stroke-width: 2.6; stroke-linecap: round; }
.btn-contribute:hover { background: var(--blue-dark); }
.btn-contribute.active { background: var(--blue-deep); }
.btn-contribute .cb-n:not(:empty) { background: var(--red); border-radius: var(--r-pill); padding: 0 6px; font-size: .7rem; margin-left: 2px; }
.ktabs { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 6px; margin-bottom: 12px; }
.ktab { display: flex; flex-direction: column; align-items: center; gap: 4px; background: #fff; border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 6px; font-weight: 700; font-size: .8rem; color: var(--ink); }
.ktab svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ktab.issue { color: #C2410C; } .ktab.idea { color: #9A7400; } .ktab.tree { color: #6D4C41; }
.ktab span { color: var(--ink); }
.ktab.on { border-color: currentColor; background: color-mix(in srgb, currentColor 8%, #fff); box-shadow: 0 0 0 1px currentColor inset; }
.ccats { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.ccat { border: 1px solid var(--line); background: #fff; border-radius: var(--r-pill); padding: 5px 11px; font-size: .78rem; font-weight: 600; color: var(--text); }
.ccat.on { background: var(--c); border-color: var(--c); color: #fff; }
.ctag { display: inline-flex; align-items: center; gap: 6px; font-size: .76rem; font-weight: 700; color: var(--c); margin-top: 8px; }
.ctag svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.cstatus { display: inline-block; margin-top: 4px; padding: 3px 10px; border-radius: var(--r-pill); font-size: .76rem; font-weight: 700; background: var(--line); color: var(--text); }
.cstatus.s-new { background: #FFF1E6; color: #9A3412; }
.cstatus.s-seen { background: var(--blue-pale); color: var(--blue); }
.cstatus.s-planned, .cstatus.s-progress { background: var(--blue); color: #fff; }
.cstatus.s-done { background: var(--green-light); color: var(--green); }
.btn-vote { border: 1.5px solid #7B3FA0; color: #7B3FA0; background: #fff; border-radius: var(--r-pill); padding: 8px 16px; font-weight: 800; font-size: .86rem; }
.btn-vote.on { background: #7B3FA0; color: #fff; }
.comments { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.cmt { background: #f5f7f9; border-radius: 12px; padding: 8px 12px; font-size: .84rem; }
.cmt b { font-size: .8rem; color: var(--ink); margin-right: 6px; }
.cmt span { font-size: .72rem; color: var(--grey); }
.cmt p { margin: 2px 0 0 !important; color: var(--text) !important; font-size: .84rem !important; }
.cmt.city { background: var(--blue-pale); border-left: 3px solid var(--blue); }
.small-cmt { margin-top: 8px; }
.cform { display: flex; gap: 6px; margin-top: 8px; align-items: center; }
.cform input { flex: 1; min-width: 0; }
.card .cform input { border: 1px solid #BFC7D0; border-radius: var(--r-md); padding: 7px 10px; font-size: .82rem; }
.status-sel { width: auto !important; font-size: .76rem; padding: 5px 30px 5px 10px !important; border-radius: var(--r-pill) !important; border: 1px solid #BFD6EE !important; background-color: #fff; flex-shrink: 0; }
.mk-contrib .vbadge { position: absolute; top: -6px; right: -10px; background: #7B3FA0; color: #fff; font-style: normal; font-size: .62rem; font-weight: 800; border-radius: 9px; padding: 1px 5px; border: 1.5px solid #fff; }
.mk-contrib.done > span { opacity: .55; }
.mk-contrib { position: relative; }

/* ---------- Legend (municipality) ---------- */
.legend { position: absolute; right: 64px; bottom: 22px; z-index: 1050; background: #fff; border-radius: var(--r-md); padding: 10px 12px; font-size: .72rem; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; color: var(--text); box-shadow: var(--shadow); }
.legend div { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.legend .mk { width: 16px; height: 16px; font-size: .6rem; box-shadow: none; flex-shrink: 0; }
.legend .mk-user { width: 12px; height: 12px; }
.lg { width: 14px; height: 14px; border-radius: 50%; background: var(--c); flex-shrink: 0; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.15); }
.lg.sq { border-radius: 4px; opacity: .85; }

/* ---------- Map markers ---------- */
.mk { display: grid; place-items: center; border-radius: 50%; font-weight: 700; font-size: .7rem; font-family: var(--font); box-shadow: 0 1px 4px rgba(0,0,0,.3); border: 2px solid #fff; line-height: 1; }
.mk-poi { background: transparent !important; border: 0 !important; box-shadow: none !important; }
.mk-poi > span { width: 100%; height: 100%; border-radius: 50%; background: var(--c); display: grid; place-items: center; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35); }
.mk-poi svg { width: 58%; height: 58%; fill: none; stroke: #fff; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.mk-poi.soon > span { opacity: .7; }
.mk-poi.hl > span { outline: 3px solid rgba(26,115,232,.45); }
.mk-shelter-poi.target > span { animation: pulse-b 1.6s infinite; }
.mk-pin { background: none; border: 0; }
.mk-pin > span { position: absolute; left: 0; top: 0; width: 34px; height: 34px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--c); border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.35); display: grid; place-items: center; }
.mk-pin svg { width: 17px; height: 17px; transform: rotate(45deg); fill: none; stroke: #fff; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.mk-user { background: #1A73E8; border: 3px solid #fff; box-shadow: 0 0 0 7px rgba(26,115,232,.18), 0 1px 4px rgba(0,0,0,.35); }
.mk-fleet { background: #D5DBE1; color: #333; }
.mk-fleet.on { background: var(--blue-deep); color: #fff; }
.mk.acc { border-radius: 6px; }
.mk-listing { background: #fff; color: var(--grey); border: 2px dashed var(--grey); }
.mk-listing.active { border-style: solid; border-color: var(--blue); color: var(--blue); }
.mk-listing.claimed { background: var(--blue); color: #fff; border-color: var(--blue); }
.mk-vol { background: #fff; color: var(--green); border: 2px solid var(--green); }
.mk-vol.busy { opacity: .45; }
.mk-req { background: var(--red); color: #fff; }
.mk-req.matched { background: #fff; color: var(--red); border-color: var(--red); }
path.hz-flood { animation: flood-pulse 3s ease-in-out infinite; }
@keyframes flood-pulse { 0%,100% { fill-opacity: .3; } 50% { fill-opacity: .45; } }

/* ---------- Toast ---------- */
.toast { position: fixed; top: calc(var(--header-h) + 14px); left: 50%; transform: translateX(-50%); z-index: 2000; background: var(--ink); color: #fff; padding: 10px 18px; border-radius: var(--r-pill); font-weight: 700; font-size: .9rem; box-shadow: var(--shadow-lg); max-width: 90vw; text-align: center; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  #resetBtn { display: none; }
  .legend { display: none; }
}
@media (max-width: 860px) {
  :root { --panel-w: auto; }
  .topbar-row { height: auto; padding: 8px 12px; flex-wrap: wrap; gap: 8px; }
  .brand { flex: 1; }
  .portals { order: 3; width: 100%; }
  .portal-tab { flex: 1; }
  .logo { margin-left: 0; padding-left: 10px; height: 30px; }
  .logo img { height: 26px; }
  .logo-left { padding-left: 0; }
  .logo-left img { height: 26px; }
  .pill { font-size: .72rem; padding: 5px 9px; max-width: 150px; }
  .btn-contribute { padding: 6px 10px 6px 8px; font-size: .78rem; }
  .subtabs { padding: 0 8px; height: 42px; }
  .c-top { right: var(--gap); flex-direction: column; align-items: stretch; gap: 8px; }
  .searchbar { width: auto; height: 48px; }
  .chips { padding-right: 2px; }
  .chips-more { display: none; }
  .chip { height: 34px; font-size: .84rem; }
  .alert-banner { top: calc(var(--gap) + 104px); right: var(--gap); width: auto; }
  .cpanel, body.has-alert .cpanel { top: auto; bottom: 0; left: 0; right: 0; width: auto; max-height: 56%; border-radius: 18px 18px 0 0; box-shadow: 0 -4px 20px rgba(0,0,0,.18); padding-top: 14px; }
  .cpanel::before { content: ""; position: absolute; top: 6px; left: 50%; transform: translateX(-50%); width: 36px; height: 4px; border-radius: 2px; background: #d0d0d0; }
  .phead { top: -14px; }
  .gov-panel { top: auto; bottom: 0; left: 0; right: 0; width: auto; max-height: 58%; border-radius: 18px 18px 0 0; }
  .leaflet-control-zoom { display: none; }
  .home-card { left: 0; right: 0; bottom: 0; width: auto; border-radius: 18px 18px 0 0; }
  .fab { bottom: 18px; }
  .grid3 { grid-template-columns: 1fr 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .protos { grid-template-columns: 1fr 1fr; }
}
