:root {
  color-scheme: dark;
  --bg: #0a1120;
  --surface: #0e182a;
  --surface-2: #111d31;
  --surface-3: #15243b;
  --border: #22314a;
  --border-soft: #1b2940;
  --text: #edf3fc;
  --muted: #8e9eb5;
  --subtle: #9aa9bf;
  --blue: #5597ff;
  --blue-strong: #367cf5;
  --blue-soft: rgba(74,140,247,.12);
  --green: #3ed5a2;
  --teal: var(--green);
  --green-soft: rgba(62,213,162,.10);
  --amber: #f6bd65;
  --amber-soft: rgba(246,189,101,.10);
  --red: #f47f85;
  --red-soft: rgba(244,127,133,.11);
  --radius: 10px;
}

* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: "Segoe UI", Arial, sans-serif; font-size: 13px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button, input, select { color: inherit; }
button { border: 0; }
button svg, a svg, .toolbar svg, .demo-notice>svg { width: 17px; height: 17px; flex: none; }
svg { display: block; }
a { color: inherit; text-decoration: none; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 4px; }
button, a, select { transition: color .18s ease, background .18s ease, border-color .18s ease, transform .18s ease; }
button:disabled { cursor: default; opacity: .45; }
button:active:not(:disabled) { transform: translateY(1px); }
select { padding: 9px 30px 9px 11px; border: 1px solid var(--border); border-radius: 6px; background-color: var(--surface-2); }
option { background: var(--surface); color: var(--text); }
input { min-width: 0; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px; }
input::placeholder { color: var(--subtle); }
input:focus, select:focus { border-color: var(--blue); }
input[type=checkbox] { accent-color: var(--blue); width: 16px; height: 16px; cursor: pointer; }
.shell { width: calc(100% - 88px); max-width: 1460px; margin: 0 auto; }
.skip { position: fixed; z-index: 100; left: 16px; top: -60px; padding: 12px 20px; background: var(--blue-strong); border-radius: 5px; }
.skip:focus { top: 12px; }

