/* Light dashboard overrides */
:root {
  --bg: #f4f7fb;
  --screen: #f8fafc;
  --card: rgba(255, 255, 255, .96);
  --text: #122033;
  --text2: #44546b;
  --muted: #758299;
  --line: #dbe3ee;
  --green: #16c96f;
  --green2: #0ea85a;
  --green3: #eaf9f1;
  --blue: #2287f3;
  --cyan: #2cc8d6;
  --orange: #f4b23f;
  --shadow: 0 12px 28px rgba(15, 23, 42, .08);
  --deep: 0 26px 64px rgba(15, 23, 42, .12);
  --r: 8px;
  --sidebar-width: 232px;
  color-scheme: light;
}

html {
  background: #f4f7fb;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body.dashboard-body {
  display: block;
  min-height: 100vh;
  padding: 0;
  overflow: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 8%, rgba(22, 201, 111, .12), transparent 26%),
    radial-gradient(circle at 90% 4%, rgba(34, 135, 243, .10), transparent 28%),
    linear-gradient(180deg, #fbfcfe 0%, #f4f7fb 100%);
}

#floatRefresh {
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 14px 32px rgba(15, 23, 42, .12);
}

#floatRefresh:hover {
  border-color: rgba(22, 201, 111, .38);
  color: var(--green2);
}

.stage {
  width: 100%;
  max-width: none;
  height: 100vh;
  display: block;
}

