/* Calm redesign: owned by the Savings screen agent (#screen-energy). Loaded after styles-calm.css.
   The approved mockup puts the period, the figure, the per-charge bars, the two cost bars and the facts straight on
   the ground with no card. Cards stay only where they hold something separate: rate check, live session, prices. */

/* Small faint text here sits on both the ground and the surface cards; #6E7887 falls under 4.5:1 on the surface at
   11-13px, so text uses a slightly lighter faint (4.8:1 on surface, 5.2:1 on ground). Strokes keep the faint token. */
#screen-energy {
  --calm-savings-faint-text: #7C8696;
}

/* ---------- Header: kicker + title on the left, D / W / M on the right ---------- */
#screen-energy > .calm-savings-heading {
  align-items: flex-end;
  margin-bottom: 26px;
}

#screen-energy .calm-savings-period {
  display: flex;
  flex: none;
  gap: 4px;
  width: auto;
  margin: 0;
  padding: 4px;
  border-radius: var(--calm-radius-control);
  background: var(--calm-surface);
}

#screen-energy .calm-savings-period button {
  position: relative;
  min-width: 44px;
  min-height: 36px;
  padding: 0 10px;
  border-radius: 10px;
  font-family: var(--calm-font);
  font-size: 13px;
  letter-spacing: 0;
  text-transform: none;
}

/* The pill is 36px tall like the mockup, but each button answers a 44px-tall tap: the hit area reaches into the
   control's 4px padding above and below. */
#screen-energy .calm-savings-period button::after,
#screen-energy .home-only-savings .period-tabs button::after {
  content: "";
  position: absolute;
  inset: -4px 0;
}

/* The header's "Ask Rev" intro bubble would sit over W / M here, so Savings shows only the Rev mark. */
body:has(#screen-energy.active) .rev-button.intro .rev-button-label {
  opacity: 0 !important;
  visibility: hidden;
}

/* Free plan and home-only: the car's period and kicker have nothing to describe. */
#screen-energy.savings-locked .calm-savings-period,
#screen-energy.savings-locked #savingsChartPeriod,
body[data-home-only="true"] #screen-energy .calm-savings-period,
body[data-home-only="true"] #screen-energy #savingsChartPeriod {
  display: none;
}

/* ---------- Summary: flat on the ground ---------- */
#screen-energy .savings-summary-card {
  display: grid;
  gap: 26px;
  margin: 0 0 8px;
  padding: 0 !important;
  border-radius: 0;
  background: transparent !important;
}

#screen-energy .savings-summary-card .savings-hero {
  display: grid;
  gap: 8px;
}

#screen-energy .savings-summary-card .savings-hero h2#savingsTotal {
  margin: 0;
  color: var(--calm-text);
  -webkit-text-fill-color: currentColor;
  background: none;
  font-family: var(--calm-font);
  font-size: 48px;
  font-weight: 300;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  line-height: 1.05;
  overflow-wrap: anywhere;
}

/* No figure yet ("No charges yet", "Savings not available"): a quieter, smaller line in the text color. */
#screen-energy .savings-summary-card .savings-hero h2#savingsTotal.is-empty {
  color: var(--calm-text);
  font-size: 34px;
  letter-spacing: -0.02em;
}

#screen-energy .savings-summary-card .savings-hero p#savingsSummaryText {
  margin: 0;
  color: var(--calm-muted);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.45;
}

/* Saved per charge */
#screen-energy .savings-per-charge {
  display: grid;
  gap: 8px;
  margin: 0;
}

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

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

#screen-energy .savings-per-charge-bar {
  display: block;
  flex: 1 1 0;
  max-width: 40px;
  min-height: 3px;
  border-radius: 4px;
  background: var(--calm-accent-deep);
}

#screen-energy .savings-per-charge-bar.latest {
  background: var(--calm-accent);
}

#screen-energy .savings-per-charge figcaption {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--calm-savings-faint-text);
  font-size: 12px;
  line-height: 1.3;
}

/* Two cost bars: charging right away (amber) vs with reVolt (accent) */
#screen-energy .savings-bars {
  gap: 14px;
}

