@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300..900;1,9..40,300..900&display=swap');

:root {
  color-scheme: dark;
  --bg: #05070a;
  --bg-soft: #0b0e13;
  --panel: rgba(18, 22, 29, 0.82);
  --panel-solid: #11161e;
  --panel-strong: #171d27;
  --line: rgba(255, 255, 255, 0.095);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #f7f8fa;
  --muted: #9da6b3;
  --dim: #67717f;
  --green: #73f56c;
  --green-soft: rgba(115, 245, 108, 0.16);
  --yellow: #ffd44a;
  --yellow-soft: rgba(255, 212, 74, 0.15);
  --orange: #ff8e3c;
  --orange-soft: rgba(255, 142, 60, 0.15);
  --red: #ff5c7a;
  --red-soft: rgba(255, 92, 122, 0.14);
  --blue: #4ab8ff;
  --blue-soft: rgba(74, 184, 255, 0.15);
  --purple: #b785ff;
  --purple-soft: rgba(183, 133, 255, 0.15);
  --cyan: #54f4d2;
  --shadow: 0 28px 90px rgba(0, 0, 0, 0.36);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --accent: var(--green);
  --accent-soft: var(--green-soft);
  --accent-glow: rgba(115, 245, 108, 0.32);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 6%, rgba(115, 245, 108, 0.18), transparent 26rem),
    radial-gradient(circle at 86% 5%, rgba(74, 184, 255, 0.13), transparent 27rem),
    radial-gradient(circle at 76% 92%, rgba(255, 142, 60, 0.10), transparent 30rem),
    linear-gradient(145deg, #030405 0%, #0a0d12 42%, #05070a 100%);
  color: var(--text);
  font-family: "DM Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.026) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.026) 1px, transparent 1px);
  background-size: 58px 58px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.78), transparent 78%);
}

button, a { font: inherit; }
button { cursor: pointer; }

.svg-defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon,
.brand-icon svg,
.compare-icon svg,
.weather-icon svg {
  width: 1.08em;
  height: 1.08em;
  flex: 0 0 auto;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.shell {
  width: min(1540px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 278px minmax(0, 1fr);
  gap: 22px;
  padding: 22px;
}

.sidebar {
  position: sticky;
  top: 22px;
  height: calc(100vh - 44px);
  min-height: 720px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at 50% 0, rgba(115, 245, 108, 0.10), transparent 35%),
    linear-gradient(180deg, rgba(16, 20, 27, 0.9), rgba(8, 11, 15, 0.84));
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.brandmark {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
}

.brandmark strong {
  display: block;
  font-size: 21px;
  letter-spacing: -0.06em;
}

.brandmark strong span,
.hero-header h1 span {
  color: var(--green);
}

.brandmark small {
  display: inline-flex;
  margin-top: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(115, 245, 108, 0.12);
  color: var(--green);
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 0.02em;
}

.brand-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background:
    radial-gradient(circle at 35% 28%, rgba(115, 245, 108, 0.9), rgba(115, 245, 108, 0.14) 58%, rgba(255, 255, 255, 0.04));
  color: #071207;
  box-shadow: 0 0 34px rgba(115, 245, 108, 0.26);
}

.brand-icon svg {
  width: 25px;
  height: 25px;
  stroke-width: 2.15;
}

.nav-list { display: grid; gap: 8px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 16px;
  padding: 12px 14px;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.nav-item:hover,
.nav-item.active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--line);
  transform: translateX(2px);
}

.nav-item.active {
  color: var(--green);
  background: rgba(115, 245, 108, 0.10);
  border-color: rgba(115, 245, 108, 0.22);
  box-shadow: 0 0 18px rgba(115, 245, 108, 0.12), inset 0 0 12px rgba(115, 245, 108, 0.06);
}

.nav-item:hover:not(.active) {
  box-shadow: 0 0 14px rgba(255, 255, 255, 0.05);
}

.device-card {
  margin-top: auto;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.045);
}

.device-card strong { display: block; font-size: 14px; line-height: 1.2; }
.device-card p, .device-card small { margin: 4px 0 0; color: var(--muted); font-size: 12px; }

.device-visual {
  position: relative;
  height: 54px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(115, 245, 108, 0.13), rgba(0, 0, 0, 0.22)), #0a0e12;
  overflow: hidden;
}

.device-visual::before,
.device-visual::after {
  content: "";
  position: absolute;
  top: 18px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 12px rgba(115, 245, 108, 0.8);
}

.device-visual::before { left: 18px; }
.device-visual::after { right: 18px; }

.device-visual span {
  position: absolute;
  left: 50%;
  bottom: 10px;
  width: 26px;
  height: 10px;
  transform: translateX(-50%);
  border-radius: 999px 999px 8px 8px;
  background: var(--green);
  box-shadow: 0 0 18px rgba(115, 245, 108, 0.65);
}

.battery-line {
  width: 100%;
  height: 7px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.battery-line span {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), #d7ff7a);
  transition: width 500ms ease;
}

.sidebar-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.sync-dot, .live-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 16px rgba(115, 245, 108, 0.8);
}

.dashboard { min-width: 0; padding: 8px 0 48px; }

.hero-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 28px;
  margin: 10px 0 18px;
}

.eyebrow,
.section-kicker,
.mini-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 8px;
  color: var(--green);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.hero-header h1 {
  margin: 0;
  font-size: clamp(40px, 6.4vw, 86px);
  line-height: 0.88;
  letter-spacing: -0.075em;
}

.hero-header p {
  max-width: 760px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.55;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.status-pill,
.ghost-button,
.chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.055);
  backdrop-filter: blur(18px);
}

.ghost-button { color: var(--muted); transition: color 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease; }
.ghost-button:hover { color: var(--text); border-color: var(--line-strong); background: rgba(255, 255, 255, 0.08); box-shadow: 0 0 22px rgba(255,255,255,0.07), 0 4px 14px rgba(0,0,0,0.25); }
.ghost-button:disabled { opacity: 0.65; cursor: wait; }

.notice {
  display: none;
  margin-bottom: 16px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 212, 74, 0.28);
  border-radius: 18px;
  color: #ffe69b;
  background: rgba(255, 212, 74, 0.09);
}

.notice.show { display: block; }

.card,
.glass-panel,
.compare-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.035)), rgba(9, 13, 18, 0.75);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.card { padding: 22px; }

.comparison-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 0 0 18px;
}

.compare-card {
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 116px;
  padding: 16px;
  overflow: hidden;
  position: relative;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
  cursor: default;
}

.compare-card:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  box-shadow: 0 24px 64px rgba(0,0,0,0.38), 0 0 28px rgba(255,255,255,0.06);
}

.compare-card.primary:hover {
  box-shadow: 0 24px 64px rgba(0,0,0,0.38), 0 0 32px rgba(115, 245, 108, 0.16);
  border-color: rgba(115, 245, 108, 0.28);
}

.compare-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 100% 0%, rgba(255,255,255,.08), transparent 44%);
  pointer-events: none;
}

.compare-card.primary { background: radial-gradient(circle at 90% 10%, rgba(115, 245, 108, 0.18), transparent 48%), rgba(255,255,255,.045); }
.compare-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  color: var(--green);
  background: var(--green-soft);
  position: relative;
  z-index: 1;
}
.compare-icon.water { color: var(--blue); background: var(--blue-soft); }
.compare-icon.fire { color: var(--orange); background: var(--orange-soft); }
.compare-icon.shield { color: var(--purple); background: var(--purple-soft); }
.compare-icon svg { width: 23px; height: 23px; }
.compare-card div { position: relative; z-index: 1; min-width: 0; }
.compare-card small { display: block; color: var(--muted); font-size: 12px; }
.compare-card strong { display: block; margin-top: 5px; font-size: 28px; line-height: 1; letter-spacing: -0.06em; }
.compare-card p { margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.35; }

.main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(360px, 0.74fr);
  gap: 18px;
  align-items: stretch;
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.card-head.compact { margin-bottom: 16px; }

.card h2,
.card h3 { margin: 0; line-height: 1; letter-spacing: -0.055em; }
.card h2 { font-size: clamp(26px, 4vw, 42px); }
.card h3 { font-size: clamp(24px, 3vw, 34px); }

.muted { margin: 8px 0 0; color: var(--muted); line-height: 1.45; }
.chip { min-height: 34px; padding: 7px 10px; color: var(--muted); font-size: 12px; white-space: nowrap; }

