:root {
  color-scheme: light;
  --bg: #edf3f5;
  --surface: rgba(255, 255, 255, 0.86);
  --surface-solid: #ffffff;
  --surface-soft: #f5f8f9;
  --text: #10232d;
  --muted: #637681;
  --line: #ccd9dd;
  --line-strong: #9eb2ba;
  --accent: #0b8f87;
  --accent-soft: #d9f2ef;
  --accent-glow: rgba(11, 143, 135, 0.2);
  --warning: #9a681b;
  --danger: #a34848;
  --flow-active: #0ba79c;
  --chart-pv: #078f86;
  --chart-home: #347ca3;
  --chart-battery: #d1812d;
  --chart-grid: #7769b3;
  --chart-direct: #239c61;
  --chart-export: #b76291;
  --chart-charge: #b98b27;
  --chart-gen24: #58a84e;
  --chart-symo: #9d6ca8;
  --shadow: 0 24px 70px rgba(27, 61, 72, 0.12);
  --node-shadow: 0 12px 34px rgba(20, 52, 62, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #07121c;
  --surface: rgba(13, 29, 41, 0.9);
  --surface-solid: #0e1d29;
  --surface-soft: #122534;
  --text: #e8f3f4;
  --muted: #91a7af;
  --line: #294250;
  --line-strong: #42606c;
  --accent: #45d0c4;
  --accent-soft: #123d3c;
  --accent-glow: rgba(69, 208, 196, 0.18);
  --warning: #e3b45e;
  --danger: #ee8b8b;
  --flow-active: #45d0c4;
  --chart-pv: #45d0c4;
  --chart-home: #70b8df;
  --chart-battery: #f2ae5d;
  --chart-grid: #b4a4f2;
  --chart-direct: #66d99b;
  --chart-export: #e496bd;
  --chart-charge: #e4c05f;
  --chart-gen24: #8edb82;
  --chart-symo: #d09bda;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.32);
  --node-shadow: 0 14px 36px rgba(0, 0, 0, 0.24);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #07121c;
    --surface: rgba(13, 29, 41, 0.9);
    --surface-solid: #0e1d29;
    --surface-soft: #122534;
    --text: #e8f3f4;
    --muted: #91a7af;
    --line: #294250;
    --line-strong: #42606c;
    --accent: #45d0c4;
    --accent-soft: #123d3c;
    --accent-glow: rgba(69, 208, 196, 0.18);
    --warning: #e3b45e;
    --danger: #ee8b8b;
    --flow-active: #45d0c4;
    --chart-pv: #45d0c4;
    --chart-home: #70b8df;
    --chart-battery: #f2ae5d;
    --chart-grid: #b4a4f2;
    --chart-direct: #66d99b;
    --chart-export: #e496bd;
    --chart-charge: #e4c05f;
    --chart-gen24: #8edb82;
    --chart-symo: #d09bda;
    --shadow: 0 24px 80px rgba(0, 0, 0, 0.32);
    --node-shadow: 0 14px 36px rgba(0, 0, 0, 0.24);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { min-width: 320px; background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 15% -10%, var(--accent-glow), transparent 34rem),
    radial-gradient(circle at 95% 20%, rgba(71, 124, 150, 0.1), transparent 30rem),
    var(--bg);
  font-size: 16px;
  line-height: 1.5;
}

button, a { font: inherit; }

.skip-link {
  position: fixed;
  z-index: 100;
  top: 0.75rem;
  left: 0.75rem;
  transform: translateY(-180%);
  padding: 0.65rem 0.9rem;
  color: var(--surface-solid);
  background: var(--text);
  border-radius: 0.5rem;
}

.skip-link:focus { transform: none; }

.app-shell { width: min(1540px, 100%); margin: 0 auto; padding: 0 2.5rem; }

.app-header {
  min-height: 76px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  border-bottom: 1px solid color-mix(in srgb, var(--line), transparent 25%);
}

.brand {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent), transparent 58%);
  border-radius: 13px;
}

.brand-mark svg { width: 23px; fill: currentColor; }
.brand strong { display: block; font-size: 1.05rem; letter-spacing: 0.01em; }
.brand small { display: block; color: var(--muted); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; }

nav { display: flex; align-items: center; gap: 0.35rem; }

.nav-link {
  padding: 0.55rem 0.9rem;
  color: var(--muted);
  text-decoration: none;
  border-radius: 0.65rem;
  font-size: 0.92rem;
  font-weight: 650;
}

.nav-link.active { color: var(--text); background: var(--surface); box-shadow: 0 4px 14px rgba(20, 52, 62, 0.06); }
.nav-link.disabled { opacity: 0.55; cursor: not-allowed; }

.theme-toggle {
  justify-self: end;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 50%;
  cursor: pointer;
}

.theme-toggle:hover { border-color: var(--line-strong); }
.theme-toggle:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent), transparent 45%); outline-offset: 3px; }
.theme-toggle svg { width: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .moon { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .moon { display: block; }

main { padding: 2rem 0 2rem; }

.live-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 2rem;
  margin-bottom: 1.1rem;
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(2rem, 4vw, 3.4rem); line-height: 1; letter-spacing: -0.045em; }
h2 { margin-bottom: 0; font-size: clamp(1.25rem, 2vw, 1.75rem); line-height: 1.2; letter-spacing: -0.025em; }
.eyebrow { margin-bottom: 0.55rem; color: var(--accent); font-size: 0.74rem; font-weight: 800; letter-spacing: 0.13em; text-transform: uppercase; }

.connection-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 0.35rem;
  background: var(--line-strong);
  border-radius: 50%;
}

.connection-dot.connected { background: var(--accent); box-shadow: 0 0 0 5px var(--accent-glow); }
.connection-dot.reconnecting { background: var(--warning); }

.freshness { display: flex; align-items: center; gap: 0.8rem; color: var(--muted); font-size: 0.9rem; }

.quality-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0.25rem 0.7rem;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.quality-pill[data-quality="partial"], .quality-pill[data-quality="missing"], .quality-pill[data-quality="unresolved"] { color: var(--warning); background: color-mix(in srgb, var(--warning), transparent 86%); }
.quality-pill[data-quality="stale"], .quality-pill[data-quality="error"], .quality-pill[data-quality="source_error"] { color: var(--danger); background: color-mix(in srgb, var(--danger), transparent 86%); }

.flow-panel, .status-panel {
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--line), transparent 10%);
  border-radius: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.flow-panel { padding: 1.35rem 1.5rem 0.4rem; overflow: hidden; }

.panel-heading, .status-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1.5rem;
}

.flow-summary { max-width: 34rem; margin-bottom: 0.1rem; color: var(--muted); text-align: right; font-size: 0.84rem; }

.flow-map { position: relative; height: clamp(520px, 52vh, 570px); min-height: 520px; isolation: isolate; }
.flow-lines { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; z-index: 0; }
.flow-lines g path { fill: none; stroke: var(--line); stroke-width: 2; stroke-linecap: round; transition: stroke 300ms ease, opacity 300ms ease; }
.flow-lines .pv-grouping path { stroke: color-mix(in srgb, var(--accent), var(--line) 42%); stroke-width: 1.5; opacity: 0.7; }
.flow-lines g circle { display: none; fill: var(--flow-active); filter: drop-shadow(0 0 5px var(--accent)); }
.flow-lines g.is-active path { stroke: var(--flow-active); stroke-width: 2.4; marker-end: url(#flow-arrow); }
.flow-lines g.is-active circle { display: block; }
.flow-lines g.is-unknown path { stroke: var(--warning); stroke-dasharray: 5 8; opacity: 0.65; }
.flow-lines marker path { fill: var(--flow-active); }

.flow-node {
  position: absolute;
  z-index: 2;
  width: clamp(128px, 13vw, 180px);
  min-height: 106px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.9rem;
  text-align: center;
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--node-shadow);
  transform: translate(-50%, -50%);
  transition: border-color 250ms ease, opacity 250ms ease, transform 250ms ease;
}

.flow-node[data-quality="complete"] { border-color: color-mix(in srgb, var(--accent), var(--line) 62%); }
.flow-node[data-quality="partial"], .flow-node[data-quality="stale"], .flow-node[data-quality="source_error"], .flow-node[data-quality="unresolved"], .flow-node[data-quality="missing"] { opacity: 0.76; }
.flow-node[data-quality="unresolved"] { border-style: dashed; border-color: var(--warning); }
.flow-node:hover { transform: translate(-50%, -50%) translateY(-2px); }

.node-pv-total { left: 50%; top: 12%; width: clamp(180px, 18vw, 236px); min-height: 124px; }
.node-gen24 { left: 27%; top: 34%; min-height: 100px; }
.node-symo { left: 73%; top: 34%; min-height: 100px; }
.node-home { left: 18%; top: 84%; }
.node-battery { left: 50%; top: 84%; width: clamp(178px, 17vw, 218px); min-height: 150px; }
.node-grid { left: 82%; top: 84%; }

.node-icon { width: 27px; height: 27px; margin-bottom: 0.3rem; color: var(--accent); }
.node-icon svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.node-icon:not(.solar-icon) svg path { fill: color-mix(in srgb, var(--accent), transparent 86%); }
.node-label { color: var(--muted); font-size: 0.72rem; font-weight: 750; letter-spacing: 0.075em; text-transform: uppercase; }
.node-value { display: block; margin: 0.05rem 0; font-size: clamp(1.45rem, 3vw, 2.2rem); line-height: 1.15; letter-spacing: -0.045em; }
.node-value.small { font-size: clamp(1.15rem, 2vw, 1.55rem); }
.node-meta { min-height: 1.2em; color: var(--muted); font-size: 0.76rem; }
.node-pv-total .node-value { font-size: clamp(1.8rem, 3vw, 2.5rem); }
.source-node[data-source-status="night_standby"] .node-meta { color: var(--muted); font-weight: 700; }
.source-node[data-source-status="stale"] .node-meta,
.source-node[data-source-status="source_error"] .node-meta,
.source-node[data-source-status="offline"] .node-meta { color: var(--danger); font-weight: 700; }

.energy-core {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: 59%;
  width: 92px;
  height: 92px;
  display: grid;
  place-content: center;
  text-align: center;
  color: var(--accent);
  background: var(--surface-solid);
  border: 1px solid color-mix(in srgb, var(--accent), var(--line) 48%);
  border-radius: 50%;
  box-shadow: 0 0 0 10px var(--accent-glow), 0 14px 34px rgba(8, 121, 111, 0.18);
  transform: translate(-50%, -50%);
}

.distributor-icon { width: 48px; height: 48px; fill: var(--accent-soft); stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.distributor-icon path { fill: none; }

.battery-soc { margin: 0.05rem 0; font-size: clamp(1.65rem, 2.5vw, 2.1rem); line-height: 1.05; letter-spacing: -0.045em; }
.battery-action { color: var(--text); font-size: 0.9rem; }
.battery-action strong { font-size: 1rem; }
.battery-device { margin-top: 0.15rem; color: var(--muted); font-size: 0.67rem; letter-spacing: 0.035em; }
.battery-gauge { width: 82%; height: 7px; margin-top: 0.55rem; overflow: hidden; background: var(--line); border-radius: 999px; }
.battery-gauge span { display: block; width: 0; height: 100%; background: var(--accent); border-radius: inherit; transition: width 500ms ease; }
.node-emphasis { margin-top: 0.05rem; color: var(--text); font-size: 0.82rem; font-weight: 700; }

.status-panel { margin-top: 1rem; padding: 1rem 1.4rem; box-shadow: 0 14px 45px rgba(27, 61, 72, 0.08); }
.status-heading h2 { font-size: 1.15rem; }
.status-note { color: var(--muted); font-size: 0.8rem; }
.status-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin: 0.8rem 0 0; }
.status-grid > div { padding: 0.15rem 1.25rem; border-left: 1px solid var(--line); }
.status-grid > div:first-child { padding-left: 0; border-left: 0; }
.status-grid dt { color: var(--muted); font-size: 0.72rem; font-weight: 750; letter-spacing: 0.07em; text-transform: uppercase; }
.status-grid dd { margin: 0.25rem 0 0; font-size: 0.94rem; font-weight: 700; }
.status-grid dd span { display: inline-block; width: 7px; height: 7px; margin-right: 0.38rem; background: var(--line-strong); border-radius: 50%; }
.status-grid dd[data-status="online"] span, .status-grid dd[data-status="complete"] span, .status-grid dd[data-status="night_standby"] span, .status-grid dd[data-status="ok"] span { background: var(--accent); }
.status-grid dd[data-status="stale"] span, .status-grid dd[data-status="partial"] span { background: var(--warning); }
.status-grid dd[data-status="offline"] span, .status-grid dd[data-status="source_error"] span, .status-grid dd[data-status="error"] span { background: var(--danger); }

.today-section { margin-top: 3rem; }

.today-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 1.15rem;
}

.today-freshness {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.today-kpi-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 1rem;
}

.kpi-group {
  grid-column: span 4;
  min-width: 0;
  padding: 1.25rem 1.35rem;
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--line), transparent 8%);
  border-radius: 22px;
  box-shadow: 0 14px 40px rgba(27, 61, 72, 0.08);
}

.kpi-group[data-quality="partial"] { border-color: color-mix(in srgb, var(--warning), var(--line) 65%); }
.kpi-group[data-quality="missing"] { border-style: dashed; }

.kpi-primary {
  grid-row: span 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background:
    radial-gradient(circle at 82% 15%, var(--accent-glow), transparent 12rem),
    var(--surface);
}

.kpi-group-label {
  margin-bottom: 0.35rem;
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.kpi-group h3, .chart-panel h3 {
  margin: 0;
  font-size: 1.12rem;
  letter-spacing: -0.02em;
}

.kpi-primary-value {
  display: block;
  margin: 0.4rem 0 0.1rem;
  font-size: clamp(2rem, 4vw, 3.3rem);
  line-height: 1;
  letter-spacing: -0.055em;
}

.kpi-breakdown, .kpi-list { margin: 0; }

.kpi-breakdown {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 1.2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.kpi-breakdown dt, .kpi-list dt {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.kpi-breakdown dd { margin: 0.2rem 0 0; font-size: 1.05rem; font-weight: 750; }

.kpi-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 0.8rem;
}

.kpi-list > div + div { padding-left: 1rem; border-left: 1px solid var(--line); }
.kpi-list dd { margin: 0.2rem 0 0; font-size: clamp(1.2rem, 2vw, 1.65rem); font-weight: 760; letter-spacing: -0.035em; }

.metric-quality {
  display: block;
  margin-top: 0.25rem;
  color: var(--warning);
  font-size: 0.7rem;
  line-height: 1.3;
}

.coverage-note { margin: 0.85rem 0 0; color: var(--muted); font-size: 0.78rem; }

.chart-panel {
  margin-top: 1rem;
  padding: 1.3rem 1.4rem 1rem;
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--line), transparent 8%);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.chart-heading { display: flex; align-items: end; justify-content: space-between; gap: 1.5rem; }
.chart-convention { max-width: 34rem; margin: 0; color: var(--muted); font-size: 0.76rem; text-align: right; }

.chart-legend { display: flex; flex-wrap: wrap; gap: 0.45rem; margin: 1rem 0 0.6rem; }
.chart-legend button {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  padding: 0.38rem 0.65rem;
  color: var(--text);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.74rem;
  font-weight: 700;
}
.chart-legend button[aria-pressed="false"] { color: var(--muted); opacity: 0.62; }
.chart-legend button:focus-visible, .chart-shell:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent), transparent 45%); outline-offset: 2px; }
.legend-swatch { width: 8px; height: 8px; background: var(--series-color); border-radius: 50%; }

.chart-shell { position: relative; width: 100%; min-width: 0; overflow: hidden; border-radius: 16px; }
.chart-shell svg { display: block; width: 100%; height: 360px; overflow: visible; }
.chart-grid { stroke: var(--line); stroke-width: 1; opacity: 0.68; }
.chart-zero { stroke: var(--line-strong); stroke-width: 1.3; }
.chart-axis-label { fill: var(--muted); font-size: 11px; }
.chart-line { fill: none; stroke: var(--series-color); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.chart-cursor { stroke: var(--line-strong); stroke-width: 1; stroke-dasharray: 3 4; }
.chart-point { fill: var(--surface-solid); stroke: var(--series-color); stroke-width: 2; }
.chart-empty { fill: var(--muted); font-size: 13px; text-anchor: middle; }

.chart-tooltip {
  position: absolute;
  z-index: 4;
  min-width: 165px;
  max-width: 220px;
  padding: 0.65rem 0.75rem;
  color: var(--text);
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--node-shadow);
  pointer-events: none;
  font-size: 0.72rem;
}
.chart-tooltip strong { display: block; margin-bottom: 0.35rem; }
.chart-tooltip small { display: block; margin: -0.15rem 0 0.45rem; color: var(--muted); }
.chart-tooltip span { display: flex; justify-content: space-between; gap: 1rem; }
.chart-tooltip i { display: inline-block; width: 7px; height: 7px; margin-right: 0.35rem; background: var(--series-color); border-radius: 50%; }
.chart-summary { margin: 0.55rem 0 0; color: var(--muted); font-size: 0.74rem; }

.history-view { min-height: 70vh; }

.history-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 1.2rem;
}

.history-state {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.history-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.9rem 1.25rem;
  align-items: center;
  padding: 0.8rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 12px 34px rgba(27, 61, 72, 0.07);
}

