/* Tessa Drive v18 — Aurora cockpit UI */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  color-scheme: dark;
  --bg: #07060f;
  --bg-deep: #030309;
  --surface: #12101e;
  --surface-raised: #19162a;
  --surface-pressed: #211d35;
  --glass: rgba(18, 15, 31, 0.76);
  --line: rgba(231, 225, 255, 0.085);
  --line-strong: rgba(231, 225, 255, 0.15);
  --text: #faf9ff;
  --text-secondary: #b5aec9;
  --text-muted: #716b86;
  --blue: #a78bfa;
  --blue-strong: #7c3aed;
  --blue-soft: rgba(167, 139, 250, 0.16);
  --mint: #22d3ee;
  --mint-soft: rgba(34, 211, 238, 0.13);
  --green: #34d399;
  --yellow: #fbbf24;
  --red: #fb7185;
  --coral: #fb7185;
  --coral-soft: rgba(251, 113, 133, 0.14);
  --violet-glow: rgba(124, 58, 237, 0.34);
  --cyan-glow: rgba(34, 211, 238, 0.25);
  --scroll-shift: 0px;
  --page: 16px;
  --tab-h: 84px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Display",
    "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

html {
  min-height: 100%;
  background: var(--bg);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  min-width: 320px;
  min-height: 100%;
  overflow-x: hidden;
  padding-bottom: calc(var(--tab-h) + var(--safe-bottom) + 8px);
  background:
    radial-gradient(circle at 50% -8%, rgba(78, 111, 190, 0.12), transparent 33%),
    var(--bg);
  color: var(--text);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: contain;
}

body::-webkit-scrollbar {
  width: 0;
  height: 0;
}

button,
summary {
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

img,
svg {
  display: block;
}

[hidden] {
  display: none !important;
}

.app-shell {
  width: 100%;
  min-height: 100svh;
  margin: 0 auto;
  overflow: clip;
  background: var(--bg);
}

/* Native gesture and feedback surfaces */
.pull-indicator {
  --pull-progress: 0;
  position: fixed;
  z-index: 1500;
  top: calc(9px + var(--safe-top));
  left: 50%;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: rgba(18, 23, 31, 0.93);
  color: var(--blue);
  opacity: calc(var(--pull-progress) * 1);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.34);
  transform: translate(-50%, calc(-54px + (var(--pull-progress) * 55px)))
    scale(calc(0.75 + (var(--pull-progress) * 0.25)));
  transition: opacity 140ms ease, transform 140ms ease, background 140ms ease;
  pointer-events: none;
}

.pull-indicator svg {
  width: 16px;
  height: 16px;
  transform: rotate(calc(var(--pull-progress) * 180deg));
  transition: transform 140ms ease;
}

.pull-indicator.is-ready {
  background: var(--blue);
  color: #07101f;
}

.pull-indicator.is-refreshing {
  --pull-progress: 1;
  background: var(--blue-soft);
  color: var(--blue);
}

.pull-indicator.is-refreshing svg {
  animation: spin 800ms linear infinite;
}

.app-toast {
  position: fixed;
  z-index: 1450;
  top: calc(10px + var(--safe-top));
  left: 50%;
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 9px;
  padding: 0 15px 0 9px;
  border: 1px solid rgba(102, 230, 189, 0.2);
  border-radius: 999px;
  background: rgba(17, 23, 28, 0.94);
  color: var(--text);
  font-size: 11px;
  font-weight: 650;
  opacity: 0;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.4);
  transform: translate(-50%, -66px) scale(0.92);
  transition: opacity 220ms ease, transform 360ms cubic-bezier(0.2, 0.8, 0.15, 1);
  pointer-events: none;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.app-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

.app-toast-icon {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 50%;
  background: var(--mint-soft);
  color: var(--mint);
}

.app-toast-icon svg {
  width: 14px;
  height: 14px;
  stroke-width: 2.3;
}

/* Compact native app bar */
.header {
  position: sticky;
  z-index: 1000;
  top: 0;
  padding: calc(7px + var(--safe-top)) var(--page) 7px;
  border-bottom: 1px solid var(--line);
  background: rgba(5, 7, 10, 0.83);
  backdrop-filter: saturate(155%) blur(24px);
  -webkit-backdrop-filter: saturate(155%) blur(24px);
  transition: background 200ms ease, box-shadow 200ms ease;
}

body.is-scrolled .header {
  background: rgba(5, 7, 10, 0.94);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22);
}

.header-top {
  display: flex;
  min-height: 43px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

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

.brand-mark {
  position: relative;
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  place-items: center;
  border-radius: 12px;
  background: var(--blue-soft);
  color: var(--blue);
}

.brand-mark::after {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(125, 162, 255, 0.2);
  border-radius: inherit;
  content: "";
}

.brand-mark svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.8;
}

.brand-overline {
  display: none;
}

.header h1 {
  overflow: hidden;
  font-size: 18px;
  font-weight: 680;
  letter-spacing: -0.035em;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
}

.connection-pill {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  gap: 7px;
  padding: 0 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 650;
  white-space: nowrap;
}

.connection-pill::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--yellow);
  box-shadow: 0 0 0 4px rgba(248, 196, 96, 0.1);
  content: "";
}

.connection-pill.online::before {
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(102, 223, 145, 0.1);
  animation: live-pulse 2.4s ease-out infinite;
}

.connection-pill.offline::before {
  background: var(--red);
  box-shadow: 0 0 0 4px rgba(255, 102, 115, 0.1);
}

.header-icon-button {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
  transition: background 160ms ease, transform 160ms ease;
}

.header-icon-button svg {
  width: 18px;
  height: 18px;
}

.header-icon-button:active {
  background: var(--surface-pressed);
  transform: scale(0.9);
}

.header-icon-button:disabled {
  opacity: 0.45;
}

.header-icon-button:disabled svg {
  animation: spin 850ms linear infinite;
}

.app-status {
  display: flex;
  min-height: 17px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 1px 0;
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 570;
}

.vehicle-name {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 6px;
}

.live-indicator {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 8px rgba(102, 230, 189, 0.55);
}

body.is-refreshing .live-indicator {
  animation: sync-pulse 750ms ease-in-out infinite alternate;
}