.recovery-card { min-height: 520px; }
.recovery-layout { display: grid; grid-template-columns: minmax(250px, 0.86fr) minmax(340px, 1fr); gap: 28px; align-items: center; }
.ring-stack { text-align: center; }

.score-ring {
  --score: 0;
  width: min(100%, 358px);
  aspect-ratio: 1;
  margin: 0 auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle, rgba(8, 11, 15, 0.99) 0 55%, transparent 56%),
    conic-gradient(var(--accent) calc(var(--score) * 1%), rgba(255, 255, 255, 0.08) 0);
  box-shadow: inset 0 0 36px rgba(255, 255, 255, 0.03), 0 0 78px var(--accent-glow);
  position: relative;
  transition: background 480ms ease, box-shadow 480ms ease;
}

.score-ring::before {
  content: "";
  position: absolute;
  inset: 20px;
  border-radius: inherit;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.score-ring::after {
  content: "";
  position: absolute;
  inset: -7px;
  border-radius: inherit;
  border: 1px solid rgba(255, 255, 255, 0.08);
  filter: blur(1px);
}

.score-inner { text-align: center; z-index: 1; }
.score-inner span { display: block; font-size: clamp(84px, 13vw, 136px); line-height: 0.86; font-weight: 880; letter-spacing: -0.09em; }
.score-inner small { display: block; margin-top: 12px; color: var(--muted); font-size: 17px; }
.ring-caption { margin: 14px auto 0; max-width: 340px; color: var(--muted); font-size: 13px; line-height: 1.45; }

.coach-panel {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: radial-gradient(circle at 100% 0%, var(--accent-soft), transparent 42%), rgba(255, 255, 255, 0.045);
}

.coach-panel p { color: var(--muted); line-height: 1.55; }
.coach-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.coach-stats div,
.weather-grid div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.045);
}
.coach-stats span,
.weather-grid span { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.coach-stats strong,
.weather-grid strong { display: block; margin-top: 6px; font-size: 18px; }

.weather-card { display: flex; flex-direction: column; min-height: 520px; }
.weather-icon {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 22px;
  color: var(--yellow);
  background: radial-gradient(circle at 35% 30%, rgba(255, 212, 74, .18), rgba(255,255,255,.05));
}
.weather-icon svg { width: 35px; height: 35px; }

.weather-main {
  padding: 20px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(115, 245, 108, 0.15), rgba(74, 184, 255, 0.055)), rgba(255, 255, 255, 0.045);
}
.weather-main strong { display: block; font-size: clamp(48px, 7vw, 74px); line-height: 0.92; letter-spacing: -0.07em; }
.weather-main span { display: block; margin-top: 10px; color: var(--muted); }
.weather-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.weather-grid.dense div { min-height: 72px; }

#weatherCanvas,
#trendCanvas { width: 100%; display: block; }
#weatherCanvas { margin-top: 14px; min-height: 150px; border-radius: 18px; background: rgba(255,255,255,.025); border: 1px solid var(--line); }

.weather-legend,
.legend {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}
.weather-legend span,
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.weather-legend i,
.legend i { width: 9px; height: 9px; border-radius: 999px; }


.forecast-summary {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background:
    radial-gradient(circle at 0 0, rgba(115, 245, 108, 0.14), transparent 45%),
    linear-gradient(135deg, rgba(255,255,255,.065), rgba(255,255,255,.025));
}
.forecast-summary-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: var(--green);
  background: var(--green-soft);
  box-shadow: 0 0 22px rgba(115,245,108,.14);
}
.forecast-summary strong { display: block; line-height: 1.2; }
.forecast-summary p { margin: 5px 0 0; color: var(--muted); font-size: 13px; line-height: 1.4; }

.forecast-pressure-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
  margin-top: 12px;
}
.pressure-card {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,255,255,.04);
  overflow: hidden;
  position: relative;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
  cursor: default;
}

.pressure-card:hover {
  transform: translateY(-2px);
  border-color: currentColor;
  border-color: color-mix(in srgb, currentColor 40%, transparent);
  box-shadow: 0 0 24px color-mix(in srgb, currentColor 25%, transparent), 0 8px 24px rgba(0,0,0,0.28);
}
.pressure-card::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .26;
  background: radial-gradient(circle at 85% 10%, currentColor, transparent 52%);
  pointer-events: none;
}
.pressure-card.heat { color: var(--red); }
.pressure-card.uv { color: var(--yellow); }
.pressure-card.wind { color: var(--purple); }
.pressure-card.rain { color: var(--blue); }
.pressure-card span,
.pressure-card small {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}
.pressure-card strong {
  display: block;
  margin-top: 8px;
  color: var(--text);
  font-size: 24px;
  line-height: .95;
  letter-spacing: -0.06em;
}
.pressure-card small { margin-top: 6px; display: block; }

.model-strip {
  display: grid;
  grid-template-columns: 1.2fr .85fr .85fr;
  gap: 10px;
  margin-top: 14px;
}
.model-strip div {
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,255,255,.04);
}
.model-strip span { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .12em; }
.model-strip strong { display: block; margin-top: 6px; font-size: 15px; }

.forecast-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: auto; padding-top: 14px; }
.forecast-day { padding: 12px; border-radius: 16px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.04); transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease; cursor: default; }
.forecast-day:hover { transform: translateY(-2px); border-color: rgba(255, 212, 74, 0.28); box-shadow: 0 0 22px rgba(255, 212, 74, 0.14), 0 8px 22px rgba(0,0,0,0.26); }
.forecast-day span,
.forecast-day small { display: block; color: var(--muted); font-size: 12px; }
.forecast-day strong { display: block; margin: 6px 0 2px; font-size: 20px; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-top: 18px; }
.metric-card {
  position: relative;
  min-height: 188px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: radial-gradient(circle at 100% 0%, rgba(255, 255, 255, 0.06), transparent 38%), rgba(255, 255, 255, 0.045);
  overflow: hidden;
}
.metric-card.primary { background: radial-gradient(circle at 88% 12%, rgba(74, 184, 255, 0.18), transparent 45%), rgba(255, 255, 255, 0.045); }
.metric-card.danger-aware { background: radial-gradient(circle at 92% 15%, rgba(255, 92, 122, 0.12), transparent 45%), rgba(255, 255, 255, 0.045); }
.metric-card.light-aware { background: radial-gradient(circle at 92% 15%, rgba(255, 212, 74, 0.12), transparent 45%), rgba(255, 255, 255, 0.045); }
.metric-card.weather-aware { background: radial-gradient(circle at 92% 15%, rgba(183, 133, 255, 0.12), transparent 45%), rgba(255, 255, 255, 0.045); }
.metric-card.scream-aware { background: radial-gradient(circle at 92% 15%, rgba(255, 142, 60, 0.12), transparent 45%), rgba(255, 255, 255, 0.045); }

.metric-top { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 13px; }
.metric-top span { display: inline-flex; align-items: center; gap: 7px; color: var(--text); font-weight: 760; }
.metric-value { display: flex; align-items: baseline; gap: 6px; margin-top: 16px; font-weight: 870; letter-spacing: -0.065em; }
.metric-value span { font-size: clamp(36px, 5vw, 56px); line-height: 0.9; }
.metric-value small { color: var(--muted); font-size: 16px; letter-spacing: -0.02em; }
.metric-card p { margin: 14px 0 0; color: var(--muted); font-size: 13px; line-height: 1.45; }

.mini-ring {
  --score: 0;
  position: absolute;
  right: 16px;
  bottom: 16px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--panel-solid) 58%, transparent 59%), conic-gradient(var(--blue) calc(var(--score) * 1%), rgba(255, 255, 255, 0.08) 0);
}

.load-bar { height: 8px; margin-top: 18px; overflow: hidden; border-radius: 999px; background: rgba(255, 255, 255, 0.08); }
.load-bar span { display: block; width: 0%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), rgba(255, 255, 255, 0.75)); transition: width 520ms ease; }