#screen-energy .savings-bar {
  row-gap: 6px;
}

#screen-energy .savings-bar span {
  color: var(--calm-muted);
  font-size: 14px;
  font-weight: 400;
}

#screen-energy .savings-bar strong {
  color: var(--calm-text);
  font-size: 14px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

#screen-energy .savings-bar i {
  height: 6px;
  border-radius: 3px;
  background: var(--calm-amber);
}

#screen-energy .savings-bar[data-kind="actual"] i {
  background: var(--calm-accent);
}

#screen-energy .savings-bars:focus-visible {
  outline: 2px solid var(--calm-accent);
  outline-offset: 6px;
  border-radius: 6px;
}

/* ---------- Facts and the vs-gas rows: one hairline list ---------- */
#screen-energy .savings-facts {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  margin: 0;
  padding: 0;
  border-top: 0;
}

#screen-energy .savings-facts > div,
#screen-energy .gas-compare-grid > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 50px;
  padding: 0 4px !important;
  border: 0 !important;
  border-bottom: 1px solid var(--calm-line) !important;
  border-radius: 0 !important;
}

#screen-energy .savings-facts > div.hidden {
  display: none;
}

#screen-energy .savings-facts dt,
#screen-energy .gas-compare-grid span {
  color: var(--calm-text);
  font-size: 15px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}

#screen-energy .savings-facts dd,
#screen-energy .gas-compare-grid strong {
  margin: 0;
  color: var(--calm-muted);
  font-size: 15px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

#screen-energy .gas-compare-grid strong span {
  color: inherit;
  font-size: inherit;
}

#screen-energy .gas-compare-grid span b {
  font-weight: 400;
}

/* With the gas rows below, the facts list continues into them; without, its last row has no divider. */
#screen-energy .savings-summary-card:has(+ .gas-compare-card.hidden) .savings-facts > div:nth-last-child(2),
#screen-energy .gas-compare-grid > div:last-child {
  border-bottom: 0 !important;
}

#screen-energy .gas-compare-card {
  margin: 0 0 8px;
  padding: 0 !important;
  border-radius: 0;
  background: transparent !important;
}

#screen-energy .gas-compare-card.hidden {
  display: none;
}

#screen-energy .gas-compare-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  margin: 0;
  padding: 0;
  border-top: 0;
}

#screen-energy .gas-compare-grid > div {
  background: transparent !important;
}

#screen-energy #gasCompareNote {
  margin: 6px 4px 0;
  color: var(--calm-savings-faint-text);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.45;
}

/* ---------- Cards below the summary ---------- */
#screen-energy .rate-check-card,
#screen-energy .live-session-card,
#screen-energy .weekly-charging-card,
#screen-energy .savings-pro-teaser {
  margin: 16px 0 0;
  padding: 20px !important;
  border-radius: var(--calm-radius);
  background: var(--calm-surface) !important;
}

#screen-energy .rate-check-card.hidden,
#screen-energy .live-session-card:not(.is-charging) {
  display: none;
}

#screen-energy .rate-check-card h2 {
  margin: 0 0 6px;
  color: var(--calm-text);
  font-size: 17px;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: -0.005em;
}

#screen-energy .rate-check-card .panel-note {
  margin: 0;
  color: var(--calm-muted);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
}

/* Section heads inside cards: eyebrow + title, chip quiet on the right. */
#screen-energy .live-session-card .section-head,
#screen-energy .weekly-charging-card .section-head {
  align-items: flex-start;
  margin: 0 0 16px;
}

#screen-energy .live-session-card .section-head h2,
#screen-energy .weekly-charging-card .section-head h2 {
  margin: 0;
  color: var(--calm-text);
  font-size: 17px;
  font-weight: 500;
  line-height: 1.3;
}

#screen-energy .live-session-card .chip,
#screen-energy .weekly-charging-card .chip {
  min-height: 0;
  padding: 2px 0;
  border: 0;
  color: var(--calm-savings-faint-text);
  background: transparent;
  font-size: 13px;
  font-weight: 400;
}

