/* =====================================================================================================================
   VueRate "Vivid" redesign: the foundation.
   Linked LAST (after styles-calm-me.css), so it wins the cascade over styles.css and the calm layers without editing
   them. Holds the token set, the area colours (car blue, sun amber, savings mint, storm violet), hero gradients,
   shared building blocks, motion, the 5-tab floating bar and the Vera button. Per-screen restyles build on these.

   Building blocks (use these in markup; all are prefixed or new so they never collide with legacy class names):
     .hero.car | .hero.sun | .hero.mint | .hero.storm   deep glass hero card, one light in the top-right corner
     .v-card                                            plain card (#0F141E, hairline, 22px radius)
     .v-tile                                            tappable card (button) for grids; .v-tile.wide spans 2 columns
     .v-chip  (.mint .amber .storm .car)                pill chip, nowrap; on a hero it is dark glass
     .seg (.car .mint)                                  segmented control, 40px segments, active = area colour
     .v-btn  (.primary .ghost)                          44px buttons
     .v-row  / .v-rowlink                               flex row / tappable list row with chevron
     .v-eyebrow                                         12/700 uppercase +.12em
     .v-big .u | .v-val .u | .v-lbl | .v-ttl            numerals (tabular, nowrap) with unit spans, labels, titles
     .nw                                                white-space: nowrap (use it on every number+unit pair)
     .titlerow > .t + .v-chev                           title that wraps before a chevron (never ellipsized)
     .v-ico (.car .sun .mint .storm .grey .coral)       36px rounded icon tile
     .v-ring (+ .breathe on the glow arc)               glowing SVG ring helper (see vividRingSvg() in JS)
     .rev-say > .rev-say-av + .v-bubble               Vera speaking in context
     .v-back                                            44px back pill ("< Garage")
     .breathe / .flowing                                animations (off under reduced motion and body.app-paused)
   ===================================================================================================================== */

:root {
  --v-bg: #06080D;
  --v-card: #0F141E;
  --v-card2: #161D2A;
  --v-raised: #1E2738;
  --v-line: rgba(255, 255, 255, 0.08);
  --v-line-strong: rgba(255, 255, 255, 0.14);
  --v-tx: #F6F8FC;
  --v-tx2: #AEB8C9;
  --v-tx3: #8591A5;

  --v-car: #3D8BFF;
  --v-car2: #7DB8FF;
  --v-sun: #FFB547;
  --v-sun2: #FF7A1F;
  --v-mint: #3BE8A6;
  --v-mint2: #16B97E;
  --v-storm: #A694FF;
  --v-coral: #FF6A5C;
  --v-goal: #FFB547;
  --v-slate: #3A4560;
  --v-ink-mint: #05281B;
  --v-ink-amber: #1A0E02;

  --v-r-hero: 28px;
  --v-r-card: 22px;
  --v-r-inner: 16px;
  --v-r-small: 12px;

  --v-gutter: 16px;
  --v-gap: 12px;
  --v-tabbar-h: 58px;
  --v-safe-bottom: env(safe-area-inset-bottom, 0px);
  --v-tabbar: calc(var(--v-tabbar-h) + max(6px, var(--v-safe-bottom)));
  --v-scroll-pad: calc(var(--v-tabbar) + 16px);

  --v-font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", Roboto, "Segoe UI", system-ui, sans-serif;

  --v-hero-car: radial-gradient(70% 55% at 100% 0%, rgba(110, 170, 255, 0.42) 0%, rgba(61, 139, 255, 0) 70%),
    radial-gradient(90% 70% at 0% 100%, rgba(28, 63, 158, 0.8) 0%, rgba(28, 63, 158, 0) 60%),
    linear-gradient(160deg, #1747B4 0%, #0C2463 55%, #0A1738 100%);
  --v-hero-sun: radial-gradient(70% 55% at 92% 0%, rgba(255, 176, 80, 0.42) 0%, rgba(255, 176, 80, 0) 70%),
    linear-gradient(160deg, #99410F 0%, #5C2508 52%, #2A1004 100%);
  --v-hero-mint: radial-gradient(60% 50% at 100% 0%, rgba(80, 240, 180, 0.32) 0%, rgba(59, 232, 166, 0) 70%),
    radial-gradient(90% 80% at 0% 100%, rgba(5, 60, 40, 0.9) 0%, rgba(5, 60, 40, 0) 60%),
    linear-gradient(160deg, #0E7A56 0%, #084F36 55%, #03241A 100%);
  --v-hero-storm: radial-gradient(60% 50% at 100% 0%, rgba(150, 130, 255, 0.4) 0%, rgba(140, 123, 255, 0) 70%),
    radial-gradient(90% 80% at 0% 100%, rgba(28, 63, 158, 0.7) 0%, rgba(28, 63, 158, 0) 60%),
    linear-gradient(160deg, #3A2BA4 0%, #1D1757 55%, #0D0B2A 100%);
  --v-garage-grad: linear-gradient(120deg, #3D8BFF, #FF9A2F);

  /* The calm tokens follow the vivid palette, so everything still drawn by the calm layers matches. */
  --calm-bg: var(--v-bg);
  --calm-surface: var(--v-card);
  --calm-raised: var(--v-raised);
  --calm-line: var(--v-line);
  --calm-track: rgba(255, 255, 255, 0.1);
  --calm-text: var(--v-tx);
  --calm-muted: var(--v-tx2);
  --calm-faint: var(--v-tx3);
  --calm-accent: var(--v-car2);
  --calm-accent-soft: rgba(61, 139, 255, 0.16);
  --calm-accent-deep: #17336A;
  --calm-amber: var(--v-sun);
  --calm-amber-soft: rgba(255, 181, 71, 0.16);
  --calm-radius: var(--v-r-card);
  --calm-radius-control: 14px;
  --calm-gutter: var(--v-gutter);
  --calm-tabbar: var(--v-tabbar);
  --calm-font: var(--v-font);
  --surface-soft: var(--v-card2);
  --border-strong: var(--v-line-strong);
}

/* ---------- Ground and type ---------- */
html,
body,
.plug-stage,
body.native-app,
html.native-app,
.phone-frame {
  background: var(--v-bg);
}

body {
  color: var(--v-tx);
  font-family: var(--v-font);
  font-feature-settings: "tnum" 1;
  -webkit-text-size-adjust: 100%;
}

button,
input,
select,
textarea {
  font-family: inherit;
}

.nw {
  white-space: nowrap;
}

/* ---------- Screens: full height under a floating tab bar, 16px gutters, one ambient light each ---------- */
.phone-frame > .screen-stack {
  height: 100%;
}

.phone-frame > .shared-account-banner:not(.hidden) ~ .screen-stack {
  height: calc(100% - var(--shared-banner-space, 72px));
}

.screen-stack > .screen-view:not(.charge-sheet) {
  padding: 16px var(--v-gutter) var(--v-scroll-pad);
  background-color: var(--v-bg);
  background-repeat: no-repeat;
  background-image: radial-gradient(60% 340px at 15% 0%, rgba(61, 139, 255, 0.22), rgba(61, 139, 255, 0) 70%);
}

body.native-app .screen-stack > .screen-view:not(.charge-sheet) {
  padding-top: max(16px, calc(env(safe-area-inset-top, 0px) + 6px));
}

/* One fixed ambient light per area (a background on the scroller stays put while the content scrolls). */
.screen-stack > #screen-energy {
  background-image: radial-gradient(60% 340px at 15% 0%, rgba(22, 185, 126, 0.2), rgba(22, 185, 126, 0) 70%);
}

.screen-stack > #screen-settings,
.screen-stack > #screen-account {
  background-image: radial-gradient(60% 340px at 85% 0%, rgba(120, 140, 190, 0.16), rgba(120, 140, 190, 0) 70%);
}

.screen-stack > #screen-fleet {
  background-image: radial-gradient(50% 300px at 15% 0%, rgba(61, 139, 255, 0.24), rgba(61, 139, 255, 0) 70%),
    radial-gradient(50% 320px at 95% 520px, rgba(255, 154, 47, 0.14), rgba(255, 154, 47, 0) 70%);
}

.screen-stack > #screen-homeenergy {
  background-image: radial-gradient(60% 320px at 80% 0%, rgba(255, 154, 47, 0.2), rgba(255, 154, 47, 0) 70%);
}

.screen-stack > #screen-homeenergy[data-page="weather"] {
  background-image: radial-gradient(60% 320px at 80% 0%, rgba(166, 148, 255, 0.2), rgba(166, 148, 255, 0) 70%);
}