.lower-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(330px, 0.7fr); gap: 18px; margin-top: 18px; }
.chart-card canvas { min-height: 290px; }
.range-tabs { display: inline-flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255, 255, 255, 0.045); }
.range-tabs button { border: 0; border-radius: 999px; color: var(--muted); background: transparent; padding: 7px 11px; font-size: 12px; transition: color 140ms ease, background 140ms ease, box-shadow 140ms ease; }
.range-tabs button:hover:not(.active) { color: var(--text); background: rgba(255,255,255,0.07); }
.range-tabs button.active { color: #061108; background: var(--green); font-weight: 850; box-shadow: 0 0 18px rgba(115, 245, 108, 0.45); }

.legend-hydration { background: var(--blue); }
.legend-stress { background: var(--orange); }
.legend-temp { background: var(--red); }
.legend-humidity { background: var(--green); }
.legend-light { background: var(--yellow); }
.legend-rain { background: var(--blue); }
.legend-uv { background: var(--yellow); }
.legend-wind { background: var(--purple); }

.action-list {
  display: grid;
  gap: 10px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.action-list li,
.event-item {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.045);
}

.action-list li {
  --action-color: var(--green);
  --action-bg: rgba(115, 245, 108, 0.12);
  --action-border: rgba(115, 245, 108, 0.22);
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: flex-start;
  gap: 12px;
  border-color: rgba(255, 255, 255, 0.09);
  background:
    radial-gradient(circle at 0% 0%, var(--action-bg), transparent 58%),
    rgba(255, 255, 255, 0.040);
  transition: border-color 180ms ease, transform 180ms ease, background 180ms ease;
}

.action-list li:hover {
  transform: translateY(-2px);
  border-color: var(--action-border);
  background:
    radial-gradient(circle at 0% 0%, var(--action-bg), transparent 62%),
    rgba(255, 255, 255, 0.055);
  box-shadow: 0 0 28px color-mix(in srgb, var(--action-color) 22%, transparent), 0 8px 28px rgba(0,0,0,0.26);
}

.action-list li.action-water { --action-color: var(--blue); --action-bg: rgba(74, 184, 255, 0.14); --action-border: rgba(74, 184, 255, 0.28); }
.action-list li.action-danger { --action-color: var(--red); --action-bg: rgba(255, 92, 122, 0.14); --action-border: rgba(255, 92, 122, 0.30); }
.action-list li.action-light { --action-color: var(--yellow); --action-bg: rgba(255, 212, 74, 0.14); --action-border: rgba(255, 212, 74, 0.30); }
.action-list li.action-weather { --action-color: var(--cyan); --action-bg: rgba(84, 244, 210, 0.12); --action-border: rgba(84, 244, 210, 0.26); }
.action-list li.action-heat { --action-color: var(--orange); --action-bg: rgba(255, 142, 60, 0.13); --action-border: rgba(255, 142, 60, 0.28); }
.action-list li.action-sensor { --action-color: var(--purple); --action-bg: rgba(183, 133, 255, 0.13); --action-border: rgba(183, 133, 255, 0.27); }
.action-list li.action-data { --action-color: var(--green); --action-bg: rgba(115, 245, 108, 0.11); --action-border: rgba(115, 245, 108, 0.24); }
.action-list li.action-ok { --action-color: var(--green); --action-bg: rgba(115, 245, 108, 0.12); --action-border: rgba(115, 245, 108, 0.26); }

.action-icon {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  align-self: start;
  margin: 0;
  border: 1px solid var(--action-border);
  border-radius: 14px;
  color: var(--action-color);
  background: var(--action-bg);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 10px 24px rgba(0, 0, 0, 0.20);
}

.action-icon .icon {
  display: block;
  width: 19px;
  height: 19px;
  margin: 0;
  color: inherit;
  stroke-width: 2;
}

.action-copy { min-width: 0; padding-top: 1px; }
.action-list strong,
.event-item strong { display: block; line-height: 1.18; }
.action-copy span,
.event-item span { display: block; margin-top: 5px; color: var(--muted); font-size: 13px; line-height: 1.38; }

.action-card .card-head { align-items: flex-start; }
.action-card #priorityChip {
  border-color: rgba(115, 245, 108, 0.22);
  color: var(--green);
  background: rgba(115, 245, 108, 0.10);
  font-weight: 850;
}

.log-card { margin-top: 18px; }
.event-list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.event-item { position: relative; overflow: hidden; }
.event-item::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--accent); opacity: .75; }
.event-time { color: var(--green) !important; font-weight: 800; }

.mobile-tabbar { display: none; }

.delta-positive { color: var(--green) !important; }
.delta-negative { color: var(--red) !important; }
.delta-neutral { color: var(--muted) !important; }

body.score-warning { --accent: var(--yellow); --accent-soft: var(--yellow-soft); --accent-glow: rgba(255, 212, 74, 0.32); }
body.score-danger { --accent: var(--red); --accent-soft: var(--red-soft); --accent-glow: rgba(255, 92, 122, 0.32); }
body.score-watch { --accent: var(--orange); --accent-soft: var(--orange-soft); --accent-glow: rgba(255, 142, 60, 0.30); }

@media (max-width: 1260px) {
  .comparison-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .event-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1180px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: sticky;
    z-index: 20;
    top: 10px;
    height: auto;
    min-height: 0;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
  }
  .nav-list { display: flex; min-width: max-content; }
  .device-card { min-width: 245px; margin: 0 0 0 auto; }
  .sidebar-foot { display: none; }
  .main-grid,
  .lower-grid { grid-template-columns: 1fr; }
  .weather-card { min-height: 0; }
}

@media (max-width: 820px) {
  body { padding-bottom: 100px; }
  .shell { padding: 12px 12px 14px; gap: 12px; }
  .sidebar { border-radius: 20px; padding: 11px 14px; }
  .brandmark small,
  .device-card,
  .nav-list { display: none; }
  .brandmark strong { font-size: 18px; }

  /* Hero header — generous vertical rhythm */
  .hero-header { flex-direction: column; gap: 14px; margin-top: 6px; margin-bottom: 6px; }
  .hero-header h1 { font-size: clamp(44px, 13.5vw, 68px); margin-bottom: 4px; }
  .hero-header p { font-size: 14.5px; line-height: 1.58; margin-top: 10px; max-width: 100%; }
  .header-actions { width: 100%; justify-content: flex-start; gap: 8px; }
  .eyebrow { font-size: 11px; letter-spacing: 0.14em; margin-bottom: 6px; }

  /* Status pill & button sizing for touch */
  .status-pill, .ghost-button { min-height: 40px; padding: 9px 14px; font-size: 13px; }

  /* Comparison strip — horizontal scroll with peek */
  .comparison-strip {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
    gap: 10px;
    margin: 0 -12px 6px;
    padding-left: 12px;
    padding-right: 12px;
  }
  .compare-card {
    min-width: 200px;
    scroll-snap-align: start;
    border-radius: 22px;
    padding: 14px;
    flex-shrink: 0;
  }
  .compare-card strong { font-size: 24px; }

  /* Main cards — more breathing room */
  .card, .metric-card { border-radius: 24px; padding: 18px; }
  .card-head { gap: 12px; margin-bottom: 16px; }
  .card h2 { font-size: clamp(24px, 7vw, 36px); }

  /* Recovery layout stacks vertically */
  .recovery-layout { grid-template-columns: 1fr; gap: 20px; }
  .score-ring { width: min(78vw, 300px); }
  .coach-panel { padding: 18px; border-radius: 22px; }
  .coach-stats { gap: 10px; }
  .coach-stats div { padding: 14px; border-radius: 18px; }
  .coach-stats strong { font-size: 20px; }

  /* Grids — single column on phone */
  .metric-grid,
  .event-list { grid-template-columns: 1fr; }
  .weather-grid,
  .coach-stats,
  .forecast-strip { grid-template-columns: 1fr 1fr; }
  .forecast-pressure-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .model-strip { grid-template-columns: 1fr; gap: 8px; }
  .lower-grid { gap: 14px; }

  /* Weather card spacing */
  .weather-main { padding: 16px; border-radius: 20px; }
  .weather-main strong { font-size: clamp(46px, 12vw, 62px); }
  .weather-grid div { padding: 12px; border-radius: 14px; }
  .forecast-day { padding: 14px; border-radius: 18px; }
  .pressure-card { padding: 13px; border-radius: 18px; }

  /* Charts */
  .chart-card canvas { min-height: 220px; }
  #weatherCanvas { min-height: 130px; }

  /* Chip — can wrap on mobile */
  .chip { white-space: normal; font-size: 11px; min-height: 30px; padding: 6px 10px; }

  /* Action list items — larger touch target */
  .action-list { gap: 10px; }
  .action-list li { padding: 15px; border-radius: 20px; }
  .action-icon { width: 40px; height: 40px; border-radius: 15px; }

  /* Event log */
  .event-item { padding: 14px; border-radius: 18px; }
  .log-card { margin-top: 14px; }

  /* Mobile tab bar — polished floating pill */
  .mobile-tabbar {
    position: fixed;
    left: max(10px, env(safe-area-inset-left));
    right: max(10px, env(safe-area-inset-right));
    bottom: max(10px, env(safe-area-inset-bottom));
    z-index: 100;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 3px;
    padding: 7px;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 26px;
    background: rgba(7, 10, 14, 0.92);
    box-shadow: 0 20px 60px rgba(0,0,0,.55), 0 0 0 1px rgba(255,255,255,.04) inset;
    backdrop-filter: blur(28px) saturate(180%);
  }
  .mobile-tabbar a {
    display: grid;
    place-items: center;
    gap: 3px;
    padding: 9px 4px;
    color: var(--dim);
    text-decoration: none;
    border-radius: 18px;
    font-size: 10.5px;
    letter-spacing: 0.01em;
    transition: color 150ms ease, background 150ms ease, box-shadow 150ms ease;
    -webkit-tap-highlight-color: transparent;
  }
  .mobile-tabbar a .icon { width: 20px; height: 20px; }
  .mobile-tabbar a.active {
    color: var(--green);
    background: rgba(115,245,108,.10);
    box-shadow: 0 0 20px rgba(115,245,108,.20);
  }
  .mobile-tabbar a:hover:not(.active) {
    color: var(--muted);
    background: rgba(255,255,255,.05);
  }
}

