/* Tessa Drive v44 - live cockpit, deposit clarity and Roadbook tools */
:root {
  --motion-control: 180ms;
  --motion-view: 300ms;
  --motion-data: 520ms;
  --motion-ease: cubic-bezier(0.22, 0.78, 0.2, 1);
  --live-cyan: #67e8f9;
  --live-teal: #2dd4bf;
  --live-green: #5ee0ad;
  --live-coral: #fb7185;
  --live-amber: #f6c85f;
}

/* Keep compact viewports readable and inside the viewport after the legacy layers load. */
.brand-lockup,
.header-actions,
.connection-pill {
  min-width: 0;
}

.brand-lockup { flex: 1 1 auto; }
.header-actions { flex: 0 1 auto; }

@media (max-width: 959px) {
  .header,
  .main-content,
  .vehicle-scene,
  .vehicle-energy-sheet {
    max-width: 100vw;
    overflow-x: clip;
  }

  .connection-pill {
    max-width: min(148px, 34vw);
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .bottom-nav {
    right: auto;
    left: 8px;
    width: calc(100vw - 16px);
    max-width: calc(100vw - 16px);
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .bottom-nav .nav-item { min-width: 0; }
  .vehicle-live-readout {
    right: 10px;
    max-width: 48%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@media (max-width: 390px) {
  .header-top { gap: 8px; }
  .header-actions { gap: 5px; }
  .header-icon-button { width: 34px; height: 34px; flex-basis: 34px; }
  .connection-pill { max-width: 116px; padding-inline: 8px; }
  .battery-primary { grid-template-columns: minmax(0, 1fr) minmax(0, auto); gap: 10px; }
  .battery-primary-range { min-width: 0; overflow: hidden; }
  .battery-primary-range span,
  .battery-primary-range strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .battery-primary-range b { font-size: clamp(20px, 7vw, 27px); }
}

/* Functional labels stay readable on a phone without competing with the data. */
.nav-label,
.home-action-strip small {
  font-size: 10px;
}

.vehicle-live-readout,
.vehicle-map-credit {
  font-size: 9px;
}

/* v41: explicit trip selection and fair combined scores */
.trip-selection-toggle {
  padding: 0;
  border: 1px solid rgba(103, 232, 249, 0.22);
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  transition: border-color var(--motion-control) ease, background var(--motion-control) ease, color var(--motion-control) ease, transform var(--motion-control) ease;
}

.trip-selection-toggle:hover {
  border-color: rgba(103, 232, 249, 0.48);
  transform: translateY(-1px);
}

.trip-selection-toggle.active {
  border-color: rgba(74, 222, 178, 0.62);
  color: #07130f;
  background: #4adeb2;
  box-shadow: 0 0 0 3px rgba(74, 222, 178, 0.1);
}

.trip-selection-bar,
.trip-selection-status,
.trip-selection-status > span,
.trip-selection-actions,
.trip-selection-actions button,
.trip-select-indicator {
  display: flex;
  align-items: center;
}

.trip-selection-bar {
  justify-content: space-between;
  gap: 14px;
  min-height: 58px;
  margin: -4px 0 12px;
  padding: 9px 2px;
  border-top: 1px solid rgba(74, 222, 178, 0.2);
  border-bottom: 1px solid rgba(74, 222, 178, 0.16);
  animation: trip-selection-enter 220ms var(--motion-ease) both;
}

.trip-selection-status {
  min-width: 0;
  gap: 10px;
}

.trip-selection-status > span {
  justify-content: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 8px;
  color: #4adeb2;
  background: rgba(74, 222, 178, 0.1);
}

.trip-selection-status svg,
.trip-selection-actions svg,
.trip-select-indicator svg {
  width: 17px;
  height: 17px;
  stroke-width: 2.2;
}

.trip-selection-status strong,
.trip-selection-status small {
  display: block;
  letter-spacing: 0;
  white-space: nowrap;
}

.trip-selection-status strong {
  color: #f6fbff;
  font-size: 0.78rem;
}

.trip-selection-status small {
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.48);
  font-size: 0.65rem;
}

.trip-selection-actions {
  flex: 0 0 auto;
  gap: 7px;
}

.trip-selection-actions button {
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 11px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 7px;
  color: rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.04);
  font: inherit;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0;
  cursor: pointer;
}

.trip-selection-actions #tripSelectionMerge {
  border-color: rgba(74, 222, 178, 0.48);
  color: #07130f;
  background: #4adeb2;
}

.trip-selection-actions button:disabled {
  cursor: default;
  opacity: 0.38;
}

#recentSection .trip-item.is-selectable .trip-summary {
  grid-template-columns: 26px minmax(0, 1fr) auto;
  cursor: pointer;
  user-select: none;
}

.trip-item.is-selectable .trip-select-indicator {
  justify-content: center;
  grid-column: 1;
  color: rgba(255, 255, 255, 0.34);
}

.trip-item.is-selectable .trip-route-block {
  overflow: hidden;
  min-width: 0;
  grid-column: 2;
}

.trip-item.is-selectable .trip-route {
  overflow: hidden;
}

.trip-item.is-selectable .trip-route > span:not(.route-arrow) {
  min-width: 0;
  flex: 1 1 0;
}

.trip-item.is-selectable .row-value-stack {
  grid-column: 3;
}

.trip-item.is-selectable.is-selected {
  background: rgba(74, 222, 178, 0.07);
  box-shadow: inset 3px 0 #4adeb2;
}

.trip-item.is-selectable.is-selected .trip-select-indicator {
  color: #4adeb2;
}

.trip-item.is-selectable.is-selected .trip-route > span:not(.route-arrow) {
  color: #effff9;
}

.trip-journey-tools > div:empty {
  display: none;
}

@keyframes trip-selection-enter {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* v40: per-charge pricing and multi-segment journeys */
#chargesSection .charge-session.has-manual-rate {
  --session-accent: #4adeb2;
  --session-accent-soft: rgba(74, 222, 178, 0.16);
}

.charge-rate-editor {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) minmax(150px, 180px) minmax(210px, 1fr) auto;
  grid-template-areas:
    "copy input preview actions"
    "feedback feedback feedback feedback";
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding: 14px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.charge-rate-editor-copy,
.charge-rate-editor-copy > span,
.charge-rate-input,
.charge-manual-rate-actions,
.trip-journey-tools,
.trip-journey-tools > span,
.trip-journey-tools > div {
  display: flex;
  align-items: center;
}

.charge-rate-editor-copy {
  grid-area: copy;
  min-width: 0;
  gap: 10px;
}

.charge-rate-editor-copy > span {
  justify-content: center;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border: 1px solid rgba(74, 222, 178, 0.32);
  border-radius: 8px;
  color: #4adeb2;
  background: rgba(74, 222, 178, 0.09);
}

.charge-rate-editor-copy svg,
.charge-manual-rate-actions svg,
.trip-journey-tools svg {
  width: 17px;
  height: 17px;
  stroke-width: 2;
}

.charge-rate-editor-copy div {
  min-width: 0;
}

.charge-rate-editor-copy small,
.charge-rate-editor-copy strong {
  display: block;
  letter-spacing: 0;
}

.charge-rate-editor-copy small {
  color: rgba(255, 255, 255, 0.52);
  font-size: 0.67rem;
  text-transform: uppercase;
}

.charge-rate-editor-copy strong {
  margin-top: 2px;
  color: #f6fbff;
  font-size: 0.88rem;
}

.charge-rate-input {
  grid-area: input;
  min-width: 0;
  height: 40px;
  padding: 0 10px 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(5, 12, 18, 0.72);
}

.charge-rate-input:focus-within {
  border-color: rgba(74, 222, 178, 0.75);
  box-shadow: 0 0 0 3px rgba(74, 222, 178, 0.1);
}

.charge-rate-input input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: #fff;
  background: transparent;
  font: inherit;
  font-size: 0.9rem;
  letter-spacing: 0;
}

.charge-rate-input small {
  flex: 0 0 auto;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.7rem;
}

.charge-rate-editor output {
  grid-area: preview;
  min-width: 0;
  color: #d7e4ea;
  font-size: 0.78rem;
  line-height: 1.35;
}

.charge-manual-rate-actions {
  grid-area: actions;
  gap: 7px;
}

.charge-manual-rate-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.05);
}

.charge-manual-rate-actions button[type="submit"] {
  border-color: rgba(74, 222, 178, 0.42);
  color: #07130f;
  background: #4adeb2;
}

.charge-manual-rate-actions button:disabled,
.trip-journey-tools button:disabled {
  opacity: 0.5;
}

.charge-rate-editor > p {
  grid-area: feedback;
  min-height: 16px;
  margin: -5px 0 0 46px;
  color: rgba(255, 255, 255, 0.48);
  font-size: 0.68rem;
  letter-spacing: 0;
}

.charge-rate-editor > p[data-state="error"] {
  color: #fda4af;
}

.charge-rate-editor > p[data-state="loading"] {
  color: #67e8f9;
}