/* ---------- Page header: eyebrow over a big title, Vera in the top-right corner ---------- */
.screen-heading {
  min-height: 60px;
  margin: 0 0 var(--v-gap);
}

.screen-view[data-screen] > .screen-heading {
  padding-right: 60px;
}

.screen-heading h2,
.v-h1 {
  margin: 2px 0 0;
  color: var(--v-tx);
  font-size: clamp(30px, 8.8vw, 34px);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.035em;
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.calm-kicker,
.v-eyebrow {
  margin: 0;
  color: var(--v-tx2);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* ---------- Cards ---------- */
.v-card {
  position: relative;
  border: 1px solid var(--v-line);
  border-radius: var(--v-r-card);
  padding: 16px;
  color: var(--v-tx);
  background: var(--v-card);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.v-card.dashed {
  border-style: dashed;
  border-color: rgba(255, 255, 255, 0.18);
  background: transparent;
  box-shadow: none;
}

.v-card.storm {
  border-color: rgba(166, 148, 255, 0.4);
  background: linear-gradient(120deg, rgba(166, 148, 255, 0.24), rgba(166, 148, 255, 0.04) 70%), var(--v-card);
}

.v-card.coral {
  border-color: rgba(255, 106, 92, 0.4);
  background: linear-gradient(120deg, rgba(255, 106, 92, 0.2), rgba(255, 106, 92, 0.04) 70%), var(--v-card);
}

.v-card.mint {
  border-color: rgba(59, 232, 166, 0.3);
  background: linear-gradient(140deg, rgba(22, 185, 126, 0.22), rgba(22, 185, 126, 0.03) 70%), var(--v-card);
}

.v-card.sun {
  border-color: rgba(255, 181, 71, 0.28);
  background: linear-gradient(140deg, rgba(255, 140, 40, 0.2), rgba(255, 140, 40, 0.03) 70%), var(--v-card);
}

/* Hero cards: a deep base plus ONE soft light, kept in the corner away from small text. */
.hero {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--v-r-hero);
  padding: 18px;
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 20px 50px -20px var(--v-glow, rgba(0, 0, 0, 0.6));
}

.hero.car {
  --v-glow: rgba(61, 139, 255, 0.55);
  background: var(--v-hero-car);
}

.hero.sun {
  --v-glow: rgba(255, 140, 40, 0.4);
  background: var(--v-hero-sun);
}

.hero.mint {
  --v-glow: rgba(59, 232, 166, 0.38);
  background: var(--v-hero-mint);
}

.hero.storm {
  --v-glow: rgba(166, 148, 255, 0.4);
  background: var(--v-hero-storm);
}

/* Small text on a hero stays at 90% white or more (4.5:1 against the deep bases). */
.hero .v-lbl,
.hero small,
.hero p {
  color: rgba(255, 255, 255, 0.9);
}

/* ---------- Tappable tiles and rows ---------- */
.v-tile {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  min-width: 0;
  min-height: 104px;
  margin: 0;
  padding: 13px;
  border: 1px solid var(--v-line);
  border-radius: var(--v-r-card);
  color: var(--v-tx);
  background: var(--v-card);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease;
}

.v-tile:active,
.v-rowlink:active,
.hero.tappable:active {
  transform: scale(0.985);
}

.v-tile:focus-visible,
.v-rowlink:focus-visible,
.hero.tappable:focus-visible {
  outline: 2px solid var(--v-car2);
  outline-offset: 2px;
}

.v-tile.wide {
  grid-column: 1 / -1;
}

.v-tile-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.v-grid2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.v-grid3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.v-stack {
  display: flex;
  flex-direction: column;
  gap: var(--v-gap);
}

.v-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.v-row.between {
  justify-content: space-between;
}

.v-row.wrap {
  flex-wrap: wrap;
}

.v-rowlink {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 60px;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--v-line);
  border-radius: var(--v-r-card);
  color: var(--v-tx);
  background: var(--v-card);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 140ms ease;
}

.v-rowlink > .t,
.titlerow > .t {
  flex: 1;
  min-width: 0;
}

.titlerow {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

/* Titles beside a chevron wrap (no ellipsis, ever): long names take a second line before reaching the chevron. */
.clamp2 {
  overflow-wrap: anywhere;
  white-space: normal;
}

.v-chev {
  flex: none;
  width: 18px;
  height: 18px;
  color: var(--v-tx3);
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hero .v-chev {
  color: #fff;
  margin-top: 6px;
}

/* ---------- Type: numerals, values, labels, titles ---------- */
.v-big {
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 0.95;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.v-big .u {
  font-size: 0.5em;
  font-weight: 750;
  letter-spacing: 0;
}

.v-val {
  font-size: 20px;
  font-weight: 750;
  line-height: 1.15;
  letter-spacing: -0.02em;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.v-val .u {
  font-size: 0.7em;
  font-weight: 650;
  letter-spacing: 0;
  opacity: 0.85;
}

.v-lbl {
  margin: 0;
  color: var(--v-tx2);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.v-ttl {
  margin: 0;
  color: inherit;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.v-name {
  margin: 0;
  font-size: clamp(24px, 7.4vw, 28px);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
}

/* ---------- Chips and pills ---------- */
.v-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 5px 11px;
  border: 1px solid var(--v-line-strong);
  border-radius: 999px;
  color: var(--v-tx);
  background: var(--v-card2);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}

.hero .v-chip {
  border-color: rgba(255, 255, 255, 0.16);
  color: #fff;
  background: rgba(0, 8, 30, 0.32);
}

.v-chip .dot {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--v-mint);
  box-shadow: 0 0 8px var(--v-mint);
}

.v-chip.mint,
.hero .v-chip.mint {
  border-color: transparent;
  color: var(--v-ink-mint);
  background: var(--v-mint);
  font-weight: 700;
}

.v-chip.amber,
.hero .v-chip.amber {
  border-color: transparent;
  color: var(--v-ink-amber);
  background: var(--v-sun);
  font-weight: 700;
}

.v-chip.storm,
.hero .v-chip.storm {
  border-color: transparent;
  color: #1A1240;
  background: var(--v-storm);
  font-weight: 700;
}

.v-chip.car {
  border-color: rgba(125, 184, 255, 0.35);
  color: #DCEBFF;
  background: rgba(61, 139, 255, 0.18);
}

.v-chip.small {
  min-height: 22px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 700;
}

/* ---------- Icon tiles ---------- */
.v-ico {
  display: grid;
  flex: none;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 12px;
}

.v-ico.sm {
  width: 32px;
  height: 32px;
  border-radius: 10px;
}

.v-ico svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.v-ico.car { color: var(--v-car2); background: rgba(61, 139, 255, 0.18); }
.v-ico.sun { color: var(--v-sun); background: rgba(255, 181, 71, 0.16); }
.v-ico.mint { color: var(--v-mint); background: rgba(59, 232, 166, 0.15); }
.v-ico.storm { color: var(--v-storm); background: rgba(166, 148, 255, 0.17); }
.v-ico.coral { color: #FF9A8F; background: rgba(255, 106, 92, 0.2); }
.v-ico.grey { color: var(--v-tx); background: rgba(255, 255, 255, 0.08); }

/* ---------- Segmented control ---------- */
.seg {
  display: grid;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--v-line);
  border-radius: 16px;
  background: var(--v-card);
}

.seg > button,
.seg > span {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 40px;
  margin: 0;
  padding: 0 6px;
  border: 0;
  border-radius: 12px;
  color: var(--v-tx2);
  background: transparent;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.seg > .on,
.seg > [aria-selected="true"],
.seg > [aria-pressed="true"] {
  color: #fff;
  background: var(--v-raised);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 4px 12px -4px rgba(0, 0, 0, 0.6);
}

.seg.car > .on,
.seg.car > [aria-selected="true"],
.seg.car > [aria-pressed="true"] {
  background: linear-gradient(160deg, #2D6FE0, #1A4FC4);
  box-shadow: 0 6px 18px -6px rgba(61, 139, 255, 0.8);
}

.seg.mint > .on,
.seg.mint > [aria-selected="true"],
.seg.mint > [aria-pressed="true"] {
  background: linear-gradient(160deg, #0D7A55, #095C40);
  box-shadow: 0 6px 18px -6px rgba(59, 232, 166, 0.6);
}

/* ---------- Buttons ---------- */
.v-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--v-line-strong);
  border-radius: 999px;
  color: var(--v-tx);
  background: var(--v-card2);
  font: inherit;
  font-size: 15px;
  font-weight: 650;
  white-space: nowrap;
  cursor: pointer;
}

.v-btn.primary {
  border-color: transparent;
  color: #fff;
  background: linear-gradient(160deg, #3D8BFF, #1A4FC4);
  box-shadow: 0 8px 24px -10px rgba(61, 139, 255, 0.9);
}

.v-btn.ghost {
  border-color: transparent;
  background: transparent;
}

/* Legacy primary / secondary buttons pick up the vivid look. */
.primary-action {
  border: 0;
  color: #fff;
  background: linear-gradient(160deg, #3D8BFF, #1A4FC4);
  box-shadow: 0 8px 24px -12px rgba(61, 139, 255, 0.9);
  font-weight: 650;
}

.secondary-action {
  border: 1px solid var(--v-line-strong);
  color: var(--v-tx);
  background: var(--v-card2);
  font-weight: 600;
}

/* Back pill: "< Garage", "< Home energy". */
.v-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  max-width: 100%;
  min-height: 44px;
  margin: 0;
  padding: 0 16px 0 8px;
  border: 1px solid var(--v-line);
  border-radius: 22px;
  color: var(--v-tx);
  background: var(--v-card2);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.v-back svg {
  flex: none;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- Switch (input type=checkbox role=switch) ---------- */
.v-switch {
  position: relative;
  flex: none;
  width: 51px;
  height: 31px;
  margin: 0;
  border-radius: 16px;
  background: #3A4458;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  transition: background-color 160ms ease;
}

.v-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  transition: transform 160ms ease;
}

.v-switch:checked {
  background: var(--v-mint2);
}

.v-switch:checked::after {
  transform: translateX(20px);
}

/* ---------- Glowing ring (see vividRingSvg in 05b-vivid-kit.js) ---------- */
.v-ring {
  display: block;
  overflow: visible;
}

.v-ring .v-ring-track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.14);
}

.v-ring .v-ring-arc,
.v-ring .v-ring-glow {
  fill: none;
  stroke-linecap: round;
  transition: stroke-dasharray 600ms ease;
}

.v-ring .v-ring-glow {
  opacity: 0.8;
}

/* ---------- Vera speaking in context ---------- */
.rev-say {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.rev-say-av {
  flex: none;
  width: 40px;
  height: 40px;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.4));
}

.v-bubble {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 10px 13px;
  border: 1px solid var(--v-line);
  border-radius: 4px 18px 18px 18px;
  color: var(--v-tx);
  background: var(--v-card2);
  font-size: 14px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.v-bubble b {
  font-weight: 700;
}

/* ---------- Motion ---------- */
@keyframes v-breathe {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

@keyframes v-flow {
  to { stroke-dashoffset: -18; }
}

.breathe {
  animation: v-breathe 3.2s ease-in-out infinite;
}

.flowing {
  animation: v-flow 1.4s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
  .breathe,
  .flowing,
  .v-tile,
  .v-rowlink {
    animation: none !important;
    transition: none !important;
  }
}

/* Backgrounded (Capacitor pause or a hidden tab): nothing animates. */
body.app-paused *,
body.app-paused *::before,
body.app-paused *::after {
  animation-play-state: paused !important;
}

/* ---------- Bottom tab bar: 5 tabs, floating, area-coloured active pill ---------- */
.phone-frame > .bottom-tabs {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 8;
  display: grid;
  grid-template-columns: none;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  gap: 0;
  height: var(--v-tabbar);
  padding: 4px 4px max(6px, var(--v-safe-bottom));
  border-top: 1px solid var(--v-line);
  background: rgba(6, 8, 13, 0.97);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .phone-frame > .bottom-tabs:not(.no-blur) {
    background: linear-gradient(180deg, rgba(6, 8, 13, 0.74), rgba(6, 8, 13, 0.96) 40%);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
  }
}

/* A 40px fade above the bar, so content dissolves into it rather than being cut. */
.phone-frame > .bottom-tabs::before {
  content: "";
  position: absolute;
  right: 0;
  bottom: 100%;
  left: 0;
  height: 40px;
  background: linear-gradient(180deg, rgba(6, 8, 13, 0), rgba(6, 8, 13, 0.9));
  pointer-events: none;
}

.phone-frame > .bottom-tabs button,
.phone-frame > .bottom-tabs button.active,
.phone-frame > .bottom-tabs button:hover {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  min-height: 50px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 12px;
  color: var(--v-tx3);
  background: transparent;
  box-shadow: none;
  font-family: var(--v-font);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.phone-frame > .bottom-tabs button.active {
  color: #fff;
}

.phone-frame > .bottom-tabs .tab-ic {
  display: grid;
  place-items: center;
  width: 46px;
  height: 28px;
  border-radius: 14px;
  transition: background-color 180ms ease, box-shadow 180ms ease;
}

.phone-frame > .bottom-tabs button svg,
.phone-frame > .bottom-tabs button.active svg {
  width: 22px;
  height: 22px;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.phone-frame > .bottom-tabs button.active .tab-ic {
  background: rgba(61, 139, 255, 0.92);
  box-shadow: 0 4px 16px -2px rgba(61, 139, 255, 0.6);
}

.phone-frame > .bottom-tabs button.active[data-accent="garage"] .tab-ic {
  background: var(--v-garage-grad);
  box-shadow: 0 4px 16px -2px rgba(255, 154, 47, 0.5);
}

.phone-frame > .bottom-tabs button.active[data-accent="mint"] .tab-ic {
  background: var(--v-mint2);
  box-shadow: 0 4px 16px -2px rgba(22, 185, 126, 0.55);
}

.phone-frame > .bottom-tabs button.active[data-accent="slate"] .tab-ic {
  background: var(--v-slate);
  box-shadow: 0 4px 16px -2px rgba(58, 69, 96, 0.7);
}

.phone-frame > .bottom-tabs button:focus-visible {
  outline: 2px solid var(--v-car2);
  outline-offset: -2px;
}

/* ---------- Vera: a 48px round button with a blue-to-amber ring and a mint online dot ---------- */
.rev-button,
.rev-button.intro {
  top: 22px;
  right: var(--v-gutter);
  width: 48px;
  height: 48px;
  min-width: 48px;
  padding: 3px;
  border-radius: 50%;
  background: conic-gradient(from 210deg, #7DB8FF, #3D8BFF, #FF7A1F, #FFB547, #7DB8FF);
  box-shadow: 0 6px 24px rgba(61, 139, 255, 0.35);
}

body.native-app .rev-button {
  top: max(22px, calc(env(safe-area-inset-top, 0px) + 12px));
}

.shared-account-banner:not(.hidden) ~ .rev-button {
  top: calc(22px + var(--shared-banner-space, 72px));
}

body.native-app .shared-account-banner:not(.hidden) ~ .rev-button {
  top: calc(max(22px, calc(env(safe-area-inset-top, 0px) + 12px)) + var(--shared-banner-space, 72px));
}

.rev-button:hover {
  background: conic-gradient(from 210deg, #7DB8FF, #3D8BFF, #FF7A1F, #FFB547, #7DB8FF);
}

.rev-button .rev-button-mark,
.rev-button.intro .rev-button-mark {
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 50%;
  background: #0D1320;
}

.rev-button .rev-button-mark img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.rev-button::after {
  content: "";
  position: absolute;
  inset: auto 1px 3px auto;
  animation: none;
  box-shadow: none;
  display: block;
  width: 11px;
  height: 11px;
  border: 2px solid var(--v-bg);
  border-radius: 50%;
  background: var(--v-mint);
}

.rev-button:focus-visible {
  border-radius: 50%;
}

/* ---------- Shared-account banner ---------- */
.shared-account-banner {
  border-bottom: 1px solid rgba(166, 148, 255, 0.3);
  background: linear-gradient(120deg, rgba(166, 148, 255, 0.2), rgba(166, 148, 255, 0.04) 70%), var(--v-card);
}

/* "Back to mine" is a vivid secondary button on every tab (the ID beats styles-calm-me.css's light-blue fill). */
#sharedAccountBanner button {
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  box-shadow: none;
  font-weight: 700;
  transition: background-color 160ms ease, transform 160ms ease;
}

#sharedAccountBanner button:hover {
  background: rgba(255, 255, 255, 0.18);
}

#sharedAccountBanner button:active {
  background: rgba(255, 255, 255, 0.22);
  transform: scale(0.97);
}

#sharedAccountBanner button:focus-visible {
  outline: 2px solid var(--v-car2);
  outline-offset: 2px;
}

/* ---------- Sheets and overlays ---------- */
.app-sheet-overlay,
.setup-overlay,
.schedule-editor-overlay,
.tesla-auth-overlay,
.billing-gate,
.charge-sheet-backdrop {
  background: rgba(3, 5, 9, 0.76);
}

.app-sheet,
.setup-sheet,
.schedule-editor-sheet,
.tesla-auth-sheet,
.command-sheet,
.target-picker-sheet {
  border: 1px solid var(--v-line);
  border-bottom: 0;
  border-radius: var(--v-r-hero) var(--v-r-hero) 0 0;
  background: linear-gradient(180deg, #131A27, var(--v-card) 160px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 -24px 60px rgba(0, 0, 0, 0.55);
}

.setup-sheet.onboarding-screen {
  background: var(--v-bg);
}

.billing-gate-card {
  border: 1px solid var(--v-line);
  border-radius: var(--v-r-hero);
  background: var(--v-card);
}

.sheet-top h2,
.app-sheet .sheet-top h2 {
  font-size: 22px;
  font-weight: 750;
  letter-spacing: -0.02em;
}

#screen-garage.charge-sheet.active {
  border: 1px solid var(--v-line);
  border-bottom: 0;
  border-radius: var(--v-r-hero) var(--v-r-hero) 0 0;
  background: linear-gradient(180deg, #131A27, var(--v-card) 160px);
}

#screen-garage .charge-sheet-head h2 {
  font-size: 22px;
  font-weight: 750;
}

/* ---------- Toast ---------- */
.toast {
  border: 1px solid var(--v-line-strong);
  border-radius: 18px;
  color: var(--v-tx);
  background: rgba(22, 29, 42, 0.97);
  box-shadow: 0 16px 40px -12px rgba(0, 0, 0, 0.7);
  font-weight: 600;
}

/* On a tab the toast sits just above the tab bar, so it never covers the page title. Over a sheet it keeps to the
   top, clear of the sheet's buttons. */
body:not(.rev-open) .toast {
  top: auto;
  bottom: calc(var(--v-tabbar, 76px) + 12px);
}

body.charge-sheet-open:not(.rev-open) .toast,
body:has(:is(.app-sheet-overlay, .setup-overlay, .schedule-editor-overlay, .tesla-auth-overlay, .billing-gate, .auth-gate):not(.hidden)):not(.rev-open) .toast {
  top: max(16px, calc(env(safe-area-inset-top, 0px) + 10px));
  bottom: auto;
}

/* =====================================================================================================================
   Garage (#screen-fleet)
   ===================================================================================================================== */
#screen-fleet .fleet-list {
  display: flex;
  flex-direction: column;
  gap: var(--v-gap);
}

.fleet-card {
  display: block;
  width: 100%;
  margin: 0;
  padding: 16px 16px 14px;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.fleet-card .v-lbl {
  margin-top: 4px;
}

.fleet-car-art {
  margin: 8px -4px 0;
}

.fleet-car-art svg,
.fleet-home-art svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.fleet-home-art {
  margin: 0 12% 0 10%;
}

/* Battery ruler: a lit bar to the level, 21 ticks, and a white goal marker with an amber halo. */
.fleet-ruler {
  position: relative;
  margin-top: 10px;
}

.fleet-ruler-bar {
  position: relative;
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.14);
}

.fleet-ruler-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, #7DB8FF, #fff);
  box-shadow: 0 0 12px rgba(155, 208, 255, 0.8);
}

.fleet-ruler-goal {
  position: absolute;
  top: -5px;
  width: 4px;
  height: 18px;
  margin-left: -2px;
  border-radius: 2px;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(255, 181, 71, 0.55);
}

.fleet-ruler-ticks {
  position: relative;
  height: 9px;
  margin-top: 6px;
}

.fleet-ruler-ticks i {
  position: absolute;
  top: 0;
  width: 2px;
  height: 6px;
  margin-left: -1px;
  border-radius: 1px;
  background: rgba(255, 255, 255, 0.26);
}

.fleet-ruler-ticks i.major {
  height: 9px;
}

.fleet-ruler-ticks i.lit {
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 0 6px rgba(155, 208, 255, 0.9);
}

.fleet-ruler-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 10px;
  margin-top: 6px;
  color: rgba(255, 255, 255, 0.92);
  font-size: 12px;
  font-weight: 600;
}

.fleet-ruler-foot .goal {
  color: #FFD9A6;
}

.fleet-stat {
  min-width: 0;
  padding: 9px clamp(8px, 2.6vw, 11px);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.26);
}

.fleet-stat .v-val {
  font-size: clamp(15px, 4.6vw, 18px);
}

.fleet-home .v-grid3 {
  margin-top: 8px;
}

.fleet-add .v-ttl {
  font-weight: 600;
}

.fleet-empty .v-ttl {
  margin-top: 8px;
}

.fleet-empty .v-lbl {
  margin-top: 4px;
}

.fleet-empty .v-btn {
  margin-top: 14px;
}

/* =====================================================================================================================
   Home energy hub (#screen-homeenergy) and its sub-pages
   ===================================================================================================================== */
.energy-hub-head {
  display: flex;
  align-items: center;
  min-height: 60px;
  padding-right: 60px;
}

.energy-hub-title {
  margin: 4px 0 var(--v-gap);
}

#screen-homeenergy .energy-hub,
#screen-homeenergy .energy-page {
  display: flex;
  flex-direction: column;
  gap: var(--v-gap);
}

#screen-homeenergy .energy-page.hidden,
#screen-homeenergy .energy-hub.hidden {
  display: none;
}

/* The live 5-node flow: Solar and To grid on top, Home use in the centre, Powerwall and the car below. */
.flow-hero {
  height: 252px;
  padding: 0;
}

.flow-hero > svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.flow-node {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 33%;
  text-align: center;
  transform: translateX(-50%);
}

.flow-node .orb {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.07), 0 8px 22px -6px rgba(0, 0, 0, 0.5);
}