@media (max-width: 480px) {
  .shell { padding: 10px 10px 12px; }
  .hero-header h1 { font-size: clamp(40px, 13vw, 58px); letter-spacing: -0.050em; }
  .hero-header p { font-size: 14px; }
  .weather-grid,
  .coach-stats { grid-template-columns: 1fr 1fr; }
  .forecast-strip,
  .forecast-pressure-grid { grid-template-columns: 1fr 1fr; }
  .weather-main strong { font-size: clamp(42px, 14vw, 56px); }
  .metric-value span { font-size: 48px; }
  .card-head { flex-direction: column; gap: 10px; }
  .card-head.compact { flex-direction: row; }
  .range-tabs { width: 100%; justify-content: space-between; }
  .range-tabs button { flex: 1; }
  .comparison-strip { gap: 8px; }
  .compare-card { min-width: 175px; padding: 13px; border-radius: 20px; }
  .compare-card strong { font-size: 22px; }
  .compare-icon { width: 38px; height: 38px; border-radius: 13px; }
  .compare-icon svg { width: 20px; height: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}

/* Live Monitor replacement: polished WHOOP-style sensor cards */
.live-monitor-section {
  scroll-margin-top: 24px;
  margin-top: 18px;
}

.live-monitor-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
  padding: 0 2px;
}

.live-monitor-head h2 {
  margin: 0;
  font-size: clamp(28px, 4vw, 44px);
  line-height: .92;
  letter-spacing: -0.06em;
}

.live-monitor-head .muted {
  max-width: 820px;
}

.metric-grid.live-monitor-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin-top: 0;
}

.metric-card {
  min-height: 258px;
  padding: 23px;
  border-radius: 31px;
  border-color: rgba(255,255,255,.12);
  background:
    radial-gradient(circle at 92% 8%, rgba(255,255,255,.075), transparent 36%),
    linear-gradient(145deg, rgba(19,25,34,.86), rgba(11,15,21,.82));
  box-shadow: 0 20px 70px rgba(0,0,0,.28), inset 0 1px 0 rgba(255,255,255,.045);
  isolation: isolate;
  transition: transform 200ms ease, box-shadow 200ms ease, border-color 200ms ease;
}

.metric-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 28px 80px rgba(0,0,0,.38), inset 0 1px 0 rgba(255,255,255,.06), 0 0 36px rgba(115, 245, 108, 0.08);
  border-color: rgba(255,255,255,.18);
}

.metric-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  border-radius: inherit;
  background:
    linear-gradient(126deg, rgba(255,255,255,.09), transparent 42%),
    radial-gradient(circle at 102% -5%, var(--accent-soft), transparent 42%);
  opacity: .8;
}

.metric-card::after {
  content: "";
  position: absolute;
  left: 12%;
  right: 12%;
  bottom: -38%;
  height: 48%;
  z-index: 0;
  pointer-events: none;
  border-radius: 999px;
  background: radial-gradient(ellipse, var(--accent-glow), transparent 67%);
  filter: blur(18px);
  opacity: .42;
}

.metric-card > * { position: relative; z-index: 1; }
.metric-card.primary { background: radial-gradient(circle at 88% 10%, rgba(115,245,108,.19), transparent 44%), linear-gradient(145deg, rgba(17,31,25,.90), rgba(10,15,21,.82)); }
.metric-card.danger-aware { background: radial-gradient(circle at 92% 10%, rgba(255,92,122,.16), transparent 43%), linear-gradient(145deg, rgba(29,20,30,.90), rgba(10,14,20,.82)); }
.metric-card.light-aware { background: radial-gradient(circle at 92% 10%, rgba(255,212,74,.16), transparent 43%), linear-gradient(145deg, rgba(30,29,20,.90), rgba(10,14,20,.82)); }
.metric-card.stability-aware { background: radial-gradient(circle at 92% 10%, rgba(115,245,108,.14), transparent 43%), linear-gradient(145deg, rgba(17,31,25,.90), rgba(10,14,20,.82)); }
.metric-card.temperature-aware { background: radial-gradient(circle at 92% 10%, rgba(255,92,122,.13), transparent 43%), linear-gradient(145deg, rgba(20,25,32,.90), rgba(10,14,20,.82)); }
.metric-card.humidity-aware { background: radial-gradient(circle at 92% 10%, rgba(115,245,108,.13), transparent 43%), linear-gradient(145deg, rgba(20,25,32,.90), rgba(10,14,20,.82)); }
.metric-card.weather-aware { background: radial-gradient(circle at 92% 10%, rgba(74,184,255,.18), transparent 43%), linear-gradient(145deg, rgba(18,31,42,.90), rgba(10,14,20,.82)); }
.metric-card.scream-aware { background: radial-gradient(circle at 92% 10%, rgba(183,133,255,.18), transparent 43%), linear-gradient(145deg, rgba(25,23,42,.90), rgba(10,14,20,.82)); }

.metric-top {
  align-items: center;
  color: var(--muted);
}

.metric-top span {
  gap: 9px;
  font-weight: 850;
  letter-spacing: -0.035em;
}

.metric-top .icon {
  width: 18px;
  height: 18px;
  color: var(--yellow);
  filter: drop-shadow(0 0 8px rgba(255,212,74,.25));
}

.metric-top small {
  white-space: nowrap;
  font-size: 13px;
}

.metric-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.metric-value {
  margin-top: 20px;
}

.metric-value span {
  font-size: clamp(54px, 5.2vw, 76px);
  line-height: .84;
  font-weight: 900;
  letter-spacing: -0.040em;
}

.metric-value small {
  font-size: 18px;
  letter-spacing: -0.02em;
}

.metric-card p {
  max-width: 32ch;
  margin-top: 18px;
  color: #aab2bf;
  font-size: 15px;
  line-height: 1.55;
}

.mini-ring {
  --score: 0;
  position: static;
  width: 90px;
  height: 90px;
  flex: 0 0 90px;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(9,14,20,.96) 0 57%, transparent 58%),
    conic-gradient(var(--green) calc(var(--score) * 1%), rgba(255,255,255,.08) 0);
  box-shadow: 0 0 34px rgba(115,245,108,.20), inset 0 0 18px rgba(255,255,255,.025);
}

.load-bar {
  height: 10px;
  margin-top: 20px;
  background: rgba(255,255,255,.08);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.035);
}