.period-tabs { display: flex; gap: 0.3rem; overflow-x: auto; scrollbar-width: thin; }
.period-tabs button, .secondary-button, .icon-button, .range-form button, .history-error button {
  padding: 0.5rem 0.75rem;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 0.65rem;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 750;
  white-space: nowrap;
}
.period-tabs button.active { color: var(--text); background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent), transparent 65%); }
.secondary-button, .icon-button, .range-form button, .history-error button { color: var(--text); background: var(--surface-soft); border-color: var(--line); }
.icon-button { min-width: 2.25rem; padding-inline: 0.55rem; }
.icon-button:disabled { opacity: 0.35; cursor: not-allowed; }

.history-navigator { display: flex; align-items: center; justify-content: end; gap: 0.45rem; }
.history-navigator strong { min-width: 13rem; text-align: center; font-size: 0.9rem; }

.range-form {
  grid-column: 1 / -1;
  display: flex;
  justify-content: end;
  align-items: end;
  gap: 0.7rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--line);
}
.range-form label { display: grid; gap: 0.25rem; color: var(--muted); font-size: 0.72rem; font-weight: 700; text-transform: uppercase; }
.range-form input { min-height: 38px; padding: 0.35rem 0.55rem; color: var(--text); background: var(--surface-solid); border: 1px solid var(--line); border-radius: 0.55rem; }

.history-error {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-top: 1rem;
  padding: 1rem 1.2rem;
  color: var(--danger);
  background: color-mix(in srgb, var(--danger), transparent 92%);
  border: 1px solid color-mix(in srgb, var(--danger), transparent 68%);
  border-radius: 16px;
}
.history-error span { flex: 1; color: var(--muted); }

.history-kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.8rem; margin-top: 1rem; }
.history-kpi {
  min-height: 105px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 1rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 12px 34px rgba(27, 61, 72, 0.06);
}
.history-kpi.kpi-accent { background: radial-gradient(circle at 86% 8%, var(--accent-glow), transparent 9rem), var(--surface); }
.history-kpi > span { color: var(--muted); font-size: 0.72rem; font-weight: 750; letter-spacing: 0.055em; text-transform: uppercase; }
.history-kpi > strong { margin-top: 0.25rem; font-size: clamp(1.25rem, 2.2vw, 1.8rem); letter-spacing: -0.04em; }
.history-kpi strong + strong { margin-top: 0; }
.history-kpi small { color: var(--muted); font-size: 0.65rem; font-weight: 650; letter-spacing: 0; }
.history-battery-values { display: grid; gap: 0.1rem; margin-top: 0.25rem; }
.history-battery-values p { display: flex; align-items: baseline; gap: 0.45rem; margin: 0; min-width: 0; }
.history-battery-values strong { font-size: clamp(1.25rem, 2.2vw, 1.8rem); letter-spacing: -0.04em; white-space: nowrap; }
.history-battery-values small { white-space: nowrap; }

.history-chart-panel { margin-top: 0.85rem; }
.history-chart-shell svg { min-height: 300px; }
.history-line { stroke-width: 2.4; }

.history-detail-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 1rem; margin-top: 1rem; }
.history-balance, .history-sources {
  padding: 1.25rem 1.4rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 12px 34px rgba(27, 61, 72, 0.06);
}
.history-balance dl, .history-sources dl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; margin: 1rem 0 0; }
.history-balance dl > div, .history-sources dl > div { padding: 0.2rem 0.8rem; border-left: 1px solid var(--line); }
.history-balance dl > div:first-child, .history-sources dl > div:first-child { padding-left: 0; border-left: 0; }
.history-balance dt, .history-sources dt { color: var(--muted); font-size: 0.68rem; font-weight: 750; text-transform: uppercase; }
.history-balance dd, .history-sources dd { margin: 0.2rem 0 0; font-size: 1rem; font-weight: 750; }
.history-sources p:last-child { margin: 0.85rem 0 0; color: var(--muted); font-size: 0.72rem; }
.history-soc-panel { margin-top: 1rem; }
.history-soc-shell svg { height: 220px; }
.soc-line { --series-color: var(--chart-battery); stroke-width: 2.5; }

#history-content[aria-busy="true"] { opacity: 0.62; pointer-events: none; }