.flow-node .orb svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.flow-node.home .orb {
  width: 64px;
  height: 64px;
  color: #8E3A0A;
  background: #fff;
}

.flow-node.home .orb svg {
  width: 28px;
  height: 28px;
}

.flow-node.solar .orb { color: #4A2508; background: radial-gradient(circle at 35% 30%, #FFF1C9, #FFB547 55%, #FF7A1F); }
.flow-node.grid .orb { color: #fff; background: #6A2C0B; }
.flow-node.battery .orb { color: #0E7A52; background: #F4F6FA; }
.flow-node.car .orb { color: #fff; background: linear-gradient(150deg, #5AA2FF, #1A4FC4); }
.flow-node.idle .orb { opacity: 0.75; }

.flow-node .v {
  margin-top: 6px;
  font-size: clamp(15px, 4.6vw, 17px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

/* Node labels wrap to a second line when long ("Model Y Long Range"), never ellipsized. */
.flow-node .l {
  max-width: 100%;
  color: rgba(255, 255, 255, 0.9);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.energy-tile-spark {
  flex: none;
  width: 48px;
  height: 20px;
}

/* The energy cards moved in from Today keep their own renderers; inside the hub they read as vivid cards. */
#screen-homeenergy .energy-page > section:not(.hidden):not(.hero):not(.v-card) {
  margin: 0;
  border: 1px solid var(--v-line);
  border-radius: var(--v-r-card);
  background: var(--v-card);
}

/* Storm Watch fill: solid mint to the level, hatched up to full. */
.storm-fill {
  position: relative;
  height: 10px;
  margin-top: 14px;
  overflow: hidden;
  border-radius: 5px;
  background: repeating-linear-gradient(135deg, rgba(59, 232, 166, 0.32) 0 5px, rgba(59, 232, 166, 0.08) 5px 10px);
}

.storm-fill > span {
  display: block;
  height: 100%;
  border-radius: 5px;
  background: linear-gradient(90deg, #16B97E, #3BE8A6);
  box-shadow: 0 0 10px rgba(59, 232, 166, 0.7);
}

.storm-fill-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 10px;
  margin-top: 8px;
  color: var(--v-tx2);
  font-size: 13px;
  font-weight: 600;
}

.storm-fill-foot b {
  color: #fff;
}

/* Wind hero: compass, then speed / direction / gusts on separate lines, then hourly bars. */
.wind-compass {
  flex: none;
  width: clamp(80px, 25vw, 100px);
  height: auto;
}

.wind-lines {
  flex: 1;
  min-width: 0;
}

.wind-lines .line {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
}

.wind-lines .gust {
  color: #FFCFC8;
}

.wind-hours-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 14px 0 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.9);
  font-size: 12px;
  font-weight: 600;
}

.wind-hours {
  display: flex;
  align-items: flex-start;
  gap: 4px;
}

.wind-hour {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}

.wind-hour .bars {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: 100%;
  height: 60px;
}

.wind-hour .bar {
  width: 62%;
  max-width: 24px;
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(201, 190, 255, 0.7), rgba(166, 148, 255, 0.18));
}

.wind-hour .gustmark {
  position: absolute;
  width: 62%;
  max-width: 24px;
  height: 3px;
  border-radius: 2px;
  background: #FFB0A6;
  box-shadow: 0 0 6px rgba(255, 176, 166, 0.8);
}

.wind-hour .s {
  margin-top: 6px;
  font-size: 14px;
  font-weight: 750;
  line-height: 1.1;
  white-space: nowrap;
}

.wind-hour .g {
  color: #FFCFC8;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
}

.wind-hour .h {
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.88);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
}

@media (max-width: 359px) {
  .wind-hour .h.alt {
    visibility: hidden;
  }
}

/* =====================================================================================================================
   Today (#screen-home): the retired Car / Home switch, the Home tile and the Storm Watch strip
   ===================================================================================================================== */
#screen-home #homeViewSwitch {
  display: none !important;
}

#screen-home .home-energy-peek:not(.hidden) {
  all: unset;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  margin: 0 0 var(--v-gap);
  padding: 14px 16px;
  border: 1px solid rgba(255, 181, 71, 0.28);
  border-radius: var(--v-r-card);
  color: var(--v-tx);
  background: linear-gradient(140deg, rgba(255, 140, 40, 0.2), rgba(255, 140, 40, 0.03) 70%), var(--v-card);
  cursor: pointer;
}