.load-bar span {
  background: linear-gradient(90deg, var(--green), #b9ff69);
  box-shadow: 0 0 24px rgba(115,245,108,.34);
}

.load-bar.danger span { background: linear-gradient(90deg, var(--red), var(--orange)); box-shadow: 0 0 24px rgba(255,92,122,.34); }
.load-bar.yellow span { background: linear-gradient(90deg, var(--yellow), #fff28d); box-shadow: 0 0 24px rgba(255,212,74,.34); }
.load-bar.green span { background: linear-gradient(90deg, var(--green), #a8ff64); box-shadow: 0 0 24px rgba(115,245,108,.34); }
.load-bar.blue span { background: linear-gradient(90deg, var(--blue), #728bff); box-shadow: 0 0 24px rgba(74,184,255,.34); }

.sparkline {
  width: 100%;
  height: 54px;
  display: block;
  margin-top: 18px;
  border-radius: 16px;
  background: rgba(255,255,255,.025);
}

.sound-wave {
  height: 58px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
}

.sound-wave span {
  width: 11px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--purple), var(--blue));
  box-shadow: 0 0 18px rgba(183,133,255,.24);
  opacity: .9;
  animation: screamWave 1.1s ease-in-out infinite;
}

.sound-wave span:nth-child(1) { height: 25px; animation-delay: 0ms; }
.sound-wave span:nth-child(2) { height: 42px; animation-delay: 70ms; }
.sound-wave span:nth-child(3) { height: 56px; animation-delay: 140ms; }
.sound-wave span:nth-child(4) { height: 36px; animation-delay: 210ms; }
.sound-wave span:nth-child(5) { height: 22px; animation-delay: 280ms; }
body:not(.is-screaming) .sound-wave span { animation: none; opacity: .36; }

@keyframes screamWave {
  0%, 100% { transform: scaleY(.62); }
  50% { transform: scaleY(1.04); }
}

@media (max-width: 1220px) {
  .metric-grid.live-monitor-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .live-monitor-head {
    display: block;
    margin-bottom: 12px;
  }

  .live-monitor-head .chip { display: none; }
  .live-monitor-head h2 { font-size: 30px; }

  .metric-grid.live-monitor-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .metric-card {
    min-height: 184px;
    padding: 14px;
    border-radius: 22px;
  }

  .metric-card p {
    margin-top: 10px;
    font-size: 12px;
    line-height: 1.38;
  }

  .metric-main {
    display: block;
  }

  .metric-top {
    min-height: 33px;
    align-items: flex-start;
    gap: 6px;
  }

  .metric-top span {
    font-size: 12px;
    line-height: 1.2;
  }

  .metric-top .icon {
    width: 15px;
    height: 15px;
  }

  .metric-top small {
    font-size: 11px;
  }

  .metric-value {
    margin-top: 12px;
  }

  .metric-value span {
    font-size: clamp(38px, 16vw, 54px);
  }

  .metric-value small { font-size: 13px; }

  .mini-ring {
    position: absolute;
    right: 12px;
    top: 58px;
    width: 54px;
    height: 54px;
    flex-basis: 54px;
  }

  .load-bar {
    height: 8px;
    margin-top: 14px;
  }

  .sparkline {
    height: 38px;
    margin-top: 12px;
    border-radius: 12px;
  }

  .sound-wave {
    height: 40px;
    gap: 5px;
    margin-top: 14px;
  }

  .sound-wave span { width: 8px; }
}

@media (max-width: 390px) {
  .metric-grid.live-monitor-grid { grid-template-columns: 1fr; }
  .metric-card { min-height: 168px; }
  .metric-main { display: flex; }
  .mini-ring { position: static; width: 62px; height: 62px; flex-basis: 62px; }
}

/* Layout fix: keep the long Irbid weather panel in the right rail and use the
   left-side whitespace for live sensor cards instead of stretching Recovery. */
.main-grid {
  grid-template-columns: minmax(0, 1fr) minmax(372px, 0.56fr);
  align-items: start;
}

.main-left-stack {
  min-width: 0;
  display: grid;
  gap: 18px;
  align-content: start;
}

.main-left-stack .recovery-card {
  min-height: auto;
}

.main-left-stack .live-monitor-section {
  margin-top: 0;
}

.main-left-stack .live-monitor-head {
  align-items: flex-start;
  margin-bottom: 12px;
}

.main-left-stack .live-monitor-head h2 {
  font-size: clamp(27px, 3.1vw, 38px);
}

.main-left-stack .live-monitor-head .muted {
  max-width: 680px;
  font-size: 14px;
}

.main-left-stack .metric-grid.live-monitor-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.main-left-stack .metric-card {
  min-height: 220px;
  padding: 18px;
  border-radius: 26px;
}

.main-left-stack .metric-value {
  margin-top: 15px;
}

.main-left-stack .metric-value span {
  font-size: clamp(44px, 4.4vw, 64px);
}

.main-left-stack .metric-card p {
  margin-top: 12px;
  font-size: 13px;
  line-height: 1.42;
}

.main-left-stack .mini-ring {
  width: 76px;
  height: 76px;
  flex-basis: 76px;
}

.main-left-stack .sparkline {
  height: 44px;
  margin-top: 12px;
}

.main-left-stack .sound-wave {
  height: 44px;
  margin-top: 14px;
}

.main-left-stack .sound-wave span {
  width: 9px;
}

@media (min-width: 1500px) {
  .main-grid {
    grid-template-columns: minmax(0, 1.08fr) minmax(390px, 0.52fr);
  }
}

@media (max-width: 1180px) {
  .main-grid {
    grid-template-columns: 1fr;
  }

  .main-left-stack {
    display: contents;
  }

  .main-left-stack .recovery-card { order: 1; }
  .weather-card { order: 2; }
  .main-left-stack .live-monitor-section { order: 3; }

  .main-left-stack .metric-grid.live-monitor-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .main-left-stack .metric-grid.live-monitor-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .main-left-stack .metric-card {
    min-height: 184px;
    padding: 14px;
    border-radius: 22px;
  }

  .main-left-stack .metric-main {
    display: block;
  }

  .main-left-stack .mini-ring {
    position: absolute;
    right: 12px;
    top: 58px;
    width: 54px;
    height: 54px;
    flex-basis: 54px;
  }
}

@media (max-width: 390px) {
  .main-left-stack .metric-grid.live-monitor-grid {
    grid-template-columns: 1fr;
  }
}

/* ─── Polish & Glow Additions ─────────────────────────────────────── */

/* Coach stats hover */
.coach-stats div {
  transition: transform 170ms ease, border-color 170ms ease, box-shadow 170ms ease;
  cursor: default;
}
.coach-stats div:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  box-shadow: 0 0 18px rgba(255,255,255,0.06), 0 8px 20px rgba(0,0,0,0.24);
}

/* Weather grid items hover */
.weather-grid div {
  transition: transform 170ms ease, border-color 170ms ease, box-shadow 170ms ease;
  cursor: default;
}
.weather-grid div:hover {
  transform: translateY(-1px);
  border-color: rgba(74, 184, 255, 0.22);
  box-shadow: 0 0 16px rgba(74, 184, 255, 0.10), 0 6px 18px rgba(0,0,0,0.22);
}

/* Model strip hover */
.model-strip div {
  transition: transform 170ms ease, border-color 170ms ease, box-shadow 170ms ease;
  cursor: default;
}
.model-strip div:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  box-shadow: 0 0 14px rgba(115,245,108,0.08), 0 6px 16px rgba(0,0,0,0.22);
}

/* Sync dot pulse animation */
.sync-dot {
  animation: syncPulse 2.2s ease-in-out infinite;
}
@keyframes syncPulse {
  0%, 100% { box-shadow: 0 0 8px rgba(115, 245, 108, 0.5); opacity: 1; }
  50% { box-shadow: 0 0 22px rgba(115, 245, 108, 0.9); opacity: 0.75; }
}

/* Live dot pulse */
.live-dot {
  animation: livePulse 1.8s ease-in-out infinite;
}
@keyframes livePulse {
  0%, 100% { box-shadow: 0 0 8px rgba(115, 245, 108, 0.6); transform: scale(1); }
  50% { box-shadow: 0 0 20px rgba(115, 245, 108, 0.95); transform: scale(1.15); }
}

/* Forecast summary hover */
.forecast-summary {
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
  cursor: default;
}
.forecast-summary:hover {
  transform: translateY(-2px);
  border-color: rgba(115, 245, 108, 0.22);
  box-shadow: 0 0 22px rgba(115, 245, 108, 0.10), 0 8px 24px rgba(0,0,0,0.24);
}

/* Score ring on hover — subtle glow intensify */
.score-ring {
  transition: box-shadow 320ms ease;
}
.score-ring:hover {
  box-shadow: inset 0 0 36px rgba(255, 255, 255, 0.04), 0 0 110px var(--accent-glow);
}

/* Notice box polish */
.notice {
  border-radius: 20px;
  padding: 16px 18px;
}

/* Section spacing — more breathing room between sections */
.comparison-strip { margin-bottom: 22px; }
.lower-grid { margin-top: 22px; }
.log-card { margin-top: 22px; }

/* Mobile: section headings breathing room */
@media (max-width: 820px) {
  .section-kicker { margin-bottom: 4px; }
  .card-head { margin-bottom: 18px; }
  .card-head.compact { margin-bottom: 14px; }
  .comparison-strip { margin-bottom: 14px; }
  .lower-grid { margin-top: 14px; }
  .log-card { margin-top: 14px; }

  /* Wider shell gutter on mid-size phones */
  .forecast-summary { padding: 14px; border-radius: 18px; }
  .forecast-pressure-grid { margin-top: 10px; }

  /* Event items better mobile */
  .event-list { grid-template-columns: 1fr; gap: 10px; }

  /* Score ring caption */
  .ring-caption { font-size: 12.5px; }

  /* Trend chart more compact */
  .chart-card canvas { min-height: 200px; }

  /* Action card padding */
  .action-card { padding: 18px; }
  .action-list li { padding: 14px; }
  .action-list li { grid-template-columns: 40px minmax(0,1fr); }
  .action-copy span { font-size: 12.5px; }
}

/* Touch ripple hint — scale on active for mobile tap feedback */
@media (hover: none) {
  .action-list li:active {
    transform: scale(0.98);
    box-shadow: 0 0 24px color-mix(in srgb, var(--action-color) 30%, transparent);
  }
  .compare-card:active { transform: scale(0.98); }
  .pressure-card:active { transform: scale(0.97); }
  .forecast-day:active { transform: scale(0.97); }
  .mobile-tabbar a:active {
    background: rgba(115,245,108,.13);
    color: var(--green);
  }
}
/* Production telemetry additions */
.metric-card.soil-temperature-aware {
  background: radial-gradient(circle at 92% 10%, rgba(255,142,60,.15), transparent 43%), linear-gradient(145deg, rgba(29,24,20,.90), rgba(10,14,20,.82));
}

.light-day-card {
  min-height: 282px;
}

.daylight-chart {
  width: 100%;
  height: 82px;
  display: block;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,255,255,.024);
}

.light-day-summary {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

@media (max-width: 640px) {
  .light-day-card { min-height: 218px; }
  .daylight-chart { height: 64px; margin-top: 10px; border-radius: 13px; }
  .light-day-summary { font-size: 10.5px; }
}

/* Interactive vitals + Irbid local-time refinements */
body {
  letter-spacing: 0.006em;
}

/* Balanced tight typography — letters breathe without losing impact */
.hero-header h1 { letter-spacing: -0.042em; }
.card h2, .card h3, .live-monitor-head h2 { letter-spacing: -0.030em; }
.brandmark strong { letter-spacing: -0.030em; }
.metric-value span { letter-spacing: -0.040em; }
.score-inner span { letter-spacing: -0.045em; }
.weather-main strong { letter-spacing: -0.038em; }

.local-time-pill strong {
  font-size: 13px;
  color: var(--green);
  letter-spacing: 0.035em;
  white-space: nowrap;
}

.metric-card[data-vital] {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.metric-card[data-vital]:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--green) 72%, transparent);
  outline-offset: 4px;
}

@media (max-width: 820px) {
  .local-time-pill { order: 3; }
}

/* Vital detail modal */
.vital-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(2, 4, 8, 0.78);
  backdrop-filter: blur(18px) saturate(140%);
  opacity: 0;
  transition: opacity 240ms ease;
}

