/* Shared graph tokens keep SVG charts and circuit legends in sync with appearance. */
:root {
  --chart-generated: #e9bd70;
  --chart-consumed: #65d8b3;
  --chart-grid: #2b4842;
  --chart-track: #25453e;
  --chart-1: #65d8b3;
  --chart-2: #abc89b;
  --chart-3: #e9bd70;
  --chart-4: #8bbbd8;
  --chart-5: #76958c;
  --chart-6: #a8a6ce;
}
.theme-toggle {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.theme-toggle:hover {
  background: var(--panel);
}
.login-theme-toggle {
  position: absolute;
  top: 24px;
  right: 24px;
}
.appearance-setting {
  padding: 12px 26px 20px;
  border-bottom: 1px solid var(--border);
}
.appearance-setting select {
  max-width: 410px;
}
.appearance-setting .helper {
  margin-bottom: 0;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f2f7f5;
  --sidebar: #e8f1ed;
  --panel: #ffffff;
  --border: #ceded6;
  --text: #193c35;
  --muted: #536e63;
  --mint: #16765f;
  --solar: #97620e;
  --blue: #386c91;
  --chart-generated: #ae751b;
  --chart-consumed: #167c65;
  --chart-grid: #d7e3dd;
  --chart-track: #e1ebe5;
  --chart-1: #167c65;
  --chart-2: #668347;
  --chart-3: #ae751b;
  --chart-4: #397da4;
  --chart-5: #607c72;
  --chart-6: #7b70a5;
}
/* Neutral surfaces and readable secondary text throughout every view. */
[data-theme="light"]
  :is(
    .sidebar-caption,
    .sidebar-footer,
    .breadcrumb,
    .eyebrow,
    .metric-top,
    .metric-bottom,
    .metric-value small,
    .metric-bottom > .icon,
    .live-label,
    .flow-node div > span,
    .flow-node strong small,
    .flow-node em,
    .storage-node strong,
    .house-caption,
    .house-caption-dot,
    .flow-footer,
    .flow-footer > span:last-child,
    .legend-row,
    .legend-row > span:last-child,
    .chart-key,
    .chart-footer,
    .connector-info small,
    .connector-status,
    .integration-note,
    .page-footer,
    label,
    td
  ) {
  color: var(--muted);
}
[data-theme="light"]
  :is(
    .breadcrumb span:last-child,
    .house-caption span:first-child,
    td:first-child
  ) {
  color: var(--text);
}
[data-theme="light"] .breadcrumb span:first-child {
  color: #809c90;
}
[data-theme="light"] .nav-item {
  color: #49675b;
}
[data-theme="light"] .nav-item:hover {
  background: #ddece4;
  color: var(--text);
}
[data-theme="light"] .nav-item.active {
  background: #d3e8dd;
  color: var(--mint);
}
[data-theme="light"] .count {
  background: #e0eee5;
  border-color: #bdd5c7;
  color: #315e47;
}
[data-theme="light"] :is(.home-icon, .avatar) {
  background: #d5e5da;
  border-color: #aecabb;
  color: #356348;
}
[data-theme="light"] .demo-badge {
  background: #f1f3e2;
  border-color: #cad0a5;
  color: #5c633a;
}
[data-theme="light"] .connection-badge {
  color: #416657;
}
[data-theme="light"] .range-switch {
  background: #e8f0eb;
}
[data-theme="light"] .range-switch .active {
  background: white;
  color: #215b44;
  box-shadow: 0 1px 4px #264b3020;
}
[data-theme="light"] .button.primary {
  background: #16765f;
  border-color: #16765f;
  color: white;
}
[data-theme="light"] .button.primary:hover {
  background: #0f5f4c;
}
[data-theme="light"] .button.secondary {
  background: #eef5f0;
  border-color: #bbd3c5;
  color: #285741;
}
[data-theme="light"] .button.secondary:hover {
  background: #deece3;
}
[data-theme="light"] .button.danger {
  background: #9d493c;
  border-color: #9d493c;
  color: white;
}
[data-theme="light"] .metric {
  background: linear-gradient(120deg, #ffffff, #edf5ee);
}
[data-theme="light"]
  :is(
    .metric-bottom,
    .connector-row,
    .integration-list-row,
    th,
    td,
    .settings-facts
  ) {
  border-color: var(--border);
}
[data-theme="light"] .scene-grid {
  background-image: radial-gradient(#80aa9566 0.8px, transparent 0.8px);
}
[data-theme="light"] .flow-track {
  stroke: #bbd2c4;
}
[data-theme="light"] .battery-line {
  stroke: #8378aa;
}
[data-theme="light"] .flow-node {
  background: #fffffff2;
  border-color: #cadbd1;
  box-shadow: 0 3px 15px #244c3310;
}
[data-theme="light"] .node-icon {
  background: #f5ecd8;
  border-color: #e7d8b6;
}
[data-theme="light"] .node-icon.blue {
  background: #e7eff6;
  border-color: #c4d8e5;
}
[data-theme="light"] :is(.node-icon.mint, .node-icon.muted) {
  background: #e5f0e9;
  border-color: #c2d7c9;
}
[data-theme="light"] .chart-tooltip {
  background: #ffffff;
  border-color: #a3c4b1;
  color: var(--text);
  box-shadow: 0 4px 16px #284b3220;
}
[data-theme="light"] :is(.chart-container svg text, .large-chart svg text) {
  fill: #536e63;
}
[data-theme="light"] .text-button {
  color: #25664a;
}
[data-theme="light"] .text-button:hover {
  color: #0f4d35;
}
[data-theme="light"] .connector-logo {
  background: #f6eedc;
  border-color: #decc9d;
  color: #7f5d16;
}
[data-theme="light"] .connector-logo.leviton {
  background: #e5f0e9;
  border-color: #bbd3c5;
  color: #2b6348;
}
[data-theme="light"] .connector-logo.custom {
  background: #e8f0f7;
  border-color: #c4d8e5;
  color: var(--blue);
}
[data-theme="light"] :is(.connector-status.error, .form-error) {
  color: #a6412d;
}
[data-theme="light"] .connect-another {
  background: #f1f7f3;
  border-color: #a9c6b6;
  color: #2d6b4a;
}
[data-theme="light"] .connect-another:hover {
  border-color: var(--mint);
}
[data-theme="light"] :is(.share-bar, .analytics-summary > div, .catalog-icon) {
  background: #e7f0e9;
}
[data-theme="light"] .notice {
  background: #faf4df;
  border-color: #dacf9e;
  color: #6c5927;
}
[data-theme="light"] .notice.error {
  background: #fff0e9;
  border-color: #dbb09a;
  color: #8e422c;
}
[data-theme="light"] dialog {
  background: #ffffff;
  border-color: #a7c5b5;
  box-shadow: 0 30px 100px #24442f35;
}
[data-theme="light"] dialog::backdrop {
  background: #18392d66;
}
[data-theme="light"] :is(input, select, textarea) {
  background: #f6faf7;
  border-color: #b6cebe;
  color: var(--text);
}
[data-theme="light"] :is(input, textarea)::placeholder {
  color: #677e70;
}
[data-theme="light"] :is(input, select, textarea):focus {
  border-color: var(--mint);
  outline-color: #16765f40;
}
[data-theme="light"] code {
  color: #4c6438;
  background: #eaf1de;
}
[data-theme="light"] .login-screen {
  background: radial-gradient(ellipse at 30% 20%, #d5eadc, var(--bg) 60%);
}
[data-theme="light"] .login-card {
  background: #ffffffed;
  box-shadow: 0 15px 60px #254b3110;
}
[data-theme="light"] #toast {
  background: #215f45;
  border-color: #397d5e;
  color: white;
}
@media (max-width: 420px) {
  .topbar .demo-badge {
    display: none;
  }
}

@media (max-width: 360px) {
  .heading-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
  }
  .heading-actions > .button {
    width: 100%;
  }
  .flow-node {
    min-width: 0;
    width: 44%;
  }
  .flow-node > div {
    min-width: 0;
  }
  .flow-node em {
    max-width: 100%;
  }
}

/* Date navigation shared by Overview and Energy analytics. */
.period-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin: -8px 0 23px;
}
.date-controls {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  padding: 3px;
  gap: 2px;
}
.date-controls > .icon-button {
  width: 30px;
  height: 30px;
}
.date-controls button:disabled {
  cursor: default;
}
.previous-arrow {
  transform: rotate(180deg);
}
.calendar-button {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 4px 8px;
  background: none;
  border: 0;
  color: var(--text);
  font-size: 11px;
  border-radius: 4px;
  white-space: nowrap;
}
.calendar-button:hover {
  background: var(--bg);
}
.calendar-button > .icon {
  width: 15px;
  height: 15px;
  color: var(--muted);
}
.period-context {
  color: var(--muted);
  font-size: 10px;
  margin-left: auto;
}
.period-toolbar[aria-busy="true"] .period-context {
  opacity: 0.7;
}
#date-dialog {
  max-width: 420px;
}
#return-today {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 11px;
}
.chart-container:has(#chart-empty:not([hidden])) {
  display: grid;
}
.chart-container:has(#chart-empty:not([hidden])) #energy-chart {
  grid-area: 1 / 1;
  opacity: 0.3;
}
#chart-empty {
  grid-area: 1 / 1;
  align-self: center;
  position: relative;
  margin: 0;
  background: var(--panel);
}
@media (max-width: 800px) {
  .period-context {
    margin-left: 0;
  }
}
@media (max-width: 550px) {
  .period-toolbar {
    gap: 9px;
    margin-top: -7px;
  }
  .period-context {
    width: 100%;
  }
}