.phone {
  width: 100%;
  height: 100vh;
  padding: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.phone::before,
.phone::after {
  display: none;
}

.screen {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 0;
  background:
    radial-gradient(circle at 100% 0%, rgba(34, 135, 243, .08), transparent 22%),
    linear-gradient(180deg, #fcfdff 0%, #f3f7fb 100%);
}

.app {
  position: relative;
  inset: auto;
  grid-column: 2;
  grid-row: 1;
  height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0 24px 30px;
  scrollbar-width: none;
}

.app::-webkit-scrollbar {
  display: none;
}

.page {
  width: min(1360px, 100%);
  margin: 0 auto;
  padding: 0 0 14px;
}

.screen,
.app,
.page,
.quick-device-grid,
.quick-device-card,
.schedule-panel,
.duration-editor,
.quick-actions,
.quick-action-btn,
.nav button {
  min-width: 0;
}

.page.active {
  animation: dashboardPageIn .24s cubic-bezier(.2, .8, .2, 1);
}

@keyframes dashboardPageIn {
  from { opacity: .2; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.app-header {
  min-height: 68px;
  padding: 12px 2px;
  border-bottom: 1px solid var(--line);
}

.brand {
  gap: 12px;
}

.brand-mark {
  width: 36px;
  height: 36px;
  filter: drop-shadow(0 12px 20px rgba(22, 201, 111, .18));
}

.brand-text b {
  color: var(--text);
  font-size: 17px;
  font-weight: 850;
}

.brand-text span {
  color: var(--muted);
  font-size: 12px;
}

.sys-ok {
  margin-left: auto;
  margin-right: 10px;
  color: var(--text2);
  font-size: 12px;
  font-weight: 700;
}

.ok-dot {
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(22, 201, 111, .12);
}

.bell {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .96);
  box-shadow: var(--shadow);
}

.bell:hover {
  border-color: rgba(22, 201, 111, .32);
  background: #f8fdf9;
}

.bell svg,
.icon-btn svg {
  stroke: #1e293b;
}

.card,
.segment,
.hero,
.chart,
.site-card,
.preview,
.form,
.nav,
.sheet,
.toast,
.battery-card,
.toggle,
.kpi {
  border-color: var(--line);
  background: var(--card);
  box-shadow: var(--shadow);
}

.card {
  color: var(--text);
  border-radius: var(--r);
  transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease;
}

#dl_xs_svg,
[stroke="#16c96f"] {
  stroke: var(--green) !important;
}

#dl_xs_svg {
  fill: var(--green) !important;
}

.hero {
  position: relative;
  overflow: hidden;
  min-height: 210px;
  border-radius: 12px;
  background: linear-gradient(180deg, #fff 0%, #eefaf4 100%);
  border: 1px solid var(--line);
  box-shadow: 0 16px 38px rgba(15, 23, 42, .08);
  padding: 19px 14px 14px;
}

.hero-bg {
  position: absolute;
  inset: auto -20px -12px -20px;
  height: 104px;
  opacity: .92;
}

.hero-grid {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr 122px 1fr;
  align-items: center;
  gap: 5px;
}

.hero-grid > *,
.flow-side {
  min-width: 0;
}

.flow-side {
  text-align: center;
}

.flow-label {
  font-size: 12px;
  font-weight: 760;
  color: #1f2937;
  letter-spacing: .1px;
}

.flow-num {
  font-size: 22px;
  font-weight: 950;
  margin: 3px 0 10px;
  letter-spacing: 0;
}

.flow-num small {
  font-size: 12px;
}

.solar-panel {
  width: 65px;
  height: 45px;
  margin: auto;
}

.home-house {
  width: 58px;
  height: 48px;
  margin: auto;
}

.flow-line {
  position: absolute;
  z-index: 1;
  top: 61px;
  height: 2px;
  border-top: 2px dashed rgba(22, 201, 111, .55);
}

.flow-line.l {
  left: 80px;
  width: 68px;
}

.flow-line.r {
  right: 80px;
  width: 68px;
}

.flow-line:after {
  content: "";
  position: absolute;
  right: -9px;
  top: -6px;
  border-left: 10px solid var(--green);
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
}

.flow-line.r:after {
  left: -9px;
  right: auto;
  transform: rotate(180deg);
}

.main-ring {
  width: 122px;
  height: 122px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  position: relative;
  background: conic-gradient(#14c976 0 100%, #e2f8ee 100% 100%);
  box-shadow: 0 0 0 9px rgba(22, 201, 111, .07), 0 18px 34px rgba(22, 201, 111, .18);
}

.main-ring::before {
  content: "";
  position: absolute;
  inset: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: inset 0 0 25px rgba(22, 201, 111, .13);
}

.soc-ring::before,
.donut::before {
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(22, 201, 111, .08);
}

.main-ring div {
  position: relative;
  text-align: center;
}

.main-ring span {
  display: block;
  color: #586474;
  font-size: 12px;
  font-weight: 760;
}

.main-ring b {
  display: block;
  font-size: 30px;
  line-height: .95;
  letter-spacing: 0;
  font-weight: 850;
}

.hero-battery {
  position: relative;
  z-index: 3;
  margin-top: 15px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  font-weight: 950;
}

.mini-cell {
  width: 43px;
  height: 26px;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(22, 201, 111, .11);
  color: #07944d;
  font-weight: 900;
  font-size: 11px;
  padding: 5px 9px;
  white-space: nowrap;
}

.battery-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
}

.battery-card {
  min-height: 172px;
  padding: 15px;
  position: relative;
  overflow: hidden;
  border-radius: var(--r);
}

.battery-card::after {
  content: "";
  position: absolute;
  right: -11px;
  bottom: 23px;
  width: 70px;
  height: 96px;
  border: 6px solid rgba(22, 201, 111, .075);
  border-radius: 10px;
}

.battery-card::before {
  content: "";
  position: absolute;
  right: 13px;
  bottom: 113px;
  width: 25px;
  height: 8px;
  border-radius: 5px;
  background: rgba(22, 201, 111, .075);
}

.home-shortcut-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.home-shortcut {
  width: 100%;
  min-height: 78px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, #fff 0%, #f7fbff 100%);
  color: var(--text);
  text-align: left;
  font: inherit;
  box-shadow: 0 10px 24px rgba(15, 23, 42, .05);
  cursor: pointer;
  transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}

.home-shortcut:hover {
  transform: translateY(-1px);
  border-color: rgba(22, 201, 111, .26);
  box-shadow: 0 14px 30px rgba(15, 23, 42, .08);
}

.home-shortcut.primary {
  border-color: rgba(22, 201, 111, .22);
  background: linear-gradient(135deg, rgba(22, 201, 111, .13), rgba(34, 135, 243, .07));
}

.home-shortcut-icon {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: rgba(34, 135, 243, .10);
  color: var(--blue);
}

.home-shortcut.primary .home-shortcut-icon {
  background: rgba(22, 201, 111, .15);
  color: var(--green2);
}

.home-shortcut-icon svg {
  width: 23px;
  height: 23px;
  stroke: currentColor;
}

.home-shortcut > span:last-child {
  min-width: 0;
}

.home-shortcut strong {
  display: block;
  font-size: 15px;
  font-weight: 900;
  line-height: 1.2;
}

.home-shortcut small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}

.b-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 15px;
  font-weight: 950;
}

.b-name {
  display: flex;
  align-items: center;
  gap: 6px;
}

.b-name svg {
  width: 18px;
  height: 22px;
  stroke: var(--green);
}

.soc {
  font-size: 38px;
  font-weight: 850;
  letter-spacing: 0;
  margin: 18px 0 5px;
}

.soc small {
  font-size: 12px;
  color: #5c6678;
  font-weight: 850;
  letter-spacing: 0;
  margin-left: 4px;
}

.bar {
  height: 8px;
  background: #e8f2ee;
  border-radius: 999px;
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  width: var(--w);
  border-radius: 999px;
  background: linear-gradient(90deg, var(--green2), #76edc9);
}

.caption {
  font-size: 12px;
  color: #526070;
  font-weight: 850;
  margin-top: 14px;
}

.green-num {
  color: #09a857;
  font-size: 23px;
  font-weight: 950;
  margin-top: 4px;
}

.section {
  margin-top: 14px;
  padding: 16px;
  border-radius: var(--r);
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 17px;
  font-weight: 950;
  margin-bottom: 14px;
  color: var(--text);
}

.section-title .left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.more {
  font-size: 13px;
  font-weight: 850;
  color: #98a2b3;
  cursor: pointer;
}

.titlebar {
  min-height: 68px;
  padding: 15px 0 11px;
  border-bottom: 1px solid var(--line);
}

.titlebar h2,
.analysis h2 {
  font-size: clamp(22px, 1.7vw, 30px);
  font-weight: 800;
  letter-spacing: -.035em;
  color: var(--text);
}

.titlebar .icon-btn:first-child {
  display: none;
}

.segment {
  padding: 6px;
  border-radius: 8px;
}

.seg {
  min-height: 52px;
  color: var(--muted);
}

.seg.active {
  border-color: rgba(22, 201, 111, .35);
  color: var(--text);
  background: rgba(22, 201, 111, .08);
  box-shadow: inset 0 0 0 1px rgba(22, 201, 111, .04);
}

.mppt-card .row {
  width: auto;
  margin: 0;
}

.mppt-card .row > * {
  width: auto;
  max-width: none;
  padding: 0;
}

.mppt-card {
  margin-top: 9px;
  padding: 14px;
  background: rgba(255, 255, 255, .88);
}

.info {
  background: linear-gradient(145deg, rgba(34, 135, 243, .08), rgba(22, 201, 111, .06));
}

.tabs,
.filters span,
.input,
.site-meta div {
  border-color: var(--line);
  background: rgba(255, 255, 255, .98);
}

.tab {
  color: var(--muted);
}

.tab.active {
  color: var(--green2);
  background: rgba(22, 201, 111, .09);
  box-shadow: none;
}

.battery-detail {
  padding: 16px;
}

.grid {
  border-color: var(--line);
  background: rgba(255, 255, 255, .96);
}

.cell {
  border-color: var(--line);
}

.chart {
  padding: 16px;
  border-radius: var(--r);
}

.chart-head {
  color: var(--text);
}

.chart-wrap {
  height: 250px;
}

.chart-wrap.compact {
  height: 185px;
}

.chart-empty {
  color: var(--muted);
  background: rgba(255, 255, 255, .86);
  border: 1px dashed var(--line);
}

.site-photo {
  height: 176px;
  filter: saturate(.88) brightness(1.02);
}

.site-overlay {
  color: #12201c;
  background: rgba(255, 255, 255, .86);
}

.site-overlay span {
  color: #51645e;
}

.small-ring {
  background: conic-gradient(var(--green) var(--soc, 0%), rgba(156, 196, 183, .12) 0);
}

.preview {
  border-radius: var(--r);
}

.toggle-grid {
  gap: 10px;
}

.toggle {
  min-height: 116px;
  padding: 17px 10px 13px;
  cursor: pointer;
  border-radius: var(--r);
}

.toggle svg {
  width: 31px;
  height: 31px;
  stroke: #9bb0a9;
}

.toggle b {
  color: var(--text);
  font-size: 14px;
}

.switch.off {
  background: #d9e1ea;
  box-shadow: none;
}

.toggle.off svg {
  stroke: #a0aab8;
}

.toggle.off b {
  color: #8b94a3;
}

.toggle.busy {
  pointer-events: none;
  opacity: .72;
  filter: saturate(.85);
}

.toggle.busy .switch {
  box-shadow: 0 0 0 4px rgba(34, 135, 243, .12);
}

.toggle.unknown .switch {
  background: #cbd5e1;
  box-shadow: none;
}

.toggle.unknown .switch:after {
  right: 14px;
}

.manual-takeover-note {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 13px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid rgba(34, 135, 243, .18);
  border-radius: var(--r);
  color: var(--text);
  background: linear-gradient(135deg, rgba(34, 135, 243, .08), rgba(22, 201, 111, .05));
  box-shadow: var(--shadow);
}

.takeover-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--green2);
  background: rgba(22, 201, 111, .11);
}

