:root {
  --bg: #f2f5f1;
  --surface: #ffffff;
  --surface-2: #e9efe9;
  --text: #14251d;
  --muted: #647269;
  --line: #d8e1da;
  --accent: #12372a;
  --accent-2: #2f6b4f;
  --shadow: 0 10px 30px rgba(20, 48, 35, .08);
}
* { box-sizing: border-box; }
html { color-scheme: light; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
.topbar {
  background: linear-gradient(135deg, #0f3024, #285f47);
  color: white;
  padding: max(18px, env(safe-area-inset-top)) 18px 28px;
}
.brand { max-width: 980px; margin: auto; display: flex; align-items: center; gap: 14px; }
.logo { width: 52px; height: 52px; filter: drop-shadow(0 4px 8px rgba(0,0,0,.18)); }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.55rem, 5vw, 2.15rem); line-height: 1.1; letter-spacing: -.02em; }
.brand p { margin-top: 4px; opacity: .78; font-size: .9rem; }
main { max-width: 980px; margin: -14px auto 0; padding: 0 14px 34px; }
.card-surface, .metric-card, .chart-card { background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.search-panel { border-radius: 18px; padding: 16px; }
.search-panel label { display: block; font-weight: 750; font-size: .9rem; margin-bottom: 8px; }
.search-row { display: flex; gap: 8px; }
input {
  width: 100%; min-width: 0; height: 48px; border: 1px solid #cbd7ce; border-radius: 12px; padding: 0 13px;
  font: inherit; color: var(--text); background: #fbfdfb; outline: none;
}
input:focus { border-color: var(--accent-2); box-shadow: 0 0 0 3px rgba(47,107,79,.12); }
button { font: inherit; cursor: pointer; }
.primary { height: 48px; border: 0; border-radius: 12px; padding: 0 18px; font-weight: 750; color: white; background: var(--accent); }
.primary:disabled { opacity: .55; cursor: progress; }
.helper-row { margin-top: 10px; min-height: 24px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.status { color: var(--muted); font-size: .84rem; line-height: 1.3; }
.status.error { color: #9b2c2c; }
.link-btn { border: 0; background: transparent; color: var(--accent-2); font-weight: 700; padding: 3px 0; white-space: nowrap; }
.range-tabs { display: flex; gap: 8px; margin: 15px 0 22px; }
.range-tabs button { flex: 1; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; min-height: 40px; font-weight: 700; color: var(--muted); }
.range-tabs button.active { background: var(--accent); color: white; border-color: var(--accent); }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 20px 3px 10px; }
.section-title h2, .charts > h2 { font-size: 1.08rem; }
.section-title p { margin-top: 2px; color: var(--muted); font-size: .78rem; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: #88a395; box-shadow: 0 0 0 5px rgba(136,163,149,.12); }
.live-dot.on { background: #2b9a5f; box-shadow: 0 0 0 5px rgba(43,154,95,.12); }
.metric-grid { display: grid; gap: 10px; }
.air-grid { grid-template-columns: repeat(2, 1fr); }
.weather-grid { grid-template-columns: repeat(3, 1fr); }
.metric-card { border-radius: 17px; padding: 16px; min-height: 126px; display: flex; flex-direction: column; justify-content: space-between; }
.metric-label { color: var(--muted); font-size: .84rem; font-weight: 720; }
.metric-value { display: flex; align-items: baseline; gap: 6px; margin: 8px 0; }
.metric-value span { font-size: clamp(1.85rem, 7vw, 2.65rem); font-weight: 780; letter-spacing: -.055em; }
.metric-value small { color: var(--muted); font-size: .8rem; font-weight: 700; }
.metric-foot { color: var(--muted); font-size: .72rem; }
.metric-card.unavailable { opacity: .55; }
.updated { margin-top: 12px; border-radius: 15px; padding: 13px 15px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.updated .eyebrow { display: block; color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; }
.updated strong { display: block; margin-top: 2px; font-size: .9rem; }
.source-pill { background: var(--surface-2); color: var(--accent); border-radius: 999px; padding: 6px 10px; font-size: .72rem; font-weight: 750; }
.charts { margin-top: 24px; }
.charts > h2 { margin: 0 3px 10px; }
.chart-card { border-radius: 17px; padding: 13px 13px 10px; margin-bottom: 10px; overflow: hidden; }
.chart-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.chart-head strong { font-size: .9rem; }
.chart-head span { color: var(--muted); font-size: .72rem; }
canvas { width: 100%; height: 175px; display: block; }
footer { padding: 24px 6px 8px; color: var(--muted); text-align: center; font-size: .75rem; line-height: 1.5; }
footer .small { margin-top: 6px; font-size: .68rem; }
.toast { position: fixed; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: #14251d; color: white; padding: 10px 14px; border-radius: 999px; font-size: .8rem; transition: .2s ease; box-shadow: 0 8px 24px rgba(0,0,0,.22); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 640px) {
  main { padding-left: 10px; padding-right: 10px; }
  .weather-grid { grid-template-columns: repeat(2, 1fr); }
  .wide-mobile { grid-column: 1 / -1; min-height: 112px; }
  .search-row { align-items: stretch; }
  .primary { padding-inline: 13px; }
  .helper-row { align-items: flex-start; }
}
@media (prefers-color-scheme: dark) {
  :root { --bg:#0f1713; --surface:#16231c; --surface-2:#223229; --text:#eef5f0; --muted:#9aaba0; --line:#2c3c32; --accent:#72b08d; --accent-2:#8bc5a3; --shadow:0 12px 32px rgba(0,0,0,.18); }
  html { color-scheme: dark; }
  .topbar { background: linear-gradient(135deg,#0c2a1e,#214e3b); }
  .primary, .range-tabs button.active { background:#417d5f; color:white; }
  input { background:#101b15; border-color:#314338; }
}
.range-tabs{overflow-x:auto;scrollbar-width:none}.range-tabs::-webkit-scrollbar{display:none}.range-tabs button{flex:0 0 auto;min-width:70px;padding:0 12px}.noise-config{margin-top:12px;border-top:1px solid var(--line);padding-top:10px}.noise-config summary{cursor:pointer;color:var(--accent-2);font-size:.82rem;font-weight:750}.noise-config label{margin-top:10px}.noise-config input{height:44px}.custom-range{display:flex;gap:10px;align-items:end;border-radius:15px;padding:12px;margin:-8px 0 18px}.custom-range[hidden]{display:none}.custom-range label{flex:1;color:var(--muted);font-size:.76rem;font-weight:700}.custom-range input{margin-top:5px;height:42px}.noise-grid{grid-template-columns:repeat(2,1fr)}.metric-value.compact span{font-size:clamp(1.3rem,5vw,2rem)}
@media(max-width:640px){.custom-range{display:grid;grid-template-columns:1fr 1fr}.custom-range .primary{grid-column:1/-1}.range-tabs{margin-left:-2px;margin-right:-2px;padding-bottom:3px}}