#screen-energy .live-session-card .chip.live {
  color: var(--calm-accent);
}

#screen-energy .weekly-charging-card .chip.warn {
  color: var(--calm-savings-faint-text);
}

/* ---------- Live session ---------- */
#screen-energy .live-session-power strong {
  color: var(--calm-text);
  font-family: var(--calm-font);
  font-size: 40px;
  font-weight: 300;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

#screen-energy .live-session-power span {
  color: var(--calm-muted);
  font-size: 14px;
  font-weight: 400;
}

#screen-energy .live-session-progress .progress-track {
  height: 6px;
  border-radius: 3px;
  background: var(--calm-track);
}

#screen-energy .live-session-progress .progress-track span {
  border-radius: 3px;
  background: var(--calm-accent);
}

#screen-energy .live-session-progress .progress-track i {
  background: var(--calm-amber);
}

#screen-energy .live-session-progress-labels span {
  color: var(--calm-muted);
  font-size: 13px;
  font-weight: 400;
}

#screen-energy .live-session-stats {
  gap: 0 16px;
}

#screen-energy .live-session-stats > div {
  border: 0 !important;
  border-top: 1px solid var(--calm-line) !important;
  border-radius: 0;
  padding: 12px 0 !important;
  background: transparent !important;
}

#screen-energy .live-session-stats span {
  color: var(--calm-muted);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}

#screen-energy .live-session-stats strong {
  color: var(--calm-text);
  font-size: 15px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

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

#screen-energy .live-session-idle {
  color: var(--calm-muted);
  font-weight: 400;
}

/* ---------- History: flat hairline rows, amber saved values ---------- */
#screen-energy .charge-summary-list-card {
  margin: 28px 0 0;
  padding: 0 !important;
  border-radius: 0;
  background: transparent !important;
}

#screen-energy .charge-summary-list-card > .section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 0 0 4px;
  padding: 0 4px;
}

#screen-energy .charge-summary-list-card > .section-head .eyebrow {
  margin: 0;
}

#screen-energy .charge-summary-list-card > .section-head h2 {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

#screen-energy #historyCount {
  min-height: 0;
  padding: 0;
  border: 0;
  color: var(--calm-savings-faint-text);
  background: transparent;
  font-size: 12px;
  font-weight: 400;
}

#screen-energy .charge-summary-list {
  display: grid;
  gap: 0;
}

#screen-energy .charge-summary-row {
  margin: 0;
  border: 0 !important;
  border-bottom: 1px solid var(--calm-line) !important;
  border-radius: 0;
  padding: 0;
  background: transparent !important;
  box-shadow: none !important;
}

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

#screen-energy .charge-summary-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 16px;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 64px;
  margin: 0;
  padding: 10px 4px;
  border: 0;
  border-radius: 0;
  color: var(--calm-text);
  background: transparent;
  box-shadow: none;
  text-align: left;
}

#screen-energy .charge-summary-head > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

#screen-energy .charge-summary-head > div span {
  color: var(--calm-muted);
  font-size: 13px;
  font-weight: 400;
}

#screen-energy .charge-summary-head > div strong {
  color: var(--calm-text);
  font-size: 15px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

#screen-energy .charge-summary-saved {
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  color: var(--calm-amber);
  background: transparent;
  font-size: 15px;
  font-style: normal;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

#screen-energy .charge-summary-head svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--calm-faint);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 160ms ease;
}

#screen-energy .charge-summary-row.open .charge-summary-head svg {
  transform: rotate(180deg);
}

#screen-energy .charge-summary-detail {
  padding: 0 4px 14px;
  border: 0;
  background: transparent;
}

#screen-energy .mini-bar-grid {
  gap: 8px;
}

#screen-energy .mini-bar-row span,
#screen-energy .mini-bar-row strong {
  color: var(--calm-muted);
  font-size: 13px;
  font-weight: 400;
}

#screen-energy .mini-bar-row {
  grid-template-columns: 56px minmax(0, 1fr) auto;
}