.takeover-icon svg {
  width: 23px;
  height: 23px;
  stroke: currentColor;
}

.manual-takeover-note b,
.manual-takeover-note span {
  display: block;
}

.manual-takeover-note > div:nth-child(2) > span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.takeover-badge {
  padding: 7px 10px;
  border-radius: 999px;
  color: var(--green2);
  background: rgba(22, 201, 111, .09);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.frow {
  border-color: var(--line);
}

.input {
  color: var(--text);
}

.save {
  box-shadow: 0 14px 32px rgba(15, 23, 42, .12);
}

.filters {
  justify-content: flex-end;
  margin: 0;
  gap: 8px;
}

.filters span {
  color: var(--muted);
  border-radius: 999px;
}

.filters .on {
  color: var(--green2);
  border-color: rgba(22, 201, 111, .28);
  background: rgba(22, 201, 111, .09);
}

.kpi {
  min-height: 108px;
  padding: 15px;
  border-radius: var(--r);
}

.donut {
  box-shadow: 0 0 0 8px rgba(255, 255, 255, .04);
}

.quick-control {
  min-height: 100%;
}

.quick-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 0 16px;
}

.quick-eyebrow {
  color: var(--green2);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .18em;
}

.quick-heading h1 {
  margin: 5px 0 6px;
  color: var(--text);
  font-size: clamp(28px, 2.8vw, 38px);
  font-weight: 840;
  letter-spacing: -.04em;
}