/* Devices use wrapped cards and charts so each circuit fits on a phone. */
.devices-summary {
  margin-bottom: 20px;
}
.device-summary-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  padding: 22px;
}
.device-summary-metrics > div {
  min-width: 0;
  padding: 17px;
  background: var(--chart-track);
  border-radius: 6px;
}
.device-summary-metrics > div > span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 10px;
}
.device-summary-metrics strong {
  font-size: 26px;
  font-weight: 450;
  font-variant-numeric: tabular-nums;
}
.device-summary-metrics small {
  font-size: 12px;
  color: var(--muted);
}
.device-graphs {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 20px;
  margin-bottom: 24px;
  align-items: start;
}
.device-graphs > .panel {
  min-width: 0;
}
.power-bars {
  display: grid;
  gap: 18px;
  padding: 26px 22px 16px;
}
.power-bar-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 12px;
}
.power-bar-label > span {
  overflow-wrap: anywhere;
  min-width: 0;
}
.power-bar-label strong {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}
.power-bar-track {
  height: 12px;
  border-radius: 4px;
  background: var(--chart-track);
  overflow: hidden;
}
.power-bar-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--circuit-color);
}
.power-bar-axis {
  display: flex;
  justify-content: space-between;
  margin: 0 22px 22px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 10px;
}
.device-donut-wrap {
  width: 185px;
  height: 185px;
  margin: 25px auto;
}
.device-circle-legend {
  list-style: none;
  padding: 0 22px 18px;
  margin: 0;
}
.device-circle-legend > li {
  display: flex;
  align-items: baseline;
  gap: 9px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}