#screen-home .home-energy-peek .v-big {
  font-size: clamp(34px, 11vw, 44px);
}

.peek-bar {
  height: 8px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
}

.peek-bar > span {
  display: block;
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, #FF7A1F, #FFB547);
}

#screen-home .storm-watch-banner:not(.hidden) {
  border: 1px solid rgba(166, 148, 255, 0.4);
  border-radius: var(--v-r-card);
  background: linear-gradient(120deg, rgba(166, 148, 255, 0.24), rgba(166, 148, 255, 0.04) 70%), var(--v-card);
  cursor: pointer;
}

#screen-home .storm-watch-banner .swb-icon {
  color: var(--v-storm);
  background: rgba(166, 148, 255, 0.17);
}

/* Today hero: the vivid car look on the existing simplified hero (screen agents refine the layout). */
#screen-home .simplified-home-hero {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--v-r-hero);
  color: #fff;
  background: var(--v-hero-car);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 20px 50px -20px rgba(61, 139, 255, 0.55);
}

#screen-home .simplified-home-hero .ring-fill {
  stroke: #9BD0FF;
  filter: drop-shadow(0 0 6px rgba(125, 184, 255, 0.9));
}

#screen-home .simplified-home-hero .ring-track {
  stroke: rgba(255, 255, 255, 0.14);
}

