/* Vivid redesign: Savings (#screen-energy). Loaded after styles-vivid.css; scope every rule to this area.
   Mockup 06: the period as a mint segmented control, ONE mint hero ("You saved" / $13.80 / "44% less" in dark ink /
   what you paid / the cumulative line), the rings card, the Solar and Powerwall row, Vera's note, then the details
   (live session, recent charges, Prices & charging, gas, rate check). Free accounts see one VueRate Drive card; the
   tab shows one card before the first charge, while loading, and when it can't load. The calm rules this replaces
   use #screen-energy .x and !important, so these match or beat them. */

#screen-energy {
  --sv-gap: 12px;
}

/* ---------- Header + period ---------- */
#screen-energy > .calm-savings-heading {
  align-items: center;
  min-height: 60px;
  margin-bottom: 14px;
}

#screen-energy > .calm-savings-heading h2 {
  font-size: clamp(30px, 8.8vw, 34px);
  font-weight: 800;
}

#screen-energy > .sv-seg {
  margin: 0 0 var(--sv-gap);
}

#screen-energy > .sv-seg > button {
  position: relative;
  min-height: 44px;
  font-size: 15px;
}

/* The period only means something with car savings. It stays up while a period loads or fails, so a slow or
   failed period can always be switched back. */
#screen-energy[data-savings-state="locked"] > .sv-seg,
#screen-energy[data-savings-state="home-only"] > .sv-seg,
body[data-home-only="true"] #screen-energy > .sv-seg {
  display: none;
}

/* What shows in each state. */
#screen-energy .savings-summary-card.sv-hero,
#screen-energy .savings-pro-teaser.sv-drive {
  display: none;
}

#screen-energy[data-savings-state="shown"] .savings-summary-card.sv-hero {
  display: block;
}

#screen-energy[data-savings-state="locked"] .savings-pro-teaser.sv-drive {
  display: flex;
}

#screen-energy:not([data-savings-state="shown"]) .charge-summary-list-card,
#screen-energy .charge-summary-list-card.sv-none,
#screen-energy:not([data-savings-state="shown"]) #gasCompareCard,
#screen-energy:not([data-savings-state="shown"]) #rateCheckCard,
#screen-energy[data-savings-state="loading"] #weeklyChargingCard,
#screen-energy[data-savings-state="error"] #weeklyChargingCard {
  display: none !important;
}

/* Cards in this tab sit 12px apart. */
#screen-energy > .v-card,
#screen-energy > .hero,
#screen-energy > .v-rowlink,
#screen-energy > .rev-say,
#screen-energy > .settings-card,
#screen-energy > .charge-summary-list-card,
#screen-energy > .savings-period-card,
#screen-energy > .savings-pro-teaser {
  margin: 0 0 var(--sv-gap) !important;
}

/* ---------- The mint hero ---------- */
#screen-energy .savings-summary-card.sv-hero {
  position: relative;
  overflow: hidden;
  padding: 18px 18px 16px !important;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--v-r-hero);
  background: var(--v-hero-mint) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 20px 50px -20px rgba(59, 232, 166, 0.38);
}

#screen-energy .sv-hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 32px;
}

#screen-energy .sv-hero-top .sv-hero-label {
  flex: 1;
  min-width: 0;
  color: #fff;
}

#screen-energy .sv-hero-top .v-chip.mint {
  flex: none;
  min-height: 32px;
  padding: 5px 13px;
  font-size: 14px;
}

#screen-energy .sv-hero-top .v-chip.hidden {
  display: none;
}

#screen-energy .savings-summary-card.sv-hero .savings-hero {
  display: block;
  margin-top: 8px;
}

#screen-energy .savings-summary-card .savings-hero h2#savingsTotal {
  margin: 0;
  color: #fff;
  font-size: clamp(54px, 19vw, 76px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.045em;
  white-space: nowrap;
  overflow-wrap: normal;
}

/* Long figures ("$1,234.56", "$12,345.67") step down so they stay on one line inside the hero at 320. */
#screen-energy .savings-summary-card .savings-hero h2#savingsTotal[data-len="8"] {
  font-size: clamp(46px, 15.5vw, 66px);
}

#screen-energy .savings-summary-card .savings-hero h2#savingsTotal[data-len="9"] {
  font-size: clamp(40px, 13.5vw, 58px);
}

