/* South Zone AQ Hotspot Portal ------------------------------------------------ */
:root {
  --bg: #f3f5f7;
  --surface: #ffffff;
  --surface-2: #f7f9fa;
  --surface-3: #eef2f4;
  --line: #e1e6ea;
  --line-strong: #c9d1d8;
  --ink: #101828;
  --ink-2: #344054;
  --muted: #667085;
  --faint: #98a2b3;
  --accent: #0f766e;
  --accent-700: #0b5f58;
  --accent-soft: #e5f3f1;
  --accent-ring: rgba(15, 118, 110, .28);
  --good: #0ca30c;   --good-ink: #146c14;   --good-soft: #e8f6e8;
  --warn: #fab219;   --warn-ink: #7a5000;   --warn-soft: #fff4d6;
  --serious: #ec835a; --serious-ink: #973b16; --serious-soft: #fdece4;
  --crit: #d03b3b;   --crit-ink: #9f2525;   --crit-soft: #fbe9e9;
  --info: #2a78d6;   --info-ink: #1c5cab;   --info-soft: #e8f1fc;
  --series-aqi: #2a78d6;
  --series-comp: #0f766e;
  --context: #a3a9b1;
  --chart-grid: #e1e0d9;
  --chart-axis: #c3c2b7;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow-1: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-2: 0 4px 12px rgba(16, 24, 40, .08), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-3: 0 20px 48px rgba(16, 24, 40, .18);
  --sidebar-w: 248px;
  --topbar-h: 60px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 15px/1.55 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
img { max-width: 100%; }
[hidden] { display: none !important; }
a { color: var(--accent-700); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
h1 { font-size: 24px; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 17px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 650; }
p { margin: 0 0 8px; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
.num, table.data td.num { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------------------------------------------------------------- shell */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; grid-template-rows: var(--topbar-h) auto 1fr; min-height: 100vh; }
.topbar { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 900; }
.brand { display: flex; align-items: center; gap: 10px; min-width: calc(var(--sidebar-w) - 16px); color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); display: grid; place-items: center; flex: none; }
.brand-text b { display: block; font-size: 14px; line-height: 1.1; }
.brand-text small { color: var(--muted); font-size: 11.5px; }
.topbar .spacer { flex: 1; }
.menu-btn { display: none; }
.global-search { position: relative; width: min(380px, 34vw); }
.global-search input { width: 100%; padding: 7px 10px 7px 32px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
.global-search input:focus { background: var(--surface); outline: 2px solid var(--accent-ring); border-color: var(--accent); }
.global-search .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.search-results { position: absolute; top: calc(100% + 4px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-2); max-height: 420px; overflow: auto; z-index: 1000; }
.search-results a { display: block; padding: 8px 12px; border-bottom: 1px solid var(--line); color: var(--ink); }
.search-results a:hover, .search-results a:focus { background: var(--accent-soft); text-decoration: none; }
.search-results small { color: var(--muted); display: block; font-size: 11.5px; }
.top-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface-2); font-size: 12.5px; white-space: nowrap; color: var(--ink-2); }
.top-chip:hover { text-decoration: none; background: var(--surface-3); }
.icon-btn { position: relative; border: 0; background: none; width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; cursor: pointer; color: var(--ink-2); }
.icon-btn:hover { background: var(--surface-3); }
.icon-btn .dot { position: absolute; top: 3px; right: 2px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 99px; background: var(--crit); color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--surface); }
.user-menu { position: relative; }
.user-btn { display: flex; align-items: center; gap: 8px; border: 0; background: none; padding: 4px 6px; border-radius: 8px; cursor: pointer; }
.user-btn:hover { background: var(--surface-3); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-700); display: grid; place-items: center; font-weight: 700; font-size: 12px; flex: none; }
.user-btn .who { text-align: left; line-height: 1.15; }
.user-btn .who b { display: block; font-size: 13px; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-btn .who small { color: var(--muted); font-size: 11.5px; }
.dropdown { position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-2); padding: 6px; z-index: 1000; }
.dropdown a, .dropdown button { display: block; width: 100%; text-align: left; padding: 8px 10px; border: 0; background: none; border-radius: 6px; color: var(--ink); cursor: pointer; }
.dropdown a:hover, .dropdown button:hover { background: var(--surface-3); text-decoration: none; }
.dropdown hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }

