.energy-page-anchor {
  position: relative;
  min-height: 100vh;
  isolation: isolate;
}
.energy-page-anchor > :not(.energy-backdrop) { position: relative; z-index: 1; }
.energy-backdrop {
  position: fixed;
  z-index: 0;
  inset: 0;
  overflow: hidden;
  background: #FFFFFF;
  pointer-events: none;
}
.energy-backdrop::before,
.energy-backdrop::after {
  content: '';
  position: absolute;
  width: 42vw;
  height: 42vw;
  min-width: 420px;
  min-height: 420px;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.16;
  animation: energy-backdrop-drift 18s ease-in-out infinite alternate;
}
.energy-backdrop::before { top: -18vw; right: -10vw; background: #A9D8C6; }
.energy-backdrop::after { bottom: -20vw; left: -12vw; background: #B9D4F5; animation-duration: 22s; animation-direction: alternate-reverse; }
@keyframes energy-backdrop-drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(4vw, 3vh, 0) scale(1.04); }
}

.energy-breadcrumb {
  margin-bottom: 16px;
  padding: 10px 16px;
  border: 1px solid #E8E8E8;
  border-radius: 8px;
  color: #888888;
  background: #FFFFFF;
  font-size: 13px;
}
.energy-breadcrumb a { color: #1E88E5; font-weight: 500; text-decoration: none; }
.energy-breadcrumb a:hover { text-decoration: underline; }
.energy-crumb-separator { margin: 0 6px; color: #888888; }

#energy-app {
  --energy-accent: #1F6A55;
  --energy-page: #F2F1F6;
  --energy-surface: #FFFFFF;
  --energy-text: #1D1D1F;
  --energy-muted: #858A83;
  --energy-line: #E3E7E1;
  display: block;
  box-sizing: border-box;
  width: 100%;
  max-width: none;
  min-height: 360px;
  margin: 0;
  padding: 32px;
  color: var(--energy-text);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-synthesis: none;
  line-height: 1.5;
}

#energy-app *,
#energy-app *::before,
#energy-app *::after { box-sizing: border-box; }
#energy-app button,
#energy-app input { font: inherit; }
#energy-app button { -webkit-tap-highlight-color: transparent; }
#energy-app h1,
#energy-app h2,
#energy-app h3,
#energy-app p { margin-top: 0; }
#energy-app svg { display: block; }
#energy-app [hidden] { display: none !important; }

.energy-page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}
.energy-page-header h1 {
  margin-bottom: 8px;
  font-size: clamp(28px, 2.2vw, 38px);
  line-height: 1.2;
  letter-spacing: -0.04em;
}
.energy-page-header p:last-child { margin-bottom: 0; color: var(--energy-muted); font-size: 14px; }
.energy-eyebrow {
  margin-bottom: 5px;
  color: #838780;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.12em;
}
.energy-page-badge {
  flex: 0 0 auto;
  padding: 8px 13px;
  border: 1px solid #DDE3DC;
  border-radius: 999px;
  color: #526257;
  background: rgb(255 255 255 / 65%);
  font-size: 12px;
}
.energy-page-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
}
.energy-page-actions [data-metric] { width: 176px; }
.energy-back-link {
  display: inline-block;
  margin-bottom: 14px;
  color: #68736B;
  font-size: 13px;
  text-decoration: none;
}
.energy-back-link:hover { color: var(--energy-accent); text-decoration: underline; }