#screen-energy .savings-summary-card .savings-hero h2#savingsTotal[data-len="10"],
#screen-energy .savings-summary-card .savings-hero h2#savingsTotal[data-len="11"],
#screen-energy .savings-summary-card .savings-hero h2#savingsTotal[data-len="12"] {
  font-size: clamp(34px, 11.5vw, 50px);
}

/* A million and up ("$1,234,567.32") still fits on one line at 320; beyond that the figure scales down to fit. */
#screen-energy .savings-summary-card .savings-hero h2#savingsTotal[data-len="13"] {
  font-size: clamp(30px, 10vw, 44px);
}

#screen-energy .savings-summary-card .savings-hero h2#savingsTotal:is([data-len="14"], [data-len="15"], [data-len="16"]) {
  font-size: clamp(26px, 8.4vw, 38px);
}

#screen-energy .savings-summary-card .savings-hero h2#savingsTotal[data-fit] {
  font-size: var(--sv-fit-size) !important;
}

#screen-energy .savings-summary-card .savings-hero h2#savingsTotal .sv-amt {
  display: inline-block;
  max-width: 100%;
}

/* Words instead of a figure ("Savings not available"): a title, not a numeral. */
#screen-energy .savings-summary-card .savings-hero h2#savingsTotal.is-words {
  font-size: clamp(28px, 8.4vw, 34px);
  line-height: 1.1;
  letter-spacing: -0.03em;
  white-space: normal;
}

#screen-energy .savings-summary-card .sv-hero-line {
  margin: 10px 0 0;
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.4;
  text-wrap: pretty;
}

#screen-energy .savings-summary-card .sv-hero-line:empty {
  display: none;
}

/* The cumulative line: white with a soft fill, the dot at today. */
#screen-energy .sv-spark {
  position: relative;
  margin: 14px 7px 0 0;
}

#screen-energy .sv-spark.hidden {
  display: none;
}

#screen-energy .sv-spark svg {
  display: block;
  width: 100%;
  height: 60px;
  overflow: visible;
}

#screen-energy .sv-spark-line {
  filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.55));
}

#screen-energy .sv-spark-dot {
  position: absolute;
  right: -7px;
  width: 14px;
  height: 14px;
  margin-top: -7px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.25);
}

#screen-energy .sv-spark-axis {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

/* ---------- Rings card ---------- */
#screen-energy .sv-break {
  padding: 14px 16px 0;
}

#screen-energy .sv-break.hidden {
  display: none;
}

#screen-energy .sv-break-body {
  display: flex;
  align-items: center;
  gap: 16px;
}

#screen-energy .sv-rings {
  flex: none;
  width: clamp(88px, 28vw, 112px);
}

#screen-energy .sv-rings svg {
  display: block;
  width: 100%;
  height: auto;
}

#screen-energy .sv-legend {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 9px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

#screen-energy .sv-legend > .sv-leg {
  display: block;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

#screen-energy .sv-legend > div.hidden {
  display: none;
}

#screen-energy .sv-legend dt {
  display: flex;
  align-items: baseline;
  gap: 7px;
  color: var(--v-tx2);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
}

#screen-energy .sv-legend dt i {
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

#screen-energy .sv-leg[data-ring="mint"] dt i { background: var(--v-mint); }
#screen-energy .sv-leg[data-ring="sun"] dt i { background: var(--v-sun); }
#screen-energy .sv-leg[data-ring="none"] dt i { background: transparent; }

#screen-energy .sv-legend dd {
  margin: 1px 0 0;
  padding-left: 16px;
  color: var(--v-tx);
  font-size: clamp(17px, 5.2vw, 20px);
  font-weight: 750;
  line-height: 1.15;
  letter-spacing: -0.02em;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

#screen-energy .savings-bars.sv-math {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 48px;
  margin: 12px -16px 0;
  padding: 0 16px;
  border-top: 1px solid var(--v-line);
  color: var(--v-car2);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

#screen-energy .savings-bars.sv-math:empty {
  display: none;
}

#screen-energy .sv-math .v-chev {
  color: var(--v-car2);
}

/* ---------- Solar and Powerwall ---------- */
#screen-energy .sv-home-row {
  min-height: 64px;
  border-color: rgba(255, 181, 71, 0.22);
  background: linear-gradient(90deg, rgba(255, 181, 71, 0.14), rgba(255, 181, 71, 0) 70%), var(--v-card);
}