.quick-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  max-width: 560px;
}

.quick-clock {
  min-width: 154px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: right;
  background: rgba(255, 255, 255, .92);
  box-shadow: var(--shadow);
}

.quick-clock span,
.quick-clock b {
  display: block;
}

.quick-clock span {
  color: var(--muted);
  font-size: 11px;
}

.quick-clock b {
  margin-top: 3px;
  color: var(--text);
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
}

.quick-device-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.quick-device-card {
  padding: 16px;
  overflow: hidden;
  border-radius: var(--r);
}

.quick-device-card.inverter-card {
  display: flex;
  flex-direction: column;
}

.quick-device-card[data-state="on"] {
  border-color: rgba(22, 201, 111, .28);
  box-shadow: 0 14px 40px rgba(15, 23, 42, .10), inset 0 1px rgba(22, 201, 111, .08);
}

.quick-device-head {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.device-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--green2);
  background: rgba(22, 201, 111, .09);
}

.strip-icon {
  color: var(--blue);
  background: rgba(34, 135, 243, .09);
}

.inverter-icon {
  color: var(--orange);
  background: rgba(244, 178, 63, .12);
}

.device-icon svg {
  width: 27px;
  height: 27px;
  stroke: currentColor;
}

.quick-device-head > div > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.quick-device-head h2 {
  margin: 2px 0 0;
  color: var(--text);
  font-size: 19px;
  font-weight: 820;
}

.quick-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 8px;
  border-radius: 999px;
  color: var(--muted);
  background: rgba(15, 23, 42, .04);
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.quick-state i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #94a3b8;
}

.quick-state.on {
  color: var(--green2);
  background: rgba(22, 201, 111, .09);
}

.quick-state.on i {
  background: var(--green);
  box-shadow: 0 0 10px rgba(22, 201, 111, .35);
}

.quick-state.off {
  color: #6b7280;
}

.quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 14px 0 12px;
}

.inverter-card .quick-actions {
  margin: 14px 0 12px;
}

.quick-action-btn {
  min-height: 58px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: rgba(255, 255, 255, .98);
  transition: .18s ease;
}

.quick-action-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(22, 201, 111, .28);
  background: rgba(22, 201, 111, .05);
}

.quick-action-btn.off:hover {
  border-color: rgba(239, 68, 68, .25);
  background: rgba(239, 68, 68, .05);
}

.quick-action-btn span {
  font-size: 15px;
  font-weight: 850;
}

