/* ============================================================================
   environment.css — Environment tab
   Grow-tent elevation view (plant + Front/Mid/Rear leaf-temp sensor tags)
   paired with a top-down canopy heat-grid. Driven by the leaf-temperature
   columns captured via the Environment tab of the Submit Data form.
   Baseline canvas: 1440px. Glass / dark-cosmic aesthetic.
   ========================================================================== */

.env-wrap {
  max-width: 1320px;
  margin: 0 auto;
  padding: 4px 4px 64px;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
.env-header { margin: 4px 2px 22px; position: relative; }
/* "Need Help?" pill — top-right of the header (reuses .rooms-help-pill style). */
.env-help-pill { position: absolute; top: 2px; right: 2px; }
@media (max-width: 640px) {
  .env-help-pill { position: static; margin-bottom: 12px; }
}
.env-title {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #f1f5fb;
  margin: 6px 0 6px;
}
.env-sub {
  font-size: 13.5px;
  line-height: 1.5;
  color: rgba(203, 213, 225, 0.62);
  max-width: 620px;
}

/* Heat legend — the cold→hot scale that every tag / band colour maps onto. */
.env-legend {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  padding: 8px 14px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(6px);
}
.env-legend-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(148, 163, 184, 0.7);
}
.env-legend-bar {
  width: 180px;
  height: 9px;
  border-radius: 6px;
  background: linear-gradient(90deg,
    hsl(205, 85%, 58%) 0%,
    hsl(160, 80%, 52%) 32%,
    hsl(95, 78%, 52%) 52%,
    hsl(45, 92%, 56%) 74%,
    hsl(8, 88%, 58%) 100%);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.25);
}
.env-legend-tick { font-size: 10.5px; font-variant-numeric: tabular-nums; color: rgba(203, 213, 225, 0.66); }

/* ── Filter bar (mirrors the Equipment tab pickers) ───────────────────────── */
.env-filterbar {
  position: sticky;
  top: 0;
  z-index: 6;
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 12px 14px;
  margin-bottom: 22px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 14px;
  background: rgba(11, 16, 32, 0.74);
  backdrop-filter: blur(12px);
}
.env-filter-row { display: flex; align-items: center; gap: 12px; }
.env-filter-label {
  flex: 0 0 58px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(148, 163, 184, 0.74);
}
.env-filter-pills { display: flex; flex-wrap: wrap; gap: 7px; }
.env-filter-hint { font-size: 12px; color: rgba(148, 163, 184, 0.55); font-style: italic; }
.env-pill {
  appearance: none;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(30, 41, 59, 0.5);
  color: rgba(203, 213, 225, 0.82);
  font-size: 12.5px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.16s ease;
}
.env-pill:hover { border-color: rgba(167, 139, 250, 0.55); color: #e9e3ff; background: rgba(76, 51, 122, 0.32); }
.env-pill.is-on {
  border-color: rgba(167, 139, 250, 0.85);
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.42), rgba(56, 189, 248, 0.26));
  color: #fff;
  box-shadow: 0 0 16px rgba(124, 58, 237, 0.3);
}

/* ══ Climate board — wide thermal-strip card per room ═══════════════════════
   The Environment tab's signature view (deliberately distinct from the
   Equipment dot-grid): each room is a Front→Middle→Back leaf-temp heat strip
   with the room average, humidity and uniformity beside it. Click to open. */
.env-clim-board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(440px, 1fr));
  gap: 16px;
}
.env-clim {
  position: relative;
  display: grid;
  grid-template-columns: minmax(112px, 0.8fr) minmax(0, 1.5fr) minmax(112px, 0.9fr);
  align-items: center;
  gap: 18px;
  padding: 16px 44px 16px 18px;
  text-align: left;
  cursor: pointer;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 18px;
  background:
    radial-gradient(130% 150% at 0% 0%, rgba(56, 189, 248, 0.06), transparent 55%),
    rgba(13, 19, 36, 0.66);
  backdrop-filter: blur(10px);
  color: inherit;
  font-family: 'Inter', sans-serif;
  overflow: hidden;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.22s ease;
}
.env-anim .env-clim {
  animation: env-clim-in 0.42s cubic-bezier(0.22, 1, 0.32, 1) both;
  animation-delay: calc(var(--i, 0) * 50ms);
}
@keyframes env-clim-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.env-clim:hover {
  transform: translateY(-2px);
  border-color: rgba(167, 139, 250, 0.5);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45), 0 0 22px rgba(124, 58, 237, 0.14);
}
.env-clim:focus-visible {
  outline: none;
  border-color: rgba(167, 139, 250, 0.75);
  box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.30);
}
.env-clim.has-stale { border-color: rgba(251, 191, 36, 0.34); }
.env-clim.is-empty { grid-template-columns: 1fr; cursor: default; opacity: 0.5; }
.env-clim.is-empty:hover { transform: none; box-shadow: none; border-color: rgba(148, 163, 184, 0.14); }