.energy-brand-list { display: grid; gap: 30px; }
.energy-brand-block { min-width: 0; }
.energy-brand-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
}
.energy-brand-head h2 { margin-bottom: 3px; font-size: 22px; line-height: 1.3; }
.energy-brand-head > div > span { color: var(--energy-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.energy-brand-actions { display: flex; align-items: center; gap: 14px; }
.energy-brand-actions [data-range] { width: 190px; }
.energy-text-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #4F6256;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.energy-text-link svg { width: 17px; height: 17px; }
.energy-text-link:hover { color: var(--energy-accent); }

.energy-overview-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}
.energy-store-card,
.energy-brand-store-card,
.energy-device-card {
  min-width: 0;
  border: 1px solid #E7E9E5;
  border-radius: 22px;
  background: var(--energy-surface);
  box-shadow: 0 6px 24px rgb(29 48 37 / 4%);
}
.energy-store-card { padding: 14px 12px; }
.energy-store-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.energy-store-head h3 { margin-bottom: 3px; font-size: 15px; line-height: 1.35; overflow-wrap: anywhere; }
.energy-store-head p { margin-bottom: 0; color: var(--energy-muted); font-size: 10px; overflow-wrap: anywhere; }
.energy-arrow-link {
  display: grid;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  padding: 6px;
  place-items: center;
  border-radius: 50%;
  color: #9BA19B;
  text-decoration: none;
  transition: color 150ms ease, background 150ms ease;
}
.energy-arrow-link svg { width: 100%; height: 100%; }
.energy-arrow-link:hover { color: var(--energy-accent); background: #F0F3EF; }
.energy-arrow-link:focus-visible,
.energy-text-link:focus-visible,
.energy-back-link:focus-visible { outline: 2px solid var(--energy-accent); outline-offset: 3px; }

.energy-overview-chart { min-width: 0; min-height: 180px; }

.energy-brand-store-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.energy-brand-store-card { padding: 16px; }
.energy-card-controls { display: grid; grid-template-columns: 0.8fr 1.25fr 0.9fr; gap: 6px; margin-top: 12px; }
.energy-card-summary {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 7px 12px;
  min-height: 36px;
  margin: 12px 0 2px;
}
.energy-card-summary > span { flex: 1 1 100%; color: var(--energy-muted); font-size: 11px; }
.energy-card-summary strong { color: var(--energy-accent); font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.energy-card-summary strong small { font-size: 11px; font-weight: 400; }
.energy-card-summary em { color: #858B85; font-size: 11px; font-style: normal; }
.energy-brand-chart { min-width: 0; min-height: 240px; }

.energy-capsule {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--option-count), minmax(0, 1fr));
  width: 100%;
  min-width: 0;
  padding: 4px;
  border: 1px solid #E4E7E2;
  border-radius: 999px;
  background: #EFF1ED;
  isolation: isolate;
}
.energy-capsule-slider {
  position: absolute;
  z-index: 0;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc((100% - 8px) / var(--option-count));
  border-radius: 999px;
  background: var(--energy-accent);
  box-shadow: 0 3px 8px rgb(29 48 37 / 16%), inset 0 1px 0 rgb(255 255 255 / 22%);
  transform: translate3d(calc(var(--selected-index, 0) * 100%), 0, 0);
  transition: transform 180ms ease;
  pointer-events: none;
}
.energy-capsule button {
  position: relative;
  z-index: 1;
  min-width: 0;
  min-height: 32px;
  margin: 0;
  padding: 6px 9px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  color: #777C75;
  background: transparent;
  font-size: 12px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  transition: color 160ms ease;
}
.energy-capsule button[aria-pressed="true"] { color: #FFFFFF; }
.energy-capsule button:hover { color: #1D1D1F; background: transparent; }
.energy-capsule button[aria-pressed="true"]:hover { color: #FFFFFF; background: transparent; }
.energy-capsule button:focus-visible { outline: 2px solid var(--energy-accent); outline-offset: 3px; }

.energy-chart-legend,
.energy-daily-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px 16px;
  min-height: 28px;
  margin: 4px 0 8px;
}
.energy-chart-legend > span,
.energy-daily-legend > span { display: inline-flex; align-items: center; min-width: 0; gap: 6px; }
.energy-chart-legend > span[data-legend-index] { cursor: pointer; user-select: none; }
.energy-chart-legend i,
.energy-daily-legend i { flex: 0 0 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--legend-color); }
.energy-chart-legend b,
.energy-daily-legend b { overflow: hidden; color: #606760; font-size: 11px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.energy-chart-legend small { color: #9A9F99; font-size: 9px; font-variant-numeric: tabular-nums; }
.energy-chart-scroll {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scrollbar-color: #C8CEC8 transparent;
  scrollbar-width: thin;
}
.energy-chart-scroll svg { max-width: none; height: auto; overflow: visible; cursor: crosshair; }
.energy-chart-grid {
  stroke: #D9DED8;
  stroke-width: 1;
  stroke-dasharray: 5 6;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}
.energy-axis-value,
.energy-chart-date,
.energy-chart-unit,
.energy-daily-time {
  fill: #92978F;
  font-family: inherit;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
.energy-chart-unit { font-size: 10px; font-weight: 650; letter-spacing: 0.06em; }
.energy-daily-time.is-on { fill: var(--energy-accent); font-weight: 650; }
.energy-summary-value {
  fill: #4F5951;
  font-family: inherit;
  font-size: 11px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
.energy-summary-bar,
.energy-schedule-bar { transition: opacity 120ms ease; }
.energy-summary-bar:hover,
.energy-schedule-bar:hover { opacity: 0.8; }
.energy-summary-bar.is-missing { fill: transparent; }
.energy-schedule-bar.is-zero { pointer-events: none; }
.energy-daily-line,
.energy-schedule-line {
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}
.energy-electricity-card .energy-daily-line { stroke-width: 2; }
.energy-daily-point { pointer-events: none; }
.energy-schedule-point { stroke: #FFFFFF; stroke-width: 2; cursor: pointer; }

.energy-chart-tooltip-host { position: relative; }
.energy-pointer-indicator {
  stroke: #B9C0B9;
  stroke-width: 1;
  stroke-dasharray: 4 5;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}
.energy-pointer-indicator.is-vertical { stroke-width: 1.5; }
.energy-chart-tooltip {
  position: absolute;
  z-index: 60;
  top: 0;
  left: 0;
  min-width: 176px;
  max-width: 270px;
  padding: 11px 13px;
  border: 1px solid #E2E5E0;
  border-radius: 12px;
  color: #414742;
  background: rgb(247 248 246 / 97%);
  box-shadow: 0 8px 24px rgb(29 36 31 / 12%);
  font-size: 12px;
  pointer-events: none;
}
.energy-tooltip-title { margin-bottom: 8px; color: #777E78; font-size: 11px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.energy-tooltip-row { display: grid; grid-template-columns: 8px minmax(0, 1fr) auto; align-items: center; gap: 8px; margin-top: 6px; }
.energy-tooltip-row i { width: 7px; height: 7px; border-radius: 50%; background: var(--tooltip-dot); }
.energy-tooltip-row span { color: #666D67; overflow-wrap: anywhere; }
.energy-tooltip-row strong { color: #3F4540; font-weight: 650; white-space: nowrap; font-variant-numeric: tabular-nums; }

.energy-device-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.energy-device-card { padding: 24px; }
.energy-device-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.energy-device-title { display: flex; align-items: center; min-width: 0; gap: 12px; }
.energy-device-title > i { flex: 0 0 11px; width: 11px; height: 42px; border-radius: 999px; background: var(--device-dot); }
.energy-device-title p { margin-bottom: 2px; color: var(--energy-accent); font-size: 11px; font-weight: 650; }
.energy-device-title h2 { margin-bottom: 2px; font-size: 20px; line-height: 1.3; overflow-wrap: anywhere; }
.energy-device-title span { display: block; color: var(--energy-muted); font-size: 11px; overflow-wrap: anywhere; }
.energy-device-head [data-view] { flex: 0 0 176px; width: 176px; }
.energy-device-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; min-height: 46px; margin-bottom: 10px; }
.energy-device-toolbar > [data-range] { flex: 0 1 270px; width: 270px; }
.energy-device-toolbar > [data-custom-range] { flex: 0 1 250px; }
.energy-range-caption { margin-left: auto; color: var(--energy-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.energy-daily-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.energy-daily-controls [data-ac-mode] { width: 176px; }
.energy-device-chart { min-width: 0; min-height: 320px; }

.energy-calendar { position: relative; min-width: 0; }
.energy-calendar-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 8px 13px;
  border: 1px solid #E1E5DF;
  border-radius: 999px;
  color: #4F554E;
  background: #FFFFFF;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  cursor: pointer;
}
.energy-calendar-trigger svg { flex: 0 0 18px; width: 18px; height: 18px; color: var(--energy-accent); }
.energy-calendar-trigger:focus-visible { outline: 2px solid var(--energy-accent); outline-offset: 2px; }
.energy-calendar-panel {
  position: absolute;
  z-index: 80;
  top: 50px;
  right: 0;
  width: 308px;
  padding: 16px;
  border: 1px solid #E3E6E1;
  border-radius: 20px;
  background: #FFFFFF;
  box-shadow: 0 18px 48px rgb(29 48 37 / 16%);
}
.energy-calendar-panel.is-loading .energy-calendar-days { opacity: 0.55; }
.energy-calendar-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.energy-calendar-head strong { font-size: 15px; }
.energy-calendar-head button { width: 32px; height: 32px; padding: 7px; border: 0; border-radius: 50%; color: #666C65; background: #F3F5F1; cursor: pointer; }
.energy-calendar-head button.is-previous svg { transform: rotate(180deg); }
.energy-calendar-head svg { width: 100%; height: 100%; }
.energy-calendar-weekdays,
.energy-calendar-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.energy-calendar-weekdays { margin-bottom: 5px; }
.energy-calendar-weekdays span { color: #92978F; font-size: 11px; text-align: center; }
.energy-calendar-days button {
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #1D1D1F;
  background: transparent;
  font-size: 12px;
  cursor: pointer;
}
.energy-calendar-days button:hover:not(:disabled) { background: #EEF1EC; }
.energy-calendar-days button.is-outside:not(:disabled) { color: #747A74; }
.energy-calendar-days button.is-in-range { border-radius: 8px; background: #E9F0EB; }
.energy-calendar-days button.is-selected { color: #FFFFFF; background: var(--energy-accent); font-weight: 650; }
.energy-calendar-days button:disabled { color: #CDD0CB; cursor: default; }
.energy-calendar-days button:focus-visible { outline: 2px solid var(--energy-accent); outline-offset: 1px; }
.energy-calendar-status { min-height: 18px; margin: 10px 0 0; color: #8A7460; font-size: 11px; text-align: center; }

.energy-loading,
.energy-empty,
.energy-error {
  display: flex;
  min-height: 180px;
  padding: 24px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  border-radius: 16px;
  color: #858C84;
  background: #FFFFFF;
  text-align: center;
}
.energy-loading p { margin: 12px 0 0; font-size: 13px; }
.energy-empty { font-size: 13px; }
.energy-error { color: #9B5A4D; background: #FBF6F3; }
.energy-error strong { color: #74483E; }
.energy-error p { max-width: 600px; margin: 8px 0 0; overflow-wrap: anywhere; }
.energy-overview-grid > .energy-empty,
.energy-brand-store-grid > .energy-empty,
.energy-device-grid > .energy-empty { grid-column: 1 / -1; }

@media (max-width: 1120px) {
  #energy-app { padding: 26px; }
  #energy-app .energy-overview-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #energy-app .energy-brand-store-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #energy-app .energy-device-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  #energy-app .energy-overview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #energy-app .energy-brand-store-grid { grid-template-columns: 1fr; }
  #energy-app .energy-page-header,
  #energy-app .energy-brand-head { align-items: flex-start; flex-direction: column; }
  #energy-app .energy-brand-actions { width: 100%; justify-content: space-between; }
  #energy-app .energy-page-badge { display: none; }
  #energy-app .energy-page-actions { width: 100%; justify-content: flex-start; }
}
@media (max-width: 640px) {
  #energy-app { padding: 18px 14px; }
  #energy-app .energy-overview-grid { grid-template-columns: 1fr; }
  #energy-app .energy-brand-actions { align-items: stretch; flex-direction: column; }
  #energy-app .energy-brand-actions [data-range] { width: 100%; }
  #energy-app .energy-card-controls { grid-template-columns: 1fr; }
  #energy-app .energy-device-card { padding: 18px 14px; }
  #energy-app .energy-device-head { align-items: flex-start; flex-direction: column; }
  #energy-app .energy-device-head [data-view] { width: 100%; flex-basis: auto; }
  #energy-app .energy-device-toolbar > [data-range],
  #energy-app .energy-device-toolbar > [data-custom-range] { width: 100%; flex-basis: 100%; }
  #energy-app .energy-range-caption { margin-left: 0; }
  #energy-app .energy-page-actions [data-metric] { width: 100%; }
  #energy-app .energy-calendar-panel { right: auto; left: 0; width: min(308px, calc(100vw - 56px)); }
}
@media (prefers-reduced-motion: reduce) {
  /* 胶囊滑块是选项位置反馈，明确不参与减少动画；其余控件和背景仍遵守系统设置。 */
  #energy-app *:not(.energy-capsule-slider),
  #energy-app *::before,
  #energy-app *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
  .energy-backdrop::before,
  .energy-backdrop::after { animation: none !important; }
}
