:root {
  color-scheme: light;
  --bg: #f3f6f4; --surface: #ffffff; --surface-2: #ecf1ee; --border: #d9e1dc;
  --ink: #0f1712; --ink-2: #44514a; --ink-3: #66736b; --grid: #e3e9e5;
  --accent: #16794a; --accent-ink: #ffffff; --accent-soft: #dff1e7;
  --line: #24312a; --band: rgba(22, 121, 74, 0.18); --who: #b4232c;
  --c-good: #00b050; --c-moderate: #f2c200; --c-usg: #ff7e00; --c-unhealthy: #e5262b; --c-vunhealthy: #8f3f97; --c-hazardous: #7e0023;
  --t-good: #062b14; --t-moderate: #2b2200; --t-usg: #2b1600; --t-unhealthy: #ffffff; --t-vunhealthy: #ffffff; --t-hazardous: #ffffff;
  --warn: #8a5300; --warn-soft: #fff4dc;
  --shadow: 0 1px 2px rgba(0, 0, 0, .05), 0 2px 8px rgba(0, 0, 0, .04);
  --radius: 12px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0f1311; --surface: #171c19; --surface-2: #202722; --border: #2d3631;
    --ink: #eef3f0; --ink-2: #bcc8c1; --ink-3: #93a19a; --grid: #28302b;
    --accent: #4cc68a; --accent-ink: #07130d; --accent-soft: #173326;
    --line: #e4ece7; --band: rgba(76, 198, 138, 0.22); --who: #ff6b72;
    --c-good: #22b35e; --c-moderate: #e3bb17; --c-usg: #f2850f; --c-unhealthy: #e8474b; --c-vunhealthy: #a660ad; --c-hazardous: #a3203f;
    --warn: #e0a440; --warn-soft: #2e2512; --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1311; --surface: #171c19; --surface-2: #202722; --border: #2d3631;
  --ink: #eef3f0; --ink-2: #bcc8c1; --ink-3: #93a19a; --grid: #28302b;
  --accent: #4cc68a; --accent-ink: #07130d; --accent-soft: #173326;
  --line: #e4ece7; --band: rgba(76, 198, 138, 0.22); --who: #ff6b72;
  --c-good: #22b35e; --c-moderate: #e3bb17; --c-usg: #f2850f; --c-unhealthy: #e8474b; --c-vunhealthy: #a660ad; --c-hazardous: #a3203f;
  --warn: #e0a440; --warn-soft: #2e2512; --shadow: none;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); }
a { color: var(--accent); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; border-radius: 8px; z-index: 50; }
.skip:focus { left: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.lbl { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 16px; }
.top-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.back { font-size: 13px; text-decoration: none; }
.acct { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
main { max-width: 1080px; margin: 0 auto; padding: 0 16px 40px; }
.hero { padding: 26px 0 14px; }
.hero h1 { margin: 0 0 6px; font-size: clamp(24px, 4vw, 34px); line-height: 1.15; letter-spacing: -0.01em; }
.hero p { margin: 0; color: var(--ink-2); max-width: 760px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin: 14px 0; box-shadow: var(--shadow); min-width: 0; }
.card h2 { margin: 0 0 12px; font-size: 19px; }
.card h3 { margin: 0; font-size: 16px; }
.btn { font: inherit; font-size: 14px; border: 1px solid var(--border); background: var(--surface-2); color: var(--ink); border-radius: 9px; padding: 8px 14px; cursor: pointer; min-height: 38px; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn.ghost { background: transparent; }
.btn.small { font-size: 13px; padding: 5px 10px; min-height: 32px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.icon-btn { border: 1px solid var(--border); background: transparent; color: var(--ink); border-radius: 9px; width: 34px; height: 34px; display: inline-grid; place-items: center; cursor: pointer; }
.search-row { display: flex; gap: 8px; align-items: stretch; flex-wrap: wrap; }
.combo { position: relative; flex: 1 1 260px; min-width: 0; }
.combo input, select, input[type="text"] { width: 100%; font: inherit; font-size: 15px; color: var(--ink); background: var(--surface); border: 1px solid var(--border); border-radius: 9px; padding: 8px 12px; min-height: 40px; }
.combo input:focus, select:focus, input:focus, .btn:focus-visible, .chip:focus-visible, .drop:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.field.compact select { width: auto; }
.combo-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px; list-style: none; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; max-height: 340px; overflow-y: auto; z-index: 30; box-shadow: 0 8px 24px rgba(0, 0, 0, .15); }
.combo-list li { padding: 8px 10px; border-radius: 7px; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; }
.combo-list li[aria-selected="true"], .combo-list li:hover { background: var(--accent-soft); }
.combo-list .sub { color: var(--ink-3); font-size: 12px; white-space: nowrap; }
.combo-list .kind { font-size: 11px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .04em; }
.chips-block { margin-top: 12px; }
.chips-block summary { cursor: pointer; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip { font: inherit; font-size: 13px; border: 1px solid var(--border); background: var(--surface-2); color: var(--ink); border-radius: 999px; padding: 5px 12px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.chip:hover { border-color: var(--accent); }
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.chip .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.upload { margin-top: 14px; }
.upload summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--ink-2); }
.drop { margin-top: 10px; border: 2px dashed var(--border); border-radius: 10px; padding: 18px; text-align: center; cursor: pointer; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.linkish { color: var(--accent); text-decoration: underline; }
.grid-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin-top: 10px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--ink-2); }
.gate { margin-top: 14px; padding: 14px; border-radius: 10px; background: var(--accent-soft); }
.gate p { margin: 0 0 8px; }
.progress { margin-top: 14px; }
.steps { list-style: none; margin: 0 0 6px; padding: 0; display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--ink-3); }
.steps li::before { content: "\25CB"; margin-right: 5px; }
.steps li.active { color: var(--ink); font-weight: 600; }
.steps li.active::before { content: "\25D4"; }
.steps li.done { color: var(--accent); }
.steps li.done::before { content: "\25CF"; }
.status { margin: 10px 0 0; min-height: 1em; font-size: 14px; color: var(--ink-2); }
.status.err { color: var(--who); }
.station-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: flex-start; }
.station-head h2 { margin: 0 0 2px; }
.station-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.notes { margin: 10px 0 0; padding: 10px 12px 10px 28px; background: var(--warn-soft); color: var(--warn); border-radius: 9px; font-size: 13px; }
.now-grid { display: grid; grid-template-columns: minmax(260px, 1fr) 2fr; gap: 14px; margin: 14px 0; }
.now-grid > .card { margin: 0; }
.now-row { display: flex; gap: 14px; align-items: center; margin-top: 8px; }
.aqi-badge { min-width: 86px; height: 86px; border-radius: 18px; display: grid; place-items: center; font-size: 34px; font-weight: 800; line-height: 1; padding: 0 8px; background: var(--grid); color: var(--ink); }
.aqi-badge small { display: block; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; opacity: .85; margin-top: 4px; text-align: center; }
.now-cat { font-size: 18px; font-weight: 700; margin-bottom: 2px; }
.pol-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.pol-tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; box-shadow: var(--shadow); border-left: 6px solid var(--grid); min-width: 0; cursor: pointer; text-align: left; font: inherit; color: inherit; }
.pol-tile:hover { border-color: var(--accent); }
.pol-tile .k { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.pol-tile .v { font-size: 22px; font-weight: 750; margin: 2px 0; }
.pol-tile .v small { font-size: 12px; font-weight: 500; color: var(--ink-3); margin-left: 3px; }
.pol-tile .s { font-size: 12px; color: var(--ink-3); }
.caveat { margin: 8px 0 12px; padding: 10px 12px; border-radius: 9px; background: var(--warn-soft); color: var(--ink-2); font-size: 13.5px; }
.caveat strong { color: var(--warn); }
.out-days { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 8px; }
.out-day { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; border-top: 6px solid var(--grid); min-width: 0; }
.out-day .d { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.out-day .a { font-size: 26px; font-weight: 800; }
.out-day .a small { font-size: 12px; font-weight: 500; color: var(--ink-3); margin-left: 4px; }
.out-day .c { font-size: 13px; font-weight: 600; }
.out-day .r { font-size: 12px; color: var(--ink-3); }
.chart-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.chart { width: 100%; min-height: 60px; overflow: hidden; }
.chart svg { display: block; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--ink-2); margin: 4px 0 6px; }
.legend .sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -2px; margin-right: 5px; }
.legend .ln { display: inline-block; width: 16px; height: 0; border-top: 2.5px solid; vertical-align: 3px; margin-right: 5px; }
.legend .ln.dash { border-top-style: dashed; }
.seg { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 8px; }
.seg button { font: inherit; font-size: 13px; padding: 5px 12px; border: 1px solid var(--border); background: var(--surface-2); color: var(--ink); border-radius: 8px; cursor: pointer; }
.seg button[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid2 > .card { margin: 0; }
.grid2 + .card, .card + .grid2 { margin-top: 14px; }
.table-wrap { overflow-x: auto; margin-top: 8px; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { padding: 6px 8px; border-bottom: 1px solid var(--grid); text-align: right; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th { font-weight: 600; color: var(--ink-2); background: var(--surface-2); position: sticky; top: 0; }
td .pill { display: inline-block; min-width: 38px; text-align: center; padding: 1px 6px; border-radius: 6px; font-weight: 700; }
.scroll-table { max-height: 420px; overflow: auto; }
.method ul { margin: 10px 0 0; padding-left: 20px; color: var(--ink-2); font-size: 14px; }
.method li { margin-bottom: 6px; }
.method summary { cursor: pointer; font-weight: 600; }
.about p { color: var(--ink-2); font-size: 14px; }
.foot { max-width: 1080px; margin: 0 auto; padding: 18px 16px 30px; display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--ink-3); }
.cat-good { background: var(--c-good); color: var(--t-good); }
.cat-moderate { background: var(--c-moderate); color: var(--t-moderate); }
.cat-usg { background: var(--c-usg); color: var(--t-usg); }
.cat-unhealthy { background: var(--c-unhealthy); color: var(--t-unhealthy); }
.cat-vunhealthy { background: var(--c-vunhealthy); color: var(--t-vunhealthy); }
.cat-hazardous { background: var(--c-hazardous); color: var(--t-hazardous); }
.bl-good { border-left-color: var(--c-good); } .bl-moderate { border-left-color: var(--c-moderate); } .bl-usg { border-left-color: var(--c-usg); }
.bl-unhealthy { border-left-color: var(--c-unhealthy); } .bl-vunhealthy { border-left-color: var(--c-vunhealthy); } .bl-hazardous { border-left-color: var(--c-hazardous); }
.bt-good { border-top-color: var(--c-good); } .bt-moderate { border-top-color: var(--c-moderate); } .bt-usg { border-top-color: var(--c-usg); }
.bt-unhealthy { border-top-color: var(--c-unhealthy); } .bt-vunhealthy { border-top-color: var(--c-vunhealthy); } .bt-hazardous { border-top-color: var(--c-hazardous); }
@media (max-width: 760px) {
  .now-grid, .grid2 { grid-template-columns: 1fr; }
  .out-days { grid-template-columns: 1fr; }
  .out-day { display: grid; grid-template-columns: 1fr auto; gap: 0 10px; }
  .top { padding: 8px 12px; }
  .brand span { font-size: 15px; }
  .back { display: none; }
}
@media (max-width: 420px) {
  .brand span { display: none; }
  .search-row .btn, .search-row .field { flex: 1 1 auto; }
  .card { padding: 14px 12px; }
}