.vital-modal-overlay[hidden] {
  display: none !important;
}

.vital-modal-overlay.open {
  opacity: 1;
}

.vital-modal-panel {
  position: relative;
  width: min(860px, 100%);
  max-height: calc(100dvh - 64px);
  overflow-y: auto;
  padding: 36px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 32px;
  background:
    radial-gradient(circle at 96% 4%, rgba(115,245,108,0.09), transparent 38%),
    linear-gradient(180deg, rgba(16, 21, 30, 0.98), rgba(8, 12, 18, 0.97));
  box-shadow: 0 50px 140px rgba(0,0,0,0.70), 0 0 0 1px rgba(255,255,255,0.05) inset;
  transform: translateY(22px) scale(0.96);
  opacity: 0;
  transition:
    transform 300ms cubic-bezier(0.34, 1.18, 0.64, 1),
    opacity 240ms ease;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
}

.vital-modal-overlay.open .vital-modal-panel {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.vital-modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  transition: color 150ms ease, background 150ms ease, border-color 150ms ease, transform 150ms ease;
  z-index: 2;
}

.vital-modal-close:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.11);
  border-color: var(--line-strong);
  transform: scale(1.08);
}

.vital-modal-close .icon {
  width: 16px;
  height: 16px;
}

@media (max-width: 640px) {
  .vital-modal-overlay { padding: 12px; align-items: flex-end; }
  .vital-modal-panel { padding: 24px 20px 32px; border-radius: 28px 28px 20px 20px; max-height: 90dvh; transform: translateY(40px) scale(0.98); }
  .vital-modal-overlay.open .vital-modal-panel { transform: translateY(0) scale(1); }
}

/* Metric card — subtle glow on hover to hint it's interactive */
.metric-card[data-vital]:hover {
  border-color: rgba(255,255,255,0.22);
  box-shadow: 0 28px 80px rgba(0,0,0,.40), inset 0 1px 0 rgba(255,255,255,.07), 0 0 42px rgba(115,245,108,0.10);
}

/* Expanded panel content (rendered inside modal) */
.metric-expanded {
  display: block;
}

.expanded-divider {
  height: 1px;
  margin: 4px 0 20px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.18), transparent);
}

.expanded-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.expanded-head strong,
.expanded-head span,
.expanded-head em {
  display: block;
}

.expanded-head strong {
  font-size: 20px;
  line-height: 1.1;
  letter-spacing: -0.025em;
}

.expanded-head span {
  margin-top: 7px;
  max-width: 76ch;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.50;
}

.expanded-head em {
  flex: 0 0 auto;
  padding: 7px 11px;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 999px;
  color: var(--green);
  background: rgba(115,245,108,.08);
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
  white-space: nowrap;
}

.detail-chart {
  width: 100%;
  height: 138px;
  display: block;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.022);
}

.vital-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.vital-detail-grid div {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,255,255,.038);
}

.vital-detail-grid span {
  display: block;
  color: var(--dim);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .10em;
  text-transform: uppercase;
}

.vital-detail-grid strong {
  display: block;
  margin-top: 7px;
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.40;
  font-weight: 720;
}

.temperature-combo .metric-value {
  margin-top: 0;
}

.dual-vital-values {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.dual-vital-values div {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.042);
}

.dual-vital-values small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 820;
  letter-spacing: .055em;
  text-transform: uppercase;
}

.dual-vital-values strong {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-top: 8px;
  font-size: clamp(34px, 3.2vw, 50px);
  line-height: .92;
  font-weight: 900;
  letter-spacing: -0.036em;
}

.dual-vital-values em {
  color: var(--muted);
  font-size: 15px;
  font-style: normal;
  letter-spacing: 0;
}

.secondary-spark {
  margin-top: 8px;
  opacity: .84;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@media (max-width: 640px) {
  .vital-detail-grid div { padding: 11px; border-radius: 14px; }
  .vital-detail-grid strong { font-size: 12.5px; }
  .detail-chart { height: 112px; }
  .dual-vital-values { gap: 8px; margin-top: 13px; }
  .dual-vital-values div { padding: 10px; border-radius: 14px; }
  .dual-vital-values small { font-size: 9.5px; }
  .dual-vital-values strong { font-size: clamp(28px, 10vw, 40px); }
  .secondary-spark { display: none; }
  .expanded-head { display: block; }
  .expanded-head em { display: inline-flex; margin-top: 10px; }
}

@media (max-width: 390px) {
  .vital-detail-grid, .dual-vital-values { grid-template-columns: 1fr; }
}


/* Scroll-spy anchor reliability */
#top,
#live-monitor,
#weather,
#trends,
#events {
  scroll-margin-top: 92px;
}

@media (max-width: 820px) {
  #top,
  #live-monitor,
  #weather,
  #trends,
  #events {
    scroll-margin-top: 78px;
  }
}