#screen-energy .sv-home-row.hidden {
  display: none;
}

#screen-energy .sv-home-row .t {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

#screen-energy .sv-home-row .v-ttl {
  font-size: clamp(14px, 4.3vw, 16px);
}

#screen-energy .sv-home-val {
  flex: none;
  color: var(--v-sun);
  font-size: 18px;
}

/* At the narrowest widths the title gets the whole first line and the amount sits beside the period, so neither
   breaks into a stack of short lines. */
@media (max-width: 374px) {
  #screen-energy .sv-home-row:not(.hidden) {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    grid-template-areas:
      "ico ttl ttl chev"
      "ico lbl val chev";
    align-items: center;
    column-gap: 10px;
    row-gap: 2px;
  }

  #screen-energy .sv-home-row > .v-ico {
    grid-area: ico;
  }

  #screen-energy .sv-home-row > .t {
    display: contents;
  }

  #screen-energy .sv-home-row .v-ttl {
    grid-area: ttl;
  }

  #screen-energy .sv-home-row .v-lbl {
    grid-area: lbl;
  }

  #screen-energy .sv-home-row > .sv-home-val {
    grid-area: val;
    font-size: 17px;
  }

  #screen-energy .sv-home-row > .v-chev {
    grid-area: chev;
  }
}

/* ---------- Vera ---------- */
#screen-energy .sv-rev.hidden {
  display: none;
}

/* ---------- Empty / loading / error ---------- */
#screen-energy .sv-empty {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px;
}

#screen-energy .sv-empty.hidden {
  display: none;
}

#screen-energy .sv-empty-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

#screen-energy .sv-empty-head .t {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

#screen-energy .sv-empty-head .v-ttl {
  font-size: 17px;
}

#screen-energy .sv-empty-head .v-lbl {
  font-size: 14px;
  line-height: 1.4;
  text-wrap: pretty;
}

#screen-energy .sv-empty-btn {
  align-self: stretch;
  min-height: 48px;
  text-align: center;
  white-space: normal;
}

#screen-energy .sv-skel {
  display: grid;
  gap: 10px;
}

#screen-energy .sv-skel i {
  display: block;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.04));
  background-size: 200% 100%;
  animation: sv-shimmer 1.4s ease-in-out infinite;
}

#screen-energy .sv-skel i + i {
  width: 60%;
  height: 16px;
}

@keyframes sv-shimmer {
  to {
    background-position: -200% 0;
  }
}

/* ---------- Free: the VueRate Drive card ---------- */
#screen-energy .savings-pro-teaser.sv-drive {
  flex-direction: column;
  gap: 12px;
  padding: 18px !important;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--v-r-hero);
  background: var(--v-hero-car) !important;
}

#screen-energy .sv-drive-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

#screen-energy .sv-drive-ico {
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
}

#screen-energy .savings-pro-teaser .sv-drive-title {
  margin: 0;
  color: #fff;
  font-size: clamp(24px, 7.2vw, 28px);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

#screen-energy .sv-drive-stat {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--v-r-inner);
  background: rgba(0, 8, 30, 0.3);
}

#screen-energy .sv-drive-stat.hidden {
  display: none;
}

#screen-energy .sv-drive-big {
  color: #fff;
  font-size: clamp(40px, 13vw, 52px);
}

#screen-energy .sv-drive-stat-copy {
  color: rgba(255, 255, 255, 0.92);
  font-size: 14px;
  line-height: 1.4;
}

#screen-energy .savings-pro-teaser p.sv-drive-copy {
  margin: 0;
  color: rgba(255, 255, 255, 0.92);
  font-size: 15px;
  line-height: 1.45;
  text-wrap: pretty;
}

#screen-energy .savings-pro-teaser .sv-drive-btn {
  width: 100%;
  min-height: 50px;
  margin: 4px 0 0;
  padding: 10px 18px;
  border: 0;
  color: #0A1738;
  background: #fff;
  box-shadow: 0 10px 26px -12px rgba(0, 0, 0, 0.7);
  font-size: clamp(14px, 4.2vw, 16px);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
  text-align: center;
  white-space: normal;
  text-wrap: balance;
}

/* At the narrowest widths the card gives the button a little more room, so "Unlock with VueRate One · $9.99/mo"
   stays on one line. */