#screen-energy .mini-bar-row strong {
  min-width: 54px;
  color: var(--calm-text);
  font-variant-numeric: tabular-nums;
}

#screen-energy .mini-track {
  height: 6px;
  border-radius: 3px;
  background: var(--calm-track);
}

#screen-energy .mini-track i {
  border-radius: 3px;
}

#screen-energy .mini-track.blue i {
  background: var(--calm-accent);
}

#screen-energy .mini-track.gold i {
  background: var(--calm-faint);
}

#screen-energy .mini-track.green i {
  background: var(--calm-amber);
}

#screen-energy .charge-summary-receipt {
  min-height: 44px;
  margin-top: 6px;
  padding: 0;
  border: 0;
  color: var(--calm-accent);
  background: transparent;
  font-size: 14px;
  font-weight: 400;
}

#screen-energy .charge-summary-list .receipt-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-height: 48px;
  margin: 4px 0 0;
  border: 0;
  border-top: 1px solid var(--calm-line);
  border-radius: 0;
  color: var(--calm-accent);
  background: transparent;
  font-size: 14px;
  font-weight: 400;
}

#screen-energy .charge-summary-list .receipt-toggle svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

#screen-energy .charge-summary-list .empty-state {
  padding: 12px 4px 0;
  color: var(--calm-muted);
  font-size: 14px;
  font-weight: 400;
}

/* ---------- Prices & charging ---------- */
#screen-energy .weekly-charging-card {
  margin-top: 24px;
}

#screen-energy .weekly-charging-tabs {
  display: flex;
  width: auto;
  margin: 0 0 14px;
  background: var(--calm-bg);
}

#screen-energy .weekly-charging-tabs button {
  flex: 1 1 0;
  font-size: 13px;
  font-weight: 400;
}

#screen-energy .weekly-charging-tabs button.active {
  font-weight: 500;
}

#screen-energy .weekly-charging-daynav strong {
  color: var(--calm-text);
  font-size: 14px;
  font-weight: 500;
}

#screen-energy .weekly-charging-daynav button {
  min-width: 44px;
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  color: var(--calm-muted);
  background: transparent;
}

#screen-energy .weekly-charging-daynav button:disabled {
  color: var(--calm-track);
}

#screen-energy .weekly-charging-legend {
  gap: 6px 14px;
  color: var(--calm-muted);
  font-size: 12px;
  font-weight: 400;
}

#screen-energy .weekly-charging-legend .swatch.line {
  border-color: var(--calm-accent);
  background: var(--calm-accent) !important;
}

#screen-energy .weekly-charging-legend .swatch.rate {
  border-top-color: var(--calm-muted);
}

#screen-energy .weekly-charging-legend .swatch.cheap {
  background: var(--calm-amber-soft);
  box-shadow: inset 0 0 0 1px rgba(242, 179, 107, 0.4);
}

#screen-energy .weekly-charging-legend .swatch.charging {
  border-color: var(--calm-accent);
  background: var(--calm-accent) !important;
}

#screen-energy .weekly-charging-legend .swatch.off {
  background: var(--calm-track);
}

#screen-energy .price-chart-empty {
  border: 0;
  border-radius: 14px;
  color: var(--calm-muted);
  background: var(--calm-bg);
  font-weight: 400;
}

#screen-energy .price-chart-headline span {
  border: 0;
  color: var(--calm-muted);
  background: transparent;
  font-size: 13px;
  font-weight: 400;
}

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

#screen-energy .price-chart-line {
  stroke: var(--calm-accent);
  stroke-width: 2;
  filter: none;
}

#screen-energy .price-chart-cheap {
  fill: var(--calm-amber);
  opacity: 0.14;
}

#screen-energy .price-chart-charge,
#screen-energy .price-chart-charge-dot {
  fill: var(--calm-accent);
}

#screen-energy .price-chart-charge-dot {
  stroke: var(--calm-surface);
}

#screen-energy .price-chart-now,
#screen-energy .price-chart-selected {
  stroke: var(--calm-faint);
  stroke-width: 1;
  stroke-dasharray: 3 4;
}