/* Identity and navigation */
.app-header { background: #0d1728; border-bottom: 1px solid var(--border); }
.header-main { display: flex; align-items: center; min-height: 87px; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 10px; letter-spacing: -1.7px; font-weight: 750; font-size: 31px; line-height: 1; }
.brand-dot { color: var(--green); }
.brand-mark { display: grid; place-items: center; width: 37px; height: 39px; color: var(--green); font-size: 37px; line-height: 1; letter-spacing: 0; }
.brand-caption { border-left: 1px solid var(--border); padding-left: 24px; font-size: 9px; line-height: 1.6; color: var(--muted); letter-spacing: 1.35px; }
.brand-caption b { color: #c4d0e1; font-weight: 600; }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 21px; }
.season { font-size: 12px; font-weight: 650; color: #c6d3e5; letter-spacing: .35px; }
.season>span { display: block; font-size: 10px; letter-spacing: 0; color: var(--subtle); font-weight: 400; margin-top: 1px; }
.icon-button { background: transparent; border: 1px solid var(--border); color: var(--muted); height: 34px; width: 34px; display: grid; place-items: center; border-radius: 7px; }
.icon-button:hover { background: var(--surface-3); color: var(--text); }
.profile { display: flex; align-items: center; gap: 10px; background: transparent; text-align: left; padding: 0 0 0 20px; border-left: 1px solid var(--border); font-size: 11px; font-weight: 600; }
.avatar { width: 34px; height: 34px; border: 1px solid #254e52; border-radius: 8px; background: var(--green-soft); color: var(--green); display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.profile small { display: block; color: var(--subtle); font-size: 10px; font-weight: 400; }
.profile-arrow { color: var(--subtle); margin-left: 12px; }
.main-nav { display: flex; gap: 32px; height: 57px; align-items: stretch; }
.main-nav>a { display: flex; gap: 9px; align-items: center; position: relative; font-size: 12px; color: var(--muted); font-weight: 550; white-space: nowrap; }
.main-nav>a svg { width: 16px; height: 16px; }
.main-nav>a:hover { color: var(--text); }
.main-nav>a.active { color: var(--green); }
.main-nav>a.active::after { position: absolute; height: 2px; background: var(--green); content: ""; left: 0; right: 0; bottom: -1px; border-radius: 3px 3px 0 0; }
.nav-count { min-width: 21px; padding: 1px 5px; border: 1px solid var(--border); border-radius: 4px; color: var(--muted); font-size: 9px; text-align: center; }
.context-line { display: flex; align-items: center; justify-content: space-between; gap: 20px; color: var(--subtle); font-size: 10px; padding-top: 22px; }
.crumb-sep { display: inline-block; margin: 0 10px; color: #3c4e67; }
#breadcrumb { color: var(--muted); }
.demo-label { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 9px; letter-spacing: .2px; }
.demo-label i { width: 5px; height: 5px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.page-heading { display: flex; justify-content: space-between; align-items: center; gap: 24px; margin: 27px 0 22px; }
.eyebrow { margin: 0 0 6px; font-size: 9px; font-weight: 650; color: var(--green); letter-spacing: 1.8px; }
h1 { font-size: clamp(24px, 2.35vw, 36px); font-weight: 730; line-height: 1.18; letter-spacing: -1.1px; margin: 0; }
.page-subtitle { color: var(--muted); font-size: 11px; margin: 9px 0 0; }
.page-actions { display: flex; gap: 9px; align-items: center; padding-top: 14px; flex-shrink: 0; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 6px; min-height: 35px; padding: 8px 13px; font-weight: 550; font-size: 10px; white-space: nowrap; border: 1px solid transparent; }
.button.primary { background: var(--blue-strong); color: white; border-color: #4488fa; box-shadow: 0 3px 12px rgba(12,76,180,.14); }
.button.primary:hover { background: #478eff; }
.button.secondary { background: var(--surface); border-color: var(--border); color: #b5c2d5; }
.button.secondary:hover { background: var(--surface-3); border-color: #3a5272; }
.button svg { width: 14px; height: 14px; }
.button.small { min-height: 29px; padding: 5px 10px; font-size: 10px; }
.demo-notice { display: flex; align-items: center; gap: 9px; padding: 9px 12px; border: 1px solid #213754; background: rgba(55,119,212,.055); border-radius: 6px; color: #8ea6c5; font-size: 10px; margin-bottom: 21px; }
.demo-notice>svg { color: var(--blue); width: 14px; height: 14px; }
.demo-notice b { font-weight: 600; color: #b9cee9; }
.notice-tag { margin-left: auto; border: 1px solid #2c4361; color: #87a4ca; font-size: 8px; padding: 2px 6px; border-radius: 3px; letter-spacing: 1px; }
.toolbar { display: flex; gap: 20px; align-items: center; padding-bottom: 22px; margin-bottom: 0; }
.toolbar-label { display: block; font-size: 9px; color: var(--subtle); margin-bottom: 6px; }
.date-control { min-width: 193px; }
.select-wrap { display: flex; align-items: center; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); gap: 8px; padding-left: 11px; }
.select-wrap svg { color: var(--muted); width: 14px; height: 14px; }
.select-wrap select { border: none; border-radius: 6px; background: transparent; padding-left: 0; width: 100%; font-size: 11px; }
.compare-control { min-width: 190px; }
.compare-control select { background: var(--surface); width: 100%; font-size: 11px; }
.sample-time { margin-left: auto; display: flex; gap: 9px; align-items: center; font-size: 10px; color: var(--muted); }
.sample-time>svg { width: 15px; height: 15px; color: var(--subtle); }
.sample-time b { color: #d0dceb; font-weight: 650; margin-left: 4px; }
.sample-time small { display: block; color: var(--subtle); margin-top: 1px; font-size: 9px; }
.scope-control { min-width: 220px; width: 240px; }
.scope-control>label { display: block; font-size: 9px; color: var(--subtle); margin-bottom: 6px; }
.scope-control select { width: 100%; font-size: 11px; background: var(--surface); }

/* Province and district overview */
.regional-panel { margin-bottom: 24px; }
.regional-summary { display: flex; gap: 20px; flex-wrap: wrap; padding: 0 20px 17px; color: var(--muted); font-size: 10px; line-height: 1.6; }
.regional-summary>span, .regional-summary>div { display: inline-flex; align-items: center; gap: 6px; }
.regional-summary b, .regional-summary strong { color: var(--text); font-weight: 600; }
.district-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; padding: 0 20px 20px; }
.district-card { display: block; text-align: left; position: relative; width: 100%; min-width: 0; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); color: var(--text); padding: 15px 16px 13px; }
button.district-card:hover { background: var(--surface-3); border-color: #3d5b81; transform: translateY(-2px); }
.district-card.active { background: var(--blue-soft); border-color: var(--blue); box-shadow: inset 0 0 0 1px rgba(85,151,255,.1); }
.district-name { display: block; color: var(--text); font-size: 12px; line-height: 1.4; font-weight: 600; padding-right: 15px; }
.district-name::after { content: "↗"; position: absolute; right: 14px; top: 14px; color: var(--subtle); font-size: 12px; font-weight: 400; }
.district-counts { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; font-size: 9px; color: var(--muted); margin-top: 6px; }
.district-counts span { display: inline-flex; align-items: center; gap: 4px; }
.district-counts b { color: var(--text); font-weight: 550; }
.district-metric { margin-top: 16px; display: flex; align-items: baseline; gap: 4px; font-variant-numeric: tabular-nums; color: var(--text); font-size: 24px; font-weight: 650; line-height: 1.2; letter-spacing: -.6px; }
.district-metric b, .district-metric strong { font: inherit; }
.district-metric small, .district-metric .stat-unit { color: var(--subtle); font-size: 11px; font-weight: 400; letter-spacing: 0; }
.district-card.warning .district-metric { color: var(--amber); }
.district-card.offline .district-metric { color: var(--subtle); }
.district-bar { display: flex; gap: 3px; height: 4px; border-radius: 5px; overflow: hidden; background: var(--border); margin: 13px 0 9px; }
.district-bar>span, .district-bar>i { display: block; height: 100%; border-radius: 2px; background: var(--green); }
.district-bar>.warning { background: var(--amber); }
.district-bar>.offline { background: #64768f; }
.district-caption { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 8px; color: var(--subtle); line-height: 1.6; }
.district-caption .status { font-size: 7px; padding: 2px 4px; }
.district-table { margin: 0 0 22px; }
.district-table td, .district-table th { font-variant-numeric: tabular-nums; }
.district-table .district-name { font-size: 11px; padding-right: 0; }
.district-table .district-name::after { display: none; }

/* Metric cards */
.stats-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 15px; margin-bottom: 22px; }
.stat-card { border: 1px solid var(--border); border-radius: var(--radius); background: linear-gradient(120deg,var(--surface-2),var(--surface)); padding: 18px 19px 14px; position: relative; overflow: hidden; }
.stat-card::after { position: absolute; content: ""; width: 65px; height: 65px; border-radius: 50%; right: -33px; top: -33px; background: rgba(77,148,255,.025); }
.stat-card:hover { border-color: #354c6c; }
.stat-icon { width: 30px; height: 30px; border-radius: 7px; background: var(--blue-soft); color: var(--blue); display: inline-grid; place-items: center; position: absolute; top: 17px; right: 17px; }
.stat-icon svg { width: 16px; height: 16px; }
.stat-card:nth-child(2) .stat-icon { background: var(--green-soft); color: var(--green); }
.stat-card:nth-child(3) .stat-icon { background: var(--amber-soft); color: var(--amber); }
.stat-card:nth-child(4) .stat-icon { background: var(--red-soft); color: var(--red); }
.stat-label { display: block; padding-right: 30px; font-size: 10px; color: #a5b3c7; font-weight: 500; }
.stat-value { font-size: 32px; letter-spacing: -1px; font-weight: 650; line-height: 1.3; margin: 10px 0 13px; font-variant-numeric: tabular-nums; }
.stat-unit { margin-left: 5px; font-size: 15px; color: var(--muted); font-weight: 400; letter-spacing: 0; }
.stat-foot { font-size: 9px; color: var(--subtle); display: flex; flex-wrap: wrap; align-items: center; gap: 6px; border-top: 1px solid var(--border-soft); padding-top: 10px; }
.stat-change { display: inline-flex; gap: 3px; align-items: center; font-size: 9px; font-weight: 600; }
.stat-change svg { width: 12px; height: 12px; }
.positive, .trend-up { color: var(--green); }
.negative, .trend-down { color: var(--red); }
.muted { color: var(--muted); }

/* Panels, chart and alerts */
.overview-grid { display: grid; grid-template-columns: minmax(0,1fr) 326px; gap: 18px; margin-bottom: 24px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; min-width: 0; }
.panel-head { display: flex; align-items: center; gap: 12px; justify-content: space-between; padding: 18px 20px; }
.panel-title { font-size: 12px; font-weight: 600; color: #e0e9f6; margin: 0; letter-spacing: -.15px; }
.panel-subtitle { font-size: 9px; color: var(--subtle); margin: 4px 0 0; }
.panel-actions { display: flex; align-items: center; gap: 11px; margin-left: auto; flex-shrink: 0; }
.panel-actions button:not(.button) { display: inline-flex; align-items: center; background: transparent; padding: 4px; color: var(--muted); }
.panel-actions svg { width: 15px; height: 15px; }
.panel-body { padding: 0 20px 20px; }
.chart-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; font-size: 9px; color: var(--muted); }
.chart-legend>span { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; flex: none; }
.legend-dot.blue { background: var(--blue); }
.legend-dot.teal { background: var(--green); }
.legend-dot.amber { background: var(--amber); }
.legend-dot.gray { background: var(--subtle); }
.chart-select { border-radius: 5px; background: var(--surface-2); font-size: 9px; padding: 5px 24px 5px 8px; }
.chart-wrap { padding: 9px 18px 15px 13px; min-width: 0; }
.chart-wrap svg { width: 100%; height: auto; overflow: visible; }
.chart-wrap svg text { font-family: "Segoe UI", Arial, sans-serif; }
.chart-wrap svg .grid-line { stroke: var(--border-soft); }
.chart-wrap svg .chart-grid { stroke: var(--border-soft); stroke-dasharray: 3 5; }
.chart-wrap svg .chart-label { fill: var(--subtle); }
.panel>.chart-legend { padding: 0 20px; }
.period-tabs { margin-left: auto; display: inline-flex; padding: 2px; border-radius: 5px; background: var(--bg); border: 1px solid var(--border-soft); }
.period-tabs button { background: transparent; color: var(--subtle); border-radius: 3px; font-size: 8px; padding: 4px 8px; white-space: nowrap; }
.period-tabs button.active { color: #b9d4fc; background: var(--surface-3); }
.chart-foot { border-top: 1px solid var(--border-soft); padding: 11px 20px; display: flex; justify-content: space-between; gap: 12px; font-size: 8px; color: var(--subtle); line-height: 1.6; }
.chart-footer { border-top: 1px solid var(--border-soft); padding: 11px 20px; display: flex; justify-content: space-between; gap: 12px; font-size: 9px; color: var(--subtle); }
.chart-footer b { color: var(--muted); font-weight: 550; }
.alert-list { padding: 0 17px 4px; }
.alert-item { display: flex; gap: 10px; padding: 15px 0; border-top: 1px solid var(--border-soft); align-items: flex-start; }
button.alert-item { width: 100%; background: transparent; text-align: left; color: inherit; }
button.alert-item:hover .alert-content b { color: var(--blue); }
.alert-item:first-child { border-top: 0; padding-top: 5px; }
.alert-icon { width: 28px; height: 28px; border-radius: 7px; color: var(--amber); background: var(--amber-soft); display: grid; place-items: center; flex: none; }
.alert-icon svg { width: 14px; height: 14px; }
.alert-icon.danger, .alert-icon.offline { background: var(--red-soft); color: var(--red); }
.alert-icon.success, .alert-icon.normal { background: var(--green-soft); color: var(--green); }
.alert-content { min-width: 0; flex: 1; }
.alert-content h3, .alert-content strong { display: block; font-size: 10px; color: #d8e3f2; font-weight: 550; margin: 0 0 3px; }
.alert-content>b { display: block; font-size: 10px; color: #d8e3f2; font-weight: 550; margin: 0 0 3px; }
.alert-content>span { display: block; font-size: 9px; color: var(--muted); margin: 0; line-height: 1.6; }
.alert-content>small { color: var(--subtle); font-size: 8px; display: block; margin-top: 5px; }
.alert-content p { font-size: 9px; color: var(--muted); margin: 0; line-height: 1.6; }
.alert-time { color: var(--subtle); font-size: 8px; display: block; margin-top: 5px; }
.alert-badge { background: var(--amber-soft); color: var(--amber); border: 1px solid rgba(246,189,101,.14); border-radius: 4px; padding: 2px 5px; font-size: 8px; white-space: nowrap; }
.alert-badge.offline { color: var(--red); background: var(--red-soft); border-color: rgba(244,127,133,.14); }
.alert-footer { display: block; width: 100%; padding: 11px 18px; border-top: 1px solid var(--border-soft); font-size: 9px; color: var(--blue); background: rgba(67,128,225,.035); text-align: center; }
.alert-footer:hover { background: var(--blue-soft); }
.panel-bottom-link { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 18px; border-top: 1px solid var(--border-soft); font-size: 9px; color: var(--blue); background: rgba(67,128,225,.035); }
.panel-bottom-link svg { height: 12px; width: 12px; }
.panel-bottom-link:hover { background: var(--blue-soft); }
.status>i { display: none; }
.status-dot { display: inline-block; width: 5px; height: 5px; border-radius: 50%; flex: none; }
.status-dot.normal { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.status-dot.warning { background: var(--amber); box-shadow: 0 0 0 3px var(--amber-soft); }
.status-dot.offline { background: var(--subtle); box-shadow: 0 0 0 3px rgba(128,146,169,.1); }
.status { display: inline-flex; align-items: center; gap: 5px; padding: 3px 6px; font-size: 8px; border-radius: 4px; font-weight: 500; line-height: 1.4; white-space: nowrap; }
.status::before { content: ""; width: 4px; height: 4px; border-radius: 50%; background: currentColor; }
.status.normal { color: var(--green); background: var(--green-soft); }
.status.warning { color: var(--amber); background: var(--amber-soft); }
.status.offline { color: #9aa9bd; background: rgba(128,146,169,.12); }

/* Individual institutions and territory */
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 15px; margin: 0 0 13px; }
.section-heading h2 { font-size: 13px; font-weight: 600; margin: 0; }
.section-heading p { color: var(--subtle); font-size: 9px; margin: 4px 0 0; }
.section-heading>div>.muted { font-size: 9px; display: block; margin-top: 3px; color: var(--subtle); }
.section-link { color: var(--blue); font-size: 10px; display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; background: transparent; padding: 0; }
.section-link svg { width: 13px; height: 13px; }
.section-link:hover { color: #93baff; }
.institution-grid { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); gap: 11px; margin-bottom: 24px; }
.institution-mini { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 13px 12px; text-align: left; min-width: 0; position: relative; }
button.institution-mini { width: 100%; }
.institution-mini:hover { background: var(--surface-2); border-color: #3b5474; transform: translateY(-2px); }
.institution-mini.warning { border-top: 2px solid rgba(246,189,101,.65); padding-top: 12px; }
.institution-mini.offline { border-top: 2px solid #55647b; padding-top: 12px; }
.institution-mini>b { display: block; font-size: 10px; color: #bdcbdf; font-weight: 500; margin-bottom: 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-top { display: flex; justify-content: space-between; gap: 5px; align-items: center; margin-bottom: 12px; }
.mini-top .status { padding: 0; font-size: 7px; background: transparent; }
.mini-icon { color: var(--muted); }
.mini-icon svg { width: 16px; height: 16px; }
.mini-temp { color: var(--text); font-size: 23px; line-height: 1.2; letter-spacing: -.65px; font-weight: 600; white-space: nowrap; }
.institution-mini>.mini-temp { display: block; }
.mini-temp .stat-unit { font-size: 11px; margin-left: 1px; color: var(--subtle); }
.mini-temp small { color: var(--subtle); font-size: 11px; font-weight: 400; margin-left: 3px; }
.institution-mini.warning .mini-temp { color: var(--amber); }
.institution-mini.offline .mini-temp { color: var(--subtle); }
.mini-caption { font-size: 9px; margin-top: 6px; color: var(--muted); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-caption small { display: block; font-size: 8px; color: var(--subtle); margin-top: 2px; }
.bottom-grid { display: grid; grid-template-columns: 1.05fr 1fr; gap: 18px; margin-bottom: 22px; }
.map-layout { display: grid; grid-template-columns: 1fr 148px; align-items: center; gap: 18px; padding: 0 20px 17px; min-height: 224px; }
.map-layout:has(>.city-map:only-child) { display: block; padding: 0 16px 4px; min-height: 0; }
.city-map { min-width: 0; }
.city-map svg { width: 100%; height: 224px; color: #32455f; }
.city-map svg text { font-family: "Segoe UI", Arial, sans-serif; }
.city-map svg .map-outline { fill: var(--surface-2); stroke: #2c4260; }
.city-map svg .map-land { fill: #14253a; stroke: #2b415e; stroke-width: 1.5; }
.city-map svg .map-river { fill: none; stroke: #204666; stroke-width: 16; opacity: .55; }
.city-map svg .map-road { fill: none; stroke: #30435d; stroke-width: 4; stroke-linecap: round; }
.city-map svg .map-city { fill: #5a708f; font-size: 14px; letter-spacing: 4px; font-weight: 600; text-anchor: middle; }
.city-map svg .map-note { fill: var(--subtle); font-size: 10px; }
.map-pin { cursor: pointer; }
.map-pin circle { fill: #14372e; stroke: var(--green); stroke-width: 1.5; }
.map-pin text { fill: #a6edcf; font-size: 10px; font-weight: 600; }
.map-pin.warning circle { fill: #493821; stroke: var(--amber); }
.map-pin.warning text { fill: #f4d3a1; }
.map-pin.offline circle { fill: #263348; stroke: #72849f; }
.map-pin.offline text { fill: #afbed1; }
.map-pin:hover circle, .map-pin:focus circle { stroke-width: 3; }
.map-pin:focus { outline: none; }
.panel>.map-key { padding: 0 20px 12px; }
.map-summary { border-left: 1px solid var(--border-soft); padding-left: 20px; font-size: 10px; color: var(--muted); }
.map-summary>div { margin-bottom: 17px; }
.map-summary strong { display: block; font-size: 22px; line-height: 1.2; font-weight: 600; color: var(--text); letter-spacing: -.4px; }
.map-summary small { color: var(--subtle); font-size: 9px; }
.map-key { font-size: 8px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 9px; align-items: center; }
.map-key span { display: flex; gap: 5px; align-items: center; }
.map-note { font-size: 8px; color: var(--subtle); margin: 4px 0 0; }
.ranking-list { padding: 0 20px 13px; }
.rank-item { display: flex; align-items: center; gap: 11px; padding: 12px 0; border-top: 1px solid var(--border-soft); }
button.rank-item { width: 100%; background: transparent; color: inherit; text-align: left; }
button.rank-item:hover .rank-name>b { color: var(--blue); }
.rank-item:first-child { border-top: 0; padding-top: 5px; }
.rank-index { width: 17px; font-size: 9px; color: var(--subtle); font-variant-numeric: tabular-nums; flex: none; }
.rank-name { font-size: 10px; color: #b4c3d7; width: 101px; flex: none; }
.rank-name small { display: block; color: var(--subtle); font-size: 8px; margin-top: 2px; }
.rank-item>.rank-name { flex: 1; width: auto; min-width: 0; }
.rank-name>b { display: block; font-size: 10px; font-weight: 500; margin-bottom: 7px; }
.rank-name>.rank-meter { display: block; height: 4px; }
.rank-meter { height: 5px; background: #192a40; flex: 1; border-radius: 6px; overflow: hidden; min-width: 20px; }
.rank-meter>span, .rank-meter>i { display: block; height: 100%; background: linear-gradient(90deg,#3473b5,#56b2de); border-radius: inherit; }
.rank-value { font-size: 10px; width: 40px; text-align: right; color: #bdcde1; font-variant-numeric: tabular-nums; }

/* Tables and data controls */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 17px; }
.panel>.filters { padding: 0 20px; gap: 8px; }
.panel>.filters .search-box { min-width: 200px; }
.panel>.filters select { font-size: 10px; }
.text-button { color: var(--muted); background: transparent; }
.text-button:hover { color: var(--blue); background: var(--blue-soft); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.filters select { font-size: 11px; background: var(--surface); min-height: 37px; }
.search-box { display: flex; align-items: center; gap: 9px; min-width: 240px; max-width: 440px; flex: 1; padding: 0 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; }
.search-box>svg { width: 15px; height: 15px; color: var(--subtle); flex: none; }
.search-box input { border: 0; background: transparent; border-radius: 6px; padding: 10px 0; width: 100%; outline-offset: 5px; font-size: 11px; }
.search-box:focus-within { border-color: var(--blue); }
.table-wrap { overflow-x: auto; scrollbar-width: thin; scrollbar-color: #324965 transparent; }
table { width: 100%; border-collapse: collapse; font-size: 11px; text-align: left; white-space: nowrap; }
thead { background: rgba(18,32,51,.8); }
th { font-size: 9px; color: var(--muted); font-weight: 550; padding: 13px 18px; border-bottom: 1px solid var(--border); }
td { padding: 16px 18px; border-bottom: 1px solid var(--border-soft); color: #b9c7da; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(82,142,226,.035); }
td:first-child, th:first-child { padding-left: 20px; }
td:last-child, th:last-child { padding-right: 20px; }
.institution-name { font-weight: 550; color: #e0e9f6; font-size: 11px; }
.institution-name small, .institution-type { display: block; font-weight: 400; font-size: 9px; color: var(--subtle); margin-top: 3px; }
.institution-name .table-icon { display: inline-grid; place-items: center; width: 29px; height: 29px; border-radius: 6px; background: var(--blue-soft); color: var(--blue); float: left; margin-right: 10px; }
.table-icon svg { height: 15px; width: 15px; }
.temp-value { font-variant-numeric: tabular-nums; font-size: 13px; color: #e2ecfa; font-weight: 600; }
.temp-value.warning { color: var(--amber); }
.temp-value.negative { color: var(--amber); }
.temp-value small { font-size: 9px; color: var(--subtle); font-weight: 400; margin-left: 2px; }
.row-button { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); color: var(--muted); border-radius: 5px; background: transparent; font-size: 9px; padding: 5px 9px; }
.row-button svg { width: 12px; height: 12px; }
.row-button:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-soft); }
.row-button:has(.institution-name) { display: flex; flex-direction: column; align-items: flex-start; gap: 0; padding: 0; border-color: transparent; border-radius: 0; text-align: left; }
.row-button:has(.institution-name):hover { border-color: transparent; background: transparent; }
.row-button:has(.institution-name):hover .institution-name { color: var(--blue); }
.stale { display: block; color: var(--subtle); font-size: 8px; margin-top: 3px; }
.temp-value>.stat-unit { font-size: 9px; margin-left: 0; }
.table-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; border-top: 1px solid var(--border); padding: 13px 20px; color: var(--subtle); font-size: 10px; }
.table-footer .pagination { display: flex; gap: 5px; }
.table-footer button { padding: 4px 8px; border: 1px solid var(--border); border-radius: 4px; background: var(--surface-2); color: var(--muted); }
.table-footer button.active { background: var(--blue-soft); color: var(--blue); border-color: #345787; }
.summary-strip { display: flex; gap: 24px; flex-wrap: wrap; padding: 15px 20px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); margin-bottom: 18px; color: var(--muted); font-size: 10px; }
.summary-strip>span, .summary-strip>div { display: flex; align-items: center; gap: 6px; }
.summary-strip b { color: var(--text); font-size: 12px; font-weight: 600; }
.sparkline { width: 75px; height: 24px; overflow: visible; }
.sparkline svg { height: 24px; width: 75px; overflow: visible; }
.badge { color: var(--blue); background: var(--blue-soft); border: 1px solid rgba(85,151,255,.15); border-radius: 4px; font-size: 9px; padding: 3px 7px; display: inline-flex; align-items: center; gap: 5px; }
.subtle-tag { display: inline-flex; align-items: center; padding: 3px 7px; color: var(--subtle); border: 1px solid var(--border); border-radius: 4px; font-size: 8px; }

/* Reports, analysis and settings */
.analysis-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px; margin-bottom: 22px; }
.analysis-grid .panel.wide, .analysis-grid .full-width { grid-column: 1/-1; }
.comparison-bars { padding: 0 20px 18px; }
.comparison-row { width: 100%; background: transparent; display: flex; align-items: center; gap: 20px; padding: 12px 0; border-top: 1px solid var(--border-soft); text-align: left; }
.comparison-row:first-child { border-top: 0; }
.comparison-row>b { color: var(--muted); font-size: 10px; font-weight: 500; width: 105px; flex: none; }
.comparison-row:hover>b { color: var(--blue); }
.comparison-tracks { display: flex; flex: 1; gap: 4px; flex-direction: column; }
.comparison-tracks>i { display: block; height: 11px; border-radius: 2px; position: relative; font-style: normal; opacity: .85; }
.comparison-tracks>i>span { position: absolute; right: 5px; top: -1px; font-size: 10px; color: #071526; font-weight: 700; line-height: 12px; }
body.light .comparison-tracks>i>span { background: #e7f0fc; padding: 0 3px; border-radius: 2px; }
.rules-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; margin-bottom: 22px; }
.rules-grid:has(>.panel) { grid-template-columns: 1fr 1fr; align-items: start; }
.rules-grid.panel-body { grid-template-columns: repeat(2,minmax(0,1fr)); }
.rule-card { padding: 19px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.rule-card>svg, .rule-card>.rule-icon { width: 20px; height: 20px; color: var(--blue); margin-bottom: 15px; }
.rule-card h3 { margin: 0 0 7px; font-size: 12px; font-weight: 600; }
.rule-card p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.7; }
.rule-card .badge { margin-top: 12px; }
.role-list { padding: 0 20px 7px; }
.role-item { padding: 15px 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-top: 1px solid var(--border-soft); font-size: 11px; }
.role-item:first-child { border-top: 0; padding-top: 2px; }
.role-item strong { color: #d5e0ef; font-weight: 550; }
.role-item p, .role-item small { display: block; font-size: 9px; color: var(--subtle); margin: 4px 0 0; }
.role-item>b { font-size: 10px; min-width: 103px; font-weight: 550; }
.role-item>span:not(.badge) { font-size: 9px; color: var(--muted); line-height: 1.7; max-width: 230px; }
.panel-body>.save-row { padding: 17px 0 0; margin-top: 20px; gap: 8px; flex-wrap: wrap; }
.role-item>svg { width: 18px; height: 18px; color: var(--blue); }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px 24px; padding: 0 20px 21px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field>label, .field>span:first-child { color: var(--muted); font-size: 10px; }
.field input, .field select { width: 100%; font-size: 11px; padding: 10px 11px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; }
.field-help { color: var(--subtle); font-size: 11px; margin: 0; line-height: 1.7; }
.field.wide { grid-column: 1/-1; }
.save-row { border-top: 1px solid var(--border-soft); padding: 15px 20px; display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.save-row p { margin: 0; color: var(--subtle); font-size: 10px; }
.report-options { padding: 0 20px 20px; display: flex; gap: 15px; flex-wrap: wrap; }
.report-options label { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 10px; }
.empty-state { text-align: center; padding: 60px 25px; color: var(--muted); }
.empty-state>svg { width: 34px; height: 34px; color: var(--subtle); margin: 0 auto 15px; }
.empty-state h3 { color: var(--text); font-size: 14px; margin: 0 0 7px; }
.empty-state p { max-width: 360px; margin: 0 auto; font-size: 11px; line-height: 1.7; }
.empty-state .button { margin-top: 18px; }

/* Detail dialog and feedback */
#details { width: min(800px,calc(100% - 36px)); max-height: calc(100vh - 48px); border: 1px solid #324766; padding: 0; border-radius: 12px; background: var(--surface); color: var(--text); box-shadow: 0 25px 100px rgba(0,0,0,.45); overflow-y: auto; }
#details::backdrop { background: rgba(2,7,16,.76); backdrop-filter: blur(5px); }
.detail-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; padding: 25px; border-bottom: 1px solid var(--border); }
.detail-header h2 { margin: 5px 0 7px; font-size: 23px; letter-spacing: -.6px; line-height: 1.2; }
.detail-header .eyebrow { font-size: 8px; }
.detail-meta { color: var(--muted); font-size: 10px; margin: 5px 0 0; }
.detail-meta>span+span { margin-left: 14px; }
.close-button { display: grid; place-items: center; width: 30px; height: 30px; flex: none; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-2); color: var(--muted); }
.close-button:hover { color: var(--text); background: var(--surface-3); }
.close-button svg { width: 17px; height: 17px; }
.detail-stats { padding: 21px 25px; display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; }
.detail-stats:has(>div:nth-child(3):last-child) { grid-template-columns: repeat(3,minmax(0,1fr)); }
.detail-stats>div { padding: 12px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface-2); }
.detail-stats span, .detail-stats small { font-size: 9px; color: var(--subtle); display: block; }
.detail-stats strong, .detail-stats b { display: block; font-size: 23px; line-height: 1.4; margin-top: 5px; font-weight: 600; letter-spacing: -.5px; }
#detail-content>.panel { margin: 0 25px 24px; }
#detail-content>.chart-wrap { margin: 0 20px 18px; }
#detail-content>.detail-meta { margin: 0 25px 24px; }
#detail-content>.detail-meta:first-of-type { padding-top: 18px; margin-bottom: 0; }
#detail-content>.chart-legend { padding: 0 25px; }
#detail-content>.field-help { margin: 0 25px 24px; font-size: 11px; }
#detail-content>.demo-notice { margin: 18px 25px 0; }
.detail-notice { margin: 0 25px 23px; padding: 12px; background: var(--blue-soft); border-radius: 6px; color: var(--muted); font-size: 10px; }
#toast { position: fixed; bottom: 26px; left: 50%; z-index: 1000; transform: translate(-50%,12px); background: #183c35; color: #bff8e5; border: 1px solid #306b5b; padding: 12px 20px; border-radius: 8px; box-shadow: 0 8px 35px rgba(0,0,0,.2); font-size: 12px; max-width: calc(100% - 32px); width: max-content; opacity: 0; pointer-events: none; transition: opacity .2s,transform .2s; }
#toast.visible, #toast.show { opacity: 1; transform: translate(-50%,0); }
.footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; border-top: 1px solid var(--border-soft); padding: 20px 0 24px; margin-top: 29px; color: var(--subtle); font-size: 9px; }
.footer b { font-weight: 650; font-size: 14px; letter-spacing: -.5px; color: var(--muted); margin-right: 10px; }
.footer-dot { margin: 0 6px; }

/* Daylight theme */
body.light { color-scheme: light; --bg: #f3f6fa; --surface: #fff; --surface-2: #f8fafd; --surface-3: #edf3fa; --border: #dbe3ee; --border-soft: #e7ecf3; --text: #15253c; --muted: #64748b; --subtle: #5d6d83; --blue: #286bd5; --blue-strong: #3279e7; --blue-soft: rgba(50,121,231,.08); --green: #168765; --green-soft: rgba(22,135,101,.08); --amber: #b97b23; --amber-soft: rgba(185,123,35,.08); --red: #c9505c; --red-soft: rgba(201,80,92,.08); }
body.light .app-header { background: #fff; }
body.light .brand-caption b, body.light .season { color: #50617a; }
body.light .main-nav>a.active { color: var(--green); }
body.light .page-subtitle { color: #718096; }
body.light .demo-notice { background: #edf4ff; border-color: #d4e3f8; color: #6680a1; }
body.light .demo-notice b { color: #415f87; }
body.light .notice-tag { border-color: #c5d8f1; color: #728db2; }
body.light .sample-time b, body.light .panel-title, body.light .alert-content h3, body.light .alert-content strong, body.light .institution-name, body.light .temp-value, body.light .role-item strong { color: var(--text); }
body.light .alert-content>b { color: var(--text); }
body.light .institution-mini>b { color: #52647e; }
body.light .period-tabs button.active { color: var(--blue); }
body.light .button.secondary { color: #5b6c83; }
body.light .stat-label { color: #728097; }
body.light .stat-card { background: linear-gradient(120deg,#fff,#f9fbff); }
body.light .rank-name, body.light .rank-value { color: #52647f; }
body.light .rank-meter { background: #e8eff7; }
body.light thead { background: #f7f9fc; }
body.light td { color: #64748b; }
body.light .city-map svg .map-outline { fill: #f1f6fc; stroke: #c9d7e8; }
body.light .city-map svg .map-road { stroke: #dce5ef; }
body.light .city-map svg .map-land { fill: #eff4fa; stroke: #cad7e7; }
body.light .city-map svg .map-river { stroke: #c2def0; }
body.light .city-map svg .map-city { fill: #8a9cb3; }
body.light .map-pin circle { fill: #e4f5ee; }
body.light .map-pin text { fill: #286f54; }
body.light .map-pin.warning circle { fill: #fff0d8; }
body.light .map-pin.warning text { fill: #9b6b26; }
body.light .map-pin.offline circle { fill: #e6ecf4; }
body.light .map-pin.offline text { fill: #66778e; }
body.light #details { border-color: #cbd9e9; box-shadow: 0 25px 100px rgba(18,37,65,.22); }
body.light #toast { background: #e9f7f0; color: #1f6e50; border-color: #b7dfcb; }

/* Responsive surfaces */
@media (min-width: 1500px) {
  .shell { width: calc(100% - 112px); }
  .stat-card { padding-top: 20px; padding-bottom: 17px; }
  .stat-value { font-size: 37px; }
  .overview-grid { grid-template-columns: minmax(0,1fr) 350px; }
  .chart-wrap { padding-top: 16px; }
  .institution-mini { padding-top: 17px; padding-bottom: 17px; }
  .institution-mini.warning, .institution-mini.offline { padding-top: 16px; }
}
@media (max-width: 1100px) {
  .shell { width: calc(100% - 48px); }
  .header-main { gap: 18px; }
  .header-actions { gap: 15px; }
  .brand-caption { padding-left: 18px; }
  .main-nav { gap: 25px; }
  .page-heading { gap: 14px; }
  h1 { font-size: 27px; }
  .button { padding: 8px 11px; }
  .overview-grid { grid-template-columns: minmax(0,1fr) 285px; gap: 15px; }
  .stat-card { padding-left: 15px; padding-right: 15px; }
  .stat-value { font-size: 29px; }
  .stat-icon { right: 13px; width: 27px; height: 27px; }
  .institution-grid { gap: 8px; }
  .institution-mini { padding-left: 10px; padding-right: 10px; }
  .mini-top { gap: 3px; }
  .mini-temp { font-size: 21px; }
  .map-layout { grid-template-columns: 1fr 110px; gap: 10px; }
  .map-summary { padding-left: 13px; }
  .rank-name { width: 87px; }
  .panel-head { padding-left: 16px; padding-right: 16px; }
}
@media (max-width: 880px) {
  .shell { width: calc(100% - 36px); }
  .header-main { min-height: 76px; }
  .brand { font-size: 28px; }
  .brand-mark { width: 31px; font-size: 33px; }
  .brand-caption { font-size: 8px; }
  .season { display: none; }
  .main-nav { gap: 25px; overflow-x: auto; scrollbar-width: none; height: 51px; }
  .main-nav::-webkit-scrollbar { display: none; }
  .main-nav>a { font-size: 11px; flex-shrink: 0; }
  .page-heading { align-items: flex-start; }
  h1 { font-size: 25px; }
  .page-actions { flex-direction: column; gap: 6px; align-items: stretch; padding-top: 0; }
  .toolbar:has(.scope-control) { flex-wrap: wrap; gap: 14px 18px; }
  .scope-control { width: 220px; }
  .toolbar:has(.scope-control) .sample-time { margin-left: 0; }
  .district-grid { gap: 10px; padding: 0 16px 16px; }
  .district-card { padding: 13px; }
  .district-name { font-size: 11px; }
  .district-metric { font-size: 22px; }
  .button { font-size: 9px; min-height: 31px; }
  .stats-grid { gap: 11px; }
  .stat-card { padding: 15px 13px 12px; }
  .stat-label { font-size: 9px; padding-right: 20px; }
  .stat-icon { width: 22px; height: 22px; right: 10px; top: 12px; }
  .stat-icon svg { width: 13px; height: 13px; }
  .stat-value { font-size: 26px; margin-top: 11px; }
  .stat-foot { font-size: 8px; }
  .stat-unit { font-size: 12px; }
  .overview-grid { grid-template-columns: 1fr; }
  .overview-grid>.panel:last-child .alert-list { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 18px; padding-bottom: 12px; }
  .overview-grid>.panel:last-child .alert-item { border-top: 0; padding-top: 3px; padding-bottom: 5px; }
  .alert-badge { display: none; }
  .chart-wrap { padding-right: 23px; padding-left: 13px; }
  .institution-grid { grid-template-columns: repeat(4,minmax(0,1fr)); }
  .institution-mini { padding: 13px; }
  .institution-mini.warning, .institution-mini.offline { padding-top: 12px; }
  .mini-top .status { font-size: 8px; }
  .mini-temp { font-size: 24px; }
  .bottom-grid { grid-template-columns: 1fr; }
  .map-layout { grid-template-columns: 1fr 180px; }
  .city-map svg { height: 210px; }
  .map-summary { padding-left: 24px; }
  .rank-name { width: 140px; }
  .rules-grid { gap: 10px; }
  .rule-card { padding: 15px; }
  .rule-card h3 { font-size: 11px; }
}
@media (max-width: 600px) {
  body { font-size: 12px; }
  .shell { width: calc(100% - 32px); }
  .header-main { min-height: 71px; gap: 12px; }
  .brand { font-size: 27px; gap: 6px; letter-spacing: -1.4px; }
  .brand-mark { width: 28px; font-size: 32px; }
  .brand-caption { font-size: 7px; letter-spacing: .8px; padding-left: 12px; }
  .header-actions { gap: 10px; }
  .profile { padding: 0; border-left: 0; }
  .profile>span:not(.avatar) { display: none; }
  .avatar { width: 29px; height: 29px; border-radius: 7px; font-size: 9px; }
  .icon-button { width: 29px; height: 29px; border-radius: 6px; }
  .icon-button svg { width: 15px; height: 15px; }
  .main-nav { width: 100%; max-width: none; gap: 24px; padding: 0 16px; height: 48px; }
  .main-nav>a { font-size: 10px; gap: 7px; }
  .main-nav>a svg { width: 14px; height: 14px; }
  .nav-count { min-width: 17px; padding: 0 4px; font-size: 8px; }
  .context-line { padding-top: 17px; font-size: 9px; gap: 10px; }
  .crumb-sep { margin: 0 6px; }
  .demo-label { font-size: 8px; gap: 5px; }
  .page-heading { margin: 24px 0 18px; display: block; }
  .eyebrow { font-size: 8px; margin-bottom: 8px; letter-spacing: 1.5px; }
  h1 { font-size: 27px; max-width: 340px; line-height: 1.16; letter-spacing: -.75px; }
  .page-subtitle { font-size: 10px; margin-top: 9px; max-width: 330px; line-height: 1.7; }
  .page-actions { flex-direction: row; margin-top: 18px; gap: 9px; }
  .button { min-height: 34px; font-size: 10px; padding: 8px 12px; }
  .button svg { width: 13px; height: 13px; }
  .demo-notice { font-size: 9px; line-height: 1.7; gap: 8px; margin-bottom: 18px; padding: 9px 10px; align-items: flex-start; }
  .demo-notice>svg { margin-top: 2px; width: 13px; height: 13px; }
  .notice-tag { display: none; }
  .toolbar { flex-wrap: wrap; gap: 13px 12px; padding-bottom: 18px; }
  .date-control { min-width: 0; flex: 1.05; }
  .compare-control { min-width: 0; flex: 1; }
  .toolbar-label { font-size: 8px; margin-bottom: 5px; }
  .select-wrap { padding-left: 9px; gap: 6px; }
  .select-wrap select, .compare-control select { font-size: 10px; padding-top: 9px; padding-bottom: 9px; }
  .sample-time { width: 100%; margin-left: 0; font-size: 9px; gap: 7px; }
  .sample-time>span { display: flex; align-items: center; flex-wrap: wrap; gap: 3px; }
  .sample-time small { display: inline; margin: 0 0 0 4px; font-size: 8px; }
  .sample-time b { margin-left: 1px; }
  .sample-time>svg { height: 12px; width: 12px; }
  .toolbar:has(.scope-control) { gap: 13px 12px; }
  .scope-control { width: 100%; min-width: 0; flex: 1 0 100%; }
  .scope-control>label { font-size: 8px; margin-bottom: 5px; }
  .scope-control select { font-size: 10px; }
  .regional-panel { margin-bottom: 20px; }
  .regional-summary { font-size: 9px; gap: 7px 14px; padding: 0 14px 14px; }
  .district-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; padding: 0 12px 13px; }
  .district-card { padding: 12px 11px 10px; border-radius: 6px; }
  .district-name { font-size: 10px; padding-right: 10px; }
  .district-name::after { right: 10px; top: 11px; font-size: 10px; }
  .district-counts { margin-top: 5px; font-size: 8px; gap: 5px; }
  .district-metric { margin-top: 13px; font-size: 23px; }
  .district-metric small, .district-metric .stat-unit { font-size: 10px; }
  .district-bar { margin-top: 11px; margin-bottom: 8px; }
  .district-caption { font-size: 7px; gap: 5px; }
  .district-caption .status { font-size: 6px; }
  .stats-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; margin-bottom: 16px; }
  .stat-card { padding: 14px 13px 11px; border-radius: 8px; }
  .stat-label { font-size: 9px; }
  .stat-value { font-size: 29px; line-height: 1.3; margin: 12px 0 10px; }
  .stat-unit { font-size: 13px; margin-left: 3px; }
  .stat-foot { font-size: 7.5px; gap: 4px; padding-top: 8px; min-height: 24px; }
  .stat-change { font-size: 8px; }
  .stat-icon { top: 12px; right: 11px; }
  .overview-grid { gap: 15px; margin-bottom: 21px; }
  .panel { border-radius: 8px; }
  .panel-head { padding: 15px 14px 14px; gap: 9px; }
  .panel-title { font-size: 11px; }
  .panel-subtitle { font-size: 8px; max-width: 225px; }
  .panel-actions { gap: 7px; }
  .chart-select { font-size: 8px; padding: 5px 18px 5px 6px; max-width: 88px; }
  .chart-legend { gap: 12px; font-size: 8px; }
  .panel>.chart-legend { padding-left: 14px; padding-right: 14px; }
  .period-tabs button { font-size: 7px; padding: 4px 6px; }
  .chart-foot { padding: 10px 14px; font-size: 7px; gap: 8px; }
  .chart-legend>span { gap: 4px; }
  .legend-dot { width: 5px; height: 5px; }
  .chart-wrap { padding: 10px 12px 12px 5px; overflow: hidden; }
  .chart-wrap svg { min-height: 180px; }
  .chart-footer { padding: 10px 14px; font-size: 8px; }
  .overview-grid>.panel:last-child .alert-list { display: block; padding: 0 14px 3px; }
  .overview-grid>.panel:last-child .alert-item { padding: 13px 0; border-top: 1px solid var(--border-soft); }
  .overview-grid>.panel:last-child .alert-item:first-child { padding-top: 3px; border-top: 0; }
  .alert-content h3, .alert-content strong { font-size: 10px; }
  .alert-content p { font-size: 9px; }
  .alert-badge { display: inline; }
  .alert-footer { font-size: 9px; padding: 10px 14px; }
  .section-heading { margin-bottom: 11px; }
  .section-heading h2 { font-size: 12px; }
  .section-heading p { font-size: 8px; }
  .section-link { font-size: 9px; }
  .institution-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; margin-bottom: 20px; }
  .institution-mini { padding: 12px; }
  .institution-mini.warning, .institution-mini.offline { padding-top: 11px; }
  .mini-top { margin-bottom: 10px; }
  .mini-icon svg { width: 15px; height: 15px; }
  .mini-temp { font-size: 27px; }
  .mini-caption { font-size: 10px; }
  .mini-caption small { font-size: 8px; }
  .bottom-grid { gap: 15px; margin-bottom: 18px; }
  .map-layout { grid-template-columns: 1fr 108px; gap: 7px; padding: 0 12px 14px; min-height: 206px; }
  .city-map svg { height: 185px; }
  .map-summary { padding-left: 12px; font-size: 9px; }
  .map-summary strong { font-size: 20px; }
  .map-summary small { font-size: 8px; }
  .map-summary>div { margin-bottom: 14px; }
  .map-key { font-size: 7px; gap: 7px; }
  .map-key span { gap: 4px; }
  .map-note { font-size: 7px; }
  .ranking-list { padding: 0 14px 11px; }
  .rank-item { gap: 8px; padding: 11px 0; }
  .rank-index { width: 13px; font-size: 8px; }
  .rank-name { font-size: 9px; width: 98px; }
  .rank-name small { font-size: 7px; }
  .rank-value { font-size: 9px; width: 35px; }
  .filters { gap: 8px; margin-bottom: 14px; }
  .panel>.filters { padding: 0 14px; gap: 8px; }
  .panel>.filters .search-box { min-width: 100%; }
  .search-box { min-width: 100%; max-width: none; }
  .filters select { flex: 1 1 calc(50% - 8px); min-width: 0; font-size: 10px; }
  .filters .button { flex: 0 0 auto; }
  table { min-width: 680px; font-size: 10px; }
  th { font-size: 8px; padding: 12px 13px; }
  td { padding: 14px 13px; }
  td:first-child, th:first-child { padding-left: 14px; }
  td:last-child, th:last-child { padding-right: 14px; }
  .table-footer { padding: 12px 14px; font-size: 9px; }
  .summary-strip { gap: 10px 19px; font-size: 9px; padding: 12px 14px; margin-bottom: 14px; }
  .summary-strip b { font-size: 11px; }
  .analysis-grid { grid-template-columns: 1fr; gap: 15px; margin-bottom: 18px; }
  .rules-grid { grid-template-columns: 1fr; gap: 10px; margin-bottom: 18px; }
  .rules-grid:has(>.panel), .rules-grid.panel-body { grid-template-columns: 1fr; }
  .rule-card { padding: 16px; }
  .rule-card>svg, .rule-card>.rule-icon { margin-bottom: 10px; }
  .rule-card h3 { font-size: 12px; }
  .rule-card p { font-size: 10px; }
  .role-list { padding: 0 14px 7px; }
  .role-item { font-size: 10px; gap: 10px; }
  .role-item p, .role-item small { font-size: 8px; }
  .form-grid { grid-template-columns: 1fr; padding: 0 14px 17px; gap: 14px; }
  .save-row { padding: 13px 14px; flex-wrap: wrap; gap: 12px; }
  .save-row p { font-size: 9px; }
  .panel-body { padding: 0 14px 16px; }
  .report-options { padding: 0 14px 16px; gap: 12px; }
  .report-options label { font-size: 9px; }
  .footer { align-items: flex-start; flex-direction: column; gap: 8px; margin-top: 21px; padding: 18px 0 24px; font-size: 8px; }
  .footer b { font-size: 13px; margin-right: 6px; }
  .detail-header { padding: 19px; }
  .detail-header h2 { font-size: 21px; }
  .detail-stats { grid-template-columns: repeat(2,minmax(0,1fr)); padding: 16px 19px; gap: 9px; }
  .detail-stats:has(>div:nth-child(3):last-child) { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 7px; }
  .detail-stats>div { padding: 11px; }
  .detail-stats strong, .detail-stats b { font-size: 23px; }
  .detail-stats:has(>div:nth-child(3):last-child)>div { padding: 9px; }
  .detail-stats:has(>div:nth-child(3):last-child) b { font-size: 20px; }
  .detail-stats .stat-unit { font-size: 9px; }
  #detail-content>.panel { margin: 0 19px 19px; }
  #detail-content>.chart-wrap { margin: 0 12px 16px; }
  #detail-content>.detail-meta, .detail-notice { margin-left: 19px; margin-right: 19px; }
  #toast { font-size: 11px; padding: 11px 15px; bottom: 19px; }
}
@media (max-width: 370px) {
  .brand-caption { display: none; }
  .brand { font-size: 29px; }
  h1 { font-size: 25px; }
  .demo-label { font-size: 7px; }
  .map-layout { grid-template-columns: 1fr 96px; }
  .sample-time small { font-size: 7px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* A clean report when printed */
@media print {
  @page { size: A4 landscape; margin: 12mm; }
  :root, body, body.light { color-scheme: light; --bg: white; --surface: white; --surface-2: #f5f7fa; --surface-3: #edf1f6; --border: #cbd4e0; --border-soft: #e2e7ef; --text: #15253c; --muted: #54637a; --subtle: #5d6d83; --blue: #286bd5; --green: #13815f; --amber: #a16b1e; --red: #b94550; }
  body { font-size: 9pt; background: white !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .shell { width: 100%; max-width: none; }
  .app-header { border-bottom: 1pt solid #aebdd0; background: white !important; }
  .header-main { min-height: 56px; }
  .brand { color: #172b45; font-size: 24px; }
  .brand-caption { color: #64748b; }
  .brand-caption b { color: #41546d; }
  .header-actions, .main-nav, .page-actions, .demo-label, .notice-tag, .filters, .panel-actions, .section-link, .alert-footer, .panel-bottom-link, .period-tabs, .save-row, #toast, #details, .skip, .chart-select, .table-footer .pagination { display: none !important; }
  .context-line { padding-top: 12px; font-size: 8px; }
  .page-heading { margin: 15px 0; }
  h1 { color: #15253c; font-size: 23px; }
  .page-subtitle { font-size: 9px; }
  .demo-notice { background: #f3f7fc !important; border-color: #d5dfec; color: #5a7290; font-size: 8px; padding: 6px 8px; margin-bottom: 12px; }
  .demo-notice b { color: #415f87; }
  .toolbar { padding-bottom: 14px; gap: 20px; }
  .toolbar select { color: #15253c; border: 0; background: white; padding-top: 2px; padding-bottom: 2px; font-size: 9px; appearance: none; }
  .toolbar .select-wrap { border: 0; padding-left: 0; background: white; }
  .toolbar-label { margin-bottom: 3px; font-size: 8px; }
  .compare-control { min-width: 140px; }
  .sample-time b { color: #15253c; }
  .scope-control { width: 220px; }
  .regional-panel { margin-bottom: 15px; }
  .regional-summary { font-size: 8px; padding-bottom: 12px; }
  .district-grid { grid-template-columns: repeat(4,minmax(0,1fr)); gap: 8px; padding-bottom: 14px; }
  .district-card { background: white; border-color: #d4dde8; padding: 11px 12px; break-inside: avoid; }
  .district-name { font-size: 10px; }
  .district-name::after { display: none; }
  .district-metric { font-size: 21px; margin-top: 10px; }
  .district-caption { font-size: 7px; }
  .stats-grid { gap: 10px; margin-bottom: 15px; grid-template-columns: repeat(4,minmax(0,1fr)); }
  .stat-card { background: white !important; padding: 12px; break-inside: avoid; }
  .stat-label { color: #5b6b82; }
  .stat-value { font-size: 25px; margin: 7px 0 8px; }
  .stat-foot { font-size: 7px; }
  .overview-grid { grid-template-columns: minmax(0,1fr) 260px; gap: 12px; margin-bottom: 15px; }
  .panel { background: white !important; break-inside: avoid; border-radius: 6px; }
  .panel-title, .institution-name, .temp-value, .alert-content h3, .alert-content strong, .role-item strong { color: #15253c; }
  .panel-head { padding: 12px 14px; }
  .panel-title { font-size: 11px; }
  .chart-wrap { padding-bottom: 10px; }
  .chart-wrap svg { max-height: 215px; }
  .chart-wrap svg text { fill: #64748b; }
  .chart-wrap svg line { stroke: #dbe2ed; }
  .alert-list { padding: 0 13px 5px; display: block !important; }
  .alert-item { padding: 11px 0; }
  .alert-content h3 { font-size: 9px; }
  .alert-content p { font-size: 8px; }
  .alert-badge { font-size: 7px; }
  .section-heading { margin-bottom: 10px; }
  .section-heading h2 { font-size: 11px; }
  .institution-grid { grid-template-columns: repeat(7,minmax(0,1fr)); gap: 7px; margin-bottom: 15px; }
  .institution-mini { background: white !important; padding: 10px; break-inside: avoid; }
  .mini-temp { color: #15253c; font-size: 22px; }
  .mini-caption { font-size: 8px; }
  .mini-top .status { font-size: 6px; }
  .bottom-grid { gap: 12px; grid-template-columns: 1fr 1fr; margin-bottom: 14px; }
  .map-layout { min-height: 180px; padding: 0 14px 12px; grid-template-columns: 1fr 110px; }
  .city-map svg { height: 160px; }
  .city-map svg .map-outline { fill: #eff4fa; stroke: #cad7e7; }
  .city-map svg .map-land { fill: #eff4fa; stroke: #cad7e7; }
  .city-map svg .map-river { stroke: #bfdcf0; }
  .city-map svg .map-road { stroke: #d5dfeb; }
  .rank-name, .rank-value { color: #52647f; }
  .rank-item { padding: 9px 0; }
  .rank-meter { background: #e8eff7; }
  .analysis-grid, .rules-grid { gap: 12px; }
  .rule-card { background: white !important; break-inside: avoid; }
  .table-wrap { overflow: visible; }
  table { min-width: 0; font-size: 8px; white-space: normal; }
  thead { background: #f5f7fa !important; display: table-header-group; }
  th { font-size: 8px; padding: 10px 9px; }
  td { color: #52647f; padding: 10px 9px; }
  tr { break-inside: avoid; }
  td:first-child, th:first-child { padding-left: 12px; }
  td:last-child, th:last-child { padding-right: 12px; }
  .institution-name { font-size: 9px; }
  .row-button { border: 0; padding: 0; background: transparent; }
  td>.icon-button { display: none; }
  .institution-type { font-size: 7px; }
  .status { font-size: 7px; }
  .footer { font-size: 7px; padding-top: 12px; margin-top: 18px; }
  .footer b { font-size: 11px; }
}