/* Rich vital modal details */
.vital-modal-panel {
  width: min(980px, 100%);
}

.vital-expanded {
  display: grid;
  gap: 16px;
}

.vital-hero-row {
  display: grid;
  grid-template-columns: minmax(190px, 0.42fr) minmax(0, 1fr);
  gap: 12px;
  margin-bottom: 2px;
}

.vital-hero-reading,
.vital-hero-copy,
.vital-source-grid > div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 20px;
  background:
    radial-gradient(circle at 100% 0%, rgba(255,255,255,.07), transparent 44%),
    rgba(255,255,255,.042);
}

.vital-hero-reading {
  padding: 18px;
}

.vital-hero-reading span,
.vital-hero-copy span,
.vital-source-grid span {
  display: block;
  color: var(--dim);
  font-size: 10.5px;
  font-weight: 850;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.vital-hero-reading strong {
  display: block;
  margin-top: 9px;
  font-size: clamp(28px, 5vw, 42px);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.vital-hero-copy {
  padding: 17px 18px;
}

.vital-hero-copy p,
.vital-source-grid p,
.vital-info-card p,
.vital-chart-caption {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.48;
}

.rich-detail-chart {
  height: 224px;
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.045), rgba(255,255,255,.016)),
    rgba(255,255,255,.02);
}

.vital-chart-caption {
  margin-top: -6px;
  padding: 0 2px;
  color: #aab2bf;
}

.vital-card-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 11px;
  margin-top: 0;
}

.vital-detail-grid .vital-info-card {
  position: relative;
  overflow: hidden;
  padding: 15px;
  border-radius: 18px;
  background:
    radial-gradient(circle at 100% 0%, rgba(255,255,255,.06), transparent 46%),
    rgba(255,255,255,.038);
}

.vital-detail-grid .vital-info-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  opacity: .86;
  background: var(--muted);
}

.vital-info-card.good::before { background: var(--green); }
.vital-info-card.warning::before { background: var(--yellow); }
.vital-info-card.danger::before { background: var(--red); }
.vital-info-card.water::before { background: var(--blue); }
.vital-info-card.light::before { background: var(--yellow); }

.vital-detail-grid .vital-info-card.good {
  background:
    radial-gradient(circle at 100% 0%, rgba(115,245,108,.10), transparent 45%),
    rgba(255,255,255,.038);
}

.vital-detail-grid .vital-info-card.warning {
  background:
    radial-gradient(circle at 100% 0%, rgba(255,212,74,.10), transparent 45%),
    rgba(255,255,255,.038);
}

.vital-detail-grid .vital-info-card.danger {
  background:
    radial-gradient(circle at 100% 0%, rgba(255,92,122,.11), transparent 45%),
    rgba(255,255,255,.038);
}

.vital-detail-grid .vital-info-card.water {
  background:
    radial-gradient(circle at 100% 0%, rgba(74,184,255,.11), transparent 45%),
    rgba(255,255,255,.038);
}

.vital-detail-grid .vital-info-card.light {
  background:
    radial-gradient(circle at 100% 0%, rgba(255,212,74,.11), transparent 45%),
    rgba(255,255,255,.038);
}

.vital-source-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px;
}

.vital-source-grid > div {
  padding: 15px;
}

.vital-source-grid strong {
  display: block;
  margin-top: 7px;
  color: var(--text);
  font-size: 15px;
  line-height: 1.3;
}

.vital-light .rich-detail-chart {
  border-color: rgba(255,212,74,.20);
  box-shadow: 0 0 34px rgba(255,212,74,.06);
}

.vital-hydration .rich-detail-chart {
  border-color: rgba(74,184,255,.20);
}

.vital-scream .rich-detail-chart {
  border-color: rgba(183,133,255,.20);
}

@media (max-width: 860px) {
  .vital-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .vital-hero-row,
  .vital-source-grid {
    grid-template-columns: 1fr;
  }

  .rich-detail-chart {
    height: 210px;
  }
}

@media (max-width: 520px) {
  .vital-card-grid {
    grid-template-columns: 1fr;
  }

  .expanded-head {
    display: block;
  }

  .expanded-head em {
    display: inline-flex;
    margin-top: 12px;
  }

  .vital-hero-reading strong {
    font-size: 30px;
  }
}


/* Interactive chart legends and hover readouts */
.chart-legend {
  display: flex;
  align-items: center;
  gap: 12px 14px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.chart-legend.compact {
  margin-top: 10px;
}

.light-day-legend {
  margin-top: 8px;
  gap: 8px 10px;
  font-size: 10.5px;
}

.vital-detail-legend {
  margin-top: -4px;
  padding: 0 2px;
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.legend-shape {
  --legend-size: 9px;
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
  width: var(--legend-size);
  height: var(--legend-size);
  background: var(--legend-color, var(--green));
  box-shadow: 0 0 12px color-mix(in srgb, var(--legend-color, var(--green)) 42%, transparent);
}

.legend-shape.circle { border-radius: 999px; }
.legend-shape.square { border-radius: 3px; }
.legend-shape.diamond { border-radius: 3px; transform: rotate(45deg); }
.legend-shape.triangle {
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 10px solid var(--legend-color, var(--green));
  background: transparent;
  box-shadow: none;
}
.legend-shape.bar {
  width: 7px;
  height: 14px;
  border-radius: 999px 999px 3px 3px;
}
.legend-shape.line,
.legend-shape.step {
  width: 18px;
  height: 3px;
  border-radius: 999px;
}
.legend-shape.step::after {
  content: "";
  position: absolute;
  right: -2px;
  top: -5px;
  width: 8px;
  height: 8px;
  border-top: 3px solid var(--legend-color, var(--green));
  border-right: 3px solid var(--legend-color, var(--green));
  border-radius: 0 3px 0 0;
}
.legend-shape.band {
  width: 20px;
  height: 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--legend-color, var(--green)) 22%, transparent);
  border: 1px solid color-mix(in srgb, var(--legend-color, var(--green)) 58%, transparent);
}

.has-chart-hover {
  cursor: crosshair;
}

.chart-hover-tooltip {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transition: opacity 90ms ease;
}

.chart-hover-tooltip.show {
  opacity: 1;
}

.chart-hover-dot {
  position: fixed;
  left: var(--dot-x);
  top: var(--dot-y);
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255,255,255,.88);
  border-radius: 999px;
  background: var(--dot-color, #fff);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--dot-color, #fff) 22%, transparent), 0 0 18px color-mix(in srgb, var(--dot-color, #fff) 68%, transparent);
  transform: translate(-50%, -50%) scale(.96);
}

.chart-hover-tooltip[data-shape="diamond"] .chart-hover-dot {
  border-radius: 3px;
  transform: translate(-50%, -50%) rotate(45deg) scale(.92);
}

.chart-hover-tooltip[data-shape="square"] .chart-hover-dot {
  border-radius: 3px;
}