#screen-energy .price-chart-now-dot {
  fill: var(--calm-text);
  stroke: var(--calm-surface);
}

#screen-energy .price-chart-now-tag {
  border: 0;
  color: var(--calm-text);
  background: var(--calm-raised);
  font-weight: 500;
  box-shadow: none;
}

#screen-energy .weekly-charging-axis,
#screen-energy .weekly-charging-axis em {
  color: var(--calm-savings-faint-text);
  font-size: 11px;
  font-style: normal;
  font-weight: 400;
}

#screen-energy #weeklyChargingNote {
  margin-top: 12px;
  color: var(--calm-muted);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.5;
}

#screen-energy .weekly-charging-row {
  border: 0 !important;
  border-bottom: 1px solid var(--calm-line) !important;
  border-radius: 0;
  background: transparent !important;
  box-shadow: none !important;
}

#screen-energy .weekly-charging-row:last-child {
  border-bottom: 0 !important;
}

#screen-energy .weekly-charging-row[aria-pressed="true"] {
  border-radius: 10px;
  background: var(--calm-accent-soft) !important;
}

#screen-energy .weekly-charging-day,
#screen-energy .weekly-charging-stat small {
  color: var(--calm-muted);
  font-weight: 400;
}

#screen-energy .weekly-charging-stat strong {
  color: var(--calm-text);
  font-weight: 400;
}

#screen-energy .weekly-charging-track {
  border: 0;
  background: var(--calm-bg);
}

#screen-energy .weekly-charging-session {
  color: var(--calm-bg);
  background: var(--calm-accent);
  box-shadow: none;
  font-weight: 500;
}

#screen-energy .weekly-charging-rate polyline {
  stroke: var(--calm-muted);
  stroke-opacity: 0.7;
}

/* ---------- Pro teaser (free plan) ---------- */
#screen-energy .savings-pro-teaser {
  margin-top: 0;
  padding: 24px !important;
  gap: 12px;
}

#screen-energy .savings-pro-teaser .eyebrow {
  color: var(--calm-amber);
}

#screen-energy .savings-pro-teaser h2 {
  margin: 0;
  color: var(--calm-text);
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

#screen-energy .savings-pro-teaser p:not(.eyebrow) {
  margin: 0;
  color: var(--calm-muted);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.5;
}

#screen-energy .savings-pro-teaser ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

#screen-energy .savings-pro-teaser li {
  position: relative;
  padding: 12px 0 12px 22px;
  border-top: 1px solid var(--calm-line);
  color: var(--calm-text);
  font-size: 15px;
  font-weight: 400;
}

#screen-energy .savings-pro-teaser li::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 2px;
  width: 8px;
  height: 8px;
  margin-top: -4px;
  border-radius: 50%;
  background: var(--calm-amber);
}

#screen-energy .savings-pro-teaser .primary-action {
  min-height: 52px;
  margin-top: 4px;
}

/* ---------- Home-only (solar and Powerwall, no car) ---------- */
#screen-energy .home-only-savings {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0 !important;
  border-radius: 0;
  background: transparent !important;
}

#screen-energy .home-only-savings.hidden {
  display: none;
}

#screen-energy .home-only-savings .period-tabs {
  display: flex;
  justify-self: start;
  width: auto;
  margin: 0 0 16px;
}

#screen-energy .home-only-savings .period-tabs button {
  position: relative;
  min-width: 64px;
  min-height: 36px;
  padding: 0 12px;
  font-size: 13px;
}

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

#screen-energy .home-only-savings h2 {
  margin: 0;
  color: var(--calm-amber);
  -webkit-text-fill-color: currentColor;
  background: none;
  font-size: 34px;
  font-weight: 300;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

#screen-energy .home-only-savings .hos-copy {
  margin: 0 0 8px;
  color: var(--calm-muted);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.45;
}

#screen-energy .home-only-savings .hos-rows {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

#screen-energy .home-only-savings .hos-rows > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 50px;
  padding: 0 4px;
  border: 0;
  border-bottom: 1px solid var(--calm-line);
  background: transparent;
}

