/* RDG visual refinement. Presentation only; retain all existing state classes,
   density detection, visibility, event handlers and data/semantic colours. */
:root {
  --rdg-surface: #101c2b;
  --rdg-surface-raised: #162538;
  --rdg-outline: #2a3b50;
  --rdg-ink: #edf3fa;
  --rdg-secondary: #a9b8cc;
  --rdg-accent: #82b6ff;
}
html body.rdg-primary-shell:is(.rdg-tesla-ui, .rdg-ai-reading-mode) {
  background: #080f19 !important;
  color: var(--rdg-ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}
html body.rdg-primary-shell:is(.rdg-tesla-ui, .rdg-ai-reading-mode) .phone-frame {
  border-color: var(--rdg-outline) !important;
  box-shadow: none !important;
  background-color: #0b1420 !important;
}
html body.rdg-primary-shell:is(.rdg-tesla-ui, .rdg-ai-reading-mode) .phone-frame::before,
html body.rdg-primary-shell:is(.rdg-tesla-ui, .rdg-ai-reading-mode) .phone-frame::after { box-shadow: none !important; }
html body.rdg-primary-shell:is(.rdg-tesla-ui, .rdg-ai-reading-mode) :is(button, [role="button"], a):focus-visible {
  outline: 2px solid #a4caff !important;
  outline-offset: 3px !important;
}
html body.rdg-primary-shell:is(.rdg-tesla-ui, .rdg-ai-reading-mode) :is(.rdg-tesla-region-hero, .rdg-tesla-region-list,
  .rdg-flight-wave-chart, .rdg-flight-bottom-card, .rdg-marine-wave,
  .rdg-marine-cruise-chart, .rdg-marine-glance article, .rdg-event-driver-day,
  .rdg-event-next) {
  background: var(--rdg-surface) !important;
  border-color: var(--rdg-outline) !important;
  box-shadow: none !important;
}
html body.rdg-primary-shell:is(.rdg-tesla-ui, .rdg-ai-reading-mode) .rdg-tesla-region-hero {
  border-width: 1px !important;
  border-top: 3px solid #699fe8 !important;
}
html body.rdg-primary-shell:is(.rdg-tesla-ui, .rdg-ai-reading-mode) .rdg-tesla-region-pagehead>div>i {
  background: #203a5e !important; box-shadow: none !important;
}
html body.rdg-primary-shell:is(.rdg-tesla-ui, .rdg-ai-reading-mode) .rdg-tesla-region-pagehead>b { color: var(--rdg-secondary); }
html body.rdg-primary-shell:is(.rdg-tesla-ui, .rdg-ai-reading-mode) .rdg-tesla-region-hero>header i {
  background: #d59a38 !important; color: #111b28 !important;
}
html body.rdg-primary-shell:is(.rdg-tesla-ui, .rdg-ai-reading-mode) .rdg-tesla-region-hero>header>em.watch {
  color: #f1c776 !important; font-style: normal;
}
html body.rdg-primary-shell:is(.rdg-tesla-ui, .rdg-ai-reading-mode) .rdg-tesla-region-metrics strong {
  font-variant-numeric: tabular-nums; letter-spacing: -.035em;
}
html body.rdg-primary-shell:is(.rdg-tesla-ui, .rdg-ai-reading-mode) .rdg-tesla-region-metrics>div:nth-child(2) strong {
  color: #b9d7ff !important;
}
html body.rdg-primary-shell:is(.rdg-tesla-ui, .rdg-ai-reading-mode) .rdg-tesla-region-list>header {
  background: #162334 !important; border-color: var(--rdg-outline) !important;
}
html body.rdg-primary-shell:is(.rdg-tesla-ui, .rdg-ai-reading-mode) .rdg-tesla-region-list article {
  border-bottom-color: #253346 !important;
}
html body.rdg-primary-shell:is(.rdg-tesla-ui, .rdg-ai-reading-mode) .rdg-tesla-region-list article:nth-child(even) {
  background-color: #132030;
}
html body.rdg-primary-shell:is(.rdg-tesla-ui, .rdg-ai-reading-mode) .rdg-tesla-region-list article:hover {
  background: #20324a !important;
}
html body.rdg-primary-shell:is(.rdg-tesla-ui, .rdg-ai-reading-mode) .rdg-tesla-region-list article>i {
  background: #233347 !important; color: #b9c8db !important;
  border-radius: 9px !important;
}
html body.rdg-primary-shell:is(.rdg-tesla-ui, .rdg-ai-reading-mode) .rdg-tesla-region-row-name {
  white-space: normal !important; overflow-wrap: anywhere;
  line-height: 1.2 !important; font-weight: 650 !important;
}
html body.rdg-primary-shell:is(.rdg-tesla-ui, .rdg-ai-reading-mode) .rdg-tesla-region-row-decision:not(.unavailable-boundary) {
  background: transparent !important; border-color: transparent !important;
  box-shadow: none !important;
}
html body.rdg-primary-shell:is(.rdg-tesla-ui, .rdg-ai-reading-mode) .rdg-tesla-table-type>div {
  height: 8px !important; border-radius: 4px !important;
}
html body.rdg-primary-shell:is(.rdg-tesla-ui, .rdg-ai-reading-mode) .rdg-tesla-region-hero-types .rdg-region-type-stack {
  height: 12px !important; flex-basis: 12px !important;
}
/* Latest-order enlargement and glow come from the existing runtime stylesheet.
   The cue controller now selects only one region per snapshot. */
/* Keep the established dock, drawer and rail geometry. */
html body.rdg-primary-shell:is(.rdg-tesla-ui, .rdg-ai-reading-mode) :is(.rdg-flow-yuban-toggle, .rdg-flow-nav-toggle,
  .rdg-flow-primary-tabs button, .rdg-order-drawer-tab, .rdg-language-toggle) {
  background: var(--rdg-surface-raised) !important;
  border-color: #415774 !important;
  box-shadow: none !important; text-shadow: none !important;
}
html body.rdg-primary-shell:is(.rdg-tesla-ui, .rdg-ai-reading-mode) .rdg-flow-yuban-toggle { color: #d5c5ff !important; }
html body.rdg-primary-shell:is(.rdg-tesla-ui, .rdg-ai-reading-mode) .rdg-flow-primary-tabs button.active {
  background: #203d60 !important; border-color: #82b6ff !important;
  color: #d7e8ff !important;
}
html body.rdg-primary-shell:is(.rdg-tesla-ui, .rdg-ai-reading-mode) .rdg-flow-nav-toggle::after {
  box-shadow: none !important; background: #598acb !important;
}
html body.rdg-primary-shell:is(.rdg-tesla-ui, .rdg-ai-reading-mode) :is(.rdg-flow-nav-toggle svg, .rdg-yuban-shortcut-icon) {
  filter: none !important;
}
html body.rdg-primary-shell:is(.rdg-tesla-ui, .rdg-ai-reading-mode) .rdg-event-urgent-alert.is-collapsed {
  box-shadow: none !important;
}
/* Prioritize place names over decorative type bars, without dropping columns. */
html body.rdg-primary-shell:is(.rdg-tesla-ui, .rdg-ai-reading-mode) .rdg-tesla-region-list>header,
html body.rdg-primary-shell:is(.rdg-tesla-ui, .rdg-ai-reading-mode) .rdg-tesla-region-list article {
  grid-template-columns: 48px minmax(200px,2fr) 90px 90px 100px 64px minmax(140px,1fr) !important;
}
html[data-rdg-tesla-density="compact"] body.rdg-primary-shell:is(.rdg-tesla-ui, .rdg-ai-reading-mode) .rdg-tesla-region-list>header,
html[data-rdg-tesla-density="compact"] body.rdg-primary-shell:is(.rdg-tesla-ui, .rdg-ai-reading-mode) .rdg-tesla-region-list article {
  grid-template-columns: 32px minmax(140px,2fr) 59px 59px 69px 38px minmax(98px,1fr) !important;
  column-gap: 8px !important;
}
html[data-rdg-tesla-density="compact"] body.rdg-primary-shell:is(.rdg-tesla-ui, .rdg-ai-reading-mode) .rdg-tesla-region-list>header {
  flex-basis: 30px !important;
}
html[data-rdg-tesla-density="compact"] body.rdg-primary-shell:is(.rdg-tesla-ui, .rdg-ai-reading-mode) .rdg-tesla-region-list>header span {
  font-size: 10px !important;
}
html[data-rdg-tesla-density="compact"] body.rdg-primary-shell:is(.rdg-tesla-ui, .rdg-ai-reading-mode) .rdg-tesla-region-row-name {
  font-size: 16px !important;
}
html[data-rdg-tesla-density="compact"] body.rdg-primary-shell:is(.rdg-tesla-ui, .rdg-ai-reading-mode) .rdg-tesla-region-hero>header>div>strong,
html[data-rdg-tesla-density="compact"] body.rdg-primary-shell:is(.rdg-tesla-ui, .rdg-ai-reading-mode) .rdg-tesla-region-hero.rdg-region-latest-order:not(.rdg-region-new-order)>header>div>strong {
  font-size: 21px !important; white-space: normal !important; line-height: 1.15;
}
/* Mobile driver palette. Existing layout, gestures and semantic status colours stay. */
html:has(.driver-shell) {
  --bg: #080f19; --panel: #101c2b; --panel-2: #162538;
  --panel-3: #1e3045; --line: #2a3b50; --line-2: #233347;
  --text: #edf3fa; --muted: #a9b8cc; --blue: #82b6ff;
}
html body:has(.driver-shell) { background: #080f19; }
html body:has(.driver-shell) :is(.section-block, .hotzone-card, .driver-login) {
  background: #101c2b; border-color: #2a3b50; box-shadow: none;
}
html body:has(.driver-shell) :is(button, a):focus-visible {
  outline: 2px solid #a4caff; outline-offset: 3px;
}
/* Keep the latest cue above the visual theme's surface overrides. */
html body.rdg-primary-shell:is(.rdg-tesla-ui, .rdg-ai-reading-mode) [data-rdg-new-order-region].rdg-region-latest-order:not(.rdg-region-new-order) {
  box-shadow: 0 0 0 2px rgba(134,239,172,.86), 0 0 28px rgba(34,197,94,.52), inset 0 0 18px rgba(34,197,94,.14) !important;
}
html[data-rdg-tesla-density="compact"] body.rdg-primary-shell:is(.rdg-tesla-ui, .rdg-ai-reading-mode) [data-rdg-new-order-region].rdg-region-latest-order:not(.rdg-region-new-order) .rdg-tesla-region-row-name { font-size:18px!important; }
html[data-rdg-tesla-density="compact"] body.rdg-primary-shell:is(.rdg-tesla-ui, .rdg-ai-reading-mode) .rdg-tesla-region-hero.rdg-region-latest-order:not(.rdg-region-new-order)>header>div>strong { font-size:24px!important; }
html body.rdg-primary-shell:is(.rdg-tesla-ui, .rdg-ai-reading-mode) [data-rdg-new-order-region].rdg-region-new-order {
  box-shadow: 0 0 0 2px rgba(134,239,172,.86), 0 0 28px rgba(34,197,94,.52) !important;
}
@media (prefers-reduced-motion: reduce) {
  html body.rdg-primary-shell [data-rdg-new-order-region].rdg-region-new-order,
  html body.rdg-primary-shell [data-rdg-new-order-region].rdg-region-new-order .rdg-tesla-region-row-name,
  html body.rdg-primary-shell .rdg-tesla-region-hero.rdg-region-new-order>header>div>strong {
    animation: none !important;
  }
  html body.rdg-primary-shell:is(.rdg-tesla-ui, .rdg-ai-reading-mode) [data-rdg-new-order-region].rdg-region-new-order {
    box-shadow: 0 0 0 2px #86efac, 0 0 28px #22c55e85 !important;
  }
}

/* Shared auxiliary surfaces keep their visibility and touch geometry. */
html body.rdg-primary-shell #rdg-admin-monitor-pill,
html body.rdg-primary-shell #user-menu,
html body.rdg-primary-shell .rdg-monitor-panel {
  background: #162538 !important;
  border-color: #415774 !important;
  box-shadow: 0 8px 24px #0004 !important;
}
html body.rdg-primary-shell .rdg-monitor-rail-divider { opacity: .5; }
html body.rdg-primary-shell .rdg-marine-head,
html body.rdg-primary-shell .rdg-marine-switch,
html body.rdg-primary-shell .rdg-event-view-toggle {
  background: #162538 !important; border-color: #2a3b50 !important;
  box-shadow: none !important;
}

/* Size the magnified label to its text, not the whole grid column. */
html body.rdg-primary-shell [data-rdg-new-order-region].rdg-region-new-order .rdg-tesla-region-row-name {
  justify-self: start; max-width: 100%;
}