.quick-action-btn small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .11em;
}

.quick-action-btn.is-current.on {
  color: #fff;
  border-color: var(--green2);
  background: linear-gradient(135deg, #20c36c, #0fa25a);
}

.quick-action-btn.is-current.on small {
  color: rgba(255, 255, 255, .72);
}

.quick-action-btn.is-current.off {
  border-color: rgba(239, 68, 68, .22);
  background: rgba(239, 68, 68, .08);
}

.quick-action-btn:disabled {
  cursor: wait;
  opacity: .55;
  transform: none;
}

.schedule-panel {
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfe;
}

.schedule-head,
.schedule-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.schedule-head span {
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.schedule-head small {
  color: var(--muted);
  font-size: 10px;
}

.schedule-mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin: 8px 0 7px;
  padding: 3px;
  border-radius: 8px;
  background: rgba(15, 23, 42, .03);
}

.schedule-mode-switch button {
  min-height: 29px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.schedule-mode-switch button.active {
  color: var(--text);
  background: #fff;
  box-shadow: 0 5px 14px rgba(15, 23, 42, .08);
}

.schedule-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.schedule-entry input {
  min-width: 0;
  height: 36px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: #fff;
}

.duration-editor {
  display: grid;
  grid-template-columns: minmax(64px, 1fr) auto;
  gap: 6px;
}

.schedule-duration-value {
  width: 100%;
  text-align: center;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.duration-unit-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.duration-unit-switch button {
  min-width: 41px;
  padding: 0 7px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.duration-unit-switch button.active {
  color: #0f7a44;
  background: rgba(22, 201, 111, .11);
}

.custom-time-editor {
  display: grid;
  gap: 6px;
}

.time-input-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 5px;
  align-items: center;
}

.time-input-row > b {
  color: var(--muted);
  font-size: 15px;
}

.time-part {
  display: grid;
  grid-template-columns: 24px 35px 24px;
  height: 34px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.time-part button {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.time-part button:hover {
  color: var(--text);
  background: rgba(22, 201, 111, .08);
}

.time-part input {
  width: 35px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 0;
  text-align: center;
  font-size: 13px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
  background: transparent;
}

.time-presets {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.time-presets button {
  min-height: 24px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  background: #fff;
}

.time-presets button:hover,
.time-presets button.active {
  border-color: rgba(22, 201, 111, .28);
  color: var(--green2);
  background: rgba(22, 201, 111, .08);
}

.schedule-submit {
  min-height: 36px;
  padding: 0 14px;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(135deg, #20c36c, #0fa25a);
  font-size: 12px;
  font-weight: 850;
}

.schedule-status {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--green2);
  font-size: 11px;
  font-weight: 750;
}

.schedule-cancel {
  color: #e11d48;
  font-size: 11px;
  font-weight: 800;
}

.inverter-hint {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 9px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  margin-top: auto;
}

.inverter-hint i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--orange);
}

.inverter-hint b {
  color: var(--text);
  margin-right: 5px;
}

#home.active,
#device.active,
#monitor.active,
#control.active,
#stats.active {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 18px;
}

#home > .app-header { grid-column: 1 / -1; }
#home > .hero { grid-column: 1 / 8; }
#home > .battery-pair { grid-column: 8 / -1; margin-top: 0; }
#home > .section { grid-column: 1 / -1; }

#device > .titlebar,
#device > .segment,
#device > .info { grid-column: 1 / -1; }
#device > .section:nth-of-type(1),
#device > .section:nth-of-type(2) { grid-column: 1 / -1; }

#monitor > .titlebar { grid-column: 1 / -1; }
#monitor > .battery-detail { grid-column: 1 / 8; }
#monitor > .site-card { grid-column: 8 / -1; }
#monitor > .chart { grid-column: 1 / 9; }
#monitor > .preview { grid-column: 9 / -1; align-self: stretch; }

#control > .app-header,
#control > .titlebar { grid-column: 1 / -1; }
#control > .toggle-grid { grid-column: 1 / 8; grid-row: 3; }
#control > .manual-takeover-note { grid-column: 1 / 8; grid-row: 4; }
#control > .form { grid-column: 8 / -1; grid-row: 3 / 5; }

#stats > .app-header,
#stats > .kpis { grid-column: 1 / -1; }
#stats > h2 { grid-column: 1 / 4; margin: 10px 0 0; align-self: center; }
#stats > .filters { grid-column: 4 / -1; align-self: center; }
#stats > .chart { grid-column: 1 / 9; grid-row: 4 / 6; }
#stats > .section:not(.chart) { grid-column: 9 / -1; }

.nav {
  position: relative;
  inset: auto;
  z-index: 45;
  grid-column: 1;
  grid-row: 1;
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  padding: 16px 12px;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, .96), rgba(243, 247, 251, .98));
  box-shadow: 14px 0 38px rgba(15, 23, 42, .06);
  backdrop-filter: blur(20px);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 2px 7px 17px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.nav-brand-mark {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  color: var(--green2);
  filter: drop-shadow(0 9px 18px rgba(22, 201, 111, .16));
}

.nav-brand-mark svg {
  width: 100%;
  height: 100%;
}

.nav-brand strong,
.nav-brand small {
  display: block;
}

.nav-brand strong {
  color: var(--text);
  font-size: 17px;
  letter-spacing: -.02em;
}

.nav-brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.nav-context {
  padding: 0 13px 8px;
  color: #7a8799;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .15em;
}

.nav button {
  width: 100%;
  min-height: 43px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #516070;
  text-align: left;
  font-size: 12px;
  font-weight: 750;
  transition: .18s ease;
}

.nav button:hover {
  color: var(--text);
  background: rgba(22, 201, 111, .05);
}

.nav button.active {
  color: var(--text);
  border-color: rgba(22, 201, 111, .2);
  background: linear-gradient(135deg, rgba(22, 201, 111, .12), rgba(34, 135, 243, .06));
  box-shadow: inset 3px 0 var(--green), 0 12px 28px rgba(15, 23, 42, .06);
}

.nav svg,
.nav .main svg {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  margin: 0;
  padding: 0;
  border-radius: 0;
  color: inherit;
  background: transparent;
  box-shadow: none;
}

.nav-foot {
  display: grid;
  gap: 10px;
  margin-top: auto;
  padding: 18px 9px 2px;
  border-top: 1px solid var(--line);
}

.nav-foot span {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.nav-foot span i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 12px rgba(22, 201, 111, .42);
}

.nav-foot a {
  display: flex;
  justify-content: space-between;
  color: #516070;
  font-size: 11px;
  font-weight: 750;
  text-decoration: none;
}

.nav-foot a:hover {
  color: var(--green2);
}

.toast {
  position: fixed;
  left: auto;
  right: 30px;
  bottom: 28px;
  width: min(430px, calc(100vw - 44px));
  padding: 15px 18px;
  border: 1px solid rgba(22, 201, 111, .18);
  border-radius: 10px;
  color: var(--text);
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 24px 60px rgba(15, 23, 42, .14);
}

.sheet-mask {
  position: fixed;
  background: rgba(15, 23, 42, .16);
  backdrop-filter: blur(4px);
}

.sheet {
  position: fixed;
  left: 50%;
  right: auto;
  bottom: 28px;
  width: min(520px, calc(100vw - 32px));
  border-color: var(--line);
  color: var(--text);
  background: #fff;
  max-height: min(74vh, calc(100vh - 56px));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  transform: translate(-50%, 120%);
}

.sheet.show {
  transform: translate(-50%, 0);
}

.sheet-options button,
.sheet-actions .cancel {
  color: var(--text);
  border-color: var(--line);
  background: rgba(255, 255, 255, .96);
}

.sheet-options button.active {
  color: var(--green2);
  background: rgba(22, 201, 111, .11);
}

.sheet-actions .confirm {
  color: #fff;
  background: linear-gradient(135deg, #20c36c, #0fa25a);
}

@media (max-width: 1180px) {
  :root {
    --sidebar-width: 92px;
  }

  .app {
    padding-inline: 24px;
  }

  .nav {
    padding-inline: 12px;
  }

  .nav-brand {
    justify-content: center;
    padding-inline: 0;
  }

  .nav-brand > span:last-child,
  .nav-context,
  .nav-foot {
    display: none;
  }

  .nav button {
    justify-content: center;
    padding: 0;
    font-size: 0;
    text-align: center;
  }

  .nav button svg {
    width: 23px;
    height: 23px;
  }

  #home > .hero {
    grid-column: 1 / -1;
  }

  #home > .battery-pair {
    grid-column: 1 / -1;
  }

  #device > .section:nth-of-type(1),
  #device > .section:nth-of-type(2) {
    grid-column: 1 / -1;
  }

  #monitor > .battery-detail,
  #monitor > .site-card,
  #monitor > .chart,
  #monitor > .preview {
    grid-column: 1 / -1;
  }

  #control > .toggle-grid,
  #control > .manual-takeover-note,
  #control > .form {
    grid-column: 1 / -1;
    grid-row: auto;
  }

  #stats > .chart,
  #stats > .section:not(.chart) {
    grid-column: 1 / -1;
    grid-row: auto;
  }
}

