:root { --glass: rgba(22, 39, 64, .67); --glass-line: rgba(174, 211, 244, .28); }
.inverter-limits-form { display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:0 18px; }
.inverter-limits-form .field { margin:14px 0; }
.inverter-limits-form input { width:100%;padding:11px 12px;border:1px solid #67809a;border-radius:10px;background:#0f1d31;color:#f2f6ff;font:inherit; }
.inverter-limits-form .subtle,.inverter-limits-form button { grid-column:1/-1; }
.inverter-limits-form button { justify-self:start;margin-top:12px; }
@media(max-width:560px){.inverter-limits-form{grid-template-columns:1fr}}
body { background: radial-gradient(circle at 50% -20%, #29456a, #071323 55%, #060e1b); }
.app-shell { max-width: 1040px; }
.scene {
  height: 230px;
  isolation: isolate;
  background: #254372 url('/sher001/app/fon.png') center 60% / cover no-repeat;
}
.scene::before {
  z-index: 0;
  background: linear-gradient(90deg, rgba(5, 17, 39, .68), rgba(7, 20, 43, .2) 65%),
    linear-gradient(0deg, rgba(7, 18, 35, .82), transparent 58%);
}
.topbar, .scene-info { z-index: 1; }
.topbar { position: relative; align-items: center; padding: 20px 23px; }
.identity { gap: 4px; }
.mountain-mark, .gate-mark {
  display: block;
  flex: none;
  width: 74px;
  height: 48px;
  background: url('/sher001/app/mountains.png') center / 108px 108px no-repeat;
  filter: drop-shadow(0 0 7px rgba(126, 215, 255, .5));
}
.house-title { font-size: 21px; text-shadow: 0 2px 9px #07162d; }
.location { margin-top: 1px; color: #d5eaff; text-shadow: 0 2px 7px #07162d; }
.menu-button {
  display: grid;
  gap: 5px;
  justify-items: end;
  border: 0;
  padding: 12px;
  background: rgba(12, 28, 51, .25);
  border-radius: 12px;
  color: #eef8ff;
}
.menu-button span { display: block; width: 22px; height: 2px; border-radius: 2px; background: currentColor; }
.menu-button:hover { background: rgba(157, 209, 255, .2); }
.scene-info { left: 25px; right: 20px; bottom: 37px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.outside-line { gap: 1px; }
.snow-mark {
  display: block;
  width: 46px;
  height: 46px;
  background: url('/sher001/app/snowflake.png') center / 62px 62px no-repeat;
  filter: drop-shadow(0 0 5px #8ce5ff);
}
.outside-line strong { display: block; font-size: 25px; line-height: 1; text-shadow: 0 2px 6px #061527; }
.outside-line small { display: block; margin-top: 3px; color: #e4f1ff; font-size: 11px; }
.connection { background: rgba(15, 33, 55, .51); backdrop-filter: blur(12px); box-shadow: inset 0 1px 0 #ffffff24; }
.hero-card, .panel, .floor-list, .detail-floor, .room-card, .mode-row, .bottom-nav {
  background: linear-gradient(145deg, rgba(39, 63, 90, .67), rgba(15, 31, 52, .68));
  border: 1px solid var(--glass-line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), 0 12px 28px rgba(0, 3, 15, .3);
  backdrop-filter: blur(18px) saturate(1.3);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
}
.hero-card { overflow: hidden; isolation: isolate; }
.hero-card::before { content: ""; position: absolute; z-index: -1; inset: 0; border-radius: inherit; pointer-events: none; background: radial-gradient(circle at 15% 22%, rgba(98, 226, 255, .15), transparent 39%), radial-gradient(circle at 90% 85%, rgba(255, 179, 89, .08), transparent 42%); }
.room-card:nth-child(odd) { box-shadow: inset 3px 0 13px rgba(255, 170, 32, .17), 0 6px 15px #0002; }
.room-card:nth-child(even) { box-shadow: inset 3px 0 13px rgba(48, 205, 255, .17), 0 6px 15px #0002; }
.sila-panel { box-shadow: inset 3px 0 16px rgba(87, 235, 159, .1), 0 12px 28px rgba(0, 3, 15, .3); }
.hero-card { grid-template-columns: 1.05fr .95fr; margin-top: -29px; padding: 8px 17px; min-height: 196px; }
.gauge-wrap { width: min(100%, 245px); aspect-ratio: 260 / 190; }
.gauge-track, .gauge-fill { stroke-width: 15; }
.gauge-track { stroke: rgba(182, 209, 239, .13); }
.gauge-fill { filter: drop-shadow(0 0 9px rgba(38, 216, 255, .35)); }
#gauge-dot { fill: #fff; stroke: #ffefcd; stroke-width: 3; filter: drop-shadow(0 0 8px #fff); transition: cx .8s ease, cy .8s ease; }
.gauge-center { top: 27%; gap: 1px; }
.gauge-title { font-size: 14px; font-weight: 700; }
.gauge-title svg { width: 19px; height: 19px; }
.gauge-caption { color: #d6e6f8; font-size: 12px; }
.gauge-center strong { font-size: clamp(35px, 5vw, 51px); line-height: 1; }
.gauge-state { margin-top: 4px; color: #ffc05b; font-size: 11px; white-space: nowrap; }
.target-control { gap: 8px; }
.target-label { font-size: 13px; }
.target-sync { display: inline-block; width: 10px; height: 10px; margin-left: 3px; vertical-align: middle; border: 2px solid #ffcb58; border-top-color: transparent; border-radius: 50%; animation: sync-turn .9s linear infinite; }
.target-sync[data-state="ok"] { border: 0; background: #62e7aa; box-shadow: 0 0 8px #62e7aa; animation: none; }
.target-sync[data-state="error"] { border: 0; background: #ff9c71; box-shadow: 0 0 8px #ff9c71; animation: none; }
@keyframes sync-turn { to { transform: rotate(360deg); } }
.target-stepper { background: rgba(58, 80, 108, .56); border-color: rgba(190, 216, 245, .27); box-shadow: inset 0 2px 7px #040c2038; }
.target-stepper button { width: 43px; height: 42px; }
.target-stepper strong { height: 42px; }
.target-control .accent-button { padding: 7px 14px; border-radius: 10px; }
.control-feedback { display: flex; align-items: center; justify-content: center; min-height: 45px; margin: 7px 16px 0; padding: 5px 12px; border: 1px solid rgba(86, 197, 231, .48); border-radius: 11px; background: linear-gradient(135deg, rgba(23, 64, 86, .85), rgba(18, 39, 63, .92)); box-shadow: inset 0 1px 0 #fff2; color: #d8f5ff; font-size: 11px; font-weight: 650; text-align: center; }
.control-feedback[data-kind="success"] { border-color: #53c997a8; background: linear-gradient(135deg, #194e43e8, #173746e8); color: #b7f6d1; }
.control-feedback[data-kind="warning"] { border-color: #dfa25e99; background: linear-gradient(135deg, #59402ee8, #283142e8); color: #ffe0b6; }
.control-feedback:not([hidden]) + .mode-row { display: grid; }
.mode-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin: 7px 16px 0; border-radius: 11px; padding: 5px; }
.mode-tile { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 7px 10px; border: 1px solid rgba(206, 223, 248, .18); border-radius: 9px; background: linear-gradient(135deg, rgba(255, 179, 44, .16), rgba(38, 55, 82, .17)); color: #f4faff; text-align: left; }
.mode-tile + .mode-tile { background: linear-gradient(135deg, rgba(54, 207, 255, .15), rgba(38, 55, 82, .17)); }
.mode-tile:hover { background-color: rgba(124, 184, 237, .16); }
.mode-tile:active { transform: scale(.98); }
.mode-tile svg { flex: none; width: 19px; height: 19px; color: #ffc05b; }
.mode-tile + .mode-tile svg { color: #7ce0ff; }
.mode-tile span { display: grid; min-width: 0; }
.mode-tile small { color: #bcd3e9; font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mode-tile strong { font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#view-home > .section-heading { align-items: center; margin-top: 11px; margin-bottom: 7px; }
#view-home > .section-heading h1 { margin: 0; font-size: 20px; }
#view-home .floor-list { padding: 11px; }
#view-home .floor-section + .floor-section { margin-top: 10px; }
#view-home .floor-section h2 { margin-bottom: 7px; }
#view-home .room-card { border-radius: 12px; border-left-width: 3px; padding: 10px 12px; }
#view-home .room-card h3 { margin-bottom: 4px; }
#view-home .room-card .temperature { font-size: 22px; }
#view-home .room-card .room-meta { margin-top: 2px; }
#view-home .summary-grid { display: block; }
#view-home .sila-panel { padding: 12px 16px; }
#view-home .sila-panel .panel-heading { gap: 8px; }
#view-home .sila-panel .panel-heading h2 { font-size: 17px; }
#view-home .sila-panel .kicker { font-size: 9px; }
#view-home .sila-panel .panel-icon { width: 30px; height: 30px; }
#view-home .sila-panel .panel-icon svg { width: 20px; height: 20px; }
#view-home .sila-values { grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 9px; }
#view-home .sila-values span { font-size: 10px; }
#view-home .sila-values strong { font-size: 17px; margin-top: 2px; }
#view-home .panel-foot { margin: 7px 0 0; padding-top: 5px; }
.bottom-nav { width: min(calc(100% - 20px), 580px); border-color: #7193bd96; background: linear-gradient(180deg, rgba(25, 44, 75, .97), rgba(9, 23, 45, .98)); box-shadow: 0 -9px 25px rgba(0, 7, 25, .72), inset 0 1px 0 rgba(179, 220, 255, .23); }
.nav-button { transition: color .2s, transform .2s, background .2s; }
.nav-button:active { transform: scale(.92); }
.room-card { transition: border-color .25s, box-shadow .25s, background .25s; }
.room-card:hover { background: rgba(45, 75, 108, .74); box-shadow: inset 0 1px 0 #fff2, 0 8px 22px #0005; }
.app-shell:not([data-view="home"]) .scene { height: 170px; }
.app-shell:not([data-view="home"]) .scene-info { bottom: 16px; }
body:has(.gate:not([hidden])) {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  background: linear-gradient(#0815268c, #081526cb), url('/sher001/app/fon.png') center / cover fixed;
}
.gate { width: min(420px, calc(100% - 24px)); margin: auto; max-height: calc(100dvh - 24px); overflow-y: auto; overscroll-behavior: contain; background: rgba(20, 39, 65, .73); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); }
.gate-mark { width: 78px; height: 48px; margin-bottom: 11px; }
.gate .login-form input:not([type=checkbox]) { font-size: 16px; scroll-margin-block: 70px; }

@media (max-width: 740px) {
  .app-shell[data-view="home"] { display: flex; flex-direction: column; height: 100dvh; min-height: 0; overflow: hidden; padding: 0 8px calc(70px + env(safe-area-inset-bottom)); }
  .app-shell[data-view="home"] > .scene { flex: none; }
  #view-home { display: flex; flex-direction: column; flex: 1; min-height: 0; }
  body:has(.app-shell[data-view="home"]:not([hidden])) { height: 100dvh; overflow: hidden; }
  .scene { height: clamp(145px, 21dvh, 190px); border-radius: 0 0 20px 20px; }
  .topbar { padding: 10px 12px; }
  .mountain-mark { width: 60px; height: 41px; background-size: 92px 92px; }
  .house-title { font-size: 19px; }
  .location { font-size: 12px; }
  .scene-info { left: 12px; right: 12px; bottom: 29px; }
  .connection { font-size: 10px; padding: 5px 7px; max-width: 124px; }
  .hero-card { min-height: 0; height: clamp(164px, 23dvh, 194px); margin: -23px 4px 0; padding: 6px 9px; gap: 1px; border-radius: 17px; }
  .gauge-wrap { width: min(100%, 225px); }
  .gauge-center { top: 27%; }
  .gauge-center strong { font-size: clamp(28px, 7vw, 41px); }
  .gauge-title { font-size: 12px; }
  .gauge-caption { font-size: 10px; }
  .gauge-state { font-size: 9px; }
  .target-label { font-size: 11px; }
  .target-stepper button { width: 32px; height: 36px; font-size: 21px; }
  .target-stepper strong { min-width: 63px; height: 36px; font-size: 19px; }
  .target-control .accent-button { min-width: 0; padding: 6px 10px; font-size: 12px; }
  .mode-row { margin: 5px 4px 0; padding: 3px; gap: 4px; }
  .control-feedback { min-height: 32px; margin: 5px 4px 0; padding: 4px 7px; font-size: 10px; }
  .mode-tile { padding: 4px 6px; gap: 4px; }
  .mode-tile svg { width: 15px; height: 15px; }
  .mode-tile small { font-size: 8px; }
  .mode-tile strong { font-size: 10px; }
  #view-home > .section-heading { margin: 7px 5px 5px; }
  #view-home > .section-heading h1 { font-size: 16px; }
  #view-home > .section-heading .link-button { font-size: 11px; }
  #view-home .floor-list { margin: 0 4px; padding: 7px; border-radius: 12px; }
  #view-home .floor-section + .floor-section { margin-top: 6px; }
  #view-home .floor-section h2 { margin-bottom: 4px; font-size: 10px; }
  #view-home .room-grid { gap: 6px; }
  #view-home .room-card { padding: 6px 9px; min-height: 53px; }
  #view-home .room-card h3 { font-size: 11px; margin-bottom: 1px; }
  #view-home .room-card .temperature { font-size: 18px; }
  #view-home .room-card .room-meta { font-size: 9px; }
  #view-home .summary-grid { margin: auto 4px 0; }
  #view-home .sila-panel { padding: 7px 11px; border-radius: 12px; }
  #view-home .sila-panel .panel-heading h2 { font-size: 14px; }
  #view-home .sila-panel .kicker { font-size: 8px; }
  #view-home .sila-panel .panel-icon { width: 26px; height: 26px; }
  #view-home .sila-values { margin-top: 5px; gap: 4px; }
  #view-home .sila-values span { font-size: 9px; }
  #view-home .sila-values strong { font-size: 14px; }
  #view-home .panel-foot { display: none; }
  .bottom-nav { width: min(calc(100% - 12px), 520px); padding: 5px 8px calc(5px + env(safe-area-inset-bottom)); border-radius: 15px 15px 0 0; }
  .nav-button { font-size: 10px; padding: 4px 2px; gap: 2px; }
  .nav-button svg { width: 21px; height: 21px; }
}
@media (max-width: 740px) and (max-height: 790px) {
  .scene { height: clamp(116px, 20dvh, 137px); }
  .scene-info { bottom: 20px; }
  .hero-card { height: clamp(132px, 21dvh, 148px); margin-top: -17px; }
  .gauge-wrap { width: min(100%, 185px); }
  .gauge-title { font-size: 10px; }
  .gauge-caption { font-size: 9px; }
  .gauge-center strong { font-size: 29px; }
  .gauge-state { font-size: 8px; }
  .mode-row { padding-block: 2px; }
  .control-feedback { min-height: 28px; margin-top: 3px; font-size: 9px; }
  .mode-tile small { display: none; }
  #view-home .room-card { min-height: 47px; padding: 4px 7px; }
  #view-home .room-card .temperature { font-size: 16px; }
  #view-home .room-card .room-meta { font-size: 8px; }
  #view-home .floor-section + .floor-section { margin-top: 4px; }
  #view-home .sila-panel { padding: 5px 10px; }
  #view-home .sila-values { margin-top: 3px; }
  .bottom-nav { padding-top: 3px; padding-bottom: calc(3px + env(safe-area-inset-bottom)); }
}
@media (max-width: 355px) {
  .identity { gap: 0; }
  .mountain-mark { width: 52px; background-size: 82px 82px; }
  .house-title { font-size: 17px; }
  .gauge-title svg { display: none; }
  .gauge-wrap { width: min(100%, 168px); }
  .target-stepper button { width: 28px; }
  .target-stepper strong { min-width: 58px; font-size: 17px; }
}
@media (min-width: 356px) and (max-width: 740px) and (min-height: 820px) {
  .scene { height: clamp(185px, 23dvh, 215px); }
  .hero-card { height: 177px; }
  .mode-row { min-height: 52px; }
  .mode-tile { padding: 8px; }
  .mode-tile svg { width: 21px; height: 21px; }
  .mode-tile small { font-size: 9px; }
  .mode-tile strong { font-size: 11px; }
  #view-home .room-card { min-height: 67px; padding-block: 9px; }
  #view-home .sila-panel { padding-block: 10px; }
}
@media (max-width: 740px) and (max-height: 610px) {
  .scene { height: 100px; }
  .scene-info { bottom: 14px; }
  .snow-mark { width: 38px; height: 38px; background-size: 52px 52px; }
  .outside-line strong { font-size: 20px; }
  .hero-card { height: 120px; margin-top: -17px; }
  .gauge-wrap { width: min(100%, 157px); }
  .gauge-title { font-size: 9px; }
  .gauge-caption { font-size: 8px; }
  .gauge-center strong { font-size: 25px; }
  .gauge-state { font-size: 7px; margin-top: 1px; }
  .target-control { gap: 4px; }
  .target-stepper button, .target-stepper strong { height: 31px; }
  .target-control .accent-button { padding: 4px 8px; font-size: 11px; }
  .mode-row { margin-top: 3px; padding-block: 2px; }
  #view-home > .section-heading { margin-top: 4px; margin-bottom: 3px; }
  #view-home .floor-list { padding: 5px; }
  #view-home .floor-section h2 { margin-bottom: 2px; }
  #view-home .floor-section + .floor-section { margin-top: 2px; }
  #view-home .room-card { min-height: 35px; padding: 1px 6px; }
  #view-home .room-card h3 { font-size: 10px; }
  #view-home .room-card .temperature { font-size: 14px; line-height: 1; }
  #view-home .room-card .room-meta { font-size: 7px; }
  #view-home .summary-grid { margin-top: 3px; }
  #view-home .sila-panel { padding: 4px 8px; }
  #view-home .sila-panel .panel-icon { width: 22px; height: 22px; }
  #view-home .sila-panel .panel-heading h2 { font-size: 12px; }
  #view-home .sila-values { margin-top: 2px; }
  #view-home .sila-values strong { font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) { #gauge-dot, .nav-button, .room-card { transition: none; } .target-sync { animation: none; } }

/* Battery is shown only from a fresh room sample: 3500 mV = 0%, 4700 mV = 100%. */
.room-card h3 { padding-right: 54px; }
.battery-indicator { position: absolute; top: 20px; right: 18px; display: inline-flex; align-items: center; gap: 4px; color: #b3edc4; font-size: 10px; font-weight: 700; white-space: nowrap; }
.battery-shell { position: relative; display: block; box-sizing: border-box; width: 21px; height: 11px; padding: 2px; border: 1px solid currentColor; border-radius: 3px; }
.battery-shell::after { content: ""; position: absolute; top: 3px; right: -4px; width: 2px; height: 3px; border-radius: 0 1px 1px 0; background: currentColor; }
.battery-fill { display: block; height: 100%; max-width: 100%; border-radius: 1px; background: currentColor; transition: width .25s ease; }
.battery-indicator.warning { color: #ffd072; }
.battery-indicator.low { color: #ff8e78; }
.battery-indicator.unknown { color: #94a6b7; }
.push-preferences { margin-top: 18px; border-top: 1px solid #7890a344; padding-top: 16px; }
.settings-grid #test-push { display: block; margin: 12px 0 0; }
.push-preferences fieldset { display: grid; gap: 7px; margin: 10px 0 13px; padding: 0; border: 0; }
.push-preferences legend { margin-bottom: 11px; color: #e6eef8; font-size: 13px; font-weight: 700; }
.push-preferences label { display: flex; align-items: center; gap: 10px; color: #d4e1ee; font-size: 13px; line-height: 1.3; }
.push-preferences input { flex: none; width: 19px; height: 19px; accent-color: #ffc13d; }
.push-preferences fieldset:disabled { opacity: .55; }
#push-message:empty, #push-preferences-message:empty { display: none; }
#view-home .battery-indicator { top: 9px; right: 10px; }
@media (max-width: 740px) and (max-height: 700px) {
  #view-home .battery-indicator { top: 5px; right: 8px; font-size: 8px; }
  #view-home .battery-shell { width: 16px; height: 9px; padding: 1px; }
  #view-home .battery-shell::after { top: 2px; right: -3px; }
}

/* Owner dashboard: the room cards absorb the available height instead of a blank gap. */
.app-shell:not([data-view="home"]) .scene { display: none; }
.app-shell:not([data-view="home"]) .page-heading { margin-top: 22px; }
.notification-button { position: relative; display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid #9bc2e366; border-radius: 12px; background: #10243bab; color: #edf8ff; }
.notification-button svg { width: 25px; height: 25px; }
#unread-count { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 1px 3px; border-radius: 20px; background: #ffc13d; color: #17243a; font-size: 10px; font-weight: 800; line-height: 16px; }
.modal-backdrop { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 18px; background: #020816b8; backdrop-filter: blur(9px); -webkit-backdrop-filter: blur(9px); }
.modal-window { position: relative; width: min(100%, 510px); max-height: min(80dvh, 720px); overflow-y: auto; border: 1px solid #8ba8c488; border-radius: 20px; background: #14243a; box-shadow: 0 28px 90px #000b; }
.modal-close { position: absolute; z-index: 1; right: 12px; top: 9px; width: 35px; height: 35px; border: 0; background: transparent; color: #ecf5ff; font-size: 28px; }
.notification-panel { border: 0; box-shadow: none; background: transparent; padding: 25px 21px 20px; }
.notification-panel .section-heading { margin: 0 36px 15px 0; }
.notification-panel .events { max-height: min(60dvh, 560px); }
.exit-window { padding: 24px; }
.exit-window h2 { margin: 0 0 10px; }
.exit-window p { color: #c8d9ec; line-height: 1.5; }
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 20px; }
.danger-button { border: 1px solid #ff9a7b; border-radius: 10px; padding: 10px 15px; background: #a43a32; color: white; font: inherit; }
.mode-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; padding: 0; background: none; border: 0; }
.mode-choice { display: grid; place-items: center; align-content: center; gap: 2px; min-width: 0; min-height: 58px; padding: 5px 3px; border: 1px solid #7895b188; border-radius: 11px; background: linear-gradient(150deg, #263e5a, #14233b); color: #edf5ff; font-size: 12px; font-weight: 650; text-align: center; line-height: 1.12; }
.mode-choice svg { width: 21px; height: 21px; }
.mode-choice.active { border-color: #ffc145; background: linear-gradient(140deg, #da8518, #8c380d); box-shadow: 0 0 18px #f9a82a77, inset 0 1px 0 #ffe09d88; }
.mode-choice.is-off { border-color: #ff9b78; color: #ffc3ad; }
.mode-choice:active { transform: scale(.97); }
.summary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.sila-values small { display: block; color: #99b5cb; font-size: 10px; }
.sila-values .power-reading { display: flex; align-items: baseline; gap: 4px; white-space: nowrap; }
.sila-values .power-reading small { display: inline; margin: 0; }
.energy-panel { box-shadow: inset 3px 0 16px #58a9ff19, 0 12px 28px #030d2c4d; }
.energy-icon { color: #ffc13d; font-size: 25px; }
.energy-now { display: inline-block; margin-top: 13px; font-size: 29px; line-height: 1; }
.energy-unit { margin-left: 5px; color: #b9cde1; font-size: 12px; }
.energy-today { margin-top: 9px; color: #d8ecff; font-size: 13px; }
.energy-panel p { margin: 7px 0 0; color: #a8bdd0; font-size: 10px; }
.mode-presets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.mode-presets label { display: grid; gap: 5px; color: #cbd9e8; font-size: 13px; }
.mode-presets input { width: 100%; padding: 9px; border: 1px solid #67809a; border-radius: 9px; background: #0f1d31; color: #f2f6ff; font: inherit; }
.mode-presets button, .mode-presets .feedback { grid-column: 1 / -1; }
@media (max-width: 740px) {
  #view-home .floor-list { display: grid; grid-template-rows: repeat(2, minmax(0, 1fr)); flex: 1; min-height: 0; }
  #view-home .floor-section { display: flex; flex-direction: column; min-height: 0; }
  #view-home .room-grid { flex: 1; min-height: 0; }
  #view-home .room-card { display: flex; flex-direction: column; justify-content: center; }
  #view-home .room-card h3 { padding-right: 43px; }
  #view-home .summary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin: 7px 4px 0; }
  #view-home .summary-grid .panel { min-width: 0; padding: 7px 8px; }
  #view-home .sila-panel .panel-heading { gap: 4px; }
  #view-home .sila-panel .panel-icon { display: none; }
  #view-home .sila-panel .status-chip { padding: 3px 4px; font-size: 8px; }
  #view-home .sila-panel .kicker { display: none; }
  #view-home .sila-panel .panel-heading h2, #view-home .energy-panel h2 { margin: 0; font-size: 13px; }
  #view-home .sila-values { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px 8px; margin-top: 6px; }
  #view-home .sila-values span { font-size: 9px; }
  #view-home .sila-values strong { font-size: 13px; }
  #view-home .energy-panel .kicker { display: none; }
  #view-home .energy-icon { font-size: 17px; }
  #view-home .energy-now { margin-top: 7px; font-size: 22px; }
  #view-home .energy-unit { font-size: 9px; }
  #view-home .energy-today { margin-top: 5px; font-size: 10px; }
  #view-home .energy-panel p { font-size: 8px; }
  .mode-row { margin: 5px 4px 0; gap: 4px; }
  .mode-choice { min-height: 50px; font-size: 10px; }
  .mode-choice svg { width: 18px; height: 18px; }
  .mode-choice.power-choice { font-size: 9px; }
}
@media (max-width: 740px) and (max-height: 700px) {
  .mode-choice { min-height: 39px; font-size: 9px; }
  .mode-choice svg { width: 15px; height: 15px; }
  #view-home .summary-grid .panel { padding: 5px 7px; }
  #view-home .energy-panel p { display: none; }
}
@media (max-width: 740px) and (max-height: 610px) {
  .app-shell[data-view="home"] { padding-bottom: calc(56px + env(safe-area-inset-bottom)); }
  .scene { height: 82px; }
  .topbar { padding-top: 5px; }
  .mountain-mark { height: 37px; }
  .scene-info { bottom: 10px; }
  .snow-mark { width: 25px; height: 25px; background-size: 38px 38px; }
  .outside-line strong { font-size: 16px; }
  .outside-line small { font-size: 8px; }
  .hero-card { height: 106px; margin-top: -9px; }
  .gauge-wrap { width: min(100%, 135px); }
  .gauge-center { top: 27%; }
  .gauge-center strong { font-size: 22px; }
  .target-control { gap: 2px; }
  .target-stepper button, .target-stepper strong { height: 27px; }
  .target-control .accent-button { padding: 2px 7px; }
  .mode-choice { min-height: 36px; }
  .mode-choice svg { width: 14px; height: 14px; }
  #view-home .floor-list { padding: 4px; }
  #view-home .floor-section h2 { line-height: 1; margin-bottom: 2px; }
  #view-home .floor-section + .floor-section { margin-top: 3px; }
  #view-home .room-card { min-height: 0; padding: 2px 5px; }
  #view-home .room-card h3 { font-size: 9px; line-height: 1; margin-bottom: 2px; }
  #view-home .room-card .temperature { font-size: 13px; line-height: 1; }
  #view-home .room-card .room-meta { font-size: 7px; margin-top: 1px; }
  #view-home .battery-indicator { top: 2px; right: 4px; font-size: 7px; }
  #view-home .battery-shell { width: 12px; height: 8px; }
  #view-home .summary-grid .panel { min-height: 92px; }
  #view-home .energy-now { margin-top: 3px; font-size: 17px; }
  #view-home .energy-today { margin-top: 2px; }
  #view-home .sila-values strong { font-size: 11px; }
}

/* The status toast floats above the navigation and never changes dashboard height. */
#control-message.control-feedback:not([hidden]) {
  position: fixed;
  z-index: 25;
  left: 50%;
  bottom: calc(80px + env(safe-area-inset-bottom));
  width: min(420px, calc(100vw - 26px));
  min-height: 0;
  margin: 0;
  padding: 11px 14px;
  transform: translateX(-50%);
  border-radius: 13px;
  box-shadow: 0 13px 36px #0009;
  pointer-events: none;
}

/* Save results use the global toast, leaving settings cards at a stable height. */
#source-message, #guest-message, #presets-message, #tariff-message,
#push-message, #push-preferences-message, #password-message { display: none; }
.target-control.manual-disabled .target-label,
.target-control.manual-disabled #target-value { color: #97a2b2; text-shadow: none; }
.target-control.manual-disabled .target-stepper { filter: grayscale(1); opacity: .58; }
.target-control.manual-disabled #save-control { filter: grayscale(1); box-shadow: none; }
.mode-choice:not(.power-choice):disabled {
  border-color: #65718488;
  background: linear-gradient(150deg, #283345, #172030);
  color: #9ca9b9;
  box-shadow: none;
  filter: grayscale(1);
  opacity: .55;
}

.battery-indicator,
#view-home .battery-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  top: 10px;
  right: 12px;
  min-width: 30px;
  line-height: 1;
}
.battery-indicator .battery-shell { width: 25px; height: 13px; }
.battery-indicator .battery-percent { font-size: 10px; line-height: 1.15; }
.detail-floor .battery-indicator { top: 21px; right: 21px; }
#view-home .room-card h3 { padding-right: 38px; }
@media (max-width: 740px) and (max-height: 700px) {
  #view-home .battery-indicator { top: 4px; right: 6px; gap: 0; }
  #view-home .battery-indicator .battery-shell { width: 18px; height: 9px; }
  #view-home .battery-indicator .battery-percent { font-size: 8px; }
  #view-home .floor-section { overflow: hidden; }
  #view-home .room-grid { grid-template-rows: minmax(0, 1fr); }
  #view-home .room-card { min-height: 0; overflow: hidden; }
}

.inverter-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 37px;
  height: 37px;
  color: #7de2ff;
  border: 1px solid #74cfff88;
  border-radius: 11px;
  background: radial-gradient(circle, #3fcdfc35, #132b47);
  box-shadow: 0 0 11px #45c6ff33;
}
.inverter-icon svg { width: 26px; height: 26px; }
.inverter-ring { stroke-dasharray: 3 3; opacity: .72; }
.inverter-rotor { transform-origin: 16px 16px; }
.inverter-icon.running { color: #ffc567; box-shadow: 0 0 15px #ffc56777; }
.inverter-icon.running .inverter-rotor { animation: inverter-turn 2.6s linear infinite; }
@keyframes inverter-turn { to { transform: rotate(360deg); } }
.energy-panel .panel-heading { gap: 4px; }
.energy-panel .panel-heading > div { min-width: 0; }
.energy-panel h2 { letter-spacing: -.025em; }
.energy-icon { line-height: 1; }

.app-shell:not([data-view="home"]) .view { padding-top: 25px; }
.app-shell:not([data-view="home"]) .page-heading {
  margin: 0 16px 20px;
  padding: 19px 20px 18px;
  border: 1px solid #7e9fc354;
  border-radius: 17px;
  background: linear-gradient(145deg, #294766b0, #142943a8);
  box-shadow: inset 0 1px 0 #e1f4ff1a;
}
.page-heading .kicker { margin-bottom: 8px; }
.page-heading h1 { margin: 0 0 8px; }
.page-heading p { margin: 0; }
.page-heading p + p { margin-top: 8px; }
.diagnostics-panel summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; list-style: none; font-weight: 700; font-size: 18px; }
.diagnostics-panel summary::-webkit-details-marker { display: none; }
.diagnostics-panel summary::after { content: "⌄"; margin-left: auto; color: #ffbf57; font-size: 24px; line-height: 1; transition: transform .2s; }
.diagnostics-panel[open] summary::after { transform: rotate(180deg); }
.diagnostics-panel summary small { font-size: 11px; font-weight: 400; }
.diagnostics-body { margin-top: 17px; padding-top: 14px; border-top: 1px solid #7896b144; }

.chart-panel { overflow: visible; }
.chart-panel h2 { font-size: 18px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 7px; margin: 13px 0 10px; }
.chart-legend button {
  border: 1px solid color-mix(in srgb, var(--series-color) 65%, #41516a);
  border-radius: 99px;
  padding: 5px 9px;
  background: color-mix(in srgb, var(--series-color) 15%, #172940);
  color: #e9f5ff;
  font-size: 11px;
  line-height: 1.2;
}
.chart-legend button::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: var(--series-color); }
.chart-legend button:not(.active) { opacity: .45; background: transparent; }
.chart-legend button:not(.active)::before { background: #8ea2b5; }
.chart-frame { position: relative; }
.chart { min-height: 0; touch-action: pan-y; cursor: crosshair; }
.chart-tooltip {
  position: absolute;
  z-index: 3;
  bottom: calc(100% + 5px);
  width: max-content;
  max-width: min(220px, 66%);
  padding: 9px 11px;
  transform: translateX(-50%);
  border: 1px solid #a7c6e888;
  border-radius: 10px;
  background: #0b2037f2;
  box-shadow: 0 8px 25px #0009;
  color: #edf7ff;
  font-size: 11px;
  pointer-events: none;
}
.chart-tooltip strong, .chart-tooltip span { display: block; white-space: nowrap; }
.chart-tooltip strong { margin-bottom: 5px; }
.chart-tooltip span { margin-top: 3px; }
.chart-tooltip span::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: var(--series-color); }

@media (max-width: 740px) {
  .scene-info { bottom: 41px; }
  .target-control { gap: 12px; }
  .target-control .accent-button { min-width: 132px; padding: 8px 13px; font-size: 13px; }
  #view-home .floor-list { grid-template-rows: repeat(2, minmax(0, 1fr)); }
  #view-home .floor-section + .floor-section { margin-top: 0; }
  #view-home .floor-section { justify-content: center; }
  #view-home .room-grid { flex: 0 1 auto; min-height: 0; }
  #view-home .room-card { min-height: 0; }
  #view-home .summary-grid .panel-heading { min-height: 26px; }
  #view-home .inverter-icon { width: 23px; height: 23px; border-radius: 7px; }
  #view-home .inverter-icon svg { width: 18px; height: 18px; }
  #view-home .sila-panel .panel-heading h2, #view-home .energy-panel h2 { font-size: 12px; }
  .app-shell:not([data-view="home"]) .view { padding-top: 26px; }
  .app-shell:not([data-view="home"]) .page-heading { margin: 0 13px 20px; padding: 17px 16px; }
  .diagnostics-panel summary { flex-wrap: wrap; font-size: 15px; }
  .diagnostics-panel summary small { order: 3; width: 100%; }
}
@media (max-width: 740px) and (max-height: 790px) {
  .scene-info { bottom: 31px; }
  .target-control { gap: 9px; }
  .target-control .accent-button { padding: 6px 12px; }
}
@media (max-width: 740px) and (max-height: 660px) {
  .scene { height: clamp(105px, 18dvh, 120px); }
  .scene-info { bottom: 19px; }
  .hero-card { height: 130px; }
  .target-control { gap: 7px; }
  #view-home .room-card {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    align-content: center;
    column-gap: 3px;
    padding: 1px 5px;
  }
  #view-home .room-card h3 { grid-column: 1 / -1; grid-row: 1; margin: 0; }
  #view-home .room-card .temperature { grid-column: 1; grid-row: 2; }
  #view-home .room-card .room-meta { grid-column: 2; grid-row: 2; justify-content: flex-start; align-self: end; margin: 0 0 1px; text-align: left; white-space: nowrap; }
}
@media (max-width: 740px) and (max-height: 610px) {
  .scene { height: 90px; }
  .hero-card { height: 106px; }
  .scene-info { bottom: 12px; }
  .target-control { gap: 5px; }
  .target-control .accent-button { padding: 4px 9px; font-size: 11px; }
  #view-home .floor-section h2 { margin-bottom: 1px; }
}
@media (max-width: 740px) and (max-height: 700px) {
  #view-home .energy-panel p { display: block; margin-top: 6px; font-size: 8px; }
}
@media (prefers-reduced-motion: reduce) { .inverter-icon.running .inverter-rotor { animation: none; } }

/* Home is a fixed dashboard, including after returning from a scrolled page. */
html:has(.app-shell[data-view="home"]:not([hidden])) { height: 100dvh; overflow: hidden; scroll-behavior: auto; }
html:has(.app-shell[data-view="home"]:not([hidden])) body { height: 100dvh; overflow: hidden; overscroll-behavior: none; }
.app-shell[data-view="home"] { touch-action: none; }
.identity { gap: 11px; }
.outside-line > div { display: grid; justify-items: center; }
.outside-line small { text-align: center; }
.room-card .temperature { display: flex; align-items: center; gap: 5px; }
.room-card .room-meta { display: flex; align-items: center; justify-content: flex-start; gap: 5px; }
.metric-icon { width: 18px; height: 18px; flex: none; stroke-width: 1.9; }
.temp-icon { color: #ffbc65; }
.humidity-icon { width: 14px; height: 14px; color: #69d8ed; }
.room-card.stale .metric-icon { color: #91a7bc; }
.room-card .metric-value { min-width: 0; white-space: nowrap; }
.sila-panel .panel-heading > div { margin-left: 4px; }
.notification-panel .section-heading { gap: 10px; }
.notification-panel .section-heading h2 { margin-right: auto; }
#clear-notifications { color: #ffc989; }
.chart-series-choice { display: inline-flex; align-items: center; gap: 5px; padding: 5px 9px; border: 1px solid var(--series-color); border-radius: 99px; background: #21344a; color: #eaf5ff; font-size: 11px; cursor: pointer; }
.chart-series-choice input { width: 15px; height: 15px; margin: 0; accent-color: var(--series-color); }
.chart-series-choice:has(input:not(:checked)) { opacity: .54; background: transparent; }
.chart-series-choice:has(input:focus-visible) { outline: 2px solid #fff; outline-offset: 2px; }
.chart-legend .chart-series-choice > span::before { content: none; }
.chart-legend-swatch { display: inline-block; flex: none; width: 13px; height: 3px; border-radius: 3px; }
@media (max-width: 740px) {
  #view-home .floor-section { justify-content: stretch; }
  #view-home .room-grid { flex: 1 1 auto; grid-template-rows: minmax(0, 1fr); }
  #view-home .room-card {
    height: 100%;
    grid-template-columns: max-content minmax(0, 1fr);
    column-gap: 8px;
  }
  #view-home .room-card .temperature { font-size: clamp(16px, 3dvh, 26px); }
  #view-home .room-card .room-meta { justify-self: start; }
}
@media (max-width: 740px) and (max-height: 700px) {
  #view-home .room-card .temperature { font-size: 16px; }
}
@media (max-width: 740px) and (max-height: 610px) {
  #view-home .room-card .temperature { font-size: 13px; }
}
@media (max-width: 740px) {
  #view-home > .section-heading { margin-top: 4px; margin-bottom: 3px; }
  #view-home > .section-heading h1 { font-size: 13px; }
  #view-home .room-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    align-content: center;
    row-gap: 1px;
  }
  #view-home .room-card h3 {
    grid-column: 1 / -1;
    grid-row: 1;
    align-self: end;
    margin: 0;
    line-height: 1.1;
  }
  #view-home .room-card .temperature { grid-column: 1; grid-row: 2; min-width: 0; }
  #view-home .room-card .room-meta {
    grid-column: 2;
    grid-row: 2;
    align-self: center;
    justify-self: end;
    min-width: 0;
    margin: 0;
    white-space: nowrap;
  }
}
@media (max-width: 740px) {
  .chart-legend[data-chart="history-room"] { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .chart-legend[data-chart="history-room"] .chart-series-choice { width: 100%; min-width: 0; }
  .chart-legend[data-chart="history-room"] .chart-series-choice span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
@media (max-width: 740px) and (max-height: 540px) {
  .hero-card { height: 90px; }
  .gauge-wrap { width: min(100%, 120px); }
  .gauge-center strong { font-size: 19px; }
  .mode-choice { min-height: 32px; }
  #view-home .summary-grid .panel { min-height: 70px; padding: 3px 6px; }
  #view-home .sila-values { gap: 1px 4px; margin-top: 2px; line-height: 1; }
  #view-home .sila-values span { font-size: 8px; line-height: 1; }
  #view-home .sila-values strong { font-size: 11px; line-height: 1; margin-top: 0; }
  #view-home .sila-values .power-reading small { display: inline; font-size: 8px; }
  #view-home .energy-now { font-size: 17px; margin-top: 3px; }
  #view-home .energy-today { font-size: 9px; margin-top: 2px; }
  #view-home .energy-panel p { display: none; }
  #view-home .battery-indicator { top: 1px; right: 3px; }
  #view-home .battery-indicator .battery-shell { width: 13px; height: 6px; }
  #view-home .battery-indicator .battery-percent { font-size: 6px; line-height: 1; }
}
@media (max-width: 740px) {
  .identity { gap: 9px; }
  #view-home .metric-icon { width: 13px; height: 13px; }
  #view-home .humidity-icon { width: 10px; height: 10px; }
  #view-home .room-card .temperature { gap: 2px; }
  #view-home .room-card .room-meta { gap: 2px; }
}
@media (max-width: 740px) and (max-height: 660px) {
  #view-home .metric-icon { width: 10px; height: 10px; }
  #view-home .humidity-icon { width: 8px; height: 8px; }
  #view-home .room-card .temperature,
  #view-home .room-card .room-meta { gap: 1px; }
}
@media (max-width: 740px) {
  #view-home .room-card { grid-template-columns: max-content minmax(0, 1fr); }
  #view-home .room-card .room-meta { justify-self: start; }
  .app-shell[data-view="home"] { padding-bottom: calc(63px + env(safe-area-inset-bottom)); }
  #view-home .floor-list { row-gap: 7px; }
  #view-home .room-card h3 { font-size: clamp(11px, 1.6dvh, 14px); }
  #view-home .room-card .temperature { font-size: clamp(19px, 3.5dvh, 30px); line-height: 1; }
  #view-home .room-card .room-meta { font-size: clamp(9px, 1.3dvh, 11px); }
}
@media (max-width: 740px) and (max-height: 700px) {
  #view-home .room-card h3 { font-size: 12px; }
  #view-home .room-card .temperature { font-size: 20px; }
  #view-home .room-card .room-meta { font-size: 9px; }
}
@media (max-width: 740px) and (max-height: 610px) {
  .app-shell[data-view="home"] { padding-bottom: calc(56px + env(safe-area-inset-bottom)); }
  #view-home .floor-list { row-gap: 0; }
  #view-home .room-card h3 { font-size: 10px; }
  #view-home .room-card .temperature { font-size: 16px; }
  #view-home .room-card .room-meta { font-size: 7px; }
}
@media (max-width: 740px) and (max-height: 540px) {
  #view-home .room-card .temperature { font-size: 13px; }
}
.chart text { font-weight: 400; stroke: none; }
#view-charts .range-switch {
  position: sticky;
  top: 0;
  z-index: 8;
  display: flex;
  width: max-content;
  max-width: calc(100% - 30px);
  margin-inline: auto;
  border-color: #91b5d9;
  background: linear-gradient(135deg, rgba(38, 83, 119, .98), rgba(26, 54, 91, .98));
  box-shadow: 0 8px 22px #071322a8, inset 0 1px 0 #d9f1ff3d;
  backdrop-filter: blur(14px);
}
#view-charts .range-button.active {
  background: linear-gradient(135deg, #f2b644, #bb681e);
  color: #13243b;
  box-shadow: 0 2px 10px #ffba4e6b;
  font-weight: 700;
}
#view-charts .range-button { white-space: nowrap; }
@media (max-width: 430px) {
  #view-charts .range-button { padding: 8px clamp(5px, 2vw, 10px); font-size: 12px; }
}
#energy-chart-panel { scroll-margin-top: 70px; }
#view-home .energy-panel { cursor: pointer; }
#view-home .energy-panel:focus-visible { outline: 2px solid #ffbd55; outline-offset: 3px; }
.energy-bar { transition: stroke-width .15s, filter .15s, opacity .15s; }
.energy-bar.selected { stroke: #fff4c7; stroke-width: 3; filter: drop-shadow(0 0 8px #ffdc83); }
.battery-indicator { padding: 0; border: 0; background: transparent; cursor: pointer; font-family: inherit; }
.battery-indicator:focus-visible { outline: 2px solid #a7ec71; outline-offset: 4px; border-radius: 3px; }
.battery-window { padding: 27px 24px 23px; background: linear-gradient(155deg, #233d59, #13243c 65%); }
.battery-window h2 { margin: 8px 35px 20px 0; font-size: 24px; }
.battery-visual { display: flex; align-items: center; justify-content: center; gap: 24px; padding: 24px 12px; border: 1px solid #a4c5dc55; border-radius: 15px; background: #0d2037a8; }
.battery-visual strong { min-width: 85px; color: #e6fbef; font-size: 36px; }
.battery-visual-shell { position: relative; display: block; width: 116px; height: 55px; padding: 5px; border: 4px solid #d7edfd; border-radius: 10px; }
.battery-visual-shell::after { content: ""; position: absolute; top: 13px; right: -11px; width: 7px; height: 21px; border-radius: 0 4px 4px 0; background: #d7edfd; }
.battery-visual-shell > span { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, #4bd894, #a7ec71); transition: width .25s; }
#battery-visual-fill[data-level="low"] { background: linear-gradient(90deg, #ed685f, #ffa470); }
#battery-visual-fill[data-level="medium"] { background: linear-gradient(90deg, #e6a94d, #f6dc83); }
#battery-visual-fill[data-level="unknown"] { background: #8294a8; }
.battery-details { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.battery-details > div { display: grid; gap: 6px; padding: 12px; border: 1px solid #a4c5dc44; border-radius: 12px; background: #1b334c88; }
.battery-details span { color: #a9c1d3; font-size: 12px; }
.battery-details strong { color: #f1f8ff; font-size: 17px; }
.battery-window > p { margin: 17px 0 0; line-height: 1.5; }
.sila-panel { cursor: pointer; }
.sila-panel:focus-visible { outline: 2px solid #8debc0; outline-offset: 3px; }
.sila-setpoint-window { padding: 27px 24px 23px; background: linear-gradient(155deg, #233c58, #10243c 65%); }
.sila-setpoint-window h2 { margin: 8px 38px 12px 0; font-size: 24px; }
.sila-setpoint-window > p { line-height: 1.5; }
#sila-slider-value { display: block; margin: 24px 0 15px; color: #f4fbff; font-size: 45px; font-weight: 750; text-align: center; text-shadow: 0 0 23px #79e6bd77; }
#sila-slider { display: block; width: 100%; height: 16px; margin: 0; accent-color: #89eac4; cursor: pointer; }
#sila-slider[hidden], #sila-slider-scale[hidden] { display: none; }
#sila-slider:disabled { opacity: .42; cursor: default; }
#sila-slider:not([hidden]) {
  height: 12px;
  border-radius: 99px;
  background: linear-gradient(90deg, #24d5ef, #69e7d5 40%, #ffc051 72%, #f16c51);
  appearance: none;
  -webkit-appearance: none;
  box-shadow: inset 0 2px 6px #07142866, 0 0 18px #3fd5eb36;
}
#sila-slider::-webkit-slider-thumb {
  width: 29px;
  height: 29px;
  border: 3px solid #ffe2a5;
  border-radius: 50%;
  background: #fff;
  -webkit-appearance: none;
  box-shadow: 0 2px 9px #071428aa, 0 0 16px #fff8;
}
#sila-slider::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border: 3px solid #ffe2a5;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 9px #071428aa, 0 0 16px #fff8;
}
.sila-setpoint-window .target-scale { margin-top: 9px; }
#sila-setpoint-message { min-height: 1.5em; margin: 15px 0 0; }
.sila-setpoint-window .modal-actions { margin-top: 10px; }
@supports (-webkit-touch-callout: none) {
  html:has(.app-shell:not([data-view="home"]):not([hidden])),
  body:has(.app-shell:not([data-view="home"]):not([hidden])) {
    overscroll-behavior-y: none;
  }
  body:has(.app-shell:not([data-view="home"]):not([hidden]))::before {
    content: "";
    position: fixed;
    z-index: 25;
    top: 0;
    left: 0;
    right: 0;
    height: env(safe-area-inset-top);
    background: #101b30;
    pointer-events: none;
  }
}
.target-control .accent-button { margin-top: 5px; }
@media (max-width: 740px) and (max-height: 700px) {
  .target-control .accent-button { margin-top: 2px; }
}

/* Desktop windows can scroll; the fixed, screen-height layout is for phones. */
@media (min-width: 741px) {
  html:has(.app-shell[data-view="home"]:not([hidden])) {
    height: auto;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
  }
  html:has(.app-shell[data-view="home"]:not([hidden])) body {
    height: auto;
    min-height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: auto;
  }
  .app-shell[data-view="home"] {
    height: auto;
    min-height: 100dvh;
    overflow: visible;
    padding-bottom: 24px;
    touch-action: auto;
  }
  .app-shell:not([data-view="home"]) { padding-bottom: 24px; }
  #view-home .summary-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }
  .bottom-nav {
    position: static;
    width: min(580px, calc(100% - 32px));
    margin: 18px auto 0;
    transform: none;
    border-bottom: 1px solid #7193bd96;
    border-radius: 17px;
  }
}

@media (min-width: 1100px) {
  .app-shell[data-view="home"] { max-width: 1400px; }
  #view-home {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr);
    grid-template-areas:
      "hero hero"
      "modes modes"
      "heading summary"
      "rooms summary";
    column-gap: 14px;
    align-items: start;
  }
  #view-home .hero-card { grid-area: hero; margin: -29px 16px 4px; }
  #view-home .mode-row { grid-area: modes; margin: 7px 16px 0; }
  #view-home > .section-heading { grid-area: heading; margin: 11px 0 7px 16px; }
  #view-home .floor-list {
    grid-area: rooms;
    display: grid;
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: 10px;
    align-self: stretch;
    margin: 0 0 0 16px;
  }
  #view-home .floor-section,
  #view-home .floor-section + .floor-section { display: flex; flex-direction: column; margin-top: 0; }
  #view-home .room-grid { flex: 1; }
  #view-home .room-card { min-height: 82px; }
  #view-home .summary-grid {
    grid-area: summary;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    align-self: stretch;
    margin: 11px 16px 0 0;
  }
  #view-home .summary-grid .panel { min-width: 0; }
}

@media (min-width: 1880px) {
  .app-shell[data-view="home"] { padding-bottom: 30px; }
  .app-shell[data-view="home"] .bottom-nav {
    position: fixed;
    left: auto;
    right: max(18px, calc((100vw - 1400px) / 2 - 210px));
    top: 226px;
    bottom: auto;
    transform: none;
    grid-template-columns: 1fr;
    width: 185px;
    padding: 9px;
    border-radius: 17px;
  }
  .app-shell[data-view="home"] .nav-button {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 11px;
    padding: 11px 12px;
    font-size: 12px;
  }
  .app-shell[data-view="home"] .nav-button svg { width: 22px; height: 22px; }
}

/* The slider sends its target with OK; plus and minus use Apply. */
#target-value { cursor: pointer; transition: color .18s, text-shadow .18s; }
#target-value:hover, #target-value:focus-visible { color: #fff5d5; text-shadow: 0 0 12px #ffbb5c99; }
#target-value[aria-disabled="true"] { cursor: default; }
.target-window {
  width: min(100%, 430px);
  padding: 28px 26px 25px;
  background: linear-gradient(145deg, #284762f2, #102139f7);
  box-shadow: inset 0 1px 0 #e5f6ff26, 0 28px 90px #000c;
  text-align: center;
}
.target-window h2 { margin: 8px 0 10px; font-size: 23px; }
.target-window output { display: block; margin: 10px 0 22px; color: #fff; font-size: 48px; font-weight: 760; letter-spacing: -.04em; text-shadow: 0 0 24px #54dfff66; }
.target-window input[type="range"] {
  display: block; width: 100%; height: 12px; margin: 0; border-radius: 99px;
  background: linear-gradient(90deg, #24d5ef 0%, #69e7d5 40%, #ffc051 72%, #f16c51 100%);
  appearance: none; -webkit-appearance: none; cursor: pointer;
  box-shadow: inset 0 2px 6px #07142866, 0 0 18px #3fd5eb36;
}
.target-window input[type="range"]::-webkit-slider-thumb {
  width: 29px; height: 29px; border: 3px solid #ffe2a5; border-radius: 50%;
  background: #fff; appearance: none; -webkit-appearance: none;
  box-shadow: 0 2px 9px #071428aa, 0 0 16px #fff8;
}
.target-window input[type="range"]::-moz-range-thumb {
  width: 24px; height: 24px; border: 3px solid #ffe2a5; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 9px #071428aa, 0 0 16px #fff8;
}
.target-scale { display: flex; justify-content: space-between; margin: 18px 0 25px; color: #bfd2e5; font-size: 12px; }
.target-window .accent-button { min-width: 126px; }

.energy-units { display: inline-flex; gap: 7px; margin: 6px 0 12px; }
.energy-units label { display: flex; align-items: center; gap: 4px; padding: 6px 11px; border: 1px solid #7595b773; border-radius: 10px; background: #203550ab; color: #e2effb; font-size: 13px; cursor: pointer; }
.energy-units input { accent-color: #ffb344; }
.energy-units label:has(input:disabled) { opacity: .45; cursor: not-allowed; }
.tariff-form { display: grid; gap: 8px; margin-top: 18px; padding-top: 16px; border-top: 1px solid #7896b144; }
.tariff-form label { color: #c7d9ed; font-size: 13px; }
.tariff-form > div { display: flex; gap: 9px; }
.tariff-form input { min-width: 0; width: 160px; padding: 9px 11px; border: 1px solid #67809a; border-radius: 10px; background: #0f1d31; color: #f2f6ff; font-size: 16px; }
.energy-tariff { margin-top: 4px; color: #cbdcf0; font-size: 12px; }
.energy-tariff strong { color: #fff0bb; }
.password-hint { margin: -5px 0 0; }
.gauge-center[role="button"] { cursor: pointer; border-radius: 18px; }
.gauge-center[role="button"]:focus-visible { outline: 2px solid #91eaff; outline-offset: 5px; }
.operation-window { width: min(100%, 455px); padding: 26px; background: linear-gradient(145deg, #284762f5, #102139fa); }
.operation-window h2, .room-names-window h2 { margin: 5px 0 9px; }
.operation-window p, .room-names-window p { color: #c2d8e9; font-size: 14px; line-height: 1.5; }
.operation-options { display: grid; gap: 10px; margin: 21px 0 16px; }
.operation-options button { display: grid; grid-template-columns: 38px 1fr; column-gap: 10px; align-items: center; text-align: left; padding: 14px 16px; border: 1px solid #7297b887; border-radius: 15px; color: #eef8ff; background: linear-gradient(130deg, #36567a99, #14283ed9); cursor: pointer; box-shadow: inset 0 1px #ffffff30; }
.operation-options button.selected { border-color: #ffc268; box-shadow: 0 0 20px #ffb44a45, inset 0 1px #ffe5b29c; }
.operation-options svg { grid-row: span 2; width: 28px; height: 28px; fill: none; stroke: #ffc268; stroke-width: 1.8; }
.operation-options strong { font-size: 17px; }
.operation-options small { color: #b9d3e8; font-size: 12px; }
.room-names-window { width: min(100%, 430px); padding: 25px; background: linear-gradient(145deg, #284762f5, #102139fa); }
.room-name-fields { display: grid; gap: 11px; margin: 15px 0 20px; }
.room-name-fields label { display: grid; gap: 5px; color: #aacce5; font-size: 12px; }
.room-name-fields input { width: 100%; padding: 10px 12px; border: 1px solid #7196b5; border-radius: 10px; background: #0c1e33; color: #f2f8ff; font-size: 16px; }
.room-sensor-id { display: block; margin-top: 2px; color: #9fc3df; font-size: 10px; font-weight: 500; }
@media (max-width: 740px) {
  #view-home .energy-tariff { margin-top: 2px; font-size: clamp(8px, 1.2dvh, 11px); }
  #view-home .energy-cost-today { font-size: inherit; }
}
@media (max-width: 740px) and (max-height: 540px) {
  #view-home .energy-now { margin-top: 1px; font-size: 15px; }
  #view-home .energy-today, #view-home .energy-tariff { margin-top: 0; line-height: 1; }
}

/* Battery details belong to the spacious Rooms cards, not the home tiles. */
#view-home .room-card h3 { padding-right: 0; }

/* On iOS, scroll the page content within the shell so Safari's changing
   viewport cannot lift the navigation over the content while scrolling. */
@supports (-webkit-touch-callout: none) {
  @media (max-width: 740px) {
    html:has(.app-shell:not([data-view="home"]):not([hidden])),
    body:has(.app-shell:not([data-view="home"]):not([hidden])) {
      height: 100%;
      overflow: hidden;
    }
    .app-shell:not([data-view="home"]):not([hidden]) {
      display: flex;
      flex-direction: column;
      height: 100dvh;
      min-height: 0;
      padding: 0;
      overflow: hidden;
    }
    .app-shell:not([data-view="home"]) > .view:not([hidden]) {
      flex: 1 1 auto;
      min-height: 0;
      overflow-y: auto;
      overscroll-behavior-y: contain;
      -webkit-overflow-scrolling: touch;
      padding-bottom: 24px;
    }
    .app-shell:not([data-view="home"]) > .bottom-nav {
      position: relative;
      flex: none;
      left: auto;
      bottom: auto;
      transform: none;
      margin: 0 auto;
    }
  }
}
.mfa-qr { width: min(240px, 70vw); margin: 14px auto; padding: 10px; background: #fff; border-radius: 12px; }
.mfa-qr svg { display: block; width: 100%; height: auto; }
#mfa-key { color: #d2e9ff; overflow-wrap: anywhere; user-select: all; }
#mfa-gate .login-form { margin-top: 20px; }
#admin-owner-security .admin-owner-form { margin-top: 20px; }
