/* Approved live-energy scope: retain existing site icons, hold the site topology card and island treatment. */
.live-energy-card {
  display: none !important;
}

.map-stage > .energy-heartbeat {
  opacity: 0;
  pointer-events: none;
}

.sidebar .energy-heartbeat {
  position: relative;
  z-index: 1;
  left: auto;
  right: auto;
  bottom: auto;
  width: auto;
  margin: 9px 0 7px;
  padding: 10px 11px 0;
  overflow: hidden;
  border: 1px solid rgba(0,32,92,.12);
  border-radius: 15px;
  background: linear-gradient(180deg,#f8f9fd 0%,#fff 70%);
  box-shadow: 0 5px 16px rgba(0,32,92,.045);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  opacity: 1;
}

.sidebar .energy-heartbeat-head {
  display: grid;
  grid-template-columns: 9px minmax(0,1fr) 28px;
  grid-template-areas:
    "dot title button"
    ". age button";
  align-items: center;
  column-gap: 7px;
  row-gap: 1px;
}

.sidebar .energy-heartbeat-dot {
  grid-area: dot;
  width: 8px;
  height: 8px;
  box-shadow: 0 0 0 4px rgba(245,185,38,.12);
}

.sidebar .energy-heartbeat-head strong {
  grid-area: title;
  min-width: 0;
  overflow: hidden;
  color: #10265f;
  font-family: "Oswald", sans-serif;
  font-size: 11.35px;
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: .06em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar .energy-heartbeat-head [data-energy-age] {
  grid-area: age;
  min-width: 0;
  overflow: hidden;
  color: #7a8395;
  font-size: 7.75px;
  font-weight: 700;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar .energy-heartbeat-head button {
  grid-area: button;
  width: 28px;
  height: 28px;
  border-color: rgba(0,32,92,.13);
  background: rgba(255,255,255,.84);
  font-size: 15px;
}

.sidebar .energy-heartbeat-counts {
  margin-top: 8px;
  color: #12285f;
  font-size: 9.7px;
  font-weight: 800;
  line-height: 1.2;
}

.energy-realtime-detail {
  margin-top: 6px;
}

.energy-status-grid {
  display: grid;
  grid-template-columns: repeat(4,minmax(0,1fr));
  gap: 4px;
}

.energy-status-item {
  min-width: 0;
  padding: 5px 2px 4px;
  border: 1px solid rgba(0,32,92,.07);
  border-radius: 8px;
  background: rgba(255,255,255,.78);
  text-align: center;
}

.energy-status-item strong {
  display: block;
  color: #10265f;
  font-family: "Oswald", sans-serif;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
}

.energy-status-item span {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: #6b7488;
  font-size: 6.75px;
  font-weight: 700;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.energy-status-item.status-export strong { color: #9b6900; }
.energy-status-item.status-charging strong { color: #4b5fa6; }
.energy-status-item.status-discharging strong { color: #183d83; }

.energy-battery-charge {
  margin-top: 7px;
}

.energy-battery-charge-copy {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.energy-battery-charge-copy strong {
  color: #10265f;
  font-family: "Oswald", sans-serif;
  font-size: 13px;
  line-height: 1;
}

.energy-battery-charge-copy span {
  color: #59647a;
  font-size: 7.95px;
  font-weight: 700;
}

.energy-battery-charge-track {
  height: 4px;
  margin-top: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(0,32,92,.08);
}

.energy-battery-charge-track i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg,#f2b823 0%,#3346a7 100%);
  transition: width .45s ease;
}

.sidebar .energy-heartbeat-legend {
  display: none;
}

.energy-monthly-tally {
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px solid rgba(0,32,92,.09);
}

.energy-section-label,
.energy-vpp-kicker {
  margin-bottom: 4px;
  color: #3346a7;
  font-family: "Oswald", sans-serif;
  font-size: 8.15px;
  font-weight: 700;
  letter-spacing: .105em;
  text-transform: uppercase;
}

.energy-monthly-grid {
  display: grid;
  grid-template-columns: 1.12fr .88fr;
  gap: 0;
}

.energy-monthly-stat {
  min-width: 0;
  padding: 5px 7px 5px 0;
}

.energy-monthly-stat + .energy-monthly-stat {
  padding-left: 9px;
  border-left: 1px solid rgba(0,32,92,.075);
}

.energy-monthly-stat strong {
  display: block;
  color: #00205c;
  font-family: "Oswald", sans-serif;
  font-size: 20px;
  font-weight: 700;
  line-height: .98;
  letter-spacing: -.015em;
  white-space: nowrap;
}

.energy-monthly-stat span {
  display: block;
  margin-top: 4px;
  color: #59647a;
  font-size: 7.8px;
  font-weight: 700;
  line-height: 1.16;
}

.energy-monthly-tally.is-loading .energy-monthly-stat strong,
.energy-vpp-summary.is-loading .energy-vpp-stat strong {
  color: #8b95a7;
}

.sidebar .energy-heartbeat-power {
  display: grid;
  grid-template-columns: 96px minmax(0,1fr);
  align-items: center;
  gap: 8px;
  margin: 7px 0 0;
  padding: 7px 9px;
  border: 1px solid rgba(220,158,0,.13);
  border-radius: 9px;
  background: rgba(245,185,38,.075);
}

.sidebar .energy-heartbeat.net-import .energy-heartbeat-power {
  border-color: rgba(75,95,166,.12);
  background: rgba(75,95,166,.06);
}

.sidebar .energy-heartbeat-power strong,
.sidebar .energy-heartbeat.mode-export .energy-heartbeat-power strong,
.sidebar .energy-heartbeat.mode-vpp .energy-heartbeat-power strong {
  color: #00205c;
  font-family: "Oswald", sans-serif;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.sidebar .energy-heartbeat-power span,
.sidebar .energy-heartbeat.mode-export .energy-heartbeat-power span,
.sidebar .energy-heartbeat.mode-vpp .energy-heartbeat-power span {
  color: #59647a;
  font-size: 7.95px;
  font-weight: 750;
  line-height: 1.15;
}

.energy-vpp-summary {
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px solid rgba(0,32,92,.09);
}

.energy-vpp-grid {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 5px;
}

.energy-vpp-stat {
  min-width: 0;
  padding: 6px 7px;
  border: 1px solid rgba(0,32,92,.065);
  border-radius: 8px;
  background: rgba(0,32,92,.022);
}

.energy-vpp-stat strong {
  display: block;
  color: #00205c;
  font-family: "Oswald", sans-serif;
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.energy-vpp-stat span {
  display: block;
  margin-top: 3px;
  color: #626c80;
  font-size: 7.25px;
  font-weight: 700;
  line-height: 1.13;
}

.energy-sites-toggle {
  width: calc(100% + 22px);
  min-height: 35px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 9px -11px 0;
  padding: 0 12px;
  border: 0;
  border-top: 1px solid rgba(0,32,92,.09);
  border-radius: 0 0 14px 14px;
  background: rgba(0,32,92,.028);
  color: #16306b;
  font-family: "Oswald", sans-serif;
  font-size: 9.1px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  cursor: pointer;
}

.energy-sites-toggle:hover { background: rgba(0,32,92,.055); }
.energy-sites-toggle:focus-visible { outline: 2px solid rgba(255,182,0,.72); outline-offset: -2px; }
.energy-sites-toggle-chevron { font-size: 15px; line-height: 1; transition: transform .18s ease; }
.energy-sites-toggle.is-expanded .energy-sites-toggle-chevron { transform: rotate(180deg); }

.sidebar.live-sites-collapsed .site-list {
  display: none;
}

.sidebar .site-list {
  display: block;
  margin-top: 2px;
}

.site-city-group {
  display: grid;
  gap: 0;
  margin-top: 6px;
}

.site-city-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px 3px;
  color: #3346a7;
  font-family: "Oswald", sans-serif;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: .095em;
  text-transform: uppercase;
}

.site-city-heading small {
  min-width: 19px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(0,32,92,.06);
  color: #667188;
  font-family: "Noto Sans", sans-serif;
  font-size: 7.5px;
  font-weight: 800;
  letter-spacing: 0;
}

.sidebar .site-row {
  min-height: 58px;
  grid-template-columns: 34px minmax(0,1fr);
  gap: 8px;
  padding: 5px 7px;
  border-radius: 10px;
}

.sidebar .site-logo {
  width: 34px;
  height: 34px;
}

.sidebar .site-name {
  font-size: 11.7px;
  line-height: 1.16;
}

.sidebar .site-meta {
  margin-top: 2px;
  font-size: 8.55px;
  line-height: 1.16;
}

.site-live-stats {
  display: block;
  min-width: 0;
  margin-top: 3px;
  overflow: hidden;
  color: #59647a;
  font-size: 8.05px;
  font-weight: 700;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-live-stats::before {
  content: "";
  width: 5px;
  height: 5px;
  display: inline-block;
  margin: 0 5px 1px 0;
  border-radius: 50%;
  background: #9aa2b1;
}

.site-live-stats.is-export::before { background: #e3a90f; }
.site-live-stats.is-charging::before { background: #7181d3; }
.site-live-stats.is-discharging::before { background: #365a9c; }
.site-live-stats.is-import::before { background: #8792a9; }
.site-live-stats.is-standby::before { background: #a8afbc; }
.site-live-stats.is-loading,
.site-live-stats.is-unavailable { color: #8a93a3; font-weight: 600; }

.energy-heartbeat-legend .legend-local {
  background: var(--energy-local);
}

@media (max-width: 980px) {
  .sidebar-head {
    padding: 0 5px 9px;
  }

  .sidebar-head p {
    margin-bottom: 3px;
    font-size: 9.5px;
  }

  .sidebar-head h1 {
    font-size: 28px;
  }

  .site-count {
    min-width: 36px;
    height: 28px;
  }

  .sidebar .energy-heartbeat {
    left: auto;
    right: auto;
    bottom: auto;
    width: auto;
    margin: 8px 0 7px;
    padding: 10px 11px 0;
    border-radius: 15px;
  }
}

@media (max-width: 430px) {
  .sidebar .energy-heartbeat-head strong {
    font-size: 10.8px;
  }

  .energy-status-grid {
    gap: 3px;
  }

  .energy-status-item span {
    font-size: 6.35px;
  }

  .energy-monthly-stat strong {
    font-size: 18.5px;
  }

  .energy-monthly-stat span,
  .energy-vpp-stat span {
    font-size: 7px;
  }

  .sidebar .energy-heartbeat-power {
    grid-template-columns: 88px minmax(0,1fr);
  }
}
