:root{font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;color:#18333a;background:#f5f4ef;font-synthesis:none;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased}
.preview-banner{background:#f4ead9;border:1px solid #ead5ad;color:#755b2c;border-radius:10px;padding:11px 15px;margin-bottom:24px;font-size:12px;font-weight:700}
.metrics-panel{border-top:1px solid #e8eee9;margin-top:18px;padding-top:20px}.metrics-head,.history-head{display:flex;justify-content:space-between;align-items:center;gap:12px}.history-head{flex-wrap:wrap}.metrics-head h3{font-size:15px;letter-spacing:-.02em;margin-top:5px}.metrics-head>span{color:#8a9b93;font-size:10px}.power-now{display:flex;justify-content:space-between;align-items:center;background:#eaf3eb;border-radius:12px;margin-top:16px;padding:18px 20px}.power-now small{display:block;font-size:10px;color:#728f7d;margin-bottom:5px}.power-now strong{font-size:28px;letter-spacing:-.04em;color:#1b5d48}.power-now>span{font-size:25px;color:#b69b58}.history-panel{margin-top:18px}.history-head strong,.history-head small{display:block}.history-head strong{font-size:12px}.history-head small{font-size:10px;color:#8a9c94;margin-top:3px}.period-switch{display:flex;flex-wrap:wrap;gap:3px;padding:3px;border-radius:8px;background:#edf2ed}.period-switch button{border:0;background:none;color:#668278;border-radius:6px;padding:7px 8px;font-size:10px;font-weight:750;white-space:nowrap}.period-switch button.selected{background:white;color:#1a5849;box-shadow:0 1px 4px #1d524318}.history-chart{min-height:185px;margin-top:11px;display:grid;place-items:center;color:#8ca19a;font-size:11px}.history-chart svg{width:100%;height:auto;max-height:220px;overflow:visible}.history-chart svg text{font:11px Inter,ui-sans-serif,sans-serif;fill:#91a39b}.chart-line{fill:none;stroke:#3b9375;stroke-width:3;stroke-linejoin:round;stroke-linecap:round}.chart-axis{stroke:#b9ccc0;stroke-width:1}.chart-grid{stroke:#e4eee8;stroke-width:1;stroke-dasharray:4 4}.chart-empty,.sensor-empty,.chart-note{color:#8ca099;font-size:11px;line-height:1.5}.chart-note{margin-top:5px}.sensor-empty{padding-top:16px}.all-metrics{margin-top:15px;border-top:1px solid #ebf0ea;padding-top:14px}.all-metrics summary{cursor:pointer;color:#426e5a;font-size:11px;font-weight:750}.all-metrics summary span{color:#98aa9f;margin-left:5px}.metrics-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin-top:14px}.metric{background:#f7faf6;border-radius:8px;padding:10px;min-width:0}.metric small{display:block;font-size:10px;color:#83988b;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.metric strong{display:block;margin-top:5px;font-size:13px;color:#274b3f;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.metric strong span{font-size:10px;color:#829588;font-weight:500}
*{box-sizing:border-box}body{margin:0;min-height:100vh;background:radial-gradient(circle at 83% 1%,#e8efe8 0,transparent 27rem),#f5f4ef}button,input,select{font:inherit}button{cursor:pointer}button:disabled,input:disabled,select:disabled{opacity:.45;cursor:not-allowed}a{color:inherit;text-decoration:none}h1,h2,h3,p{margin:0}.shell{min-height:100vh;max-width:1480px;margin:auto;padding:0 48px;display:flex;flex-direction:column}.topbar{height:88px;display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid #dbe2de}.brand{display:flex;align-items:center;gap:12px;font-size:26px;font-weight:800;letter-spacing:-.07em}.brand-mark{display:inline-grid;place-items:center;width:37px;height:37px;border-radius:12px;background:#102f39;color:#e7eee5;font-size:26px;font-weight:400;line-height:1}.brand-dot,.heading-dot{color:#ba8c55}.top-actions{display:flex;gap:23px;align-items:center}.connection{display:flex;align-items:center;gap:8px;color:#61747a;font-size:12px;font-weight:700}.status-dot{width:8px;height:8px;background:#75af83;border-radius:100%;box-shadow:0 0 0 4px #dceade}.connection.offline .status-dot{background:#d19b79;box-shadow:0 0 0 4px #f4e9dc}.ghost,.text-button,.back-link{border:0;background:none;color:#234c54;font-size:13px;font-weight:750;padding:8px 0}.ghost:hover,.text-button:hover,.back-link:hover{text-decoration:underline}.button{display:inline-flex;align-items:center;justify-content:center;gap:24px;padding:14px 19px;border-radius:11px;font-size:13px;font-weight:780;border:1px solid transparent;transition:transform .18s,background .18s}.button:hover{transform:translateY(-1px)}.primary{background:#174550;color:#fff}.primary:hover{background:#0e333c}.secondary{background:#fff;color:#174550;border-color:#cddbd7}.secondary:hover{background:#f2f8f4}main{width:100%;flex:1;padding:44px 0 72px}.eyebrow{text-transform:uppercase;letter-spacing:.19em;color:#729480;font-weight:800;font-size:10px}.welcome{max-width:570px;margin:12vh auto 0;text-align:center;padding:35px}.welcome h1{font-size:clamp(45px,6vw,75px);letter-spacing:-.07em;color:#14353d;margin:16px 0}.welcome p{color:#728488;font-size:16px;line-height:1.6;margin-bottom:28px}.welcome .button{margin:auto}.page-head{display:flex;justify-content:space-between;align-items:end;gap:20px;margin-bottom:30px}.page-head h1{font-size:clamp(37px,4.2vw,59px);letter-spacing:-.065em;line-height:1.08;margin:12px 0 11px;font-weight:760}.page-head p{color:#74868a;font-size:14px}.page-head .button{margin-bottom:8px}.summary{display:grid;grid-template-columns:repeat(3,1fr);background:#183b44;border-radius:16px;color:#fff;overflow:hidden;margin-bottom:44px;box-shadow:0 16px 35px #102f3912}.summary>div{min-height:116px;padding:22px 29px;display:flex;flex-direction:column;justify-content:space-between}.summary>div+div{border-left:1px solid #ffffff22}.summary small{color:#b4cbc5;font-size:11px;font-weight:650}.summary strong{font-size:37px;line-height:1;letter-spacing:-.06em}.section-heading{display:flex;align-items:end;justify-content:space-between;margin-bottom:18px}.section-heading h2{font-size:25px;letter-spacing:-.04em;margin-top:6px}.device-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:20px}.device-card,.user-panel,.policy-panel{background:#fff;border:1px solid #e4e9e4;border-radius:16px;box-shadow:0 8px 25px #173c4208}.device-card{padding:24px}.device-title{display:flex;justify-content:space-between;gap:12px;border-bottom:1px solid #ecf0ec;padding-bottom:21px}.type-label{font-size:10px;text-transform:uppercase;letter-spacing:.13em;color:#7c9b86;font-weight:850}.device-title h2{font-size:22px;letter-spacing:-.04em;margin:7px 0 3px}.device-title p{font-size:11px;color:#9aa6a5}.device-count{font-size:11px;color:#7b8c8d;white-space:nowrap}.entities{display:grid;gap:15px;padding-top:16px}.entity{border-radius:12px;background:#f7f9f5;padding:17px}.entity-head{display:flex;align-items:center;gap:12px}.entity-icon{width:40px;height:40px;flex:none;display:grid;place-items:center;border-radius:11px;font-size:22px}.light-icon{background:#f4e9ce;color:#b18b49}.climate-icon{background:#dcece7;color:#4c8980}.entity-head h3{font-size:14px;letter-spacing:-.02em}.entity-head p{font-size:11px;color:#83908f;margin-top:3px}.state-pill{margin-left:auto;padding:5px 9px;border-radius:99px;background:#e8ece9;color:#708480;font-size:10px;font-weight:750}.state-pill.active{background:#e0f0e5;color:#3f8b62}.entity-actions{margin-top:18px;display:flex;align-items:center;gap:23px}.toggle{height:27px;width:48px;border:0;border-radius:100px;background:#c6d1cd;padding:3px;flex:none}.toggle span{display:block;width:21px;height:21px;border-radius:50%;background:#fff;transition:transform .2s}.toggle.is-on{background:#3d8b73}.toggle.is-on span{transform:translateX(21px)}.range-wrap{display:grid;grid-template-columns:auto auto;align-items:center;gap:5px 10px;width:100%;font-size:11px;color:#728884}.range-wrap strong{justify-self:end;color:#23444b}.range-wrap input{grid-column:1/3;width:100%;accent-color:#448a74}.temperatures{display:grid;grid-template-columns:1fr 1fr;margin-top:21px;border-top:1px solid #e7ece7;border-bottom:1px solid #e7ece7}.temperatures>div{padding:16px 0}.temperatures>div+div{border-left:1px solid #e7ece7;padding-left:22px}.temperatures small{display:block;color:#8a9a96;font-size:10px;margin-bottom:5px}.temperatures strong{font-size:30px;font-weight:650;letter-spacing:-.05em}.temperatures strong span{font-size:13px;margin-left:2px;color:#79918a}.climate-controls{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;margin-top:15px}.climate-controls label{font-size:10px;color:#78908a;font-weight:700}.climate-controls select,.climate-controls input{display:block;margin-top:6px;width:100%;padding:9px 8px;border-radius:8px;border:1px solid #d6e1d9;background:white;color:#193c41;font-size:12px;outline-color:#5a9d7f}.admin-head{margin-bottom:30px}.admin-head .back-link{display:block;margin-bottom:23px}.admin-badge{background:#e5ece6;color:#49765e;padding:9px 13px;border-radius:8px;font-size:11px;font-weight:800}.admin-layout{display:grid;grid-template-columns:300px 1fr;gap:20px;align-items:start}.user-panel,.policy-panel{min-height:410px}.panel-head{padding:24px;border-bottom:1px solid #edf0ea}.panel-head h2{font-size:23px;letter-spacing:-.045em;margin:7px 0}.panel-head p{font-size:12px;line-height:1.45;color:#81918f}.user-list{padding:10px}.user-item{width:100%;display:flex;align-items:center;text-align:left;gap:10px;background:transparent;border:0;border-radius:10px;padding:11px}.user-item:hover,.user-item.selected{background:#eef5ef}.avatar{flex:none;display:grid;place-items:center;width:36px;height:36px;background:#d8e7dc;color:#326e56;border-radius:10px;font-size:13px;font-weight:800}.user-item strong,.user-item small{display:block;max-width:190px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.user-item strong{font-size:12px}.user-item small{font-size:10px;color:#8e9b97;margin-top:3px}.chevron{margin-left:auto;color:#9aad9f;font-size:20px}.aside-empty{padding:23px;color:#84938c;font-size:12px;line-height:1.5}.mode-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px;padding:20px 24px}.mode-option{display:flex;gap:12px;border:1px solid #dae4dd;border-radius:11px;padding:15px;cursor:pointer;min-height:90px}.mode-option.chosen{border-color:#589275;background:#f1f8f2}.mode-option input{accent-color:#3f8b62;align-self:flex-start;margin-top:2px}.mode-option strong,.mode-option small{display:block}.mode-option strong{font-size:12px}.mode-option small{font-size:10px;line-height:1.4;color:#7f8f88;margin-top:5px}.access-heading{display:flex;justify-content:space-between;align-items:end;padding:8px 24px 14px}.access-heading h3{font-size:15px}.access-heading p,.access-heading>span{font-size:10px;color:#81918b;margin-top:4px}.access-list{padding:0 24px 18px}.access-row{display:flex;align-items:center;justify-content:space-between;gap:15px;border-top:1px solid #edf0eb;padding:13px 0}.access-row strong,.access-row small{display:block}.access-row strong{font-size:12px;margin:3px 0}.access-row small{font-size:10px;color:#93a09a}.access-row select{width:130px;padding:9px;border:1px solid #d8e1db;border-radius:8px;background:#fff;font-size:11px;color:#234c45}.save-bar{border-top:1px solid #edf0ea;padding:17px 24px;display:flex;justify-content:space-between;align-items:center;gap:12px}.save-bar span{font-size:10px;color:#889792}.save-bar .button{padding:11px 15px}.empty{border:1px dashed #ccd9d0;border-radius:15px;background:#fcfdfa;text-align:center;padding:55px 25px;color:#81918a}.empty>span{display:block;font-size:35px;color:#90ac98;margin-bottom:10px}.empty h3{color:#25434a;font-size:17px;margin-bottom:8px}.empty p{font-size:12px;line-height:1.5}.loading{padding:50px;color:#81918a}footer{display:flex;justify-content:space-between;gap:20px;border-top:1px solid #dce5de;padding:20px 0 27px;font-size:10px;color:#93a29a}.toast{position:fixed;right:25px;bottom:25px;background:#193d45;color:#fff;border-radius:10px;padding:13px 17px;font-size:12px;font-weight:650;box-shadow:0 12px 35px #16393d35;z-index:10}.toast.error{background:#923f37}
@media(max-width:900px){.shell{padding:0 25px}.device-grid{grid-template-columns:1fr}.admin-layout{grid-template-columns:1fr}.user-panel{min-height:0}.user-list{display:flex;overflow:auto}.user-item{min-width:190px}.policy-panel{min-height:300px}}
@media(max-width:620px){.shell{padding:0 16px}.topbar{height:70px}.brand{font-size:23px}.top-actions{gap:12px}.connection{font-size:0}.connection .status-dot{font-size:12px}.page-head{display:block}.page-head .button{margin-top:22px}.page-head h1{font-size:39px}.summary>div{padding:16px 13px;min-height:95px}.summary small{font-size:9px}.summary strong{font-size:28px}.device-card{padding:18px}.mode-grid{grid-template-columns:1fr}.climate-controls{grid-template-columns:1fr 1fr}.save-bar{align-items:flex-start;flex-direction:column}footer{font-size:9px}}

.install-banner{display:flex;align-items:center;justify-content:space-between;gap:20px;padding:18px 22px;margin-top:24px;border:1px solid #cbded1;border-radius:14px;background:#eaf3eb}.install-banner[hidden]{display:none}.install-banner strong{font-size:14px;color:#234c40}.install-banner p{font-size:12px;line-height:1.5;color:#648174;margin-top:5px}.install-actions{display:flex;align-items:center;gap:15px;flex-shrink:0}.install-actions .button{padding:11px 15px}.install-actions [hidden]{display:none}@media(max-width:620px){.install-banner{align-items:flex-start;flex-direction:column;padding:16px;gap:12px}.top-actions{gap:10px}#install-shortcut{font-size:11px}}

.history-chart{position:relative}.interactive-chart{cursor:crosshair;touch-action:pan-y}.interactive-chart:focus-visible{outline:2px solid #3b9375;outline-offset:4px;border-radius:6px}.chart-cursor{pointer-events:none}.chart-cursor line{stroke:#668278;stroke-width:1;stroke-dasharray:3 3}.chart-cursor circle{fill:#3b9375;stroke:white;stroke-width:2}.chart-tooltip{position:absolute;z-index:2;pointer-events:none;background:#173d31;color:white;border-radius:8px;padding:9px 12px;box-shadow:0 4px 14px #173d3126;max-width:100%;box-sizing:border-box;white-space:nowrap}.chart-tooltip[hidden]{display:none}.chart-tooltip time{display:block;font-size:10px;color:#c4dace}.chart-tooltip strong{display:block;margin-top:3px;font-size:13px}
.view-tabs{display:flex;gap:5px;border-bottom:1px solid #dce7df;margin-bottom:28px;padding-bottom:10px}.view-tabs button{border:0;background:transparent;color:#6d8478;font:inherit;font-size:13px;font-weight:700;padding:10px 18px;border-radius:8px;cursor:pointer}.view-tabs button.selected{background:#173d31;color:white}.energy-access{display:flex;gap:20px;justify-content:space-between;align-items:center;padding:18px;border:1px solid #dce7df;border-radius:12px;margin:16px 0}.energy-access strong,.energy-access small{display:block}.energy-access small{color:#789080;margin-top:5px;font-size:11px;max-width:440px}.energy-access input{width:22px;height:22px;accent-color:#286c50;cursor:pointer}.energy-toolbar{display:flex;flex-wrap:wrap;align-items:center;gap:14px;margin-bottom:20px}.energy-toolbar label{font-size:12px;color:#617b6b;display:flex;align-items:center;gap:8px}.energy-toolbar input{padding:9px;border:1px solid #dce7df;border-radius:8px;background:white;color:#274b3f;font:inherit}.energy-toolbar>span{margin-left:auto;font-size:10px;color:#789080}.energy-range-label{font-size:12px;color:#678470;margin-bottom:16px}.energy-summary{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin-bottom:22px}.energy-stat{background:white;padding:20px;border:1px solid #e1e8df;border-radius:12px}.energy-stat small{display:block;color:#789080;font-size:11px;margin-bottom:8px}.energy-stat strong{font-size:24px;color:#274b3f;letter-spacing:-.03em}.energy-layout{display:grid;grid-template-columns:minmax(280px,1fr) minmax(0,2fr);gap:20px}.energy-card{background:white;border:1px solid #e1e8df;border-radius:16px;padding:24px;margin-bottom:20px;min-width:0}.energy-card h2{font-size:16px;margin-bottom:20px}.energy-flow{display:grid;grid-template-columns:1fr 1fr;gap:15px;position:relative}.energy-flow>div{border-radius:12px;padding:14px;text-align:center;background:#f4f8f1;position:relative}.energy-flow span{display:block;font-size:26px}.energy-flow small{display:block;font-size:10px;color:#6d8478;margin:5px 0}.energy-flow strong{display:block;font-size:15px;color:#274b3f}.energy-flow .solar{background:#fff7e4;color:#be901a}.energy-flow .grid{background:#edf5fb;color:#347baa}.energy-flow .flow-home{grid-column:1/-1;background:#e6f2e8}.energy-details{display:flex;gap:25px;margin-top:20px}.energy-details small,.energy-details strong{display:block}.energy-details small{font-size:10px;color:#789080;margin-bottom:5px}.energy-notice{padding:14px 18px;background:#fff6e4;border-radius:10px;color:#8d702c;font-size:12px;margin-bottom:18px}.energy-notice p{margin-top:5px;font-size:11px;line-height:1.5}.energy-graph{position:relative}.energy-svg{width:100%;height:auto;cursor:crosshair;touch-action:pan-y}.energy-svg text{font:11px Inter,ui-sans-serif,sans-serif;fill:#789080}.energy-svg:focus-visible{outline:2px solid #3b9375;border-radius:8px}.energy-legend{display:flex;gap:14px;flex-wrap:wrap;font-size:10px;color:#678470;margin-bottom:15px}.energy-legend span{display:flex;align-items:center;gap:5px}.energy-legend i{width:8px;height:8px;border-radius:2px}.energy-cursor{stroke:#668278;stroke-dasharray:3 3;pointer-events:none}.energy-tooltip{position:absolute;z-index:3;pointer-events:none;background:#173d31;color:white;border-radius:8px;padding:10px 13px;box-shadow:0 4px 14px #173d3126;font-size:11px;max-width:100%;box-sizing:border-box}.energy-tooltip[hidden]{display:none}.energy-tooltip time{display:block;color:#c4dace;margin-bottom:8px;font-size:10px}.energy-tooltip>div{display:flex;gap:15px;justify-content:space-between;white-space:nowrap;margin-top:4px}.energy-devices{display:grid;gap:18px}.energy-device-label{display:flex;gap:15px;justify-content:space-between;font-size:12px;color:#486650;margin-bottom:7px}.energy-device-track{background:#eef4ed;height:6px;border-radius:5px;overflow:hidden}.energy-device-track span{height:100%;background:#3b9375;display:block}.energy-devices small{color:#789080;font-size:10px}@media(max-width:800px){.energy-layout{grid-template-columns:1fr}.energy-summary{grid-template-columns:repeat(2,minmax(0,1fr))}.energy-card{padding:18px}.energy-stat{padding:16px}.energy-stat strong{font-size:20px}.energy-toolbar>span{margin-left:0}.energy-device-label{font-size:11px}}

.energy-color-import{background:#3b85c2}.energy-color-export{background:#9d69bb}.energy-color-solar,.energy-color-forecast{background:#d69b22}.energy-color-consumption{background:#3b9375}.energy-color-charge{background:#6d8fb2}.energy-color-discharge{background:#ba77a6}
.energy-stat-value{display:flex;align-items:baseline;flex-wrap:wrap;gap:4px 8px}.energy-stat-percent{font-size:15px;color:#9aa5a0;font-weight:500;white-space:nowrap}
.energy-lifetime summary{cursor:pointer;font-size:16px;font-weight:700;color:#274b3f}.energy-lifetime summary:focus-visible{outline:2px solid #3b9375;outline-offset:5px;border-radius:4px}.energy-lifetime>h2{margin-top:22px;margin-bottom:8px}.energy-lifetime>.chart-note{margin-top:14px}.energy-lifetime>.energy-summary{margin-top:18px;margin-bottom:0}.energy-lifetime>.energy-notice{margin-top:14px}
.chart-settings{min-height:0;margin-bottom:20px}.chart-settings .energy-access{margin:0;border:0}.chart-settings-status{min-height:18px;padding:0 18px 12px;color:#678470;font-size:11px}

.live-energy-card{margin-bottom:22px}.live-energy-head{display:flex;justify-content:space-between;gap:15px;align-items:start}.live-energy-head h2{margin-bottom:5px}.live-status{font-size:11px;color:#789080}.live-flow-svg{display:block;width:100%;max-width:760px;margin:12px auto 0}.live-flow-line{fill:none;stroke-width:4}.flow-moving{stroke-dasharray:10 7;animation:energy-flow-motion 1s linear infinite}.live-solar-node rect{fill:#fff7e4}.live-grid-node rect{fill:#edf5fb}.live-home-node rect{fill:#e6f2e8}.live-node-label{font:14px Inter,ui-sans-serif,sans-serif;fill:#547460}.live-node-value{font:700 27px Inter,ui-sans-serif,sans-serif;fill:#274b3f}.live-node-hint{font:11px Inter,ui-sans-serif,sans-serif;fill:#789080}@keyframes energy-flow-motion{to{stroke-dashoffset:-17}}@media(prefers-reduced-motion:reduce){.flow-moving{animation:none}}

.energy-alert { display: block; margin-top: .7rem; text-align: left; }
.energy-target-dialog { border: 1px solid #c7d2c9; border-radius: 18px; padding: 24px; max-width: 480px; width: calc(100% - 32px); }
.energy-target-dialog::backdrop { background: #15291f88; }
.energy-target-dialog input { display: block; width: 100%; margin: 12px 0; }
.energy-counter-value { background: none; border: 0; color: inherit; padding: 0; text-align: left; cursor: pointer; }
.energy-counter-value:focus-visible { outline: 2px solid #3b9375; outline-offset: 4px; }
.workflow-note{color:#789080;font-size:12px;line-height:1.6;margin:12px 0 22px}.workflow-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:20px}.workflow-card,.workflow-section{background:#fff;border:1px solid #e1e8df;border-radius:16px;padding:24px;margin-bottom:20px;min-width:0}.workflow-card h2,.workflow-section h2{font-size:18px;color:#274b3f}.workflow-card h1{font-size:28px;margin-top:16px}.workflow-card-head{display:flex;justify-content:space-between;gap:15px;align-items:flex-start}.workflow-card-head p{font-size:12px;color:#789080;margin-top:8px;white-space:pre-wrap}.workflow-card-head .state-pill{flex-shrink:0}.workflow-devices{font-size:12px;color:#486650;margin-top:20px}.workflow-readonly{font-size:12px;line-height:1.7;color:#8d702c;background:#fff6e4;padding:14px;border-radius:10px;margin:16px 0}.workflow-section .section-heading{margin:0 0 18px}.workflow-section .section-heading p{font-size:12px;color:#789080;margin-top:8px}.workflow-block{border:1px solid #dce7df;background:#f7faf6;border-radius:12px;padding:18px;margin-top:12px}.workflow-block-type{display:flex;gap:18px;align-items:flex-end;flex-wrap:wrap;margin-bottom:16px}.workflow-block-type>label{flex:1;min-width:150px}.workflow-fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}.workflow-fields>label:first-child{grid-column:1/-1}.workflow-section label{display:flex;flex-direction:column;gap:7px;font-size:12px;color:#486650;min-width:0}.workflow-section input,.workflow-section select,.workflow-section textarea{font:inherit;color:#274b3f;border:1px solid #ccd9d0;border-radius:8px;background:white;padding:11px;width:100%;min-width:0}.workflow-meta{display:grid;gap:18px}.workflow-meta textarea{min-height:70px;resize:vertical}.workflow-days{grid-column:1/-1;border:0;padding:0;display:flex;gap:12px;flex-wrap:wrap}.workflow-days legend{font-size:12px;color:#486650;margin-bottom:10px}.workflow-days label{flex-direction:row;align-items:center}.workflow-days input{width:18px;height:18px;accent-color:#286c50}.workflow-block button{cursor:pointer}.workflow-section input:focus-visible,.workflow-section select:focus-visible,.workflow-section textarea:focus-visible{outline:2px solid #3b9375;outline-offset:2px}#workflow-status{font-size:12px;color:#486650;line-height:1.6;max-width:600px}#workflow-form .save-bar{padding:18px 0;margin-bottom:25px}@media(max-width:700px){.workflow-list{grid-template-columns:1fr}.workflow-card,.workflow-section{padding:18px}.workflow-fields{grid-template-columns:1fr}.workflow-block{padding:14px}.view-tabs{gap:2px}.view-tabs button{padding:10px 12px}}
#workflow-cancel{display:block;margin-bottom:12px}@media(max-width:700px){.workflow-block-type>label{flex-basis:100%}}

/* Theme preference lives in the shell, so it is available before and after login. */
:root{color-scheme:light}
.theme-picker{display:flex;align-items:center;gap:8px;font-size:12px;font-weight:700;color:#61747a}
.theme-picker select{background:#fff;color:#234c54;border:1px solid #cddbd7;border-radius:8px;padding:8px;max-width:120px;font:inherit;cursor:pointer}
.theme-picker select:focus-visible{outline:2px solid #3b9375;outline-offset:3px}
.topbar{height:auto;min-height:88px;flex-wrap:wrap;gap:12px;padding:18px 0}
@media(max-width:620px){.topbar{min-height:70px;padding:14px 0}.theme-picker>span{display:none}.theme-picker select{max-width:100px;font-size:11px;padding:7px}.top-actions{flex-wrap:wrap;gap:10px}}

:root[data-theme="dark"]{
  color-scheme:dark;
  --dark-page:#10191e;
  --dark-surface:#19272d;
  --dark-inset:#203139;
  --dark-hover:#283e43;
  --dark-border:#34474f;
  --dark-text:#e1ece9;
  --dark-muted:#afc1bb;
  --dark-accent:#9bd6ba;
  --dark-green:#244638;
  --dark-warn:#3d3221;
  --dark-warn-text:#ecd19c;
  color:var(--dark-text);
  background:var(--dark-page);
}
:root[data-theme="dark"] body{background:radial-gradient(circle at 83% 1%,#1c3030 0,transparent 27rem),var(--dark-page)}
:root[data-theme="dark"] :is(.device-card,.user-panel,.policy-panel,.workflow-card,.workflow-section,.energy-card,.energy-stat,.energy-target-dialog,.secondary,.theme-picker select){background:var(--dark-surface);color:var(--dark-text);border-color:var(--dark-border)}
:root[data-theme="dark"] :is(.entity,.metric,.workflow-block,.empty,.mode-option.chosen,.user-item.selected,.user-item:hover,.energy-flow>div,.energy-device-track){background:var(--dark-inset);border-color:var(--dark-border)}
:root[data-theme="dark"] :is(.climate-controls select,.climate-controls input,.access-row select,.energy-toolbar input,.workflow-section input,.workflow-section select,.workflow-section textarea,.energy-target-dialog input){background:var(--dark-page);color:var(--dark-text);border-color:var(--dark-border)}
:root[data-theme="dark"] :is(.welcome h1,.range-wrap strong,.metric strong,.empty h3,.energy-stat strong,.energy-flow strong,.energy-lifetime summary,.workflow-card h2,.workflow-section h2,.theme-picker){color:var(--dark-text)}
:root[data-theme="dark"] :is(.ghost,.text-button,.back-link,.all-metrics summary,.energy-device-label,.workflow-devices,.workflow-section label,.workflow-days legend,#workflow-status){color:var(--dark-accent)}
:root[data-theme="dark"] :is(.connection,.welcome p,.page-head p,.eyebrow,.type-label,.device-title p,.device-count,.entity-head p,.range-wrap,.temperatures small,.temperatures strong span,.climate-controls label,.panel-head p,.user-item small,.chevron,.aside-empty,.mode-option small,.access-heading p,.access-heading>span,.access-row small,.save-bar span,.empty,.loading,footer,.metrics-head>span,.power-now small,.history-head small,.history-chart,.chart-empty,.sensor-empty,.chart-note,.all-metrics summary span,.metric small,.metric strong span,.energy-access small,.energy-toolbar label,.energy-toolbar>span,.energy-range-label,.energy-stat small,.energy-flow small,.energy-details small,.energy-legend,.energy-devices small,.energy-stat-percent,.chart-settings-status,.live-status,.workflow-note,.workflow-card-head p,.workflow-section .section-heading p){color:var(--dark-muted)}
:root[data-theme="dark"] :is(.topbar,.device-title,.temperatures,.temperatures>div+div,.panel-head,.access-row,.save-bar,footer,.metrics-panel,.all-metrics,.view-tabs,.energy-access,.mode-option){border-color:var(--dark-border)}
:root[data-theme="dark"] .primary{background:#2e6f64;color:#fff}
:root[data-theme="dark"] .primary:hover{background:#388475}
:root[data-theme="dark"] .secondary:hover{background:var(--dark-hover)}
:root[data-theme="dark"] .brand-mark{background:#2c535c;color:#e7eee5}
:root[data-theme="dark"] .summary{background:#213e47}
:root[data-theme="dark"] :is(.power-now,.install-banner,.energy-flow .flow-home){background:var(--dark-green);border-color:#3d6452}
:root[data-theme="dark"] :is(.power-now strong,.install-banner strong){color:var(--dark-accent)}
:root[data-theme="dark"] .install-banner p{color:var(--dark-muted)}
:root[data-theme="dark"] :is(.preview-banner,.energy-notice,.workflow-readonly){background:var(--dark-warn);color:var(--dark-warn-text);border-color:#685231}
:root[data-theme="dark"] .light-icon{background:#433923;color:#e5c07b}
:root[data-theme="dark"] :is(.climate-icon,.avatar,.admin-badge){background:#2b4b42;color:var(--dark-accent)}
:root[data-theme="dark"] .state-pill{background:#304047;color:#b8cbc6}
:root[data-theme="dark"] .state-pill.active{background:var(--dark-green);color:var(--dark-accent)}
:root[data-theme="dark"] .toggle{background:#4c6067}
:root[data-theme="dark"] .toggle.is-on{background:#4ca487}
:root[data-theme="dark"] .period-switch{background:var(--dark-page)}
:root[data-theme="dark"] .period-switch button{color:var(--dark-muted)}
:root[data-theme="dark"] .period-switch button.selected{background:var(--dark-hover);color:var(--dark-text)}
:root[data-theme="dark"] .view-tabs button{color:var(--dark-muted)}
:root[data-theme="dark"] .view-tabs button.selected{background:#2e6f64;color:#fff}
:root[data-theme="dark"] .status-dot{box-shadow:0 0 0 4px #254439}
:root[data-theme="dark"] .connection.offline .status-dot{box-shadow:0 0 0 4px #47382b}
:root[data-theme="dark"] .energy-flow .solar{background:var(--dark-warn);color:#e5c07b}
:root[data-theme="dark"] .energy-flow .grid{background:#233b50;color:#92bce3}
:root[data-theme="dark"] .live-solar-node rect{fill:var(--dark-warn)}
:root[data-theme="dark"] .live-grid-node rect{fill:#233b50}
:root[data-theme="dark"] .live-home-node rect{fill:var(--dark-green)}
:root[data-theme="dark"] :is(.history-chart svg text,.energy-svg text,.live-node-label,.live-node-hint){fill:var(--dark-muted)}
:root[data-theme="dark"] .live-node-value{fill:var(--dark-text)}
:root[data-theme="dark"] .chart-grid{stroke:var(--dark-border)}
:root[data-theme="dark"] .chart-axis{stroke:#6f8781}
:root[data-theme="dark"] .energy-target-dialog::backdrop{background:#080e14bb}

.control-dialog{border:1px solid #ccd9d0;border-radius:16px;padding:24px;width:calc(100% - 32px);max-width:510px;background:#fff;color:#18333a}.control-dialog::backdrop{background:#102f3980}.control-dialog-head{display:flex;justify-content:space-between;align-items:start;gap:16px}.control-dialog h2{font-size:22px;margin-top:8px}.control-dialog label,.activity-filters label{display:flex;flex-direction:column;gap:7px;font-size:12px;color:#486650;margin:16px 0}.control-dialog input,.control-dialog select,.activity-filters select{border:1px solid #ccd9d0;border-radius:8px;padding:11px;background:#fff;color:#274b3f;font:inherit;width:100%;min-width:0}.control-dialog [hidden]{display:none}.control-dialog input:focus-visible,.control-dialog select:focus-visible,.activity-filters select:focus-visible{outline:2px solid #3b9375;outline-offset:2px}.control-note{font-size:12px;color:#789080;line-height:1.6;margin:12px 0 18px}#temporary-status,#activity-status{font-size:12px;line-height:1.6;color:#486650;margin:12px 0}.temporary-overview,.activity-card{background:#fff;border:1px solid #dce7df;border-radius:16px;padding:24px;margin-bottom:20px}.temporary-overview h2{font-size:20px;margin-top:8px}.temporary-row{display:flex;align-items:center;justify-content:space-between;gap:20px;border-top:1px solid #dce7df;padding:14px 0}.temporary-row strong,.temporary-row small{display:block;font-size:12px}.temporary-row small{color:#789080;margin-top:5px}.temporary-row:last-child{padding-bottom:0}.activity-filters{display:flex;gap:18px;flex-wrap:wrap;margin-bottom:18px}.activity-filters label{flex:1;min-width:200px}.activity-card-head{display:flex;justify-content:space-between;gap:18px;flex-wrap:wrap;font-size:12px}.activity-card-head time{color:#789080}.activity-card h3{font-size:17px;margin:12px 0 8px}.activity-card p{font-size:12px;color:#617b6b;line-height:1.6;margin-top:5px}.activity-card .control-note{margin-bottom:0}.temporary-start{text-align:left}.view-tabs{flex-wrap:wrap}
:root[data-theme="dark"] :is(.control-dialog,.temporary-overview,.activity-card){background:var(--dark-surface);color:var(--dark-text);border-color:var(--dark-border)}
:root[data-theme="dark"] :is(.control-dialog input,.control-dialog select,.activity-filters select){background:var(--dark-page);color:var(--dark-text);border-color:var(--dark-border)}
:root[data-theme="dark"] :is(.control-dialog label,.activity-filters label,#temporary-status,#activity-status){color:var(--dark-accent)}
:root[data-theme="dark"] :is(.control-note,.temporary-row small,.activity-card-head time,.activity-card p){color:var(--dark-muted)}
:root[data-theme="dark"] .temporary-row{border-color:var(--dark-border)}
:root[data-theme="dark"] .control-dialog::backdrop{background:#080e14bb}
@media(max-width:620px){.control-dialog,.temporary-overview,.activity-card{padding:18px}.temporary-row{align-items:start;flex-direction:column;gap:8px}.activity-filters{gap:0}.activity-filters label{min-width:100%}.view-tabs button{padding:10px 12px}}
#activity-more[hidden]{display:none}.control-dialog{max-height:calc(100dvh - 32px);overflow:auto}

.workflow-card-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.workflow-text-steps { padding-left: 24px; }
.workflow-step-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; line-height: 1.6; padding: 14px; border: 1px solid #dce7df; border-radius: 8px; }
:root[data-theme="dark"] .workflow-step-text { border-color: var(--dark-border); color: var(--dark-text); }

.notification-panel { background: #fff; border: 1px solid #dce7df; border-radius: 16px; padding: 24px; margin-bottom: 20px; }
.notification-panel h2 { font-size: 20px; margin-bottom: 14px; }
.notification-toggle { display: flex; align-items: center; gap: 10px; font-size: 13px; margin: 14px 0; }
.notification-toggle input { width: 18px; height: 18px; accent-color: #367c62; flex-shrink: 0; }
.notification-quiet { display: flex; flex-wrap: wrap; gap: 16px; }
.notification-quiet label { display: flex; flex-direction: column; gap: 8px; font-size: 12px; flex: 1; min-width: 140px; }
.notification-quiet input { width: 100%; min-width: 0; padding: 10px; border: 1px solid #ccd9d0; border-radius: 8px; font: inherit; }
.notification-device { border: 1px solid #dce7df; border-radius: 10px; padding: 8px 16px; margin: 20px 0; }
.notification-device legend { font-size: 15px; font-weight: 600; padding: 0 8px; }
#notification-status, #push-status { font-size: 13px; line-height: 1.6; }
:root[data-theme="dark"] .notification-panel { background: var(--dark-surface); border-color: var(--dark-border); color: var(--dark-text); }
:root[data-theme="dark"] .notification-device { border-color: var(--dark-border); }
:root[data-theme="dark"] .notification-quiet input { background: var(--dark-page); color: var(--dark-text); border-color: var(--dark-border); }
@media(max-width:620px) { .notification-panel { padding: 18px; } }

.update-guide { width: calc(100% - 32px); max-width: 680px; max-height: calc(100dvh - 32px); overflow: hidden; margin: auto; padding: 26px; border: 1px solid #ccd9d0; border-radius: 18px; background: #fff; color: #18333a; }
.update-guide::backdrop { background: #102f3980; }
.update-guide-head { display: flex; justify-content: space-between; align-items: start; gap: 16px; }
.update-guide-head h2 { font-size: 25px; margin: 8px 0 12px; }
.update-guide p { font-size: 13px; line-height: 1.65; color: #617b6b; }
.update-guide-progress { margin: 18px 0 8px; color: #367c62; font-size: 12px; font-weight: 600; }
.update-guide h3 { font-size: 20px; line-height: 1.35; margin: 0 0 8px; }
.update-guide-image { display: block; width: 100%; max-height: 245px; object-fit: contain; margin: 16px 0; border: 1px solid #dce7df; border-radius: 10px; background: #fff; }
.update-guide-steps { padding-left: 22px; font-size: 13px; line-height: 1.65; }
.update-guide-steps li { margin: 10px 0; padding-left: 4px; }
.update-guide-footer { display: flex; justify-content: space-between; gap: 12px; border-top: 1px solid #dce7df; padding-top: 16px; margin-top: 18px; }
:root[data-theme="dark"] .update-guide { background: var(--dark-surface); color: var(--dark-text); border-color: var(--dark-border); }
:root[data-theme="dark"] .update-guide p { color: var(--dark-muted); }
:root[data-theme="dark"] .update-guide-progress { color: var(--dark-accent); }
:root[data-theme="dark"] .update-guide-footer { border-color: var(--dark-border); }
:root[data-theme="dark"] .update-guide::backdrop { background: #080e14bb; }
@media(max-width:620px) { .update-guide { padding: 18px; } .update-guide-head h2 { font-size: 22px; } .update-guide-image { max-height: 190px; } }

.update-guide[open] { display: flex; flex-direction: column; }
.update-guide-head, .update-guide-footer { flex-shrink: 0; }
.update-guide-content { overflow: auto; min-height: 0; }

.connection-notice{display:flex;align-items:center;justify-content:space-between;gap:14px;margin:16px 0;padding:14px 18px;border:1px solid #dfb566;border-radius:12px;background:#fff7e5;color:#72531e;font-size:12px;line-height:1.6}.connection-notice[hidden],.command-status[hidden]{display:none}.connection-notice .text-button{flex-shrink:0;color:inherit}.command-status{margin:12px 0 4px;font-size:12px;line-height:1.5;color:#315b78}.command-status.confirmed{color:#287451}.command-status.failed,.command-status.unconfirmed{color:#995022}.entity[aria-busy="true"]{outline:1px solid #7babc2}.readings-stale :is(.temperatures,.metrics-grid,.power-now,.live-energy-card svg){opacity:.6}:root[data-theme="dark"] .connection-notice{background:#352d1e;border-color:#927340;color:#f3d496}:root[data-theme="dark"] .command-status{color:#a7cee2}:root[data-theme="dark"] .command-status.confirmed{color:#99d4ad}:root[data-theme="dark"] :is(.command-status.failed,.command-status.unconfirmed){color:#efb487}@media(max-width:620px){.connection-notice{align-items:flex-start;flex-direction:column}}

#notification-user-id,.notification-recipient-id{display:block;width:100%;margin:8px 0;padding:10px;border:1px solid #ccd9d0;border-radius:8px;background:#f7faf7;color:#234c45;font:12px monospace}:root[data-theme="dark"] :is(#notification-user-id,.notification-recipient-id){background:var(--dark-page);color:var(--dark-text);border-color:var(--dark-border)}
.admin-layout>*{min-width:0}