/* Head — room name + system count */
.env-clim-head { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.env-clim-name {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-size: 19px;
  font-weight: 600;
  color: #f1f5fb;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.env-clim-count {
  align-self: flex-start;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(148, 163, 184, 0.78);
  padding: 2px 8px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 999px;
}

/* Thermal strip — Front / Middle / Back heat blocks */
.env-clim-strip { display: flex; gap: 6px; min-width: 0; }
.env-clim-seg {
  position: relative;
  overflow: hidden;
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: 58px;
  border-radius: 12px;
  background: var(--bg, rgba(148, 163, 184, 0.12));
  border: 1px solid var(--c, rgba(148, 163, 184, 0.40));
  box-shadow: inset 0 0 22px -8px var(--c, transparent);
}
/* The seg letter/value sit above the shimmer sheen. */
.env-clim-seg-l, .env-clim-seg-v { position: relative; z-index: 1; }
.env-clim-seg.is-empty { box-shadow: none; }
/* Position under the field bar on the overview tile — red ring overrides heat. */
.env-clim-seg.is-incomplete {
  border-color: rgba(248, 113, 113, 0.7);
  background: rgba(127, 29, 29, 0.2);
  box-shadow: inset 0 0 22px -10px rgba(248, 113, 113, 0.8);
}
.env-clim-seg.is-incomplete .env-clim-seg-l,
.env-clim-seg.is-incomplete .env-clim-seg-v { color: #fca5a5; }
.env-clim-seg-l {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: rgba(226, 232, 240, 0.6);
}
.env-clim-seg-v {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--t, #e8eef7);
}

/* Side — room average leaf, humidity, uniformity */
.env-clim-side { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; min-width: 0; }
.env-clim-avg {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: #e8eef7;
}
.env-clim-avg-u { font-size: 13px; font-weight: 600; opacity: 0.7; margin-left: 1px; }
.env-clim-sub { font-size: 10px; font-weight: 600; color: rgba(148, 163, 184, 0.7); }
.env-clim-k { text-transform: uppercase; letter-spacing: 0.08em; color: rgba(148, 163, 184, 0.6); }
.env-clim-hum { color: rgba(125, 211, 252, 0.92); }
.env-clim-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 3px; }
.env-clim-delta {
  font-size: 10px; font-weight: 700; font-variant-numeric: tabular-nums;
  padding: 2px 7px; border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, 0.22); background: rgba(30, 41, 59, 0.5); color: rgba(226, 232, 240, 0.85);
}
.env-clim-delta.is-good { border-color: rgba(74, 222, 128, 0.4);  background: rgba(22, 101, 52, 0.22); color: #86efac; }
.env-clim-delta.is-warn { border-color: rgba(251, 191, 36, 0.42); background: rgba(120, 80, 6, 0.22);  color: #fcd34d; }
.env-clim-delta.is-bad  { border-color: rgba(248, 113, 113, 0.45);background: rgba(127, 29, 29, 0.24); color: #fca5a5; }
.env-clim-stale {
  font-size: 10px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 6px;
  border: 1px solid rgba(251, 191, 36, 0.42); background: rgba(120, 80, 6, 0.26); color: #fcd34d;
}
/* Incomplete-position alert chip on an overview tile (red sibling of stale). */
.env-clim-alert {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 6px;
  border: 1px solid rgba(248, 113, 113, 0.5); background: rgba(127, 29, 29, 0.3); color: #fca5a5;
}
.env-clim.has-alert { border-color: rgba(248, 113, 113, 0.42); }

/* Full-width "Last update" footer row — the most recent submission across the
   room's systems. Spans all three card columns under the strip/side. */
.env-clim-last {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid rgba(148, 163, 184, 0.16);
  min-width: 0;
}
.env-clim-last-ic { flex-shrink: 0; color: rgba(167, 139, 250, 0.9); }
.env-clim-last-lbl {
  flex-shrink: 0;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(148, 163, 184, 0.85);
}
.env-clim-last-val {
  margin-left: auto;
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: rgba(237, 246, 255, 0.97);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
html[data-theme="light"] .env-clim-last     { border-top-color: rgba(15, 23, 42, 0.12); }
html[data-theme="light"] .env-clim-last-ic  { color: rgba(124, 58, 237, 0.85); }
html[data-theme="light"] .env-clim-last-lbl { color: rgba(71, 85, 105, 0.85); }
html[data-theme="light"] .env-clim-last-val { color: rgba(15, 23, 42, 0.95); }

/* Screen-level alert banner above the room board — names rooms missing data. */
.env-alert-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 16px;
  padding: 11px 15px;
  border-radius: 13px;
  border: 1px solid rgba(248, 113, 113, 0.4);
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(248, 113, 113, 0.14), transparent 60%),
    rgba(127, 29, 29, 0.2);
  color: #fecaca;
  font-size: 13px;
  line-height: 1.45;
}
.env-alert-banner-ico {
  flex: 0 0 auto;
  display: inline-flex;
  color: #fca5a5;
}
.env-alert-banner-txt strong { color: #fff; font-weight: 700; }
.env-clim-go {
  position: absolute;
  right: 16px; top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  color: rgba(167, 139, 250, 0.55);
  transition: color 0.18s ease, transform 0.18s ease;
}
.env-clim:hover .env-clim-go { color: rgba(221, 214, 254, 1); transform: translateY(-50%) translateX(3px); }
.env-clim-empty { font-size: 12px; color: rgba(148, 163, 184, 0.45); font-style: italic; }

/* ══ Drill-in back bar ═════════════════════════════════════════════════════ */
.env-backbar {
  position: sticky;
  top: calc(var(--banner-h, 0px) + var(--nav-h, 46px) + 8px);
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 14px;
  margin-bottom: 22px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 14px;
  background: rgba(11, 16, 32, 0.78);
  backdrop-filter: blur(12px);
}
.env-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  padding: 7px 13px 7px 10px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(30, 41, 59, 0.5);
  color: rgba(226, 232, 240, 0.9);
  font-family: 'Inter', sans-serif;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}
.env-back:hover { border-color: rgba(167, 139, 250, 0.55); background: rgba(76, 51, 122, 0.32); color: #fff; }
.env-back:hover svg { transform: translateX(-2px); }
.env-back svg { transition: transform 0.16s ease; }
.env-back-room {
  flex-shrink: 0;
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: #f1f5fb;
}
.env-back-sys { margin-left: auto; }

/* ══ Board ⇄ detail view transition ════════════════════════════════════════ */
.env-wrap.env-leaving { animation: env-view-out 0.15s ease forwards; pointer-events: none; }
@keyframes env-view-out {
  to { opacity: 0; transform: translateY(-6px) scale(0.992); }
}
.env-wrap-detail.env-anim { animation: env-view-in 0.4s cubic-bezier(0.22, 1, 0.32, 1) both; }
.env-wrap-detail.env-anim .env-system { animation: env-view-in 0.46s cubic-bezier(0.22, 1, 0.32, 1) both; animation-delay: 0.07s; }
@keyframes env-view-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .env-clim { animation: none; }
  .env-clim:hover { transform: none; }
  .env-wrap.env-leaving,
  .env-wrap-detail,
  .env-wrap-detail .env-system { animation: none !important; }
}

/* ── System card ──────────────────────────────────────────────────────────── */
.env-system {
  position: relative;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 20px;
  background:
    radial-gradient(120% 90% at 12% 0%, rgba(56, 189, 248, 0.06), transparent 60%),
    radial-gradient(120% 90% at 88% 100%, rgba(124, 58, 237, 0.07), transparent 60%),
    rgba(13, 19, 36, 0.66);
  backdrop-filter: blur(10px);
  padding: 20px 22px 22px;
  margin-bottom: 22px;
  overflow: hidden;
}
.env-system.is-stale { border-color: rgba(251, 191, 36, 0.32); }

.env-system-hdr {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.env-room-tag {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: rgba(148, 163, 184, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 7px;
  padding: 3px 9px;
}
.env-system-name {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-size: 19px;
  font-weight: 600;
  color: #f1f5fb;
}
.env-system-meta { font-size: 12px; color: rgba(148, 163, 184, 0.6); }
.env-hdr-spacer { flex: 1 1 auto; }

/* Chips on the right of the header */
.env-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(30, 41, 59, 0.5);
  color: rgba(226, 232, 240, 0.9);
}
.env-chip-label { font-weight: 500; color: rgba(148, 163, 184, 0.78); }
.env-chip.is-good  { border-color: rgba(74, 222, 128, 0.4);  background: rgba(22, 101, 52, 0.22);  color: #86efac; }
.env-chip.is-warn  { border-color: rgba(251, 191, 36, 0.42); background: rgba(120, 80, 6, 0.22);   color: #fcd34d; }
.env-chip.is-bad   { border-color: rgba(248, 113, 113, 0.45);background: rgba(127, 29, 29, 0.24);  color: #fca5a5; }

.env-stale-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(251, 191, 36, 0.45);
  background: rgba(120, 80, 6, 0.28);
  color: #fcd34d;
}

/* Missing-reading alert — a position (Front / Middle / Back) has no data point.
   Red sibling of the amber stale pill; pulses gently to read as "needs action". */
.env-alert-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.01em;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(248, 113, 113, 0.55);
  background: rgba(127, 29, 29, 0.34);
  color: #fca5a5;
  animation: env-alert-pulse 2.1s ease-in-out infinite;
}
@keyframes env-alert-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(248, 113, 113, 0.0); }
  50%      { box-shadow: 0 0 0 4px rgba(248, 113, 113, 0.12); }
}
@media (prefers-reduced-motion: reduce) {
  .env-alert-pill { animation: none; }
}
/* Card with a missing position — red accent border over the neutral/stale ones. */
.env-system.has-missing { border-color: rgba(248, 113, 113, 0.4); }

/* ── Stage: elevation view | canopy grid ──────────────────────────────────── */
.env-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
}
.env-panel {
  position: relative;
  border: 1px solid rgba(148, 163, 184, 0.1);
  border-radius: 16px;
  background: rgba(8, 12, 26, 0.55);
  padding: 10px 12px 8px;
}
.env-panel-cap {
  position: absolute;
  top: 12px;
  left: 14px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(148, 163, 184, 0.55);
  pointer-events: none;
}
.env-tent-svg {
  display: block;
  width: 100%;
  height: auto;
}

/* Right panel: readings column — Temp / Humidity / Leaf per position */
.env-panel-data { display: flex; padding: 40px 16px 16px; }
.env-data-col {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  width: 100%;
}
.env-dc-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-left: 3px solid rgba(148, 163, 184, 0.5);
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.45);
}
.env-dc-letter {
  flex: 0 0 30px;
  width: 30px;
  text-align: center;
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
}
.env-dc-body { flex: 1 1 auto; min-width: 0; }
.env-dc-name {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: rgba(148, 163, 184, 0.72);
  margin-bottom: 9px;
}
/* A position under the field bar — red-tinted row + inline "N / 6" tag. */
.env-dc-row.is-incomplete {
  border-color: rgba(248, 113, 113, 0.3);
  background: rgba(127, 29, 29, 0.16);
}
.env-dc-missing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid rgba(248, 113, 113, 0.5);
  background: rgba(127, 29, 29, 0.3);
  color: #fca5a5;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  vertical-align: middle;
}
/* Equal-width metric grid. Was a flex row with flex-grow, which stretched the
   last row's trailing cards (HH Temp / HH RH) across the full width once the
   metric count stopped dividing evenly. auto-fill keeps every card the same
   width and left-aligns a partial last row instead of ballooning it. */
