/* BH v4: bairro map with an explicit failure state. */
.territory-layout{display:grid;grid-template-columns:minmax(0,1.65fr) minmax(280px,.72fr);gap:14px;align-items:stretch}
.map-shell{height:min(66vh,640px);min-height:460px}
.map-shell svg{touch-action:auto}
.map-feature{stroke:#06182b;stroke-width:.62;vector-effect:non-scaling-stroke}
.map-feature.level-0{fill:#32445a}
.map-feature.level-1,.legend-step.step-1{fill:#0e473b;background:#0e473b}
.map-feature.level-2,.legend-step.step-2{fill:#11694c;background:#11694c}
.map-feature.level-3,.legend-step.step-3{fill:#1b8e59;background:#1b8e59}
.map-feature.level-4,.legend-step.step-4{fill:#24b96d;background:#24b96d}
.map-feature.level-5,.legend-step.step-5{fill:#35e18a;background:#35e18a}
.map-feature:hover,.map-feature:focus-visible,.map-feature.selected{fill:#f4b84a;stroke:#fff2cd;stroke-width:1.6}
.map-feature.search-match:not(.selected){fill:#4b91ff;stroke:#bde8ff;stroke-width:1.1}
.map-feature.dim:not(.selected){opacity:.19}
.map-toolbar{justify-content:space-between}
.map-toolbar label.search-wrap{font-size:12px;letter-spacing:0}
.map-toolbar input{width:min(410px,60vw)}
.search-status{color:#8399b5;font-size:11px}
.map-legend{display:flex;align-items:center;gap:5px;flex-wrap:wrap;color:#8399b5;font-size:11px;margin:12px 0 0}
.map-legend span:first-child{margin-right:8px;color:#aebed0}
.map-legend span:last-child{margin-left:7px}
.legend-step{display:inline-block;width:25px;height:11px;border-radius:3px}
.territory-detail{min-height:460px;border:1px solid #19304a;border-radius:11px;background:linear-gradient(145deg,#0c1d32,#081626);padding:23px;display:flex;flex-direction:column;align-items:stretch;gap:10px}
.territory-detail .origin-badge{align-self:flex-start}
.territory-detail h2{margin:4px 0 0;color:#f3f7fb;font-size:22px;line-height:1.25}
.territory-detail p{margin:0;color:#8399b5;font-size:12px;line-height:1.55}
.territory-detail .detail-subhead{margin-bottom:5px}
.territory-metric{border:1px solid #19304a;border-radius:8px;background:#0d2338;padding:11px 13px}
.territory-metric>span{display:block;color:#a5b8c9;font-size:11px}
.territory-metric>strong{display:block;color:#f3f7fb;font-size:22px;margin:5px 0;font-variant-numeric:tabular-nums}
.territory-metric>small{display:block;color:#758da7;font-size:9px;letter-spacing:.04em}
.detail-species{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.detail-species .territory-metric>strong{font-size:17px}
.territory-detail .detail-method{margin:3px 0;color:#deb875;font-size:11px}
.territory-detail a{margin-top:auto}
.territory-explainer{background:#13263a;border-left:3px solid #f4b84a;border-radius:5px;color:#9fb4c5;font-size:12px;line-height:1.6;padding:15px 18px;margin-top:15px}
.territory-explainer strong{color:#f3f7fb}
.city-trend{display:flex;flex-direction:column;gap:12px;margin:20px 0}
.trend-row{display:grid;grid-template-columns:42px 1fr 75px;gap:12px;align-items:center;color:#9fb4c5;font-size:12px}
.trend-track{height:13px;background:#132c40;border-radius:7px;overflow:hidden}
.trend-fill{height:100%;border-radius:7px;background:linear-gradient(90deg,#167552,#28df82)}
.trend-row strong{text-align:right;color:#f3f7fb}
@media(max-width:1000px){.territory-layout{grid-template-columns:1fr}.territory-detail{min-height:0}.map-shell{height:min(62vh,580px)}}
@media(max-width:600px){.map-toolbar label.search-wrap{width:100%}.map-toolbar input{width:100%;flex:1}.map-shell{min-height:410px;height:58vh}.territory-detail{padding:18px}.search-status{width:100%}}
.map-error{display:flex;flex-direction:column;align-items:center;gap:10px;text-align:center;padding:24px;color:#dcebe6}
.map-error strong{font-size:17px}
.map-error span{font-size:12px;color:#a5b8c9}
.map-error button{margin-top:6px;padding:10px 15px;border:1px solid #28d985;border-radius:7px;background:#123c38;color:#e8fff2;font-weight:700}
.map-error button:hover,.map-error button:focus-visible{background:#17604c}
/* V5: controls above the existing map, with no map geometry or layout changes. */
.territory-filter-panel{margin:22px 0 13px;padding:18px 20px;background:#10263b;border:1px solid #29485d;border-radius:11px}
.filter-heading{display:flex;justify-content:space-between;align-items:center;gap:15px;flex-wrap:wrap}
.filter-heading h2{font-size:19px;margin:4px 0 0;color:#f3f7fb}
.filter-model-tag{font-size:10px;color:#e8c886;background:#3a3029;border-radius:20px;padding:7px 11px}
.territory-filter-panel .map-toolbar{display:grid;grid-template-columns:minmax(150px,1fr) minmax(145px,1fr) minmax(180px,1.35fr) auto;gap:12px;align-items:end;margin:17px 0 10px}
.territory-filter-panel .filter-field{display:flex;flex-direction:column;align-items:stretch;gap:7px;min-width:0;color:#a5b8c9;font-size:10px;letter-spacing:.1em}
.territory-filter-panel .filter-field select,.territory-filter-panel .filter-field input{width:100%;height:44px;min-height:44px;font-size:12px;letter-spacing:0;background:#0a1b2d;color:#f0f7f4;border:1px solid #34576b;border-radius:8px;padding:0 12px}
.territory-filter-panel .filter-field input::placeholder{color:#8399b5}
.territory-filter-panel .reset-filters{height:44px;white-space:nowrap;background:transparent;border:1px solid #34576b;border-radius:8px;color:#c2d5e1;padding:0 12px;font-size:11px}
.territory-filter-panel .reset-filters:hover,.territory-filter-panel .reset-filters:focus-visible{border-color:#35e18a;color:#f3f7fb}
.filter-summary{display:flex;justify-content:space-between;flex-wrap:wrap;gap:8px;color:#a8becb;font-size:11px;line-height:1.5}
.filter-summary #filter-total{color:#d4e7d8;font-weight:700}
@media(max-width:840px){.territory-filter-panel .map-toolbar{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:540px){.territory-filter-panel{padding:15px}.territory-filter-panel .map-toolbar{grid-template-columns:1fr}.territory-filter-panel .map-toolbar .filter-field{width:100%}.territory-filter-panel .filter-field input{width:100%}.territory-filter-panel .reset-filters{width:100%}}

.filter-footnote{margin:9px 0 0;color:#8399b5;font-size:10px;line-height:1.5}