#screen-home .simplified-home-hero .ring-goal {
  stroke: rgba(255, 181, 71, 0.35);
}

/* Today's home-only energy hero reuses the hub's flow markup. */
#todayEnergyHero.hidden {
  display: none;
}

#todayEnergyHero {
  margin-bottom: var(--v-gap);
  cursor: pointer;
}

/* ---------- Global card look on the existing tabs, so nothing reads half-old ---------- */
.screen-view .home-metric-card,
.screen-view .autopilot-card,
.screen-view .rate-strip,
.screen-view .tesla-card,
.screen-view .ai-card,
.screen-view .hint-card,
.screen-view .weekly-summary-card,
.screen-view .home-score,
.screen-view .home-energy-card,
.screen-view .settings-group,
.screen-view .savings-summary-card {
  border: 1px solid var(--v-line);
  border-radius: var(--v-r-card);
  background-color: var(--v-card);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* The home energy cards now live in #screen-homeenergy; these restate styles.css rules that were scoped to Today. */
#screen-homeenergy .home-energy-week {
  display: grid;
  gap: 6px;
  padding: 16px;
}

#screen-homeenergy .weather-plan,
#screen-homeenergy .day-plan,
#screen-homeenergy .solar-worth {
  display: grid;
  gap: 8px;
  padding: 16px;
}