.env-dc-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 10px;
  align-content: start;
}
.env-dc-metric {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 7px 10px;
  border-radius: 9px;
  background: rgba(30, 41, 59, 0.42);
  border: 1px solid rgba(148, 163, 184, 0.1);
}
.env-dc-mk {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: rgba(148, 163, 184, 0.62);
}
.env-dc-mv {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: #e8eef7;
  font-variant-numeric: tabular-nums;
}

/* ── SVG element styling (tent elevation) ─────────────────────────────────── */
.env-tag-box {
  fill: rgba(8, 12, 26, 0.82);
  stroke-width: 1.6;
}
.env-tag-letter {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-size: 23px;
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: central;
}
.env-tag-div {
  stroke-width: 1;
  opacity: 0.32;
}
.env-tag-name {
  font-family: 'Inter', sans-serif;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.12em;
  fill: rgba(148, 163, 184, 0.78);
}
.env-tag-temp {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-size: 15.5px;
  font-weight: 600;
  fill: #f1f5fb;
}
.env-tag-temp.is-empty { fill: rgba(148, 163, 184, 0.5); }
.env-tag-sub {
  font-family: 'Inter', sans-serif;
  font-size: 7.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  fill: rgba(148, 163, 184, 0.55);
}

.env-leader { stroke-width: 1.6; stroke-dasharray: 4 3; opacity: 0.7; fill: none; }