.updated-at {
  overflow: hidden;
  max-width: 62%;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* App view transitions */
.main-content {
  position: relative;
  min-height: calc(100svh - 78px);
  padding-bottom: 12px;
}

.app-view-section.is-entering {
  animation: view-fade 360ms cubic-bezier(0.2, 0.75, 0.1, 1) both;
  animation-delay: calc(var(--enter-index, 0) * 38ms);
}

.main-content[data-direction="forward"] .app-view-section.is-entering {
  animation-name: view-forward;
}

.main-content[data-direction="backward"] .app-view-section.is-entering {
  animation-name: view-backward;
}

/* Vehicle hero: one continuous native surface */
.status-card {
  position: relative;
  height: 354px;
  overflow: hidden;
  margin: 10px 10px 0;
  padding: 19px 18px 15px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 30px;
  background:
    radial-gradient(circle at 78% 32%, rgba(102, 230, 189, 0.12), transparent 30%),
    radial-gradient(circle at 16% 75%, rgba(125, 162, 255, 0.16), transparent 32%),
    linear-gradient(155deg, #141924, #090c12 62%, #080b0e);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.28);
  isolation: isolate;
}

.status-card::after {
  position: absolute;
  z-index: 6;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(125deg, rgba(255, 255, 255, 0.1), transparent 18%, transparent 72%, rgba(125, 162, 255, 0.05));
  content: "";
  opacity: 0.55;
  pointer-events: none;
}

.status-card::before {
  position: absolute;
  z-index: -1;
  top: -45%;
  left: 36%;
  width: 320px;
  height: 320px;
  border-radius: 44%;
  background: rgba(125, 162, 255, 0.09);
  filter: blur(10px);
  content: "";
  animation: ambient-drift 10s ease-in-out infinite alternate;
}

.vehicle-heading {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 15px;
}

.vehicle-copy {
  min-width: 0;
}

.section-eyebrow {
  display: block;
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 720;
  letter-spacing: 0.11em;
  line-height: 1.2;
  text-transform: uppercase;
}

.vehicle-copy h2 {
  margin-top: 5px;
  font-size: 27px;
  font-weight: 650;
  letter-spacing: -0.055em;
  line-height: 1;
}

.vehicle-copy p {
  max-width: 230px;
  margin-top: 7px;
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 10px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-badge {
  display: inline-flex;
  min-height: 30px;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(102, 230, 189, 0.1);
  color: var(--mint);
  font-size: 10px;
  font-weight: 720;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 9px currentColor;
}

.status-badge[data-state="asleep"] {
  background: rgba(156, 164, 175, 0.09);
  color: var(--text-secondary);
}

.status-badge[data-state="driving"] {
  background: var(--blue-soft);
  color: var(--blue);
}

.status-badge[data-state="offline"] {
  background: rgba(255, 102, 115, 0.1);
  color: var(--red);
}

.vehicle-stage {
  position: relative;
  z-index: 2;
  height: 192px;
  margin: 0 -18px;
  overflow: hidden;
}

.vehicle-orbit {
  position: absolute;
  z-index: 0;
  top: 45%;
  left: 50%;
  border: 1px solid rgba(125, 162, 255, 0.11);
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%) rotate(-7deg);
}

.vehicle-orbit-one {
  width: 350px;
  height: 112px;
  animation: orbit-breathe 5.5s ease-in-out infinite;
}

.vehicle-orbit-two {
  width: 270px;
  height: 86px;
  border-color: rgba(102, 230, 189, 0.09);
  animation: orbit-breathe 5.5s 1.1s ease-in-out infinite reverse;
}

.vehicle-image {
  position: absolute;
  z-index: 3;
  top: -54px;
  left: 50%;
  width: min(540px, 145vw);
  transform: translateX(-50%);
  animation: car-arrive 720ms cubic-bezier(0.2, 0.85, 0.15, 1) both;
  pointer-events: none;
}

.vehicle-image img {
  width: 100%;
  height: auto;
  animation: car-float 4.8s 800ms ease-in-out infinite;
  filter: drop-shadow(0 19px 14px rgba(0, 0, 0, 0.44));
  user-select: none;
}

.vehicle-floor {
  position: absolute;
  z-index: 1;
  right: 12%;
  bottom: 25px;
  left: 12%;
  height: 20px;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(0, 0, 0, 0.82), transparent 68%);
  filter: blur(5px);
  animation: floor-breathe 4.8s 800ms ease-in-out infinite;
}

.vehicle-insights {
  position: absolute;
  z-index: 5;
  right: 14px;
  bottom: 39px;
  left: 14px;
  display: grid;
  min-height: 57px;
  align-items: center;
  padding: 7px 0;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(5, 7, 10, 0.52);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.vehicle-insights > div {
  min-width: 0;
  padding: 1px 12px;
  border-right: 1px solid var(--line);
}

.vehicle-insights > div:last-child {
  border-right: 0;
}

.vehicle-insights span,
.vehicle-insights strong {
  display: block;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vehicle-insights span {
  color: var(--text-muted);
  font-size: 8px;
  font-weight: 690;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.vehicle-insights strong {
  margin-top: 4px;
  font-size: 13px;
  font-weight: 680;
}

.vehicle-footer {
  position: absolute;
  z-index: 5;
  right: 19px;
  bottom: 14px;
  left: 19px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: rgba(156, 164, 175, 0.68);
  font-size: 8px;
  font-weight: 580;
}

.vehicle-footer > span {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vehicle-footer svg {
  width: 10px;
  height: 10px;
}

body[data-vehicle-state="charging"] .status-card {
  background:
    radial-gradient(circle at 78% 32%, rgba(102, 230, 189, 0.2), transparent 32%),
    radial-gradient(circle at 16% 75%, rgba(67, 192, 144, 0.15), transparent 33%),
    linear-gradient(155deg, #12231f, #090f10 63%, #080b0e);
}

body[data-vehicle-state="driving"] .status-card {
  background:
    radial-gradient(circle at 78% 32%, rgba(125, 162, 255, 0.2), transparent 31%),
    radial-gradient(circle at 13% 78%, rgba(87, 123, 209, 0.17), transparent 33%),
    linear-gradient(155deg, #141b2a, #090c13 64%, #080b0e);
}

/* Functional quick actions */
.quick-actions {
  display: grid;
  margin: 11px 12px 0;
  gap: 7px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.quick-action {
  display: flex;
  min-width: 0;
  min-height: 69px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 6px;
  border-radius: 19px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-secondary);
  font-size: 8px;
  font-weight: 640;
  transition: background 160ms ease, color 160ms ease, transform 150ms ease;
}

.quick-action:active {
  background: rgba(255, 255, 255, 0.065);
  transform: scale(0.92);
}

.quick-action-icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 13px;
  background: var(--blue-soft);
  color: var(--blue);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.04);
}

.quick-action:nth-child(2) .quick-action-icon {
  background: var(--mint-soft);
  color: var(--mint);
}

.quick-action:nth-child(3) .quick-action-icon {
  background: rgba(178, 133, 255, 0.12);
  color: #b995ff;
}

.quick-action:nth-child(4) .quick-action-icon {
  background: rgba(255, 177, 102, 0.12);
  color: #ffb56f;
}

.quick-action-icon svg {
  width: 17px;
  height: 17px;
  stroke-width: 1.8;
}

.quick-actions.is-entering .quick-action {
  animation: quick-action-enter 360ms cubic-bezier(0.2, 0.8, 0.15, 1) both;
}

.quick-actions.is-entering .quick-action:nth-child(2) {
  animation-delay: 45ms;
}

.quick-actions.is-entering .quick-action:nth-child(3) {
  animation-delay: 90ms;
}

.quick-actions.is-entering .quick-action:nth-child(4) {
  animation-delay: 135ms;
}

body.is-refreshing [data-refresh-shortcut] .quick-action-icon svg {
  animation: spin 800ms linear infinite;
}

/* Battery is a native information rail, not another card */
.battery-card {
  position: relative;
  margin: 7px 16px 0;
  padding: 20px 3px 19px;
  border-bottom: 1px solid var(--line);
}

.battery-header {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 18px;
}

.battery-main {
  min-width: 0;
  flex: 1;
}

.battery-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--mint);
  font-size: 10px;
  font-weight: 700;
}

.battery-kicker svg {
  width: 14px;
  height: 14px;
}

.battery-reading {
  display: flex;
  align-items: flex-start;
  margin-top: 8px;
}

.battery-percent {
  font-size: clamp(48px, 14vw, 64px);
  font-weight: 590;
  letter-spacing: -0.075em;
  line-height: 0.88;
}

.battery-percent-unit {
  margin: 2px 0 0 5px;
  color: var(--text-secondary);
  font-size: 18px;
  font-weight: 580;
}

.battery-range {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 10px;
  color: var(--text-secondary);
  font-size: 12px;
}

.battery-range svg {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
}

.battery-range .unit {
  color: var(--text-muted);
  font-size: 10px;
}

.battery-consumption {
  display: flex;
  min-width: 137px;
  align-items: flex-end;
  justify-content: center;
  flex-direction: column;
  padding-left: 17px;
  border-left: 1px solid var(--line);
  text-align: right;
}

.battery-consumption .label {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  color: var(--text-muted);
  font-size: 8px;
  font-weight: 680;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.battery-consumption .label svg {
  width: 11px;
  height: 11px;
}

.battery-consumption .value {
  margin-top: 8px;
  font-size: 15px;
  font-weight: 670;
}

.consumption-note {
  margin-top: 5px;
  color: var(--text-muted);
  font-size: 8px;
}

.battery-bar-wrap {
  margin-top: 18px;
}

.battery-bar-labels {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  color: var(--text-muted);
  font-size: 7px;
  font-weight: 670;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.battery-bar {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.075);
}

.battery-bar-fill {
  position: relative;
  width: 0;
  height: 100%;
  overflow: hidden;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue-strong), var(--blue) 56%, var(--mint));
  box-shadow: 0 0 16px rgba(125, 162, 255, 0.28);
  transition: width 760ms cubic-bezier(0.2, 0.8, 0.1, 1);
}

.battery-bar-fill::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.42), transparent);
  content: "";
  animation: energy-sweep 2.8s ease-in-out infinite;
  transform: translateX(-105%);
}

/* Since-charge disclosure */
.since-charge-section {
  overflow: hidden;
  margin: 14px 12px 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
}

.since-charge-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.since-charge-heading h2,
.section-title,
.metrics-section-heading h2 {
  margin-top: 5px;
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.045em;
  line-height: 1.08;
}

.since-charge-heading p,
.period-caption,
.section-description {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 10px;
  line-height: 1.35;
}

.since-charge-battery {
  display: grid;
  min-width: 58px;
  height: 34px;
  place-items: center;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 12px;
  font-weight: 720;
}