.trip-date b {
  display: inline-flex;
  margin-left: 6px;
  padding: 2px 6px;
  border-radius: 5px;
  color: #07130f;
  background: #4adeb2;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0;
  vertical-align: middle;
}

.trip-item.is-journey {
  border-color: rgba(74, 222, 178, 0.24);
}

.trip-journey-tools {
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  margin: 12px 0;
  padding: 8px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

.trip-journey-tools > span {
  min-width: 0;
  gap: 8px;
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.75rem;
}

.trip-journey-tools > span svg {
  flex: 0 0 auto;
  color: #4adeb2;
}

.trip-journey-tools > div {
  flex: 0 0 auto;
  gap: 7px;
}

.trip-journey-tools button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 11px;
  border: 1px solid rgba(72, 200, 255, 0.28);
  border-radius: 7px;
  color: #cdeffc;
  background: rgba(72, 200, 255, 0.08);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0;
}

.trip-journey-tools button[data-split-trip-ids] {
  border-color: rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.68);
  background: rgba(255, 255, 255, 0.04);
}

.trip-stat-band > div > small {
  display: block;
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.42);
  font-size: 0.62rem;
  letter-spacing: 0;
}

@media (max-width: 720px) {
  .charge-rate-editor {
    grid-template-columns: minmax(0, 1fr) max-content;
    grid-template-areas:
      "copy copy"
      "input actions"
      "preview preview"
      "feedback feedback";
  }

  .charge-rate-editor-copy,
  .charge-rate-editor output {
    min-width: 0;
  }

  .charge-rate-editor output {
    min-height: 18px;
  }

  .charge-rate-editor > p {
    margin-left: 0;
  }

  .trip-journey-tools {
    align-items: flex-start;
    flex-direction: column;
  }

  .trip-journey-tools > div {
    width: 100%;
  }

  .trip-journey-tools button {
    flex: 1 1 0;
    min-width: 0;
  }
}

@media (max-width: 390px) {
  .charge-rate-input {
    min-width: 0;
  }

  .trip-journey-tools button {
    padding-inline: 8px;
    font-size: 0.68rem;
  }

  .trip-selection-bar {
    gap: 8px;
  }

  .trip-selection-status {
    gap: 7px;
  }

  .trip-selection-status > span {
    width: 30px;
    height: 30px;
    flex-basis: 30px;
  }

  .trip-selection-actions {
    gap: 5px;
  }

  .trip-selection-actions button {
    min-width: 36px;
    padding-inline: 8px;
  }

  .trip-selection-actions button span {
    display: none;
  }
}

@media (max-width: 959px) {
  .header,
  .main-content,
  .vehicle-energy-sheet,
  .vehicle-scene {
    max-width: 100vw;
    overflow-x: clip;
  }

  .bottom-nav {
    right: auto;
    left: 8px;
    width: calc(100vw - 16px);
    max-width: calc(100vw - 16px);
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .bottom-nav .nav-item {
    min-width: 0;
  }
}

#app *,
.tesla-command-dialog * {
  letter-spacing: 0;
}

[hidden] {
  display: none !important;
}

button,
a,
summary,
input,
select {
  -webkit-tap-highlight-color: transparent;
}

button,
summary,
.nav-active-track,
.vehicle-map,
.vehicle-scene-car,
.chart-column,
.charge-overview-flow-track i {
  transition-duration: var(--motion-control);
  transition-timing-function: var(--motion-ease);
}

/* Fast, directional view changes. */
.app-view-section.is-entering {
  animation: cockpit-view-in var(--motion-view) var(--motion-ease) both !important;
  animation-delay: calc(var(--enter-index, 0) * 28ms) !important;
}

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

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

@keyframes cockpit-view-in {
  from { opacity: 0; transform: translateY(9px); }
  to { opacity: 1; transform: none; }
}

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

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

/* Feedback stays clear of the brand and navigation. */
.app-toast {
  top: auto;
  bottom: calc(104px + var(--safe-bottom));
  max-width: calc(100vw - 28px);
  border-radius: 8px;
  transform: translate(-50%, 18px) scale(0.97);
  transition: opacity var(--motion-control) ease, transform 240ms var(--motion-ease);
}

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

/* One moving selector makes all five navigation states feel connected. */
.bottom-nav {
  --nav-index: 0;
  isolation: isolate;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
}

.nav-active-track {
  position: absolute;
  z-index: -1;
  top: 5px;
  bottom: 5px;
  left: 5px;
  width: calc((100% - 10px) / 5);
  border: 1px solid rgba(103, 232, 249, 0.11);
  border-radius: 6px;
  background: #17242c;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.035);
  transform: translateX(calc(var(--nav-index) * 100%));
  transition-property: transform, background-color;
  transition-duration: 280ms;
}

.nav-item {
  position: relative;
  z-index: 1;
  background: transparent !important;
  transition-property: color, transform;
}

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

/* Live vehicle scene. */
#overviewEnergy .vehicle-scene-header .status-badge {
  display: none;
}

.vehicle-map {
  transform: scale(1.015);
  transform-origin: center;
  transition-property: transform, filter;
  transition-duration: 760ms;
}

#overviewEnergy[data-state="driving"] .vehicle-map {
  transform: scale(1.055);
}

#overviewEnergy[data-state="asleep"] .vehicle-map,
#overviewEnergy[data-state="offline"] .vehicle-map {
  filter: saturate(0.55) brightness(0.82);
  transform: scale(1.005);
}

.vehicle-scene-hud {
  position: absolute;
  z-index: 620;
  top: 84px;
  right: 16px;
  left: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  pointer-events: none;
}

.scene-state-pill,
.scene-energy-mini,
.scene-energy-mini > span {
  display: flex;
  align-items: center;
}

.scene-state-pill {
  min-width: 0;
  min-height: 30px;
  gap: 7px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  background: rgba(7, 11, 15, 0.74);
  color: #dce6ec;
  backdrop-filter: blur(15px);
}

.scene-state-pill svg,
.scene-energy-mini svg {
  width: 13px;
  height: 13px;
  color: var(--live-cyan);
}

.scene-state-pill b,
.scene-energy-mini strong {
  overflow: hidden;
  font-size: 9px;
  font-weight: 720;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scene-energy-mini {
  min-height: 30px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  background: rgba(7, 11, 15, 0.74);
  backdrop-filter: blur(15px);
}

.scene-energy-mini > span {
  min-height: 29px;
  gap: 6px;
  padding: 0 9px;
}

.scene-energy-mini > span + span {
  border-left: 1px solid rgba(255, 255, 255, 0.09);
}

.vehicle-scene-car {
  transition-property: transform, width, bottom;
  transition-duration: 620ms;
}

.vehicle-motion-trail {
  position: absolute;
  z-index: -1;
  right: 8%;
  bottom: 10%;
  left: 8%;
  height: 18%;
  opacity: 0;
  transform: perspective(120px) rotateX(66deg) translateY(10px);
}

.vehicle-motion-trail::before,
.vehicle-motion-trail::after {
  position: absolute;
  top: 50%;
  width: 42%;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(103, 232, 249, 0.8));
  content: "";
}

.vehicle-motion-trail::before { right: 66%; }
.vehicle-motion-trail::after { left: 66%; transform: scaleX(-1); }

#overviewEnergy[data-state="driving"] .vehicle-scene-car {
  animation: vehicle-cruise 2.4s ease-in-out infinite;
}

#overviewEnergy[data-state="driving"] .vehicle-motion-trail {
  opacity: 0.9;
  animation: trail-pulse 1.2s ease-in-out infinite;
}

#overviewEnergy[data-state="driving"] .scene-state-pill {
  border-color: rgba(103, 232, 249, 0.3);
  color: #e9fcff;
}

#overviewEnergy[data-state="charging"] .vehicle-scene-car {
  animation: vehicle-charge-breathe 2.2s ease-in-out infinite;
}

#overviewEnergy[data-state="charging"] .scene-state-pill,
#overviewEnergy[data-state="charging"] .scene-energy-mini {
  border-color: rgba(94, 224, 173, 0.34);
}

#overviewEnergy[data-state="charging"] .scene-state-pill svg,
#overviewEnergy[data-state="charging"] .scene-energy-mini svg {
  color: var(--live-green);
}

#overviewEnergy[data-state="charging"] #batteryBarFill {
  background-size: 180% 100%;
  animation: battery-flow 1.9s linear infinite;
}

@keyframes vehicle-cruise {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(0, -4px, 0); }
}

@keyframes trail-pulse {
  0%, 100% { transform: perspective(120px) rotateX(66deg) translateY(10px) scaleX(0.78); opacity: 0.4; }
  50% { transform: perspective(120px) rotateX(66deg) translateY(10px) scaleX(1); opacity: 0.95; }
}

@keyframes vehicle-charge-breathe {
  0%, 100% { filter: drop-shadow(0 16px 22px rgba(0, 0, 0, 0.7)); }
  50% { filter: drop-shadow(0 16px 26px rgba(45, 212, 191, 0.34)); }
}