.env-node-core { stroke: #0b1020; stroke-width: 1.6; }
.env-node-pulse { opacity: 0.55; }

/* Empty / loading states */
.env-empty {
  text-align: center;
  padding: 56px 20px;
  color: rgba(148, 163, 184, 0.6);
  font-size: 14px;
  border: 1px dashed rgba(148, 163, 184, 0.18);
  border-radius: 16px;
  background: rgba(13, 19, 36, 0.4);
}

/* ── Animations (motion-safe only) ────────────────────────────────────────── */
@media (prefers-reduced-motion: no-preference) {
  .env-node-pulse {
    transform-box: fill-box;
    transform-origin: center;
    animation: envPulse 2.6s ease-out infinite;
  }
  .env-node-pulse.n2 { animation-delay: 0.5s; }
  .env-node-pulse.n3 { animation-delay: 1s; }
  .env-leaf-sway {
    transform-box: fill-box;
    transform-origin: 50% 100%;
    animation: envSway 6s ease-in-out infinite;
  }
  .env-light-glow { animation: envGlow 5s ease-in-out infinite; }

  /* Thermal airflow — convection particles rising off the canopy. Transform-only
     (translate + opacity), so it's GPU-cheap and never reflows. */
  .env-air {
    fill: rgba(125, 211, 252, 0.5);
    will-change: transform, opacity;
    animation: envRise 4.6s ease-in-out infinite;
  }
  .env-air.a2 { animation-duration: 5.3s; animation-delay: 0.6s; fill: rgba(94, 224, 138, 0.42); }
  .env-air.a3 { animation-duration: 4.1s; animation-delay: 1.2s; }
  .env-air.a4 { animation-duration: 5.7s; animation-delay: 0.35s; fill: rgba(94, 224, 138, 0.42); }
  .env-air.a5 { animation-duration: 4.9s; animation-delay: 1.7s; }
  .env-air.a6 { animation-duration: 5.1s; animation-delay: 2.2s; fill: rgba(167, 139, 250, 0.42); }
  .env-air.a7 { animation-duration: 4.4s; animation-delay: 2.8s; fill: rgba(167, 139, 250, 0.4); }

  /* Heat shimmer — a slow sheen sweeping across each LIVE (complete) F/M/B tile.
     Skipped on empty / incomplete tiles so they stay calm + red. */
  .env-clim-seg:not(.is-empty):not(.is-incomplete)::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(115deg, transparent 38%, rgba(255, 255, 255, 0.12) 50%, transparent 62%);
    transform: translateX(-130%);
    animation: envShimmer 5s ease-in-out infinite;
    pointer-events: none;
  }
  .env-clim-seg:nth-child(2)::after { animation-delay: 0.6s; }
  .env-clim-seg:nth-child(3)::after { animation-delay: 1.2s; }
}
@keyframes envPulse {
  0%   { transform: scale(0.55); opacity: 0.6; }
  70%  { transform: scale(2.3);  opacity: 0; }
  100% { transform: scale(2.3);  opacity: 0; }
}
@keyframes envRise {
  0%   { opacity: 0; transform: translateY(0) translateX(0); }
  18%  { opacity: 0.85; }
  72%  { opacity: 0.5; }
  100% { opacity: 0; transform: translateY(-232px) translateX(7px); }
}
@keyframes envShimmer {
  0%, 58% { transform: translateX(-130%); }
  100%    { transform: translateX(130%); }
}
@keyframes envSway {
  0%, 100% { transform: rotate(-1.3deg); }
  50%      { transform: rotate(1.3deg); }
}
@keyframes envGlow {
  0%, 100% { opacity: 0.5; }
  50%      { opacity: 0.85; }
}

/* ── Reflows ──────────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .env-stage { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .env-wrap { padding: 2px 2px 48px; }
  .env-title { font-size: 25px; }
  .env-legend-bar { width: 130px; }
}
/* Climate cards: drop to a single column + stack their internals on phones. */
@media (max-width: 620px) {
  .env-clim-board { grid-template-columns: 1fr; }
  .env-clim {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 16px 16px 16px;
  }
  .env-clim-head { flex-direction: row; align-items: center; justify-content: space-between; }
  .env-clim-side { flex-direction: row; align-items: baseline; flex-wrap: wrap; gap: 8px; }
  .env-clim-go { display: none; }
}

/* ── Inactive systems (admin turned off in Permissions → Active Systems) ── */
.env-pill.is-inactive {
  opacity: 0.5; cursor: not-allowed; text-decoration: line-through;
  border-style: dashed;
}
.env-pill.is-inactive:hover { transform: none; }
.env-pill-x { color: rgba(248,113,113,0.85); font-weight: 700; text-decoration: none; display: inline-block; }
.env-system.is-inactive { opacity: 0.6; }
.env-system.is-inactive .env-system-name { text-decoration: line-through; color: rgba(148,163,184,0.75); }
.env-inactive-pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 3px 10px; border-radius: 999px;
  color: rgba(148,163,184,0.9); background: rgba(148,163,184,0.1); border: 1px solid rgba(148,163,184,0.28);
}
.env-inactive-body { margin-top: 8px; font-size: 12px; color: rgba(148,163,184,0.7); font-style: italic; }

/* ── VPD (Vapor Pressure Deficit) widgets ─────────────────────────────────────
   Room anchor (big) + supporting per-system cards, glass on the cosmic palette.
   Severity color is passed in as --sev; the band/sparkline use it inline. */
.vpd-block { margin: 4px 0 26px; }