@media (min-width: 768px) and (max-width: 920px) {
  .quick-device-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .quick-device-card.inverter-card {
    grid-column: 1 / -1;
  }
}

@media (max-width: 767px) {
  body.dashboard-body {
    overflow: hidden;
  }

  .screen {
    display: block;
    width: 100vw;
    max-width: 100vw;
  }

  .app {
    width: 100%;
    max-width: 100vw;
    height: 100vh;
    height: 100dvh;
    overflow-x: hidden;
    padding:
      env(safe-area-inset-top, 0)
      max(11px, env(safe-area-inset-right, 0))
      calc(91px + env(safe-area-inset-bottom, 0))
      max(11px, env(safe-area-inset-left, 0));
  }

  .page {
    width: 100%;
    max-width: 100%;
    padding-bottom: 9px;
  }

  #home.active,
  #device.active,
  #monitor.active,
  #control.active,
  #stats.active {
    display: block;
  }

  #home > *,
  #device > *,
  #monitor > *,
  #control > *,
  #stats > * {
    margin-top: 10px;
  }

  .app-header {
    min-height: 61px;
    padding: 9px 0;
  }

  #home .app-header {
    align-items: center;
    gap: 8px;
    padding: 11px 0 13px;
  }

  #home .brand {
    flex: 1 1 auto;
    min-width: 0;
    align-items: flex-start;
    gap: 10px;
  }

  .brand-mark {
    width: 33px;
    height: 33px;
  }

  .brand-text b {
    font-size: 15px;
  }

  .brand-text span {
    font-size: 10px;
  }

  #home .brand-text {
    min-width: 0;
    gap: 3px;
  }

  #home .brand-text b {
    font-size: 18px;
    line-height: 1.1;
  }

  #home .brand-text #weather-temp {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.15;
  }

  #home .brand-text #time {
    color: var(--text2);
    font-size: 11px;
    font-weight: 800;
    line-height: 1.15;
  }

  #home .sys-ok {
    flex: 0 0 auto;
    align-self: flex-start;
    padding-top: 4px;
    white-space: nowrap;
    gap: 4px;
    font-size: 9px;
  }

  #home .sys-ok .ok-dot {
    width: 8px;
    height: 8px;
    box-shadow: 0 0 0 3px rgba(22, 201, 111, .12);
  }

  .sys-ok {
    margin-right: 0;
    font-size: 10px;
  }

  .bell {
    display: none;
  }

  .nav {
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: max(8px, env(safe-area-inset-bottom, 0));
    width: auto;
    height: 70px;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 2px;
    padding: 5px 4px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255, 255, 255, .94);
    box-shadow: 0 -14px 34px rgba(15, 23, 42, .10);
  }

  .nav-brand,
  .nav-context,
  .nav-foot {
    display: none;
  }

  .nav button,
  .nav .main {
    min-width: 0;
    width: auto;
    min-height: 56px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 2px;
    padding: 3px 1px;
    border-radius: 12px;
    font-size: 9px;
    text-align: center;
  }

  .nav button.active {
    box-shadow: inset 0 -2px var(--green);
  }

  .nav button svg,
  .nav .main svg {
    width: 20px;
    height: 20px;
    margin: 0 auto 3px;
  }

  .quick-heading {
    align-items: flex-start;
    padding: 18px 0 13px;
  }

  .quick-heading h1 {
    font-size: 31px;
  }

  .quick-heading p {
    max-width: 270px;
    line-height: 1.6;
  }

  .quick-clock {
    display: none;
  }

  .quick-device-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .quick-device-card {
    padding: 14px;
  }

  .quick-device-card.inverter-card {
    display: block;
  }

  .inverter-card .quick-actions {
    margin: 13px 0 11px;
  }

  .quick-device-head {
    grid-template-columns: 40px minmax(0, 1fr) auto;
    gap: 9px;
  }

  .device-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
  }

  .quick-device-head h2 {
    font-size: 18px;
  }

  .quick-state {
    padding: 6px 8px;
    font-size: 9px;
  }

  .quick-action-btn {
    min-height: 54px;
    padding: 9px 11px;
  }

  .schedule-entry {
    grid-template-columns: 1fr;
  }

  .duration-editor {
    grid-template-columns: 1fr;
  }

  .duration-unit-switch {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .schedule-submit {
    width: 100%;
  }

  .hero {
    min-height: 218px;
    padding-inline: 8px;
    border-radius: 12px;
  }

  .hero-grid {
    grid-template-columns: minmax(0, .95fr) 96px minmax(0, .95fr);
    gap: 2px;
  }

  .main-ring {
    width: 94px;
    height: 94px;
  }

  .main-ring b {
    font-size: 22px;
  }

  .flow-label {
    font-size: 11px;
  }

  .flow-num {
    font-size: 18px;
    margin: 2px 0 8px;
  }

  .flow-num small {
    font-size: 10px;
  }

  .solar-panel {
    width: 58px;
    height: 40px;
  }

  .home-house {
    width: 50px;
    height: 41px;
  }

  .flow-line.l {
    left: 22%;
    width: 16%;
  }

  .flow-line.r {
    right: 22%;
    width: 16%;
  }

  .battery-pair {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .battery-card {
    min-height: 162px;
    padding: 14px;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  .titlebar {
    min-height: 68px;
    margin-top: 0 !important;
  }

  .titlebar .icon-btn:first-child {
    display: grid;
  }

  .titlebar h2 {
    font-size: 25px;
  }

  .toggle-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .toggle {
    min-height: 108px;
  }

  .manual-takeover-note {
    grid-template-columns: 38px 1fr;
  }

  .takeover-badge {
    display: none;
  }

  .frow {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .input {
    width: 100%;
  }

  .grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .cell:nth-child(3n) {
    border-right: 1px solid var(--line);
  }

  .cell:nth-child(2n) {
    border-right: 0;
  }

  .cell:nth-last-child(-n+3) {
    border-bottom: 1px solid var(--line);
  }

  .cell:nth-last-child(-n+2) {
    border-bottom: 0;
  }

  .detail-top {
    grid-template-columns: 110px 1fr;
  }

  .soc-ring {
    width: 105px;
    height: 105px;
  }

  .soc-ring div {
    font-size: 29px;
  }

  .site-photo {
    height: 180px;
  }

  .filters {
    justify-content: flex-start;
  }

  #stats > h2 {
    margin-top: 22px;
  }

  .kpis {
    grid-template-columns: 1fr;
  }

  .chart-wrap {
    height: 220px;
  }

  .donut-row {
    grid-template-columns: 100px 1fr;
  }

  .donut {
    width: 96px;
    height: 96px;
  }

  .toast {
    right: 14px;
    bottom: 96px;
    width: calc(100vw - 28px);
  }

  .sheet {
    bottom: 10px;
    left: 50%;
    right: auto;
    width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
    border-radius: 16px;
    transform: translate(-50%, 120%);
  }

  .sheet.show {
    transform: translate(-50%, 0);
  }

  .sheet-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sheet-options button {
    height: 46px;
    font-size: 14px;
  }

  .sheet-actions {
    grid-template-columns: 1fr;
  }

  .sheet-actions .cancel {
    display: none;
  }

  .sheet-actions .confirm {
    height: 48px;
  }
}

@media (max-width: 390px) {
  .app {
    padding-inline: 10px;
  }

  .nav {
    left: 4px;
    right: 4px;
  }

  .nav button {
    font-size: 8px;
  }

  .nav button,
  .nav .main {
    font-size: 0;
    gap: 0;
  }

  .nav button svg,
  .nav .main svg {
    margin: 0;
  }

  .quick-heading h1 {
    font-size: 32px;
  }

  .quick-device-card {
    padding: 15px;
  }

  .battery-pair {
    grid-template-columns: 1fr;
  }

  .home-shortcut-grid {
    grid-template-columns: 1fr;
  }

  .home-shortcut {
    min-height: 72px;
    padding: 12px 14px;
  }

  .home-shortcut-icon {
    width: 40px;
    height: 40px;
  }
}

@media (max-width: 500px) {
  .nav button,
  .nav .main {
    font-size: 0;
    gap: 0;
  }

  .nav button svg,
  .nav .main svg {
    margin: 0;
  }
}

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