@keyframes battery-flow {
  from { background-position: 100% 0; }
  to { background-position: -80% 0; }
}

/* Telemetry uses the entire stage instead of leaving a dead desktop column. */
#metricsGrid.metrics-grid {
  width: 100%;
  max-width: none;
  margin: 0;
  border-top: 1px solid var(--cockpit-line);
}

#metricsGrid .pulse-deck,
#metricsGrid .pulse-ledger,
#metricsGrid .pulse-sync {
  width: 100%;
}

#metricsGrid .metric-card,
#metricsGrid .pulse-sync {
  transition: border-color var(--motion-control) ease, background-color var(--motion-control) ease, transform var(--motion-control) var(--motion-ease);
}

#metricsGrid .metric-card:hover {
  border-color: rgba(103, 232, 249, 0.24);
  transform: translateY(-2px);
}

#metricsGrid .metric-value.value-updated,
.activity-km > span.value-updated {
  animation-duration: var(--motion-data) !important;
}

/* Activity: comparison first, interactive chart second, detail metrics third. */
#activitySection.activity-section {
  width: min(100%, 1084px);
  max-width: none;
}

.activity-hero {
  align-items: center;
  grid-template-columns: minmax(190px, 1fr) minmax(190px, auto) minmax(160px, 0.75fr);
}

.activity-comparison {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  padding: 11px 13px;
  border: 1px solid var(--cockpit-line-strong);
  border-radius: 8px;
  background: #0c1218;
}

.activity-comparison-icon {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  border-radius: 50%;
  background: rgba(94, 224, 173, 0.1);
  color: var(--live-green);
}

.activity-comparison[data-tone="negative"] .activity-comparison-icon {
  background: rgba(251, 113, 133, 0.1);
  color: var(--live-coral);
  transform: rotate(180deg);
}

.activity-comparison[data-tone="neutral"] .activity-comparison-icon {
  background: rgba(246, 200, 95, 0.1);
  color: var(--live-amber);
}

.activity-comparison-icon svg {
  width: 17px;
  height: 17px;
}

.activity-comparison > div {
  min-width: 0;
}

.activity-comparison strong,
.activity-comparison small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.activity-comparison strong {
  color: #f2f8fa;
  font-size: 15px;
  white-space: nowrap;
}

.activity-comparison small {
  margin-top: 3px;
  color: #84909b;
  font-size: 8px;
  line-height: 1.35;
}

#activitySection .chart-panel {
  margin-top: 18px;
  padding: 14px 12px 8px;
  border-color: rgba(103, 232, 249, 0.2);
  background: #0d141a;
}

.activity-chart-focus {
  display: grid;
  min-height: 48px;
  align-items: center;
  margin: 9px 4px 10px;
  padding: 8px 10px;
  gap: 2px 12px;
  grid-template-columns: minmax(0, 1fr) auto;
  border-left: 2px solid var(--live-teal);
  background: rgba(45, 212, 191, 0.045);
}

.activity-chart-focus span,
.activity-chart-focus small {
  overflow: hidden;
  color: #85919c;
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-chart-focus strong {
  color: #f2fcfd;
  font-size: 18px;
  grid-row: 1 / 3;
  grid-column: 2;
}

#activitySection .activity-metrics {
  margin-top: 14px;
}

#activitySection .activity-metric:nth-child(4n + 1) strong { color: var(--live-cyan); }
#activitySection .activity-metric:nth-child(4n + 2) strong { color: var(--live-green); }
#activitySection .activity-metric:nth-child(4n + 3) strong { color: var(--live-amber); }
#activitySection .activity-metric:nth-child(4n) strong { color: #eef3f6; }

#activitySection .activity-chart {
  min-height: 232px;
  scroll-behavior: smooth;
}

#activitySection .chart-grid-line {
  stroke: rgba(214, 232, 240, 0.09);
}

#activitySection .chart-axis-label,
#activitySection .chart-unit {
  fill: #7f8b96;
  color: #7f8b96;
}

#activitySection .distance-bar,
#activitySection .consumption-bar {
  cursor: pointer;
  transform-box: fill-box;
  transform-origin: center bottom;
  animation: chart-rise var(--motion-data) var(--motion-ease) both;
  animation-delay: calc(var(--bar-index, 0) * 18ms);
  transition: opacity var(--motion-control) ease, filter var(--motion-control) ease, stroke var(--motion-control) ease;
}

#activitySection .distance-bar {
  filter: drop-shadow(0 0 4px rgba(45, 212, 191, 0.24));
}

#activitySection .consumption-bar {
  filter: drop-shadow(0 0 4px rgba(246, 200, 95, 0.2));
}

#activitySection .chart-column {
  opacity: 1;
  transition-property: opacity;
}

#activitySection .activity-chart:has(.chart-column.is-focused) .chart-column:not(.is-focused) {
  opacity: 0.42;
}

#activitySection .chart-column.is-focused {
  opacity: 1;
}

#activitySection .chart-column.is-focused rect {
  stroke: #f6fdff;
  stroke-width: 1.4;
  filter: drop-shadow(0 0 7px rgba(103, 232, 249, 0.48));
}

#activitySection .chart-trend-line {
  stroke: rgba(103, 232, 249, 0.56);
  stroke-width: 1.3;
}

#activitySection .chart-trend-point {
  fill: #071014;
  stroke: var(--live-cyan);
}

@keyframes chart-rise {
  from { opacity: 0.15; transform: scaleY(0.08); }
  to { opacity: 1; transform: scaleY(1); }
}

/* Trips: compact summaries and an actual route playback control. */
#recentSection.recent-section {
  width: min(100%, 960px);
  max-width: none;
}

#recentSection .trip-item {
  transition: border-color var(--motion-control) ease, background-color var(--motion-control) ease;
}

#recentSection .trip-item:not([open]):hover {
  border-color: rgba(103, 232, 249, 0.25);
  background: #111820;
}

#recentSection .trip-summary {
  min-height: 74px;
}

#recentSection .trip-item[open] .trip-summary {
  background: rgba(103, 232, 249, 0.025);
}

#recentSection .trip-map .leaflet-tile-pane {
  filter: brightness(0.36) contrast(1.24) saturate(0.42);
}

#recentSection .trip-map .leaflet-overlay-pane {
  filter: drop-shadow(0 0 4px rgba(103, 232, 249, 0.3));
}

.trip-playback {
  display: grid;
  min-height: 58px;
  align-items: center;
  padding: 9px 12px;
  gap: 11px;
  grid-template-columns: 40px minmax(0, 1fr);
  border-top: 1px solid var(--cockpit-line);
  border-bottom: 1px solid var(--cockpit-line);
  background: #0b1117;
}

.trip-playback > button {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid rgba(103, 232, 249, 0.3);
  border-radius: 50%;
  background: rgba(103, 232, 249, 0.09);
  color: var(--live-cyan);
}

.trip-playback > button:active:not(:disabled) {
  transform: scale(0.92);
}

.trip-playback > button:disabled {
  opacity: 0.32;
}

.trip-playback svg {
  width: 16px;
  height: 16px;
}

.trip-pause-icon,
.trip-playback > button[data-playing="true"] .trip-play-icon {
  display: none;
}

.trip-playback > button[data-playing="true"] .trip-pause-icon {
  display: grid;
}

.trip-playback-progress {
  --trip-progress: 0;
  display: grid;
  min-width: 0;
  align-items: center;
  gap: 6px 10px;
  grid-template-columns: minmax(0, 1fr) 54px;
}

.trip-playback-progress > span {
  position: relative;
  height: 4px;
  overflow: hidden;
  border-radius: 3px;
  background: #26313a;
}

.trip-playback-progress > span i {
  position: absolute;
  inset: 0 auto 0 0;
  width: calc(var(--trip-progress) * 1%);
  border-radius: inherit;
  background: linear-gradient(90deg, var(--live-green), var(--live-cyan));
  box-shadow: 0 0 9px rgba(103, 232, 249, 0.35);
  transition: width 90ms linear;
}

.trip-playback-progress small {
  color: #8e9aa5;
  font-size: 8px;
  text-align: right;
}

.route-playback-marker {
  fill: var(--live-cyan);
  stroke: #ffffff;
  stroke-width: 2;
}

.trip-score-explanation {
  border-top: 1px solid var(--cockpit-line);
}

.trip-score-explanation > summary {
  min-height: 48px;
  cursor: pointer;
  list-style: none;
}

.trip-score-explanation > summary::-webkit-details-marker {
  display: none;
}

.trip-score-explanation > summary strong::after {
  margin-left: 7px;
  color: var(--live-cyan);
  content: "+";
}

.trip-score-explanation[open] > summary strong::after {
  content: "-";
}

.trip-score-explanation-body {
  padding: 0 0 2px;
  animation: score-detail-in 220ms var(--motion-ease) both;
}

@keyframes score-detail-in {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: none; }
}

/* Charges: three-part overview with visible grid-to-battery flow. */
#chargesSection.charges-section {
  width: min(100%, 1084px);
  max-width: none;
}