.device-circle-legend .legend-name {
  flex: 1;
  min-width: 0;
}
.device-circle-legend .legend-name span {
  display: block;
  font-size: 11px;
  overflow-wrap: anywhere;
}
.device-circle-legend small {
  color: var(--muted);
  display: block;
  margin-top: 4px;
  font-size: 10px;
  overflow-wrap: anywhere;
}
.device-circle-legend strong {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}
.device-list-heading {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 5px;
  margin: 24px 0 14px;
}
.device-list-heading h2 {
  font-size: 15px;
  font-weight: 500;
  margin: 0;
}
.circuit-cards {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  list-style: none;
  padding: 0;
  margin: 0;
}
.circuit-card {
  padding: 20px 22px;
  min-width: 0;
}
.circuit-card-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}
.circuit-card-name {
  min-width: 0;
  flex: 1;
}
.circuit-card-name h3 {
  font-size: 14px;
  font-weight: 550;
  margin: 0;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.circuit-card-name h3 > .small-dot {
  margin-right: 8px;
  vertical-align: middle;
}
.circuit-card-name p {
  font-size: 11px;
  line-height: 1.7;
  margin: 4px 0 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.circuit-card-power {
  font-weight: 450;
  font-size: 23px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.circuit-card-power small {
  font-size: 11px;
  color: var(--muted);
}
.circuit-card dl {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  margin: 18px 0 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.circuit-card dt {
  font-size: 10px;
  color: var(--muted);
  margin-bottom: 5px;
}
.circuit-card dd {
  font-size: 12px;
  line-height: 1.7;
  margin: 0;
  overflow-wrap: anywhere;
}
.circuit-share-track {
  height: 5px;
  border-radius: 3px;
  background: var(--chart-track);
  overflow: hidden;
}
.circuit-share-track > span {
  display: block;
  height: 100%;
  background: var(--circuit-color);
}
@media (max-width: 900px) {
  .device-graphs {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 550px) {
  .device-summary-metrics {
    grid-template-columns: minmax(0, 1fr);
    padding: 18px 16px;
    gap: 9px;
  }
  .device-summary-metrics > div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 14px;
  }
  .device-summary-metrics > div > span {
    margin: 0;
  }
  .device-summary-metrics strong {
    font-size: 22px;
  }
  .power-bars {
    padding: 22px 16px 14px;
  }
  .power-bar-axis {
    margin-left: 16px;
    margin-right: 16px;
  }
  .power-bar-label {
    font-size: 11px;
  }
  .device-circle-legend {
    padding-left: 16px;
    padding-right: 16px;
  }
  .circuit-card {
    padding: 18px 16px;
  }
  .circuit-card-heading {
    flex-wrap: wrap;
    gap: 8px;
  }
  .circuit-card-name {
    flex-basis: 100%;
  }
  .circuit-card-power {
    font-size: 22px;
  }
  .circuit-card dl {
    grid-template-columns: minmax(0, 1fr);
    gap: 13px;
  }
}

.demo-tour {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  font-size: 13px;
}
.demo-tour[hidden] {
  display: none;
}
#server-identity {
  overflow-wrap: anywhere;
}
.login-card a {
  color: var(--text);
}
.login-card input[readonly] {
  color: var(--muted);
}
@media (max-width: 600px) {
  .demo-tour {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px 18px;
  }
}