.vpd-room {
  position: relative;
  display: grid;
  grid-template-columns: minmax(190px, 0.9fr) 1.5fr;
  gap: 22px;
  align-items: center;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-left: 3px solid var(--sev, rgba(148,163,184,0.5));
  border-radius: 22px;
  background:
    radial-gradient(130% 100% at 8% 0%, color-mix(in srgb, var(--sev, #38bdf8) 12%, transparent), transparent 60%),
    radial-gradient(120% 90% at 92% 100%, rgba(124, 58, 237, 0.08), transparent 60%),
    rgba(13, 19, 36, 0.72);
  backdrop-filter: blur(12px);
  padding: 22px 26px;
  overflow: hidden;
}
.vpd-room::after {            /* soft severity glow bleed, top-left */
  content: ''; position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--sev, #38bdf8) 18%, transparent);
  border-radius: inherit; opacity: 0.5;
}
.vpd-room-eyebrow {
  font: 600 11px/1 'Space Grotesk', sans-serif; letter-spacing: 0.14em; text-transform: uppercase;
  color: rgba(203, 213, 225, 0.72); display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
}
.vpd-room-sevtag {
  font-size: 9.5px; letter-spacing: 0.1em; padding: 2px 7px; border-radius: 999px;
  color: var(--sev); background: color-mix(in srgb, var(--sev) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--sev) 40%, transparent);
}
.vpd-room-num {
  display: flex; align-items: baseline; gap: 8px;
  font: 700 46px/0.95 'Space Grotesk', sans-serif; font-variant-numeric: tabular-nums;
  color: #eaf2ff; letter-spacing: -0.01em;
}
.vpd-room-num .vpd-unit, .vpd-sys-num .vpd-unit {
  font: 600 14px/1 'Inter', sans-serif; color: rgba(148, 163, 184, 0.78); letter-spacing: 0;
}
.vpd-room-stage { margin-top: 6px; font: 600 14px/1.3 'Inter', sans-serif; color: var(--sev); }
.vpd-room-report { margin-top: 4px; font: 500 11.5px/1.3 'Inter', sans-serif; color: rgba(148,163,184,0.7); }
.vpd-room-viz { display: flex; flex-direction: column; gap: 10px; }
.vpd-room-insight { font: 500 13px/1.5 'Inter', sans-serif; color: rgba(214, 224, 240, 0.86); }

/* Healthy-zones band + gliding needle */
.vpd-band { display: block; border-radius: 6px; overflow: visible; }
.vpd-band-needle { transform: translateX(0); }
.env-anim .vpd-band-needle { animation: vpd-needle-in 0.9s cubic-bezier(0.22, 1, 0.32, 1) both; }
@keyframes vpd-needle-in { from { transform: translateX(calc(var(--nx) * -1)); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Per-system supporting cards */
.vpd-sys-row {
  margin-top: 14px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px;
}
.vpd-sys {
  position: relative;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-top: 2px solid var(--sev, rgba(148,163,184,0.5));
  border-radius: 16px;
  background: rgba(15, 22, 41, 0.66);
  backdrop-filter: blur(8px);
  padding: 13px 15px 12px;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.vpd-sys:hover { transform: translateY(-2px); box-shadow: 0 10px 26px -16px color-mix(in srgb, var(--sev) 60%, #000); }
.vpd-sys.is-empty { opacity: 0.6; }
.vpd-sys-hdr { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.vpd-sys-name { font: 600 12.5px/1 'Space Grotesk', sans-serif; color: rgba(226, 232, 240, 0.92); letter-spacing: 0.01em; }
.vpd-sys-num {
  display: flex; align-items: baseline; gap: 5px;
  font: 700 26px/1 'Space Grotesk', sans-serif; font-variant-numeric: tabular-nums; color: #eaf2ff;
}
.vpd-sys-pill {
  margin-top: 5px; font: 600 11px/1.3 'Inter', sans-serif; color: var(--sev);
  display: inline-block;
}
.vpd-sys-spark { margin-top: 8px; height: 30px; }
.vpd-spark.is-empty { height: 30px; border-bottom: 1px dashed rgba(148,163,184,0.2); }

/* "?" help button */
.vpd-q {
  flex: none; display: inline-grid; place-items: center; width: 22px; height: 22px;
  border-radius: 999px; border: 1px solid rgba(148,163,184,0.28);
  background: rgba(255,255,255,0.04); color: rgba(186,230,253,0.92);
  cursor: pointer; transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
  align-self: center;
}
.vpd-q:hover { background: rgba(56,189,248,0.16); border-color: rgba(56,189,248,0.55); color: #e0f2fe; }
.vpd-q:focus-visible { outline: 2px solid var(--accent-cyan, #38bdf8); outline-offset: 2px; }
.vpd-room-num .vpd-q { margin-left: 4px; transform: translateY(-6px); }

/* Intermediate-math tooltip (pure CSS, pre-line) */
[data-tip] { position: relative; cursor: help; }
[data-tip]::after {
  content: attr(data-tip); white-space: pre-line;
  position: absolute; left: 0; top: calc(100% + 8px); z-index: 60;
  min-width: 210px; padding: 9px 12px; border-radius: 10px;
  font: 500 11.5px/1.55 'Inter', sans-serif; color: #dbe6ff; text-align: left;
  background: rgba(10, 15, 30, 0.96); border: 1px solid rgba(148,163,184,0.24);
  box-shadow: 0 16px 40px -18px rgba(0,0,0,0.8);
  opacity: 0; transform: translateY(-4px); pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
}
[data-tip]:hover::after, [data-tip]:focus-visible::after { opacity: 1; transform: translateY(0); }

@media (max-width: 1024px) { .vpd-room { grid-template-columns: 1fr; gap: 16px; } }
@media (prefers-reduced-motion: reduce) {
  .env-anim .vpd-band-needle { animation: none; }
  .vpd-sys { transition: none; }
  .vpd-sys:hover { transform: none; }
}

/* Room-overall VPD — full-width strip at the foot of each climate-board card.
   Spans all 3 grid columns so it gets real room instead of the cramped side col. */
.env-clim-vpd {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 14px;
  margin-top: 2px; padding: 10px 14px; border-radius: 13px;
  background: color-mix(in srgb, var(--sev, #34d399) 8%, rgba(11, 17, 33, 0.55));
  border: 1px solid color-mix(in srgb, var(--sev, #34d399) 24%, transparent);
  border-left: 3px solid var(--sev, #34d399);
  font-variant-numeric: tabular-nums;
}
.env-clim-vpd-lead { display: inline-flex; flex-direction: column; gap: 3px; flex: 0 0 auto; }
.env-clim-vpd-k { font: 600 9px/1 'Space Grotesk', sans-serif; letter-spacing: 0.13em; text-transform: uppercase; color: rgba(203, 213, 225, 0.66); }
.env-clim-vpd-val { display: inline-flex; align-items: baseline; gap: 4px; }
.env-clim-vpd-n { font: 700 24px/1 'Space Grotesk', sans-serif; color: #eaf2ff; letter-spacing: -0.01em; }
.env-clim-vpd-u { font: 500 11px/1 'Inter', sans-serif; color: rgba(148, 163, 184, 0.75); }
.env-clim-vpd-stage { font: 600 12px/1.3 'Inter', sans-serif; color: var(--sev, #34d399); flex: 0 1 auto; }
.env-clim-vpd-band { flex: 1 1 auto; min-width: 70px; max-width: 220px; display: flex; align-items: center; }
.env-clim-vpd-rep { font: 500 10.5px/1 'Inter', sans-serif; color: rgba(148, 163, 184, 0.6); flex: 0 0 auto; }
.env-clim-vpd .vpd-q { width: 20px; height: 20px; flex: 0 0 auto; }
.env-clim-vpd .vpd-q svg { width: 12px; height: 12px; }
@media (max-width: 1024px) {
  .env-clim-vpd { flex-wrap: wrap; gap: 10px; }
  .env-clim-vpd-band { order: 5; flex-basis: 100%; max-width: none; }
}

/* Per-system grow-cycle + day chips on the climate-board cards (active only) */
.env-clim-cycles {
  grid-column: 1 / -1;
  display: flex; flex-wrap: wrap; gap: 7px;
  margin: 5px 0 3px;
}
.env-clim-cyc {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 11px; border-radius: 9px;
  font: 600 11.5px/1 'Inter', sans-serif;
  border: 1px solid; white-space: nowrap;
  color: var(--cyc, rgba(148, 163, 184, 0.7));
  background: color-mix(in srgb, var(--cyc, #94a3b8) 9%, transparent);
  border-color: color-mix(in srgb, var(--cyc, #94a3b8) 30%, transparent);
}
.env-clim-cyc-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--cyc, currentColor); box-shadow: 0 0 7px var(--cyc, transparent); }
.env-clim-cyc-sys { font-weight: 600; color: rgba(226, 232, 240, 0.78); }
.env-clim-cyc-stage { font-weight: 700; letter-spacing: 0.01em; }
.env-clim-cyc-day {
  font-variant-numeric: tabular-nums; font-weight: 700; color: #eef4ff;
  padding-left: 7px; margin-left: 1px;
  border-left: 1px solid color-mix(in srgb, var(--cyc, #94a3b8) 38%, transparent);
}
.env-clim-cyc.cyc-trans  { --cyc: #fbbf24; }
.env-clim-cyc.cyc-veg    { --cyc: #34d399; }
.env-clim-cyc.cyc-flower { --cyc: #a78bfa; }
.env-clim-cyc.cyc-none   { --cyc: rgba(148, 163, 184, 0.6); }
.env-clim-cyc.cyc-none .env-clim-cyc-stage { font-weight: 500; font-style: italic; color: rgba(148, 163, 184, 0.75); }
.env-clim-cyc.cyc-none .env-clim-cyc-dot { box-shadow: none; opacity: 0.6; }

/* "F only" note — average reflects only the positions that reported a reading.
   The ⓘ glyph signals it's hoverable; the title gives the full plain-English why. */
.env-clim-partial {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  color: #fbbf24; cursor: help;
  padding: 1px 7px 1px 5px; border-radius: 5px;
  background: rgba(251, 191, 36, 0.12); border: 1px solid rgba(251, 191, 36, 0.3);
  transition: background 0.16s ease, border-color 0.16s ease;
}
.env-clim-partial:hover { background: rgba(251, 191, 36, 0.2); border-color: rgba(251, 191, 36, 0.55); }
.env-clim-partial-i { flex: none; opacity: 0.9; }

/* ══════════════════════════════════════════
   LIGHT MODE — Environment overrides
══════════════════════════════════════════ */

/* ── Header ── */
html[data-theme="light"] .env-title { color: var(--text-primary); }
html[data-theme="light"] .env-sub { color: var(--text-secondary); }

/* Heat legend — light frosted surface */
html[data-theme="light"] .env-legend {
  border-color: rgba(19, 16, 58, 0.12);
  background: rgba(255, 255, 255, 0.55);
}
html[data-theme="light"] .env-legend-label { color: var(--text-muted); }
html[data-theme="light"] .env-legend-tick { color: var(--text-secondary); }

/* ── Filter bar ── */
html[data-theme="light"] .env-filterbar {
  border-color: rgba(19, 16, 58, 0.12);
  background: rgba(255, 255, 255, 0.72);
}
html[data-theme="light"] .env-filter-label { color: var(--text-muted); }
html[data-theme="light"] .env-filter-hint { color: var(--text-muted); }

/* Pills */
html[data-theme="light"] .env-pill {
  border-color: rgba(19, 16, 58, 0.16);
  background: rgba(19, 16, 58, 0.05);
  color: var(--text-secondary);
}
html[data-theme="light"] .env-pill:hover {
  border-color: rgba(124, 58, 237, 0.5);
  color: var(--accent-purple, #7c3aed);
  background: rgba(124, 58, 237, 0.1);
}
/* .env-pill.is-on keeps saturated violet/cyan gradient + white text (inherits dark rule) */

/* ── Climate board ── */
html[data-theme="light"] .env-clim {
  border-color: rgba(19, 16, 58, 0.12);
  background:
    radial-gradient(130% 150% at 0% 0%, rgba(2, 132, 199, 0.06), transparent 55%),
    rgba(255, 255, 255, 0.62);
}
html[data-theme="light"] .env-clim.is-empty:hover { border-color: rgba(19, 16, 58, 0.12); }
html[data-theme="light"] .env-clim-name { color: var(--text-primary); }
html[data-theme="light"] .env-clim-count {
  color: var(--text-muted);
  border-color: rgba(19, 16, 58, 0.12);
}

/* Thermal strip — fallback only (inline --bg/--c from JS heat colors) */
html[data-theme="light"] .env-clim-seg-l { color: var(--text-muted); }
/* .env-clim-seg-v uses --t inline from JS; leave */

/* Side — averages / humidity */
html[data-theme="light"] .env-clim-avg { color: var(--text-primary); }
html[data-theme="light"] .env-clim-sub { color: var(--text-muted); }
html[data-theme="light"] .env-clim-k { color: var(--text-muted); }
html[data-theme="light"] .env-clim-hum { color: #0369a1; }
html[data-theme="light"] .env-clim-delta {
  border-color: rgba(19, 16, 58, 0.12);
  background: rgba(19, 16, 58, 0.05);
  color: var(--text-secondary);
}
html[data-theme="light"] .env-clim-delta.is-good {
  border-color: rgba(5, 150, 105, 0.4);
  background: rgba(16, 185, 129, 0.14);
  color: #047857;
}
html[data-theme="light"] .env-clim-delta.is-warn {
  border-color: rgba(217, 119, 6, 0.4);
  background: rgba(217, 119, 6, 0.14);
  color: #b45309;
}
html[data-theme="light"] .env-clim-delta.is-bad {
  border-color: rgba(225, 29, 72, 0.4);
  background: rgba(225, 29, 72, 0.12);
  color: #be123c;
}
html[data-theme="light"] .env-clim-stale {
  border-color: rgba(217, 119, 6, 0.4);
  background: rgba(217, 119, 6, 0.14);
  color: #b45309;
}
html[data-theme="light"] .env-clim-alert {
  border-color: rgba(225, 29, 72, 0.4);
  background: rgba(225, 29, 72, 0.12);
  color: #be123c;
}

/* Alert banner — light red tint */
html[data-theme="light"] .env-alert-banner {
  border-color: rgba(225, 29, 72, 0.4);
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(225, 29, 72, 0.1), transparent 60%),
    rgba(225, 29, 72, 0.1);
  color: #be123c;
}
html[data-theme="light"] .env-alert-banner-ico { color: #be123c; }
html[data-theme="light"] .env-alert-banner-txt strong { color: #7f1d1d; }

/* Go chevron */
html[data-theme="light"] .env-clim-go { color: rgba(124, 58, 237, 0.55); }
html[data-theme="light"] .env-clim:hover .env-clim-go { color: rgba(124, 58, 237, 1); }
html[data-theme="light"] .env-clim-empty { color: var(--text-muted); }

/* ── Back bar ── */
html[data-theme="light"] .env-backbar {
  border-color: rgba(19, 16, 58, 0.12);
  background: rgba(255, 255, 255, 0.72);
}
html[data-theme="light"] .env-back {
  border-color: rgba(19, 16, 58, 0.16);
  background: rgba(19, 16, 58, 0.05);
  color: var(--text-secondary);
}
html[data-theme="light"] .env-back:hover {
  border-color: rgba(124, 58, 237, 0.5);
  background: rgba(124, 58, 237, 0.1);
  color: var(--accent-purple, #7c3aed);
}
html[data-theme="light"] .env-back-room { color: var(--text-primary); }

/* ── System card ── */
html[data-theme="light"] .env-system {
  border-color: rgba(19, 16, 58, 0.12);
  background:
    radial-gradient(120% 90% at 12% 0%, rgba(2, 132, 199, 0.05), transparent 60%),
    radial-gradient(120% 90% at 88% 100%, rgba(124, 58, 237, 0.06), transparent 60%),
    rgba(255, 255, 255, 0.62);
}
html[data-theme="light"] .env-room-tag {
  color: var(--text-muted);
  border-color: rgba(19, 16, 58, 0.16);
}
html[data-theme="light"] .env-system-name { color: var(--text-primary); }
html[data-theme="light"] .env-system-meta { color: var(--text-muted); }

/* Chips */
html[data-theme="light"] .env-chip {
  border-color: rgba(19, 16, 58, 0.16);
  background: rgba(19, 16, 58, 0.05);
  color: var(--text-secondary);
}
html[data-theme="light"] .env-chip-label { color: var(--text-muted); }
html[data-theme="light"] .env-chip.is-good {
  border-color: rgba(5, 150, 105, 0.4);
  background: rgba(16, 185, 129, 0.14);
  color: #047857;
}
html[data-theme="light"] .env-chip.is-warn {
  border-color: rgba(217, 119, 6, 0.4);
  background: rgba(217, 119, 6, 0.14);
  color: #b45309;
}
html[data-theme="light"] .env-chip.is-bad {
  border-color: rgba(225, 29, 72, 0.4);
  background: rgba(225, 29, 72, 0.12);
  color: #be123c;
}

html[data-theme="light"] .env-stale-pill {
  border-color: rgba(217, 119, 6, 0.4);
  background: rgba(217, 119, 6, 0.14);
  color: #b45309;
}
html[data-theme="light"] .env-alert-pill {
  border-color: rgba(225, 29, 72, 0.4);
  background: rgba(225, 29, 72, 0.12);
  color: #be123c;
}

/* ── Stage panels ── */
html[data-theme="light"] .env-panel {
  border-color: rgba(19, 16, 58, 0.12);
  background: rgba(255, 255, 255, 0.5);
}
html[data-theme="light"] .env-panel-cap { color: var(--text-muted); }

html[data-theme="light"] .env-dc-row {
  border-color: rgba(19, 16, 58, 0.12);
  border-left-color: rgba(19, 16, 58, 0.5);
  background: rgba(255, 255, 255, 0.55);
}
html[data-theme="light"] .env-dc-name { color: var(--text-muted); }
html[data-theme="light"] .env-dc-row.is-incomplete {
  border-color: rgba(225, 29, 72, 0.3);
  background: rgba(225, 29, 72, 0.08);
}
html[data-theme="light"] .env-dc-missing {
  border-color: rgba(225, 29, 72, 0.4);
  background: rgba(225, 29, 72, 0.12);
  color: #be123c;
}
html[data-theme="light"] .env-dc-metric {
  background: rgba(19, 16, 58, 0.03);
  border-color: rgba(19, 16, 58, 0.12);
}
html[data-theme="light"] .env-dc-mk { color: var(--text-muted); }
html[data-theme="light"] .env-dc-mv { color: var(--text-primary); }

/* ── SVG (tent elevation) — flip dark tag box to light + dark text ── */
html[data-theme="light"] .env-tag-box {
  fill: rgba(255, 255, 255, 0.88);
}
html[data-theme="light"] .env-tag-name { fill: rgba(19, 16, 58, 0.65); }
html[data-theme="light"] .env-tag-temp { fill: #13103a; }
html[data-theme="light"] .env-tag-temp.is-empty { fill: rgba(19, 16, 58, 0.4); }
html[data-theme="light"] .env-tag-sub { fill: rgba(19, 16, 58, 0.55); }
/* .env-node-core thin outline (stroke:#0b1020) — left dark, fine */

/* Empty / loading */
html[data-theme="light"] .env-empty {
  color: var(--text-muted);
  border-color: rgba(19, 16, 58, 0.12);
  background: rgba(255, 255, 255, 0.45);
}

/* ── Inactive systems ── */
html[data-theme="light"] .env-system.is-inactive .env-system-name { color: var(--text-muted); }
html[data-theme="light"] .env-inactive-pill {
  color: var(--text-muted);
  background: rgba(19, 16, 58, 0.06);
  border-color: rgba(19, 16, 58, 0.24);
}
html[data-theme="light"] .env-inactive-body { color: var(--text-muted); }

/* ── VPD room anchor + system cards ── */
html[data-theme="light"] .vpd-room {
  border-color: rgba(19, 16, 58, 0.12);
  background:
    radial-gradient(130% 100% at 8% 0%, color-mix(in srgb, var(--sev, #0284c7) 12%, transparent), transparent 60%),
    radial-gradient(120% 90% at 92% 100%, rgba(124, 58, 237, 0.06), transparent 60%),
    rgba(255, 255, 255, 0.66);
}
html[data-theme="light"] .vpd-room-eyebrow { color: var(--text-secondary); }
html[data-theme="light"] .vpd-room-num { color: var(--text-primary); }
html[data-theme="light"] .vpd-room-num .vpd-unit,
html[data-theme="light"] .vpd-sys-num .vpd-unit { color: var(--text-muted); }
html[data-theme="light"] .vpd-room-report { color: var(--text-muted); }
html[data-theme="light"] .vpd-room-insight { color: var(--text-secondary); }
html[data-theme="light"] .vpd-sys {
  border-color: rgba(19, 16, 58, 0.12);
  background: rgba(255, 255, 255, 0.62);
}
html[data-theme="light"] .vpd-sys-name { color: var(--text-primary); }
html[data-theme="light"] .vpd-sys-num { color: var(--text-primary); }

/* "?" help button */
html[data-theme="light"] .vpd-q {
  border-color: rgba(19, 16, 58, 0.2);
  background: rgba(19, 16, 58, 0.05);
  color: #0369a1;
}
html[data-theme="light"] .vpd-q:hover {
  background: rgba(2, 132, 199, 0.12);
  border-color: rgba(2, 132, 199, 0.5);
  color: #0284c7;
}
/* [data-tip]::after tooltip stays dark — legible floating tooltip on light */

/* Room-overall VPD strip uses --sev color-mix — semantic, left as-is */

/* Per-system cycle chips — text keys to light */
html[data-theme="light"] .env-clim-cyc-sys { color: var(--text-secondary); }
html[data-theme="light"] .env-clim-cyc-day { color: var(--text-primary); }
html[data-theme="light"] .env-clim-cyc.cyc-none .env-clim-cyc-stage { color: var(--text-muted); }
/* .env-clim-cyc --cyc color chips (amber/teal/purple via color-mix) — fine on light */

/* VPD strip text */
html[data-theme="light"] .env-clim-vpd-k { color: var(--text-muted); }
html[data-theme="light"] .env-clim-vpd-n { color: var(--text-primary); }
html[data-theme="light"] .env-clim-vpd-u { color: var(--text-muted); }
html[data-theme="light"] .env-clim-vpd-rep { color: var(--text-muted); }

/* Partial-average note — amber recolored for light bg */
html[data-theme="light"] .env-clim-partial {
  color: #b45309;
  background: rgba(217, 119, 6, 0.14);
  border-color: rgba(217, 119, 6, 0.35);
}
html[data-theme="light"] .env-clim-partial:hover {
  background: rgba(217, 119, 6, 0.2);
  border-color: rgba(217, 119, 6, 0.55);
}

/* VPD healthy-zones band (inline SVG from environment.js _vpdBandSVG) —
   the track, tick lines and needle are hardcoded white/near-white and
   vanish on the light band. CSS beats SVG presentation attributes.
   Track = first <rect> child; ticks = direct <line> children; needle
   line/circle live inside .vpd-band-needle. */
html[data-theme="light"] .vpd-band > rect:first-child { fill: rgba(19,16,58,0.05); }
html[data-theme="light"] .vpd-band > line { stroke: rgba(19,16,58,0.16); }
html[data-theme="light"] .vpd-band-needle line { stroke: #13103a; }
html[data-theme="light"] .vpd-band-needle circle { fill: #13103a; }