@media (max-width: 359px) {
  #screen-energy .savings-pro-teaser.sv-drive {
    padding: 16px !important;
  }

  #screen-energy .savings-pro-teaser .sv-drive-btn {
    padding: 10px 8px;
    font-size: 13px;
  }
}

#screen-energy .savings-pro-teaser .sv-drive-btn .nw {
  white-space: nowrap;
}

/* The button holds text and two no-break spans; laid out as a block so they flow as one line, not flex items. */
#screen-energy .savings-pro-teaser .sv-drive-btn {
  display: block;
  padding-top: 14px;
  padding-bottom: 14px;
}

#screen-energy .savings-pro-teaser p.sv-drive-fine {
  margin: -4px 0 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: 13px;
  text-align: center;
}

/* ---------- Home-only (solar / Powerwall, no car) ---------- */
#screen-energy .home-only-savings:not(.hidden) {
  display: flex;
  flex-direction: column;
  gap: var(--sv-gap);
}

#screen-energy .home-only-savings .hos-seg {
  margin: 0;
}

#screen-energy .home-only-savings .hos-seg > button {
  min-width: 0;
  min-height: 42px;
  font-size: 15px;
}

#screen-energy .home-only-savings .hos-hero {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#screen-energy .home-only-savings .hos-hero .v-eyebrow {
  color: #fff;
}

#screen-energy .home-only-savings .hos-hero h2 {
  margin: 0;
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0;
}

#screen-energy .home-only-savings .hos-hero h2 .hos-amt {
  display: block;
  margin-bottom: 6px;
  font-size: clamp(54px, 19vw, 76px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.045em;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

#screen-energy .home-only-savings .hos-hero h2.hos-words,
#screen-energy .home-only-savings .hos-hero .hos-title {
  font-size: clamp(24px, 7.2vw, 28px);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.03em;
}

#screen-energy .home-only-savings .hos-hero .hos-copy {
  margin: 0;
  color: rgba(255, 255, 255, 0.92);
  font-size: 15px;
  line-height: 1.45;
}

#screen-energy .home-only-savings .hos-btn {
  width: 100%;
  min-height: 50px;
  margin-top: 4px;
  border: 0;
  color: #2A1004;
  background: #fff;
  font-weight: 700;
  white-space: normal;
}

#screen-energy .home-only-savings .hos-rows.v-card {
  display: block;
  padding: 4px 16px;
}

#screen-energy .home-only-savings .hos-rows > div {
  min-height: 56px;
  padding: 0;
  border-bottom: 1px solid var(--v-line);
}

#screen-energy .home-only-savings .hos-rows dt {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: var(--v-tx);
  font-size: 15px;
  font-weight: 600;
}

#screen-energy .home-only-savings .hos-rows dd {
  flex: none;
  color: var(--v-tx);
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
}

/* ---------- Live session (only while charging) ---------- */
#screen-energy .live-session-card.is-charging {
  padding: 16px !important;
  border: 1px solid rgba(125, 184, 255, 0.3) !important;
  border-radius: var(--v-r-card) !important;
  background: linear-gradient(140deg, rgba(61, 139, 255, 0.22), rgba(61, 139, 255, 0.03) 70%), var(--v-card) !important;
}

#screen-energy .live-session-card .section-head .eyebrow {
  color: var(--v-car2);
}

#screen-energy .live-session-card .section-head h2 {
  font-size: 17px;
  font-weight: 700;
}

#screen-energy .live-session-card .chip.live {
  border-color: transparent;
  color: #fff;
  background: var(--v-car);
}

#screen-energy .live-session-power strong {
  color: #fff;
  font-weight: 800;
  letter-spacing: -0.03em;
}

#screen-energy .live-session-progress .progress-track span {
  background: linear-gradient(90deg, #3D8BFF, #7DB8FF);
}

#screen-energy .live-session-stats strong {
  font-weight: 700;
}

/* ---------- Recent charges ---------- */
#screen-energy .charge-summary-list-card.sv-history {
  padding: 16px 16px 6px !important;
  border: 1px solid var(--v-line) !important;
  border-radius: var(--v-r-card) !important;
  background: var(--v-card) !important;
}

#screen-energy .sv-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}

#screen-energy .sv-card-head .v-ttl {
  font-size: 17px;
}