#screen-energy .home-only-savings .hos-rows > div:last-child {
  border-bottom: 0;
}

#screen-energy .home-only-savings .hos-rows dt {
  color: var(--calm-text);
  font-size: 15px;
  font-weight: 400;
}

#screen-energy .home-only-savings .hos-rows dd {
  margin: 0;
  color: var(--calm-muted);
  font-size: 15px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

/* ---------- Text fit on narrow phones (320-430px) ---------- */
/* Header: at 320px the title, D / W / M and the Rev corner don't fit on one line and "Savings" ran under D. The
   kicker and title keep their natural width; when there isn't room the period control drops to its own line. */
#screen-energy > .calm-savings-heading {
  flex-wrap: wrap;
  row-gap: 12px;
}

#screen-energy > .calm-savings-heading > div:first-child {
  flex: 1 0 auto;
}

#screen-energy > .calm-savings-heading > .calm-savings-period {
  margin-left: auto;
}

#screen-energy > .calm-savings-heading #savingsChartPeriod,
#screen-energy > .calm-savings-heading h2 {
  white-space: nowrap;
}

@media (max-width: 389px) {
  /* Here it never fits: the title takes the first line and D / W / M the next, lined up with Ask Rev's right edge
     rather than the corner reserved for it on the first line (D / W / M on the first line ran under Rev). */
  #screen-energy > .calm-savings-heading > div:first-child {
    flex-basis: 100%;
  }

  #screen-energy > .calm-savings-heading > .calm-savings-period {
    margin-right: -56px;
  }
}

/* Facts and vs-gas rows: a long mileage stays in one piece, and when the value is too wide to share the line the
   value moves under the label instead of squeezing it. */
#screen-energy .savings-facts > div,
#screen-energy .gas-compare-grid > div {
  flex-wrap: wrap;
  row-gap: 2px;
  padding-block: 8px !important;
}

#screen-energy .savings-facts dd,
#screen-energy .gas-compare-grid > div > strong {
  margin-left: auto;
}

#screen-energy .gas-compare-grid span b {
  white-space: nowrap;
}

/* Prices & charging, Week: the kWh and rate under it were 10-13px type at line-height 1.05 and touched. A little
   more room and readable sizes; the axis keeps the same columns so the hours stay under the tracks. */
#screen-energy .weekly-charging-row,
#screen-energy .weekly-charging-axis:not(.compact) {
  grid-template-columns: 38px minmax(0, 1fr) 72px;
}

#screen-energy .weekly-charging-stat {
  gap: 2px;
  line-height: 1.25;
}

#screen-energy .weekly-charging-stat strong {
  font-size: 13px;
  white-space: nowrap;
}

#screen-energy .weekly-charging-stat small {
  font-size: 11px;
  white-space: nowrap;
}

#screen-energy .weekly-charging-session {
  font-size: 10px;
  line-height: 1.2;
}

/* Savings detail sheet (receipt and period detail): three fixed columns left $1,234.56 hanging out of the tiles at
   320-360px. Tiles now take as many columns as fit, and a long value can't leave its tile. */
#savingsExplainOverlay .assumption-grid {
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
}

#savingsExplainOverlay .assumption-grid > div {
  min-width: 0;
}

#savingsExplainOverlay .assumption-grid strong {
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

#savingsExplainOverlay .receipt-row span,
#savingsExplainOverlay .receipt-row strong {
  overflow-wrap: anywhere;
}

/* ---------- Text fit, second pass ---------- */
/* History rows: at 320px a "$11.70 saved off-peak" label squeezed the date and "38.4 kWh · $2.40" into a narrow
   column where the numbers broke mid-figure ("1234. / 5 kWh", "$9876 / .54"). The left side keeps its natural width
   and breaks only between words; when the saved label doesn't fit beside it, the label moves under it, right-aligned.
   The chevron stays pinned to the right edge either way. */
#screen-energy .charge-summary-head {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 12px;
  row-gap: 4px;
  padding-right: 32px;
}