.chart-hover-tooltip[data-shape="triangle"] .chart-hover-dot {
  width: 0;
  height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-bottom: 13px solid var(--dot-color, #fff);
  border-top: 0;
  background: transparent;
  box-shadow: 0 0 18px color-mix(in srgb, var(--dot-color, #fff) 68%, transparent);
  transform: translate(-50%, -50%);
}

.chart-hover-tooltip[data-shape="bar"] .chart-hover-dot {
  width: 9px;
  height: 18px;
  border-radius: 999px 999px 3px 3px;
}

.chart-hover-tooltip[data-shape="line"] .chart-hover-dot,
.chart-hover-tooltip[data-shape="step"] .chart-hover-dot {
  width: 20px;
  height: 6px;
  border-radius: 999px;
}

.chart-hover-card {
  position: fixed;
  left: var(--card-x);
  top: var(--card-y);
  min-width: 160px;
  max-width: 205px;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 15px;
  background: rgba(7, 10, 14, .88);
  box-shadow: 0 14px 46px rgba(0,0,0,.42), 0 0 24px color-mix(in srgb, var(--dot-color, #fff) 14%, transparent);
  backdrop-filter: blur(18px) saturate(160%);
}

.chart-hover-card strong {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text);
  font-size: 12px;
  line-height: 1.2;
}

.chart-hover-card strong::before {
  content: "";
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--dot-color, #fff);
  box-shadow: 0 0 12px color-mix(in srgb, var(--dot-color, #fff) 55%, transparent);
}

.chart-hover-x,
.chart-hover-y {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
}

.chart-hover-y {
  color: var(--text);
  font-weight: 850;
  font-size: 13px;
}

@media (max-width: 640px) {
  .chart-hover-card {
    max-width: 180px;
    padding: 9px 10px;
  }
  .vital-detail-legend,
  .chart-legend.compact {
    gap: 8px 10px;
    font-size: 11px;
  }
}

/* Weather grouping + phone scaling refinements */
.weather-grid.grouped {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.weather-group-card {
  min-height: 86px;
  position: relative;
  overflow: hidden;
}

.weather-group-card small {
  display: block;
  margin-top: 6px;
  color: var(--dim);
  font-size: 11px;
  line-height: 1.25;
}

.weather-group-card::after {
  content: "";
  position: absolute;
  inset: auto -18% -45% 28%;
  height: 70%;
  border-radius: 999px;
  background: radial-gradient(ellipse, currentColor, transparent 66%);
  opacity: .10;
  pointer-events: none;
  filter: blur(14px);
}

.weather-group-card.thermal { color: var(--red); }
.weather-group-card.humidity { color: var(--green); }
.weather-group-card.wind { color: var(--purple); }
.weather-group-card.rain { color: var(--blue); }
.weather-group-card.sun { color: var(--yellow); }
.weather-group-card.water-demand { color: var(--cyan); }
.weather-group-card span,
.weather-group-card strong,
.weather-group-card small { position: relative; z-index: 1; }
.weather-group-card strong { color: var(--text); }
.weather-group-card span { color: color-mix(in srgb, currentColor 82%, var(--muted)); }

@media (max-width: 640px) {
  .main-left-stack .metric-grid.live-monitor-grid,
  .metric-grid.live-monitor-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }

  .main-left-stack .metric-card,
  .metric-card {
    min-height: auto;
    padding: 13px;
    border-radius: 20px;
  }

  .main-left-stack .metric-card.primary .metric-main > div,
  .metric-card.primary .metric-main > div {
    padding-right: 48px;
  }

  .main-left-stack .mini-ring,
  .mini-ring {
    top: 58px;
    right: 11px;
    width: 42px;
    height: 42px;
    flex-basis: 42px;
    opacity: .90;
    box-shadow: 0 0 20px rgba(115,245,108,.18), inset 0 0 12px rgba(255,255,255,.025);
  }

  .main-left-stack .metric-value span,
  .metric-value span {
    font-size: clamp(34px, 13vw, 46px);
    letter-spacing: -0.032em;
  }

  .main-left-stack .metric-value small,
  .metric-value small {
    font-size: 12px;
  }

  .metric-card.temperature-combo,
  .metric-card.light-day-card {
    grid-column: 1 / -1;
  }

  .dual-vital-values {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .dual-vital-values div {
    padding: 9px;
    border-radius: 13px;
  }

  .dual-vital-values small {
    font-size: 8.7px;
    letter-spacing: .035em;
  }

  .dual-vital-values strong {
    font-size: clamp(24px, 8.4vw, 34px);
    gap: 3px;
  }

  .dual-vital-values em {
    font-size: 11px;
  }

  .weather-grid.grouped {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .weather-group-card {
    min-height: 82px;
    padding: 11px;
  }

  .weather-group-card strong {
    font-size: 16px;
    line-height: 1.05;
  }

  .weather-group-card small {
    font-size: 10px;
  }
}

@media (max-width: 430px) {
  .main-left-stack .metric-grid.live-monitor-grid,
  .metric-grid.live-monitor-grid {
    grid-template-columns: 1fr;
  }

  .metric-card.temperature-combo,
  .metric-card.light-day-card {
    grid-column: auto;
  }

  .main-left-stack .metric-card.primary .metric-main,
  .metric-card.primary .metric-main {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .main-left-stack .metric-card.primary .metric-main > div,
  .metric-card.primary .metric-main > div {
    padding-right: 0;
  }

  .main-left-stack .mini-ring,
  .mini-ring {
    position: static;
    width: 54px;
    height: 54px;
    flex: 0 0 54px;
  }

  .dual-vital-values {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .weather-grid.grouped {
    grid-template-columns: 1fr;
  }
}

/* Ultra-thin phone vital compression: keep two vitals per row where practical. */
@media (max-width: 520px) {
  .main-left-stack .metric-grid.live-monitor-grid,
  .metric-grid.live-monitor-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
  }

  .metric-card.temperature-combo,
  .metric-card.light-day-card {
    grid-column: auto !important;
  }

  .main-left-stack .metric-card,
  .metric-card {
    min-height: 154px !important;
    padding: 11px !important;
    border-radius: 18px !important;
  }

  .metric-top {
    min-height: 0 !important;
    gap: 5px !important;
  }

  .metric-top span {
    max-width: 100%;
    font-size: 11px !important;
    line-height: 1.13 !important;
    letter-spacing: -0.015em;
  }

  .metric-top .icon {
    width: 13px !important;
    height: 13px !important;
  }

  .metric-top small {
    max-width: 44px;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 9.5px !important;
  }

  .main-left-stack .metric-value,
  .metric-value {
    margin-top: 10px !important;
  }

  .main-left-stack .metric-value span,
  .metric-value span {
    font-size: clamp(30px, 11vw, 39px) !important;
    line-height: .88 !important;
  }

  .main-left-stack .metric-value small,
  .metric-value small {
    font-size: 10.5px !important;
  }

  .main-left-stack .metric-card p,
  .metric-card p {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-top: 8px !important;
    font-size: 10.8px !important;
    line-height: 1.27 !important;
  }

  .load-bar {
    height: 6px !important;
    margin-top: 10px !important;
  }

  .sparkline {
    height: 28px !important;
    margin-top: 9px !important;
    border-radius: 10px !important;
  }

  .main-left-stack .metric-card.primary .metric-main,
  .metric-card.primary .metric-main {
    display: block !important;
  }

  .main-left-stack .metric-card.primary .metric-main > div,
  .metric-card.primary .metric-main > div {
    padding-right: 0 !important;
  }

  .main-left-stack .metric-card.primary .mini-ring,
  .metric-card.primary .mini-ring {
    display: none !important;
  }

  .daylight-chart {
    display: none !important;
  }

  .light-day-card {
    min-height: 154px !important;
  }

  .light-day-summary {
    display: none !important;
  }

  .dual-vital-values {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 5px !important;
    margin-top: 9px !important;
  }

  .dual-vital-values div {
    padding: 7px 6px !important;
    border-radius: 11px !important;
  }

  .dual-vital-values small {
    font-size: 7.6px !important;
    line-height: 1.05 !important;
    letter-spacing: .03em !important;
  }

  .dual-vital-values strong {
    font-size: clamp(18px, 7vw, 26px) !important;
    line-height: .92 !important;
    gap: 2px !important;
    letter-spacing: -0.035em !important;
  }

  .dual-vital-values em {
    font-size: 8.5px !important;
  }

  .temperature-combo .sparkline,
  .temperature-combo .secondary-spark {
    display: none !important;
  }

  .weather-grid.grouped {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 360px) {
  .main-left-stack .metric-grid.live-monitor-grid,
  .metric-grid.live-monitor-grid {
    gap: 7px !important;
  }

  .main-left-stack .metric-card,
  .metric-card {
    min-height: 146px !important;
    padding: 10px !important;
  }

  .metric-top span {
    font-size: 10.5px !important;
  }

  .main-left-stack .metric-value span,
  .metric-value span {
    font-size: clamp(27px, 10.5vw, 35px) !important;
  }

  .dual-vital-values strong {
    font-size: clamp(16px, 6.5vw, 23px) !important;
  }
}

@media (max-width: 320px) {
  .main-left-stack .metric-grid.live-monitor-grid,
  .metric-grid.live-monitor-grid {
    grid-template-columns: 1fr !important;
  }

  .main-left-stack .metric-card,
  .metric-card {
    min-height: auto !important;
  }
}

/* Orphan vital card handling: when a final vital would sit alone on a two-column row, let it use the full row. */
.main-left-stack .metric-grid.live-monitor-grid > .metric-card:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

@media (max-width: 1220px) {
  .metric-grid.live-monitor-grid > .metric-card:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
}

@media (max-width: 320px) {
  .metric-grid.live-monitor-grid > .metric-card:last-child:nth-child(odd),
  .main-left-stack .metric-grid.live-monitor-grid > .metric-card:last-child:nth-child(odd) {
    grid-column: auto;
  }
}