.banners { grid-column: 1 / -1; grid-row: 2; }
.banner { padding: 7px 16px; font-size: 13px; display: flex; gap: 8px; align-items: flex-start; }
.banner svg { flex: none; margin-top: 2px; }
.banner span { min-width: 0; }
.banner.dev { background: #fbe9e9; color: var(--crit-ink); border-bottom: 1px solid #f1c4c4; }

.sidebar { background: var(--surface); border-right: 1px solid var(--line); padding: 12px 10px 24px; position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h)); overflow-y: auto; grid-row: 3; }
.nav-group { margin-bottom: 14px; }
.nav-group > span { display: block; padding: 0 10px 4px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.nav-link { display: flex; align-items: center; gap: 11px; padding: 10px 11px; border-radius: 9px; color: var(--ink-2); font-weight: 550; font-size: 15px; }
.nav-link:hover { background: var(--surface-3); text-decoration: none; color: var(--ink); }
.nav-link.active { background: var(--accent-soft); color: var(--accent-700); font-weight: 650; }
.nav-link svg { flex: none; opacity: .8; }
.nav-link .count { margin-left: auto; font-size: 11.5px; font-weight: 700; padding: 0 6px; border-radius: 99px; background: var(--crit-soft); color: var(--crit-ink); }
.nav-link.primary-action { background: var(--accent); color: #fff; margin-bottom: 12px; justify-content: center; font-weight: 700; font-size: 16px; padding: 13px 11px; box-shadow: var(--shadow-1); }
.nav-link.primary-action:hover { background: var(--accent-700); color: #fff; }

.main { grid-row: 3; min-width: 0; padding: 20px 24px 64px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head .sub { color: var(--muted); margin-top: 3px; font-size: 13px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.crumbs { font-size: 12.5px; color: var(--muted); margin-bottom: 6px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--accent-700); }

.mobile-bar { display: none; }
.backdrop { display: none; }

/* ---------------------------------------------------------------- controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 15px; min-height: 42px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); cursor: pointer; font-weight: 550; white-space: nowrap; line-height: 1.3; text-decoration: none; }
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-700); border-color: var(--accent-700); }
.btn.danger { color: var(--crit-ink); border-color: #e7b9b9; }
.btn.danger:hover { background: var(--crit-soft); }
.btn.danger.solid { background: var(--crit); color: #fff; border-color: var(--crit); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-3); }
.btn.sm { padding: 6px 11px; font-size: 13.5px; border-radius: 8px; min-height: 34px; }
.btn.lg { padding: 14px 22px; font-size: 17px; min-height: 52px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; min-width: 0; }
.field > span, .field > label.lbl { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: 13px; color: var(--muted); font-weight: 400; }
.input, .field input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]), .field select, .field textarea, select.input, textarea.input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--surface); min-width: 0; min-height: 44px; font-size: 15px; }
.field textarea, textarea.input { resize: vertical; min-height: 72px; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--accent-ring); border-color: var(--accent); }
.field input[aria-invalid="true"], .field select[aria-invalid="true"] { border-color: var(--crit); }
.check { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 10px; cursor: pointer; }
.check input { margin-top: 2px; accent-color: var(--accent); width: 20px; height: 20px; flex: none; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-error { background: var(--crit-soft); color: var(--crit-ink); border: 1px solid #f0c8c8; padding: 8px 10px; border-radius: 8px; margin-bottom: 12px; font-size: 13px; }
.form-note { background: var(--info-soft); color: var(--info-ink); border: 1px solid #cadff7; padding: 8px 10px; border-radius: 8px; margin-bottom: 12px; font-size: 13px; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.filters .field { margin-bottom: 0; min-width: 150px; }
.filters .field.grow { flex: 1; min-width: 200px; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: none; padding: 9px 15px; min-height: 42px; cursor: pointer; font-weight: 600; color: var(--ink-2); border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-700); }

/* ---------------------------------------------------------------- cards / layout */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1); }
.card-pad { padding: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.card-head h2, .card-head h3 { display: flex; align-items: center; gap: 8px; }
.card-head .meta { color: var(--muted); font-size: 12.5px; }
.card-body { padding: 14px 16px; }
.card + .card, .stack > * + * { margin-top: 16px; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.main-side { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
.grid.side-main { grid-template-columns: 300px minmax(0, 1fr); align-items: start; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.tiny { font-size: 11.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.between { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.divider { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; color: var(--ink); box-shadow: var(--shadow-1); position: relative; }
a.kpi:hover { text-decoration: none; border-color: var(--line-strong); box-shadow: var(--shadow-2); }
.kpi .label { font-size: 13.5px; color: var(--muted); font-weight: 550; display: flex; gap: 6px; align-items: center; }
.kpi .value { font-size: 32px; font-weight: 650; line-height: 1.15; margin-top: 4px; letter-spacing: -.01em; }
.kpi .value small { font-size: 13px; color: var(--muted); font-weight: 500; margin-left: 4px; letter-spacing: 0; }
.kpi .foot { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.kpi.crit .value { color: var(--crit-ink); }
.kpi.warn .value { color: var(--warn-ink); }
.kpi.good .value { color: var(--good-ink); }
.kpi .status-icon { position: absolute; top: 12px; right: 12px; }

/* ---------------------------------------------------------------- badges and chips */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 99px; font-size: 12.5px; font-weight: 600; white-space: nowrap; line-height: 1.5; border: 1px solid transparent; }
.badge.neutral { background: var(--surface-3); color: var(--ink-2); }
.badge.accent { background: var(--accent-soft); color: var(--accent-700); }
.badge.good { background: var(--good-soft); color: var(--good-ink); }
.badge.warn { background: var(--warn-soft); color: var(--warn-ink); }
.badge.serious { background: var(--serious-soft); color: var(--serious-ink); }
.badge.crit { background: var(--crit-soft); color: var(--crit-ink); }
.badge.info { background: var(--info-soft); color: var(--info-ink); }
.badge.outline { background: var(--surface); border-color: var(--line-strong); color: var(--ink-2); }
.badge svg { flex: none; }
.swatch { width: 10px; height: 10px; border-radius: 50%; flex: none; display: inline-block; box-shadow: 0 0 0 1px rgba(0,0,0,.12); }
.swatch.sq { border-radius: 3px; }
.cat { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); white-space: nowrap; }
.glyph { width: 20px; height: 20px; border-radius: 50%; color: #fff; font-size: 10.5px; font-weight: 800; display: inline-grid; place-items: center; flex: none; }
.aqi { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.aqi b { font-size: 15px; font-variant-numeric: tabular-nums; }
.aqi .cat-label { font-size: 12px; color: var(--ink-2); }
.aqi .pol { font-size: 11.5px; color: var(--muted); }
.ref { font-family: var(--mono); font-size: 12px; background: var(--surface-3); padding: 1px 6px; border-radius: 5px; color: var(--ink-2); white-space: nowrap; }
.flag-list { display: flex; flex-wrap: wrap; gap: 4px; }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { text-align: left; font-size: 12.5px; font-weight: 650; color: var(--muted); background: var(--surface-2); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; }
table.data td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover td { background: #fafbfc; }
table.data tr.clickable { cursor: pointer; }
table.data tr.flagged td:first-child { box-shadow: inset 3px 0 0 var(--crit); }
table.data td .title { font-weight: 600; color: var(--ink); }
table.data td .title:hover { color: var(--accent-700); }
table.data .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
table.data.compact td { padding: 6px 8px; }

/* ---------------------------------------------------------------- tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tabs button { border: 0; background: none; padding: 12px 14px; min-height: 46px; font-weight: 600; font-size: 15px; color: var(--muted); border-bottom: 3px solid transparent; cursor: pointer; white-space: nowrap; }
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { color: var(--accent-700); border-bottom-color: var(--accent); }
.tabs button .count { font-size: 11.5px; background: var(--surface-3); color: var(--ink-2); border-radius: 99px; padding: 0 6px; margin-left: 4px; }

/* ---------------------------------------------------------------- modal / toast */
.modal-backdrop { position: fixed; inset: 0; background: rgba(16, 24, 40, .45); z-index: 3000; display: grid; place-items: center; padding: 16px; animation: fade .12s ease-out; }
.modal { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-3); width: min(560px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; }
.modal.wide { width: min(880px, 100%); }
.modal.full { width: min(1100px, 100%); height: calc(100vh - 32px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 16px 18px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 14px 14px; flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
#toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 4000; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: #1d2939; color: #fff; padding: 9px 14px; border-radius: 9px; box-shadow: var(--shadow-2); font-size: 13.5px; max-width: min(560px, 92vw); pointer-events: auto; animation: fade .15s ease-out; }
.toast.error { background: var(--crit-ink); }
.toast.good { background: var(--good-ink); }

/* ---------------------------------------------------------------- empty / states */
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty h3 { color: var(--ink-2); margin-bottom: 4px; }
.empty .btn { margin-top: 10px; }
.loading { padding: 40px; text-align: center; color: var(--muted); }
.error-box { padding: 20px; border: 1px solid #f0c8c8; background: var(--crit-soft); color: var(--crit-ink); border-radius: var(--radius); }
.stale { opacity: .55; transition: opacity .15s; }

/* ---------------------------------------------------------------- dashboard */
.hotspot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.hs-card { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; color: var(--ink); box-shadow: var(--shadow-1); }
.hs-card:hover { text-decoration: none; border-color: var(--line-strong); box-shadow: var(--shadow-2); }
.hs-card .name { display: flex; align-items: center; gap: 8px; font-weight: 650; font-size: 14.5px; }
.hs-card .station { font-size: 12.5px; color: var(--muted); margin: 1px 0 8px 18px; }
.hs-card .hs-aqi { flex: none; min-width: 44px; height: 34px; padding: 0 9px; border-radius: 9px; color: #fff; font-weight: 750; font-size: 19px;
  display: grid; place-items: center; font-variant-numeric: tabular-nums; text-shadow: 0 1px 1px rgba(0,0,0,.2); }
.hs-card .name { font-size: 16px; }
.hs-card .stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 10px; }
.hs-card .stat { background: var(--surface-2); border-radius: 7px; padding: 5px 7px; }
.hs-card .stat b { display: block; font-size: 17px; font-variant-numeric: tabular-nums; }
.hs-card .stat span { font-size: 11.5px; color: var(--muted); }
.hs-card .stat.crit b { color: var(--crit-ink); }
.hs-card .insight { font-size: 12px; margin-top: 8px; display: flex; gap: 6px; align-items: flex-start; color: var(--ink-2); }
.meter { height: 6px; border-radius: 99px; background: #d5e6f8; overflow: hidden; margin-top: 4px; }
.meter > i { display: block; height: 100%; background: var(--info); border-radius: 99px; }

.attention { list-style: none; margin: 0; padding: 0; }
.attention li { display: flex; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); align-items: flex-start; }
.attention li:last-child { border-bottom: 0; }
.attention .ico { flex: none; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; }
.attention .ico.crit { background: var(--crit-soft); color: var(--crit-ink); }
.attention .ico.warn { background: var(--warn-soft); color: var(--warn-ink); }
.attention .ico.info { background: var(--info-soft); color: var(--info-ink); }
.attention .txt { flex: 1; min-width: 0; font-size: 13px; }
.attention .txt .lvl { font-weight: 650; }

/* ---------------------------------------------------------------- compliance grid */
.cgrid { border-collapse: separate; border-spacing: 2px; font-size: 12.5px; }
.cgrid th { font-weight: 600; color: var(--muted); font-size: 11.5px; padding: 4px 6px; text-align: center; vertical-align: bottom; line-height: 1.2; }
.cgrid th.row-head { text-align: left; }
.cgrid td.hname { padding: 4px 8px 4px 0; white-space: nowrap; font-weight: 600; }
.cgrid td.cell { width: 64px; min-width: 52px; height: 34px; text-align: center; border-radius: 6px; font-variant-numeric: tabular-nums; cursor: default; position: relative; }
.cell.done { background: var(--good-soft); color: var(--good-ink); }
.cell.pending, .cell.partial { background: var(--warn-soft); color: var(--warn-ink); }
.cell.missed { background: var(--crit-soft); color: var(--crit-ink); }
.cell.today { background: var(--surface-3); color: var(--muted); }
.cell.na, .cell.future { background: transparent; color: var(--faint); }
.cell .cnt { display: block; font-size: 10.5px; opacity: .85; }
.cgrid td.pct { font-weight: 700; padding-left: 8px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.heat td.cell { color: #fff; font-weight: 650; }
/* positive actions: 7-day strip in tables, 30-day strip on the detail page */
.week-strip { display: inline-flex; gap: 2px; vertical-align: middle; }
.week-strip .cell { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 4px; font-size: 11px; }
.month-strip { display: flex; flex-wrap: wrap; gap: 4px; }
.month-strip .cell { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 6px; font-size: 14px; line-height: 1; }
.month-strip .cell small { font-size: 9.5px; opacity: .8; margin-bottom: 2px; }
.aqi-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.aqi-cal .dow { font-size: 11px; font-weight: 600; color: var(--muted); text-align: center; padding-bottom: 2px; }
.aqi-cal .day { min-height: 58px; border-radius: 8px; padding: 5px 6px; color: #fff; display: flex; flex-direction: column; text-shadow: 0 1px 1px rgba(0,0,0,.25); }
.aqi-cal .day .dn { font-size: 11px; opacity: .9; }
.aqi-cal .day .v { font-size: 18px; line-height: 1.15; }
.aqi-cal .day .pol { font-size: 10px; opacity: .9; }
.aqi-cal .day.none { background: var(--surface-3); color: var(--muted); text-shadow: none; }
.aqi-cal .day.pad { background: transparent; }
.aqi-cal .day.today { outline: 2px solid var(--ink); outline-offset: 1px; }
@media (max-width: 560px) { .aqi-cal { gap: 2px; } .aqi-cal .day { min-height: 48px; padding: 3px 4px; } .aqi-cal .day .v { font-size: 15px; } .aqi-cal .day .pol { display: none; } }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--ink-2); align-items: center; }
.legend span { display: inline-flex; gap: 5px; align-items: center; }
.legend .key-line { width: 18px; height: 2px; display: inline-block; border-radius: 2px; }
.legend .key-bar { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.scale { display: inline-flex; border-radius: 4px; overflow: hidden; }
.scale i { width: 26px; height: 10px; display: block; }

/* ---------------------------------------------------------------- charts */
.chart { position: relative; }
.chart svg { display: block; overflow: visible; max-width: 100%; }
.chart text { font-family: var(--font); fill: var(--muted); font-size: 12px; }
.chart .grid-line { stroke: var(--chart-grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart .axis-line { stroke: var(--chart-axis); stroke-width: 1; shape-rendering: crispEdges; }
.chart .band-label { fill: var(--faint); font-size: 10.5px; }
.chart .panel-title { fill: var(--ink-2); font-size: 13px; font-weight: 650; }
.chart .crosshair { stroke: #667085; stroke-width: 1; pointer-events: none; }
.chart .end-label { fill: var(--ink); font-size: 13px; font-weight: 700; }
.chart-tip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow-2); padding: 8px 11px; font-size: 13px; min-width: 165px; z-index: 5; }
.chart-tip .d { color: var(--muted); font-size: 11.5px; margin-bottom: 3px; }
.chart-tip .r { display: flex; align-items: center; gap: 6px; justify-content: space-between; }
.chart-tip .r b { font-variant-numeric: tabular-nums; }
.chart-tip .r .k { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); }
.chart-tip .r .k i { width: 12px; height: 2px; border-radius: 2px; display: inline-block; }
.chart-tip .r .k i.bar { height: 8px; width: 8px; border-radius: 2px; }
.insight-box { display: flex; gap: 9px; align-items: flex-start; padding: 11px 14px; border-radius: 9px; font-size: 14.5px; line-height: 1.45; margin-top: 12px; }
.insight-box.mismatch, .insight-box.low_compliance { background: var(--serious-soft); color: var(--serious-ink); }
.insight-box.improving, .insight-box.regional { background: var(--good-soft); color: var(--good-ink); }
.insight-box.steady, .insight-box.insufficient { background: var(--surface-2); color: var(--ink-2); }
.small-multiples { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 16px; }

/* ---------------------------------------------------------------- tasks tree / timeline */
.tree { list-style: none; margin: 0; padding: 0; }
.tree .tree { padding-left: 22px; border-left: 1px dashed var(--line-strong); margin-left: 10px; }
.task-row { display: flex; gap: 10px; align-items: flex-start; padding: 9px 10px; border-radius: 8px; }
.task-row:hover { background: var(--surface-2); }
.task-row .status-dot { margin-top: 3px; flex: none; }
.task-row .body { flex: 1; min-width: 0; }
.task-row .t { font-weight: 600; color: var(--ink); }
.task-row .meta { display: flex; flex-wrap: wrap; gap: 6px 10px; font-size: 12px; color: var(--muted); margin-top: 3px; align-items: center; }
.task-row.closed .t { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--faint); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 22px; }
.timeline li::before { content: ""; position: absolute; left: 6px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); }
.timeline li::after { content: ""; position: absolute; left: 9.5px; top: 16px; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline li.accent::before { background: var(--accent); }
.timeline li.crit::before { background: var(--crit); }
.timeline li.good::before { background: var(--good); }
.timeline .when { font-size: 12px; color: var(--muted); }
.comments { list-style: none; margin: 0 0 10px; padding: 0; }
.comments li { padding: 9px 0; border-bottom: 1px solid var(--line); display: flex; gap: 10px; }
.comments li:last-child { border-bottom: 0; }
.comments .c-body { flex: 1; min-width: 0; }
.comments .c-meta { font-size: 12px; color: var(--muted); }
.comments li.system .c-body { color: var(--muted); font-size: 12.5px; }
.diff { font-size: 12px; margin-top: 4px; }
.diff .old { color: var(--crit-ink); text-decoration: line-through; }
.diff .new { color: var(--good-ink); }

/* ---------------------------------------------------------------- photos */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.photo-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; cursor: pointer; color: var(--ink); text-align: left; padding: 0; }
.photo-card:hover { box-shadow: var(--shadow-2); }
.photo-card .ph { aspect-ratio: 4 / 3; background: var(--surface-3); position: relative; overflow: hidden; }
.photo-card .ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-card .ph .badges { position: absolute; top: 6px; left: 6px; right: 6px; display: flex; gap: 4px; flex-wrap: wrap; }
.photo-card .info { padding: 8px 10px; font-size: 12.5px; }
.photo-card .info b { display: block; font-size: 13px; }
.photo-big { width: 100%; max-height: 60vh; object-fit: contain; background: #111; border-radius: 8px; display: block; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pair figure { margin: 0; }
.pair figcaption { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.thumb { width: 56px; height: 42px; object-fit: cover; border-radius: 6px; background: var(--surface-3); display: block; }

/* ---------------------------------------------------------------- capture */
.capture { display: flex; flex-direction: column; gap: 10px; }
.viewfinder { position: relative; background: #0b0f14; border-radius: 12px; overflow: hidden; aspect-ratio: 4 / 3; max-height: calc(100vh - 290px); min-height: 220px; width: 100%; display: grid; place-items: center; }
.viewfinder video, .viewfinder img { width: 100%; height: 100%; object-fit: contain; display: block; }
.viewfinder .overlay-msg { position: absolute; inset: 0; display: grid; place-items: center; color: #e5e7eb; text-align: center; padding: 20px; font-size: 14px; }
.gps-line { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.shutter-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
.shutter { width: 76px; height: 76px; border-radius: 50%; border: 4px solid #fff; background: var(--accent); box-shadow: 0 0 0 2px var(--accent); cursor: pointer; }
.shutter:disabled { background: #9aa4ae; box-shadow: 0 0 0 2px #9aa4ae; cursor: not-allowed; }
.action-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.action-tile { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 11px; padding: 13px; text-align: left; cursor: pointer; font-weight: 600; font-size: 15px; min-height: 66px; }
.action-tile small { display: block; color: var(--muted); font-weight: 400; font-size: 12.5px; margin-top: 2px; }
.action-tile[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent); }
.steps { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.steps span { font-size: 12px; padding: 3px 10px; border-radius: 99px; background: var(--surface-3); color: var(--muted); font-weight: 600; }
.steps span.on { background: var(--accent); color: #fff; }
.steps span.done { background: var(--accent-soft); color: var(--accent-700); }

/* ---------------------------------------------------------------- map */
.map-box { height: 320px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: var(--surface-3); position: relative; z-index: 0; }
.map-box.tall { height: calc(100vh - 170px); min-height: 460px; }
.map-box.short { height: 220px; }
.map-page { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; align-items: start; }
.map-offline { display: grid; place-items: center; height: 100%; color: var(--muted); text-align: center; padding: 16px; }
.pin-icon svg { filter: drop-shadow(0 2px 2px rgba(0,0,0,.35)); }
.pin-icon .g { font: 800 10px/1 var(--font); fill: #fff; }
.centre-icon div { width: 18px; height: 18px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1.5px rgba(0,0,0,.45), 0 2px 5px rgba(0,0,0,.35); }
.station-icon div { width: 11px; height: 11px; background: #334155; border: 2px solid #fff; transform: rotate(45deg); box-shadow: 0 0 0 1px rgba(0,0,0,.4); }
.log-icon div { width: 12px; height: 12px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.45); }
.leaflet-tooltip.hs-name { background: rgba(255,255,255,.94); border: 0; border-radius: 5px; padding: 1px 6px; font-weight: 650; font-size: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.leaflet-tooltip.hs-name::before { display: none; }
.leaflet-popup-content { font: 13px/1.45 var(--font); margin: 10px 12px; min-width: 220px; }
.leaflet-popup-content h4 { margin: 0 0 4px; font-size: 13.5px; }
.map-legend { background: rgba(255,255,255,.95); padding: 8px 10px; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,.2); font-size: 12px; line-height: 1.7; max-height: 280px; overflow: auto; }
.layer-list label { display: flex; gap: 8px; align-items: center; padding: 4px 0; cursor: pointer; font-size: 13px; }

/* ---------------------------------------------------------------- auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: linear-gradient(160deg, #e7f3f1 0%, #f3f5f7 55%); }
.auth-card { width: min(460px, 100%); background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-3); padding: 28px; }
.auth-card.wide { width: min(640px, 100%); }
.auth-card .brand { margin-bottom: 18px; min-width: 0; }
.auth-card h1 { margin-bottom: 4px; }
.auth-foot { margin-top: 18px; font-size: 12px; color: var(--muted); text-align: center; }

/* ---------------------------------------------------------------- report document */
.report-doc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 32px; max-width: 1100px; }
.report-doc h1 { font-size: 22px; }
.report-doc h2 { font-size: 16px; margin: 24px 0 8px; padding-bottom: 6px; border-bottom: 2px solid var(--ink); }
.report-doc h3 { margin: 14px 0 6px; }
.report-doc .rep-head { display: flex; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); padding-bottom: 12px; margin-bottom: 12px; }
.report-doc table.data th { position: static; }
.report-doc .attention-list li { margin-bottom: 4px; }
.report-doc .kpis { grid-template-columns: repeat(4, 1fr); }
.report-doc .kpi { box-shadow: none; }
.delta-up { color: var(--crit-ink); }
.delta-down { color: var(--good-ink); }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1180px) {
  .grid.main-side { grid-template-columns: minmax(0, 1fr); }
  .grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  :root { --topbar-h: 52px; }
  .shell { grid-template-columns: 1fr; }
  .menu-btn { display: grid; }
  .brand { min-width: 0; }
  .brand-text small { display: none; }
  .global-search { display: none; }
  .top-chip.hide-sm { display: none; }
  .user-btn .who { display: none; }
  .sidebar { position: fixed; left: 0; top: var(--topbar-h); bottom: 0; width: 272px; height: auto; z-index: 950; transform: translateX(-102%); transition: transform .18s ease-out; box-shadow: var(--shadow-3); }
  .shell.nav-open .sidebar { transform: none; }
  .shell.nav-open .backdrop { display: block; position: fixed; inset: var(--topbar-h) 0 0 0; background: rgba(16,24,40,.35); z-index: 940; }
  .main { padding: 16px 16px 90px; grid-row: auto; }
  .grid.two, .grid.three, .grid.side-main, .map-page { grid-template-columns: minmax(0, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .mobile-bar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); z-index: 900; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); gap: 6px; }
  .mobile-bar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--ink-2); padding: 4px; border-radius: 8px; }
  .mobile-bar a.log { background: var(--accent); color: #fff; font-weight: 650; }
  .mobile-bar a:hover { text-decoration: none; }
  .map-box.tall { height: 62vh; }
  .small-multiples { grid-template-columns: minmax(0, 1fr); }
  .report-doc { padding: 18px 16px; }
  .report-doc .kpis { grid-template-columns: repeat(2, 1fr); }
  h1 { font-size: 19px; }
  .modal-backdrop { padding: 0; place-items: end center; }
  .modal, .modal.wide, .modal.full { width: 100%; max-height: 94vh; border-radius: 14px 14px 0 0; height: auto; }
  .modal-foot { border-radius: 0; }
}
@media (max-width: 520px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi .value { font-size: 24px; }
  .hotspot-grid { grid-template-columns: minmax(0, 1fr); }
  .page-head .actions { width: 100%; }
  .filters .field { min-width: calc(50% - 4px); flex: 1; }
}


/* ================================================================ simple & mobile
   Everything below is aimed at officers with little experience of apps: bigger targets,
   one column on a phone, tables that become cards, and plain visual cues.            */

/* --- "what to do now" action rows (home screen and empty states) */
.do-list { display: grid; gap: 10px; }
.do-row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line);
  border-left: 5px solid var(--line-strong); border-radius: var(--radius); color: var(--ink); box-shadow: var(--shadow-1); min-height: 64px; }
a.do-row:hover, button.do-row:hover { text-decoration: none; border-color: var(--line-strong); box-shadow: var(--shadow-2); }
.do-row .ic { flex: none; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-3); color: var(--ink-2); }
.do-row { text-align: left; font: inherit; }
.do-row .tx { flex: 1; min-width: 0; }
.do-row .tx b { display: block; font-size: 16px; font-weight: 650; }
.do-row .tx span { color: var(--muted); font-size: 13.5px; }
.do-row .go { flex: none; color: var(--faint); }
.do-row.crit { border-left-color: var(--crit); } .do-row.crit .ic { background: var(--crit-soft); color: var(--crit-ink); }
.do-row.warn { border-left-color: var(--warn); } .do-row.warn .ic { background: var(--warn-soft); color: var(--warn-ink); }
.do-row.good { border-left-color: var(--good); } .do-row.good .ic { background: var(--good-soft); color: var(--good-ink); }
.do-row.accent { border-left-color: var(--accent); } .do-row.accent .ic { background: var(--accent-soft); color: var(--accent-700); }
.do-row .count-pill { flex: none; min-width: 34px; height: 34px; padding: 0 9px; border-radius: 99px; display: grid; place-items: center;
  font-weight: 700; font-size: 16px; background: var(--surface-3); color: var(--ink); }
.do-row.crit .count-pill { background: var(--crit); color: #fff; }
.do-row.warn .count-pill { background: var(--warn); color: #4a3000; }
.do-row.good .count-pill { background: var(--good-soft); color: var(--good-ink); }

/* --- big primary action (phone-first) */
.big-cta { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 18px; border-radius: 14px;
  background: var(--accent); color: #fff; font-size: 18px; font-weight: 700; box-shadow: var(--shadow-2); border: 0; cursor: pointer; }
.big-cta:hover { background: var(--accent-700); color: #fff; text-decoration: none; }
.big-cta small { display: block; font-weight: 500; font-size: 13px; opacity: .9; }

/* --- AQI hero: one large, colour-banded number */
.aqi-hero { display: flex; align-items: center; gap: 16px; padding: 16px; border-radius: var(--radius); color: #fff; }
.aqi-hero .n { font-size: 46px; font-weight: 750; line-height: 1; font-variant-numeric: tabular-nums; }
.aqi-hero .t b { display: block; font-size: 17px; }
.aqi-hero .t span { font-size: 13px; opacity: .92; }
.aqi-strip { display: flex; border-radius: 99px; overflow: hidden; height: 10px; margin-top: 8px; }
.aqi-strip i { flex: 1; }
.aqi-scale { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 3px; }

/* --- plain-language help line under a page title */
.help-line { background: var(--accent-soft); color: #0b4f4a; border-radius: 10px; padding: 10px 14px; font-size: 14px; margin-bottom: 14px;
  display: flex; gap: 9px; align-items: flex-start; }
.help-line svg { flex: none; margin-top: 2px; }

/* --- steps used by the guided forms */
.wizard-step { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; }
.wizard-step .n { width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; flex: none; }
.wizard-step b { font-size: 16px; }

/* --- tables become cards on small screens (labels are stamped by core.js) */
@media (max-width: 760px) {
  .table-wrap { overflow-x: visible; }
  table.data, table.data tbody, table.data tr, table.data td { display: block; width: 100%; }
  table.data thead { display: none; }
  table.data tr { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; padding: 4px 2px; background: var(--surface); }
  table.data tr:last-child { margin-bottom: 0; }
  table.data td { border: 0; padding: 7px 12px; display: flex; gap: 12px; align-items: baseline; justify-content: space-between; }
  table.data td:empty { display: none; }
  table.data td::before { content: attr(data-label); flex: none; color: var(--muted); font-size: 12.5px; font-weight: 600; max-width: 42%; }
  table.data td[data-label=""]::before, table.data td.no-label::before { display: none; }
  table.data td:first-child { display: block; padding-top: 10px; }
  table.data td:first-child::before { display: none; }
  table.data td:first-child .title { font-size: 16px; }
  table.data td .sub { font-size: 13px; }
  table.data td.right, table.data td .right { text-align: left; }
  table.data tbody tr:hover td { background: transparent; }
  table.data tr.flagged { box-shadow: inset 4px 0 0 var(--crit); }
  table.data tr.flagged td:first-child { box-shadow: none; }
  table.data.compact td { padding: 6px 12px; }
  /* the cell-grid tables keep their grid shape and scroll instead */
  .cgrid, .cgrid tbody, .cgrid tr, .cgrid td, .cgrid thead { display: revert; }
  .card .table-wrap:has(.cgrid) { overflow-x: auto; }
}

/* --- phone layout */
@media (max-width: 900px) {
  body { font-size: 15.5px; }
  html, body { overflow-x: hidden; }
  .main { padding: 14px 14px 96px; min-width: 0; max-width: 100vw; }
  .shell, .page, .card, .stack, .grid { min-width: 0; }
  .page-head { margin-bottom: 12px; gap: 10px; }
  .page-head .actions { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .page-head .actions .btn { width: 100%; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .page-head .actions .btn:only-child { grid-column: 1 / -1; }
  .card-body, .card-pad { padding: 14px; }
  .card-head { padding: 12px 14px; }
  .card + .card, .stack > * + * { margin-top: 12px; }
  .grid { gap: 12px; }
  /* filters fold away behind one button */
  .filters { display: none; margin-bottom: 12px; }
  .filters.open { display: grid; grid-template-columns: 1fr; gap: 10px; background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 14px; }
  .filters.open .field, .filters.open .field.grow { min-width: 0; width: 100%; }
  .filter-toggle { display: inline-flex !important; }
  .seg { width: 100%; }
  .seg button { flex: 1; padding: 10px 6px; font-size: 14px; }
  .tabs { gap: 0; margin-bottom: 12px; -webkit-overflow-scrolling: touch; }
  .tabs button { padding: 12px 12px; font-size: 14.5px; }
  .modal-foot .btn { flex: 1 1 46%; }
  .modal-foot { position: sticky; bottom: 0; }
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dt { margin-top: 8px; font-size: 12.5px; }
  .aqi-hero .n { font-size: 40px; }
  .do-row { padding: 12px 13px; gap: 11px; }
  .do-row .tx b { font-size: 15.5px; }
  .month-strip .cell { width: 13.5vw; height: 13.5vw; max-width: 44px; max-height: 44px; }
  .report-doc .kpis { grid-template-columns: repeat(2, 1fr); }
  .leaflet-popup-content { min-width: 180px; }
}
.filter-toggle { display: none; }

@media (max-width: 520px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 11px 12px; }
  .kpi .value { font-size: 26px; }
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pair { grid-template-columns: 1fr 1fr; gap: 6px; }
  .action-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  h1 { font-size: 21px; }
}

/* --- bottom bar: five big targets on a phone */
@media (max-width: 900px) {
  .mobile-bar { padding: 5px 4px calc(5px + env(safe-area-inset-bottom)); box-shadow: 0 -2px 10px rgba(16,24,40,.07); }
  .mobile-bar a { font-size: 11px; gap: 3px; padding: 7px 2px; min-height: 54px; justify-content: center; }
  .mobile-bar a.on { color: var(--accent-700); font-weight: 700; }
  .mobile-bar a.log { border-radius: 10px; }
}

/* --- inputs on iOS must be >=16px or the page zooms on focus */
@media (max-width: 900px) {
  .input, .field input, .field select, .field textarea, select.input, textarea.input, .global-search input { font-size: 16px; min-height: 48px; }
  .btn { min-height: 46px; padding: 11px 16px; }
  .btn.sm { min-height: 38px; font-size: 14px; }
  .check input { width: 22px; height: 22px; }
}

/* --- clearer status colours on the compliance grid */
.cgrid td.cell { height: 40px; font-size: 15px; }
.cell.done { box-shadow: inset 0 0 0 1px rgba(20,108,20,.18); }
.cell.missed { box-shadow: inset 0 0 0 1px rgba(159,37,37,.18); }

.help-steps { margin: 0; padding-left: 4px; list-style: none; counter-reset: none; }
.help-steps li { padding: 7px 0 7px 2px; border-bottom: 1px solid var(--line); line-height: 1.5; }
.help-steps li:last-child { border-bottom: 0; }
.help-steps b { color: var(--accent-700); margin-right: 6px; }
.help-list { margin: 0; padding-left: 20px; }
.help-list li { margin-bottom: 7px; line-height: 1.5; }

details.field > summary { padding: 8px 0; font-size: 14px; font-weight: 600; color: var(--accent-700); }
details.field > summary::marker { color: var(--faint); }

/* --- simple progress bar with a readable label */
.bar-line { display: flex; align-items: center; gap: 10px; }
.bar-line .meter { flex: 1; height: 10px; margin: 0; background: var(--surface-3); }
.bar-line .meter > i.lo { background: var(--crit); }
.bar-line .meter > i.mid { background: var(--warn); }
.bar-line .meter > i.hi { background: var(--good); }
.bar-line b { font-variant-numeric: tabular-nums; min-width: 42px; text-align: right; }

/* ---------------------------------------------------------------- print (reports) */
@media print {
  @page { size: A4 landscape; margin: 12mm; }
  body { background: #fff; font-size: 11.5px; }
  .topbar, .sidebar, .mobile-bar, .banner, .no-print, .page-head .actions, #toasts { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; }
  .report-doc { border: 0; padding: 0; max-width: none; }
  .report-doc h2 { page-break-after: avoid; }
  .report-doc section { page-break-inside: avoid; }
  .report-doc .page-break { page-break-before: always; }
  table.data th { background: #f2f2f2 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .badge, .cell, .swatch, .glyph, .kpi { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  a { color: inherit; text-decoration: none; }
}