.energy-tariff-panel {
  margin: 0 0 16px;
  overflow: hidden;
  border: 1px solid var(--cockpit-line-strong);
  border-radius: 8px;
  background: #0b1117;
  transition: border-color var(--motion-control) ease, background-color var(--motion-control) ease;
}

.energy-tariff-panel[data-state="active"] {
  border-color: rgba(94, 224, 173, 0.34);
  background: #0b1415;
}

.energy-tariff-panel > summary {
  display: grid;
  min-height: 68px;
  align-items: center;
  padding: 10px 14px;
  gap: 11px;
  grid-template-columns: 36px minmax(0, 1fr) auto 18px;
  cursor: pointer;
  list-style: none;
}

.energy-tariff-panel > summary::-webkit-details-marker {
  display: none;
}

.energy-tariff-summary-icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid rgba(103, 232, 249, 0.18);
  border-radius: 6px;
  background: #14212a;
  color: var(--live-cyan);
}

.energy-tariff-summary-icon svg {
  width: 17px;
  height: 17px;
}

.energy-tariff-summary-copy {
  min-width: 0;
}

.energy-tariff-summary-copy small,
.energy-tariff-summary-copy strong {
  display: block;
}

.energy-tariff-summary-copy small {
  color: #71808a;
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
}

.energy-tariff-summary-copy strong {
  overflow: hidden;
  margin-top: 3px;
  color: #edf5f6;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.energy-tariff-summary-state {
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  padding: 0 8px;
  border: 1px solid rgba(246, 200, 95, 0.23);
  border-radius: 5px;
  background: rgba(246, 200, 95, 0.07);
  color: var(--live-amber);
  font-size: 8px;
  font-weight: 800;
  white-space: nowrap;
}

.energy-tariff-summary-state[data-state="active"] {
  border-color: rgba(94, 224, 173, 0.26);
  background: rgba(94, 224, 173, 0.08);
  color: var(--live-green);
}

.energy-tariff-summary-state[data-state="ready"] {
  border-color: rgba(103, 232, 249, 0.22);
  background: rgba(103, 232, 249, 0.07);
  color: var(--live-cyan);
}

.energy-tariff-chevron {
  width: 16px;
  height: 16px;
  color: #77858f;
  transition: transform var(--motion-control) var(--motion-ease);
}

.energy-tariff-panel[open] .energy-tariff-chevron {
  transform: rotate(180deg);
}

.energy-tariff-form {
  display: grid;
  grid-template-columns: 126px minmax(0, 1.35fr) minmax(250px, 0.95fr);
  border-top: 1px solid var(--cockpit-line);
}

.energy-tariff-now {
  display: flex;
  min-width: 0;
  min-height: 132px;
  justify-content: center;
  flex-direction: column;
  padding: 15px;
  border-right: 1px solid var(--cockpit-line);
  background: #0d151b;
}

.energy-tariff-now > span,
.energy-tariff-now > small {
  color: #74818b;
  font-size: 8px;
}

.energy-tariff-now > strong {
  margin: 6px 0 3px;
  color: var(--live-cyan);
  font-size: 21px;
  line-height: 1;
}

.energy-tariff-now[data-band="valley"] > strong { color: var(--live-green); }
.energy-tariff-now[data-band="flat"] > strong { color: var(--live-amber); }
.energy-tariff-now[data-band="peak"] > strong { color: var(--live-coral); }

.energy-tariff-rates {
  display: grid;
  min-width: 0;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.energy-tariff-rate {
  display: flex;
  min-width: 0;
  min-height: 132px;
  justify-content: center;
  flex-direction: column;
  padding: 13px;
  gap: 9px;
  border-right: 1px solid var(--cockpit-line);
}

.energy-tariff-rate > span:first-child {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #9ba7ae;
  font-size: 9px;
  font-weight: 750;
}

.energy-tariff-rate > span:first-child i,
.energy-tariff-schedule i {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 2px;
  background: var(--live-cyan);
}

[data-band="valley"] > span:first-child i,
.energy-tariff-schedule [data-band="valley"] i { background: var(--live-green); }
[data-band="flat"] > span:first-child i,
.energy-tariff-schedule [data-band="flat"] i { background: var(--live-amber); }
[data-band="peak"] > span:first-child i,
.energy-tariff-schedule [data-band="peak"] i { background: var(--live-coral); }

.energy-tariff-input {
  display: grid;
  min-width: 0;
  align-items: center;
  grid-template-columns: minmax(0, 1fr) auto;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.energy-tariff-input:focus-within {
  border-color: var(--live-cyan);
}

.energy-tariff-input input {
  width: 100%;
  min-width: 0;
  height: 36px;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: #f2f7f8;
  font: inherit;
  font-size: 16px;
  font-weight: 760;
}

.energy-tariff-input input::placeholder {
  color: #46535c;
}

.energy-tariff-input small {
  color: #77848d;
  font-size: 8px;
  white-space: nowrap;
}

.energy-tariff-schedule {
  display: grid;
  min-width: 0;
  align-content: center;
  padding: 12px 15px;
  gap: 9px;
}

.energy-tariff-schedule > span {
  display: grid;
  min-width: 0;
  align-items: center;
  gap: 0 7px;
  grid-template-columns: 7px 42px minmax(0, 1fr);
}

.energy-tariff-schedule strong {
  color: #dce5e8;
  font-size: 8px;
}

.energy-tariff-schedule small {
  overflow: hidden;
  color: #77848d;
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.energy-tariff-actions {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: flex-end;
  padding: 9px 12px;
  gap: 8px;
  border-top: 1px solid var(--cockpit-line);
  grid-column: 1 / -1;
}

.energy-tariff-toggle {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  margin-right: auto;
  gap: 9px;
  color: #c8d2d6;
  cursor: pointer;
}

.energy-tariff-toggle input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.energy-tariff-toggle > span {
  position: relative;
  width: 36px;
  height: 20px;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  background: #171e24;
  transition: border-color var(--motion-control) ease, background-color var(--motion-control) ease;
}

.energy-tariff-toggle > span::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #8c979e;
  content: "";
  transition: transform var(--motion-control) var(--motion-ease), background-color var(--motion-control) ease;
}

.energy-tariff-toggle input:checked + span {
  border-color: rgba(94, 224, 173, 0.46);
  background: rgba(94, 224, 173, 0.14);
}

.energy-tariff-toggle input:checked + span::after {
  background: var(--live-green);
  transform: translateX(16px);
}

.energy-tariff-toggle input:focus-visible + span {
  outline: 2px solid var(--live-cyan);
  outline-offset: 2px;
}

.energy-tariff-toggle input:disabled + span,
.energy-tariff-toggle input:disabled ~ strong {
  opacity: 0.45;
  cursor: not-allowed;
}

.energy-tariff-toggle strong {
  overflow: hidden;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.energy-tariff-reset,
.energy-tariff-save {
  display: inline-flex;
  height: 36px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--cockpit-line-strong);
  border-radius: 6px;
  background: #151d23;
  color: #dce5e8;
}

.energy-tariff-reset {
  width: 36px;
  padding: 0;
}

.energy-tariff-save {
  min-width: 96px;
  padding: 0 13px;
  gap: 7px;
  border-color: rgba(103, 232, 249, 0.25);
  background: #16303a;
  color: #e9fcff;
  font-size: 10px;
  font-weight: 760;
}

.energy-tariff-reset svg,
.energy-tariff-save svg {
  width: 15px;
  height: 15px;
}

.energy-tariff-reset:active,
.energy-tariff-save:not(:disabled):active {
  transform: scale(0.96);
}

.energy-tariff-save:disabled {
  opacity: 0.42;
}

.energy-tariff-feedback {
  min-height: 30px;
  margin: 0;
  padding: 8px 12px;
  border-top: 1px solid var(--cockpit-line);
  color: #7f8c95;
  font-size: 8px;
  line-height: 1.45;
  grid-column: 1 / -1;
}

#chargesSection .charge-overview-card {
  display: grid;
  align-items: stretch;
  grid-template-columns: minmax(0, 1.05fr) minmax(190px, 0.78fr) minmax(260px, 1fr);
}

.charge-overview-flow {
  display: flex;
  min-width: 0;
  justify-content: center;
  flex-direction: column;
  padding: 17px;
  border-left: 1px solid var(--cockpit-line);
}

.charge-overview-flow > span,
.charge-overview-flow > small {
  color: #83909a;
  font-size: 8px;
}

.charge-overview-flow > b {
  margin-top: 11px;
  color: var(--live-green);
  font-size: 21px;
}

.charge-overview-flow > small {
  margin-top: 2px;
}

.charge-overview-flow-nodes {
  display: grid;
  min-width: 0;
  align-items: center;
  margin-top: 12px;
  gap: 8px;
  grid-template-columns: auto minmax(38px, 1fr) auto;
}

.charge-overview-flow-nodes > strong {
  display: grid;
  min-width: 0;
  justify-items: center;
  gap: 5px;
  color: #e8eef1;
  font-size: 8px;
}

.charge-overview-flow-nodes > strong:first-child svg { color: var(--live-coral); }
.charge-overview-flow-nodes > strong:last-child svg { color: var(--live-green); }

.charge-overview-flow-nodes svg {
  width: 18px;
  height: 18px;
}

.charge-overview-flow-nodes b {
  overflow: hidden;
  max-width: 84px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.charge-overview-flow-track {
  position: relative;
  height: 3px;
  overflow: visible;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--live-coral), var(--live-amber), var(--live-green));
}