#screen-energy .charge-summary-head > div {
  flex: 1 1 auto;
  min-width: min(100%, max-content);
}

#screen-energy .charge-summary-head > div span,
#screen-energy .charge-summary-head > div strong {
  overflow-wrap: normal;
  word-break: normal;
}

#screen-energy .charge-summary-saved {
  flex: 0 1 auto;
  margin-left: auto;
  text-align: right;
}

#screen-energy .charge-summary-head svg {
  position: absolute;
  top: calc(50% - 8px);
  right: 4px;
}

/* Prices & charging, Week: the day number under each weekday was 9.9px heavy type at about 3.9:1 contrast. */
#screen-energy .weekly-charging-day {
  font-size: 12px;
  line-height: 1.25;
}

#screen-energy .weekly-charging-day small {
  margin-top: 2px;
  color: var(--calm-muted);
  font-size: 11px;
  font-weight: 400;
  line-height: 1.2;
}

#screen-energy .weekly-charging-session {
  font-size: 11px;
}

/* Savings detail sheet: a value too long for its tile (an energy total like 1234567.8 kWh) breaks between the
   number and its unit instead of running out of the tile; figures themselves never break. Tiles in a row keep their
   label and value at the top. The explanation under the tiles gets room to breathe and can break a long receipt id
   instead of running off the sheet. */
#savingsExplainOverlay .assumption-grid > div {
  align-content: start;
}

#savingsExplainOverlay .assumption-grid strong {
  white-space: normal;
  overflow-wrap: normal;
  word-break: normal;
}

#savingsExplainOverlay #savingsExplainText {
  margin-top: 14px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

/* ---------- Text fit, third pass ---------- */
/* Savings detail sheet, session rows: the amounts line was 11.8px type at weight 800 on the default line height, so
   its two or three lines at 320-360px sat almost on top of each other. Calm weights, a readable size and room between
   the lines; figures keep their width. */
#savingsExplainOverlay .receipt-row strong {
  font-size: 15px;
  font-weight: 500;
  line-height: 1.35;
}

#savingsExplainOverlay .receipt-row span {
  color: var(--calm-muted);
  font-size: 13px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  line-height: 1.45;
}

#savingsExplainOverlay .receipt-row small {
  color: var(--calm-muted);
  font-size: 12px;
  line-height: 1.4;
}

/* Day / Week under Prices & charging and Daily / Weekly / Monthly in the detail sheet: 36px pills like the header's
   D / W / M, so each answers a 44px-tall tap the same way, reaching into the control's 4px padding. Week rows get the
   same 44px height; the track inside keeps its size. */
#screen-energy .weekly-charging-tabs button,
#savingsExplainOverlay #savingsDetailTabs button {
  position: relative;
}

#screen-energy .weekly-charging-tabs button::after,
#savingsExplainOverlay #savingsDetailTabs button::after {
  content: "";
  position: absolute;
  inset: -4px 0;
}

#screen-energy .weekly-charging-row {
  min-height: 44px;
}

/* Headlines and the Pro button break into even lines instead of leaving one word behind: "$12345.67 / saved vs /
   fixed rate" rather than "... fixed / rate", and "Unlock with reVolt / Pro · $2.99/mo" rather than a line ending in
   the dot. */
#screen-energy .savings-summary-card .savings-hero h2#savingsTotal,
#screen-energy .home-only-savings h2,
#screen-energy .savings-pro-teaser h2,
#screen-energy .savings-pro-teaser li,
#screen-energy .savings-pro-teaser .primary-action {
  text-wrap: balance;
}

/* Prices & charging, Week: the rate line is drawn over the charging blocks so the price during a charge stays
   visible, and a price spike ran straight through the block's rate label ("43.1¢" crossed out). The label sits on
   its own patch of the block's color above the line, so the line passes behind the figure only. */
#screen-energy .weekly-charging-session-label {
  position: relative;
  z-index: 1;
  padding: 0 3px;
  border-radius: 3px;
  background: var(--calm-accent);
  line-height: 1.2;
}
