:root {
  color-scheme: dark;
  --bg: #0c0f0e;
  --panel: #151918;
  --panel-2: #1a1f1d;
  --line: #2a302e;
  --line-soft: #222725;
  --text: #f4f7f5;
  --muted: #9da7a2;
  --muted-2: #707a75;
  --solar: #f7c948;
  --battery: #50c878;
  --home: #58a6ff;
  --grid: #a2aaa6;
  --warning: #ff9f43;
  --danger: #ff6b6b;
  --radius: 18px;
  --shadow: 0 18px 48px rgba(0, 0, 0, .22);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--text); }
button, input { font: inherit; }
button { color: inherit; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.prototype-note {
  position: fixed; z-index: 50; top: 0; left: 0; right: 0; height: 34px; display: flex; align-items: center;
  justify-content: center; gap: 14px; background: #f5f1e5; color: #343632; font-size: 11px; letter-spacing: .02em;
  border-bottom: 1px solid rgba(0,0,0,.16);
}
.prototype-note span:first-child { text-transform: uppercase; font-weight: 800; letter-spacing: .1em; }
.prototype-note span + span { color: #6f746f; }
.prototype-note button { border: 0; background: #232824; color: #fff; border-radius: 999px; padding: 4px 10px; cursor: pointer; font-size: 10px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 232px 1fr; }
.sidebar { position: fixed; top: 0; bottom: 0; left: 0; width: 232px; display: flex; flex-direction: column; padding: 26px 18px 18px; background: #101312; border-right: 1px solid var(--line-soft); z-index: 10; }
body.auth-pending .app-shell { visibility: hidden; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 10px 30px; color: var(--text); text-decoration: none; }
.brand-mark { width: 37px; height: 37px; border-radius: 12px; display: grid; place-items: center; background: var(--solar); color: #222718; box-shadow: 0 8px 24px rgba(247,201,72,.16); }
.brand-mark svg { width: 23px; height: 23px; stroke-width: 2.1; }
.brand > span:last-child, .login-brand > span:last-child { display: flex; flex-direction: column; line-height: 1.05; }
.brand b, .login-brand b { font-size: 17px; letter-spacing: -.02em; }
.brand small, .login-brand small { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .17em; margin-top: 5px; }
.nav-list { display: grid; gap: 6px; }
.nav-item { position: relative; display: flex; align-items: center; gap: 13px; width: 100%; padding: 12px 13px; background: transparent; border: 0; border-radius: 12px; color: var(--muted); cursor: pointer; text-align: left; transition: .2s ease; }
.nav-item:hover { color: var(--text); background: #181c1b; }
.nav-item.active { color: var(--text); background: #202522; }
.nav-item.active::before { content: ""; position: absolute; left: 0; width: 3px; height: 22px; border-radius: 3px; background: var(--solar); }
.nav-icon { width: 20px; height: 20px; display: inline-grid; place-items: center; }
.nav-icon svg { width: 20px; height: 20px; }
.nav-badge { margin-left: auto; min-width: 21px; height: 21px; border-radius: 10px; display: grid; place-items: center; font-size: 10px; background: rgba(255,159,67,.16); color: var(--warning); }
.sidebar-footer { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 15px 8px 0; border-top: 1px solid var(--line-soft); }
.site-chip { min-width: 0; display: flex; align-items: center; gap: 9px; }
.site-chip > span:last-child { display: flex; flex-direction: column; white-space: nowrap; overflow: hidden; }
.site-chip b { font-size: 11px; }
.site-chip small { font-size: 9px; color: var(--muted); margin-top: 3px; }
.status-dot { width: 7px; height: 7px; display: inline-block; border-radius: 50%; background: var(--battery); box-shadow: 0 0 0 4px rgba(80,200,120,.12); }
.avatar { margin-left: auto; border: 1px solid var(--line); width: 34px; height: 34px; border-radius: 50%; background: var(--panel-2); font-size: 10px; cursor: pointer; }

.main-content { grid-column: 2; min-width: 0; padding: 0 38px 70px; max-width: 1560px; width: 100%; margin: 0 auto; }
.topbar { min-height: 112px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.topbar h1 { margin: 4px 0 0; font-size: 28px; letter-spacing: -.04em; font-weight: 620; }
.eyebrow { margin: 0 0 5px; color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: .16em; text-transform: uppercase; }
.freshness { display: flex; align-items: center; gap: 11px; color: var(--text); }
.freshness-pulse { position: relative; width: 9px; height: 9px; border-radius: 50%; background: var(--battery); }
.freshness-pulse::after { content: ""; position: absolute; inset: -5px; border: 1px solid rgba(80,200,120,.36); border-radius: 50%; animation: pulse 2.2s ease-out infinite; }
@keyframes pulse { 0% { transform: scale(.5); opacity: 0; } 35% { opacity: 1; } 100% { transform: scale(1.35); opacity: 0; } }
.freshness > span:last-child { display: flex; flex-direction: column; text-align: right; }
.freshness b { font-size: 11px; }
.freshness small { margin-top: 4px; color: var(--muted); font-size: 10px; }

.view { display: none; animation: reveal .32s ease both; }
.view.active { display: block; }
@keyframes reveal { from { opacity: 0; transform: translateY(5px); } }
.card { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); box-shadow: var(--shadow); }
.hero-grid { display: grid; grid-template-columns: minmax(610px, 1.65fr) minmax(290px, .7fr); gap: 18px; }
.flow-card { padding: 24px 26px 14px; overflow: hidden; }
.card-heading { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; }
.card-heading h2, .view-heading h2 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -.03em; }
.card-heading p:not(.eyebrow), .view-heading p:not(.eyebrow) { margin: 7px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.mode-pill, .device-status { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; padding: 7px 10px; border-radius: 999px; font-size: 10px; font-weight: 700; }
.mode-pill { color: var(--solar); background: rgba(247,201,72,.1); border: 1px solid rgba(247,201,72,.18); }
.energy-flow { position: relative; height: 390px; max-width: 760px; margin: 0 auto; }
.flow-lines { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.flow-path { fill: none; stroke-width: 2; stroke-dasharray: 3 9; animation: moveFlow .7s linear infinite; }
.flow-path.solar-home { stroke: var(--solar); }
.flow-path.home-battery { stroke: var(--battery); }
.flow-path.home-battery.reverse { animation-direction: reverse; }
.flow-path.grid-home { stroke: var(--grid); animation-direction: reverse; }
.flow-path.grid-home.exporting { animation-direction: normal; }
.flow-path.idle { opacity: .22; animation: none; }
@keyframes moveFlow { to { stroke-dashoffset: -12; } }
.energy-node { position: absolute; width: 152px; min-height: 122px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.solar-node { top: 31px; left: 4px; }
.home-node { top: 130px; left: calc(50% - 76px); }
.grid-node { left: 4px; bottom: 3px; }
.battery-node { right: 4px; bottom: 3px; }
.node-icon { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; margin-bottom: 8px; border: 1px solid currentColor; background: rgba(255,255,255,.025); }
.node-icon svg { width: 25px; height: 25px; }
.node-icon.solar { color: var(--solar); box-shadow: 0 0 35px rgba(247,201,72,.15); }
.node-icon.home { color: var(--home); box-shadow: 0 0 35px rgba(88,166,255,.12); }
.node-icon.battery { color: var(--battery); box-shadow: 0 0 35px rgba(80,200,120,.13); }
.node-icon.grid { color: var(--grid); }
.node-label { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .13em; }
.energy-node strong { margin-top: 4px; font-size: 22px; letter-spacing: -.04em; font-weight: 630; }
.energy-node strong small { font-size: 11px; color: var(--muted); font-weight: 500; }
.node-detail { margin-top: 3px; font-size: 10px; color: var(--muted); }
.energy-node.muted { opacity: .66; }
.right-rail { display: grid; gap: 18px; grid-template-rows: 1fr 1fr; }
.score-card, .weather-card { padding: 22px; min-height: 0; }
.score-card { display: grid; grid-template-columns: 135px 1fr; align-items: center; gap: 18px; }
.score-ring { --score: 82; width: 130px; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--solar) calc(var(--score) * 1%), #242927 0); position: relative; }
.score-ring::before { content: ""; position: absolute; inset: 10px; background: var(--panel); border-radius: inherit; }
.score-ring > div { position: relative; display: flex; flex-direction: column; align-items: center; }
.score-ring strong { font-size: 30px; letter-spacing: -.06em; }
.score-ring strong small { font-size: 15px; }
.score-ring span { color: var(--muted); font-size: 9px; }
.score-card h3, .weather-card h3 { margin: 0; font-size: 15px; line-height: 1.25; }
.score-card p:not(.eyebrow), .weather-card p:not(.eyebrow) { color: var(--muted); font-size: 11px; line-height: 1.5; }
.weather-card { display: flex; flex-direction: column; justify-content: space-between; }
.weather-card svg { width: 100%; height: 66px; margin-top: 12px; }
.weather-card .area { fill: url(#forecastFill); stroke: none; }
.weather-card .line { stroke: var(--solar); stroke-width: 2; }
.emporia-flow-card { margin-top: 18px; padding: 24px 26px 8px; overflow: hidden; }
.emporia-scan-label { color: var(--battery); background: rgba(80,200,120,.08); border: 1px solid rgba(80,200,120,.18); }
.emporia-energy-flow { position: relative; height: 220px; max-width: 760px; margin: 6px auto 0; }
.emporia-node { position: absolute; top: 50px; width: 152px; min-height: 122px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.emporia-inverter-node { left: 4px; }
.emporia-home-node { left: calc(50% - 76px); }
.emporia-grid-node { right: 4px; }
.emporia-node strong { margin-top: 4px; font-size: 22px; letter-spacing: -.04em; font-weight: 630; }
.emporia-node strong small { font-size: 11px; color: var(--muted); font-weight: 500; }
.flow-path.emporia-inverter-home { stroke: var(--solar); }
.flow-path.emporia-grid-home { stroke: var(--grid); animation-direction: reverse; }
.flow-path.emporia-grid-home.exporting { animation-direction: normal; }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 18px; }
.metric { min-height: 113px; padding: 19px; display: flex; align-items: center; gap: 14px; }
.metric-icon { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; font-weight: 800; }
.metric-icon.solar { color: var(--solar); background: rgba(247,201,72,.1); }
.metric-icon.home { color: var(--home); background: rgba(88,166,255,.1); }
.metric-icon.battery { color: var(--battery); background: rgba(80,200,120,.1); }
.metric-icon.grid { color: var(--grid); background: rgba(162,170,166,.1); }
.metric > div { display: flex; min-width: 0; flex-direction: column; }
.metric small { color: var(--muted); font-size: 10px; }
.metric strong { margin: 4px 0; font-size: 18px; letter-spacing: -.03em; }
.metric span:last-child { color: var(--muted-2); font-size: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.battery-history-card { margin-top: 18px; padding: 23px 25px 17px; }
.battery-history-summary { display: flex; gap: 28px; margin: 20px 0 8px 43px; }
.battery-history-summary > span { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 10px; }
.battery-history-summary i { width: 8px; height: 8px; border-radius: 50%; background: var(--battery); box-shadow: 0 0 0 4px rgba(80,200,120,.1); }
.battery-history-summary .historical i { background: var(--grid); box-shadow: none; }
.battery-history-summary > span > span { display: flex; align-items: baseline; gap: 8px; }
.battery-history-summary strong { color: var(--text); font-size: 14px; }
.battery-history-chart-wrap { position: relative; height: 250px; margin: 8px 0 0 43px; }
.battery-history-y { position: absolute; left: -43px; top: 0; height: 210px; display: flex; flex-direction: column; justify-content: space-between; color: var(--muted-2); font-size: 8px; padding: 10px 0 8px; }
.battery-history-chart { width: 100%; height: 210px; overflow: visible; }
.battery-history-chart, .energy-chart, .large-chart svg { cursor: crosshair; touch-action: pan-y; }
.battery-history-chart:focus-visible, .energy-chart:focus-visible, .large-chart svg:focus-visible { outline: 1px solid var(--solar); outline-offset: 4px; border-radius: 5px; }
.chart-hover-guide { stroke: rgba(255,255,255,.34); stroke-width: 1; stroke-dasharray: 3 4; vector-effect: non-scaling-stroke; pointer-events: none; }
.chart-hover-dot { fill: var(--point-color); stroke: #101312; stroke-width: 2; vector-effect: non-scaling-stroke; pointer-events: none; }
.chart-point-tooltip { position: absolute; z-index: 8; top: 7px; transform: translateX(-50%); min-width: 190px; max-width: calc(100% - 18px); padding: 10px 12px; border: 1px solid rgba(255,255,255,.16); border-radius: 10px; background: rgba(10,13,12,.94); box-shadow: 0 12px 30px rgba(0,0,0,.32); color: var(--text); pointer-events: none; backdrop-filter: blur(10px); }
.chart-point-tooltip[hidden] { display: none; }
.chart-point-tooltip > strong { display: block; margin-bottom: 7px; color: #fff; font-size: 10px; font-variant-numeric: tabular-nums; }
.chart-point-tooltip dl { display: grid; gap: 5px; margin: 0; }
.chart-point-tooltip dl > div { display: flex; justify-content: space-between; align-items: center; gap: 18px; }
.chart-point-tooltip dt { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 9px; }
.chart-point-tooltip dt i { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: var(--point-color); }
.chart-point-tooltip dd { margin: 0; color: #fff; font-size: 10px; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.battery-history-area { fill: url(#batteryHistoryFill); stroke: none; }
.battery-history-line { fill: none; stroke-width: 2.2; vector-effect: non-scaling-stroke; }
.battery-history-line.active { stroke: var(--battery); }
.battery-history-line.historical { stroke: var(--grid); stroke-width: 1.7; stroke-dasharray: 5 5; opacity: .75; }
.battery-history-x { display: flex; justify-content: space-between; color: var(--muted-2); font-size: 8px; margin-top: 4px; }
.battery-history-empty { position: absolute; inset: 82px 0 auto; margin: 0; text-align: center; color: var(--muted); font-size: 11px; }
.battery-history-legend { display: flex; justify-content: center; gap: 24px; color: var(--muted); font-size: 9px; }
.battery-history-legend span { display: inline-flex; align-items: center; gap: 6px; }
.battery-history-legend i { width: 18px; height: 2px; background: var(--battery); }
.battery-history-legend i.historical { background: repeating-linear-gradient(90deg, var(--grid) 0 5px, transparent 5px 9px); }
.mini-history { margin-top: 18px; padding: 23px 25px 17px; }
.card-heading.compact { align-items: center; }
.text-button { border: 0; background: transparent; padding: 5px; color: var(--muted); cursor: pointer; font-size: 10px; }
.text-button:hover { color: var(--text); }
.chart-wrap { position: relative; height: 220px; margin: 18px 0 0 43px; }
.chart-y { position: absolute; left: -43px; top: 0; bottom: 0; display: flex; flex-direction: column; justify-content: space-between; color: var(--muted-2); font-size: 8px; padding: 2px 0 11px; }
.energy-chart { width: 100%; height: 185px; overflow: visible; }
.grid-lines path { stroke: var(--line); stroke-width: 1; }
.solar-area { fill: url(#solarFill); stroke: none; }
.solar-area-large { fill: url(#solarFillLarge); stroke: none; }
.solar-stroke { stroke: var(--solar); stroke-width: 2.1; fill: none; }
.home-stroke { stroke: var(--home); stroke-width: 2; fill: none; }
.battery-stroke { stroke: var(--battery); stroke-width: 2; fill: none; }
.grid-stroke { stroke: var(--grid); stroke-width: 1.8; fill: none; }
.chart-x { display: flex; justify-content: space-between; color: var(--muted-2); font-size: 8px; }
.legend { display: flex; justify-content: center; gap: 24px; color: var(--muted); font-size: 9px; }
.legend span, .summary-stats span { display: inline-flex; align-items: center; gap: 6px; }
.legend i, .summary-stats i { width: 7px; height: 7px; border-radius: 50%; }
.legend i.solar, .summary-stats i.solar { background: var(--solar); }.legend i.home, .summary-stats i.home { background: var(--home); }.legend i.battery, .summary-stats i.battery { background: var(--battery); }.legend i.grid, .summary-stats i.grid { background: var(--grid); }

.view-heading { min-height: 76px; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.view-heading h2 { font-size: 24px; }
.secondary-button, .primary-button { border-radius: 11px; padding: 10px 14px; cursor: pointer; font-size: 11px; font-weight: 700; }
.secondary-button { color: var(--text); background: var(--panel); border: 1px solid var(--line); }
.primary-button { color: #1e2418; background: var(--solar); border: 1px solid var(--solar); }
.detail-card { padding: 24px; }
.range-tabs { display: inline-flex; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: #101312; }
.range-tabs button { min-width: 62px; padding: 8px 12px; border: 0; border-radius: 8px; color: var(--muted); background: transparent; cursor: pointer; font-size: 10px; }
.range-tabs button.active { color: var(--text); background: var(--panel-2); box-shadow: 0 3px 10px rgba(0,0,0,.25); }
.detail-chart-summary { display: flex; align-items: flex-end; justify-content: space-between; padding: 25px 3px 8px; }
.detail-chart-summary > div:first-child { display: flex; flex-direction: column; }
.detail-chart-summary small, .detail-chart-summary span { color: var(--muted); font-size: 10px; }
.detail-chart-summary strong { font-size: 31px; letter-spacing: -.05em; margin: 4px 0 2px; }
.summary-stats { display: flex; gap: 23px; }
.summary-stats span { display: grid; grid-template-columns: 8px auto; grid-template-rows: auto auto; column-gap: 6px; }
.summary-stats i { grid-row: 1 / 3; }
.summary-stats b { font-size: 12px; }.summary-stats small { font-size: 8px; }
.large-chart { position: relative; margin: 18px 0 0 45px; height: 380px; }
.large-chart svg { width: 100%; height: 340px; }
.scrubber { stroke: rgba(255,255,255,.35); stroke-width: 1; stroke-dasharray: 3 4; }
.scrubber-dot { fill: var(--solar); stroke: #fff; stroke-width: 2; }
.scrubber-label { position: absolute; left: 54%; top: 13px; transform: translateX(-50%); display: flex; flex-direction: column; background: #252a28; border: 1px solid #343b38; border-radius: 9px; padding: 8px 10px; box-shadow: var(--shadow); }
.scrubber-label b { font-size: 10px; }.scrubber-label span { color: var(--muted); font-size: 8px; margin-top: 3px; white-space: nowrap; }
.two-column { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 18px; }
.insight { padding: 24px; }.insight strong { display: block; font-size: 38px; color: var(--solar); letter-spacing: -.06em; }.insight h3 { margin: 4px 0 8px; font-size: 15px; }.insight p:not(.eyebrow) { color: var(--muted); font-size: 11px; }

.battery-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.battery-detail { padding: 24px; }
.battery-detail.disconnected { opacity: .72; }
.battery-top { display: flex; justify-content: space-between; gap: 25px; align-items: flex-start; }
.battery-top h3 { margin: 12px 0 5px; font-size: 19px; }.battery-top p { margin: 0; color: var(--muted); font-size: 10px; }
.device-status.online { color: var(--battery); background: rgba(80,200,120,.1); border: 1px solid rgba(80,200,120,.16); }
.device-status.offline { color: var(--grid); background: rgba(162,170,166,.1); border: 1px solid rgba(162,170,166,.16); }
.device-status.degraded { color: var(--warning); background: rgba(255,159,67,.1); border: 1px solid rgba(255,159,67,.16); }
.battery-visual { position: relative; width: 54px; height: 86px; border: 2px solid #59625d; border-radius: 10px; padding: 5px; display: flex; align-items: flex-end; }
.battery-visual::before { content: ""; position: absolute; width: 20px; height: 5px; top: -7px; left: 15px; border-radius: 4px 4px 0 0; background: #59625d; }
.battery-level { width: 100%; height: var(--level); border-radius: 5px; background: linear-gradient(180deg, var(--battery), #2c9f58); }
.battery-visual span { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 12px; font-weight: 800; text-shadow: 0 1px 5px rgba(0,0,0,.5); }
.battery-state { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 12px; margin-top: 22px; padding: 13px 15px; border-radius: 12px; border: 1px solid var(--line); background: #111513; }
.battery-state .state-icon { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; font-size: 15px; font-weight: 800; }
.battery-state > div { display: flex; flex-direction: column; }.battery-state small { color: var(--muted); font-size: 8px; letter-spacing: .11em; }.battery-state strong { margin-top: 4px; font-size: 12px; }.battery-state > b { font-size: 12px; }
.battery-state.charging { border-color: rgba(80,200,120,.18); background: rgba(80,200,120,.055); }.battery-state.charging .state-icon { color: var(--battery); background: rgba(80,200,120,.12); }.battery-state.charging > b { color: var(--battery); }
.battery-state.discharging { border-color: rgba(88,166,255,.18); background: rgba(88,166,255,.055); }.battery-state.discharging .state-icon { color: var(--home); background: rgba(88,166,255,.12); }.battery-state.discharging > b { color: var(--home); }
.battery-state.idle .state-icon, .battery-state.unavailable .state-icon { color: var(--grid); background: rgba(162,170,166,.1); }.battery-state.unavailable > b { color: var(--muted); font-size: 9px; font-weight: 500; }
.battery-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin-top: 28px; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--line); }
.battery-stats > div { padding: 15px; display: flex; flex-direction: column; background: var(--panel); }
.battery-stats small { color: var(--muted); font-size: 9px; }.battery-stats strong { margin-top: 6px; font-size: 14px; }
.device-footer { display: flex; justify-content: space-between; align-items: center; gap: 15px; margin-top: 17px; color: var(--muted); font-size: 9px; }
.device-footer > span { display: inline-flex; align-items: center; gap: 9px; }
.health-card { margin-top: 18px; padding: 24px; display: flex; justify-content: space-between; align-items: center; gap: 30px; }
.health-card h2 { margin: 0; font-size: 18px; }.health-card p:not(.eyebrow) { color: var(--muted); font-size: 10px; }
.cells { height: 95px; display: flex; align-items: flex-end; gap: 8px; }
.cells span { height: var(--h); width: 38px; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 8px; border-radius: 7px 7px 3px 3px; background: linear-gradient(180deg, rgba(80,200,120,.32), rgba(80,200,120,.08)); border: 1px solid rgba(80,200,120,.22); color: #c9f1d6; font-size: 8px; }

.inverter-summary { display: grid; grid-template-columns: minmax(260px, .65fr) 1.35fr; gap: 20px; align-items: center; padding: 22px 24px; }
.inverter-identity { display: flex; align-items: center; gap: 14px; }.inverter-identity .system-icon { width: 46px; height: 46px; }.inverter-identity h3 { margin: 0 0 4px; font-size: 16px; }.inverter-identity p:not(.eyebrow) { margin: 0; color: var(--muted); font-size: 9px; }
.inverter-live { display: grid; grid-template-columns: repeat(4, 1fr); overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--line); gap: 1px; }
.inverter-live > div { display: flex; flex-direction: column; padding: 14px; background: var(--panel); }.inverter-live small { color: var(--muted); font-size: 8px; }.inverter-live strong { margin-top: 6px; font-size: 12px; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 18px; align-items: start; }
.settings-card { padding: 22px; }
.settings-heading { display: flex; align-items: center; gap: 12px; padding-bottom: 17px; border-bottom: 1px solid var(--line-soft); }
.settings-heading h3 { margin: 0; font-size: 15px; }.settings-heading .eyebrow { margin-bottom: 3px; }
.settings-icon { width: 35px; height: 35px; display: grid; place-items: center; border-radius: 10px; font-weight: 800; }.settings-icon.solar { color: var(--solar); background: rgba(247,201,72,.1); }.settings-icon.battery { color: var(--battery); background: rgba(80,200,120,.1); }.settings-icon.home { color: var(--home); background: rgba(88,166,255,.1); }.settings-icon.protection { color: #b6a2ff; background: rgba(182,162,255,.1); }
.settings-list { margin: 0; }
.settings-list > div { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 45px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }.settings-list > div:last-child { border-bottom: 0; }.settings-list dt { color: var(--muted); font-size: 9px; }.settings-list dd { margin: 0; text-align: right; font-size: 10px; font-weight: 650; }.settings-list dd small { display: block; margin-top: 3px; color: var(--muted); font-size: 8px; font-weight: 500; }
.setting-state { display: inline-flex; align-items: center; gap: 5px; }.setting-state::before { content: ""; width: 6px; height: 6px; border-radius: 50%; }.setting-state.on { color: var(--battery); }.setting-state.on::before { background: var(--battery); }.setting-state.off { color: var(--grid); }.setting-state.off::before { background: var(--grid); }
.settings-note { margin-top: 18px; padding: 18px 21px; display: flex; gap: 13px; align-items: center; color: var(--home); border-color: rgba(88,166,255,.18); background: rgba(88,166,255,.05); }.settings-note h3 { margin: 0 0 4px; color: var(--text); font-size: 12px; }.settings-note p { margin: 0; color: var(--muted); font-size: 9px; line-height: 1.45; }

.system-list { display: grid; gap: 11px; }
.system-row { display: grid; grid-template-columns: 46px 1fr 130px 100px; align-items: center; gap: 16px; padding: 17px 19px; }
.system-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 9px; font-weight: 800; background: rgba(88,166,255,.1); color: var(--home); border: 1px solid rgba(88,166,255,.12); }
.system-icon.solar { color: var(--solar); background: rgba(247,201,72,.1); }.system-icon.inverter { color: #b6a2ff; background: rgba(182,162,255,.1); }.system-icon.battery { color: var(--battery); background: rgba(80,200,120,.1); }.system-icon.muted { color: var(--grid); background: rgba(162,170,166,.1); }
.system-row h3 { margin: 0 0 4px; font-size: 13px; }.system-row p { margin: 0; color: var(--muted); font-size: 9px; }
.scan-time { display: flex; flex-direction: column; text-align: right; font-size: 10px; }.scan-time small { margin-top: 4px; color: var(--muted); font-size: 8px; }
.safety-banner { margin-top: 18px; padding: 19px 22px; display: flex; gap: 14px; align-items: center; border-color: rgba(88,166,255,.18); background: rgba(88,166,255,.05); }
.safety-banner > span { color: var(--home); }.safety-banner h3 { margin: 0 0 4px; font-size: 12px; }.safety-banner p { margin: 0; color: var(--muted); font-size: 9px; }

.alerts-layout { display: grid; grid-template-columns: 1.5fr .7fr; gap: 18px; }
.alert-list { padding: 0 22px; }
.alert-item { display: grid; grid-template-columns: 34px 1fr auto; gap: 14px; align-items: flex-start; padding: 21px 0; border-bottom: 1px solid var(--line-soft); }
.alert-item:last-child { border-bottom: 0; }
.alert-symbol { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 12px; }
.alert-item.warning .alert-symbol { color: var(--warning); background: rgba(255,159,67,.12); }.alert-item.resolved .alert-symbol { color: var(--battery); background: rgba(80,200,120,.12); }.alert-item.info .alert-symbol { color: var(--home); background: rgba(88,166,255,.12); }
.alert-item h3 { margin: 2px 0 5px; font-size: 12px; }.alert-item p { margin: 0 0 7px; color: var(--muted); font-size: 9px; line-height: 1.45; }.alert-item small { color: var(--muted-2); font-size: 8px; }
.alert-item > button { border: 1px solid var(--line); background: transparent; border-radius: 9px; padding: 7px 10px; color: var(--muted); font-size: 8px; cursor: pointer; }
.notification-settings { padding: 23px; }
.notification-settings h3 { margin: 0 0 18px; font-size: 16px; }
.notification-settings label { position: relative; display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 13px 0; cursor: pointer; }
.notification-settings label > span { display: flex; flex-direction: column; }.notification-settings label b { font-size: 10px; }.notification-settings label small { margin-top: 4px; color: var(--muted); font-size: 8px; }
.notification-settings input { position: absolute; opacity: 0; pointer-events: none; }.notification-settings label > i { width: 34px; height: 19px; border-radius: 12px; background: #343a37; position: relative; transition: .2s; }.notification-settings label > i::after { content: ""; position: absolute; width: 13px; height: 13px; top: 3px; left: 3px; background: #a3aaa6; border-radius: 50%; transition: .2s; }.notification-settings input:checked + i { background: rgba(80,200,120,.4); }.notification-settings input:checked + i::after { left: 18px; background: var(--battery); }
.notification-settings hr { border: 0; border-top: 1px solid var(--line-soft); margin: 12px 0; }.quiet-note { color: var(--muted); font-size: 9px; line-height: 1.5; }

.mobile-nav { display: none; }

.login-screen { position: fixed; inset: 0; z-index: 100; display: none; flex-direction: column; align-items: center; justify-content: center; background: radial-gradient(circle at 50% 30%, #1b211e 0, #0c0f0e 52%, #080a09 100%); padding: 32px; }
.login-screen.visible { display: flex; animation: reveal .25s ease both; }
.close-login { position: absolute; top: 22px; right: 26px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); width: 36px; height: 36px; border-radius: 50%; cursor: pointer; font-size: 20px; }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 27px; }
.brand-mark.large { width: 44px; height: 44px; }
.login-card { width: min(100%, 410px); padding: 31px; border-radius: 20px; background: rgba(21,25,24,.93); border: 1px solid #2c332f; box-shadow: 0 28px 80px rgba(0,0,0,.4); backdrop-filter: blur(15px); }
.login-card h2 { margin: 0; font-size: 27px; letter-spacing: -.04em; }.login-card > p:not(.eyebrow) { color: var(--muted); font-size: 11px; margin: 8px 0 24px; }
.login-card form > label { display: flex; flex-direction: column; gap: 8px; margin: 14px 0; color: #c8cecb; font-size: 10px; font-weight: 650; }
.login-card input[type="email"], .login-card input[type="password"] { width: 100%; height: 43px; border: 1px solid #343b38; border-radius: 10px; background: #101312; padding: 0 13px; color: var(--text); outline: none; }
.login-card input:focus { border-color: rgba(247,201,72,.7); box-shadow: 0 0 0 3px rgba(247,201,72,.08); }
.login-error { min-height: 17px; margin: 0 0 8px !important; color: var(--danger) !important; font-size: 9px !important; }
.password-field { position: relative; display: block; }.password-field button { position: absolute; top: 6px; right: 7px; height: 31px; border: 0; background: transparent; color: var(--muted); font-size: 9px; cursor: pointer; }
.login-options { display: flex; align-items: center; justify-content: space-between; margin: 13px 0 20px; }.login-options label { color: var(--muted); font-size: 9px; }.login-options input { accent-color: var(--solar); }.login-options a { color: var(--solar); text-decoration: none; font-size: 9px; }
.primary-button.full { width: 100%; height: 43px; }.login-help { display: block; text-align: center; color: var(--muted-2); margin-top: 18px; font-size: 8px; }.login-footer { position: absolute; bottom: 24px; color: var(--muted-2); font-size: 8px; }
.toast { position: fixed; z-index: 120; right: 24px; bottom: 24px; transform: translateY(90px); opacity: 0; padding: 12px 16px; border: 1px solid rgba(80,200,120,.25); border-radius: 12px; background: #18221c; color: #cff0d9; font-size: 10px; box-shadow: var(--shadow); transition: .25s ease; }.toast.show { transform: translateY(0); opacity: 1; }

@media (max-width: 1150px) {
  .hero-grid { grid-template-columns: 1fr; }
  .right-rail { grid-template-columns: 1fr 1fr; grid-template-rows: auto; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .score-card { min-height: 190px; }
}

@media (max-width: 900px) {
  .app-shell { display: block; padding-bottom: 70px; }
  .sidebar { display: none; }
  .main-content { padding: 0 14px 26px; }
  .topbar { min-height: 94px; align-items: center; }.topbar h1 { font-size: 22px; }.topbar .eyebrow { display: none; }
  .freshness b { font-size: 9px; }.freshness small { font-size: 8px; }
  .hero-grid { display: block; }.flow-card { padding: 19px 15px 8px; }.card-heading { display: block; }.mode-pill { display: none; }.card-heading h2 { font-size: 18px; }.card-heading p:not(.eyebrow) { font-size: 11px; }
  .energy-flow { height: 335px; }.flow-lines { transform: scale(.94); }.energy-node { width: 100px; min-height: 100px; }.solar-node, .grid-node { left: 0; }.battery-node { right: 0; }.home-node { left: calc(50% - 50px); }.node-icon { width: 42px; height: 42px; }.energy-node strong { font-size: 19px; }.node-detail { font-size: 8px; }
  .right-rail { display: grid; grid-template-columns: 1fr; margin-top: 12px; gap: 12px; }.score-card { min-height: 160px; grid-template-columns: 120px 1fr; padding: 17px; }.score-ring { width: 112px; }.weather-card { min-height: 175px; }
  .emporia-flow-card { margin-top: 12px; padding: 19px 15px 8px; }.emporia-scan-label { display: inline-flex; margin-top: 12px; }.emporia-energy-flow { height: 220px; }.emporia-node { width: 92px; top: 56px; min-height: 100px; }.emporia-inverter-node { left: 0; }.emporia-home-node { left: calc(50% - 46px); }.emporia-grid-node { right: 0; }.emporia-node strong { font-size: 18px; }
  .metric-grid { grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }.metric { min-height: 96px; padding: 14px; gap: 10px; }.metric-icon { display: none; }.metric strong { font-size: 16px; }.metric span:last-child { font-size: 8px; }
  .battery-history-card { margin-top: 12px; padding: 18px 15px; }.battery-history-summary { margin-left: 36px; gap: 15px; flex-wrap: wrap; }.battery-history-summary > span > span { display: flex; flex-direction: column; gap: 2px; }.battery-history-chart-wrap { height: 220px; margin-left: 36px; }.battery-history-y { left: -36px; height: 180px; }.battery-history-chart { height: 180px; }.battery-history-legend { gap: 14px; flex-wrap: wrap; }
  .mini-history { margin-top: 12px; padding: 18px 15px; }.chart-wrap { height: 175px; }.energy-chart { height: 140px; }.legend { gap: 12px; }
  .view-heading { min-height: 95px; }.view-heading h2 { font-size: 20px; }.view-heading p:not(.eyebrow) { font-size: 10px; }.secondary-button, .view-heading .primary-button { font-size: 9px; padding: 8px 10px; }
  .detail-card { padding: 16px; }.range-tabs { display: flex; width: 100%; overflow-x: auto; }.range-tabs button { min-width: 58px; }.detail-chart-summary { display: block; }.summary-stats { margin-top: 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }.large-chart { height: 300px; margin-left: 38px; }.large-chart svg { height: 260px; }.scrubber-label { display: none; }.two-column { grid-template-columns: 1fr; gap: 12px; margin-top: 12px; }
  .battery-grid { grid-template-columns: 1fr; gap: 12px; }.battery-detail { padding: 18px; }.battery-state { grid-template-columns: 32px 1fr auto; }.battery-stats { grid-template-columns: 1fr 1fr; }.health-card { align-items: flex-start; flex-direction: column; }.cells { width: 100%; gap: 5px; }.cells span { flex: 1; min-width: 0; }
  .inverter-summary { grid-template-columns: 1fr; padding: 18px; }.inverter-live { grid-template-columns: 1fr 1fr; }.settings-grid { grid-template-columns: 1fr; gap: 12px; margin-top: 12px; }.settings-card { padding: 18px; }.settings-list > div { min-height: 42px; }
  .system-row { grid-template-columns: 42px 1fr auto; grid-template-rows: auto auto; gap: 5px 11px; padding: 14px; }.system-row .system-icon { grid-column: 1; grid-row: 1 / 3; }.system-row > div { grid-column: 2; grid-row: 1; }.scan-time { display: flex; grid-column: 2; grid-row: 2; text-align: left; font-size: 8px; }.scan-time small { display: none; }.system-row .device-status { grid-column: 3; grid-row: 1 / 3; padding: 5px 8px; font-size: 8px; }.system-row h3 { font-size: 11px; }.system-row p { font-size: 8px; }
  .alerts-layout { grid-template-columns: 1fr; gap: 12px; }.alert-list { padding: 0 15px; }.alert-item { grid-template-columns: 30px 1fr; }.alert-item > button { display: none; }
  .mobile-nav { position: fixed; z-index: 40; display: grid; grid-template-columns: repeat(6, 1fr); left: 0; right: 0; bottom: 0; height: 66px; padding: 7px 3px 8px; background: rgba(16,19,18,.94); border-top: 1px solid var(--line); backdrop-filter: blur(18px); }.mobile-nav button { position: relative; border: 0; background: transparent; color: var(--muted-2); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 7px; cursor: pointer; }.mobile-nav svg { width: 19px; height: 19px; }.mobile-nav button.active { color: var(--solar); }.mobile-nav button i { position: absolute; top: 3px; right: calc(50% - 14px); width: 5px; height: 5px; border-radius: 50%; background: var(--warning); }
  .login-screen { padding: 22px; }.login-card { padding: 25px 21px; }.close-login { top: 15px; right: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}