.charge-overview-flow-track i {
  position: absolute;
  top: 50%;
  left: 0;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.72);
  transform: translate(-50%, -50%);
  animation: charge-particle 2.25s linear infinite;
}

.charge-overview-flow-track i:nth-child(2) { animation-delay: -0.75s; }
.charge-overview-flow-track i:nth-child(3) { animation-delay: -1.5s; }

@keyframes charge-particle {
  0% { left: 0; opacity: 0; }
  12%, 86% { opacity: 1; }
  100% { left: 100%; opacity: 0; }
}

#chargesSection .charge-session-flow {
  position: relative;
  overflow: hidden;
}

#chargesSection .charge-session-flow::after {
  position: absolute;
  top: 50%;
  left: 13%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 8px rgba(103, 232, 249, 0.7);
  content: "";
  animation: session-energy-flow 2.4s linear infinite;
  pointer-events: none;
}

@keyframes session-energy-flow {
  from { left: 13%; opacity: 0; }
  15%, 84% { opacity: 1; }
  to { left: 84%; opacity: 0; }
}

/* Tesla Control now reads as a vehicle console, including empty state. */
.tesla-control-view {
  width: min(100%, 960px);
  max-width: none;
}

.tesla-control-hero {
  min-height: 164px;
  border-top: 2px solid var(--live-cyan);
}

.tesla-empty-state {
  min-height: 380px;
  padding-top: 18px;
}

.tesla-empty-vehicle-stage,
.tesla-connected-vehicle {
  position: relative;
  display: grid;
  width: min(480px, 100%);
  min-height: 190px;
  place-items: center;
  isolation: isolate;
}

.tesla-empty-vehicle-stage img,
.tesla-connected-vehicle img {
  z-index: 2;
  width: min(380px, 86%);
  height: auto;
  filter: drop-shadow(0 24px 24px rgba(0, 0, 0, 0.64));
  animation: control-car-arrive 520ms var(--motion-ease) both;
}

.tesla-stage-floor {
  position: absolute;
  z-index: 1;
  right: 10%;
  bottom: 24px;
  left: 10%;
  height: 34px;
  border: 1px solid rgba(103, 232, 249, 0.17);
  border-radius: 50%;
  background: rgba(103, 232, 249, 0.035);
  transform: perspective(120px) rotateX(68deg);
}

.tesla-stage-signal {
  position: absolute;
  z-index: 0;
  width: 118px;
  height: 118px;
  border: 1px solid rgba(103, 232, 249, 0.13);
  border-radius: 50%;
  box-shadow: 0 0 0 28px rgba(103, 232, 249, 0.025), 0 0 0 58px rgba(103, 232, 249, 0.015);
  animation: stage-signal 2.8s ease-in-out infinite;
}

.tesla-empty-state h3 {
  margin-top: 2px;
  font-size: 18px;
}

.tesla-empty-state p {
  max-width: 46ch;
  font-size: 11px;
}

.tesla-connected-stage {
  display: grid;
  min-height: 220px;
  align-items: center;
  margin-top: 14px;
  padding: 10px 18px;
  gap: 8px 18px;
  grid-template-columns: minmax(0, 1.5fr) minmax(180px, 0.7fr);
  border-top: 1px solid var(--cockpit-line);
  border-bottom: 1px solid var(--cockpit-line);
  background: #0b1117;
}

.tesla-connected-stage > div:last-child span,
.tesla-connected-stage > div:last-child strong {
  display: block;
}

.tesla-connected-stage > div:last-child span {
  color: #7f8b96;
  font-size: 8px;
}

.tesla-connected-stage > div:last-child strong {
  margin-top: 6px;
  color: #eef7f8;
  font-size: 16px;
  line-height: 1.3;
}

.tesla-connected-stage[data-state="online"] .tesla-stage-signal {
  border-color: rgba(94, 224, 173, 0.28);
  box-shadow: 0 0 0 28px rgba(94, 224, 173, 0.035), 0 0 0 58px rgba(94, 224, 173, 0.015);
}

.tesla-connected-stage[data-feedback="success"] {
  border-color: rgba(94, 224, 173, 0.34);
}

.tesla-connected-stage[data-feedback="error"] {
  border-color: rgba(251, 113, 133, 0.34);
}

.tesla-command-grid button {
  transition: opacity var(--motion-control) ease, border-color var(--motion-control) ease, transform var(--motion-control) var(--motion-ease), background-color var(--motion-control) ease;
}

.tesla-command-grid button:not(:disabled):hover {
  border-color: rgba(103, 232, 249, 0.28);
  background: #172028;
  transform: translateY(-2px);
}

.tesla-control-view.has-command-busy .tesla-connected-vehicle img {
  animation: command-signal 1.35s ease-in-out infinite;
}

@keyframes control-car-arrive {
  from { opacity: 0; transform: translateY(10px) scale(0.96); }
  to { opacity: 1; transform: none; }
}

@keyframes stage-signal {
  0%, 100% { opacity: 0.34; transform: scale(0.92); }
  50% { opacity: 0.8; transform: scale(1.03); }
}

@keyframes command-signal {
  0%, 100% { filter: drop-shadow(0 24px 24px rgba(0, 0, 0, 0.64)); }
  50% { filter: drop-shadow(0 20px 28px rgba(103, 232, 249, 0.38)); }
}

@media (max-width: 959px) {
  .vehicle-scene {
    height: 310px;
  }

  .vehicle-scene-car {
    bottom: 25px;
    width: min(330px, 88vw);
  }

  #metricsGrid.metrics-grid {
    padding-top: 24px;
  }

  .activity-hero {
    align-items: stretch;
    grid-template-columns: minmax(0, 1fr) minmax(150px, 0.72fr);
  }

  .activity-comparison {
    align-self: center;
  }

  .activity-insights {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-top: 1px solid var(--cockpit-line);
    border-left: 0;
  }

  .activity-insights > div {
    padding: 10px 8px 0 0;
  }

  .activity-insights > div + div {
    padding-left: 12px;
    border-top: 0;
    border-left: 1px solid var(--cockpit-line);
  }

  .energy-tariff-form {
    grid-template-columns: 126px minmax(0, 1fr);
  }

  .energy-tariff-schedule {
    min-height: 76px;
    border-top: 1px solid var(--cockpit-line);
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .energy-tariff-schedule > span {
    grid-template-columns: 7px 42px minmax(0, 1fr);
  }

  #chargesSection .charge-overview-card {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .charge-overview-flow {
    min-height: 138px;
    border-top: 1px solid var(--cockpit-line);
    border-left: 0;
    grid-column: 1 / -1;
  }

  .tesla-connected-stage {
    grid-template-columns: 1fr;
  }

  .tesla-connected-stage > div:last-child {
    padding: 0 8px 12px;
    text-align: center;
  }
}

@media (min-width: 960px) {
  .app-toast {
    top: calc(92px + var(--safe-top));
    right: max(24px, calc(50vw - 560px));
    bottom: auto;
    left: auto;
    transform: translateY(-12px) scale(0.97);
  }

  .app-toast.is-visible {
    transform: translateY(0) scale(1);
  }

  .bottom-nav {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .nav-active-track {
    top: 7px;
    bottom: auto;
    left: 7px;
    width: calc(100% - 14px);
    height: 64px;
    transform: translateY(calc(var(--nav-index) * 68px));
  }

  .vehicle-scene-car {
    bottom: 64px;
    width: min(590px, 88%);
  }

  .vehicle-scene-hud {
    top: 96px;
    right: 24px;
    left: 24px;
  }

  #metricsGrid.metrics-grid {
    padding: 34px 32px 62px;
  }

  #metricsGrid .pulse-deck {
    grid-template-columns: minmax(0, 1.5fr) minmax(310px, 0.72fr);
  }

  #activitySection.activity-section,
  #chargesSection.charges-section {
    padding-right: 32px;
    padding-left: 32px;
  }
}