#screen-energy .sv-history #historyCount {
  min-height: 24px;
  padding: 3px 10px;
  border: 1px solid var(--v-line-strong);
  color: var(--v-tx2);
  background: var(--v-card2);
  font-size: 12px;
  font-weight: 700;
}

#screen-energy .sv-history .charge-summary-row {
  border-bottom: 1px solid var(--v-line) !important;
}

#screen-energy .sv-history .charge-summary-row:last-of-type {
  border-bottom: 0 !important;
}

#screen-energy .sv-history .charge-summary-head {
  min-height: 64px;
}

#screen-energy .sv-history .charge-summary-head > div span {
  color: var(--v-tx2);
  font-size: 13px;
}

#screen-energy .sv-history .charge-summary-head > div strong {
  color: var(--v-tx);
  font-size: 16px;
  font-weight: 700;
}

#screen-energy .sv-history .charge-summary-saved {
  color: var(--v-mint);
  font-size: 15px;
  font-weight: 700;
  font-style: normal;
}

#screen-energy .sv-history .charge-summary-saved.unknown {
  color: var(--v-tx3);
  font-weight: 600;
}

#screen-energy .sv-history .mini-track.blue i { background: var(--v-car); }
#screen-energy .sv-history .mini-track.gold i { background: var(--v-sun); }
#screen-energy .sv-history .mini-track.green i { background: var(--v-mint); }

#screen-energy .sv-history .charge-summary-receipt,
#screen-energy .sv-history .receipt-toggle {
  color: var(--v-car2);
  font-weight: 600;
}

#screen-energy .sv-history .receipt-toggle {
  min-height: 48px;
  border-top: 1px solid var(--v-line);
}

/* ---------- Prices & charging ---------- */
#screen-energy .weekly-charging-card {
  padding: 16px !important;
  border: 1px solid var(--v-line) !important;
  border-radius: var(--v-r-card) !important;
  background: var(--v-card) !important;
}

#screen-energy .weekly-charging-card .section-head .eyebrow {
  color: var(--v-tx2);
}

#screen-energy .weekly-charging-card .section-head h2 {
  font-size: 17px;
  font-weight: 700;
}

#screen-energy .weekly-charging-card .chip,
#screen-energy .live-session-card .chip {
  min-height: 24px;
  padding: 3px 10px;
  border: 1px solid var(--v-line-strong);
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.3;
  white-space: nowrap;
  color: var(--v-tx2);
  background: var(--v-card2);
  font-weight: 600;
}

#screen-energy .weekly-charging-tabs {
  display: grid;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--v-line);
  border-radius: 14px;
  background: var(--v-bg);
}

#screen-energy .weekly-charging-tabs button {
  min-height: 38px;
  border: 0;
  border-radius: 10px;
  color: var(--v-tx2);
  background: transparent;
  font-size: 14px;
  font-weight: 600;
}

#screen-energy .weekly-charging-tabs button.active {
  color: #fff;
  background: var(--v-raised);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

#screen-energy .price-chart-headline span.cheap {
  color: var(--v-mint);
}

#screen-energy .price-chart-line {
  stroke: var(--v-car2);
}

#screen-energy .price-chart-cheap {
  fill: rgba(59, 232, 166, 0.12);
  stroke: rgba(59, 232, 166, 0.3);
}

#screen-energy .weekly-charging-legend .swatch.cheap {
  border-color: rgba(59, 232, 166, 0.5);
  background: rgba(59, 232, 166, 0.16);
}

#screen-energy #weeklyChargingNote {
  color: var(--v-tx2);
}

/* ---------- Gas and rate check ---------- */
#screen-energy .gas-compare-card:not(.hidden),
#screen-energy .rate-check-card:not(.hidden) {
  padding: 16px !important;
  border: 1px solid var(--v-line) !important;
  border-radius: var(--v-r-card) !important;
  background: var(--v-card) !important;
}

#screen-energy .gas-compare-grid strong {
  font-weight: 750;
}

#screen-energy .gas-compare-ev {
  color: var(--v-mint);
}

#screen-energy .rate-check-card h2 {
  font-weight: 700;
}

/* ---------- The savings sheet ---------- */
#savingsExplainOverlay .sv-sheet {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

#savingsExplainOverlay .sheet-top h2 {
  font-weight: 800;
  letter-spacing: -0.02em;
}