.wattpilot-view { min-height: 70vh; }
.wattpilot-kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.8rem;
}
.wattpilot-kpi-grid .history-kpi { min-height: 96px; }
.wattpilot-kpi-grid .history-kpi > strong { font-size: clamp(1.05rem, 1.8vw, 1.55rem); }
.wattpilot-filters {
  display: flex;
  align-items: end;
  gap: 0.75rem;
  margin: 1rem 0;
  padding: 0.8rem 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
}
.wattpilot-filters label { display: grid; gap: 0.25rem; color: var(--muted); font-size: 0.72rem; font-weight: 750; text-transform: uppercase; }
.wattpilot-filters select { min-height: 38px; padding: 0.35rem 2rem 0.35rem 0.55rem; color: var(--text); background: var(--surface-solid); border: 1px solid var(--line); border-radius: 0.55rem; }
.wattpilot-filters .checkbox-filter { display: flex; align-items: center; gap: 0.4rem; min-height: 38px; }
.wattpilot-table-panel { padding: 1.2rem 1.3rem; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 12px 34px rgba(27, 61, 72, 0.06); }
.wattpilot-table-scroll { overflow-x: auto; }
.wattpilot-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.wattpilot-table th { color: var(--muted); font-size: 0.68rem; letter-spacing: 0.045em; text-align: left; text-transform: uppercase; }
.wattpilot-table th, .wattpilot-table td { padding: 0.75rem 0.6rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.wattpilot-table tbody tr[data-conflict="true"] { background: color-mix(in srgb, var(--danger), transparent 94%); }
.wattpilot-pagination { display: flex; align-items: center; justify-content: center; gap: 0.8rem; padding-top: 1rem; color: var(--muted); font-size: 0.82rem; }
#wattpilot-content[aria-busy="true"] { opacity: 0.62; pointer-events: none; }

footer { display: flex; justify-content: space-between; padding: 1.2rem 0 1.8rem; color: var(--muted); font-size: 0.74rem; }

@media (max-width: 820px) {
  .app-shell { padding: 0 1.1rem; }
  .app-header { grid-template-columns: 1fr auto; min-height: 68px; }
  .app-header nav { grid-row: 2; grid-column: 1 / -1; justify-content: center; padding: 0.4rem 0 0.7rem; border-top: 1px solid var(--line); }
  .live-heading { align-items: flex-start; flex-direction: column; gap: 1rem; }
  .freshness { width: 100%; justify-content: space-between; }
  main { padding-top: 1.5rem; }
  .flow-panel { padding: 1.25rem 0.8rem 0.3rem; border-radius: 22px; }
  .panel-heading { align-items: flex-start; flex-direction: column; padding: 0 0.45rem; gap: 0.75rem; }
  .flow-summary { text-align: left; }
  .flow-map { height: 640px; min-height: 640px; }
  .node-pv-total { top: 12%; }
  .node-gen24 { left: 24%; top: 34%; }
  .node-symo { left: 76%; top: 34%; }
  .energy-core { top: 59%; width: 84px; height: 84px; }
  .node-home { left: 17%; top: 84%; }
  .node-battery { left: 50%; top: 84%; }
  .node-grid { left: 83%; top: 84%; }
  .flow-node { width: clamp(115px, 27vw, 160px); min-height: 108px; padding: 0.72rem; }
  .status-grid { grid-template-columns: repeat(2, 1fr); gap: 1rem 0; }
  .status-grid > div:nth-child(3) { padding-left: 0; border-left: 0; }
  .today-heading { align-items: flex-start; flex-direction: column; gap: 0.75rem; }
  .today-freshness { width: 100%; justify-content: space-between; }
  .today-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-group { grid-column: span 1; }
  .kpi-primary { grid-column: span 2; grid-row: auto; }
  .chart-heading { align-items: flex-start; flex-direction: column; gap: 0.55rem; }
  .chart-convention { text-align: left; }
  .history-heading { align-items: flex-start; flex-direction: column; gap: 0.75rem; }
  .history-state { width: 100%; justify-content: space-between; }
  .history-toolbar { grid-template-columns: 1fr; }
  .history-navigator { justify-content: center; }
  .history-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .history-detail-grid { grid-template-columns: 1fr; }
  .wattpilot-kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .wattpilot-filters { flex-wrap: wrap; }
}

@media (max-width: 520px) {
  .app-shell { padding: 0 0.7rem; }
  .brand small { display: none; }
  .app-header { min-height: 60px; }
  .nav-link { padding: 0.45rem 0.7rem; font-size: 0.84rem; }
  .live-heading { padding: 0 0.3rem; }
  .live-heading { gap: 0.55rem; margin-bottom: 0.9rem; }
  .freshness { align-items: center; flex-direction: row; gap: 0.45rem; }
  main { padding-top: 1.05rem; }
  .flow-map { height: 820px; min-height: 820px; }
  .node-pv-total { top: 10%; }
  .node-gen24 { left: 24%; top: 25%; }
  .node-symo { left: 76%; top: 25%; }
  .energy-core { top: 44%; width: 82px; height: 82px; }
  .node-home { left: 24%; top: 61%; }
  .node-battery { left: 76%; top: 74%; }
  .node-grid { left: 24%; top: 89%; }
  .flow-node { width: min(42vw, 145px); min-height: 105px; border-radius: 17px; }
  .node-battery { width: min(44vw, 155px); min-height: 148px; }
  .status-panel { padding: 1.2rem 1rem; }
  .status-grid { grid-template-columns: 1fr; }
  .status-grid > div { padding: 0.55rem 0; border-left: 0; border-top: 1px solid var(--line); }
  .status-grid > div:first-child { border-top: 0; }
  .today-section { margin-top: 2.25rem; }
  .today-heading { padding: 0 0.3rem; }
  .today-freshness { align-items: flex-start; flex-direction: column; }
  .today-kpi-grid { grid-template-columns: 1fr; gap: 0.75rem; }
  .kpi-group, .kpi-primary { grid-column: span 1; padding: 1.1rem; border-radius: 18px; }
  .kpi-primary-value { font-size: 2.35rem; }
  .chart-panel { padding: 1.1rem 0.7rem 0.85rem; border-radius: 20px; }
  .chart-heading { padding: 0 0.35rem; }
  .chart-convention { font-size: 0.7rem; }
  .chart-legend { padding: 0 0.3rem; }
  .chart-shell svg { height: 310px; }
  footer { padding-inline: 0.35rem; }
  .history-heading { padding: 0 0.3rem; }
  .history-state { align-items: flex-start; flex-direction: column; }
  .history-toolbar { padding: 0.65rem; border-radius: 16px; }
  .period-tabs { margin-inline: -0.2rem; }
  .period-tabs button { padding-inline: 0.62rem; }
  .history-navigator { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; }
  .history-navigator strong { min-width: 0; font-size: 0.8rem; }
  .history-navigator .secondary-button { grid-column: 1 / -1; }
  .range-form { align-items: stretch; flex-direction: column; }
  .history-error { align-items: flex-start; flex-direction: column; }
  .history-kpi-grid { grid-template-columns: 1fr; gap: 0.65rem; }
  .history-kpi { min-height: 86px; padding: 0.85rem 1rem; }
  .history-battery-values { gap: 0.18rem; }
  .history-battery-values p { gap: 0.55rem; }
  .history-detail-grid { gap: 0.75rem; }
  .history-balance, .history-sources { padding: 1.05rem; border-radius: 18px; }
  .history-balance dl { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.8rem 0; }
  .history-balance dl > div:nth-child(odd) { padding-left: 0; border-left: 0; }
  .history-sources dl { grid-template-columns: 1fr; }
  .history-sources dl > div { padding: 0.55rem 0; border-left: 0; border-top: 1px solid var(--line); }
  .history-sources dl > div:first-child { border-top: 0; }
  .wattpilot-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.65rem; }
  .wattpilot-kpi-grid .history-kpi { min-height: 86px; }
  .wattpilot-filters { align-items: stretch; flex-direction: column; padding: 0.8rem; }
  .wattpilot-filters .checkbox-filter { min-height: 30px; }
  .wattpilot-table-panel { padding: 1rem 0.7rem; border-radius: 18px; }
  .wattpilot-table th, .wattpilot-table td { padding: 0.65rem 0.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
  .flow-lines g circle { display: none !important; }
}

/* Phase 8C house view */
.live-heading-actions { display: flex; align-items: center; gap: 1rem; }
.view-switch { display: inline-flex; padding: 0.2rem; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 999px; }
.view-switch button { min-height: 34px; padding: 0.35rem 0.8rem; color: var(--muted); background: transparent; border: 0; border-radius: 999px; font-size: 0.75rem; font-weight: 750; }
.view-switch button[aria-pressed="true"] { color: var(--text); background: var(--surface-solid); box-shadow: 0 3px 12px rgba(10, 43, 52, 0.1); }

.house-panel { overflow: hidden; padding: 1.4rem; background: var(--surface); border: 1px solid var(--line); border-radius: 26px; box-shadow: 0 18px 52px rgba(27, 61, 72, 0.08); }
.house-panel-heading { padding: 0 0.35rem 1rem; }
.environment-readout { display: grid; justify-items: end; gap: 0.12rem; color: var(--muted); font-size: 0.72rem; }
.environment-readout strong { color: var(--text); font-size: 0.84rem; }
.house-scene {
  --sky-top: #71b7d2; --sky-bottom: #e8f4ef; --land-back: #79a585; --land-front: #527b61;
  position: relative; min-height: 650px; overflow: hidden; isolation: isolate;
  background: linear-gradient(180deg, var(--sky-top), var(--sky-bottom) 65%);
  border: 1px solid color-mix(in srgb, var(--line), transparent 20%); border-radius: 22px;
  transition: background 800ms ease;
}
.house-scene[data-scene="golden"] { --sky-top: #6ca6c6; --sky-bottom: #f8cda0; --land-back: #788f79; --land-front: #4e6e57; }
.house-scene[data-scene="evening"] { --sky-top: #455d8d; --sky-bottom: #efa477; --land-back: #53646d; --land-front: #334b45; }
.house-scene[data-scene="twilight"] { --sky-top: #263955; --sky-bottom: #9b7180; --land-back: #344550; --land-front: #253c3c; }
.house-scene[data-scene="night"] { --sky-top: #071625; --sky-bottom: #193247; --land-back: #233a45; --land-front: #142e32; }
.environment-sky { position: absolute; inset: 0; z-index: -4; overflow: hidden; }
.sun-disc, .moon-disc { position: absolute; top: 9%; right: 13%; width: 70px; aspect-ratio: 1; border-radius: 50%; transition: opacity 600ms ease; }
.sun-disc { background: #fff5b5; box-shadow: 0 0 55px 22px rgba(255, 231, 130, .48); }
.moon-disc { opacity: 0; background: radial-gradient(circle at 38% 35%, #fff, #cbd6da 70%); box-shadow: 0 0 30px rgba(220, 235, 245, .3); clip-path: inset(0 calc(100% - var(--moon-illumination, 50%)) 0 0); }
.house-scene[data-scene="night"] .sun-disc, .house-scene[data-scene="twilight"] .sun-disc { opacity: 0; }
.house-scene[data-scene="night"] .moon-disc, .house-scene[data-scene="twilight"] .moon-disc { opacity: 1; }
.house-scene[data-weather="overcast"] .sun-disc,
.house-scene[data-weather="fog"] .sun-disc,
.house-scene[data-weather="drizzle"] .sun-disc,
.house-scene[data-weather="rain"] .sun-disc,
.house-scene[data-weather="heavy_rain"] .sun-disc,
.house-scene[data-weather="snow"] .sun-disc,
.house-scene[data-weather="thunderstorm"] .sun-disc { opacity: 0; }
.star-field { position: absolute; inset: 0; opacity: 0; background-image: radial-gradient(circle, #fff 0 1px, transparent 1.5px); background-size: 67px 61px; transform: rotate(-4deg); transition: opacity 600ms ease; }
.house-scene[data-scene="night"] .star-field { opacity: .65; }
.cloud { position: absolute; width: 130px; height: 28px; border-radius: 999px; background: rgba(255,255,255,.66); filter: blur(.2px); opacity: 0; }
.cloud::before, .cloud::after { content: ""; position: absolute; bottom: 0; border-radius: 50%; background: inherit; }
.cloud::before { left: 18px; width: 55px; height: 55px; }.cloud::after { right: 20px; width: 72px; height: 72px; }
.cloud-one { top: 15%; left: 8%; }.cloud-two { top: 24%; right: 26%; transform: scale(.65); }
.house-scene:not([data-weather="clear"]):not([data-weather="unavailable"]) .cloud { opacity: .72; }
.house-scene[data-weather="overcast"] .cloud, .house-scene[data-weather="fog"] .cloud { opacity: .9; filter: grayscale(1); }
.weather-layer { position: absolute; inset: 0; opacity: 0; pointer-events: none; }
.house-scene[data-weather="rain"] .weather-layer, .house-scene[data-weather="heavy_rain"] .weather-layer, .house-scene[data-weather="drizzle"] .weather-layer { opacity: .5; background-image: repeating-linear-gradient(105deg, transparent 0 13px, rgba(210,235,245,.55) 14px 15px, transparent 16px 28px); animation: rain-shift .55s linear infinite; }
.house-scene[data-weather="snow"] .weather-layer { opacity: .8; background-image: radial-gradient(circle, #fff 0 2px, transparent 2.5px); background-size: 32px 32px; animation: snow-shift 4s linear infinite; }
.house-scene[data-weather="thunderstorm"] .weather-layer { opacity: .45; background: linear-gradient(110deg, transparent 46%, #eff8ff 48%, transparent 51%); animation: lightning 5s steps(1) infinite; }
@keyframes rain-shift { to { background-position: -28px 40px; } }
@keyframes snow-shift { to { background-position: 18px 60px; } }
@keyframes lightning { 0%, 91%, 94%, 100% { opacity: 0; } 92%, 93% { opacity: .7; } }
.landscape { position: absolute; inset: auto 0 0; height: 40%; z-index: -3; background: linear-gradient(180deg, var(--land-back), var(--land-front)); clip-path: polygon(0 40%, 13% 22%, 29% 42%, 46% 10%, 65% 40%, 80% 20%, 100% 39%, 100% 100%, 0 100%); }
.landscape::after { content: ""; position: absolute; inset: 50% 0 0; background: color-mix(in srgb, var(--land-front), #102b2a 12%); }

.house-illustration { position: absolute; left: 30%; bottom: 7%; width: 46%; z-index: 2; filter: drop-shadow(0 20px 18px rgba(10, 35, 42, .22)); }
.house-illustration svg { display: block; width: 100%; }
.house-wall { fill: #e4ded0; stroke: #6f736e; stroke-width: 3; }.house-roof { fill: #4b4d4b; stroke: #333b3a; stroke-width: 4; }.house-shadow { fill: rgba(12,33,33,.2); }
.roof-panels path { fill: #215c6e; stroke: #8fc4cc; stroke-width: 2; }.floor-line { fill: none; stroke: rgba(56,71,71,.35); stroke-width: 2; stroke-dasharray: 5 7; }.house-window { fill: #9cd0d4; stroke: #50686c; stroke-width: 3; }.house-door { fill: #6e7875; }
.house-scene[data-scene="night"] .house-window, .house-scene[data-scene="twilight"] .house-window { fill: #f4c46c; filter: drop-shadow(0 0 8px rgba(244,196,108,.65)); }
.carport-illustration { position: absolute; left: 4%; bottom: 15%; width: 28%; height: 180px; z-index: 1; }
.carport-roof { position: absolute; left: 0; right: 0; top: 0; height: 20px; background: #3d4b4b; transform: skewX(-8deg); border-top: 6px solid #275e6c; }
.carport-post { position: absolute; top: 14px; bottom: 0; width: 7px; background: #56615f; }.carport-post.left { left: 6%; }.carport-post.right { right: 4%; }
.scene-component { position: absolute; z-index: 5; padding: 0; color: var(--text); background: transparent; border: 0; text-align: left; }
.scene-component:focus-visible .component-card, .scene-component:hover .component-card { border-color: var(--accent); box-shadow: 0 10px 30px rgba(10, 64, 65, .2); transform: translateY(-2px); }
.component-card { display: grid; min-width: 125px; gap: .08rem; padding: .62rem .72rem; background: color-mix(in srgb, var(--surface-solid), transparent 5%); border: 1px solid color-mix(in srgb, var(--line), transparent 8%); border-radius: 13px; box-shadow: 0 8px 22px rgba(10, 38, 43, .14); backdrop-filter: blur(8px); transition: 160ms ease; }
.component-card.compact { min-width: 94px; padding: .45rem .58rem; }.component-kicker { color: var(--muted); font-size: .61rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }.component-card strong { font-size: .92rem; }.component-card > span:last-child:not(.component-kicker) { color: var(--muted); font-size: .66rem; }
.pv-component { left: 46%; top: 6%; }.gen24-component { left: 38%; bottom: 21%; }.symo-component { left: 55%; bottom: 21%; }.home-component { left: 62%; top: 36%; }.battery-component { left: 42%; bottom: 1.5%; display: flex; align-items: center; gap: .45rem; }.grid-component { right: 2.5%; bottom: 24%; }.vehicle-component { left: 5%; bottom: 11%; width: 25%; }.vehicle-component img { display: block; width: 100%; }.vehicle-component .component-card { margin: -.15rem auto 0; width: 88%; }
.device-dot { position: absolute; width: 13px; height: 13px; left: -7px; top: 50%; border-radius: 4px; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
.battery-illustration { display: flex; align-items: end; width: 20px; height: 42px; padding: 2px; border: 2px solid #486464; border-radius: 5px; background: rgba(255,255,255,.5); }.battery-illustration span { display: block; width: 100%; background: var(--accent); border-radius: 2px; }
.grid-mast { position: absolute; bottom: 95%; left: 50%; width: 64px; height: 170px; transform: translateX(-50%); border-left: 4px solid #53615f; clip-path: polygon(46% 0,54% 0,68% 100%,32% 100%); background: repeating-linear-gradient(180deg, #53615f 0 4px, transparent 4px 24px); }
.floor-label { position: absolute; left: 63%; z-index: 3; color: rgba(34,52,52,.65); font-size: .58rem; font-weight: 800; text-transform: uppercase; }.floor-dg { top: 43%; }.floor-eg { top: 58%; }.floor-ug { top: 70%; }
.atmosphere-note { position: absolute; right: .75rem; bottom: .35rem; z-index: 4; margin: 0; color: color-mix(in srgb, var(--text), transparent 34%); font-size: .58rem; }
.house-energy-lines { position: absolute; inset: 0; z-index: 4; width: 100%; height: 100%; pointer-events: none; }
.house-energy-lines g path { fill: none; stroke: rgba(56,106,108,.3); stroke-width: 2; stroke-dasharray: 5 8; vector-effect: non-scaling-stroke; }
.house-energy-lines g.is-active path { stroke: var(--flow-active); stroke-width: 2.5; stroke-dasharray: 8 8; animation: house-flow 1.3s linear infinite; }
@keyframes house-flow { to { stroke-dashoffset: -32; } }
.house-scene.is-charging .vehicle-component .component-card { border-color: color-mix(in srgb, var(--accent), transparent 35%); }

.component-dialog { width: min(480px, calc(100vw - 2rem)); max-height: min(760px, calc(100vh - 2rem)); margin-right: 1rem; padding: 1.2rem; color: var(--text); background: var(--surface-solid); border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 28px 80px rgba(0,0,0,.3); }
.component-dialog::backdrop { background: rgba(4, 17, 22, .46); backdrop-filter: blur(2px); }.dialog-header { display: flex; align-items: flex-start; justify-content: space-between; }.dialog-header h2 { margin: .1rem 0 0; }.detail-tabs { display: flex; gap: .35rem; margin: 1rem 0; padding-bottom: .8rem; border-bottom: 1px solid var(--line); }.detail-tabs button { padding: .42rem .7rem; color: var(--muted); background: transparent; border: 1px solid transparent; border-radius: 999px; }.detail-tabs button[aria-selected="true"] { color: var(--text); background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent), transparent 65%); }.detail-metrics { display: grid; grid-template-columns: repeat(2, 1fr); gap: .7rem; margin: 0; }.detail-metrics > div { padding: .85rem; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 14px; }.detail-metrics dt { color: var(--muted); font-size: .67rem; font-weight: 750; text-transform: uppercase; }.detail-metrics dd { margin: .25rem 0 0; font-size: 1rem; font-weight: 760; }.detail-note { color: var(--muted); font-size: .75rem; line-height: 1.55; }.detail-history-link { display: inline-flex; margin-top: .8rem; text-decoration: none; }

.system-view { min-height: 70vh; }.vehicle-admin-layout { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(320px, .9fr); gap: 1rem; }.vehicle-list-panel, .vehicle-form { padding: 1.2rem; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 12px 34px rgba(27,61,72,.06); }.vehicle-list { display: grid; gap: .65rem; margin-top: 1rem; }.vehicle-list-item { display: grid; grid-template-columns: 105px 1fr; align-items: center; gap: .75rem; padding: .65rem; color: var(--text); background: var(--surface-soft); border: 1px solid var(--line); border-radius: 14px; text-align: left; }.vehicle-list-item[data-active="false"] { opacity: .58; }.vehicle-list-item img { width: 105px; }.vehicle-list-item span { display: grid; gap: .2rem; }.vehicle-list-item small { color: var(--muted); }.vehicle-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }.vehicle-form > div:first-child, .vehicle-form .form-actions, .vehicle-form .coverage-note { grid-column: 1 / -1; }.vehicle-form label { display: grid; gap: .25rem; color: var(--muted); font-size: .7rem; font-weight: 750; text-transform: uppercase; }.vehicle-form input, .vehicle-form select { min-height: 40px; padding: .45rem .55rem; color: var(--text); background: var(--surface-solid); border: 1px solid var(--line); border-radius: .55rem; }.vehicle-form .checkbox-filter { display: flex; align-items: center; gap: .45rem; }.vehicle-form .checkbox-filter input { min-height: auto; }.form-actions { display: flex; gap: .6rem; }

@media (max-width: 980px) {
  .live-heading-actions { align-items: flex-end; flex-direction: column-reverse; }
  .house-scene { min-height: 720px; }.house-illustration { left: 24%; bottom: 17%; width: 62%; }.carport-illustration { left: 3%; bottom: 18%; width: 30%; }.vehicle-component { left: 3%; bottom: 14%; width: 30%; }.pv-component { left: 43%; top: 8%; }.home-component { left: 64%; top: 34%; }.gen24-component { left: 31%; bottom: 29%; }.symo-component { left: 51%; bottom: 29%; }.battery-component { left: 39%; bottom: 8%; }.grid-component { right: 2%; bottom: 30%; }.floor-label { left: 67%; }.vehicle-admin-layout { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  body { overflow-x: hidden; }
  .app-header nav { min-width: 0; max-width: 100%; justify-content: flex-start; overflow-x: auto; }
  .nav-link { flex: 0 0 auto; }
  .live-heading-actions { width: 100%; align-items: stretch; }.view-switch { align-self: flex-start; }.house-panel { min-width: 0; padding: .65rem; border-radius: 20px; }.house-panel-heading { align-items: flex-start; flex-direction: column; }.environment-readout { max-width: 100%; justify-items: start; }.house-scene { min-width: 0; min-height: 820px; }.house-illustration { left: 4%; top: 20%; bottom: auto; width: 92%; }.carport-illustration { left: 5%; bottom: 9%; width: 48%; height: 145px; }.vehicle-component { left: 6%; bottom: 6%; width: 46%; }.pv-component { left: 31%; top: 6%; }.home-component { left: 52%; top: 40%; }.gen24-component { left: 14%; top: 48%; bottom: auto; }.symo-component { left: 55%; top: 48%; bottom: auto; }.battery-component { left: 13%; top: 61%; bottom: auto; }.grid-component { right: 3%; bottom: 17%; }.grid-mast { height: 120px; }.floor-label { display: none; }.atmosphere-note { left: .55rem; right: .55rem; bottom: .25rem; text-align: center; }.house-energy-lines { opacity: .45; }.component-card { min-width: 112px; padding: .5rem .58rem; }.component-dialog { margin: auto .5rem .5rem; width: calc(100vw - 1rem); max-height: calc(100vh - 1rem); }.detail-metrics { grid-template-columns: 1fr; }.vehicle-form { grid-template-columns: 1fr; }.vehicle-form > div:first-child, .vehicle-form .form-actions, .vehicle-form .coverage-note { grid-column: auto; }
}

@media (max-width: 420px) {
  .app-header nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    gap: .2rem;
    overflow: visible;
  }
  .app-header .nav-link { min-width: 0; padding: .36rem .28rem; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  .house-energy-lines g.is-active path, .weather-layer { animation: none !important; }
}

/* Phase 8C.1 visual-fidelity pass */
.live-heading h1 { margin-bottom: .18rem; font-size: clamp(2rem, 3vw, 3.35rem); letter-spacing: -.045em; }
.live-subtitle { margin: 0; color: var(--muted); font-size: clamp(.88rem, 1.3vw, 1.15rem); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.house-panel { padding: 0; border-radius: 28px; background: var(--surface-solid); box-shadow: 0 22px 70px rgba(16,48,61,.14); }
.house-scene {
  min-height: 690px;
  border-radius: 27px 27px 0 0;
  --sky-top: #7bc8f5;
  --sky-bottom: #edf9ff;
  --land-back: #75a979;
  --land-front: #315f47;
  background: linear-gradient(180deg, var(--sky-top), var(--sky-bottom) 58%, #d8e8cf 58%, #b2c99e 100%);
  box-shadow: inset 0 -32px 70px rgba(16,56,47,.12);
}
.house-scene::after { content: ""; position: absolute; inset: auto 0 0; height: 17%; z-index: -1; background: repeating-linear-gradient(96deg, rgba(255,255,255,.7) 0 2px, transparent 2px 36px), linear-gradient(180deg,#d7d5cb,#b7b8b0); transform: perspective(500px) rotateX(62deg); transform-origin: bottom; }
.house-scene[data-scene="golden"] { --sky-top:#8bbbcf; --sky-bottom:#ffd2a0; --land-back:#698a68; --land-front:#3f6147; }
.house-scene[data-scene="evening"] { --sky-top:#384c7a; --sky-bottom:#f58b58; --land-back:#3c5360; --land-front:#243f3f; }
.house-scene[data-scene="twilight"] { --sky-top:#172c57; --sky-bottom:#bd6e72; --land-back:#2b4654; --land-front:#17343a; }
.house-scene[data-scene="night"] { --sky-top:#041329; --sky-bottom:#103455; --land-back:#163749; --land-front:#0d2830; }
.house-scene[data-weather="overcast"], .house-scene[data-weather="fog"] { filter: saturate(.72); }
.house-scene[data-weather="rain"], .house-scene[data-weather="heavy_rain"] { --sky-top:#314b63; --sky-bottom:#8099a6; --land-back:#294b4d; --land-front:#15383b; }
.scene-caption { position: absolute; top: 1rem; right: 1.2rem; z-index: 7; display: grid; grid-template-columns: auto auto; align-items: baseline; gap: .12rem .55rem; padding: .72rem .9rem; color: #143644; background: rgba(255,255,255,.78); border: 1px solid rgba(255,255,255,.72); border-radius: 16px; box-shadow: 0 12px 32px rgba(10,43,55,.14); backdrop-filter: blur(12px); }
.scene-caption .scene-time { grid-row: 1 / 3; align-self: center; padding-right: .55rem; color: var(--accent); font-weight: 850; border-right: 1px solid rgba(30,83,90,.18); }
.scene-caption strong { font-size: .8rem; }.scene-caption > span:last-child { max-width: 270px; color: #45616c; font-size: .67rem; }
.environment-sky { background: radial-gradient(circle at 82% 14%, rgba(255,255,255,.36), transparent 23%); }
.sun-disc, .moon-disc { right: 18%; width: 76px; }
.sun-disc { border: 1px solid rgba(255,255,255,.8); box-shadow: 0 0 55px 25px rgba(255,229,115,.55); }
.moon-disc { box-shadow: 0 0 34px rgba(220,235,245,.42); }
.cloud { width: 155px; background: rgba(255,255,255,.7); filter: drop-shadow(0 12px 12px rgba(28,65,78,.14)); }
.cloud-one { top: 17%; left: 8%; }.cloud-two { top: 22%; right: 10%; }
.house-scene[data-scene="night"][data-weather="overcast"] .star-field,
.house-scene[data-scene="night"][data-weather="rain"] .star-field,
.house-scene[data-scene="night"][data-weather="heavy_rain"] .star-field { opacity: .05; }
.landscape { height: 52%; clip-path: none; background: transparent; }
.landscape .horizon { position:absolute; inset:20% 0 0; background: linear-gradient(180deg,var(--land-back),var(--land-front)); clip-path: polygon(0 33%,8% 20%,16% 34%,24% 13%,35% 36%,47% 8%,59% 35%,70% 14%,82% 34%,92% 18%,100% 31%,100% 100%,0 100%); }
.tree { position:absolute; bottom:12%; width:105px; height:240px; background: radial-gradient(ellipse at 52% 22%,#75a85b 0 22%,transparent 23%),radial-gradient(ellipse at 30% 46%,#4f8b4d 0 28%,transparent 29%),radial-gradient(ellipse at 70% 50%,#3f7746 0 32%,transparent 33%),linear-gradient(90deg,transparent 44%,#6c533b 45% 55%,transparent 56%); filter: drop-shadow(0 8px 8px rgba(18,51,37,.25)); }
.tree-one { left:2%; transform:scale(.86); transform-origin:bottom; }.tree-two { left:20%; transform:scale(.62); transform-origin:bottom; }.tree-three { right:8%; transform:scale(.9); transform-origin:bottom; }
.garden-bed { position:absolute; bottom:4%; width:28%; height:60px; border-radius:50%; background: radial-gradient(ellipse,#4c8a48 0 40%,transparent 42%) 0 0/42px 31px,linear-gradient(180deg,transparent,#23452e); }.garden-left{left:4%}.garden-right{right:4%}
.house-illustration { left:28%; bottom:6%; width:51%; filter:drop-shadow(0 22px 18px rgba(8,30,37,.3)); }
.house-illustration svg { overflow: visible; }
.house-wall { fill:#f3eee4; stroke:#6b7775; stroke-width:3; }.house-roof{fill:#3a4144;stroke:#293437;stroke-width:5}.roof-edge{fill:none;stroke:#202c2f;stroke-width:8;stroke-linecap:round}.house-shadow{fill:rgba(8,28,33,.2)}
.roof-panels path { fill:#1d5c82; stroke:#b7e5ef; stroke-width:2; filter:drop-shadow(0 0 5px rgba(62,169,197,.32)); }
.floor-slab{fill:#c7cdca}.basement-wall{fill:#d0d7d6;stroke:#738180;stroke-width:2}.room-divider{fill:none;stroke:rgba(65,80,79,.35);stroke-width:2}.window-glass{fill:#aad8e3;stroke:#687b7e;stroke-width:3}.house-door{fill:#c9c1b4;stroke:#77746e;stroke-width:2}
.bed,.sofa{fill:#b8bfbc;stroke:#707b78;stroke-width:2}.bed-head,.sofa-back{fill:#9da8a4}.pillow{fill:#f5f3ec}.desk,.table{fill:#8c765b}.lamp{fill:#323f42}.lamp-line{fill:none;stroke:#323f42;stroke-width:2}.plants{fill:#3d7450}
.basement-devices rect{fill:#ecf0ef;stroke:#617170;stroke-width:2}.basement-devices path{fill:#d8342f}.basement-devices circle{fill:#2ac76d}.byd-device rect{fill:#f4f5ef}.byd-device path{fill:#3c4948}
.house-scene[data-scene="night"] .house-wall,.house-scene[data-scene="twilight"] .house-wall{fill:#d9d2c4}.house-scene[data-scene="night"] .window-glass,.house-scene[data-scene="twilight"] .window-glass,.house-scene[data-scene="evening"] .window-glass{fill:#ffd07a;filter:drop-shadow(0 0 12px rgba(255,190,80,.7))}.house-scene[data-scene="night"] .room,.house-scene[data-scene="twilight"] .room{filter:drop-shadow(0 0 12px rgba(255,190,80,.18))}
.carport-illustration { left:2.3%; bottom:9%; width:28%; height:265px; z-index:2; perspective:600px; }
.carport-roof { height:32px; border:0; border-top:9px solid #293638; background:linear-gradient(180deg,#8a7a64,#5f5345); transform:skewX(-9deg); box-shadow:0 13px 18px rgba(18,35,35,.25); }.carport-roof i{position:absolute;inset:2px 4px 8px;background:repeating-linear-gradient(90deg,#1e5b71 0 42px,#9ad2df 43px 45px)}
.carport-side { position:absolute; left:0; top:30px; bottom:0; width:26%; background:repeating-linear-gradient(180deg,#5d4939 0 7px,transparent 7px 13px); border-left:7px solid #72614e; }
.carport-post{top:25px;bottom:0;width:10px;background:linear-gradient(90deg,#6d5d4c,#9d8a71)}.carport-post.left{left:4%}.carport-post.right{right:3%}.parking-pad{position:absolute;left:3%;right:0;bottom:-3px;height:28px;background:linear-gradient(180deg,#aeb4af,#797f7b);transform:skewX(-12deg);opacity:.75}
.wattpilot-device{position:absolute;right:7%;top:91px;width:31px;height:57px;border-radius:8px;background:#173d46;border:3px solid #d8f5f2;box-shadow:0 0 18px rgba(41,222,200,.5)}.wattpilot-device i{position:absolute;left:50%;top:12px;width:8px;height:8px;border-radius:50%;background:#23deb6;transform:translateX(-50%)}
.scene-component{z-index:6}.component-card{position:relative;min-width:138px;gap:.11rem;padding:.66rem .82rem .7rem;background:rgba(255,255,255,.92);border:1px solid rgba(69,143,153,.42);border-radius:15px;box-shadow:0 10px 30px rgba(12,46,56,.2);backdrop-filter:blur(13px)}
[data-theme="dark"] .component-card{background:rgba(13,31,38,.9);border-color:rgba(75,190,187,.36)}.component-card::before{content:"";position:absolute;left:0;top:13px;bottom:13px;width:4px;border-radius:0 4px 4px 0;background:var(--card-accent,var(--accent))}.component-kicker{font-size:.63rem;color:color-mix(in srgb,var(--text),transparent 34%)}.component-card strong{font-size:1.02rem;letter-spacing:-.015em}.component-card>span:last-child:not(.component-kicker){font-size:.67rem}.component-card-icon{position:absolute;right:.6rem;top:.45rem;color:var(--accent);font-size:1.15rem}.component-card.compact{min-width:108px;padding:.52rem .65rem}
.pv-component{left:47%;top:3.5%;--card-accent:#13c988}.pv-component .component-card{min-width:160px}.home-component{left:51%;top:35%;--card-accent:#f59e0b}.gen24-component{left:36%;bottom:2.7%;--card-accent:#17c964}.symo-component{left:46%;bottom:2.7%;--card-accent:#17c964}.battery-component{left:57%;bottom:1.7%;--card-accent:#0aa79d}.grid-component{right:2.5%;bottom:21%;--card-accent:#6941c6}.vehicle-component{left:3.5%;bottom:9%;width:25%;--card-accent:#0c74d9}.vehicle-component img{width:100%}.vehicle-component .component-card{position:absolute;left:3%;bottom:95%;width:auto;min-width:180px;margin:0}
.battery-illustration{width:25px;height:51px;background:rgba(255,255,255,.86)}.grid-mast{height:190px;width:78px;bottom:90%;border-left-width:5px;background:repeating-linear-gradient(180deg,#46566a 0 4px,transparent 4px 24px)}
.floor-label{left:30.2%;padding:.15rem .38rem;color:rgba(28,51,51,.72);background:rgba(255,255,255,.54);border-radius:4px;font-size:.57rem;letter-spacing:.02em;text-transform:none}.floor-dg{top:40%}.floor-eg{top:55.5%}.floor-ug{top:69.8%}
.atmosphere-note{right:.8rem;bottom:.3rem;color:rgba(255,255,255,.78);text-shadow:0 1px 3px rgba(0,0,0,.45)}
.house-energy-lines{z-index:5}.house-energy-lines g path{stroke:rgba(110,151,154,.34);stroke-width:5;stroke-dasharray:none;stroke-linecap:round;stroke-linejoin:round;vector-effect:non-scaling-stroke}.house-energy-lines g.is-active path{stroke:var(--flow-color,#19c98c);stroke-width:6;stroke-dasharray:none;filter:url(#flow-glow);animation:none}.house-energy-lines g[data-house-flow="gen24"],.house-energy-lines g[data-house-flow="symo"]{--flow-color:#16cb82}.house-energy-lines g[data-house-flow="home"]{--flow-color:#ff9e0b}.house-energy-lines g[data-house-flow="battery"]{--flow-color:#0fbdad}.house-energy-lines g[data-house-flow="grid"]{--flow-color:#7551db}.house-energy-lines g[data-house-flow="wattpilot"]{--flow-color:#0b7be5}.house-energy-lines .flow-particle{display:none;fill:var(--flow-color);stroke:#fff;stroke-width:3;filter:url(#flow-glow)}.house-energy-lines g.is-active .flow-particle{display:block}.house-energy-lines g[data-direction="to_system"] .reverse,.house-energy-lines g[data-direction="from_system"] .forward{display:none}
.vehicle-assignment{position:absolute;left:2.7%;bottom:2.1%;z-index:8;width:min(330px,27%);padding:.7rem;color:#173742;background:rgba(255,255,255,.94);border:1px solid rgba(8,151,148,.42);border-radius:14px;box-shadow:0 13px 34px rgba(6,39,49,.24);backdrop-filter:blur(12px)}.vehicle-assignment strong,.vehicle-assignment>span{display:block}.vehicle-assignment>span{margin:.1rem 0 .5rem;color:#58717a;font-size:.62rem}.vehicle-assignment div{display:flex;gap:.35rem}.vehicle-assignment button{min-height:32px;padding:.35rem .5rem;color:#fff;background:#087d7b;border:0;border-radius:8px;font-size:.65rem;font-weight:750}.vehicle-assignment p{min-height:.8rem;margin:.35rem 0 0;color:#a33;font-size:.62rem}
.house-system-strip{display:flex;align-items:center;justify-content:space-between;gap:1.2rem;min-height:84px;padding:.75rem 1.1rem;background:color-mix(in srgb,var(--surface-solid),#eaf7f7 18%);border-top:1px solid var(--line)}.status-summary,.flow-legend{display:flex;align-items:center;gap:.9rem}.status-summary>strong,.flow-legend>strong{color:var(--accent);font-size:.72rem}.status-summary span{display:grid;grid-template-columns:auto auto;gap:.05rem .3rem;padding-right:.75rem;border-right:1px solid var(--line);font-size:.65rem}.status-summary span i{grid-row:1/3;align-self:center;width:8px;height:8px;border-radius:50%;background:#16bd8a;box-shadow:0 0 8px rgba(22,189,138,.5)}.status-summary span b{font-size:.66rem}.flow-legend span{position:relative;padding-left:13px;color:var(--muted);font-size:.63rem}.flow-legend span::before{content:"";position:absolute;left:0;top:50%;width:8px;height:8px;border-radius:50%;background:#16cb82;transform:translateY(-50%)}.flow-legend .legend-home::before{background:#ff9e0b}.flow-legend .legend-grid::before{background:#7551db}.flow-legend .legend-car::before{background:#0b7be5}
.component-dialog{width:min(610px,calc(100vw - 2rem));height:calc(100vh - 2rem);max-height:none;margin:1rem 1rem 1rem auto;padding:1.35rem 1.45rem;border-radius:24px;box-shadow:-18px 0 70px rgba(2,18,25,.34);overflow:auto}.component-dialog::backdrop{background:rgba(4,20,27,.54);backdrop-filter:blur(3px)}.dialog-header{padding-bottom:.8rem;border-bottom:1px solid var(--line)}.dialog-header h2{font-size:1.65rem}.detail-tabs{margin:.7rem 0 1rem}.detail-tabs button{flex:1;border-radius:9px}.detail-tabs button[aria-selected="true"]{box-shadow:inset 0 -2px 0 var(--accent)}.detail-hero{display:grid;grid-template-columns:130px 1fr;align-items:center;gap:1rem;margin-bottom:1rem;padding:1rem;background:linear-gradient(135deg,var(--accent-soft),transparent);border:1px solid var(--line);border-radius:18px}.detail-hero img{width:130px}.detail-hero strong{font-size:1.35rem}.detail-hero span{display:block;color:var(--muted);font-size:.76rem}.detail-metrics{grid-template-columns:1fr;margin-top:.4rem;border-top:1px solid var(--line)}.detail-metrics>div{display:flex;align-items:baseline;justify-content:space-between;gap:1rem;padding:.7rem .15rem;background:transparent;border:0;border-bottom:1px solid var(--line);border-radius:0}.detail-metrics dt{font-size:.7rem;text-transform:none}.detail-metrics dd{margin:0;font-size:.9rem}.detail-chart{height:145px;margin:1rem 0;padding:.65rem;border:1px solid var(--line);border-radius:15px;background:linear-gradient(180deg,transparent,var(--accent-soft));overflow:hidden}.detail-chart svg{width:100%;height:100%}.detail-chart path{fill:none;stroke:var(--accent);stroke-width:3}.detail-chart .area{fill:url(#detail-area);stroke:none}.assignment-controls{margin-top:1rem;padding:1rem;background:var(--surface-soft);border:1px solid var(--line);border-radius:16px}.assignment-controls strong{display:block;margin-bottom:.5rem}.assignment-controls div{display:flex;flex-wrap:wrap;gap:.45rem}.assignment-controls button{min-height:36px}.assignment-controls .clear-assignment{color:var(--muted);background:transparent;border:1px solid var(--line)}.assignment-conflict{color:#bd5a24;font-weight:700}
@media (max-width:1180px){.house-scene{min-height:720px}.house-illustration{left:24%;width:58%;bottom:9%}.carport-illustration{width:29%;bottom:12%}.vehicle-component{width:27%;bottom:12%}.gen24-component{left:30%;bottom:5%}.symo-component{left:43%;bottom:5%}.battery-component{left:57%;bottom:4%}.home-component{left:54%;top:36%}.pv-component{left:44%}.grid-component{bottom:26%}.house-system-strip{align-items:flex-start;flex-direction:column}.status-summary,.flow-legend{width:100%;flex-wrap:wrap}}
@media (max-width:780px){.live-heading h1{font-size:2.15rem}.house-scene{min-height:920px;border-radius:20px 20px 0 0}.scene-caption{top:.7rem;right:.7rem}.house-illustration{left:5%;top:19%;bottom:auto;width:90%}.carport-illustration{left:3%;bottom:12%;width:45%;height:210px}.vehicle-component{left:3.5%;bottom:12%;width:42%}.vehicle-component .component-card{left:0;bottom:96%;min-width:160px}.pv-component{left:31%;top:7%}.home-component{left:50%;top:39%}.gen24-component{left:8%;top:52%;bottom:auto}.symo-component{left:38%;top:52%;bottom:auto}.battery-component{left:67%;top:51%;bottom:auto}.grid-component{right:3%;bottom:20%}.grid-mast{height:140px}.floor-label{display:none}.vehicle-assignment{left:3%;bottom:2%;width:94%}.house-system-strip{padding:.8rem}.status-summary{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.5rem}.status-summary>strong{grid-column:1/-1}.status-summary span{border:0}.flow-legend{display:none}.component-dialog{width:100%;height:min(86vh,820px);margin:auto 0 0;padding:1rem;border-radius:24px 24px 0 0}.detail-hero{grid-template-columns:95px 1fr}.detail-hero img{width:95px}}
@media (max-width:480px){.house-panel{border-radius:20px}.house-scene{min-height:850px}.scene-caption{left:.55rem;right:.55rem;top:.55rem}.scene-caption>span:last-child{max-width:210px}.house-illustration{top:22%;width:96%;left:2%}.carport-illustration{bottom:11%;width:49%;height:175px}.vehicle-component{bottom:11%;width:46%}.component-card{min-width:104px;padding:.46rem .55rem}.component-card strong{font-size:.82rem}.component-kicker{font-size:.54rem}.pv-component{left:25%;top:11%}.pv-component .component-card{min-width:145px}.home-component{left:49%;top:41%}.gen24-component{left:3%;top:51%}.symo-component{left:35%;top:51%}.battery-component{left:64%;top:50%}.battery-illustration{display:none}.grid-component{right:2%;bottom:22%}.grid-mast{height:105px}.vehicle-component .component-card{min-width:145px}.vehicle-assignment{bottom:1%;}.vehicle-assignment div{display:grid;grid-template-columns:1fr 1fr}.house-system-strip{min-height:0}.status-summary{grid-template-columns:1fr 1fr}.status-summary span{padding:0}.atmosphere-note{display:none}}
@media (prefers-reduced-motion:reduce){.house-energy-lines .flow-particle{display:none!important}.scene-component:focus-visible .component-card,.scene-component:hover .component-card{transform:none}}
.grid-mast{display:none}.grid-pylon{position:absolute;left:50%;bottom:88%;width:88px;height:195px;overflow:visible;transform:translateX(-50%)}.grid-pylon path{fill:none;stroke:#40566d;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;filter:drop-shadow(0 4px 4px rgba(20,42,58,.18))}
.component-dialog{width:min(660px,calc(100vw - 2rem));height:auto;min-height:620px;max-height:calc(100vh - 2rem)}
.detail-primary{display:grid;gap:.1rem;margin:.15rem 0 .75rem}.detail-primary strong{font-size:2rem;letter-spacing:-.04em}.detail-primary span{color:var(--muted);font-size:.74rem}
@media (max-width:780px){.grid-pylon{height:145px}.component-dialog{width:100%;height:min(86vh,820px);min-height:0;margin:auto 0 0}}
@media (max-width:480px){.grid-pylon{height:110px}}

/* Phase 8C.1 final visual polish: layered, code-native illustration */
.house-scene {
  min-height: 720px;
  background:
    radial-gradient(circle at 78% 13%, rgba(255,255,255,.5), transparent 22%),
    linear-gradient(180deg,var(--sky-top),var(--sky-bottom) 57%,#c9dcba 57%,#9bb584 100%);
  box-shadow: inset 0 -44px 95px rgba(15,49,41,.18);
}
.house-scene::before {
  content:""; position:absolute; inset:0; z-index:-2; pointer-events:none; opacity:0;
  background:linear-gradient(180deg,rgba(2,11,27,.08),rgba(3,17,22,.48));
  transition:opacity .6s ease;
}
.house-scene::after {
  content:""; position:absolute; inset:auto -4% -8% -4%; height:27%; z-index:0;
  background:
    linear-gradient(102deg,transparent 0 29%,rgba(255,255,255,.56) 29.2% 29.4%,transparent 29.7% 63%,rgba(255,255,255,.45) 63.2% 63.4%,transparent 63.7%),
    repeating-linear-gradient(90deg,transparent 0 42px,rgba(70,83,78,.16) 43px 45px),
    repeating-linear-gradient(0deg,rgba(255,255,255,.18) 0 2px,transparent 2px 30px),
    linear-gradient(180deg,#d7d4ca,#9ea59f);
  border-top:1px solid rgba(255,255,255,.7); transform:perspective(610px) rotateX(60deg); transform-origin:bottom;
  box-shadow:inset 0 18px 30px rgba(255,255,255,.22);
}
.house-scene[data-scene="night"]::before,.house-scene[data-scene="twilight"]::before{opacity:1}
.environment-sky{background:radial-gradient(circle at 82% 16%,rgba(255,255,255,.4),transparent 21%),linear-gradient(180deg,rgba(255,255,255,.08),transparent 48%)}
.sun-disc{background:radial-gradient(circle,#fff 0 28%,#ffe97f 31% 57%,rgba(255,211,77,.45) 60%,transparent 74%);box-shadow:0 0 70px 30px rgba(255,223,103,.48)}
.moon-disc{overflow:hidden;background:radial-gradient(circle at 38% 31%,#fff 0 11%,#e3e8df 12% 41%,#aebbc0 68%,#778991 100%);box-shadow:0 0 45px 14px rgba(202,224,242,.26);clip-path:none}
.moon-disc::before{content:"";position:absolute;inset:13% 18% 20% 12%;border-radius:50%;background:radial-gradient(circle at 32% 30%,rgba(91,105,111,.24) 0 8%,transparent 9%),radial-gradient(circle at 67% 58%,rgba(91,105,111,.2) 0 12%,transparent 13%),radial-gradient(circle at 42% 78%,rgba(91,105,111,.17) 0 7%,transparent 8%)}
.moon-disc::after{content:"";position:absolute;inset:-3%;border-radius:50%;background:#071625;transform:translateX(calc((100% - var(--moon-illumination,50%)) * .48));opacity:.72;filter:blur(1px)}
.star-field{background-image:radial-gradient(circle,#fff 0 1px,transparent 1.6px),radial-gradient(circle,#c8e7ff 0 1px,transparent 1.7px),radial-gradient(circle,#fff 0 1.3px,transparent 1.9px);background-position:3px 8px,27px 33px,54px 16px;background-size:61px 48px,73px 63px,91px 72px}
.cloud{height:42px;border-radius:50px;background:linear-gradient(180deg,rgba(255,255,255,.92),rgba(205,224,230,.74));box-shadow:-34px 10px 0 -7px rgba(235,246,248,.84),34px 12px 0 -5px rgba(224,239,243,.82),0 14px 22px rgba(24,61,73,.16)}
.house-scene[data-weather="overcast"] .cloud,.house-scene[data-weather="fog"] .cloud{background:linear-gradient(180deg,#d8e0e2,#8fa1a7);filter:drop-shadow(0 14px 16px rgba(21,48,58,.2))}
.house-scene[data-weather="rain"] .cloud,.house-scene[data-weather="heavy_rain"] .cloud{background:linear-gradient(180deg,#9babb2,#4a5f69);filter:drop-shadow(0 16px 17px rgba(9,29,38,.35))}
.house-scene[data-weather="rain"]::after,.house-scene[data-weather="heavy_rain"]::after{background:linear-gradient(102deg,transparent 0 26%,rgba(179,224,238,.32) 27%,transparent 29%,rgba(122,190,211,.18) 58%,transparent 65%),repeating-linear-gradient(90deg,transparent 0 42px,rgba(28,62,70,.28) 43px 45px),repeating-linear-gradient(0deg,rgba(175,217,228,.18) 0 2px,transparent 2px 30px),linear-gradient(180deg,#6f858a,#455b5e);box-shadow:inset 0 25px 45px rgba(179,229,244,.2)}
.house-scene[data-weather="rain"] .weather-layer,.house-scene[data-weather="heavy_rain"] .weather-layer,.house-scene[data-weather="drizzle"] .weather-layer{opacity:.72;background-image:repeating-linear-gradient(104deg,transparent 0 15px,rgba(220,242,250,.65) 16px 17px,transparent 18px 31px),repeating-linear-gradient(105deg,transparent 0 27px,rgba(174,217,232,.38) 28px 30px,transparent 31px 54px);background-size:100% 120%,80% 90%;animation:rain-shift .7s linear infinite}
.landscape{height:61%;filter:drop-shadow(0 -5px 18px rgba(22,60,43,.15));transition:filter .5s ease}
.distant-ridge{position:absolute;inset:6% -4% 18%;background:linear-gradient(180deg,color-mix(in srgb,var(--land-back),#bdd3c5 36%),var(--land-back));clip-path:polygon(0 43%,8% 28%,17% 41%,28% 19%,39% 40%,49% 14%,59% 40%,71% 24%,82% 42%,92% 22%,100% 37%,100% 100%,0 100%);opacity:.72}
.landscape .horizon{inset:23% -2% 0;background:radial-gradient(ellipse at 12% 62%,#2f6b41 0 8%,transparent 8.5%),radial-gradient(ellipse at 32% 58%,#3b7648 0 11%,transparent 11.5%),radial-gradient(ellipse at 70% 61%,#2d6b42 0 12%,transparent 12.5%),radial-gradient(ellipse at 90% 57%,#467d49 0 10%,transparent 10.5%),linear-gradient(180deg,var(--land-back),var(--land-front));clip-path:polygon(0 27%,7% 17%,15% 28%,24% 12%,35% 31%,47% 9%,58% 30%,69% 15%,80% 29%,91% 17%,100% 28%,100% 100%,0 100%)}
.tree{bottom:10%;width:150px;height:285px;background:radial-gradient(ellipse at 49% 13%,#9cc16d 0 13%,transparent 13.5%),radial-gradient(ellipse at 30% 27%,#75a657 0 20%,transparent 20.5%),radial-gradient(ellipse at 71% 30%,#5d944e 0 21%,transparent 21.5%),radial-gradient(ellipse at 46% 48%,#397b46 0 27%,transparent 27.5%),radial-gradient(ellipse at 73% 56%,#2f6c40 0 23%,transparent 23.5%),linear-gradient(90deg,transparent 46%,#70533a 47% 54%,transparent 55%);filter:drop-shadow(0 12px 11px rgba(13,43,31,.3))}
.tree-one{left:-1%;transform:scale(.92)}.tree-two{left:18%;transform:scale(.62)}.tree-three{right:3%;transform:scale(.95)}
.garden-bed{bottom:2%;height:84px;background:radial-gradient(ellipse at 12% 65%,#90bd59 0 9%,transparent 10%),radial-gradient(ellipse at 28% 42%,#4b984e 0 13%,transparent 14%),radial-gradient(ellipse at 47% 62%,#2f7a43 0 16%,transparent 17%),radial-gradient(ellipse at 69% 39%,#6aa64b 0 14%,transparent 15%),radial-gradient(ellipse at 87% 64%,#3b8444 0 12%,transparent 13%),linear-gradient(180deg,transparent,#173b29)}
.shrub-line{position:absolute;bottom:5%;width:25%;height:92px;background:radial-gradient(ellipse at 12% 62%,#5d9a45 0 16%,transparent 17%),radial-gradient(ellipse at 32% 47%,#397d42 0 21%,transparent 22%),radial-gradient(ellipse at 57% 64%,#2e7040 0 24%,transparent 25%),radial-gradient(ellipse at 82% 45%,#4b8f45 0 20%,transparent 21%);filter:drop-shadow(0 8px 8px rgba(13,44,29,.25))}.shrub-left{left:19%}.shrub-right{right:19%}.garden-path{position:absolute;left:25%;right:19%;bottom:-2%;height:20%;background:linear-gradient(105deg,transparent 0 35%,rgba(206,199,181,.75) 36% 61%,transparent 62%);clip-path:polygon(40% 0,59% 0,72% 100%,25% 100%)}
.house-scene[data-scene="night"] .landscape,.house-scene[data-scene="twilight"] .landscape{filter:brightness(.43) saturate(.72) drop-shadow(0 -4px 18px rgba(3,16,24,.4))}

.house-illustration{left:25.5%;bottom:2.8%;width:56%;filter:drop-shadow(0 24px 22px rgba(6,25,31,.38))}
.house-illustration svg{overflow:visible}.house-ground-shadow{fill:rgba(4,25,29,.3)}
.house-wall{fill:url(#wall-face);stroke:#707a78;stroke-width:3}.house-side{fill:url(#side-face);stroke:#677573;stroke-width:3}.house-roof-back{fill:#202a2d}.house-roof{fill:url(#roof-face);stroke:#273236;stroke-width:5}.roof-side{fill:#202b2f;stroke:#172125;stroke-width:3}.roof-edge{stroke:#152225;stroke-width:10;filter:drop-shadow(0 5px 4px rgba(8,25,29,.35))}
.roof-texture{fill:url(#roof-tiles);stroke:none;opacity:.82;pointer-events:none}
.room-shell .room{fill:url(#room-light);stroke:#a6aca8;stroke-width:2}.basement-wall{fill:url(#basement-light);stroke:#71807e;stroke-width:2}.floor-slab{fill:#aeb8b5;filter:drop-shadow(0 3px 3px rgba(33,51,49,.24))}.room-divider{fill:none;stroke:#b6bbb6;stroke-width:7}.window-glass{fill:url(#room-light);stroke:#687b7e}.side-window{fill:#9ec9d7}
.bed-frame{fill:#796b5f}.bed-head{fill:#77716b}.mattress{fill:#eef0ed}.duvet{fill:#aeb9b6}.pillow{fill:#fff}.nightstand,.desk,.shelf,.sideboard{fill:#8d7658}.lamp-line,.pendant-line{fill:none;stroke:#2e3b3e;stroke-width:2}.lamp-shade,.pendant{fill:#344245}.picture-frame{fill:#a7c8c6;stroke:#736d62;stroke-width:4}.monitor{fill:#273b44;stroke:#111d22;stroke-width:3}.monitor-stand{fill:#2f3d42}.office-chair{fill:#384449;stroke:#202c30;stroke-width:3}.sofa-back{fill:#9da9a6}.sofa-seat{fill:#b8c1be}.sofa-cushion{fill:#cbd1ce;stroke:#8d9995;stroke-width:2}.sofa-leg,.table-leg{fill:none;stroke:#574d42;stroke-width:5}.coffee-table,.dining-table{fill:#8f7557}.rug{fill:#a7b8b2;opacity:.6}.chairs path{fill:#8b7357;stroke:#5e5142;stroke-width:2}.plant-pot{fill:#a47754!important}.plants{fill:#447b4d}.basement-services path{fill:none;stroke:#8da6a4;stroke-width:4;stroke-linecap:round}
.basement-devices rect{fill:#f5f7f6;stroke:#566865;stroke-width:2}.basement-devices .device-side{fill:#aab7b4;stroke:#657673}.basement-devices .device-cap{fill:#d7dfdc}.basement-devices .brand-mark{fill:#d7332f}.basement-devices .device-led{fill:#2bd175}.basement-devices .device-led.muted{fill:#7c8b88}.basement-devices .device-vent,.basement-devices .battery-seam{fill:none;stroke:#91a09c;stroke-width:2}.byd-device rect{fill:#f5f6ef}
.roof-panels path{fill:url(#pv-glass);stroke:#c8edf4;stroke-width:2}.roof-panels .pv-grid-overlay{fill:url(#pv-grid);stroke:#c7e8ee;stroke-width:1.5;opacity:.78}.roof-panels .pv-highlight{fill:none;stroke:rgba(255,255,255,.68);stroke-width:5;stroke-linecap:round;opacity:.58}
.house-scene[data-weather="overcast"] .roof-panels .pv-highlight{opacity:.18}.house-scene[data-scene="night"] .roof-panels .pv-highlight,.house-scene[data-scene="twilight"] .roof-panels .pv-highlight{opacity:.08}
.house-scene[data-scene="night"] .house-wall,.house-scene[data-scene="twilight"] .house-wall{fill:#6f7775}.house-scene[data-scene="night"] .house-side,.house-scene[data-scene="twilight"] .house-side{fill:#3d4c4e}.house-scene[data-scene="night"] .room-shell .room,.house-scene[data-scene="twilight"] .room-shell .room{fill:linear-gradient(#79603d,#4a4338)}
.house-scene[data-scene="night"] .room-shell .room,.house-scene[data-scene="twilight"] .room-shell .room{fill:#7b6547;filter:drop-shadow(0 0 16px rgba(255,190,90,.45))}.house-scene[data-scene="night"] .basement-wall{fill:#31454a}.house-scene[data-scene="night"] .house-illustration{filter:drop-shadow(0 25px 24px rgba(0,8,14,.6)) brightness(.8)}

.carport-illustration{left:1.2%;bottom:5.8%;width:31%;height:300px;z-index:2;filter:drop-shadow(0 18px 16px rgba(9,29,30,.36))}
.carport-roof{height:40px;border-top:10px solid #2d3739;background:linear-gradient(180deg,#907a5e 0 22%,#5e4f3e 23% 100%);transform:skewX(-7deg);box-shadow:0 14px 20px rgba(15,32,33,.34)}.carport-roof::after{content:"";position:absolute;left:0;right:0;bottom:-6px;height:8px;background:linear-gradient(90deg,#4c4236,#9a876d,#4c4236)}.carport-roof i{inset:3px 7px 12px;background:repeating-linear-gradient(90deg,#173f59 0 36px,#8bbdca 37px 39px);box-shadow:inset 0 0 12px rgba(136,220,233,.28)}
.carport-back{position:absolute;left:16%;right:3%;top:38px;bottom:17px;background:linear-gradient(90deg,rgba(77,61,47,.94),rgba(129,108,81,.8)),repeating-linear-gradient(0deg,transparent 0 13px,rgba(31,30,27,.25) 14px 16px);clip-path:polygon(0 0,100% 0,100% 100%,8% 100%);box-shadow:inset 0 0 30px rgba(10,24,25,.35)}
.carport-side{top:37px;bottom:13px;width:25%;background:repeating-linear-gradient(180deg,#6a513b 0 8px,#332b24 9px 14px);border-left:9px solid #7b674e}.carport-post{top:31px;bottom:8px;width:12px;background:linear-gradient(90deg,#574a3b,#a08b6e 52%,#55483a)}.parking-pad{height:42px;left:2%;right:-3%;bottom:-6px;background:repeating-linear-gradient(90deg,#aeb4af 0 48px,#8e9690 49px 51px),linear-gradient(#bbc0ba,#777f79);box-shadow:inset 0 10px 15px rgba(255,255,255,.22)}
.wattpilot-device{right:7.5%;top:112px;width:35px;height:62px;border-radius:9px;background:linear-gradient(145deg,#1f5360,#0d2f38);border:3px solid #dff8f5;box-shadow:0 0 18px rgba(41,222,200,.48),5px 7px 10px rgba(7,24,27,.4)}.wattpilot-device::after{content:"";position:absolute;left:9px;right:9px;bottom:9px;height:3px;border-radius:3px;background:#86e8dc}.charger-cable{position:absolute;right:5%;top:168px;width:50px;height:76px;border:5px solid #203b42;border-left-color:transparent;border-top-color:transparent;border-radius:0 0 34px 0;transform:rotate(6deg)}.carport-light{position:absolute;top:47px;left:54%;width:38px;height:8px;border-radius:0 0 10px 10px;background:#ffe5a2;box-shadow:0 7px 22px 8px rgba(255,210,111,.18)}
.house-scene[data-scene="night"] .carport-light,.house-scene[data-scene="twilight"] .carport-light{box-shadow:0 15px 38px 18px rgba(255,202,94,.4)}.house-scene[data-scene="night"] .carport-back{filter:brightness(.62)}
.vehicle-component{left:2.4%;bottom:5.8%;width:29%;z-index:5}.vehicle-component img{width:100%}.vehicle-component .component-card{left:4%;bottom:91%;min-width:185px}

.component-card{border:1px solid rgba(81,154,162,.52);box-shadow:0 12px 34px rgba(7,39,49,.24),inset 0 1px 0 rgba(255,255,255,.82)}.component-card::after{content:"";position:absolute;inset:1px;border-radius:13px;pointer-events:none;background:linear-gradient(135deg,rgba(255,255,255,.18),transparent 42%)}
.pv-component{left:48%;top:2.5%}.home-component{left:52%;top:35%}.gen24-component{left:35%;bottom:1.6%}.symo-component{left:46%;bottom:1.6%}.battery-component{left:58%;bottom:.8%}.grid-component{bottom:17%}
.floor-label{left:28%;background:rgba(255,255,255,.7);box-shadow:0 3px 10px rgba(14,44,49,.12)}.floor-dg{top:39%}.floor-eg{top:55.5%}.floor-ug{top:70%}

.house-energy-lines g path{opacity:calc(.38 + var(--flow-intensity,0) * .34);filter:drop-shadow(0 0 3px rgba(50,218,205,.24))}.house-energy-lines g.is-active path{stroke-width:calc(5px + var(--flow-intensity,0) * 2.4px);opacity:calc(.72 + var(--flow-intensity,0) * .28);filter:drop-shadow(0 0 5px rgba(53,235,217,.68))}.house-energy-lines .flow-particle{display:block;opacity:calc(.58 + var(--flow-intensity,.5) * .42);filter:drop-shadow(0 0 3px currentColor)}

.component-dialog{background:color-mix(in srgb,var(--surface-solid),transparent 3%);border:1px solid color-mix(in srgb,var(--line),#fff 45%);backdrop-filter:blur(24px) saturate(1.15)}
.component-dialog[data-detail="pv"]{width:min(545px,calc(100vw - 2rem));min-height:0}.component-dialog[data-detail="wattpilot"]{width:min(620px,calc(100vw - 2rem));min-height:0}.component-dialog[data-detail="pv"] .component-dialog-content{display:grid;grid-template-columns:1fr;gap:.65rem}.component-dialog[data-detail="pv"] .detail-primary{margin:0;padding:.25rem 0}.component-dialog[data-detail="pv"] .detail-chart{height:185px;margin:.2rem 0 .45rem}.component-dialog[data-detail="pv"] .detail-metrics{display:grid;grid-template-columns:1fr 1fr;border:1px solid var(--line);border-radius:15px;overflow:hidden}.component-dialog[data-detail="pv"] .detail-metrics>div{padding:.62rem .7rem}.component-dialog[data-detail="pv"] .detail-metrics>div:nth-child(odd){border-right:1px solid var(--line)}
.component-dialog[data-detail="wattpilot"] .detail-hero{grid-template-columns:minmax(210px,44%) 1fr;min-height:205px;margin:.15rem 0 .8rem;padding:.8rem 1rem;background:radial-gradient(circle at 20% 20%,rgba(255,255,255,.8),transparent 38%),linear-gradient(135deg,var(--accent-soft),transparent);overflow:hidden}.component-dialog[data-detail="wattpilot"] .detail-hero img{width:100%;max-width:260px}.component-dialog[data-detail="wattpilot"] .detail-hero strong{font-size:1.5rem}.component-dialog[data-detail="wattpilot"] .detail-metrics{display:grid;grid-template-columns:1fr 1fr;border:1px solid var(--line);border-radius:16px;overflow:hidden}.component-dialog[data-detail="wattpilot"] .detail-metrics>div{padding:.58rem .72rem}.component-dialog[data-detail="wattpilot"] .detail-metrics>div:nth-child(odd){border-right:1px solid var(--line)}.component-dialog[data-detail="wattpilot"] .assignment-controls{margin-top:.75rem}.component-dialog[data-detail="wattpilot"] .detail-note{margin:.7rem 0 0;font-size:.69rem}

@media (max-width:1180px){.house-illustration{left:21%;width:62%;bottom:7%}.carport-illustration{width:31%;bottom:10%}.vehicle-component{width:29%;bottom:10%}.gen24-component{left:29%;bottom:4%}.symo-component{left:43%;bottom:4%}.battery-component{left:58%;bottom:3%}}
@media (max-width:780px){.house-scene{min-height:950px}.house-illustration{left:2%;top:18%;width:96%}.carport-illustration{left:2%;bottom:11%;width:48%;height:225px}.vehicle-component{left:2%;bottom:11%;width:47%}.component-dialog[data-detail="pv"],.component-dialog[data-detail="wattpilot"]{width:100%}.component-dialog[data-detail="wattpilot"] .detail-hero{grid-template-columns:130px 1fr;min-height:145px}.component-dialog[data-detail="wattpilot"] .detail-metrics{grid-template-columns:1fr}}
@media (max-width:480px){.house-scene{min-height:880px}.house-illustration{top:21%;left:0;width:100%}.carport-illustration{bottom:10%;width:52%;height:190px}.vehicle-component{bottom:10%;width:50%}.component-dialog{max-width:100vw;overflow-x:hidden}.component-dialog-content,.component-dialog[data-detail="wattpilot"] .detail-hero>div,.component-dialog[data-detail="wattpilot"] .detail-metrics>div{min-width:0}.detail-tabs{gap:.15rem}.detail-tabs button{min-width:0;padding:.4rem .42rem;font-size:.78rem}.component-dialog[data-detail="pv"] .detail-metrics{grid-template-columns:1fr}.component-dialog[data-detail="pv"] .detail-metrics>div:nth-child(odd),.component-dialog[data-detail="wattpilot"] .detail-metrics>div:nth-child(odd){border-right:0}.component-dialog[data-detail="wattpilot"] .detail-hero{grid-template-columns:96px minmax(0,1fr);min-height:122px;padding:.65rem}.component-dialog[data-detail="wattpilot"] .detail-hero strong{font-size:1.02rem;overflow-wrap:anywhere}.component-dialog[data-detail="wattpilot"] .detail-metrics dd{max-width:58%;text-align:right;overflow-wrap:anywhere}}
@media (prefers-reduced-motion:reduce){.house-energy-lines .flow-particle{display:none!important}.house-energy-lines g.is-active path{opacity:calc(.48 + var(--flow-intensity,0) * .52)}.weather-layer{animation:none!important}}

/* Phase 8C.1 flow correction: explicit PV -> inverter -> merge -> shared bus. */
.house-energy-lines .topology-rails path{
  fill:none;stroke:rgba(196,225,222,.42);stroke-width:5;stroke-linecap:round;
  stroke-linejoin:round;vector-effect:non-scaling-stroke;filter:drop-shadow(0 1px 2px rgba(7,38,44,.18));
}
.house-energy-lines .topology-rails .house-bus-rail{stroke:rgba(31,119,116,.38);stroke-width:7}
.house-energy-lines .topology-junctions circle{fill:#0c8580;stroke:#eafffc;stroke-width:5;filter:url(#flow-glow)}
.house-energy-lines .topology-junctions .main-junction{fill:#075f61;stroke-width:6}
.house-energy-lines g[data-house-flow="pv-roof"],
.house-energy-lines g[data-house-flow="pv-distribution"],
.house-energy-lines g[data-house-flow="pv-gen24"],
.house-energy-lines g[data-house-flow="pv-symo"],
.house-energy-lines g[data-house-flow="pv-bus"],
.house-energy-lines g[data-house-flow="gen24"],
.house-energy-lines g[data-house-flow="symo"]{--flow-color:#12c77e}
.house-energy-lines g[data-house-flow="home"]{--flow-color:#ff9d0a}
.house-energy-lines g[data-house-flow="battery"]{--flow-color:#08aa9e}
.house-energy-lines g[data-house-flow="grid"]{--flow-color:#7351dc}
.house-energy-lines g[data-house-flow="wattpilot"]{--flow-color:#087ce8}
.house-energy-lines g path{marker-start:none;marker-end:none}
.house-energy-lines g[data-direction="idle"] path,
.house-energy-lines g[data-direction="unknown"] path{marker-start:none;marker-end:none;opacity:.22}
.house-energy-lines g.is-active path{
  stroke-width:calc(3.5px + var(--flow-intensity,0) * 1.5px);
  opacity:calc(.52 + var(--flow-intensity,0) * .2);
  filter:drop-shadow(0 0 2px rgba(53,235,217,.42));
}
.house-energy-lines .flow-particle{r:6px;stroke-width:2.5}

/* The consumption target is deliberately inside the living area, not on the roof. */
.home-component{left:52%;top:49%;--card-accent:#f59e0b}
.home-component .component-card{min-width:158px}

/* An empty/idle carport stays truthful: Wattpilot status remains, no vehicle is asserted. */
.house-scene:not(.has-vehicle) .vehicle-component{height:205px;bottom:7.5%}
.house-scene:not(.has-vehicle) .vehicle-component .component-card{top:0;bottom:auto;left:3%}
.house-scene:not(.has-vehicle) .parking-pad{filter:saturate(.82)}

/* More material depth while retaining independent illustration, UI, flow and environment layers. */
.house-illustration .room-shell .room{stroke:#9aa29e;stroke-width:2.4;filter:drop-shadow(0 3px 3px rgba(61,70,66,.16))}
.house-illustration .room-shell .upper-left,.house-illustration .room-shell .upper-right{fill:url(#room-upper)}
.house-illustration .room-shell .lower-left,.house-illustration .room-shell .lower-right{fill:url(#room-living)}
.house-illustration .room-surfaces path{fill:url(#wood-floor);stroke:#8b7b67;stroke-width:1;opacity:.92}
.house-illustration .floor-slab{stroke:#77827e;stroke-width:1.2}
.house-illustration .room-divider{stroke:#c8c4b9;stroke-width:9}
.house-illustration .basement-wall{fill:url(#basement-light);stroke:#5f716f;stroke-width:3}
.carport-illustration{filter:drop-shadow(0 21px 18px rgba(9,29,30,.4));transform:perspective(1200px) rotateY(1.5deg);transform-origin:right bottom}
.carport-back{background:linear-gradient(95deg,rgba(58,47,38,.97),rgba(139,116,84,.86)),repeating-linear-gradient(0deg,transparent 0 12px,rgba(26,25,23,.28) 13px 16px)}
.carport-roof{border-top-color:#202b2e;box-shadow:0 12px 20px rgba(15,32,33,.36),inset 0 2px rgba(255,255,255,.16)}
.landscape .tree{width:225px;height:410px;bottom:7%;background:radial-gradient(ellipse at 48% 11%,#b5cf7c 0 10%,transparent 11%),radial-gradient(ellipse at 27% 27%,#7eaf5c 0 19%,transparent 20%),radial-gradient(ellipse at 70% 28%,#5f9850 0 21%,transparent 22%),radial-gradient(ellipse at 46% 48%,#397b46 0 27%,transparent 28%),radial-gradient(ellipse at 71% 58%,#2d683e 0 22%,transparent 23%),radial-gradient(ellipse at 28% 63%,#3b7742 0 18%,transparent 19%),linear-gradient(90deg,transparent 46%,#6e5036 47% 54%,transparent 55%)}
.landscape .tree-one{left:-3%;transform:scale(.96)}.landscape .tree-two{left:17%;transform:scale(.68)}.landscape .tree-three{right:0;transform:scale(.94)}
.garden-bed{filter:drop-shadow(0 8px 7px rgba(15,50,31,.32)) saturate(1.12)}
.house-scene[data-scene="night"] .house-energy-lines .topology-rails path,
.house-scene[data-scene="twilight"] .house-energy-lines .topology-rails path{stroke:rgba(147,222,215,.46)}
.house-scene[data-scene="night"] .house-illustration .room-shell .room,
.house-scene[data-scene="twilight"] .house-illustration .room-shell .room{fill:#806849;filter:drop-shadow(0 0 15px rgba(255,192,94,.42))}
.house-scene[data-scene="night"] .house-illustration .room-surfaces path,
.house-scene[data-scene="twilight"] .house-illustration .room-surfaces path{filter:brightness(.72) saturate(.86)}

@media (max-width:1180px){
  .home-component{left:54%;top:48%}
}
@media (max-width:780px){
  .house-scene{min-height:730px}
  .house-energy-lines{top:10%;height:70%}
  .home-component{left:49%;top:43%}
  .house-scene:not(.has-vehicle) .vehicle-component{height:170px;bottom:10%}
  .wattpilot-device{right:35%}
}
@media (max-width:480px){
  .house-scene{min-height:720px}
  .house-energy-lines{top:12%;height:70%}
  .house-energy-lines .topology-rails path{stroke-width:4}
  .house-energy-lines .topology-rails .house-bus-rail{stroke-width:6}
  .house-energy-lines .topology-junctions circle{stroke-width:4}
  .scene-caption{left:auto;right:.55rem;top:.55rem;width:150px;padding:.5rem .58rem;gap:.08rem .36rem}
  .scene-caption>span:last-child{max-width:96px;font-size:.57rem}
  .scene-caption strong{font-size:.68rem}
  .scene-caption .scene-time{padding-right:.36rem;font-size:.78rem}
  .component-card{min-width:88px;max-width:96px;padding:.35rem .4rem .4rem;border-radius:11px}
  .component-card strong{font-size:.7rem}
  .component-kicker{font-size:.46rem}
  .component-card>span:last-child:not(.component-kicker){font-size:.54rem}
  .component-card-icon{right:.35rem;top:.28rem;font-size:.8rem}
  .pv-component{left:2%;top:1.5%}
  .pv-component .component-card{min-width:108px;max-width:112px}
  .home-component{left:47%;top:43%}
  .home-component .component-card{min-width:112px;max-width:118px}
  .gen24-component{left:2%;top:55%}
  .symo-component{left:34%;top:55%}
  .battery-component{left:66%;top:55%}
  .grid-component{right:2%;bottom:5%}
  .vehicle-component{z-index:7}
  .vehicle-component .component-card{left:0;top:42%;bottom:auto;min-width:118px;max-width:132px}
  .house-scene:not(.has-vehicle) .vehicle-component{height:145px;bottom:10%}
}

/* Independent local landscape illustration: no data or UI is baked into the asset. */
.landscape{
  inset:0;
  height:100%;
  background:transparent;
  clip-path:none;
  overflow:hidden;
  transition:filter 700ms ease,opacity 700ms ease;
}
.landscape::after{display:none}
.landscape-asset{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  object-fit:cover;
  object-position:center bottom;
  pointer-events:none;
}
.landscape .tree,.landscape .distant-ridge,.landscape .horizon{display:none}
.house-scene[data-scene="golden"] .landscape{filter:sepia(.08) saturate(.94) brightness(.93)}
.house-scene[data-scene="evening"] .landscape{filter:saturate(.8) brightness(.72) hue-rotate(6deg)}
.house-scene[data-scene="twilight"] .landscape{filter:saturate(.66) brightness(.48) hue-rotate(14deg)}
.house-scene[data-scene="night"] .landscape{filter:saturate(.52) brightness(.3) hue-rotate(18deg)}
.house-scene[data-weather="overcast"] .landscape,
.house-scene[data-weather="fog"] .landscape{filter:saturate(.64) brightness(.83)}
.house-scene[data-weather="rain"] .landscape,
.house-scene[data-weather="heavy_rain"] .landscape,
.house-scene[data-weather="drizzle"] .landscape{filter:saturate(.58) brightness(.66) contrast(.94)}

/* Phase 8C.2: locked visual assets on one 1670 x 942 scene coordinate system. */
.house-scene {
  position: relative;
  min-height: 0 !important;
  aspect-ratio: 1670 / 942;
  overflow: hidden;
  isolation: isolate;
  background: #dce8e7;
}
.base-scene-asset {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: left center;
  pointer-events: none;
  transition: filter .55s ease;
}
.landscape,.carport-illustration,.house-illustration,.floor-label { display: none !important; }
.house-scene::before,.house-scene::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  width: auto;
  height: auto;
  pointer-events: none;
  transform: none;
  opacity: 0;
  transition: opacity .5s ease;
}
.house-scene::before { background: transparent; }
.house-scene::after { z-index: 3; background: transparent; box-shadow: none; }
.environment-sky {
  z-index: 2;
  background: none;
  pointer-events: none;
}
.house-scene[data-scene="golden"] .base-scene-asset { filter: saturate(.94) sepia(.12) brightness(.92); }
.house-scene[data-scene="evening"] .base-scene-asset { filter: saturate(.82) sepia(.18) brightness(.7) hue-rotate(4deg); }
.house-scene[data-scene="twilight"] .base-scene-asset { filter: saturate(.7) brightness(.48) hue-rotate(10deg); }
.house-scene[data-scene="night"] .base-scene-asset { filter: saturate(.58) brightness(.3) hue-rotate(13deg); }
.house-scene[data-scene="evening"]::before,
.house-scene[data-scene="twilight"]::before,
.house-scene[data-scene="night"]::before {
  opacity: 1;
  background:
    radial-gradient(ellipse at 62% 59%, rgba(255,190,92,.24), transparent 16%),
    radial-gradient(ellipse at 27% 63%, rgba(255,198,104,.2), transparent 12%),
    linear-gradient(180deg, rgba(13,35,62,.12), rgba(3,20,35,.36));
}
.house-scene[data-weather="cloudy"] .base-scene-asset,
.house-scene[data-weather="partly_cloudy"] .base-scene-asset { filter: saturate(.88) brightness(.92); }
.house-scene[data-weather="overcast"] .base-scene-asset { filter: saturate(.66) brightness(.78) contrast(.9); }
.house-scene[data-weather="fog"] .base-scene-asset { filter: saturate(.52) brightness(.9) contrast(.72); }
.house-scene[data-weather="fog"]::after {
  opacity: .62;
  background: linear-gradient(180deg, rgba(230,239,239,.7), rgba(220,233,232,.35) 52%, rgba(223,235,232,.56));
}
.house-scene[data-weather="rain"] .base-scene-asset,
.house-scene[data-weather="heavy_rain"] .base-scene-asset,
.house-scene[data-weather="drizzle"] .base-scene-asset { filter: saturate(.55) brightness(.62) contrast(.92); }
.house-scene[data-weather="rain"]::after,
.house-scene[data-weather="heavy_rain"]::after,
.house-scene[data-weather="drizzle"]::after {
  opacity: .58;
  background: linear-gradient(180deg, rgba(27,53,72,.24), rgba(20,49,59,.42));
}
.house-scene[data-weather="snow"] .base-scene-asset { filter: saturate(.56) brightness(.93) contrast(.9); }
.house-scene[data-weather="snow"]::after {
  opacity: .88;
  background: linear-gradient(180deg, transparent 0 57%, rgba(239,245,244,.62) 72%, rgba(246,249,248,.88));
}
.house-energy-lines {
  inset: 0;
  top: 0 !important;
  z-index: 5;
  width: 100%;
  height: 100% !important;
  opacity: 1;
}
.house-energy-lines g path { opacity: .2; stroke-width: 4; }
.house-energy-lines .topology-rails path { opacity: .2; stroke-width: 4; }
.house-energy-lines .topology-rails .house-bus-rail { stroke-width: 5; }
.house-energy-lines g.is-active path { opacity: calc(.3 + var(--flow-intensity,0) * .18); stroke-width: calc(4px + var(--flow-intensity,0) * 1.5px); }
.house-energy-lines .flow-particle { opacity: calc(.72 + var(--flow-intensity,.5) * .28); }
.scene-caption { z-index: 8; }
.scene-component { z-index: 7; }
.pv-component { left: 51%; top: 3%; }
.home-component { left: 61%; top: 51%; }
.gen24-component,
.symo-component,
.battery-component {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  top: 88.2%;
  bottom: auto;
  transform: translateX(-50%);
}
.gen24-component { left: 40.1%; }
.symo-component { left: 47%; }
.battery-component { left: 55%; }
.grid-component { right: 3%; top: 45%; bottom: auto; }
.vehicle-component,
.house-scene:not(.has-vehicle) .vehicle-component {
  left: 2.5%;
  top: 50%;
  bottom: auto;
  width: 28%;
  height: 28%;
}
.vehicle-component .component-card,
.house-scene:not(.has-vehicle) .vehicle-component .component-card {
  position: absolute;
  left: 0;
  top: 0;
  bottom: auto;
  width: auto;
  min-width: 185px;
  margin: 0;
}
.vehicle-component:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; border-radius: 14px; }
.detail-vehicle-visual,.vehicle-list-visual {
  position: relative;
  display: block;
  min-width: 0;
}
.detail-vehicle-visual img,.vehicle-list-visual img { display: block; width: 100%; height: auto; }
.house-vehicle-plate rect {
  fill: #f7f6ed;
  stroke: rgba(18, 27, 31, .9);
  stroke-width: 1.4;
}
.house-vehicle-plate text {
  fill: #10191d;
  font-family: "Arial Narrow", "Roboto Condensed", Arial, sans-serif;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .35px;
}
.dynamic-vehicle-plate {
  position: absolute;
  left: var(--plate-x);
  top: var(--plate-y);
  display: grid;
  width: 22%;
  min-width: 24px;
  min-height: 9px;
  place-items: center;
  padding: 1px 2px;
  color: #10191d;
  background: #f7f6ed;
  border: 1px solid rgba(18, 27, 31, .88);
  border-radius: 2px;
  font-family: "Arial Narrow", "Roboto Condensed", Arial, sans-serif;
  font-size: clamp(.25rem, .5vw, .48rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -.02em;
  white-space: nowrap;
  transform: translate(-50%, -50%);
}
.detail-vehicle-visual { width: min(220px,100%); }
.detail-vehicle-visual.is-empty { min-height: 92px; border: 1px dashed var(--line); border-radius: 14px; background: var(--surface-soft); }
.vehicle-list-item { grid-template-columns: 130px 1fr; }
.vehicle-list-visual { width: 130px; }
.vehicle-list-visual.is-empty { display: grid; min-height: 72px; place-items: center; padding: .4rem; color: var(--muted); background: var(--surface-soft); border: 1px dashed var(--line); border-radius: 10px; font-size: .65rem; text-align: center; }
.atmosphere-note { z-index: 8; }

@media (max-width: 820px) {
  .house-scene { min-height: 900px !important; aspect-ratio: auto; }
  .base-scene-asset { object-position: left center; }
  .scene-caption { left: auto; right: .65rem; width: min(230px,62%); }
  .pv-component { left: 3%; top: 2%; }
  .home-component { left: 55%; top: 27%; }
  .gen24-component { left: 3%; top: 38%; }
  .symo-component { left: 35%; top: 38%; }
  .battery-component { left: 68%; top: 38%; }
  .grid-component { right: 3%; top: 50%; }
  .vehicle-component,.house-scene:not(.has-vehicle) .vehicle-component { left: 2%; top: 51%; width: 60%; height: 31%; }
  .vehicle-component .component-card,.house-scene:not(.has-vehicle) .vehicle-component .component-card { min-width: 165px; }
  .house-energy-lines g path,.house-energy-lines .topology-rails path { opacity: .14; }
}

@media (max-width: 480px) {
  .house-scene { min-height: 720px !important; }
  .scene-caption { width: 155px; }
  .home-component { left: 52%; top: 26%; }
  .gen24-component { left: 2%; top: 37%; }
  .symo-component { left: 34%; top: 37%; }
  .battery-component { left: 66%; top: 37%; }
  .grid-component { top: 48%; }
  .vehicle-component,.house-scene:not(.has-vehicle) .vehicle-component { top: 50%; width: 76%; height: 34%; }
  .vehicle-component .component-card,.house-scene:not(.has-vehicle) .vehicle-component .component-card { top: 0; min-width: 150px; }
  .vehicle-list-item { grid-template-columns: 105px 1fr; }
  .vehicle-list-visual { width: 105px; }
}

/* Phase 8C.2 environment gate correction: locked v3 scenes, quiet labels and flow. */
.environment-scene-layer {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.environment-scene-asset {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: left center;
  opacity: 0;
  transition: opacity .42s ease;
  will-change: opacity;
}
.environment-scene-asset.is-active { opacity: 1; }
.house-scene::after { display: none !important; }
.environment-sky {
  z-index: 2;
  background: none;
  pointer-events: none;
}
.scene-caption {
  grid-template-columns: auto auto minmax(0,1fr);
  gap: .08rem .42rem;
  padding: .48rem .62rem;
  border-radius: 12px;
}
.scene-weather-icon {
  grid-row: 1 / 3;
  align-self: center;
  color: var(--accent);
  font-size: 1.05rem;
  line-height: 1;
}
.scene-caption .scene-time {
  grid-column: 2;
  grid-row: 1 / 3;
  padding-right: .42rem;
  font-size: .74rem;
}
.scene-caption strong { grid-column: 3; font-size: .72rem; }
.scene-caption > span:last-child { grid-column: 3; font-size: .61rem; }

.scene-component::before {
  content: "";
  position: absolute;
  inset: -10px;
  min-width: 44px;
  min-height: 44px;
}
.scene-component { min-width: 44px; min-height: 44px; }
.component-card,
.component-card.compact,
.pv-component .component-card,
.home-component .component-card,
.vehicle-component .component-card,
.house-scene:not(.has-vehicle) .vehicle-component .component-card {
  display: inline-flex;
  align-items: baseline;
  width: max-content;
  min-width: 0;
  max-width: min(290px,80vw);
  gap: .24rem;
  padding: .3rem .48rem;
  overflow: hidden;
  color: #16333b;
  background: rgba(250,253,251,.78);
  border: 1px solid rgba(97,147,151,.42);
  border-radius: 9px;
  box-shadow: 0 4px 12px rgba(10,38,43,.13);
  backdrop-filter: blur(7px) saturate(1.05);
  white-space: nowrap;
  pointer-events: none;
}
[data-theme="dark"] .component-card {
  color: #eef8f7;
  background: rgba(10,29,35,.74);
  border-color: rgba(118,192,191,.38);
}
.component-card::before,
.component-card::after { display: none; }
.component-kicker {
  color: inherit;
  font-size: .56rem;
  font-weight: 850;
  letter-spacing: .035em;
  opacity: .76;
}
.component-kicker::after { content: " ·"; }
.component-card strong {
  overflow: hidden;
  font-size: .72rem;
  letter-spacing: -.005em;
  text-overflow: ellipsis;
}
.component-card > span:last-child:not(.component-kicker) {
  overflow: hidden;
  color: inherit;
  font-size: .59rem;
  opacity: .72;
  text-overflow: ellipsis;
}
.component-card > span:last-child:not(.component-kicker):not(:empty)::before { content: "· "; }
.component-card > span:empty { display: none; }
.scene-component:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 5px;
  border-radius: 12px;
}
.scene-component:focus-visible .component-card,
.scene-component:hover .component-card {
  box-shadow: 0 6px 17px rgba(10,64,65,.18);
  transform: translateY(-1px);
}
.house-energy-lines .flow-particle { r: 5px; }

@media (max-width: 480px) {
  .scene-caption { width: min(190px,65%); }
  .battery-component { left: auto; right: 2%; }
  .component-card,
  .pv-component .component-card,
  .home-component .component-card,
  .vehicle-component .component-card,
  .house-scene:not(.has-vehicle) .vehicle-component .component-card {
    min-width: 0;
    max-width: 175px;
    padding: .27rem .4rem;
  }
  .component-kicker { font-size: .5rem; }
  .component-card strong { font-size: .65rem; }
  .component-card > span:last-child:not(.component-kicker) { font-size: .52rem; }
}

@media (prefers-reduced-motion: reduce) {
  .environment-scene-asset { transition: none !important; }
}

/* Phase 8C.2 final polish: device values belong to the scene, not to KPI cards. */
.gen24-component .device-label,
.symo-component .device-label,
.battery-component .device-label {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: .02rem;
  padding: .18rem .3rem;
  background: rgba(247, 252, 249, .34);
  border-color: transparent;
  border-radius: 6px;
  box-shadow: none;
  backdrop-filter: blur(3px);
  text-align: center;
}
[data-theme="dark"] .gen24-component .device-label,
[data-theme="dark"] .symo-component .device-label,
[data-theme="dark"] .battery-component .device-label {
  background: rgba(5, 22, 28, .38);
  border-color: transparent;
}
.device-label .component-kicker::after,
.home-label .component-kicker::after,
.wattpilot-label .component-kicker::after { content: ""; }
.device-label .component-kicker { font-size: .52rem; opacity: .84; }
.device-label strong { font-size: .7rem; line-height: 1.05; }
.device-label > span:last-child:not(.component-kicker) {
  max-width: 125px;
  font-size: .53rem;
  line-height: 1.1;
}
.device-label > span:last-child:not(.component-kicker):not(:empty)::before,
.wattpilot-label > span:last-child:not(.component-kicker):not(:empty)::before { content: ""; }

.home-component { left: 55%; top: 45.5%; }
.home-component .home-label {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: .02rem;
  min-width: 112px;
  padding: .28rem .46rem;
  text-align: center;
}
.home-label .component-kicker { font-size: .54rem; }
.home-label strong { font-size: .76rem; }

.pv-component .aggregate-label { padding: .27rem .44rem; }
.grid-component .grid-label { padding: .25rem .42rem; }
.grid-label > span:last-child:not(.component-kicker) { font-size: .55rem; }

.vehicle-component .wattpilot-label,
.house-scene:not(.has-vehicle) .vehicle-component .wattpilot-label {
  left: 70%;
  top: 22%;
  bottom: auto;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .03rem;
  min-width: 0;
  max-width: 185px;
  padding: .24rem .38rem;
  background: rgba(247, 252, 249, .34);
  border-color: transparent;
  border-radius: 6px;
  box-shadow: none;
  backdrop-filter: blur(3px);
  color: var(--text);
  white-space: normal;
}
[data-theme="dark"] .vehicle-component .wattpilot-label,
[data-theme="dark"] .house-scene:not(.has-vehicle) .vehicle-component .wattpilot-label {
  background: rgba(5, 22, 28, .38);
  border-color: transparent;
}
.vehicle-component:focus-visible .wattpilot-label,
.vehicle-component:hover .wattpilot-label {
  box-shadow: none;
  transform: none;
}
.house-scene.is-charging .vehicle-component .wattpilot-label {
  border-color: transparent;
}
.wattpilot-label .component-kicker { font-size: .52rem; }
.wattpilot-label strong { font-size: .68rem; line-height: 1.15; }
.wattpilot-label > span:last-child:not(.component-kicker) {
  max-width: 175px;
  font-size: .54rem;
  line-height: 1.15;
}

@media (max-width: 780px) {
  .home-component { left: 50%; top: 32%; }
  .vehicle-component .wattpilot-label,
  .house-scene:not(.has-vehicle) .vehicle-component .wattpilot-label {
    left: 62%;
    top: 18%;
    min-width: 0;
  }
}

@media (max-width: 480px) {
  .home-component { left: 48%; top: 31%; }
  .device-label strong { font-size: .63rem; }
  .vehicle-component .wattpilot-label,
  .house-scene:not(.has-vehicle) .vehicle-component .wattpilot-label {
    left: 58%;
    top: 14%;
    max-width: 145px;
  }
}

/* Phase 8C.2 mobile correction: keep the complete locked 1670 x 942 scene visible. */
@media (max-width: 820px) {
  body { overflow-x: hidden; }
  .app-shell { width: 100%; padding-inline: .62rem; }
  .app-header { min-height: 54px; }
  .brand { gap: .48rem; }
  .brand-mark { width: 36px; height: 36px; border-radius: 11px; }
  .brand-mark svg { width: 19px; }
  .brand strong { font-size: .94rem; }
  .app-header nav {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .15rem;
    padding: .25rem 0 .42rem;
  }
  .app-header .nav-link {
    display: grid;
    min-width: 0;
    min-height: 44px;
    place-items: center;
    padding: .25rem .18rem;
    font-size: .72rem;
    line-height: 1.15;
    text-align: center;
  }
  .theme-toggle { width: 44px; height: 44px; }
  main { padding-top: .72rem; }
  .live-heading { gap: .45rem; margin-bottom: .65rem; padding-inline: .12rem; }
  .live-heading h1 { font-size: clamp(1.5rem, 7vw, 2rem); }
  .live-subtitle { margin-bottom: 0; font-size: .76rem; line-height: 1.3; }
  .eyebrow { margin-bottom: .28rem; font-size: .62rem; }
  .live-heading-actions {
    width: 100%;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: .35rem .55rem;
  }
  .view-switch { padding: .12rem; }
  .view-switch button { min-height: 44px; padding: .25rem .62rem; font-size: .69rem; }
  .freshness { width: auto; gap: .35rem; font-size: .68rem; }
  .quality-pill { min-height: 26px; padding: .15rem .48rem; font-size: .62rem; }

  .house-panel { min-width: 0; border-radius: 18px; }
  .house-scene {
    width: 100%;
    height: auto !important;
    min-height: 0 !important;
    aspect-ratio: 1670 / 942 !important;
    border-radius: 18px 18px 0 0;
    contain: layout paint;
  }
  .environment-scene-layer { background: #dce8e7; }
  .environment-scene-asset {
    object-fit: contain;
    object-position: center center;
  }
  .moon-disc {
    top: 2%;
    right: auto;
    left: 8%;
    width: clamp(48px, 7vw, 54px);
    box-shadow: 0 0 26px 8px rgba(202, 224, 242, .25);
  }
  .house-energy-lines {
    inset: 0 !important;
    top: 0 !important;
    width: 100% !important;
    height: 100% !important;
  }
  .house-energy-lines g path,
  .house-energy-lines .topology-rails path { stroke-width: 2.25; }
  .house-energy-lines .topology-rails .house-bus-rail { stroke-width: 3; }
  .house-energy-lines g.is-active path {
    stroke-width: calc(2.25px + var(--flow-intensity, 0) * .75px);
  }
  .house-energy-lines .flow-particle { r: 3.5px; stroke-width: 1.5; }
  .house-energy-lines .topology-junctions circle { stroke-width: 2.5; }

  .scene-caption {
    left: auto;
    right: 1.2%;
    top: 2%;
    width: min(124px, 36%);
    gap: .02rem .22rem;
    padding: .25rem .34rem;
    border-radius: 8px;
    backdrop-filter: blur(5px);
  }
  .scene-weather-icon { font-size: .72rem; }
  .scene-caption .scene-time { padding-right: .22rem; font-size: .56rem; }
  .scene-caption strong { font-size: .54rem; }
  .scene-caption > span:last-child {
    max-width: 75px;
    font-size: .45rem;
    line-height: 1.1;
  }

  .scene-component,
  .scene-component::before { min-width: 44px; min-height: 44px; }
  .scene-component::before { inset: 0; }
  .component-card,
  .component-card.compact,
  .pv-component .component-card,
  .home-component .component-card,
  .vehicle-component .component-card,
  .house-scene:not(.has-vehicle) .vehicle-component .component-card {
    max-width: 92px;
    padding: .16rem .25rem;
    border-radius: 5px;
    box-shadow: 0 2px 7px rgba(10, 38, 43, .12);
    backdrop-filter: blur(3px);
  }
  .component-kicker { font-size: .39rem; }
  .component-card strong { font-size: .52rem; line-height: 1.05; }
  .component-card > span:last-child:not(.component-kicker) { font-size: .4rem; }

  .pv-component { left: 42%; top: 1.5%; }
  .pv-component .component-card { min-width: 0; max-width: 84px; }
  .pv-component .component-kicker { font-size: 0; }
  .pv-component .component-kicker::before {
    content: attr(data-mobile-label);
    font-size: .42rem;
  }
  .home-component { left: 56%; top: 43%; }
  .home-component .home-label { min-width: 65px; padding: .18rem .25rem; }
  .home-label .component-kicker { font-size: .39rem; }
  .home-label strong { font-size: .54rem; }
  .gen24-component { left: 40.1%; top: 88.2%; bottom: auto; }
  .symo-component { left: 47%; top: 88.2%; bottom: auto; }
  .battery-component { left: 55%; right: auto; top: 88.2%; bottom: auto; }
  .gen24-component .device-label,
  .symo-component .device-label,
  .battery-component .device-label {
    min-width: 0;
    max-width: 24px;
    gap: 0;
    padding: .06rem .08rem;
    border-radius: 3px;
    line-height: 1;
  }
  .device-label .component-kicker { font-size: .3rem; line-height: 1; }
  .device-label strong { font-size: .36rem; line-height: 1; }
  .battery-label > span:last-child:not(.component-kicker) { display: none; }
  .grid-component { right: 1%; top: 43%; bottom: auto; }
  .grid-component .grid-label { max-width: 76px; padding: .16rem .24rem; }
  .grid-label { flex-direction: row; align-items: baseline; }
  .grid-label > span:last-child:not(.component-kicker) { display: none; }
  #house-grid::after { content: " " attr(data-mobile-direction); }

  .vehicle-component,
  .house-scene:not(.has-vehicle) .vehicle-component {
    left: 1.5%;
    top: 49%;
    bottom: auto;
    width: 29%;
    height: 30%;
  }
  .vehicle-component .wattpilot-label,
  .house-scene:not(.has-vehicle) .vehicle-component .wattpilot-label {
    left: 66%;
    top: 12%;
    display: inline-flex;
    flex-direction: row;
    align-items: baseline;
    max-width: 100px;
    padding: .16rem .24rem;
    white-space: nowrap;
  }
  .wattpilot-label .component-kicker { font-size: .38rem; }
  .wattpilot-label .component-kicker::after { content: " ·"; }
  .wattpilot-label strong { font-size: .49rem; }
  .wattpilot-label > span:last-child:not(.component-kicker) { display: none; }
  .atmosphere-note { display: none; }

  .vehicle-assignment {
    left: 2%;
    bottom: 2%;
    width: min(280px, 78%);
    padding: .42rem;
  }
  .vehicle-assignment button { min-height: 44px; }
  .house-system-strip { min-height: 0; padding: .6rem .68rem; }
  .status-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .42rem .7rem;
  }
  .status-summary > strong { grid-column: 1 / -1; }
  .status-summary span { padding: 0; border: 0; }
  .flow-legend { display: none; }

  .component-dialog {
    width: 100%;
    max-width: 100vw;
    height: min(90dvh, 820px);
    max-height: calc(100dvh - .35rem);
    margin: auto 0 0;
    padding: .85rem;
    overflow-x: hidden;
    border-radius: 20px 20px 0 0;
  }
  .component-dialog button,
  .component-dialog .dialog-close,
  .detail-tabs button { min-width: 44px; min-height: 44px; }
}

@media (max-width: 480px) {
  .moon-disc {
    top: 4%;
    right: 34.5%;
    width: clamp(28px, 8vw, 32px);
    box-shadow: 0 0 18px 5px rgba(202, 224, 242, .24);
  }
}

@media (max-width: 420px) {
  .app-shell { padding-inline: .45rem; }
  .brand-mark { width: 34px; height: 34px; }
  .brand strong { font-size: .88rem; }
  .app-header .nav-link { font-size: .66rem; }
  .live-heading h1 { font-size: 1.52rem; }
  .live-subtitle { font-size: .7rem; }
  .freshness { width: 100%; justify-content: space-between; }
  .scene-caption { width: min(112px, 35%); }
  .pv-component { left: 40%; }
  .home-component { left: 55%; }
  .vehicle-component .wattpilot-label,
  .house-scene:not(.has-vehicle) .vehicle-component .wattpilot-label { left: 62%; }
  .house-energy-lines .flow-particle { r: 3px; }
  .today-section,
  .today-kpi-grid,
  .kpi-group,
  .kpi-list,
  .kpi-list > div { min-width: 0; }
  .kpi-list { gap: .4rem; }
  .kpi-list > div + div { padding-left: .4rem; }
  .kpi-list dt { font-size: .62rem; overflow-wrap: anywhere; }
}

@media (max-width: 900px) and (max-height: 500px) and (orientation: landscape) {
  .app-header {
    grid-template-columns: 1fr auto auto;
    min-height: 48px;
    gap: .45rem;
  }
  .app-header nav {
    display: flex;
    grid-row: 1;
    grid-column: 2;
    padding: 0;
    border-top: 0;
  }
  .app-header .nav-link { padding-inline: .5rem; }
  .theme-toggle { grid-column: 3; }
  .brand small { display: none; }
  main { padding-top: .45rem; }
  .live-heading {
    align-items: center;
    flex-direction: row;
    gap: .7rem;
    margin-bottom: .4rem;
  }
  .live-heading h1 { font-size: 1.35rem; }
  .live-subtitle { display: none; }
  .eyebrow { margin-bottom: .18rem; }
  .live-heading-actions { width: auto; flex-wrap: nowrap; }
  .freshness { width: auto; white-space: nowrap; }
  .house-scene {
    width: min(100%, calc((100dvh - 135px) * 1670 / 942));
    margin-inline: auto;
  }
}

/* Phase 8C.2 acceptance corrections: astronomical moon, explicit endpoints,
   physical cable state and real portrait viewport/safe-area behavior. */
.night-lighting-layer {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  opacity: 0;
  mix-blend-mode: normal;
  pointer-events: none;
  transition: opacity .8s ease;
}
.night-light-raster-reveal {
  mix-blend-mode: screen;
  transform: translateZ(0);
}
.night-light-raster-reveal-dg-bedroom {
  opacity: .94;
  filter: brightness(3.2) contrast(1.1) saturate(.72);
}
.night-light-raster-reveal-dg-office {
  opacity: .88;
  filter: brightness(2.9) contrast(1.1) saturate(.72);
}
.night-light-raster-reveal-eg-living {
  opacity: .92;
  filter: brightness(3.05) contrast(1.1) saturate(.73);
}
.night-light-raster-reveal-eg-kitchen {
  opacity: .95;
  filter: brightness(3.18) contrast(1.1) saturate(.74);
}
.night-light-raster-reveal-carport {
  opacity: .64;
  filter: brightness(2.25) contrast(1.06) saturate(.7);
}
.night-light-color-grade { mix-blend-mode: color; }
.night-light-color-grade-dg-bedroom { opacity: .8; }
.night-light-color-grade-dg-office { opacity: .65; }
.night-light-color-grade-eg-living { opacity: .73; }
.night-light-color-grade-eg-kitchen { opacity: .82; }
.night-light-color-grade-carport { opacity: .48; }
.night-light-reflections,
.night-light-garden-accents { mix-blend-mode: screen; }
.night-light-ceiling-reflection { opacity: .43; }
.night-light-wall-reflection { opacity: .34; }
.night-light-floor-reflection { opacity: .32; }
.night-light-fixture-reflection { opacity: .68; }
.night-light-cabinet-reflection { opacity: .6; }
.night-light-reflections-carport { opacity: .58; }
.night-light-garden-accents { opacity: .58; }
.house-scene[data-scene="night"] .night-lighting-layer { opacity: 1; }
.house-scene[data-scene="night"][data-weather="overcast"] .night-lighting-layer,
.house-scene[data-scene="night"][data-weather="fog"] .night-lighting-layer,
.house-scene[data-scene="night"][data-weather="rain"] .night-lighting-layer,
.house-scene[data-scene="night"][data-weather="heavy_rain"] .night-lighting-layer { opacity: .94; }
.house-scene[data-scene="night"][data-weather="overcast"] .night-light-garden-accents,
.house-scene[data-scene="night"][data-weather="fog"] .night-light-garden-accents,
.house-scene[data-scene="night"][data-weather="rain"] .night-light-garden-accents,
.house-scene[data-scene="night"][data-weather="heavy_rain"] .night-light-garden-accents { opacity: .34; }

.moon-disc {
  position: absolute;
  top: 9%;
  right: 18%;
  display: block;
  width: 76px;
  aspect-ratio: 1;
  overflow: visible;
  opacity: 0;
  background: none;
  border: 0;
  border-radius: 50%;
  box-shadow: none;
  clip-path: none;
  filter: drop-shadow(0 0 5px rgba(207, 224, 237, calc(.08 + var(--moon-illumination, 0) * .12)));
  transition: opacity .45s ease;
}
.moon-disc[hidden] { display: none; }
.moon-disc::before,
.moon-disc::after { content: none; }
.house-scene[data-moon-visible="true"] .moon-disc { opacity: .88; }
.moon-dark-base { fill: rgba(5, 13, 24, .96); }
.moon-texture { pointer-events: none; }
.moon-texture-earthshine {
  opacity: .09;
  filter: brightness(.34) contrast(1.18) saturate(.18);
}
.moon-texture-lit {
  opacity: .88;
  filter: brightness(.72) contrast(1.22) saturate(.16);
}
.moon-rim {
  fill: none;
  stroke: rgba(226, 235, 237, .28);
  stroke-width: .65;
}
.house-scene[data-weather="partly_cloudy"] .moon-disc,
.house-scene[data-weather="cloudy"] .moon-disc { opacity: .56; filter: blur(.25px) drop-shadow(0 0 4px rgba(207, 224, 237, .1)); }
.house-scene[data-weather="overcast"] .moon-disc,
.house-scene[data-weather="fog"] .moon-disc,
.house-scene[data-weather="drizzle"] .moon-disc,
.house-scene[data-weather="rain"] .moon-disc,
.house-scene[data-weather="heavy_rain"] .moon-disc,
.house-scene[data-weather="thunderstorm"] .moon-disc,
.house-scene[data-weather="snow"] .moon-disc { opacity: .22; filter: blur(.65px) drop-shadow(0 0 3px rgba(207, 224, 237, .08)); }

.house-energy-lines .vehicle-cable-layer { display: none; }
.house-scene.has-connected-cable .house-energy-lines .vehicle-cable-layer { display: block; }
.vehicle-component .wattpilot-label,
.house-scene:not(.has-vehicle) .vehicle-component .wattpilot-label {
  top: -14%;
}
.house-energy-lines .vehicle-cable-layer path {
  opacity: .88;
  fill: none;
  stroke: #1a3038;
  stroke-width: 8;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 2px rgba(3, 13, 18, .42));
  vector-effect: non-scaling-stroke;
}
.house-energy-lines .flow-endpoints { pointer-events: none; }
.house-energy-lines .flow-endpoint {
  stroke: rgba(255, 255, 255, .92);
  stroke-width: 3;
  vector-effect: non-scaling-stroke;
}
.house-energy-lines .endpoint-home { fill: #ff9e0b; filter: url(#flow-glow); }
.house-energy-lines .endpoint-battery { fill: #0fbdad; filter: url(#flow-glow); }
.house-energy-lines .endpoint-grid { fill: #7551db; filter: url(#flow-glow); }
.house-energy-lines .endpoint-vehicle {
  display: none;
  fill: #0b7be5;
  filter: url(#flow-glow);
}
.house-scene.has-connected-cable .house-energy-lines .endpoint-vehicle { display: block; }

@media (max-width: 820px) {
  html,
  body { max-width: 100%; min-height: 100%; overflow-x: clip; }
  body { min-height: 100dvh; }
  .app-shell {
    width: 100%;
    max-width: 100%;
    padding-right: max(.62rem, env(safe-area-inset-right));
    padding-left: max(.62rem, env(safe-area-inset-left));
  }
  .app-header { padding-top: env(safe-area-inset-top); }
  main { padding-bottom: max(.75rem, env(safe-area-inset-bottom)); }
  .house-panel,
  .house-scene,
  .environment-scene-layer,
  .environment-sky { max-width: 100%; }
  .house-panel { overflow: hidden; }
  .moon-disc {
    top: 2%;
    right: 20%;
    width: clamp(48px, 7vw, 54px);
    box-shadow: none;
  }
  .vehicle-component .wattpilot-label,
  .house-scene:not(.has-vehicle) .vehicle-component .wattpilot-label {
    left: 66%;
    top: -12%;
  }
  .house-energy-lines .vehicle-cable-layer path { stroke-width: 5; }
  .house-energy-lines .flow-endpoint { r: 5.5px; stroke-width: 2; }
  .component-dialog {
    width: 100%;
    max-width: 100%;
    max-height: calc(100dvh - max(.35rem, env(safe-area-inset-top)));
    padding-right: max(.85rem, env(safe-area-inset-right));
    padding-bottom: max(.85rem, env(safe-area-inset-bottom));
    padding-left: max(.85rem, env(safe-area-inset-left));
    overscroll-behavior: contain;
  }
  #component-dialog-close { top: max(.55rem, env(safe-area-inset-top)); }
}

@media (max-width: 480px) and (orientation: portrait) {
  .app-shell {
    padding-right: max(.45rem, env(safe-area-inset-right));
    padding-left: max(.45rem, env(safe-area-inset-left));
  }
  .moon-disc {
    top: 4%;
    right: auto;
    left: 30%;
    width: clamp(28px, 8vw, 32px);
    box-shadow: none;
  }
  .house-energy-lines .flow-endpoint { r: 5px; }
}

/* Phase 8C.2 rain polish: quiet, depth-separated rain over the locked v3 scene. */
.rain-scene-composition {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .45s ease, visibility 0s linear .45s;
}
.house-scene[data-weather="drizzle"] .rain-scene-composition,
.house-scene[data-weather="rain"] .rain-scene-composition,
.house-scene[data-weather="heavy_rain"] .rain-scene-composition,
.house-scene[data-weather="thunderstorm"] .rain-scene-composition {
  opacity: 1;
  visibility: visible;
  transition-delay: 0s;
}
.rain-foundation,
.rain-depth,
.rain-scene-composition::before,
.rain-scene-composition::after {
  position: absolute;
  inset: 0;
  display: block;
  content: "";
  pointer-events: none;
}
.rain-foundation {
  z-index: 0;
  background:
    linear-gradient(180deg, rgba(52, 69, 81, .035), rgba(25, 46, 53, .11)),
    url("/assets/assets/scene/energy4u-environment-overcast-day.png") center / cover no-repeat;
  opacity: .92;
  filter: saturate(.72) brightness(.88) contrast(.9);
}
.rain-scene-composition::before {
  z-index: 1;
  background: linear-gradient(180deg, rgba(218, 229, 232, .08), rgba(137, 157, 162, .035) 44%, transparent 72%);
}
.rain-scene-composition::after {
  z-index: 1;
  background: linear-gradient(180deg, transparent 0 62%, rgba(130, 151, 153, .025) 78%, rgba(221, 230, 230, .075));
  mix-blend-mode: soft-light;
}
.rain-depth {
  background-repeat: repeat;
  will-change: background-position;
}
.rain-far {
  z-index: 2;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 260 220'%3E%3Cg fill='none' stroke='%23e5ecee' stroke-linecap='round' stroke-width='.65'%3E%3Cpath opacity='.22' d='M18 14l-1 5'/%3E%3Cpath opacity='.16' d='M53 91l-1.4 6'/%3E%3Cpath opacity='.2' d='M89 39l-.8 4'/%3E%3Cpath opacity='.14' d='M116 176l-1.2 5'/%3E%3Cpath opacity='.18' d='M149 113l-1.3 6'/%3E%3Cpath opacity='.13' d='M174 25l-.7 4'/%3E%3Cpath opacity='.21' d='M205 154l-1.4 7'/%3E%3Cpath opacity='.15' d='M239 68l-1 5'/%3E%3Cpath opacity='.12' d='M33 202l-.7 3'/%3E%3Cpath opacity='.17' d='M135 58l-1 5'/%3E%3Cpath opacity='.14' d='M222 211l-.8 4'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 260px 220px;
  opacity: .5;
  filter: blur(.18px);
  animation: rain-far-drift 4.8s linear infinite;
}
.rain-mid {
  z-index: 3;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 420 330'%3E%3Cg fill='none' stroke='%23dbe5e8' stroke-linecap='round'%3E%3Cpath opacity='.32' stroke-width='1.05' d='M42 31l-3 13'/%3E%3Cpath opacity='.23' stroke-width='.9' d='M111 204l-2.2 10'/%3E%3Cpath opacity='.4' stroke-width='1.2' d='M188 91l-3.8 17'/%3E%3Cpath opacity='.27' stroke-width='1' d='M274 281l-2.7 12'/%3E%3Cpath opacity='.35' stroke-width='1.1' d='M346 151l-3.3 15'/%3E%3Cpath opacity='.2' stroke-width='.8' d='M397 52l-2 9'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 420px 330px;
  opacity: .62;
  filter: blur(.48px);
  animation: rain-mid-drift 2.65s linear infinite;
}
.rain-near {
  z-index: 4;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 820 620'%3E%3Cg fill='none' stroke='%23d5e0e3' stroke-linecap='round'%3E%3Cpath opacity='.31' stroke-width='2.2' d='M94 76l-8 35'/%3E%3Cpath opacity='.22' stroke-width='2.8' d='M417 398l-10 45'/%3E%3Cpath opacity='.27' stroke-width='2.4' d='M731 191l-7 31'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 820px 620px;
  opacity: .48;
  filter: blur(1.25px);
  animation: rain-near-drift 1.55s linear infinite;
}
.house-scene[data-weather="drizzle"] .rain-mid { opacity: .38; }
.house-scene[data-weather="drizzle"] .rain-near { opacity: .25; }
.house-scene[data-weather="heavy_rain"] .rain-mid,
.house-scene[data-weather="thunderstorm"] .rain-mid { opacity: .68; }
.house-scene[data-weather="heavy_rain"] .rain-near,
.house-scene[data-weather="thunderstorm"] .rain-near { opacity: .58; }

@keyframes rain-far-drift { to { background-position: -18px 220px; } }
@keyframes rain-mid-drift { to { background-position: -27px 330px; } }
@keyframes rain-near-drift { to { background-position: -38px 620px; } }

@media (max-width: 620px) {
  .rain-far { background-size: 360px 300px; opacity: .36; }
  .rain-mid { background-size: 560px 450px; opacity: .47; }
  .rain-near { background-size: 1100px 850px; opacity: .34; }
}

@media (prefers-reduced-motion: reduce) {
  .rain-depth { animation: none !important; }
}