@media (max-width: 520px) {
  .vehicle-scene-hud {
    top: 90px;
  }

  .scene-energy-mini > span {
    padding: 0 7px;
  }

  .scene-energy-mini > span:last-child {
    display: none;
  }

  .activity-hero {
    grid-template-columns: 1fr;
  }

  .activity-comparison {
    width: 100%;
  }

  .activity-chart-focus {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .activity-chart-focus strong {
    font-size: 15px;
  }

  #recentSection .trip-summary {
    min-height: 70px;
  }

  #recentSection .trip-map {
    height: 214px;
  }

  .trip-stat-band {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .trip-stat-band > div:nth-child(3) {
    border-top: 1px solid var(--cockpit-line);
    border-left: 0;
  }

  .trip-stat-band > div:nth-child(4) {
    border-top: 1px solid var(--cockpit-line);
  }

  .trip-playback {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .trip-playback > button {
    width: 38px;
    height: 38px;
  }

  .energy-tariff-panel > summary {
    padding-right: 12px;
    padding-left: 12px;
  }

  .energy-tariff-form {
    grid-template-columns: 1fr;
  }

  .energy-tariff-now {
    min-height: 88px;
    border-right: 0;
    border-bottom: 1px solid var(--cockpit-line);
  }

  .energy-tariff-rates {
    grid-column: 1;
  }

  .energy-tariff-rate {
    min-height: 112px;
    padding: 11px;
  }

  .energy-tariff-input {
    grid-template-columns: minmax(0, 1fr);
  }

  .energy-tariff-input small {
    display: none;
  }

  .energy-tariff-schedule {
    min-height: 0;
    grid-column: 1;
    grid-template-columns: 1fr;
  }

  .energy-tariff-schedule small {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
  }

  #chargesSection .charge-overview-card {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #chargesSection .charge-overview-energy,
  #chargesSection .charge-overview-cost {
    min-height: 128px;
  }

  #chargesSection .charge-overview-energy {
    border-top: 0;
  }

  #chargesSection .charge-overview-cost {
    border-top: 0;
    border-left: 1px solid var(--cockpit-line);
  }

  .charge-overview-flow {
    min-height: 128px;
    border-top: 1px solid var(--cockpit-line);
    border-left: 0;
    grid-column: 1 / -1;
  }

  .tesla-empty-state {
    min-height: 330px;
  }

  .tesla-empty-vehicle-stage,
  .tesla-connected-vehicle {
    min-height: 156px;
  }

  .tesla-empty-vehicle-stage img,
  .tesla-connected-vehicle img {
    width: min(320px, 92%);
  }

  .tesla-stage-floor {
    bottom: 17px;
  }
}

@media (max-width: 370px) {
  .scene-state-pill {
    max-width: 135px;
  }

  .scene-energy-mini > span {
    min-width: 66px;
  }

  #activitySection .activity-km > span {
    font-size: 48px;
  }

  .activity-chart-focus {
    grid-template-columns: 1fr;
  }

  .activity-chart-focus strong {
    margin-top: 3px;
    grid-row: auto;
    grid-column: auto;
  }

  .activity-chart-focus small {
    white-space: normal;
  }

  .trip-playback-progress {
    grid-template-columns: 1fr 44px;
  }

  .energy-tariff-panel > summary {
    gap: 8px;
    grid-template-columns: 34px minmax(0, 1fr) auto 16px;
  }

  .energy-tariff-summary-icon {
    width: 34px;
    height: 34px;
  }

  .energy-tariff-actions {
    flex-wrap: wrap;
  }

  .energy-tariff-toggle {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }

  .vehicle-motion-trail,
  .charge-overview-flow-track i,
  #chargesSection .charge-session-flow::after {
    display: none;
  }
}
/* v39: device notifications and Web Push controls. */
.notification-console {
  margin: 14px 0 18px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 8px;
  background: rgba(8, 12, 18, 0.72);
  box-shadow: inset 3px 0 0 rgba(72, 200, 255, 0.42);
  letter-spacing: 0;
}

.notification-console[data-state="active"] {
  border-color: rgba(74, 222, 178, 0.34);
  box-shadow: inset 3px 0 0 #4adeb2, 0 14px 34px rgba(0, 0, 0, 0.14);
}

.notification-console[data-state="denied"],
.notification-console[data-state="unsupported"] {
  box-shadow: inset 3px 0 0 rgba(251, 113, 133, 0.68);
}

.notification-console-main {
  display: grid;
  min-width: 0;
  grid-template-columns: 42px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 11px;
  padding: 14px;
}

.notification-console-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(72, 200, 255, 0.28);
  border-radius: 8px;
  background: rgba(72, 200, 255, 0.09);
  color: #6bd5ff;
}

.notification-console[data-state="active"] .notification-console-icon {
  border-color: rgba(74, 222, 178, 0.34);
  background: rgba(74, 222, 178, 0.1);
  color: #66e6bc;
}

.notification-console-icon svg {
  width: 19px;
  height: 19px;
}

.notification-console-copy {
  min-width: 0;
}

.notification-console-copy .section-eyebrow {
  font-size: 8px;
}