#screen-homeenergy .home-energy-week.hidden,
#screen-homeenergy .weather-plan.hidden,
#screen-homeenergy .day-plan.hidden,
#screen-homeenergy .solar-worth.hidden {
  display: none;
}

#screen-homeenergy .energy-page-slot > section:not(.hidden) {
  margin: 0;
  border: 1px solid var(--v-line);
  border-radius: var(--v-r-card);
  background: var(--v-card);
}

/* The illustrations sit inside buttons, whose legacy svg rules would stroke every shape; they draw only what they say. */
.fleet-car-art svg,
.fleet-home-art svg {
  fill: #000;
  stroke: none;
}


/* Today's ring hero becomes the blue car hero (the Today screen agent refines its layout). */
#screen-home .simplified-home-hero[data-ring="true"],
#screen-home .simplified-home-hero {
  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-home .today-rev-note:not(.hidden) {
  margin: 0 0 var(--v-gap);
}

/* Under 360px every other hour label hides; the ones left get a little smaller so "10 PM" fits its column. */
@media (max-width: 359px) {
  .wind-hours {
    gap: 2px;
  }

  .wind-hour .h {
    font-size: 10px;
    letter-spacing: -0.01em;
  }
}

/* Headline numerals: confident and heavy, as in the mockups (the calm look drew them light). */
.calm-num {
  font-weight: 750;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

/* Take control (Today hero, Plan, and its sheet): the vivid primary action and glass status. */
#screen-home .simplified-home-hero .tesla-schedule-status:not(.hidden) {
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--v-r-inner);
  color: #fff;
  background: rgba(0, 8, 30, 0.32);
}

#screen-home .simplified-home-hero .tesla-schedule-status p {
  color: rgba(255, 255, 255, 0.9);
}

#takeControlButton:not(.hidden),
#planTakeControlButton:not(.hidden) {
  border: 0;
  color: #fff;
  background: linear-gradient(160deg, #3D8BFF, #1A4FC4);
  box-shadow: 0 8px 24px -10px rgba(61, 139, 255, 0.9);
  font-weight: 650;
}