#savingsExplainOverlay .sv-sheet-seg {
  margin: 0;
}

#savingsExplainOverlay .sv-sheet-seg.hidden {
  display: none;
}

#savingsExplainOverlay .sv-receipt {
  display: flex;
  flex-direction: column;
  padding: 6px 16px;
  border: 1px solid var(--v-line);
  border-radius: var(--v-r-card);
  background: var(--v-card);
}

#savingsExplainOverlay .sv-receipt.hidden {
  display: none;
}

#savingsExplainOverlay .sv-rc-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 46px;
  border-bottom: 1px solid var(--v-line);
  color: var(--v-tx2);
  font-size: clamp(14px, 4.2vw, 15px);
}

#savingsExplainOverlay .sv-rc-row:last-child {
  border-bottom: 0;
}

#savingsExplainOverlay .sv-rc-row span {
  min-width: 0;
  line-height: 1.3;
}

#savingsExplainOverlay .sv-rc-row strong {
  flex: none;
  color: var(--v-tx);
  font-weight: 700;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

#savingsExplainOverlay .sv-rc-row.total {
  min-height: 58px;
  color: var(--v-tx);
  font-weight: 700;
}

#savingsExplainOverlay .sv-rc-row.total strong {
  color: var(--v-mint);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

#savingsExplainOverlay .sv-rc-row.meta {
  min-height: 40px;
  font-size: 14px;
}

#savingsExplainOverlay .sv-sheet-note {
  margin: 0;
  color: var(--v-tx2);
  font-size: 14px;
  line-height: 1.5;
  text-wrap: pretty;
}

#savingsExplainOverlay .sv-sheet-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#savingsExplainOverlay .sv-sheet-h {
  margin: 4px 0 0;
  color: var(--v-tx2);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

#savingsExplainOverlay .sv-sheet-row .t {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

#savingsExplainOverlay .sv-sheet-row .v-ttl {
  font-size: 15px;
  white-space: nowrap;
}

/* Date and amount saved share the top line; at 320 the amount drops under the date rather than splitting it. */
#savingsExplainOverlay .sv-sheet-top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 2px 10px;
}

#savingsExplainOverlay .sv-sheet-saved {
  flex: none;
  color: var(--v-mint);
  font-size: 14px;
  font-weight: 700;
  text-align: right;
}

#savingsExplainOverlay .sv-sheet-back {
  align-self: flex-start;
}

#savingsExplainOverlay .savings-per-charge {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 14px 16px;
  border: 1px solid var(--v-line);
  border-radius: var(--v-r-card);
  background: var(--v-card);
}

#savingsExplainOverlay .savings-per-charge.hidden {
  display: none;
}

#savingsExplainOverlay .savings-per-charge-bars {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 80px;
}

#savingsExplainOverlay .savings-per-charge-bar {
  display: block;
  flex: 1 1 0;
  max-width: 32px;
  min-height: 3px;
  border-radius: 4px;
  background: rgba(59, 232, 166, 0.35);
}

#savingsExplainOverlay .savings-per-charge-bar.latest {
  background: var(--v-mint);
  box-shadow: 0 0 10px rgba(59, 232, 166, 0.5);
}

#savingsExplainOverlay .savings-per-charge figcaption {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--v-tx2);
  font-size: 12px;
}

@media (prefers-reduced-motion: reduce) {
  #screen-energy .sv-skel i {
    animation: none;
  }
}

/* ---------- Tap targets: every control in the area is at least 44px tall ---------- */
#screen-energy .weekly-charging-tabs > button {
  min-height: 44px;
}

#savingsExplainOverlay .sv-sheet-seg > button {
  min-height: 44px;
}

#savingsExplainOverlay #savingsExplainCloseButton {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
}

/* Saved per charge: the bars spread across the card, with the best and latest figures beside them. */
#savingsExplainOverlay .savings-per-charge-bars {
  justify-content: space-evenly;
}

#savingsExplainOverlay .savings-per-charge-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--v-tx2);
  font-size: 13px;
  font-weight: 600;
}

#savingsExplainOverlay .savings-per-charge-head strong {
  color: var(--v-mint);
  font-weight: 700;
}

/* Day / Week: the two tabs fill their track. */
#screen-energy .weekly-charging-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
#screen-energy .sv-leg dt { text-wrap: balance; }