.notification-console-copy h3 {
  margin: 3px 0 0;
  color: var(--text-primary, #f7f9fc);
  font-size: 16px;
  line-height: 1.1;
  letter-spacing: 0;
}

.notification-console-copy p {
  margin: 5px 0 0;
  overflow-wrap: anywhere;
  color: var(--text-muted, #8d98a8);
  font-size: 10px;
  line-height: 1.35;
}

.notification-badge {
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  gap: 6px;
  padding: 0 9px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 6px;
  color: var(--text-secondary, #c6cfda);
  font-size: 9px;
  font-weight: 760;
  white-space: nowrap;
}

.notification-badge > span:first-child {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #94a3b8;
}

.notification-badge[data-state="active"] {
  border-color: rgba(74, 222, 178, 0.26);
  color: #91f0ce;
}

.notification-badge[data-state="active"] > span:first-child {
  background: #4adeb2;
  box-shadow: 0 0 10px rgba(74, 222, 178, 0.6);
}

.notification-badge[data-state="denied"] > span:first-child,
.notification-badge[data-state="unsupported"] > span:first-child {
  background: #fb7185;
}

.notification-console-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.notification-test-button,
.notification-toggle {
  min-height: 38px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-secondary, #c6cfda);
}

.notification-test-button {
  display: grid;
  width: 38px;
  padding: 0;
  place-items: center;
}

.notification-test-button svg,
.notification-toggle svg {
  width: 15px;
  height: 15px;
}

.notification-toggle {
  display: inline-flex;
  min-width: 104px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 13px;
  font-size: 10px;
  font-weight: 760;
}

.notification-toggle.is-active {
  border-color: rgba(251, 113, 133, 0.34);
  color: #ff9aaa;
}

.notification-test-button:disabled,
.notification-toggle:disabled {
  cursor: not-allowed;
  opacity: 0.44;
}

.notification-test-button:not(:disabled):hover,
.notification-toggle:not(:disabled):hover {
  border-color: rgba(72, 200, 255, 0.48);
  background: rgba(72, 200, 255, 0.08);
  color: #8ee1ff;
}

.notification-preferences {
  display: grid;
  margin: 0;
  padding: 11px 14px 13px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  border: 0;
  border-top: 1px solid rgba(148, 163, 184, 0.14);
}

.notification-preferences legend {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.notification-preferences label {
  display: flex;
  min-width: 0;
  min-height: 28px;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  color: var(--text-muted, #8d98a8);
}

.notification-preferences input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.notification-preferences label > span {
  position: relative;
  width: 30px;
  height: 17px;
  flex: 0 0 30px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.12);
  transition: border-color 160ms ease, background 160ms ease;
}

.notification-preferences label > span::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #94a3b8;
  content: '';
  transition: transform 160ms ease, background 160ms ease;
}

.notification-preferences input:checked + span {
  border-color: rgba(74, 222, 178, 0.52);
  background: rgba(74, 222, 178, 0.18);
}

.notification-preferences input:checked + span::after {
  transform: translateX(13px);
  background: #66e6bc;
}

.notification-preferences input:focus-visible + span {
  outline: 2px solid rgba(72, 200, 255, 0.72);
  outline-offset: 2px;
}

.notification-preferences b {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 9px;
  font-weight: 680;
  line-height: 1.2;
}

.notification-feedback {
  margin: 0;
  padding: 9px 14px 11px;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
  color: var(--text-muted, #8d98a8);
  font-size: 9px;
}

.notification-feedback[data-state="success"] {
  color: #91f0ce;
}

.notification-feedback[data-state="error"] {
  color: #ff9aaa;
}

.notification-console.is-busy .notification-console-icon svg {
  animation: notification-bell-pulse 900ms ease-in-out infinite;
}

@keyframes notification-bell-pulse {
  50% { transform: rotate(10deg) scale(1.06); }
}

@media (max-width: 620px) {
  .notification-console-main {
    grid-template-columns: 40px minmax(0, 1fr) auto;
    gap: 10px;
    padding: 12px;
  }

  .notification-console-icon {
    width: 40px;
    height: 40px;
  }

  .notification-badge {
    align-self: start;
  }

  .notification-console-actions {
    grid-column: 2 / -1;
    justify-content: flex-end;
  }

  .notification-preferences {
    padding: 10px 12px 12px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px 10px;
  }

  .notification-preferences label {
    min-height: 31px;
  }
}

@media (max-width: 360px) {
  .notification-console-main {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .notification-console-icon {
    width: 38px;
    height: 38px;
  }

  .notification-badge {
    grid-column: 2;
    justify-self: start;
  }

  .notification-console-actions {
    grid-column: 1 / -1;
  }

  .notification-toggle {
    flex: 1 1 auto;
  }
}

/* v44: deposit clarity, trip search and export tools. */
.trip-heading-actions { display: flex; align-items: center; gap: 8px; }
.trip-export-button { color: var(--live-cyan); }

.trip-deposit-panel {
  position: relative;
  margin: 0 0 14px;
  padding: 16px;
  overflow: hidden;
  border: 1px solid rgba(103, 232, 249, 0.2);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(10, 23, 29, 0.98), rgba(15, 11, 26, 0.96));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 14px 36px rgba(0, 0, 0, 0.14);
}

.trip-deposit-header,
.trip-deposit-source,
.trip-deposit-explainer > summary,
.trip-deposit-explainer > summary > span { display: flex; align-items: center; }
.trip-deposit-header { position: relative; z-index: 1; min-width: 0; gap: 10px; }
.trip-deposit-icon { display: grid; width: 36px; height: 36px; flex: 0 0 36px; place-items: center; border: 1px solid rgba(103, 232, 249, 0.3); border-radius: 8px; color: var(--live-cyan); background: rgba(103, 232, 249, 0.08); }
.trip-deposit-icon svg { width: 18px; height: 18px; }
.trip-deposit-header > div { min-width: 0; }
.trip-deposit-header h3 { margin: 3px 0 0; color: #f3fbfc; font-size: 15px; line-height: 1.15; }
.trip-deposit-badge { display: inline-flex; min-height: 24px; align-items: center; margin-left: auto; padding: 0 8px; gap: 5px; border: 1px solid rgba(94, 224, 173, 0.26); border-radius: 5px; color: var(--live-green); background: rgba(94, 224, 173, 0.07); font-size: 9px; font-weight: 760; white-space: nowrap; }
.trip-deposit-badge svg { width: 13px; height: 13px; }
.trip-deposit-copy { position: relative; z-index: 1; max-width: 66ch; margin: 12px 0 14px; color: #aab9c0; font-size: 10px; line-height: 1.55; }

.trip-deposit-stats { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid rgba(255, 255, 255, 0.09); border-bottom: 1px solid rgba(255, 255, 255, 0.09); }
.trip-deposit-stats > div { min-width: 0; padding: 12px 13px 11px; }
.trip-deposit-stats > div + div { border-left: 1px solid rgba(255, 255, 255, 0.09); }
.trip-deposit-stats span, .trip-deposit-stats strong, .trip-deposit-stats small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trip-deposit-stats span { color: #778891; font-size: 8px; font-weight: 720; text-transform: uppercase; }
.trip-deposit-stats strong { margin-top: 5px; color: #f5fcfd; font-size: 17px; line-height: 1.1; }
.trip-deposit-stats > div:nth-child(2) strong { color: var(--live-green); }
.trip-deposit-stats > div:nth-child(4) strong { color: var(--live-amber); }
.trip-deposit-stats small { margin-top: 5px; color: #7e8f98; font-size: 8px; }

.trip-deposit-source { position: relative; z-index: 1; min-width: 0; min-height: 36px; gap: 7px; color: #84949d; font-size: 9px; }
.trip-deposit-source svg { width: 14px; height: 14px; color: var(--live-cyan); }
.trip-deposit-source strong { overflow: hidden; min-width: 0; color: #dbe8eb; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }

.trip-deposit-explainer { position: relative; z-index: 1; border-top: 1px solid rgba(255, 255, 255, 0.09); }
.trip-deposit-explainer > summary { justify-content: space-between; min-height: 38px; cursor: pointer; list-style: none; color: #b9c9ce; font-size: 9px; font-weight: 740; }
.trip-deposit-explainer > summary::-webkit-details-marker { display: none; }
.trip-deposit-explainer > summary > span { gap: 6px; }
.trip-deposit-explainer > summary svg { width: 14px; height: 14px; color: var(--live-cyan); }
.trip-deposit-explainer > summary strong { color: #7f919a; font-size: 8px; }
.trip-deposit-explainer > summary strong::after { content: " +"; color: var(--live-cyan); }
.trip-deposit-explainer[open] > summary strong::after { content: " −"; }
.trip-deposit-explainer ol { display: grid; margin: 0 0 13px; padding: 0; gap: 8px; list-style: none; }
.trip-deposit-explainer li { display: grid; align-items: start; gap: 9px; grid-template-columns: 21px minmax(0, 1fr); }
.trip-deposit-explainer li > span { display: grid; width: 21px; height: 21px; place-items: center; border: 1px solid rgba(103, 232, 249, 0.22); border-radius: 50%; color: var(--live-cyan); font-size: 8px; font-weight: 800; }
.trip-deposit-explainer li strong, .trip-deposit-explainer li small { display: block; }
.trip-deposit-explainer li strong { color: #eaf4f6; font-size: 9px; }
.trip-deposit-explainer li small { margin-top: 2px; color: #84949d; font-size: 9px; line-height: 1.4; }

.trip-tools { display: grid; min-width: 0; align-items: center; margin: 0 0 13px; gap: 8px; grid-template-columns: minmax(180px, 1fr) auto auto; }
.trip-search-field { display: flex; min-width: 0; height: 38px; align-items: center; padding: 0 9px; gap: 8px; border: 1px solid var(--cockpit-line-strong); border-radius: 7px; color: #78919a; background: #0b1117; }
.trip-search-field:focus-within { border-color: rgba(103, 232, 249, 0.5); box-shadow: 0 0 0 3px rgba(103, 232, 249, 0.08); }
.trip-search-field svg { width: 15px; height: 15px; flex: 0 0 auto; color: var(--live-cyan); }
.trip-search-field input { width: 100%; min-width: 0; border: 0; outline: 0; color: #ecf6f7; background: transparent; font: inherit; font-size: 10px; }
.trip-search-field input::placeholder { color: #65767f; }
.trip-search-field kbd { padding: 2px 5px; border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 3px; color: #74848c; font-size: 9px; }
.trip-filter-control { display: flex; min-height: 38px; align-items: center; padding: 3px; gap: 2px; border: 1px solid var(--cockpit-line-strong); border-radius: 7px; background: #0b1117; }
.trip-filter-control button { min-height: 30px; padding: 0 8px; border: 0; border-radius: 5px; color: #8d9ba2; background: transparent; font: inherit; font-size: 8px; font-weight: 760; cursor: pointer; white-space: nowrap; }
.trip-filter-control button.active { color: #051115; background: var(--live-cyan); box-shadow: 0 0 12px rgba(103, 232, 249, 0.2); }
.trip-filter-control button:active { transform: scale(0.96); }
.trip-result-count { color: #758891; font-size: 8px; font-weight: 720; text-align: right; white-space: nowrap; }
.trip-empty-state { display: flex; min-height: 112px; align-items: center; justify-content: center; margin: 0; gap: 8px; color: #758891; font-size: 10px; }
.trip-empty-state svg { width: 16px; height: 16px; color: var(--live-cyan); }

@media (max-width: 720px) {
  .trip-tools { grid-template-columns: minmax(0, 1fr) auto; }
  .trip-result-count { grid-column: 2; grid-row: 1; align-self: center; }
  .trip-filter-control { grid-column: 1 / -1; justify-content: space-between; }
  .trip-filter-control button { flex: 1 1 0; }
}

@media (max-width: 520px) {
  .trip-deposit-panel { padding: 13px; }
  .trip-deposit-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .trip-deposit-stats > div:nth-child(3) { border-top: 1px solid rgba(255, 255, 255, 0.09); border-left: 0; }
  .trip-deposit-stats > div:nth-child(4) { border-top: 1px solid rgba(255, 255, 255, 0.09); }
  .trip-search-field kbd { display: none; }
}

@media (max-width: 370px) {
  .trip-deposit-header { align-items: flex-start; }
  .trip-deposit-badge { align-self: center; padding: 0 6px; }
  .trip-deposit-badge svg { display: none; }
  .trip-filter-control button { padding: 0 4px; font-size: 7px; }
}

/* v46: date-based Roadbook and progressive history. */
#recentSection {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

#recentSection > .list-heading { order: 0; margin-bottom: 22px; }
#recentSection .section-title { font-size: 25px; line-height: 1.2; letter-spacing: 0; }
#recentSection .section-description { margin-top: 7px; font-size: 12px; color: #abb0bc; }
#recentSection .section-eyebrow { font-size: 10px; letter-spacing: 0; }
#recentSection .list-heading-icon { width: 44px; height: 44px; border-radius: 8px; }

.trip-period-control {
  order: 1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid #35343e;
  border-radius: 8px;
  background: #121216;
}

.trip-period-control button {
  display: flex;
  min-width: 0;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 5px;
  color: #afb2bd;
  font-size: 12px;
  font-weight: 650;
  transition: color 180ms ease, background-color 180ms ease;
}

.trip-period-control button.active { color: #f5efff; background: #343042; box-shadow: inset 0 0 0 1px #76698f; }
.trip-period-control button:hover { color: white; background-color: #26242e; }
.trip-period-control svg { width: 16px; height: 16px; flex-shrink: 0; }
.trip-date-picker {
  order: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-top: 12px;
  padding: 14px 0;
  border-bottom: 1px solid #35343e;
  animation: trip-history-enter 220ms ease both;
}
.trip-date-picker label { display: grid; min-width: 0; gap: 7px; color: #b6b9c3; font-size: 12px; }
.trip-date-picker input {
  width: 100%;
  min-width: 0;
  height: 46px;
  padding: 8px 10px;
  border: 1px solid #41404c;
  border-radius: 6px;
  background: #19191f;
  color: #f8f8fa;
  font: inherit;
  font-size: 16px;
}
.trip-date-picker button,
.trip-history-error button {
  display: flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  border: 1px solid #436967;
  border-radius: 6px;
  background: #203f3c;
  color: #e5fff4;
  font-size: 12px;
  font-weight: 700;
}
.trip-date-picker button svg,
.trip-history-error button svg { width: 16px; height: 16px; }
#tripDateFeedback { grid-column: 1 / -1; color: #f9acb5; font-size: 12px; line-height: 1.5; }
#tripDateFeedback:empty { display: none; }

.trip-history-summary {
  order: 3;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 22px 0;
  margin: 0;
  border-bottom: 1px solid #35343e;
}
.trip-history-summary > div { min-width: 0; padding: 0 12px; }
.trip-history-summary > div:first-child { padding-left: 0; }
.trip-history-summary > div:last-child { padding-right: 0; }
.trip-history-summary > div + div { border-left: 1px solid #35343e; }
.trip-history-summary dt { color: #a1a6b0; font-size: 11px; line-height: 1.4; }
.trip-history-summary dd { margin: 8px 0 0; color: #f6f7fa; font-size: 20px; font-weight: 720; line-height: 1.4; overflow-wrap: anywhere; }
.trip-history-summary > div:nth-child(2) dd { color: #a8dbe2; }
.trip-history-summary > div:nth-child(3) dd { color: #e7c995; }

#recentSection .trip-tools { order: 4; margin-top: 18px; margin-bottom: 0; grid-template-columns: minmax(0, 1fr); gap: 12px; }
#recentSection .trip-search-field { height: 46px; background: #15151b; border-color: #383740; border-radius: 6px; }
#recentSection .trip-search-field input { font-size: 16px; }
#recentSection .trip-search-field input::placeholder { color: #939aa7; font-size: 13px; }
#recentSection .trip-filter-control { grid-column: auto; min-height: 46px; padding: 0; border: 0; border-bottom: 1px solid #35343e; border-radius: 0; background: transparent; gap: 12px; }
#recentSection .trip-filter-control button { flex: 1; min-width: 0; min-height: 44px; padding: 0 3px; border-radius: 0; border-bottom: 2px solid transparent; background: transparent; color: #aeb2bd; font-size: 12px; box-shadow: none; }
#recentSection .trip-filter-control button.active { border-bottom-color: #b59aee; color: #e7d9ff; }
#recentSection .trip-result-count { grid-column: auto; grid-row: auto; margin: 0 0 8px; color: #939eaa; font-size: 11px; text-align: left; }
#recentSection .trip-selection-bar { order: 5; margin-top: 10px; }
#recentSection .trip-list { order: 6; overflow: visible; border: 0; background: transparent; }

.trip-day-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 18px 0 8px; padding: 0 2px; color: #e2e5ed; font-size: 13px; font-weight: 650; line-height: 1.4; letter-spacing: 0; }
.trip-day-heading:first-child { margin-top: 8px; }
.trip-day-heading small { color: #a0a7b2; font-size: 10px; font-weight: 500; text-align: right; flex-shrink: 0; }
#recentSection .trip-item { margin-bottom: 7px; border: 1px solid #34353e; border-radius: 8px; background: #14151b; box-shadow: none; overflow: hidden; transition: border-color 200ms ease, background-color 200ms ease; }
#recentSection .trip-item:hover { border-color: #565366; background: #1a1922; }
#recentSection .trip-item[open] { border-color: #716286; background: #19171f; }
#recentSection .trip-item.is-selected { border-color: #5ea98f; background: #17251f; box-shadow: inset 3px 0 #70dbb3; }
#recentSection .trip-summary { min-height: 104px; padding: 15px 12px; gap: 10px; }
#recentSection .trip-route { gap: 7px; }
#recentSection .trip-route > span:not(.route-arrow) { color: #f0f0f4; font-size: 13px; line-height: 1.4; }
#recentSection .trip-date { margin-top: 6px; color: #a5a7b4; font-size: 11px; line-height: 1.5; }
#recentSection .row-primary-value { color: #eae6f7; font-size: 17px; }
#recentSection .trip-score { font-size: 10px; }
.trip-glance { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 8px; color: #b6bdc7; font-size: 11px; }
.trip-glance > span { display: inline-flex; align-items: center; gap: 5px; }
.trip-glance svg { width: 12px; height: 12px; }
.trip-glance-cost { color: #e5c996; }
.trip-glance-cost.is-free { color: #8fe0ba; }
#recentSection .trip-body { border-top: 1px solid #393341; animation: trip-history-enter 220ms ease both; }
#recentSection .trip-map-caption { font-size: 10px; }
#recentSection .trip-map-caption a { color: #a9bac2; }
#recentSection .trip-item.is-new-trip { animation: trip-history-enter 260ms ease var(--trip-enter-delay, 0ms) both; }

.trip-history-footer { order: 7; display: grid; gap: 12px; padding: 20px 0 26px; }
.trip-load-more { display: flex; align-items: center; justify-content: center; min-height: 48px; gap: 10px; border: 1px solid #4e655f; border-radius: 7px; background: #1a2a25; color: #d8f7e6; font-size: 13px; font-weight: 650; transition: background 180ms ease; }
.trip-load-more:hover { background: #253f33; }
.trip-load-more svg { width: 17px; height: 17px; }
.trip-load-more:disabled { opacity: 0.65; cursor: wait; }
#tripHistoryStatus { min-height: 18px; text-align: center; color: #9ea9b0; font-size: 11px; }
.trip-history-error { display: grid; justify-items: center; gap: 12px; padding: 14px; border-block: 1px solid #703d47; color: #fac5ce; text-align: center; font-size: 13px; line-height: 1.5; }
#recentSection .trip-empty-state { min-height: 155px; font-size: 13px; text-align: center; line-height: 1.5; padding: 16px; }
.trip-loading-state { display: grid; gap: 8px; margin-top: 12px; }
.trip-loading-state span { height: 104px; border: 1px solid #32323b; border-radius: 8px; background: #191a20; animation: trip-history-pulse 1.2s ease-in-out infinite alternate; }
.trip-loading-state span:nth-child(2) { animation-delay: 150ms; }
.trip-loading-state span:nth-child(3) { animation-delay: 300ms; }

#recentSection .trip-deposit-panel { order: 8; margin: 0; padding: 14px 0; border: 0; border-top: 1px solid #45414e; border-radius: 0; background: transparent; box-shadow: none; }
#recentSection .trip-deposit-header { min-height: 50px; list-style: none; }
#recentSection .trip-deposit-header::-webkit-details-marker { display: none; }
#recentSection .trip-deposit-header h3 { font-size: 15px; }
.trip-deposit-chevron { margin-left: auto; width: 18px; height: 18px; color: #c7b6e5; transition: transform 200ms ease; }
.trip-deposit-panel[open] .trip-deposit-chevron { transform: rotate(180deg); }
#recentSection .trip-deposit-stats { margin-top: 12px; }
#recentSection .trip-deposit-stats span, #recentSection .trip-deposit-stats small { font-size: 10px; white-space: normal; line-height: 1.5; }
#recentSection .trip-deposit-explainer summary { min-height: 44px; font-size: 12px; }
#recentSection .trip-deposit-source { font-size: 11px; }

.header-icon-button { min-width: 44px; min-height: 44px; }
@media (min-width: 960px) {
  .bottom-nav .nav-item { min-height: 64px; }
  #recentSection .trip-tools { grid-template-columns: minmax(0, 1fr) minmax(310px, auto); }
  #recentSection .trip-result-count { grid-column: 1 / -1; }
  .trip-period-control { max-width: 520px; }
}
@media (max-width: 959px) {
  .bottom-nav { transform: none; animation: none; }
}
@media (max-width: 520px) {
  #recentSection .section-title { font-size: 22px; }
  #recentSection > .list-heading { align-items: center; gap: 10px; }
  .trip-heading-actions { gap: 5px; }
  .trip-date-picker { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .trip-date-picker button { grid-column: 1 / -1; }
  .trip-history-summary dd { font-size: 17px; }
  .trip-history-summary > div { padding-inline: 8px; }
  #recentSection .trip-filter-control { gap: 4px; }
}
@keyframes trip-history-enter {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes trip-history-pulse {
  from { opacity: 0.5; }
  to { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  #recentSection *, #recentSection *::before, #recentSection *::after { animation: none !important; transition: none !important; }
}