/* ---------- Review fixes ---------- */
/* On the blue car hero the calm rules (#screen-home .simplified-home-hero .hero-controls-button) outrank the
   generic Take control rule above, so state it at hero specificity: glass for Charge controls, and Take control as
   the one solid (white) action, which reads on blue where a blue gradient wouldn't. */
#screen-home .simplified-home-hero .hero-controls-button {
  border: 1px solid rgba(255, 255, 255, 0.16) !important;
  color: #fff;
  background: rgba(0, 8, 30, 0.32);
  font-weight: 600;
}

#screen-home .simplified-home-hero .hero-controls-button.hero-take-control:not(.hidden) {
  border-color: transparent !important;
  color: #0B2A6B;
  background: #fff;
  box-shadow: 0 8px 24px -12px rgba(0, 0, 0, 0.6);
  font-weight: 650;
}

#screen-home .simplified-home-hero .hero-controls-button.hero-take-control svg {
  color: #1A4FC4;
}

/* Electricity prices on Today is a row in the Autopilot list, not a card. */
#screen-home .rate-strip {
  border: 0;
  border-bottom: 1px solid var(--v-line);
  border-radius: 0;
  background: none;
  box-shadow: none;
}

/* Sub-page placeholder while a section loads or can't be fetched. */
#screen-homeenergy .energy-page-empty {
  padding: 18px;
}

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

/* Garage house stats: at 320 a third of the card is ~64px, so the label steps down rather than splitting
   "Powerwall" across two lines. */
.fleet-stat .v-lbl {
  font-size: clamp(11.5px, 3.6vw, 13px);
  overflow-wrap: normal;
}

/* Plan's Take control card on its blue gradient: white copy, a glass icon well and a white chevron (the calm greys
   were ~2:1 on blue). */
#screen-device .plan-take-control .plan-take-control-copy strong {
  color: #fff;
  font-weight: 650;
}

#screen-device .plan-take-control .plan-take-control-copy small {
  color: rgba(255, 255, 255, 0.86);
  font-weight: 500;
}

#screen-device .plan-take-control .plan-take-control-icon {
  background: rgba(255, 255, 255, 0.18);
}

#screen-device .plan-take-control .plan-take-control-icon svg,
#screen-device .plan-take-control .plan-take-control-chevron {
  stroke: #fff;
}

/* Today's Storm Watch strip: the calm rules set its surface with !important, so the vivid storm look needs it too.
   Title + light line + a chevron button (the strip opens Weather & storms). */
#screen-home .storm-watch-banner:not(.hidden) {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 12px 14px 14px;
  border: 1px solid rgba(166, 148, 255, 0.4) !important;
  background: linear-gradient(120deg, rgba(166, 148, 255, 0.24), rgba(166, 148, 255, 0.04) 70%), var(--v-card) !important;
}

#screen-home .storm-watch-banner .swb-icon svg {
  color: var(--v-storm);
  stroke: var(--v-storm);
}

#screen-home .storm-watch-banner .swb-copy {
  flex: 1;
  min-width: 0;
}

#screen-home .storm-watch-banner .swb-copy strong {
  color: var(--v-tx);
  font-size: 16px;
  font-weight: 700;
}

#screen-home .storm-watch-banner .swb-copy small {
  color: var(--v-tx2);
  font-size: 13px;
  font-weight: 500;
}

#screen-home .storm-watch-banner .swb-open {
  display: grid;
  flex: none;
  place-items: center;
  width: 32px;
  height: 44px;
  margin: -8px -4px -8px 0;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

#screen-home .storm-watch-banner .swb-open svg {
  color: var(--v-tx3);
  stroke: var(--v-tx3);
}

/* VueRate plans (Drive / Home / One): the VueRate Home notice now sits on the Home energy hub, where the features it
   talks about live. The amber card, white title, two buttons that wrap rather than squeeze. */
#screen-homeenergy .home-plan-notice:not(.hidden) {
  display: grid;
  gap: 14px;
  margin: 0 0 var(--v-gap);
  padding: 18px;
  border: 1px solid rgba(255, 181, 71, 0.35);
  border-radius: var(--v-r-card);
  background: linear-gradient(140deg, rgba(255, 122, 31, 0.22), rgba(255, 181, 71, 0.05) 70%), var(--v-card);
}

#screen-homeenergy .home-plan-notice.hidden {
  display: none;
}

#screen-homeenergy .home-plan-notice .eyebrow {
  margin: 0 0 6px;
  color: #FFC37A;
}

#screen-homeenergy .home-plan-notice h3 {
  margin: 0 0 6px;
  color: var(--v-tx);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.3;
}

#screen-homeenergy .home-plan-notice p:not(.eyebrow) {
  margin: 0;
  color: var(--v-tx2);
  font-size: 14px;
  line-height: 1.45;
}

#screen-homeenergy .home-plan-notice-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

#screen-homeenergy .home-plan-notice-actions button {
  flex: 1 1 120px;
  min-height: 44px;
}

/* Without VueRate Home the summary switches say which plan adds them, and the worth row offers it. */
#screen-homeenergy .hes-solar.locked small,
#screen-homeenergy .hes-storm.locked small {
  color: #FFC37A;
}

#screen-homeenergy .hes-worth.locked strong {
  color: var(--v-car2, #7DB8FF);
}

/* Plans & billing: each plan wears its area colour (Drive = the car's blue, Home = the sun's amber, One = both), with
   heavy price numerals and the vivid primary button on the suggested plan. Ids and classes are the plans release's. */
#billingSettingsOverlay .plan-option:not(.plan-option-free) {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--v-line);
  border-radius: var(--v-r-card);
  background: var(--v-card);
}

#billingSettingsOverlay .plan-option:not(.plan-option-free)::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: var(--plan-accent, var(--v-car));
}

#billingSettingsOverlay #planOptionDrive {
  --plan-accent: linear-gradient(90deg, #3D8BFF, #7DB8FF);
  background: linear-gradient(160deg, rgba(61, 139, 255, 0.16), rgba(61, 139, 255, 0) 55%), var(--v-card);
}

#billingSettingsOverlay #planOptionHome {
  --plan-accent: linear-gradient(90deg, #FF7A1F, #FFB547);
  background: linear-gradient(160deg, rgba(255, 140, 50, 0.16), rgba(255, 140, 50, 0) 55%), var(--v-card);
}

#billingSettingsOverlay #planOptionOne {
  --plan-accent: linear-gradient(90deg, #3D8BFF, #FFB547);
  background: linear-gradient(160deg, rgba(61, 139, 255, 0.14), rgba(255, 140, 50, 0.1) 60%, rgba(0, 0, 0, 0)), var(--v-card);
}

