@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
  color-scheme: dark;
  --ink: #edf2e9;
  --muted: #8e9991;
  --faint: #5d6963;
  --canvas: #0b1111;
  --sidebar: #0e1514;
  --surface: #121b19;
  --surface-raised: #17211e;
  --line: #26332e;
  --line-soft: rgba(201, 220, 202, .08);
  --lime: #c7ef75;
  --lime-dark: #a5d34e;
  --cyan: #8bd9cb;
  --amber: #e8c66e;
  --coral: #f19b74;
  --red: #ed7b70;
  --radius: 12px;
  --mono: 'DM Mono', 'SFMono-Regular', Consolas, monospace;
  --sans: 'DM Sans', 'Segoe UI', sans-serif;
  --display: 'Manrope', 'DM Sans', sans-serif;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--canvas); }
body { margin: 0; color: var(--ink); background: var(--canvas); font-family: var(--sans); font-size: 14px; -webkit-font-smoothing: antialiased; }
button, a { font: inherit; }
button { color: inherit; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--lime); outline-offset: 3px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; min-height: 600px; display: flex; flex-direction: column; padding: 30px 17px 20px; background: var(--sidebar); border-right: 1px solid var(--line-soft); }
.brand { display: flex; align-items: center; width: fit-content; gap: 10px; color: var(--ink); text-decoration: none; margin: 0 0 54px 9px; }
.brand-mark { display: flex; align-items: end; gap: 2px; height: 23px; width: 22px; padding: 3px 4px; border: 1px solid rgba(199,239,117,.6); border-radius: 7px; transform: rotate(-8deg); }
.brand-mark i { display: block; width: 2px; border-radius: 2px; background: var(--lime); }
.brand-mark i:nth-child(1) { height: 6px; opacity: .55; }
.brand-mark i:nth-child(2) { height: 10px; opacity: .75; }
.brand-mark i:nth-child(3) { height: 14px; }
.brand-mark i:nth-child(4) { height: 8px; opacity: .7; }
.brand-word { font: 700 18px/1 var(--display); letter-spacing: -.8px; }
.brand-word span { color: var(--muted); font-weight: 500; }
.brand-region { align-self: flex-start; margin: -3px 0 0 -5px; color: var(--lime); font: 500 9px/1 var(--mono); letter-spacing: .04em; }
.sidebar-label { color: #77847b; font: 500 10px/1 var(--mono); letter-spacing: .13em; }
.sidebar > .sidebar-label { margin: 0 10px 12px; }
.nav-current { position: relative; display: flex; align-items: center; gap: 11px; height: 42px; padding: 0 11px; color: #e3ebdf; background: rgba(199,239,117,.08); border: 1px solid rgba(199,239,117,.11); border-radius: 7px; font-size: 12px; }
.nav-current svg { width: 16px; height: 16px; fill: none; stroke: var(--lime); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.nav-dot { width: 5px; height: 5px; margin-left: auto; border-radius: 50%; background: var(--lime); box-shadow: 0 0 10px rgba(199,239,117,.6); }
.city-list-head { display: flex; align-items: center; justify-content: space-between; margin: 36px 9px 11px; }
.city-count { color: #67736b; font: 11px/1 var(--mono); }
.city-list { display: flex; flex-direction: column; gap: 2px; overflow: auto; scrollbar-width: thin; scrollbar-color: #2e3b34 transparent; }
.city-option { position: relative; display: flex; align-items: center; gap: 10px; width: 100%; height: 35px; padding: 0 10px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: #929e95; text-align: left; cursor: pointer; transition: color .16s ease, background .16s ease, border-color .16s ease; }
.city-option:hover { color: var(--ink); background: rgba(255,255,255,.035); }
.city-option[aria-pressed="true"] { color: var(--ink); background: var(--surface-raised); border-color: rgba(199,239,117,.11); }
.city-option[aria-pressed="true"] .city-ordinal { color: var(--lime); }
.city-ordinal { width: 19px; color: #5e6a62; font: 10px/1 var(--mono); }
.city-option-name { font-size: 12px; font-weight: 500; }
.city-option-dot { width: 4px; height: 4px; margin-left: auto; border-radius: 50%; background: #455149; }
.city-option[aria-pressed="true"] .city-option-dot { background: var(--lime); box-shadow: 0 0 8px rgba(199,239,117,.5); }
.skeleton-city { height: 34px; margin: 1px 0; border-radius: 6px; background: linear-gradient(90deg, #141d19 25%, #1a241f 50%, #141d19 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
.sidebar-bottom { margin-top: auto; padding: 16px 10px 0; border-top: 1px solid var(--line-soft); }
.source-mark { display: flex; align-items: center; gap: 10px; color: #77847b; font: 9px/1.6 var(--mono); letter-spacing: .08em; }
.source-wave { display: grid; place-items: center; width: 27px; height: 27px; color: var(--lime); border: 1px solid rgba(199,239,117,.25); border-radius: 50%; font: 18px/1 var(--sans); }
.source-mark strong { color: #cbd6cb; font-weight: 500; }
.sidebar-footnote { margin: 14px 0 0 37px; color: #536058; font: 10px/1.55 var(--mono); }

.main-panel { min-width: 0; }
.topbar { height: 68px; display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(26px, 4.2vw, 66px); border-bottom: 1px solid var(--line-soft); }
.breadcrumbs, .topbar-right { display: flex; align-items: center; gap: 10px; color: #77847b; font: 10px/1 var(--mono); letter-spacing: .09em; }
.breadcrumbs span:first-child { color: var(--lime); }
.crumb-slash { color: #49564e; }
.topbar-right { gap: 15px; }
.api-state { display: inline-flex; align-items: center; gap: 7px; color: #a6b19f; font-size: 9px; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 9px rgba(199,239,117,.55); }
.api-state.offline .status-dot { background: var(--red); box-shadow: 0 0 9px rgba(237,123,112,.4); }
.api-state.offline { color: var(--red); }
.topbar-divider { width: 1px; height: 15px; background: var(--line); }
.topbar-caption { color: #66736b; }
.content-wrap { width: min(1320px, 100%); margin: 0 auto; padding: 39px clamp(26px, 4.2vw, 66px) 22px; }
.page-intro { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.eyebrow, .panel-overline { margin: 0; color: #829087; font: 10px/1.4 var(--mono); letter-spacing: .12em; }
.eyebrow { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.eyebrow-line { display: inline-block; width: 19px; height: 1px; background: var(--lime); }
.title-row { display: flex; align-items: center; gap: 14px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin: 0; color: #f0f4ec; font: 700 clamp(28px, 3.1vw, 38px)/1.15 var(--display); letter-spacing: -1.8px; }
.title-period { color: var(--lime); }
.daily-tag { margin-top: 4px; padding: 6px 8px; color: #aebcae; border: 1px solid #2d3932; border-radius: 4px; font: 9px/1 var(--mono); letter-spacing: .07em; }
.intro-note { display: flex; align-items: center; gap: 11px; margin-bottom: 4px; color: #9ca79d; font-size: 11px; line-height: 1.55; }
.intro-note-mark { display: grid; place-items: center; width: 28px; height: 28px; color: var(--lime); border: 1px solid rgba(199,239,117,.3); border-radius: 50%; font: 9px/1 var(--mono); }

.city-summary { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 1px minmax(230px, .55fr) 175px; align-items: center; min-height: 162px; padding: 25px 31px; overflow: hidden; background: linear-gradient(112deg, #18221f 0%, #141c19 66%, #17221b 100%); border: 1px solid #2a3930; border-radius: var(--radius); box-shadow: 0 14px 45px rgba(0,0,0,.12); }
.city-summary::before { position: absolute; inset: 0; content: ""; pointer-events: none; opacity: .14; background-image: radial-gradient(rgba(207,232,190,.35) .65px, transparent .65px); background-size: 12px 12px; mask-image: linear-gradient(90deg, transparent 45%, #000 100%); }
.city-summary-main, .summary-reading { position: relative; z-index: 1; }
.city-kicker { display: flex; align-items: center; gap: 7px; color: #8f9c91; font: 9px/1 var(--mono); letter-spacing: .1em; }
.city-kicker-line { width: 13px; height: 1px; background: var(--lime); }
.city-kicker-sep { color: #4e5b51; }
.city-title-line { display: flex; flex-wrap: wrap; align-items: center; gap: 13px; margin: 13px 0 9px; }
h2 { margin: 0; color: #f1f4ec; font: 700 clamp(27px, 3vw, 36px)/1 var(--display); letter-spacing: -1.2px; }
.category-badge { display: inline-flex; align-items: center; min-height: 22px; padding: 0 9px; color: #bcd891; background: rgba(199,239,117,.09); border: 1px solid rgba(199,239,117,.22); border-radius: 4px; font: 10px/1.3 var(--mono); }
.category-badge::before { width: 5px; height: 5px; margin-right: 7px; content: ""; border-radius: 50%; background: currentColor; }
.tone-moderate { color: var(--amber) !important; background: rgba(232,198,110,.08) !important; border-color: rgba(232,198,110,.2) !important; }
.tone-unhealthy { color: var(--coral) !important; background: rgba(241,155,116,.08) !important; border-color: rgba(241,155,116,.2) !important; }
.tone-critical { color: var(--red) !important; background: rgba(237,123,112,.08) !important; border-color: rgba(237,123,112,.2) !important; }
.tone-neutral { color: #a0aaa2 !important; background: rgba(160,170,162,.08) !important; border-color: rgba(160,170,162,.18) !important; }
.city-summary-meta { display: flex; align-items: center; gap: 7px; margin: 0; color: #8c998e; font-size: 11px; }
.calendar-icon { color: var(--lime); font-size: 13px; }
.meta-divider { color: #4c594f; }
.summary-divider { position: relative; z-index: 1; width: 1px; height: 73px; background: #344137; }
.summary-reading { padding-left: 34px; }
.summary-reading-label, .summary-reading-foot { display: block; color: #8d9a8e; font: 9px/1.3 var(--mono); letter-spacing: .1em; }
.summary-reading-label span { margin-left: 5px; color: #c6d2c4; }
.summary-reading-value { display: flex; align-items: baseline; gap: 8px; margin: 7px 0 5px; }
.summary-reading-value strong { color: var(--lime); font: 700 45px/.98 var(--display); letter-spacing: -2px; }
.summary-reading-value span { color: #a8b4a7; font-size: 11px; }
.summary-reading-foot { color: #59675d; font-size: 8px; }
.summary-accent { position: relative; z-index: 1; display: flex; align-items: center; justify-content: end; gap: 6px; height: 76px; padding: 0 3px 0 0; opacity: .9; }
.summary-accent span { display: block; width: 6px; border-radius: 4px; background: rgba(199,239,117,.8); }
.city-summary[data-tone="moderate"] .summary-reading-value strong { color: var(--amber); }
.city-summary[data-tone="unhealthy"] .summary-reading-value strong { color: var(--coral); }
.city-summary[data-tone="critical"] .summary-reading-value strong { color: var(--red); }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.72fr) minmax(265px, .8fr); gap: 15px; margin-top: 15px; }
.panel { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.trend-panel { min-height: 365px; padding: 22px 24px 17px; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; }
.panel-overline { color: #839087; font-size: 9px; letter-spacing: .11em; }
.overline-mark { margin-left: 3px; color: var(--lime); font-size: 12px; }
h3 { margin: 7px 0 0; color: #e5ece4; font: 600 17px/1.2 var(--display); letter-spacing: -.35px; }
.panel-subtitle { margin: 5px 0 0; color: #77847a; font-size: 11px; }
.range-switch { display: flex; gap: 2px; padding: 3px; background: #0d1412; border: 1px solid #26332d; border-radius: 6px; }
.range-switch button { min-width: 33px; height: 25px; padding: 0 6px; color: #839087; background: transparent; border: 0; border-radius: 4px; font: 9px/1 var(--mono); cursor: pointer; transition: color .15s ease, background .15s ease; }
.range-switch button:hover { color: var(--ink); }
.range-switch button.active { color: #10170e; background: var(--lime); font-weight: 500; }
.chart-key { display: flex; align-items: center; gap: 8px; margin-top: 24px; color: #a1ada0; font: 9px/1 var(--mono); }
.key-line { width: 16px; height: 2px; background: var(--lime); border-radius: 1px; box-shadow: 0 0 7px rgba(199,239,117,.35); }
.key-period { margin-left: auto; color: #606d63; letter-spacing: .05em; }
.chart-wrap { position: relative; height: 207px; margin-top: 5px; }
#pm-chart { display: block; width: 100%; height: 100%; overflow: visible; }
.chart-gridline { stroke: #28342e; stroke-width: 1; stroke-dasharray: 2 5; }
.chart-y-label, .chart-x-label { fill: #718076; font: 9px var(--mono); }
.chart-area { fill: url(#chart-fill); fill: rgba(199,239,117,.055); }
.chart-line { fill: none; stroke: var(--lime); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; filter: drop-shadow(0 0 4px rgba(199,239,117,.22)); }
.chart-point { fill: #152019; stroke: #a4c968; stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.chart-point-latest { fill: var(--lime); stroke: #0e1511; stroke-width: 2; }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; color: #748177; font-size: 12px; }
.chart-empty[hidden] { display: none; }
.chart-axis { display: flex; align-items: center; justify-content: center; padding: 0; color: #626f65; font: 8px/1 var(--mono); letter-spacing: .11em; }

.metric-column { display: flex; flex-direction: column; gap: 12px; }
.metric-card { display: flex; flex-direction: column; justify-content: space-between; min-height: 112px; padding: 16px 18px 13px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.metric-top, .metric-bottom { display: flex; align-items: center; justify-content: space-between; }
.metric-label, .metric-code { color: #8a978c; font: 9px/1 var(--mono); letter-spacing: .08em; }
.metric-code { color: var(--cyan); letter-spacing: .03em; }
.metric-value { display: flex; align-items: baseline; gap: 7px; margin: 10px 0 7px; }
.metric-value strong { color: #e6eee4; font: 600 27px/1 var(--display); letter-spacing: -1px; }
.metric-value span { color: #7e8b81; font-size: 10px; }
.metric-bottom { color: #78857b; font-size: 10px; }
.metric-glyph { color: var(--cyan); font-size: 13px; }
.metric-aqi .metric-code { color: var(--amber); }
.metric-coverage { min-height: 84px; }
.metric-coverage .metric-value { margin: 7px 0 8px; }
.metric-coverage .metric-value strong { font-size: 23px; }
.coverage-track { width: 100%; height: 3px; overflow: hidden; background: #29362e; border-radius: 3px; }
.coverage-track span { display: block; height: 100%; background: var(--lime); border-radius: inherit; transition: width .3s ease; }
.aqi-scale { display: flex; gap: 2px; }
.aqi-scale i { width: 9px; height: 3px; border-radius: 2px; background: #52664d; }
.aqi-scale i:nth-child(2) { background: #a6b15b; }
.aqi-scale i:nth-child(3) { background: #e2bf64; }
.aqi-scale i:nth-child(4) { background: #e28f68; }
.aqi-scale i:nth-child(5) { background: #b96368; }
.metric-footnote { display: flex; align-items: center; gap: 9px; min-height: 36px; padding: 0 4px; color: #77847a; font-size: 9px; line-height: 1.45; }
.footnote-star { color: var(--lime); font-size: 12px; }

.readings-panel { margin-top: 15px; padding: 21px 24px 0; }
.readings-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 15px; }
.readings-heading h3 { margin-top: 5px; }
.table-units { color: #6f7d72; font: 8px/1 var(--mono); letter-spacing: .08em; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
thead { border-top: 1px solid #27342e; border-bottom: 1px solid #27342e; }
th { padding: 11px 11px; color: #758278; text-align: left; font: 8px/1 var(--mono); letter-spacing: .08em; }
th:first-child, td:first-child { padding-left: 0; }
th:last-child, td:last-child { padding-right: 0; }
td { padding: 12px 11px; color: #b5c0b5; border-bottom: 1px solid rgba(201,220,202,.055); font-size: 11px; }
tbody tr:last-child td { border-bottom: 0; }
.numeric-cell { color: #d6e0d2; font: 11px/1 var(--mono); }
.table-category { display: inline-block; max-width: 240px; overflow: hidden; padding: 4px 7px; border: 1px solid rgba(199,239,117,.18); border-radius: 4px; color: #bcd891; background: rgba(199,239,117,.06); font: 9px/1.2 var(--mono); text-overflow: ellipsis; vertical-align: middle; }
.table-loading { padding: 20px 0; color: #7b887d; }
.table-footer { display: flex; align-items: center; justify-content: space-between; min-height: 37px; margin-top: 1px; color: #69766b; border-top: 1px solid rgba(201,220,202,.06); font: 8px/1 var(--mono); letter-spacing: .06em; }
.table-footer > span:first-child { display: flex; align-items: center; gap: 7px; }
.table-footer-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--lime-dark); }
.page-footer { display: flex; align-items: center; justify-content: space-between; padding: 19px 2px 0; color: #58655b; font: 8px/1 var(--mono); letter-spacing: .08em; }
.footer-sep { margin: 0 3px; color: #849080; }
.error-banner { position: fixed; right: 24px; bottom: 22px; z-index: 5; display: flex; align-items: center; gap: 18px; padding: 13px 16px; color: #f1c1b9; background: #2a1d1c; border: 1px solid rgba(237,123,112,.35); border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.25); font-size: 12px; }
.error-banner[hidden] { display: none; }
.error-banner button { padding: 7px 9px; color: var(--ink); background: transparent; border: 1px solid rgba(237,123,112,.45); border-radius: 4px; font: 9px/1 var(--mono); cursor: pointer; }
.loading-text { opacity: .6; }

@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; } }

@media (max-width: 1050px) {
  .app-shell { grid-template-columns: 220px minmax(0, 1fr); }
  .city-summary { grid-template-columns: minmax(0, 1fr) 1px minmax(210px, .55fr) 95px; padding-inline: 23px; }
  .summary-reading { padding-left: 23px; }
  .summary-accent { gap: 4px; }
  .summary-accent span:nth-child(1), .summary-accent span:nth-child(2), .summary-accent span:nth-child(3) { display: none; }
  .dashboard-grid { grid-template-columns: minmax(0, 1.5fr) minmax(230px, .8fr); }
}

@media (max-width: 780px) {
  .app-shell { display: block; }
  .sidebar { position: static; width: 100%; height: auto; min-height: 0; padding: 15px 18px 10px; border-right: 0; border-bottom: 1px solid var(--line-soft); }
  .brand { margin: 0 0 16px 1px; }
  .sidebar > .sidebar-label, .nav-current, .city-list-head, .sidebar-bottom { display: none; }
  .city-list { flex-direction: row; gap: 6px; margin: 0 -3px; padding: 2px 3px 5px; overflow-x: auto; }
  .city-option { flex: 0 0 auto; width: auto; height: 31px; gap: 7px; padding: 0 9px; background: rgba(255,255,255,.025); border-color: rgba(201,220,202,.07); }
  .city-ordinal { width: auto; }
  .city-option-name { font-size: 11px; }
  .city-option-dot { display: none; }
  .topbar { height: 50px; padding: 0 19px; }
  .breadcrumbs { font-size: 8px; }
  .topbar-caption, .topbar-divider { display: none; }
  .topbar-right { gap: 0; }
  .content-wrap { padding: 27px 18px 20px; }
  .page-intro { align-items: start; margin-bottom: 20px; }
  .intro-note { display: none; }
  .eyebrow { font-size: 8px; }
  h1 { font-size: 30px; }
  .daily-tag { font-size: 7px; }
  .city-summary { grid-template-columns: minmax(0,1fr) 1px minmax(125px,.7fr); min-height: 144px; padding: 20px 17px; }
  .summary-reading { padding-left: 17px; }
  .summary-accent { display: none; }
  .city-kicker { font-size: 8px; }
  h2 { font-size: 28px; }
  .category-badge { max-width: 100%; font-size: 8px; }
  .city-title-line { gap: 8px; margin: 12px 0 8px; }
  .city-summary-meta { flex-wrap: wrap; font-size: 9px; }
  .summary-reading-label, .summary-reading-foot { font-size: 7px; }
  .summary-reading-value strong { font-size: 36px; }
  .summary-reading-value span { font-size: 9px; }
  .dashboard-grid { grid-template-columns: 1fr; gap: 11px; margin-top: 11px; }
  .trend-panel { min-height: 345px; padding: 18px 15px 14px; }
  .panel-heading { gap: 8px; }
  .panel-overline { font-size: 8px; }
  h3 { font-size: 15px; }
  .panel-subtitle { font-size: 10px; }
  .range-switch { gap: 0; }
  .range-switch button { min-width: 28px; height: 24px; padding: 0 4px; font-size: 8px; }
  .chart-wrap { height: 205px; }
  .chart-axis { padding-left: 34px; font-size: 7px; }
  .metric-column { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
  .metric-card { min-height: 104px; padding: 13px 12px 11px; }
  .metric-label, .metric-code { font-size: 7px; }
  .metric-value strong { font-size: 23px; }
  .metric-value span { font-size: 8px; }
  .metric-bottom { font-size: 8px; }
  .metric-footnote { grid-column: 1 / -1; min-height: auto; padding: 0 2px 2px; }
  .readings-panel { margin-top: 11px; padding: 17px 14px 0; }
  .readings-heading { align-items: start; }
  .table-units { padding-top: 7px; font-size: 7px; }
  th { padding: 10px 8px; font-size: 7px; }
  td { padding: 11px 8px; font-size: 10px; }
  .numeric-cell { font-size: 10px; }
  .table-category { max-width: 175px; font-size: 8px; }
  .page-footer { font-size: 7px; }
}

@media (max-width: 430px) {
  .daily-tag { display: none; }
  .city-summary { grid-template-columns: minmax(0,1fr) 1px minmax(112px,.65fr); padding-inline: 13px; }
  .summary-reading { padding-left: 11px; }
  .city-title-line { align-items: flex-start; flex-direction: column; }
  .category-badge { min-height: 20px; }
  .summary-reading-value strong { font-size: 31px; }
  .range-switch button { min-width: 25px; }
  .table-units { display: none; }
  .topbar-right .api-state { font-size: 8px; }
  .page-footer span:last-child { max-width: 125px; text-align: right; line-height: 1.4; }
}