.since-charge-metrics {
  display: grid;
  margin-top: 17px;
  padding: 13px 0;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.since-charge-metrics > div {
  min-width: 0;
  padding: 0 8px;
  border-right: 1px solid var(--line);
  text-align: center;
}

.since-charge-metrics > div:first-child {
  padding-left: 0;
}

.since-charge-metrics > div:last-child {
  padding-right: 0;
  border-right: 0;
}

.since-charge-metrics span,
.detail-grid span,
.charge-efficiency-stats span,
.charge-energy-flow span {
  display: block;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 7px;
  font-weight: 680;
  letter-spacing: 0.035em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.since-charge-metrics strong {
  display: block;
  margin-top: 7px;
  overflow: hidden;
  font-size: 11px;
  font-weight: 680;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.since-charge-details {
  margin: 9px -6px -8px;
}

.since-charge-details > summary {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 680;
  list-style: none;
}

.since-charge-details > summary::-webkit-details-marker,
.activity-row-summary::-webkit-details-marker {
  display: none;
}

.since-charge-details > summary svg {
  width: 16px;
  height: 16px;
  transition: transform 220ms ease;
}

.since-charge-details[open] > summary svg {
  transform: rotate(180deg);
}

.since-charge-trips {
  overflow: hidden;
  margin: 2px 6px 5px;
  border: 1px solid var(--line);
  border-radius: 15px;
}

.since-charge-trip {
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.since-charge-trip:last-child {
  border-bottom: 0;
}

.since-charge-route {
  display: grid;
  align-items: center;
  gap: 7px;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
}

.since-charge-route strong {
  overflow: hidden;
  font-size: 10px;
  font-weight: 620;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.since-charge-route strong:last-child {
  text-align: right;
}

.since-charge-route span {
  color: var(--text-muted);
}

.since-charge-route svg {
  width: 12px;
  height: 12px;
}

.since-charge-trip-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 8px;
}

.since-charge-empty,
.chart-empty,
.chart-loading {
  display: grid;
  min-height: 105px;
  place-items: center;
  color: var(--text-muted);
  font-size: 11px;
}

/* Native grouped summary list */
.metrics-grid {
  display: block;
  overflow: hidden;
  margin: 14px 12px 0;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
}

.metrics-section-heading {
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
}

.metrics-count {
  flex: 0 0 auto;
  color: var(--text-muted);
  font-size: 9px;
}

.metric-card {
  position: relative;
  display: grid;
  min-height: 64px;
  align-items: center;
  gap: 11px;
  padding: 9px 1px;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  border-bottom: 1px solid var(--line);
}

.metric-card:last-child {
  border-bottom: 0;
}

.metric-card::after {
  position: absolute;
  inset: 6px -8px;
  z-index: 0;
  border-radius: 13px;
  background: transparent;
  content: "";
  transition: background 150ms ease;
}

.metric-card:active::after {
  background: rgba(255, 255, 255, 0.035);
}

.metric-card > * {
  position: relative;
  z-index: 1;
}

.metric-icon {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 11px;
  background: var(--blue-soft);
  color: var(--blue);
}

.metric-card:nth-of-type(3n + 1) .metric-icon {
  background: var(--mint-soft);
  color: var(--mint);
}

.metric-icon svg {
  width: 16px;
  height: 16px;
  stroke-width: 1.7;
}

.metric-label {
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-value {
  margin-top: 2px;
  overflow: hidden;
  color: var(--text);
  font-size: 15px;
  font-weight: 690;
  letter-spacing: -0.025em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-card > .metric-label {
  grid-column: 2;
}

.metric-card > .metric-value {
  margin-top: 0;
  grid-column: 3;
  text-align: right;
}

.metric-card-wide > div:not(.metric-icon) {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  grid-column: 2 / 4;
}

.metric-card-wide > div:not(.metric-icon) .metric-value {
  margin-top: 0;
  text-align: right;
}

.metric-unit {
  color: var(--text-muted);
  font-size: 0.7em;
  font-weight: 580;
  letter-spacing: 0;
}

.metric-caption {
  display: none;
}

.metric-card-last-seen .metric-value {
  font-size: 13px;
}

/* Activity */
.activity-section,
.recent-section {
  min-height: calc(100svh - 80px);
  padding: 22px 12px 28px;
}

.section-heading,
.list-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 0 4px;
}

.period-control,
.chart-control {
  display: flex;
  align-items: center;
  padding: 3px;
  border-radius: 11px;
  background: var(--surface);
}

.period-control {
  max-width: 62%;
  overflow-x: auto;
  scrollbar-width: none;
}

.period-control::-webkit-scrollbar,
.activity-chart::-webkit-scrollbar {
  display: none;
}

.period-control button,
.chart-control button {
  min-height: 31px;
  padding: 0 9px;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 650;
  white-space: nowrap;
  transition: background 170ms ease, color 170ms ease, transform 150ms ease;
}

.period-control button:active,
.chart-control button:active {
  transform: scale(0.95);
}

.period-control button.active,
.chart-control button.active {
  background: var(--blue-soft);
  color: var(--blue);
}

.activity-km {
  margin: 30px 5px 0;
}

.activity-km > span {
  display: block;
  font-size: clamp(58px, 19vw, 78px);
  font-weight: 570;
  letter-spacing: -0.08em;
  line-height: 0.86;
}

.activity-km small {
  display: block;
  margin-top: 10px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 620;
}

.activity-metrics {
  display: grid;
  overflow: hidden;
  margin-top: 25px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 21px;
  background: var(--surface);
}

.activity-metric {
  min-width: 0;
  min-height: 68px;
  padding: 13px 14px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.activity-metric:nth-child(2n) {
  border-right: 0;
}

.activity-metric:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.activity-metric span {
  display: block;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 8px;
  font-weight: 660;
  letter-spacing: 0.035em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.activity-metric strong {
  display: block;
  margin-top: 8px;
  overflow: hidden;
  font-size: 14px;
  font-weight: 670;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-panel {
  margin-top: 13px;
  padding: 17px 11px 8px;
  border: 1px solid var(--line);
  border-radius: 21px;
  background: var(--surface);
}

.chart-toolbar {
  display: flex;
  min-height: 38px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 6px 9px;
}

.chart-toolbar h3 {
  font-size: 14px;
  font-weight: 660;
}

.activity-chart {
  position: relative;
  min-height: 240px;
  overflow-x: auto;
  scrollbar-width: none;
}

.activity-chart svg {
  width: 100%;
  min-width: 520px;
  height: auto;
}

.chart-unit {
  position: absolute;
  z-index: 2;
  top: 3px;
  left: 5px;
  color: var(--text-muted);
  font-size: 8px;
  font-weight: 650;
}

.chart-grid-line {
  stroke: rgba(255, 255, 255, 0.065);
  stroke-width: 1;
}

.chart-axis-label {
  fill: var(--text-muted);
  font-family: inherit;
  font-size: 8px;
}

.distance-bar {
  fill: var(--blue);
}

.consumption-bar {
  fill: var(--mint);
}

.chart-entering .distance-bar,
.chart-entering .consumption-bar {
  animation: bar-grow 480ms cubic-bezier(0.2, 0.75, 0.1, 1) both;
  animation-delay: calc(var(--bar-index, 0) * 18ms);
  transform-box: fill-box;
  transform-origin: bottom;
}

/* Native history lists */
.list-heading {
  margin: 0 2px 18px;
}

.list-heading .section-description {
  max-width: 300px;
}

.list-heading-icon {
  display: grid;
  width: 39px;
  height: 39px;
  flex: 0 0 39px;
  place-items: center;
  border-radius: 13px;
  background: var(--blue-soft);
  color: var(--blue);
}

.list-heading-icon svg {
  width: 18px;
  height: 18px;
}

.trip-list,
.charge-list {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 21px;
  background: var(--surface);
}

.trip-item,
.charge-item {
  border-bottom: 1px solid var(--line);
}

.trip-item:last-child,
.charge-item:last-child {
  border-bottom: 0;
}

.trip-item[open],
.charge-item[open] {
  background: rgba(255, 255, 255, 0.024);
}

.activity-row-summary {
  display: grid;
  min-height: 74px;
  align-items: center;
  gap: 5px 9px;
  padding: 11px 12px 11px 14px;
  grid-template-columns: minmax(0, 1fr) auto 17px;
  list-style: none;
}

.trip-route {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 5px;
}

.trip-route > span:not(.route-arrow) {
  overflow: hidden;
  font-size: 11px;
  font-weight: 620;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.route-arrow {
  flex: 0 0 auto;
  color: var(--text-muted);
}

.route-arrow svg {
  width: 11px;
  height: 11px;
}

.row-value-stack {
  display: flex;
  align-items: flex-end;
  flex-direction: column;
  gap: 4px;
}

.row-primary-value {
  overflow: hidden;
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-secondary-value {
  overflow: hidden;
  max-width: 100%;
  color: var(--text-muted);
  font-size: 8px;
  grid-column: 1 / 3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-chevron {
  display: grid;
  color: var(--text-muted);
  grid-column: 3;
  grid-row: 1 / 3;
  place-items: center;
}

.row-chevron svg {
  width: 15px;
  height: 15px;
  transition: transform 220ms ease;
}

details[open] > .activity-row-summary .row-chevron svg {
  transform: rotate(180deg);
}

.trip-score {
  padding: 2px 6px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  font-size: 7px;
  font-weight: 750;
}

.trip-score.excellent,
.trip-score.good {
  background: rgba(102, 223, 145, 0.1);
  color: var(--green);
}

.trip-score.fair {
  background: rgba(248, 196, 96, 0.1);
  color: var(--yellow);
}

.trip-score.rough {
  background: rgba(255, 102, 115, 0.1);
  color: var(--red);
}

.activity-row-body {
  padding: 0 12px 14px;
  transform-origin: top;
  animation: disclosure-open 230ms ease both;
}

.trip-map {
  height: 170px;
  overflow: hidden;
  border-radius: 14px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    #090c10;
  background-size: 26px 26px;
}

.trip-map-empty {
  display: grid;
  place-items: center;
}

.trip-map-empty::after {
  color: var(--text-muted);
  font-size: 10px;
  content: "Sin trazado GPS";
}

.trip-map-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 3px 9px;
  color: var(--text-muted);
  font-size: 7px;
}

.detail-grid {
  display: grid;
  overflow: hidden;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 14px;
}

.detail-grid > div {
  min-width: 0;
  min-height: 63px;
  padding: 11px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.detail-grid > div:nth-child(2n) {
  border-right: 0;
}

.detail-grid > div:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.detail-grid > div:last-child:nth-child(odd) {
  border-right: 0;
  grid-column: span 2;
}

.detail-grid strong {
  display: block;
  margin-top: 7px;
  overflow: hidden;
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.charge-location {
  overflow: hidden;
  font-size: 11px;
  font-weight: 630;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recovered-charge {
  box-shadow: inset 2px 0 var(--yellow);
}

.charge-list-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 23px 4px 9px;
}

.charge-list-heading strong {
  font-size: 13px;
  font-weight: 660;
}

.charge-list-heading span {
  color: var(--text-muted);
  font-size: 9px;
}

/* Charging balance */
.charge-efficiency-card {
  overflow: hidden;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
}

.charge-efficiency-hero {
  display: flex;
  align-items: center;
  gap: 16px;
}

.charge-efficiency-ring {
  position: relative;
  display: grid;
  width: 88px;
  height: 88px;
  flex: 0 0 88px;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle, var(--surface) 58%, transparent 59%),
    conic-gradient(var(--blue) calc(var(--efficiency, 0) * 1%), rgba(255, 255, 255, 0.07) 0);
  transition: background 500ms ease;
}

.charge-efficiency-ring::after {
  position: absolute;
  inset: 10px;
  border: 1px solid var(--line);
  border-radius: inherit;
  content: "";
}

.charge-efficiency-ring > div {
  position: relative;
  z-index: 2;
  text-align: center;
}

.charge-efficiency-ring strong,
.charge-efficiency-ring small {
  display: block;
}

.charge-efficiency-ring strong {
  font-size: 17px;
  font-weight: 720;
}

.charge-efficiency-ring small {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 7px;
}

.charge-efficiency-copy {
  min-width: 0;
}

.charge-efficiency-copy h3 {
  margin-top: 5px;
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -0.04em;
}

.charge-efficiency-copy p {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 9px;
  line-height: 1.4;
}

.charge-energy-flow {
  display: grid;
  align-items: center;
  margin-top: 17px;
  padding: 13px;
  gap: 9px;
  grid-template-columns: 1fr auto 1fr;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
}

.charge-energy-flow > div:last-child {
  text-align: right;
}

.charge-energy-flow strong {
  display: block;
  margin-top: 6px;
  font-size: 13px;
  font-weight: 680;
}

.charge-flow-arrow {
  color: var(--blue);
}

.charge-flow-arrow svg {
  width: 17px;
  height: 17px;
}

.charge-efficiency-stats {
  display: grid;
  margin-top: 13px;
  padding-top: 13px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line);
}

.charge-efficiency-stats > div {
  min-width: 0;
  padding: 0 9px;
  border-right: 1px solid var(--line);
}

.charge-efficiency-stats > div:first-child {
  padding-left: 0;
}

.charge-efficiency-stats > div:last-child {
  padding-right: 0;
  border-right: 0;
}

.charge-efficiency-stats strong {
  display: block;
  margin-top: 7px;
  overflow: hidden;
  font-size: 11px;
  font-weight: 670;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Maps */
.route-fallback {
  width: 100%;
  height: 100%;
}

.route-grid {
  fill: none;
  stroke: rgba(255, 255, 255, 0.045);
  stroke-width: 1;
}

.route-line {
  fill: none;
  stroke: var(--blue);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4;
}

.route-start {
  fill: var(--mint);
  stroke: #fff;
  stroke-width: 2;
}

.route-end {
  fill: var(--red);
  stroke: #fff;
  stroke-width: 2;
}

.leaflet-container {
  background: #090c10;
  font-family: inherit;
}

.leaflet-tile-pane {
  filter: grayscale(0.78) brightness(0.54) contrast(1.13);
}

/* Loading and error states */
.loading {
  display: flex;
  min-height: calc(100svh - 170px);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 14px;
  color: var(--text-muted);
  font-size: 11px;
}

.loading-car {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border-radius: 18px;
  background: var(--blue-soft);
  color: var(--blue);
  animation: loading-breathe 1.7s ease-in-out infinite;
}

.loading-car svg {
  width: 25px;
  height: 25px;
}

.loading-track {
  width: 116px;
  height: 3px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--surface-raised);
}

.loading-track span {
  display: block;
  width: 44%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--mint));
  animation: loading-track 1.2s ease-in-out infinite;
}

.error {
  display: grid;
  min-height: calc(100svh - 170px);
  place-content: center;
  padding: 28px;
  text-align: center;
}

.error p {
  color: var(--text-secondary);
  font-size: 13px;
}

.error button {
  min-width: 126px;
  min-height: 43px;
  margin-top: 14px;
  border-radius: 13px;
  background: var(--blue);
  color: #07101f;
  font-size: 12px;
  font-weight: 750;
}

/* Native fixed tab bar */
.bottom-nav {
  position: fixed;
  z-index: 1200;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  height: calc(var(--tab-h) + var(--safe-bottom));
  padding: 7px 8px calc(7px + var(--safe-bottom));
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border-top: 1px solid var(--line-strong);
  background: rgba(7, 9, 12, 0.9);
  backdrop-filter: saturate(160%) blur(26px);
  -webkit-backdrop-filter: saturate(160%) blur(26px);
  box-shadow: 0 -18px 42px rgba(0, 0, 0, 0.24);
}

.nav-item {
  display: flex;
  min-width: 0;
  min-height: 57px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 3px;
  border-radius: 14px;
  color: var(--text-muted);
  transition: color 170ms ease, transform 150ms ease;
}

.nav-item:active {
  transform: scale(0.93);
}

.nav-icon {
  position: relative;
  display: grid;
  width: 36px;
  height: 29px;
  place-items: center;
  border-radius: 12px;
  transition: background 180ms ease, color 180ms ease;
}

.nav-icon svg {
  width: 19px;
  height: 19px;
  stroke-width: 1.8;
}

.nav-label {
  overflow: hidden;
  max-width: 100%;
  font-size: 8px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-item.active {
  color: var(--blue);
}

.nav-item.active .nav-icon {
  background: var(--blue-soft);
  animation: tab-pop 300ms cubic-bezier(0.2, 0.8, 0.15, 1);
}

.nav-item.active .nav-icon::after {
  position: absolute;
  top: 3px;
  right: 4px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 7px var(--mint);
  content: "";
}

/* Dynamic value animation */
.value-updated {
  animation: value-pop 390ms cubic-bezier(0.2, 0.8, 0.15, 1) both;
  animation-delay: calc(var(--value-index, 0) * 22ms);
}

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}

summary:focus-visible {
  outline-offset: -2px;
}

.nav-item:focus-visible,
.quick-action:focus-visible {
  outline: 0;
}

.nav-item:focus-visible .nav-icon,
.quick-action:focus-visible .quick-action-icon {
  box-shadow: 0 0 0 2px var(--blue);
}

@keyframes view-fade {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes view-forward {
  from {
    opacity: 0;
    transform: translateX(24px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes view-backward {
  from {
    opacity: 0;
    transform: translateX(-24px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes car-arrive {
  from {
    opacity: 0;
    transform: translateX(-43%) scale(0.94);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) scale(1);
  }
}

@keyframes car-float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}

@keyframes floor-breathe {
  0%,
  100% {
    opacity: 0.72;
    transform: scaleX(1);
  }
  50% {
    opacity: 0.46;
    transform: scaleX(0.94);
  }
}

@keyframes orbit-breathe {
  0%,
  100% {
    opacity: 0.46;
    transform: translate(-50%, -50%) rotate(-7deg) scale(0.96);
  }
  50% {
    opacity: 0.9;
    transform: translate(-50%, -50%) rotate(-3deg) scale(1.04);
  }
}

@keyframes ambient-drift {
  to {
    transform: translate(-46px, 52px) rotate(18deg);
  }
}

@keyframes live-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(102, 223, 145, 0.28);
  }
  72%,
  100% {
    box-shadow: 0 0 0 7px rgba(102, 223, 145, 0);
  }
}

@keyframes sync-pulse {
  to {
    opacity: 0.3;
    transform: scale(0.75);
  }
}

@keyframes energy-sweep {
  0%,
  38% {
    transform: translateX(-105%);
  }
  72%,
  100% {
    transform: translateX(120%);
  }
}

@keyframes bar-grow {
  from {
    opacity: 0;
    transform: scaleY(0);
  }
  to {
    opacity: 1;
    transform: scaleY(1);
  }
}

@keyframes disclosure-open {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes tab-pop {
  0% {
    transform: scale(0.82);
  }
  70% {
    transform: scale(1.08);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes quick-action-enter {
  from {
    opacity: 0;
    transform: translateY(9px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes value-pop {
  from {
    opacity: 0.35;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes loading-breathe {
  50% {
    box-shadow: 0 0 0 9px rgba(125, 162, 255, 0.055);
    transform: scale(1.03);
  }
}

@keyframes loading-track {
  from {
    transform: translateX(-110%);
  }
  to {
    transform: translateX(280%);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Compact phones */
@media (max-width: 370px) {
  :root {
    --page: 12px;
  }

  .connection-pill {
    width: 31px;
    padding: 0;
    justify-content: center;
    font-size: 0;
  }

  .status-card {
    height: 338px;
    margin-right: 8px;
    margin-left: 8px;
    padding-right: 15px;
    padding-left: 15px;
  }

  .vehicle-copy p {
    max-width: 185px;
  }

  .vehicle-stage {
    margin-right: -15px;
    margin-left: -15px;
  }

  .vehicle-image {
    top: -47px;
    width: 151vw;
  }

  .vehicle-insights > div {
    padding-right: 8px;
    padding-left: 8px;
  }

  .vehicle-footer > span:last-child {
    display: none;
  }

  .battery-consumption {
    min-width: 116px;
    padding-left: 12px;
  }

  .battery-consumption .value {
    font-size: 13px;
  }

  .since-charge-section,
  .metrics-grid {
    margin-right: 8px;
    margin-left: 8px;
  }
}

/* Larger mobile/tablet app canvas */
@media (min-width: 620px) {
  :root {
    --page: 22px;
  }

  .status-card {
    height: 420px;
    margin: 14px 18px 0;
    padding: 25px 25px 18px;
  }

  .vehicle-copy h2 {
    font-size: 32px;
  }

  .vehicle-stage {
    height: 245px;
    margin-right: -25px;
    margin-left: -25px;
  }

  .vehicle-image {
    top: -71px;
    width: 640px;
  }

  .vehicle-orbit-one {
    width: 480px;
    height: 150px;
  }

  .vehicle-orbit-two {
    width: 370px;
    height: 116px;
  }

  .vehicle-insights {
    right: 20px;
    bottom: 42px;
    left: 20px;
  }

  .vehicle-footer {
    right: 25px;
    left: 25px;
  }

  .battery-card {
    margin-right: 24px;
    margin-left: 24px;
  }

  .quick-actions {
    margin-right: 18px;
    margin-left: 18px;
  }

  .since-charge-section,
  .metrics-grid {
    margin-right: 18px;
    margin-left: 18px;
  }

  .activity-metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .activity-metric:nth-child(2n) {
    border-right: 1px solid var(--line);
  }

  .activity-metric:nth-child(4n) {
    border-right: 0;
  }

  .activity-metric:nth-last-child(-n + 4) {
    border-bottom: 0;
  }

  .detail-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .detail-grid > div,
  .detail-grid > div:nth-child(2n) {
    border-right: 1px solid var(--line);
  }

  .detail-grid > div:nth-child(3n) {
    border-right: 0;
  }

  .detail-grid > div:nth-last-child(-n + 3) {
    border-bottom: 0;
  }

  .detail-grid > div:last-child:nth-child(odd) {
    border-right: 0;
    grid-column: auto;
  }
}

@media (min-width: 720px) {
  body {
    background:
      radial-gradient(circle at 50% 0%, rgba(74, 101, 164, 0.14), transparent 38%),
      var(--bg-deep);
  }

  .app-shell {
    max-width: 680px;
    border-right: 1px solid rgba(255, 255, 255, 0.04);
    border-left: 1px solid rgba(255, 255, 255, 0.04);
    box-shadow: 0 0 90px rgba(0, 0, 0, 0.56);
  }

  .bottom-nav {
    right: 50%;
    left: auto;
    width: 680px;
    transform: translateX(50%);
  }
}

/* Aurora cockpit — high-impact native polish */
@property --battery-level {
  syntax: "<number>";
  inherits: true;
  initial-value: 0;
}

body {
  background:
    radial-gradient(circle at 14% 8%, rgba(124, 58, 237, 0.17), transparent 30%),
    radial-gradient(circle at 92% 32%, rgba(34, 211, 238, 0.09), transparent 28%),
    linear-gradient(180deg, #090713 0%, var(--bg) 42%, #05040a 100%);
}

.app-shell {
  position: relative;
  background: transparent;
  isolation: isolate;
}

.ambient-scene {
  position: fixed;
  z-index: -2;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.ambient-orb {
  position: absolute;
  display: block;
  border-radius: 50%;
  filter: blur(64px);
  opacity: 0.2;
  will-change: transform;
}

.ambient-orb-violet {
  top: calc(-110px - (var(--scroll-shift) * 0.18));
  left: -100px;
  width: 280px;
  height: 280px;
  background: #7c3aed;
  animation: aurora-violet 12s ease-in-out infinite alternate;
}

.ambient-orb-cyan {
  top: calc(260px - (var(--scroll-shift) * 0.1));
  right: -130px;
  width: 250px;
  height: 250px;
  background: #0891b2;
  animation: aurora-cyan 14s 1s ease-in-out infinite alternate;
}

.ambient-orb-coral {
  top: 70vh;
  left: -90px;
  width: 190px;
  height: 190px;
  background: #e11d48;
  opacity: 0.11;
  animation: aurora-coral 16s 2s ease-in-out infinite alternate;
}

.ambient-grain {
  position: absolute;
  inset: -50%;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.38'/%3E%3C/svg%3E");
  opacity: 0.018;
  transform: rotate(8deg);
}

.header {
  padding: calc(9px + var(--safe-top)) 14px 8px;
  border-bottom-color: transparent;
  background: linear-gradient(180deg, rgba(7, 6, 15, 0.94), rgba(7, 6, 15, 0.62) 72%, transparent);
  backdrop-filter: saturate(135%) blur(12px);
  -webkit-backdrop-filter: saturate(135%) blur(12px);
}

body.is-scrolled .header {
  border-bottom-color: var(--line);
  background: rgba(9, 7, 19, 0.84);
  box-shadow: 0 14px 34px rgba(2, 1, 8, 0.35);
  backdrop-filter: saturate(165%) blur(26px);
  -webkit-backdrop-filter: saturate(165%) blur(26px);
}

.header-top {
  min-height: 47px;
}

.brand-lockup {
  gap: 11px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  flex-basis: 40px;
  overflow: hidden;
  border-radius: 14px;
  background:
    radial-gradient(circle at 72% 20%, rgba(255, 255, 255, 0.35), transparent 22%),
    linear-gradient(145deg, #a78bfa, #6d28d9 55%, #312e81);
  color: white;
  box-shadow: 0 10px 28px rgba(109, 40, 217, 0.36), inset 0 1px rgba(255, 255, 255, 0.3);
  transform: rotate(-2deg);
}

.brand-mark::after {
  border-color: rgba(255, 255, 255, 0.18);
}

.brand-mark svg {
  width: 20px;
  height: 20px;
  stroke-width: 2;
}

.brand-overline {
  display: block;
  margin-bottom: 4px;
  color: var(--blue);
  font-size: 7px;
  font-weight: 800;
  letter-spacing: 0.18em;
  line-height: 1;
  text-transform: uppercase;
}

.header h1 {
  font-size: 20px;
  font-weight: 720;
}

.connection-pill {
  min-height: 33px;
  border: 1px solid rgba(255, 255, 255, 0.055);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.035));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.04);
}

.header-icon-button {
  width: 38px;
  height: 38px;
  flex-basis: 38px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.035));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.04);
}

.header-icon-button:active {
  background: var(--blue-soft);
  color: var(--blue);
}

.app-status {
  padding-top: 4px;
}

.live-indicator {
  background: var(--mint);
  box-shadow: 0 0 5px var(--mint), 0 0 14px rgba(34, 211, 238, 0.62);
}

.main-content {
  padding-bottom: 20px;
}

.app-view-section.is-entering {
  animation-duration: 540ms;
  animation-timing-function: cubic-bezier(0.16, 0.9, 0.24, 1);
  animation-delay: calc(var(--enter-index, 0) * 65ms);
}

.status-card {
  height: 370px;
  margin: 8px 11px 0;
  padding: 20px 18px 15px;
  border-color: rgba(199, 181, 255, 0.16);
  border-radius: 32px;
  background:
    radial-gradient(circle at 82% 24%, rgba(34, 211, 238, 0.22), transparent 27%),
    radial-gradient(circle at 14% 82%, rgba(251, 113, 133, 0.16), transparent 30%),
    linear-gradient(145deg, #261445 0%, #111633 48%, #071821 100%);
  box-shadow:
    0 26px 70px rgba(2, 1, 10, 0.52),
    0 8px 34px rgba(76, 29, 149, 0.2),
    inset 0 1px rgba(255, 255, 255, 0.09);
}

.status-card::before {
  z-index: 0;
  top: -190px;
  left: -80px;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  background: conic-gradient(
    from 40deg,
    transparent,
    rgba(167, 139, 250, 0.16),
    transparent 26%,
    rgba(34, 211, 238, 0.1),
    transparent 54%,
    rgba(251, 113, 133, 0.11),
    transparent 78%
  );
  filter: blur(1px);
  animation: hero-aura-spin 18s linear infinite;
}

.status-card::after {
  z-index: 8;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.13), transparent 15%, transparent 77%, rgba(34, 211, 238, 0.08)),
    linear-gradient(180deg, transparent 65%, rgba(3, 3, 10, 0.28));
  opacity: 0.72;
}

.vehicle-heading {
  z-index: 9;
}

.section-eyebrow {
  color: rgba(210, 198, 255, 0.68);
  font-size: 8px;
  letter-spacing: 0.16em;
}

.vehicle-copy h2 {
  margin-top: 6px;
  font-size: 31px;
  font-weight: 720;
  letter-spacing: -0.065em;
}

.vehicle-copy p {
  color: rgba(226, 221, 244, 0.67);
}

.status-badge {
  min-height: 32px;
  border: 1px solid rgba(34, 211, 238, 0.18);
  background: rgba(8, 29, 36, 0.52);
  color: #67e8f9;
  box-shadow: 0 8px 24px rgba(2, 8, 18, 0.28), inset 0 1px rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
}

.status-dot {
  animation: status-beacon 2.4s ease-out infinite;
}

.vehicle-stage {
  height: 204px;
  margin: 0 -18px;
}

.vehicle-scan {
  position: absolute;
  z-index: 2;
  top: 15px;
  bottom: 22px;
  left: -34%;
  width: 32%;
  background: linear-gradient(100deg, transparent, rgba(103, 232, 249, 0.2), transparent);
  filter: blur(5px);
  transform: skewX(-16deg);
  animation: vehicle-scan 5.6s 1.4s ease-in-out infinite;
  pointer-events: none;
}

.vehicle-road-grid {
  position: absolute;
  z-index: 0;
  right: -12%;
  bottom: -25px;
  left: -12%;
  height: 100px;
  opacity: 0.18;
  background-image:
    linear-gradient(rgba(167, 139, 250, 0.35) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34, 211, 238, 0.28) 1px, transparent 1px);
  background-size: 24px 18px;
  -webkit-mask-image: linear-gradient(to bottom, transparent, black 30%, transparent 92%);
  mask-image: linear-gradient(to bottom, transparent, black 30%, transparent 92%);
  transform: perspective(150px) rotateX(58deg) scaleX(1.25);
  transform-origin: bottom;
  animation: road-grid-flow 3.8s linear infinite;
}

.vehicle-orbit {
  top: 46%;
  border-color: rgba(196, 181, 253, 0.2);
  box-shadow: 0 0 22px rgba(124, 58, 237, 0.08);
}

.vehicle-orbit-one {
  width: 368px;
  height: 119px;
  animation: orbit-violet 7s ease-in-out infinite;
}

.vehicle-orbit-two {
  width: 284px;
  height: 88px;
  border-color: rgba(34, 211, 238, 0.16);
  animation: orbit-cyan 6s 0.8s ease-in-out infinite;
}

.vehicle-image {
  top: -58px;
  width: min(565px, 151vw);
  animation: car-arrive 920ms cubic-bezier(0.16, 0.92, 0.2, 1) both;
}

.vehicle-image img {
  animation: car-float 4.2s 900ms ease-in-out infinite;
  filter:
    drop-shadow(0 22px 16px rgba(0, 0, 0, 0.48))
    drop-shadow(0 0 18px rgba(167, 139, 250, 0.1));
}

.vehicle-floor {
  right: 9%;
  bottom: 18px;
  left: 9%;
  height: 25px;
  background:
    radial-gradient(ellipse, rgba(2, 3, 10, 0.9), transparent 66%),
    linear-gradient(90deg, transparent, rgba(34, 211, 238, 0.12), transparent);
}

.vehicle-insights {
  z-index: 9;
  right: 13px;
  bottom: 42px;
  left: 13px;
  min-height: 62px;
  padding: 8px 0;
  border-color: rgba(231, 225, 255, 0.13);
  border-radius: 19px;
  background: linear-gradient(135deg, rgba(10, 8, 24, 0.64), rgba(7, 18, 28, 0.56));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.055), 0 14px 28px rgba(1, 1, 8, 0.22);
}

.vehicle-insights span {
  color: rgba(181, 174, 201, 0.72);
}

.vehicle-insights strong {
  font-size: 14px;
  color: #fff;
}

.vehicle-insights > div:nth-child(1) strong {
  color: #c4b5fd;
}

.vehicle-insights > div:nth-child(2) strong {
  color: #67e8f9;
}

.vehicle-insights > div:nth-child(3) strong {
  color: #fda4af;
}

.vehicle-footer {
  z-index: 9;
  bottom: 15px;
  color: rgba(200, 194, 219, 0.62);
}

body[data-vehicle-state="charging"] .status-card {
  background:
    radial-gradient(circle at 80% 22%, rgba(52, 211, 153, 0.25), transparent 28%),
    radial-gradient(circle at 13% 82%, rgba(34, 211, 238, 0.17), transparent 31%),
    linear-gradient(145deg, #12382f 0%, #0d2029 50%, #07141d 100%);
}

body[data-vehicle-state="driving"] .status-card {
  background:
    radial-gradient(circle at 82% 22%, rgba(251, 113, 133, 0.24), transparent 27%),
    radial-gradient(circle at 12% 82%, rgba(167, 139, 250, 0.21), transparent 31%),
    linear-gradient(145deg, #38162e 0%, #20132f 48%, #0e1427 100%);
}

.quick-actions {
  margin: 11px 11px 0;
  padding: 9px 7px 8px;
  gap: 3px;
  border: 1px solid rgba(231, 225, 255, 0.08);
  border-radius: 25px;
  background: linear-gradient(180deg, rgba(25, 21, 42, 0.76), rgba(12, 11, 22, 0.7));
  box-shadow: 0 16px 36px rgba(2, 1, 8, 0.22), inset 0 1px rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
}

.quick-action {
  position: relative;
  min-height: 72px;
  overflow: hidden;
  border-radius: 19px;
  background: transparent;
  color: #aaa3bd;
  font-size: 8px;
}

.quick-action::after {
  position: absolute;
  top: -22px;
  left: -48px;
  width: 35px;
  height: 120px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
  content: "";
  transform: rotate(22deg);
}

.quick-action:active {
  background: rgba(255, 255, 255, 0.045);
  color: white;
}

.quick-action:active::after {
  animation: action-glint 420ms ease-out;
}

.quick-action-icon {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(196, 181, 253, 0.13);
  border-radius: 15px;
  background: linear-gradient(145deg, rgba(167, 139, 250, 0.28), rgba(76, 29, 149, 0.22));
  color: #c4b5fd;
  box-shadow: 0 8px 22px rgba(76, 29, 149, 0.16), inset 0 1px rgba(255, 255, 255, 0.1);
}

.quick-action:nth-child(2) .quick-action-icon {
  border-color: rgba(34, 211, 238, 0.13);
  background: linear-gradient(145deg, rgba(34, 211, 238, 0.24), rgba(8, 145, 178, 0.17));
  color: #67e8f9;
  box-shadow: 0 8px 22px rgba(8, 145, 178, 0.12), inset 0 1px rgba(255, 255, 255, 0.1);
}

.quick-action:nth-child(3) .quick-action-icon {
  border-color: rgba(251, 113, 133, 0.13);
  background: linear-gradient(145deg, rgba(251, 113, 133, 0.25), rgba(190, 24, 93, 0.16));
  color: #fda4af;
  box-shadow: 0 8px 22px rgba(190, 24, 93, 0.12), inset 0 1px rgba(255, 255, 255, 0.1);
}

.quick-action:nth-child(4) .quick-action-icon {
  border-color: rgba(251, 191, 36, 0.13);
  background: linear-gradient(145deg, rgba(251, 191, 36, 0.23), rgba(217, 119, 6, 0.15));
  color: #fde68a;
  box-shadow: 0 8px 22px rgba(217, 119, 6, 0.11), inset 0 1px rgba(255, 255, 255, 0.1);
}

.battery-card {
  overflow: hidden;
  margin: 14px 11px 0;
  padding: 19px 17px 17px;
  border: 1px solid rgba(231, 225, 255, 0.11);
  border-radius: 30px;
  background:
    radial-gradient(circle at 18% 35%, rgba(124, 58, 237, 0.17), transparent 34%),
    radial-gradient(circle at 93% 80%, rgba(34, 211, 238, 0.1), transparent 30%),
    linear-gradient(145deg, rgba(25, 21, 43, 0.92), rgba(10, 13, 25, 0.94));
  box-shadow: 0 22px 52px rgba(2, 1, 8, 0.34), inset 0 1px rgba(255, 255, 255, 0.055);
}

.battery-card::after {
  position: absolute;
  top: -75px;
  right: -50px;
  width: 180px;
  height: 180px;
  border: 1px solid rgba(34, 211, 238, 0.08);
  border-radius: 50%;
  box-shadow: 0 0 0 28px rgba(34, 211, 238, 0.022), 0 0 0 58px rgba(167, 139, 250, 0.018);
  content: "";
  pointer-events: none;
}

.battery-header {
  position: relative;
  z-index: 1;
  display: grid;
  align-items: center;
  gap: 14px;
  grid-template-columns: 142px minmax(0, 1fr);
}

.battery-main {
  display: flex;
  align-items: center;
  flex-direction: column;
}

.battery-kicker {
  align-self: flex-start;
  color: #c4b5fd;
}

.battery-orb {
  --battery-level: 0;
  position: relative;
  display: grid;
  width: 132px;
  height: 132px;
  margin-top: 12px;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, rgba(11, 10, 22, 0.94) 56%, transparent 58%),
    conic-gradient(
      from -90deg,
      #a78bfa 0%,
      #22d3ee calc(var(--battery-level) * 1%),
      rgba(255, 255, 255, 0.08) calc(var(--battery-level) * 1%),
      rgba(255, 255, 255, 0.08) 100%
    );
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.055),
    0 18px 34px rgba(1, 1, 8, 0.34),
    inset 0 0 26px rgba(167, 139, 250, 0.08);
  transition: --battery-level 1.15s cubic-bezier(0.16, 0.9, 0.22, 1);
  animation: battery-orb-in 800ms 180ms cubic-bezier(0.16, 0.9, 0.22, 1) both;
}

.battery-orb::before {
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: inherit;
  content: "";
}

.battery-orb-glow {
  position: absolute;
  inset: 13px;
  border-radius: 50%;
  box-shadow: 0 -14px 30px rgba(167, 139, 250, 0.18), 0 14px 32px rgba(34, 211, 238, 0.12);
  animation: battery-glow 3.6s ease-in-out infinite;
}

.battery-orb-core {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
}

.battery-reading {
  justify-content: center;
  margin-top: 0;
}

.battery-percent {
  font-size: 43px;
  font-weight: 680;
  letter-spacing: -0.08em;
}

.battery-percent-unit {
  margin-top: 2px;
  font-size: 15px;
}

.battery-orb-label {
  margin-top: 5px;
  color: var(--text-muted);
  font-size: 7px;
  font-weight: 760;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.battery-range {
  justify-content: center;
  margin-top: 10px;
}

.battery-consumption {
  min-width: 0;
  min-height: 152px;
  align-items: flex-start;
  justify-content: center;
  padding: 15px;
  border: 1px solid rgba(231, 225, 255, 0.08);
  border-radius: 22px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.025));
  text-align: left;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.04);
}

.battery-consumption .label {
  justify-content: flex-start;
  color: #a79fbd;
  line-height: 1.35;
}

.battery-consumption .value {
  margin-top: 13px;
  color: #fff;
  font-size: 17px;
  line-height: 1.18;
  text-align: left;
}

.consumption-note {
  margin-top: 9px;
  color: #7f7893;
  line-height: 1.35;
}

.battery-bar-wrap {
  position: relative;
  z-index: 1;
  margin-top: 17px;
}

.battery-bar {
  height: 8px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.34);
}

.battery-bar-fill {
  background: linear-gradient(90deg, #8b5cf6, #a78bfa 40%, #22d3ee 92%);
  box-shadow: 0 0 18px rgba(34, 211, 238, 0.28);
}

.since-charge-section {
  margin: 14px 11px 0;
  border-color: rgba(231, 225, 255, 0.1);
  border-radius: 28px;
  background:
    linear-gradient(145deg, rgba(24, 21, 39, 0.9), rgba(11, 10, 20, 0.92));
  box-shadow: 0 18px 42px rgba(2, 1, 8, 0.24), inset 0 1px rgba(255, 255, 255, 0.04);
}

.since-charge-battery {
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.2), rgba(34, 211, 238, 0.13));
  color: #c4b5fd;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.06);
}

.since-charge-details > summary {
  color: #c4b5fd;
}

.metrics-grid {
  display: grid;
  overflow: visible;
  margin: 14px 11px 0;
  padding: 0;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 0;
  border-radius: 0;
  background: transparent;
}

.metrics-section-heading {
  min-height: 70px;
  padding: 0 6px;
  grid-column: 1 / -1;
  border-bottom: 0;
}

.metrics-count {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
}

.metric-card {
  display: flex;
  min-height: 126px;
  align-items: flex-start;
  justify-content: flex-end;
  flex-direction: column;
  gap: 7px;
  padding: 14px;
  border: 1px solid rgba(231, 225, 255, 0.085);
  border-radius: 22px;
  background:
    radial-gradient(circle at 85% 12%, rgba(167, 139, 250, 0.08), transparent 28%),
    linear-gradient(145deg, rgba(24, 21, 39, 0.9), rgba(11, 10, 20, 0.94));
  box-shadow: 0 14px 34px rgba(2, 1, 8, 0.21), inset 0 1px rgba(255, 255, 255, 0.035);
}

.metric-card::after {
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(125deg, rgba(255, 255, 255, 0.07), transparent 24%);
}

.metric-card:active {
  transform: scale(0.975);
}

.metric-card-wide {
  min-height: 104px;
  align-items: center;
  justify-content: flex-start;
  flex-direction: row;
  grid-column: 1 / -1;
}

.metric-icon {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(167, 139, 250, 0.22), rgba(76, 29, 149, 0.14));
  color: #c4b5fd;
}

.metric-card:nth-of-type(3n + 1) .metric-icon {
  background: linear-gradient(145deg, rgba(34, 211, 238, 0.21), rgba(8, 145, 178, 0.13));
  color: #67e8f9;
}

.metric-card:nth-of-type(3n + 2) .metric-icon {
  background: linear-gradient(145deg, rgba(251, 113, 133, 0.2), rgba(190, 24, 93, 0.12));
  color: #fda4af;
}

.metric-label,
.metric-card > .metric-label {
  color: #888199;
}

.metric-value,
.metric-card > .metric-value {
  font-size: 22px;
  color: #fff;
}

.metric-card-wide > div:not(.metric-icon) .metric-value {
  font-size: 22px;
}

.metric-caption {
  margin-left: auto;
}

.activity-section,
.recent-section {
  background:
    radial-gradient(circle at 85% 5%, rgba(124, 58, 237, 0.09), transparent 22%),
    transparent;
}

.activity-metrics,
.chart-panel,
.charge-efficiency-card,
.trip-item,
.charge-item {
  border-color: rgba(231, 225, 255, 0.095);
  background: linear-gradient(145deg, rgba(24, 21, 39, 0.9), rgba(10, 10, 19, 0.94));
  box-shadow: 0 18px 42px rgba(2, 1, 8, 0.22), inset 0 1px rgba(255, 255, 255, 0.04);
}

.period-control,
.chart-control {
  background: rgba(7, 6, 15, 0.65);
}

.period-control button.active,
.chart-control button.active {
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.28), rgba(124, 58, 237, 0.2));
  color: #e9e2ff;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.08);
}

.charge-efficiency-ring {
  background:
    radial-gradient(circle at 50% 50%, var(--surface) 58%, transparent 60%),
    conic-gradient(#a78bfa, #22d3ee calc(var(--efficiency) * 1%), rgba(255, 255, 255, 0.07) 0);
  box-shadow: 0 0 34px rgba(124, 58, 237, 0.12);
}

.charge-flow-arrow {
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.2), rgba(34, 211, 238, 0.13));
  color: #c4b5fd;
}

.error {
  width: calc(100% - 34px);
  min-height: 250px;
  margin: 38px auto;
  padding: 30px 24px;
  border: 1px solid rgba(251, 113, 133, 0.12);
  border-radius: 30px;
  background:
    radial-gradient(circle at 50% 0%, rgba(251, 113, 133, 0.12), transparent 36%),
    linear-gradient(145deg, rgba(24, 18, 34, 0.92), rgba(10, 9, 18, 0.94));
  box-shadow: 0 22px 54px rgba(2, 1, 8, 0.28), inset 0 1px rgba(255, 255, 255, 0.04);
}

.error::before {
  display: block;
  margin-bottom: 12px;
  color: #fda4af;
  content: "CONEXIÓN";
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.error p {
  max-width: 260px;
  color: #c7c0d6;
  line-height: 1.45;
}

.error button {
  min-width: 164px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 15px;
  background: linear-gradient(135deg, #a78bfa, #7c3aed);
  color: white;
  box-shadow: 0 12px 28px rgba(109, 40, 217, 0.3), inset 0 1px rgba(255, 255, 255, 0.2);
}

.bottom-nav {
  right: 10px;
  bottom: calc(8px + var(--safe-bottom));
  left: 10px;
  width: auto;
  height: 72px;
  padding: 6px;
  border: 1px solid rgba(231, 225, 255, 0.13);
  border-radius: 25px;
  background:
    linear-gradient(180deg, rgba(30, 26, 48, 0.88), rgba(11, 10, 21, 0.9));
  box-shadow:
    0 20px 54px rgba(2, 1, 8, 0.52),
    inset 0 1px rgba(255, 255, 255, 0.07);
  backdrop-filter: saturate(175%) blur(28px);
  -webkit-backdrop-filter: saturate(175%) blur(28px);
  transform: none;
  animation: nav-dock-in 650ms 220ms cubic-bezier(0.16, 0.9, 0.22, 1) both;
}

.nav-item {
  min-height: 58px;
  gap: 2px;
  border-radius: 19px;
  transition: color 220ms ease, background 260ms ease, transform 160ms ease;
}

.nav-item.active {
  background:
    radial-gradient(circle at 50% 0%, rgba(196, 181, 253, 0.2), transparent 58%),
    linear-gradient(180deg, rgba(167, 139, 250, 0.16), rgba(124, 58, 237, 0.09));
  color: #e4dcff;
}

.nav-icon {
  height: 31px;
}

.nav-item.active .nav-icon {
  background: transparent;
  color: #c4b5fd;
  filter: drop-shadow(0 0 7px rgba(167, 139, 250, 0.34));
}

.nav-item.active .nav-icon::after {
  top: 1px;
  right: 3px;
  background: #67e8f9;
  box-shadow: 0 0 8px #22d3ee;
}

.nav-label {
  font-size: 8px;
}

@keyframes aurora-violet {
  to {
    opacity: 0.29;
    transform: translate(92px, 105px) scale(1.14);
  }
}

@keyframes aurora-cyan {
  to {
    opacity: 0.27;
    transform: translate(-74px, 120px) scale(1.08);
  }
}

@keyframes aurora-coral {
  to {
    opacity: 0.17;
    transform: translate(105px, -90px) scale(1.2);
  }
}

@keyframes hero-aura-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes status-beacon {
  0% {
    box-shadow: 0 0 0 0 currentColor;
  }
  75%,
  100% {
    box-shadow: 0 0 0 8px transparent;
  }
}

@keyframes vehicle-scan {
  0%,
  22% {
    left: -40%;
    opacity: 0;
  }
  42% {
    opacity: 1;
  }
  70%,
  100% {
    left: 118%;
    opacity: 0;
  }
}

@keyframes road-grid-flow {
  to {
    background-position: 0 18px, 24px 0;
  }
}

@keyframes orbit-violet {
  0%,
  100% {
    opacity: 0.45;
    transform: translate(-50%, -50%) rotate(-7deg) scale(0.96);
  }
  50% {
    opacity: 0.95;
    transform: translate(-50%, -50%) rotate(5deg) scale(1.05);
  }
}

@keyframes orbit-cyan {
  0%,
  100% {
    opacity: 0.35;
    transform: translate(-50%, -50%) rotate(8deg) scale(1.03);
  }
  50% {
    opacity: 0.85;
    transform: translate(-50%, -50%) rotate(-6deg) scale(0.95);
  }
}

@keyframes action-glint {
  to {
    left: 130%;
  }
}

@keyframes battery-orb-in {
  from {
    opacity: 0;
    transform: scale(0.72) rotate(-40deg);
  }
  to {
    opacity: 1;
    transform: scale(1) rotate(0);
  }
}

@keyframes battery-glow {
  50% {
    opacity: 0.62;
    transform: scale(1.05);
  }
}

@keyframes nav-dock-in {
  from {
    opacity: 0;
    transform: translateY(28px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 370px) {
  .status-card {
    height: 354px;
    margin-right: 9px;
    margin-left: 9px;
  }

  .vehicle-image {
    top: -49px;
  }

  .battery-header {
    gap: 10px;
    grid-template-columns: 126px minmax(0, 1fr);
  }

  .battery-orb {
    width: 118px;
    height: 118px;
  }

  .battery-consumption {
    padding: 12px;
  }

  .bottom-nav {
    right: 7px;
    left: 7px;
  }
}

@media (min-width: 720px) {
  .bottom-nav {
    right: 50%;
    left: auto;
    width: min(660px, calc(100vw - 20px));
    transform: translateX(50%);
  }

  @keyframes nav-dock-in {
    from {
      opacity: 0;
      transform: translate(50%, 28px) scale(0.96);
    }
    to {
      opacity: 1;
      transform: translate(50%, 0) scale(1);
    }
  }
}

/* Tesla Fleet API controls */
.tesla-control-view {
  padding: 11px 11px 108px;
}

.tesla-control-hero {
  display: grid;
  min-height: 178px;
  align-items: end;
  padding: 21px 18px 18px;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) auto;
  border: 1px solid rgba(231, 225, 255, 0.1);
  border-radius: 28px;
  background: #131020;
  box-shadow: 0 22px 52px rgba(2, 1, 8, 0.3), inset 0 1px rgba(255, 255, 255, 0.05);
}

.tesla-control-heading {
  min-width: 0;
}

.tesla-control-heading h2 {
  margin-top: 7px;
  font-size: 27px;
  font-weight: 680;
  letter-spacing: 0;
  line-height: 1.05;
}

.tesla-control-heading p {
  max-width: 34ch;
  margin-top: 9px;
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.45;
}

.tesla-api-badge {
  display: inline-flex;
  min-height: 30px;
  align-self: start;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  font-size: 9px;
  font-weight: 720;
  white-space: nowrap;
}

.tesla-api-badge > span:first-child {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--yellow);
  box-shadow: 0 0 8px currentColor;
}

.tesla-api-badge[data-state="online"] {
  border-color: rgba(52, 211, 153, 0.18);
  color: var(--green);
}

.tesla-api-badge[data-state="online"] > span:first-child {
  background: var(--green);
}

.tesla-api-badge[data-state="error"] {
  border-color: rgba(251, 113, 133, 0.18);
  color: var(--red);
}

.tesla-api-badge[data-state="error"] > span:first-child {
  background: var(--red);
}

.tesla-account-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  grid-column: 1 / -1;
}

.tesla-primary-button {
  display: inline-flex;
  min-height: 43px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 17px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background: #7c3aed;
  color: white;
  font-size: 11px;
  font-weight: 720;
  box-shadow: 0 11px 26px rgba(76, 29, 149, 0.3);
}

.tesla-primary-button svg,
.tesla-icon-button svg {
  width: 17px;
  height: 17px;
}

.tesla-primary-button:active,
.tesla-icon-button:active,
.tesla-pair-button:active {
  transform: scale(0.96);
}

.tesla-primary-button:disabled,
.tesla-icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.tesla-icon-button {
  display: grid;
  width: 43px;
  height: 43px;
  flex: 0 0 43px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--text-secondary);
}

.tesla-icon-button.is-loading svg {
  animation: spin 850ms linear infinite;
}

.tesla-setup-strip {
  display: grid;
  margin-top: 10px;
  padding: 12px 8px;
  gap: 0;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.tesla-setup-item {
  display: flex;
  min-width: 0;
  min-height: 53px;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
}

.tesla-setup-item + .tesla-setup-item {
  border-left: 1px solid var(--line);
}

.tesla-setup-icon {
  display: grid;
  width: 31px;
  height: 31px;
  flex: 0 0 31px;
  place-items: center;
  border-radius: 11px;
  background: rgba(251, 191, 36, 0.1);
  color: var(--yellow);
}

.tesla-setup-icon svg {
  width: 15px;
  height: 15px;
}

.tesla-setup-item[data-state="ready"] .tesla-setup-icon {
  background: rgba(52, 211, 153, 0.11);
  color: var(--green);
}

.tesla-setup-item[data-state="error"] .tesla-setup-icon {
  background: rgba(251, 113, 133, 0.1);
  color: var(--red);
}

.tesla-setup-item div {
  min-width: 0;
}

.tesla-setup-item small,
.tesla-setup-item strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tesla-setup-item small {
  color: var(--text-muted);
  font-size: 7px;
  font-weight: 670;
  text-transform: uppercase;
}

.tesla-setup-item strong {
  margin-top: 3px;
  color: var(--text-secondary);
  font-size: 9px;
  font-weight: 680;
}

.tesla-empty-state {
  display: grid;
  min-height: 260px;
  place-items: center;
  align-content: center;
  padding: 28px 22px;
  text-align: center;
}

.tesla-empty-state > span {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
}

.tesla-empty-state svg {
  width: 27px;
  height: 27px;
}

.tesla-empty-state h3 {
  margin-top: 17px;
  font-size: 16px;
  font-weight: 680;
  letter-spacing: 0;
}

.tesla-empty-state p {
  max-width: 36ch;
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 10px;
  line-height: 1.5;
}

.tesla-connected-content {
  padding-top: 17px;
}

.tesla-vehicle-toolbar {
  display: grid;
  align-items: end;
  gap: 7px 9px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.tesla-vehicle-toolbar > label {
  color: var(--text-muted);
  font-size: 8px;
  font-weight: 720;
  text-transform: uppercase;
  grid-column: 1 / -1;
}

.tesla-vehicle-toolbar select {
  width: 100%;
  min-width: 0;
  height: 43px;
  padding: 0 35px 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  appearance: none;
  background: #151221;
  color: var(--text);
  font: inherit;
  font-size: 11px;
}

.tesla-pair-button {
  display: inline-flex;
  min-height: 43px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 13px;
  border: 1px solid rgba(34, 211, 238, 0.2);
  border-radius: 13px;
  background: rgba(34, 211, 238, 0.09);
  color: #67e8f9;
  font-size: 9px;
  font-weight: 720;
  text-decoration: none;
  white-space: nowrap;
}

.tesla-pair-button svg {
  width: 15px;
  height: 15px;
}

.tesla-command-auth {
  display: grid;
  margin-top: 18px;
  gap: 8px;
}

.tesla-command-auth > label,
.tesla-charge-limit label {
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 670;
}

.tesla-pin-field {
  position: relative;
}

.tesla-pin-field > svg {
  position: absolute;
  top: 50%;
  left: 13px;
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  transform: translateY(-50%);
  pointer-events: none;
}

.tesla-pin-field input {
  width: 100%;
  height: 45px;
  padding: 0 13px 0 39px;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  outline: 0;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  letter-spacing: 0;
}

.tesla-pin-field input:focus,
.tesla-vehicle-toolbar select:focus-visible,
.tesla-charge-limit button:focus-visible {
  border-color: rgba(167, 139, 250, 0.55);
  box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.1);
}

.tesla-command-auth > span {
  color: var(--green);
  font-size: 8px;
  font-weight: 650;
}

.tesla-command-auth > span[data-state="error"] {
  color: var(--red);
}

.tesla-command-section {
  margin-top: 24px;
}

.tesla-command-heading {
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.tesla-command-heading h3 {
  margin-top: 4px;
  font-size: 21px;
  font-weight: 680;
  letter-spacing: 0;
}

.tesla-vehicle-state {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-secondary);
  font-size: 8px;
  font-weight: 680;
  white-space: nowrap;
}

.tesla-vehicle-state[data-state="online"] {
  border-color: rgba(52, 211, 153, 0.18);
  color: var(--green);
}

.tesla-command-grid {
  display: grid;
  margin-top: 12px;
  gap: 8px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.tesla-command-grid button {
  display: flex;
  aspect-ratio: 1.18;
  min-width: 0;
  align-items: flex-start;
  justify-content: space-between;
  flex-direction: column;
  padding: 12px 10px;
  border: 1px solid rgba(231, 225, 255, 0.09);
  border-radius: 17px;
  background: #151221;
  color: var(--text);
  text-align: left;
  transition: border-color 160ms ease, transform 150ms ease, opacity 160ms ease;
}

.tesla-command-grid button:active:not(:disabled) {
  border-color: rgba(167, 139, 250, 0.4);
  transform: scale(0.96);
}

.tesla-command-grid button > span {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 12px;
  background: rgba(167, 139, 250, 0.13);
  color: #c4b5fd;
}

.tesla-command-grid button[data-danger="true"] > span {
  background: rgba(251, 113, 133, 0.11);
  color: #fda4af;
}

.tesla-command-grid button svg {
  width: 17px;
  height: 17px;
}

.tesla-command-grid button strong {
  overflow-wrap: anywhere;
  font-size: 9px;
  font-weight: 680;
  line-height: 1.25;
}

.tesla-command-grid button:disabled {
  cursor: not-allowed;
  opacity: 0.32;
}

.tesla-command-grid button.is-loading > span svg {
  animation: spin 850ms linear infinite;
}

.tesla-charge-limit {
  display: grid;
  margin-top: 22px;
  padding: 17px 0 2px;
  gap: 14px;
  grid-template-columns: minmax(0, 1fr) auto;
  border-top: 1px solid var(--line);
}

.tesla-charge-limit > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  grid-column: 1 / -1;
}

.tesla-charge-limit strong {
  color: #c4b5fd;
  font-size: 16px;
}

.tesla-charge-limit input[type="range"] {
  width: 100%;
  accent-color: #a78bfa;
}

.tesla-charge-limit button {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid rgba(167, 139, 250, 0.2);
  border-radius: 12px;
  background: rgba(167, 139, 250, 0.12);
  color: #d8ccff;
  font-size: 9px;
  font-weight: 720;
}

.tesla-charge-limit button:disabled,
.tesla-charge-limit input:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

.tesla-inline-status {
  margin: 18px 2px 0;
  padding: 10px 12px;
  border-left: 2px solid var(--yellow);
  background: rgba(251, 191, 36, 0.06);
  color: var(--text-secondary);
  font-size: 10px;
  line-height: 1.45;
}

.tesla-inline-status[data-state="success"] {
  border-color: var(--green);
  background: rgba(52, 211, 153, 0.06);
  color: #a7f3d0;
}

.tesla-inline-status[data-state="error"] {
  border-color: var(--red);
  background: rgba(251, 113, 133, 0.06);
  color: #fecdd3;
}

.tesla-command-dialog {
  width: min(360px, calc(100vw - 28px));
  max-width: none;
  padding: 0;
  border: 1px solid rgba(231, 225, 255, 0.14);
  border-radius: 24px;
  background: #131020;
  color: var(--text);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.62);
}

.tesla-command-dialog::backdrop {
  background: rgba(2, 1, 8, 0.72);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
}

.tesla-command-dialog form {
  padding: 25px 21px 19px;
}

.tesla-dialog-icon {
  display: grid;
  width: 47px;
  height: 47px;
  place-items: center;
  border-radius: 16px;
  background: rgba(167, 139, 250, 0.13);
  color: #c4b5fd;
}

.tesla-dialog-icon svg {
  width: 22px;
  height: 22px;
}

.tesla-command-dialog h2 {
  margin-top: 19px;
  font-size: 20px;
  font-weight: 680;
  letter-spacing: 0;
}

.tesla-command-dialog p {
  margin-top: 8px;
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.5;
}

.tesla-dialog-actions {
  display: grid;
  margin-top: 23px;
  gap: 8px;
  grid-template-columns: 1fr 1fr;
}

.tesla-dialog-actions button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 700;
}

.tesla-dialog-actions .tesla-dialog-confirm {
  border-color: rgba(167, 139, 250, 0.25);
  background: #7c3aed;
  color: white;
}

.tesla-dialog-actions .tesla-dialog-confirm.is-danger {
  border-color: rgba(251, 113, 133, 0.3);
  background: #be123c;
}

@media (max-width: 390px) {
  .tesla-control-heading h2 {
    font-size: 23px;
  }

  .tesla-setup-item {
    align-items: flex-start;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
  }

  .tesla-setup-item strong {
    white-space: normal;
  }

  .tesla-command-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tesla-command-grid button {
    aspect-ratio: 1.35;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