#billingSettingsOverlay .plan-option.suggested {
  border-color: rgba(125, 184, 255, 0.7);
  box-shadow: 0 0 0 1px rgba(125, 184, 255, 0.35), 0 14px 34px -18px rgba(61, 139, 255, 0.8);
}

#billingSettingsOverlay .plan-option.current {
  border-color: rgba(59, 232, 166, 0.5);
}

#billingSettingsOverlay .plan-option-name {
  font-weight: 700;
}

#billingSettingsOverlay .plan-option-price strong {
  font-weight: 800;
  letter-spacing: -0.035em;
}

#billingSettingsOverlay .plan-option-benefits svg {
  stroke: var(--v-mint);
}

#billingSettingsOverlay .plan-option-cta.primary-action {
  border: 0;
  color: #fff;
  background: linear-gradient(160deg, #3D8BFF, #1A4FC4);
  box-shadow: 0 8px 24px -10px rgba(61, 139, 255, 0.9);
  font-weight: 650;
}

/* Setup: a Tesla sign-in that didn't finish says so in the step itself. */
#setupVehicleBrandHint.warn {
  color: #FFB547;
  font-weight: 600;
}

/* Sheets float inside the overlay's margin, so they are closed cards (all four corners and edges), not docked panels
   that look cut off above the bottom of the screen. */
.app-sheet-overlay > .app-sheet,
.tesla-auth-overlay > .tesla-auth-sheet {
  border-bottom: 1px solid var(--v-line);
  border-radius: var(--v-r-hero);
}

/* Robustness and shared viewers. A switch a "Can view" member can't change looks off limits. */
.autopilot-switch input:disabled,
input[type="checkbox"]:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
#autopilotViewOnly {
  color: var(--v-tx2);
  font-weight: 400;
}
.view-only-note {
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid var(--v-line-strong);
  border-radius: var(--v-r-small);
  background: var(--v-card2);
  color: var(--v-tx2);
  font-size: 14px;
  line-height: 1.4;
}
label.is-disabled { cursor: not-allowed; }
/* With a shared account's banner across the top, a toast shows below it, never over its name or Back to mine. On a tab
   it already sits above the tab bar; at the top (over a sheet) it moves down by the banner's height. */
body.shared-banner-on.charge-sheet-open:not(.rev-open) .toast,
body.shared-banner-on:has(:is(.app-sheet-overlay, .setup-overlay, .schedule-editor-overlay, .tesla-auth-overlay, .billing-gate, .auth-gate):not(.hidden)):not(.rev-open) .toast {
  top: calc(max(16px, calc(env(safe-area-inset-top, 0px) + 10px)) + var(--shared-banner-space, 72px));
}

/* ---------- Plan badge ----------
   One badge for every paid feature this account doesn't have yet: the plan's icon and short name (Drive, Home, One) in
   the plan's colour (car blue, sun amber, both for One). Built by planBadgeMarkup() in 12a-plans.js. As a button it
   opens Plans with that plan chosen; .plan-badge inside another button is a span and the host opens the plan. */
.plan-badge {
  --pb-tx: #CFE3FF;
  --pb-bg: rgba(61, 139, 255, 0.2);
  --pb-line: rgba(125, 184, 255, 0.42);
  position: relative;
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 4px;
  height: 22px;
  min-height: 0;
  margin: 0;
  padding: 0 8px 0 6px;
  border: 1px solid var(--pb-line);
  border-radius: 999px;
  color: var(--pb-tx);
  background: var(--pb-bg);
  font-family: inherit;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.01em;
  text-transform: none;
  white-space: nowrap;
  vertical-align: middle;
  box-shadow: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
span.plan-badge { cursor: inherit; }
.plan-badge svg {
  flex: none;
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.plan-badge > span { display: inline-block; }
.plan-badge--md {
  height: 26px;
  gap: 5px;
  padding: 0 10px 0 8px;
  font-size: 13px;
}
.plan-badge--md svg { width: 15px; height: 15px; }
.plan-badge--home {
  --pb-tx: #FFD18A;
  --pb-bg: rgba(255, 181, 71, 0.16);
  --pb-line: rgba(255, 181, 71, 0.45);
}
.plan-badge--one {
  --pb-tx: #F2F6FF;
  border-color: transparent;
  background:
    linear-gradient(90deg, rgba(31, 52, 92, 0.96), rgba(70, 50, 22, 0.96)) padding-box,
    linear-gradient(90deg, var(--v-car2), var(--v-sun)) border-box;
}
/* As a button the badge is a full 44px target: the pill is drawn by ::after inside it, and negative margins keep the
   line it sits on the pill's own height. */
button.plan-badge {
  height: 44px;
  min-width: 44px;
  margin: -11px 0;
  border: 0;
  background: none;
  isolation: isolate;
}
button.plan-badge.plan-badge--md { height: 48px; }
button.plan-badge::after {
  content: "";
  position: absolute;
  inset: 11px 0;
  z-index: -1;
  border: 1px solid var(--pb-line);
  border-radius: 999px;
  background: var(--pb-bg);
}
button.plan-badge--one::after {
  border-color: transparent;
  background:
    linear-gradient(90deg, rgba(31, 52, 92, 0.96), rgba(70, 50, 22, 0.96)) padding-box,
    linear-gradient(90deg, var(--v-car2), var(--v-sun)) border-box;
}
button.plan-badge:hover { filter: brightness(1.12); }
button.plan-badge:active { transform: scale(0.96); }
.plan-badge:focus-visible { outline: none; }
button.plan-badge:focus-visible::after {
  outline: 2px solid var(--v-car2);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  button.plan-badge:active { transform: none; }
}
/* Where the badge sits: after a title, on the same line while it fits. */
.pv-toggle-title,
#autopilotCard .eyebrow {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
}
#autopilotCard .eyebrow .plan-badge { text-transform: none; letter-spacing: 0.01em; }
.pv-toggle--locked .pv-cap-line { opacity: 0.6; }
#planWhenCopy .plan-badge { margin-left: 2px; vertical-align: middle; }
/* Savings, Free with a Powerwall: Drive is the offer; One is a quiet line under it. */
#screen-energy .savings-pro-teaser .sv-drive-one {
  display: block;
  width: 100%;
  min-height: 44px;
  margin: -6px 0 0;
  padding: 8px 4px;
  border: 0;
  background: none;
  color: #FFE2B0;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  text-align: center;
  text-decoration: underline;
  text-decoration-color: rgba(255, 226, 176, 0.45);
  text-underline-offset: 3px;
  cursor: pointer;
}
#screen-energy .savings-pro-teaser .sv-drive-one.hidden { display: none; }
#screen-energy .sv-drive-plan:empty { display: none; }
