:root {
  color-scheme: dark;
  font-family: 'Sora', system-ui, sans-serif;
  background: #08111f;
  color: #eef3fb;
  --bg: #08111f;
  --panel: #0d1628;
  --panel-2: #0a1322;
  --stroke: rgba(148, 176, 220, 0.16);
  --text: #eef3fb;
  --muted: #9eafc8;
  --accent: #d4b56a;
  --accent-2: #4d79d6;
  --accent-3: #6eb8d4;
  --glow: rgba(77, 121, 214, 0.08);
  --glow-2: rgba(212, 181, 106, 0.12);
  --glow-3: rgba(110, 184, 212, 0.1);
  --grid: rgba(255, 255, 255, 0.03);
  --accent-red: #ff3b3b;
  --glow-red: rgba(255, 59, 59, 0.14);
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 18% 0%, rgba(77, 121, 214, 0.12) 0%, transparent 42%),
    radial-gradient(circle at 82% 8%, rgba(212, 181, 106, 0.08) 0%, transparent 36%),
    linear-gradient(155deg, #0b1526 0%, #08111f 50%, #070e1a 100%);
  position: relative;
  min-height: 100vh;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(circle at 0 0, rgba(212, 181, 106, 0.04), transparent 50%),
    radial-gradient(circle at 100% 40%, rgba(77, 121, 214, 0.05), transparent 55%);
  opacity: 1;
  pointer-events: none;
  z-index: -2;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: none;
  opacity: 0;
  pointer-events: none;
  z-index: -1;
}

.app {
  max-width: 1480px;
  margin: 0 auto;
  padding: 28px;
  position: relative;
}

.portal-banner {
  margin-bottom: 16px;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid rgba(248, 113, 113, 0.42);
  background: linear-gradient(135deg, rgba(127, 29, 29, 0.5), rgba(69, 10, 10, 0.72));
  color: #fecaca;
  box-shadow: 0 12px 30px rgba(127, 29, 29, 0.22);
  font-weight: 600;
}

.portal-banner.info {
  border-color: rgba(96, 165, 250, 0.4);
  background: linear-gradient(135deg, rgba(30, 58, 138, 0.45), rgba(12, 18, 40, 0.78));
  color: #bfdbfe;
}

.portal-banner.warn {
  border-color: rgba(251, 191, 36, 0.45);
  background: linear-gradient(135deg, rgba(120, 53, 15, 0.45), rgba(41, 24, 12, 0.8));
  color: #fde68a;
}

.app::before,
.app::after {
  content: '';
  position: absolute;
  pointer-events: none;
  border-radius: 999px;
  filter: blur(60px);
  opacity: 0.7;
}

.app::before {
  width: 420px;
  height: 420px;
  background: var(--glow-2);
  top: -140px;
  right: -120px;
}

.app::after {
  width: 360px;
  height: 360px;
  background: var(--glow);
  bottom: 120px;
  left: -80px;
}

.app .ai-aura,
.app .scanline-aura {
  position: absolute;
  pointer-events: none;
  inset: auto;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding: 12px 16px;
  border-radius: 16px;
  background: linear-gradient(120deg, rgba(13, 21, 39, 0.9), rgba(10, 16, 32, 0.7));
  border: 1px solid rgba(44, 88, 255, 0.25);
  backdrop-filter: blur(8px);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.45);
  position: sticky;
  top: 16px;
  z-index: 3;
}

.topbar-leading {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  border-radius: 14px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.34), 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  flex-direction: column;
}

.topbar-icon span {
  width: 16px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  display: block;
}

.mobile-only {
  display: none;
}

.brand-wrap {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.brand {
  font-size: 19px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: 'Sora', system-ui, sans-serif;
  text-shadow: 0 0 18px rgba(44, 88, 255, 0.45);
}

.brand-sub {
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(191, 211, 246, 0.8);
}

.user-info {
  font-size: 14px;
  color: var(--muted);
}

.card {
  background: linear-gradient(160deg, rgba(13, 22, 40, 0.94), rgba(8, 14, 26, 0.9));
  border: 1px solid rgba(148, 176, 220, 0.12);
  border-radius: 16px;
  padding: 16px 18px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.35);
  animation: floatIn 0.45s ease both;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, rgba(255, 255, 255, 0.025), transparent 42%);
  pointer-events: none;
}

.card h3 {
  margin: 0 0 10px;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(238, 243, 251, 0.92);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.stream-status {
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(148, 163, 184, 0.12);
  color: #cbd5e1;
}

.stream-status.idle {
  border-color: rgba(148, 163, 184, 0.35);
  background: rgba(148, 163, 184, 0.1);
  color: #cbd5e1;
}

.stream-status.live {
  border-color: rgba(52, 211, 153, 0.55);
  background: rgba(16, 185, 129, 0.18);
  color: #6ee7b7;
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.22);
}

.stream-status.stale {
  border-color: rgba(248, 113, 113, 0.5);
  background: rgba(239, 68, 68, 0.16);
  color: #fca5a5;
}

#ai-chat-status {
  margin-top: 10px;
  min-height: 1.2em;
  color: #bfdbfe;
}

#ai-chat-status.is-fallback {
  color: #fde68a;
}

#ai-chat-status.is-cloud {
  color: #86efac;
}

.card::before {
  content: '';
  position: absolute;
  inset: 1px;
  border-radius: 16px;
  border: 1px solid rgba(246, 195, 68, 0.08);
  pointer-events: none;
  z-index: 1;
}

.card::after {
  content: '';
  position: absolute;
  inset: -40% auto auto -10%;
  width: 120px;
  height: 120px;
  background: radial-gradient(circle, rgba(246, 195, 68, 0.24), transparent 70%);
  transform: rotate(32deg);
  opacity: 0.5;
  pointer-events: none;
}

.card:hover {
  border-color: rgba(246, 195, 68, 0.45);
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.6), 0 0 22px rgba(246, 195, 68, 0.16);
}

.tone-blue {
  background: linear-gradient(150deg, rgba(6, 18, 36, 0.96), rgba(8, 30, 52, 0.84));
  border-color: rgba(56, 189, 248, 0.34);
}

.tone-cyan {
  background: linear-gradient(150deg, rgba(4, 22, 32, 0.96), rgba(6, 28, 42, 0.86));
  border-color: rgba(97, 243, 255, 0.36);
}

.tone-teal {
  background: linear-gradient(150deg, rgba(5, 24, 24, 0.96), rgba(8, 32, 34, 0.84));
  border-color: rgba(45, 212, 191, 0.32);
}

.tone-violet {
  background: linear-gradient(150deg, rgba(18, 14, 36, 0.96), rgba(26, 17, 55, 0.84));
  border-color: rgba(167, 139, 250, 0.3);
}

.tone-copper {
  background: linear-gradient(150deg, rgba(38, 22, 7, 0.96), rgba(26, 17, 12, 0.84));
  border-color: rgba(251, 191, 36, 0.32);
}

.tone-slate {
  background: linear-gradient(150deg, rgba(11, 16, 29, 0.96), rgba(18, 24, 38, 0.84));
  border-color: rgba(148, 163, 184, 0.26);
}

.tone-alert {
  background: linear-gradient(150deg, rgba(40, 10, 13, 0.96), rgba(28, 12, 18, 0.84));
  border-color: rgba(248, 113, 113, 0.34);
}

.tone-ai {
  background: linear-gradient(150deg, rgba(8, 16, 39, 0.96), rgba(8, 25, 54, 0.84));
  border-color: rgba(96, 165, 250, 0.34);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
  align-items: start;
}

.history-card {
  position: relative;
  isolation: isolate;
}

.history-card h3 {
  display: flex;
  align-items: center;
  gap: 8px;
}

.history-card h3::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin-left: 6px;
}

.vin-card {
  border-radius: 26px 26px 90px 26px;
  border: 1px solid rgba(94, 234, 255, 0.4);
  background: linear-gradient(145deg, rgba(5, 11, 24, 0.95), rgba(6, 14, 32, 0.7));
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6), inset 0 0 32px rgba(64, 159, 255, 0.12);
}

.vin-card::after {
  background: radial-gradient(circle at 80% 20%, rgba(94, 234, 255, 0.35), transparent 60%);
  opacity: 0.6;
}

.ai-card {
  border-radius: 24px;
  border-left: 3px solid var(--accent-2);
  padding-top: 26px;
  background: linear-gradient(140deg, rgba(4, 9, 22, 0.95), rgba(7, 15, 30, 0.75));
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.65), 0 0 24px rgba(44, 88, 255, 0.28);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ai-desk-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.ai-desk-sub {
  color: rgba(191, 211, 246, 0.8);
}

.ai-desk-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ai-tests-meta {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(220px, 0.8fr);
  gap: 14px;
}

.ai-tests-overview,
.ai-brief-shell {
  border-radius: 16px;
  border: 1px solid rgba(96, 165, 250, 0.24);
  background: rgba(6, 13, 28, 0.72);
  padding: 14px 16px;
}

.ai-tests-overview-title,
.ai-brief-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.ai-tests-overview-title strong,
.ai-brief-title strong {
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ai-tests-progress {
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(148, 163, 184, 0.15);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.ai-tests-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #61f3ff 0%, #2c58ff 55%, #f6c344 100%);
  box-shadow: 0 0 22px rgba(97, 243, 255, 0.35);
}

.ai-tests-progress-meta,
.ai-brief-summary {
  margin-top: 10px;
  color: rgba(226, 236, 255, 0.82);
  font-size: 12px;
  line-height: 1.5;
}

.ai-tests-code-row,
.dtc-analysis-chip-row,
.ai-brief-chip-row,
.ai-test-targets,
.ai-test-signals,
.ai-test-evidence,
.ai-test-result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ai-test-workflow {
  display: grid;
  gap: 14px;
}

.ai-test-card {
  border-radius: 18px;
  border: 1px solid rgba(96, 165, 250, 0.22);
  background: linear-gradient(150deg, rgba(7, 16, 36, 0.96), rgba(7, 13, 28, 0.82));
  padding: 16px;
  display: grid;
  gap: 12px;
  position: relative;
  overflow: hidden;
}

.ai-test-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 0%, rgba(97, 243, 255, 0.04) 36%, transparent 72%);
  pointer-events: none;
}

.ai-test-card.is-complete {
  border-color: rgba(52, 211, 153, 0.42);
}

.ai-test-card-head,
.ai-test-card-meta,
.ai-test-actions,
.ai-brief-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ai-test-card-head {
  align-items: flex-start;
}

.ai-test-card-title {
  display: grid;
  gap: 6px;
}

.ai-test-card-title strong {
  font-size: 17px;
}

.ai-test-card-copy {
  color: rgba(226, 236, 255, 0.82);
  line-height: 1.55;
  font-size: 13px;
}

.ai-tests-basis-copy {
  color: rgba(226, 236, 255, 0.88);
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 10px;
}

.ai-tests-snapshot-row,
.ai-test-setup {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.ai-test-driver-callout {
  border-radius: 14px;
  border: 1px solid rgba(246, 195, 68, 0.28);
  background: linear-gradient(145deg, rgba(43, 28, 8, 0.6), rgba(10, 16, 31, 0.78));
  color: #fff4cf;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.55;
}

.ai-test-maneuvers {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.ai-test-maneuver-step {
  border-radius: 14px;
  border: 1px solid rgba(96, 165, 250, 0.2);
  background: rgba(4, 11, 24, 0.72);
  padding: 12px;
  display: grid;
  gap: 4px;
}

.ai-test-maneuver-step strong {
  font-size: 13px;
  letter-spacing: 0.04em;
  color: #f8fbff;
}

.ai-test-maneuver-step span {
  color: rgba(151, 215, 255, 0.86);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.ai-test-stage {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(44, 88, 255, 0.14);
  border: 1px solid rgba(96, 165, 250, 0.32);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 11px;
}

.ai-test-instructions {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
  color: rgba(226, 236, 255, 0.88);
  font-size: 13px;
  line-height: 1.5;
}

.ai-test-note {
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(4, 10, 22, 0.7);
  color: var(--text);
  min-height: 72px;
  padding: 12px;
  resize: vertical;
}

.ai-test-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.ai-test-result {
  margin-top: 4px;
  border-radius: 14px;
  border: 1px solid rgba(96, 165, 250, 0.2);
  background: rgba(4, 11, 24, 0.68);
  padding: 12px;
  display: grid;
  gap: 8px;
}

.ai-brief-shell {
  display: grid;
  gap: 12px;
}

.ai-brief-headline-box {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(96, 165, 250, 0.28);
  border-left: 4px solid rgba(96, 165, 250, 0.82);
  background: linear-gradient(145deg, rgba(16, 27, 52, 0.86), rgba(7, 14, 28, 0.72));
}

.ai-brief-headline-label,
.ai-brief-item-kicker {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(148, 197, 255, 0.84);
}

.ai-brief-headline-box strong {
  font-size: 15px;
  line-height: 1.45;
  color: rgba(244, 248, 255, 0.96);
}

.ai-brief-summary-card {
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(6, 14, 28, 0.7);
  padding: 12px 14px;
}

.ai-brief-summary {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
  color: rgba(226, 236, 255, 0.9);
  font-size: 13px;
  line-height: 1.5;
}

.ai-brief-section {
  display: grid;
  gap: 10px;
}

.ai-brief-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.ai-brief-list {
  display: grid;
  gap: 8px;
  padding-top: 2px;
}

.ai-brief-list-item {
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(4, 11, 24, 0.68);
  padding: 12px;
  display: grid;
  gap: 6px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.ai-brief-list-item strong {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}

.ai-outcome-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}

.ai-outcome-icon.ok {
  background: rgba(16, 185, 129, 0.16);
  color: #6ee7b7;
}

.ai-outcome-icon.danger {
  background: rgba(239, 68, 68, 0.16);
  color: #fca5a5;
}

.ai-outcome-icon.neutral {
  background: rgba(148, 163, 184, 0.14);
  color: rgba(226, 232, 240, 0.9);
}

.button-row-compact {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.button-row-compact button {
  min-width: 108px;
}

.ai-card h3::after {
  display: none;
}

.ai-card .kv-list {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.ai-card .kv-item {
  border-radius: 14px;
  background: rgba(7, 17, 36, 0.85);
  border: 1px solid rgba(52, 134, 255, 0.32);
  box-shadow: inset 0 0 18px rgba(14, 26, 50, 0.65);
}

.ai-placeholder {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px dashed rgba(148, 176, 255, 0.5);
  background: rgba(5, 12, 24, 0.65);
  color: rgba(226, 236, 255, 0.85);
  font-size: 12px;
  line-height: 1.4;
}

.section-title {
  margin: 22px 2px 10px;
  font-size: 14px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(222, 236, 255, 0.95);
  font-family: 'Sora', system-ui, sans-serif;
  text-shadow: 0 0 10px rgba(246, 195, 68, 0.2);
}

.top-grid .card-mechanic {
  min-height: 260px;
}

.live-grid,
.history-grid,
.analytics-grid {
  margin-bottom: 20px;
}

.live-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.live-grid > .card {
  min-width: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.live-grid .card-live,
.live-grid .card-dtcs {
  grid-column: auto;
}

.live-grid .card-state-trace {
  grid-column: auto;
}

.history-grid {
  grid-template-columns: repeat(12, minmax(0, 1fr));
}

.history-card.drives-card {
  grid-column: span 4;
}

.history-card.vin-card {
  grid-column: span 8;
}

.history-card.drive-summary-card {
  grid-column: span 7;
}

.history-card.storyboard-card {
  grid-column: span 7;
}

.history-card.ai-card {
  grid-column: span 5;
}

.analytics-grid {
  grid-template-columns: repeat(12, minmax(0, 1fr));
}

.analytics-grid .card-charts {
  grid-column: 1 / -1;
}

.analytics-grid .card-focus {
  grid-column: span 5;
}

.analytics-grid .card:last-child {
  grid-column: span 7;
}

.hero {
  display: grid;
  grid-template-columns: minmax(260px, 0.82fr) minmax(0, 1.18fr);
  gap: 14px;
  margin-bottom: 18px;
  padding: 20px;
  border-radius: 30px 22px 26px 26px;
  background: linear-gradient(125deg, rgba(13, 21, 39, 0.95), rgba(10, 16, 32, 0.65));
  border: 1px solid rgba(246, 195, 68, 0.28);
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.5), 0 0 30px rgba(97, 243, 255, 0.08);
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 80% 20%, rgba(44, 88, 255, 0.18), transparent 55%),
    linear-gradient(90deg, transparent 0%, rgba(246, 195, 68, 0.08) 52%, transparent 100%);
  pointer-events: none;
}

.dashboard-shell {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  gap: 22px;
  align-items: flex-start;
}

.dashboard-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 100px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding-right: 6px;
  z-index: 2;
  isolation: isolate;
}

.dashboard-sidebar::-webkit-scrollbar {
  width: 10px;
}

.dashboard-sidebar::-webkit-scrollbar-track {
  background: rgba(8, 16, 32, 0.55);
  border-radius: 999px;
}

.dashboard-sidebar::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(77, 184, 255, 0.9), rgba(24, 74, 176, 0.78));
  border-radius: 999px;
  border: 2px solid rgba(8, 16, 32, 0.55);
}

body.sidebar-collapsed .dashboard-shell {
  grid-template-columns: 96px minmax(0, 1fr);
}

body.sidebar-collapsed .dashboard-sidebar {
  overflow: hidden;
}

body.sidebar-collapsed .sidebar-brand-title,
body.sidebar-collapsed .sidebar-brand-meta,
body.sidebar-collapsed .sidebar-link-sub,
body.sidebar-collapsed .sidebar-card-title,
body.sidebar-collapsed .sidebar-brand-identity,
body.sidebar-collapsed .sidebar-preview,
body.sidebar-collapsed .sidebar-label,
body.sidebar-collapsed .drive-health-meta {
  display: none;
}

body.sidebar-collapsed .sidebar-brand-panel,
body.sidebar-collapsed .sidebar-card,
body.sidebar-collapsed .sidebar-menu {
  padding-left: 12px;
  padding-right: 12px;
}

body.sidebar-collapsed .sidebar-link {
  align-items: center;
  text-align: center;
  padding: 14px 10px;
}

body.sidebar-collapsed .sidebar-link::before {
  display: none;
}

body.sidebar-collapsed .sidebar-link-title {
  font-size: 12px;
  line-height: 1.2;
}

body.sidebar-collapsed .sidebar-brand-lockup {
  justify-content: center;
}

body.sidebar-collapsed .sidebar-brand-mark {
  width: 44px;
  height: 44px;
}

body.sidebar-collapsed .sidebar-card.compact,
body.sidebar-collapsed .sidebar-card.sidebar-score {
  padding-top: 14px;
  padding-bottom: 14px;
}

body.sidebar-collapsed .drive-health-wrap,
body.sidebar-collapsed .sidebar-score .drive-health-wrap {
  gap: 0;
}

body.sidebar-collapsed .drive-health-circle {
  width: 72px;
  height: 72px;
}

body.sidebar-collapsed .drive-health-label,
body.sidebar-collapsed .drive-health-grade {
  display: none;
}

body.mobile-sidebar-open {
  overflow: hidden;
}

body.mobile-sidebar-open::before {
  content: '';
  position: fixed;
  inset: 0;
  background: rgba(3, 10, 20, 0.68);
  z-index: 4;
}

.dashboard-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

/* Sticky Master Mechanic dock ? always reachable at top of portal view */
.ai-dock {
  position: sticky;
  top: 12px;
  z-index: 40;
  padding: 14px 16px 12px;
  border: 1px solid rgba(96, 165, 250, 0.28);
  background:
    linear-gradient(155deg, rgba(8, 18, 36, 0.97), rgba(12, 28, 52, 0.94)),
    radial-gradient(circle at top right, rgba(77, 184, 255, 0.12), transparent 42%);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}
.ai-dock-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.ai-dock-kicker {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #93c5fd;
  margin-bottom: 2px;
}
.ai-dock-sub {
  margin: 4px 0 0;
  font-size: 12px;
  color: #94a3b8;
  max-width: 62ch;
}
.ai-dock-messages {
  max-height: min(42vh, 320px);
  margin-bottom: 8px;
  overflow-y: auto;
}
.ai-dock-compose {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "photo name name"
    "input input send";
  gap: 8px;
  align-items: end;
}
.ai-dock-compose #ai-chat-photo-btn { grid-area: photo; }
.ai-dock-photo-name {
  grid-area: name;
  color: #93c5fd;
  align-self: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ai-dock-compose #ai-chat-input {
  grid-area: input;
  width: 100%;
  resize: vertical;
  min-height: 52px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(2, 8, 18, 0.72);
  color: var(--text);
  padding: 10px 12px;
  font: inherit;
}
.ai-dock-compose #ai-chat-send {
  grid-area: send;
  align-self: stretch;
}
@media (max-width: 720px) {
  .ai-dock { top: 6px; }
  .ai-dock-compose {
    grid-template-columns: 1fr;
    grid-template-areas:
      "photo"
      "name"
      "input"
      "send";
  }
}

.sidebar-brand-panel {
  border-radius: 24px;
  padding: 20px 18px;
  background:
    linear-gradient(160deg, rgba(3, 9, 20, 0.99), rgba(8, 18, 35, 0.95) 52%, rgba(9, 26, 49, 0.92)),
    radial-gradient(circle at top right, rgba(77, 184, 255, 0.14), transparent 38%);
  border: 1px solid rgba(96, 165, 250, 0.24);
  box-shadow: 0 26px 62px rgba(0, 0, 0, 0.62), inset 0 0 0 1px rgba(255, 255, 255, 0.04), 0 0 30px rgba(96, 165, 250, 0.08), inset 0 -24px 48px rgba(2, 7, 18, 0.38);
  position: relative;
  overflow: hidden;
}

.sidebar-brand-panel::before {
  content: '';
  position: absolute;
  left: 18px;
  right: 18px;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, rgba(77, 184, 255, 0), rgba(77, 184, 255, 0.75), rgba(77, 184, 255, 0));
  pointer-events: none;
}

.sidebar-brand-panel::after {
  content: '';
  position: absolute;
  inset: auto -24% -30% auto;
  width: 180px;
  height: 180px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(86, 195, 255, 0.18), transparent 68%);
  opacity: 0.7;
  pointer-events: none;
}

.sidebar-brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.sidebar-brand-mark {
  width: 54px;
  height: 54px;
  flex: 0 0 auto;
  border-radius: 16px;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.44), 0 0 0 1px rgba(255, 255, 255, 0.08), 0 0 22px rgba(77, 184, 255, 0.12);
}

.sidebar-brand-identity {
  min-width: 0;
}

.sidebar-brand-name {
  font-family: 'Sora', system-ui, sans-serif;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #eef6ff;
}

.sidebar-brand-system {
  font-size: 10px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: rgba(133, 177, 224, 0.72);
  text-shadow: 0 0 12px rgba(77, 184, 255, 0.16);
}

.sidebar-brand-kicker {
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: rgba(110, 196, 255, 0.88);
  margin-bottom: 10px;
}

.sidebar-brand-title {
  font-size: 19px;
  line-height: 1.35;
  font-family: 'Sora', system-ui, sans-serif;
  font-weight: 700;
  letter-spacing: 0.015em;
  color: rgba(243, 248, 255, 0.97);
  margin-bottom: 14px;
  max-width: 14ch;
}

.sidebar-brand-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sidebar-meta-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(96, 165, 250, 0.24);
  background: rgba(5, 16, 32, 0.78);
  color: rgba(221, 238, 255, 0.88);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03), 0 0 14px rgba(77, 184, 255, 0.05);
}

.sidebar-score {
  backdrop-filter: blur(12px);
}

.hero-cluster {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(300px, 0.82fr);
  gap: 18px;
  align-items: start;
  margin-bottom: 16px;
}

.hero-command-deck {
  min-height: 560px;
}

.mechanic-float {
  position: sticky;
  top: 96px;
  align-self: flex-start;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.65), 0 10px 40px rgba(44, 88, 255, 0.25);
}

.mechanic-float .chat-messages {
  max-height: 320px;
}

.sidebar-card {
  border-radius: 22px;
  padding: 18px;
  background: linear-gradient(165deg, rgba(4, 9, 20, 0.95), rgba(9, 18, 36, 0.9));
  border: 1px solid rgba(59, 130, 246, 0.36);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 28px rgba(59, 130, 246, 0.22), 0 0 20px rgba(97, 243, 255, 0.08);
  position: relative;
  overflow: hidden;
}

.sidebar-card::after {
  content: '';
  position: absolute;
  inset: auto auto -40% -20%;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(94, 234, 212, 0.16), transparent 70%);
  pointer-events: none;
}

.sidebar-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 10px;
}

.sidebar-label {
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(203, 244, 255, 0.9);
}

.sidebar-pill {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(94, 234, 212, 0.45);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #9fffe2;
  background: rgba(15, 118, 110, 0.2);
  box-shadow: 0 0 12px rgba(94, 234, 212, 0.35);
}

.sidebar-menu {
  counter-reset: sidebar-nav;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  border-radius: 22px;
  border: 1px solid rgba(75, 118, 191, 0.22);
  background:
    linear-gradient(180deg, rgba(4, 10, 22, 0.99), rgba(9, 16, 31, 0.95)),
    linear-gradient(135deg, rgba(62, 116, 255, 0.06), transparent 48%, rgba(74, 222, 255, 0.04));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03), inset 0 0 26px rgba(18, 42, 90, 0.18), 0 18px 42px rgba(0, 0, 0, 0.42);
  position: relative;
  overflow: visible;
}

.sidebar-menu::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 26%, transparent 74%, rgba(77, 184, 255, 0.05));
  pointer-events: none;
}

.sidebar-link {
  counter-increment: sidebar-nav;
  width: 100%;
  border-radius: 18px;
  border: 1px solid rgba(92, 124, 174, 0.18);
  background:
    linear-gradient(180deg, rgba(8, 15, 29, 0.99), rgba(10, 19, 36, 0.95)),
    linear-gradient(90deg, rgba(74, 222, 255, 0.03), transparent 42%, rgba(61, 140, 255, 0.04));
  color: var(--text);
  padding: 14px 16px 14px 54px;
  text-align: left;
  display: grid;
  gap: 4px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03), 0 12px 24px rgba(0, 0, 0, 0.24);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.sidebar-link::before {
  content: counter(sidebar-nav, decimal-leading-zero);
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  border: 1px solid rgba(108, 150, 214, 0.22);
  background: linear-gradient(180deg, rgba(11, 23, 42, 0.98), rgba(8, 16, 30, 0.94));
  color: rgba(158, 193, 235, 0.7);
  font-family: 'IBM Plex Mono', 'Consolas', monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03), 0 0 14px rgba(74, 222, 255, 0.04);
  transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.sidebar-link::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, rgba(99, 154, 255, 0.08), transparent 38%, rgba(74, 222, 255, 0.1) 100%);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.sidebar-link:focus-visible {
  outline: none;
}

.sidebar-link:hover,
.sidebar-link:focus-visible {
  border-color: rgba(103, 164, 241, 0.34);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04), 0 16px 30px rgba(0, 0, 0, 0.3), 0 0 20px rgba(74, 222, 255, 0.06);
  transform: translateY(-1px);
}

.sidebar-link:hover::after,
.sidebar-link:focus-visible::after {
  opacity: 1;
}

.sidebar-link.is-active {
  border-color: rgba(116, 191, 255, 0.4);
  background:
    linear-gradient(180deg, rgba(11, 23, 42, 0.99), rgba(10, 21, 41, 0.96)),
    linear-gradient(90deg, rgba(87, 165, 255, 0.09), transparent 48%, rgba(74, 222, 255, 0.06));
  box-shadow: 0 0 0 1px rgba(92, 177, 255, 0.14), 0 16px 34px rgba(0, 0, 0, 0.36), 0 0 18px rgba(74, 222, 255, 0.06), inset 3px 0 0 rgba(122, 205, 255, 0.8);
  transform: translateY(-1px);
}

.sidebar-link.is-active::before,
.sidebar-link:hover::before,
.sidebar-link:focus-visible::before {
  border-color: rgba(124, 201, 255, 0.36);
  color: #e9f5ff;
  background: linear-gradient(180deg, rgba(13, 29, 55, 1), rgba(9, 20, 38, 0.97));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03), 0 0 16px rgba(74, 222, 255, 0.08);
}

.sidebar-link.is-active .sidebar-link-title {
  color: #f8fbff;
}

.sidebar-link-title {
  position: relative;
  z-index: 1;
  font-size: 14px;
  line-height: 1.2;
  font-weight: 700;
  font-family: 'Sora', system-ui, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: rgba(241, 247, 255, 0.95);
  text-shadow: 0 0 10px rgba(77, 184, 255, 0.08);
}

.sidebar-link-sub {
  position: relative;
  z-index: 1;
  font-size: 10px;
  line-height: 1.55;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(156, 184, 219, 0.7);
}

.sidebar-card-title {
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(200, 230, 255, 0.78);
  margin-bottom: 8px;
}

.sidebar-preview {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-preview strong {
  font-size: 16px;
  color: var(--text);
}

.sidebar-preview span {
  font-size: 13px;
  color: rgba(183, 210, 242, 0.85);
}

.sidebar-card.compact {
  padding: 16px;
}

.sidebar-assist-card {
  gap: 12px;
}

.sidebar-assist-card .sidebar-preview {
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(8, 17, 32, 0.72);
  border: 1px solid rgba(94, 234, 212, 0.14);
}

.sidebar-assist-card .sidebar-preview strong {
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.overview-ribbon {
  display: grid;
  grid-template-columns: minmax(240px, 0.78fr) minmax(0, 2.22fr);
  gap: 14px;
  align-items: stretch;
}

.card-overview-story {
  min-height: 164px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-radius: 28px 18px 22px 22px;
  background: linear-gradient(135deg, rgba(12, 20, 40, 0.96), rgba(8, 14, 29, 0.88));
}

.overview-kicker {
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(246, 195, 68, 0.92);
  margin-bottom: 10px;
}

.overview-title {
  font-size: 24px;
  line-height: 1.08;
  font-weight: 700;
  margin-bottom: 12px;
  max-width: 11ch;
}

.overview-copy {
  font-size: 13px;
  line-height: 1.45;
  color: rgba(206, 220, 245, 0.84);
  max-width: 26ch;
}

.overview-tile-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.overview-tile {
  min-height: 86px;
  border-radius: 22px;
  padding: 18px;
  background: linear-gradient(145deg, rgba(7, 15, 30, 0.94), rgba(12, 22, 43, 0.84));
  border: 1px solid rgba(59, 130, 246, 0.24);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  position: relative;
  overflow: hidden;
}

.overview-tile::after {
  content: '';
  position: absolute;
  inset: auto -18% -30% auto;
  width: 110px;
  height: 110px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.12), transparent 68%);
  opacity: 0.35;
  pointer-events: none;
}

.overview-tile-wide {
  grid-column: span 2;
}

.overview-tile-accent {
  border-color: rgba(246, 195, 68, 0.32);
  background: linear-gradient(145deg, rgba(25, 18, 7, 0.92), rgba(13, 21, 39, 0.88));
}

.overview-tile-label {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(184, 203, 230, 0.78);
}

.overview-tile strong {
  font-family: 'Sora', system-ui, sans-serif;
  font-size: 20px;
  color: #f8fbff;
}

.overview-tile-sub {
  font-size: 12px;
  color: rgba(193, 213, 238, 0.78);
  line-height: 1.4;
}

.workspace-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mode-control-bar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 10px 12px 10px 10px;
  margin: 0 0 16px;
  position: sticky;
  top: 8px;
  z-index: 40;
  border-radius: 20px;
  border: 1px solid rgba(148, 176, 220, 0.14);
  background:
    linear-gradient(135deg, rgba(12, 20, 36, 0.92), rgba(8, 14, 26, 0.88)),
    radial-gradient(circle at 12% 50%, rgba(77, 121, 214, 0.12), transparent 55%);
  box-shadow:
    0 18px 40px rgba(2, 8, 18, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(14px);
}

.mode-toggle {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 5px;
  border-radius: 16px;
  background: rgba(4, 10, 20, 0.72);
  border: 1px solid rgba(148, 176, 220, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
  min-width: 280px;
}

.mode-tab {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  text-align: left;
  padding: 10px 14px;
  border-radius: 12px;
  cursor: pointer;
  transition: color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.mode-tab:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
}

.mode-tab-glow {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
  z-index: -1;
}

.mode-tab-copy {
  display: grid;
  gap: 1px;
  line-height: 1.15;
}

.mode-tab-copy strong {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.mode-tab-copy small {
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.72;
}

.mode-tab-dot,
.mode-tab-icon {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: rgba(158, 175, 200, 0.45);
  box-shadow: 0 0 0 3px rgba(158, 175, 200, 0.08);
}

.mode-tab-icon {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 6px;
  font-size: 0.72rem;
  line-height: 1;
  background: rgba(158, 175, 200, 0.12);
  color: inherit;
  box-shadow: none;
}

#mode-tab-live.is-active {
  color: #061018;
  transform: translateY(-1px);
}

#mode-tab-live.is-active .mode-tab-glow {
  opacity: 1;
  background:
    linear-gradient(135deg, #7ee0ff 0%, #4d79d6 48%, #2f5fb8 100%);
  box-shadow:
    0 10px 28px rgba(77, 121, 214, 0.45),
    0 0 24px rgba(110, 184, 212, 0.35);
}

#mode-tab-live.is-active .mode-tab-dot {
  background: #e8fbff;
  box-shadow:
    0 0 0 4px rgba(232, 251, 255, 0.22),
    0 0 12px rgba(126, 224, 255, 0.9);
  animation: mode-live-pulse 1.6s ease-in-out infinite;
}

#mode-tab-history.is-active {
  color: #120e06;
  transform: translateY(-1px);
}

#mode-tab-history.is-active .mode-tab-glow {
  opacity: 1;
  background:
    linear-gradient(135deg, #ffe7a8 0%, #d4b56a 52%, #b8923f 100%);
  box-shadow:
    0 10px 28px rgba(212, 181, 106, 0.42),
    0 0 22px rgba(232, 205, 134, 0.28);
}

#mode-tab-history.is-active .mode-tab-icon {
  background: rgba(18, 14, 6, 0.16);
  color: #120e06;
}

@keyframes mode-live-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.18); opacity: 0.82; }
}

.mode-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(140px, 1fr));
  gap: 10px;
  align-items: end;
}

.mode-drive-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mode-drive-actions .ghost.compact,
.drive-cleanup-bar .ghost.compact,
button.ghost.compact {
  padding: 7px 12px;
  font-size: 0.78rem;
  border-radius: 10px;
}

.drive-cleanup-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.drive-cleanup-status {
  margin-top: 8px;
  min-height: 1.2em;
  color: var(--muted);
}

button.danger-ghost,
.cockpit button.danger-ghost {
  border: 1px solid rgba(255, 99, 132, 0.45);
  background: rgba(255, 70, 100, 0.12);
  color: #ffb4c0;
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
}

button.danger-ghost:hover,
.cockpit button.danger-ghost:hover {
  background: rgba(255, 70, 100, 0.22);
}

.hud-mil-cluster {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.mil-lamp-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  border: 1px solid rgba(148, 176, 220, 0.28);
  background: rgba(12, 22, 40, 0.88);
  color: #c5d4e8;
}

.mil-lamp-pill.mil-on {
  border-color: rgba(255, 80, 90, 0.75);
  background: rgba(180, 20, 40, 0.55);
  color: #ffe4e8;
}

.mil-lamp-pill.mil-off {
  border-color: rgba(60, 200, 120, 0.55);
  background: rgba(20, 90, 55, 0.45);
  color: #d4ffe6;
}

.mil-lamp-pill.mil-unknown {
  opacity: 0.85;
}

button.mil-reset-btn,
.cockpit button.mil-reset-btn,
#clear-dtcs-btn.mil-reset-btn,
#clear-dtcs-btn-bay.mil-reset-btn {
  appearance: none;
  border: 1px solid rgba(255, 60, 70, 0.85);
  background: linear-gradient(180deg, #ff3b4a 0%, #c41028 100%);
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-size: 0.78rem;
  padding: 10px 14px;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 6px 0 #7a0c18, 0 10px 18px rgba(180, 0, 30, 0.35);
  transform: translateY(0);
}

button.mil-reset-btn:hover,
.cockpit button.mil-reset-btn:hover {
  filter: brightness(1.06);
}

button.mil-reset-btn:active,
.cockpit button.mil-reset-btn:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #7a0c18, 0 4px 10px rgba(180, 0, 30, 0.3);
}

button.mil-reset-btn:disabled,
.cockpit button.mil-reset-btn:disabled {
  opacity: 0.55;
  cursor: wait;
  transform: none;
  box-shadow: 0 3px 0 #7a0c18;
}

.mil-bay-actions {
  margin-top: 10px;
}

.mil-bay-actions .mil-reset-btn {
  width: 100%;
}

.manage-drives-dialog {
  width: min(560px, calc(100vw - 28px));
  max-height: min(78vh, 720px);
  border: 1px solid rgba(148, 176, 220, 0.22);
  border-radius: 18px;
  padding: 0;
  background: rgba(8, 14, 26, 0.96);
  color: var(--text);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.manage-drives-dialog::backdrop {
  background: rgba(2, 6, 14, 0.72);
}

.manage-drives-form {
  display: grid;
  gap: 12px;
  padding: 16px 18px 18px;
}

.manage-drives-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.manage-drives-head h3 {
  margin: 0 0 4px;
  font-size: 1.05rem;
}

.manage-drives-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.manage-drives-check-all {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.86rem;
}

.manage-drives-list {
  display: grid;
  gap: 6px;
  max-height: min(42vh, 360px);
  overflow: auto;
  padding: 4px 2px;
}

.manage-drives-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(148, 176, 220, 0.14);
  background: rgba(6, 12, 22, 0.55);
}

.manage-drives-item strong {
  display: block;
  font-size: 0.9rem;
}

.manage-drives-item small {
  color: var(--muted);
}

.manage-drives-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

@media (min-width: 900px) {
  .mode-controls {
    grid-template-columns: minmax(160px, 1fr) minmax(220px, 1.4fr) auto;
  }

  .mode-drive-actions {
    grid-column: auto;
    flex-direction: column;
    align-items: stretch;
  }
}

.mode-field {
  display: grid;
  gap: 5px;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.mode-field select {
  width: 100%;
  min-width: 0;
  border-radius: 12px;
  border: 1px solid rgba(148, 176, 220, 0.16);
  background: rgba(6, 12, 22, 0.72);
  color: var(--text);
  padding: 10px 12px;
}

.mode-status {
  display: grid;
  gap: 4px;
  justify-items: end;
  text-align: right;
  min-width: 110px;
}

.mode-load-status {
  min-height: 1.1em;
  font-size: 0.76rem;
  color: var(--accent-strong, #e8cd86);
}

.portal-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: grid;
  place-items: center;
  background: rgba(6, 11, 20, 0.72);
  backdrop-filter: blur(4px);
}

.portal-loading-overlay.hidden {
  display: none;
}

.portal-loading-card {
  display: grid;
  gap: 8px;
  justify-items: center;
  text-align: center;
  min-width: min(320px, 86vw);
  padding: 22px 24px;
  border-radius: 18px;
  border: 1px solid var(--stroke);
  background: linear-gradient(160deg, #0d1628, #0a1322);
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.45);
}

.portal-loading-spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid rgba(148, 176, 220, 0.2);
  border-top-color: var(--accent);
  animation: portal-spin 0.8s linear infinite;
}

.portal-loading-progress {
  width: min(260px, 72vw);
  height: 10px;
  border-radius: 999px;
  background: rgba(148, 176, 220, 0.16);
  overflow: hidden;
  border: 1px solid rgba(148, 176, 220, 0.22);
}

.portal-loading-bar {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #d4b56a, #6eb8d4 55%, #4d79d6);
  transition: width 0.18s ease-out;
}

.portal-loading-progress.is-indeterminate .portal-loading-bar {
  width: 38% !important;
  animation: portal-progress-pulse 1.1s ease-in-out infinite;
}

.portal-loading-pct {
  min-height: 1em;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  color: var(--accent-strong, #e8cd86);
  letter-spacing: 0.02em;
}

@keyframes portal-progress-pulse {
  0% { transform: translateX(-40%); }
  50% { transform: translateX(160%); }
  100% { transform: translateX(-40%); }
}

@keyframes portal-spin {
  to { transform: rotate(360deg); }
}

body.portal-busy .dashboard-main {
  opacity: 0.72;
  pointer-events: none;
}

body.workspace-history #live-drive-deck .hero-kicker,
body.workspace-history #live-board-mode {
  color: var(--accent);
}

.drive-modes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.drive-mode-card {
  display: grid;
  gap: 8px;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid var(--stroke);
  background: linear-gradient(160deg, #101a2c, #0c1524);
}

.drive-mode-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.drive-mode-card-head strong {
  font-size: 15px;
  letter-spacing: 0.01em;
}

.drive-mode-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.drive-mode-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.drive-mode-steps li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  color: #c5d4e8;
  line-height: 1.35;
}

.drive-mode-step-num {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  font-size: 10px;
  font-weight: 700;
  color: #0b1220;
  background: linear-gradient(135deg, #3ddbd9, #61f3ff);
}

.drive-mode-cta {
  margin-top: 4px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(97, 243, 255, 0.85);
}

.drive-modes-runs {
  margin-top: 8px;
}

.pid-chart-empty {
  min-height: 110px;
  display: grid;
  place-items: center;
  color: #9fb3c8;
  font-size: 12px;
}

@media (max-width: 900px) {
  .mode-control-bar {
    grid-template-columns: 1fr;
    position: static;
  }
  .mode-status {
    justify-items: start;
    text-align: left;
  }
}

.workspace-section-live .section-head,
.workspace-section-history .section-head,
.workspace-section-graphs .section-head {
  position: relative;
  padding-left: 18px;
}

.workspace-section-live .section-head::before,
.workspace-section-history .section-head::before,
.workspace-section-graphs .section-head::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 4px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(97, 243, 255, 0.92), rgba(44, 88, 255, 0.4));
  box-shadow: 0 0 18px rgba(97, 243, 255, 0.2);
}

.workspace-section-history .section-head::before {
  background: linear-gradient(180deg, rgba(251, 191, 36, 0.92), rgba(245, 158, 11, 0.35));
  box-shadow: 0 0 18px rgba(251, 191, 36, 0.18);
}

.workspace-section-graphs .section-head::before {
  background: linear-gradient(180deg, rgba(167, 139, 250, 0.92), rgba(96, 165, 250, 0.35));
  box-shadow: 0 0 18px rgba(167, 139, 250, 0.18);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.section-copy {
  display: block;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  border-radius: 0;
  font-size: 0.86rem;
  line-height: 1.4;
  letter-spacing: 0.01em;
  text-transform: none;
  color: var(--muted);
  max-width: 42rem;
}

.status-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 18px;
  padding: 12px 16px;
  margin-bottom: 12px;
  border-radius: 16px;
}

.tone-blue,
.tone-cyan,
.tone-teal,
.tone-violet,
.tone-copper,
.tone-slate,
.tone-alert,
.tone-ai {
  border-color: rgba(148, 176, 220, 0.12);
}

.hero-left {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 2px 4px 0;
}

.hero-status-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
}

.hero-status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(97, 243, 255, 0.26);
  background: rgba(5, 18, 33, 0.68);
  color: rgba(224, 244, 255, 0.88);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero-status-chip.chip-route {
  border-color: rgba(97, 243, 255, 0.34);
  box-shadow: 0 0 18px rgba(97, 243, 255, 0.12);
}

.hero-status-chip.chip-ai {
  border-color: rgba(96, 165, 250, 0.34);
  box-shadow: 0 0 18px rgba(96, 165, 250, 0.12);
}

.hero-status-chip.chip-health {
  border-color: rgba(251, 191, 36, 0.34);
  box-shadow: 0 0 18px rgba(251, 191, 36, 0.12);
}

.drive-health-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.sidebar-score .drive-health-wrap {
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.sidebar-score .drive-health-meta {
  text-align: center;
  max-width: 220px;
}

.drive-health-circle {
  --health-fill: 0%;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  display: grid;
  justify-items: center;
  align-content: center;
  text-align: center;
  background:
    radial-gradient(circle at 50% 50%, rgba(9, 18, 30, 0.96) 56%, transparent 57%),
    conic-gradient(rgba(246, 195, 68, 0.95) var(--health-fill), rgba(40, 66, 94, 0.35) var(--health-fill));
  border: 1px solid rgba(246, 195, 68, 0.45);
  box-shadow: 0 0 28px rgba(246, 195, 68, 0.28), inset 0 0 20px rgba(56, 189, 248, 0.12);
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.drive-health-circle:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 34px rgba(246, 195, 68, 0.42), inset 0 0 24px rgba(56, 189, 248, 0.18);
}

.drive-health-circle .drive-health-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: rgba(171, 219, 246, 0.9);
}

.drive-health-circle strong {
  margin-top: 3px;
  font-family: 'Sora', system-ui, sans-serif;
  font-size: 36px;
  color: #fff7de;
  line-height: 1;
}

.drive-health-grade {
  margin-top: 3px;
  font-size: 10px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: rgba(246, 195, 68, 0.95);
}

.drive-health-meta {
  max-width: 260px;
  color: rgba(191, 222, 243, 0.9);
}

.drive-health-circle.is-good {
  border-color: rgba(34, 197, 94, 0.58);
}

.drive-health-circle.is-mid {
  border-color: rgba(246, 195, 68, 0.62);
}

.drive-health-circle.is-poor {
  border-color: rgba(239, 68, 68, 0.7);
  box-shadow: 0 0 34px rgba(239, 68, 68, 0.35), inset 0 0 20px rgba(246, 195, 68, 0.08);
}

.hero-kicker {
  color: var(--accent-2);
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.24em;
}

.hero-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  font-family: 'Sora', system-ui, sans-serif;
}

.hero-sub {
  color: var(--muted);
  font-size: 15px;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--text);
  font-size: 13px;
}

.hero-right {
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  border-radius: 24px 24px 30px 24px;
  border: 1px solid rgba(44, 88, 255, 0.22);
  padding: 14px;
  background: linear-gradient(150deg, rgba(7, 14, 28, 0.92), rgba(12, 24, 45, 0.85));
  min-height: 0;
}

.hero-map-frame {
  position: relative;
  height: 320px;
  border-radius: 28px;
  overflow: hidden;
  border: 1px solid rgba(94, 234, 212, 0.35);
  box-shadow: 0 25px 45px rgba(0, 0, 0, 0.55), 0 0 36px rgba(94, 234, 212, 0.18), inset 0 0 28px rgba(97, 243, 255, 0.05);
  background: radial-gradient(circle at 30% 20%, rgba(94, 234, 212, 0.12), transparent 60%),
    linear-gradient(120deg, rgba(3, 6, 14, 0.9), rgba(8, 16, 30, 0.85));
}

.hero-map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
  filter: saturate(1.05) contrast(1.05);
}

.hero-map-overlay {
  position: absolute;
  top: 14px;
  left: 14px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(213, 246, 255, 0.9);
  background: rgba(2, 6, 16, 0.6);
  border: 1px solid rgba(94, 234, 212, 0.4);
  z-index: 2;
}

.hero-map-overlay.is-drive {
  color: rgba(254, 240, 138, 0.96);
  background: rgba(56, 30, 4, 0.72);
  border-color: rgba(246, 195, 68, 0.68);
}

.hero-map-overlay.is-idle {
  color: rgba(255, 237, 213, 0.95);
  background: rgba(80, 36, 8, 0.65);
  border-color: rgba(249, 115, 22, 0.7);
}

.hero-upload-inline {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.hero-upload-inline button {
  padding: 7px 10px;
  font-size: 12px;
}

.hero-upload-inline .small {
  font-size: 11px;
}

.hero-primary-gauges {
  margin-top: 8px;
  padding: 14px;
  border-radius: 22px 16px 24px 16px;
  max-width: 420px;
}

.hero-primary-gauges .card-head h3 {
  font-size: 15px;
  margin: 0;
}

.hero-primary-gauges .gauge-grid {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.hero-primary-gauges .gauge-card {
  padding: 8px 6px 12px;
  border-radius: 18px;
}

.hero-primary-gauges .gauge-card canvas {
  width: 180px;
  height: 180px;
}

.hero-primary-gauges .gauge-value {
  font-size: 18px;
}

.hero-gauge-rail {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 6px 4px;
  border-radius: 20px;
  border: 1px solid rgba(44, 88, 255, 0.25);
  background: linear-gradient(180deg, rgba(10, 18, 30, 0.65), rgba(5, 10, 20, 0.45));
}

.live-grid .card-live,
.history-card.drives-card,
.analytics-grid .card:last-child {
  border-radius: 30px 18px 24px 24px;
}

.live-grid .card-timeline,
.history-card.drive-summary-card,
.analytics-grid .card-focus {
  border-radius: 20px 30px 24px 24px;
}

.live-grid .card-state-trace,
.history-card.ai-card,
.card-mechanic {
  border-radius: 24px 24px 30px 18px;
}

.live-grid .card-dtcs,
.history-card.storyboard-card,
.analytics-grid .card-charts {
  border-radius: 26px;
}

.mini-gauge {
  --fill: 0%;
  position: relative;
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 8px 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(70, 120, 165, 0.66);
  background:
    radial-gradient(circle at 50% 6%, rgba(56, 189, 248, 0.22), transparent 45%),
    linear-gradient(160deg, rgba(6, 18, 31, 0.95), rgba(5, 12, 23, 0.92));
}

.mini-gauge::before {
  content: '';
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: conic-gradient(rgba(56, 189, 248, 0.95) var(--fill), rgba(48, 74, 104, 0.35) var(--fill));
  display: block;
  margin-bottom: 3px;
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.25);
}

.mini-gauge:nth-child(2n)::before,
.mini-gauge:nth-child(5)::before {
  background: conic-gradient(rgba(246, 195, 68, 0.95) var(--fill), rgba(92, 78, 44, 0.35) var(--fill));
  box-shadow: 0 0 14px rgba(246, 195, 68, 0.28);
}

.mini-gauge:nth-child(2n) {
  border-color: rgba(246, 195, 68, 0.45);
}

.mini-gauge::after {
  content: '';
  position: absolute;
  top: 16px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(4, 13, 24, 0.92);
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.mini-gauge-label,
.mini-gauge-unit {
  position: relative;
  z-index: 1;
  font-size: 10px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: rgba(165, 224, 250, 0.85);
}

.mini-gauge strong {
  position: relative;
  z-index: 1;
  margin-top: -48px;
  font-family: 'Sora', system-ui, sans-serif;
  font-size: 14px;
  color: #e9f8ff;
}

.hero-photo-mini {
  position: absolute;
  right: 14px;
  bottom: 14px;
  width: 190px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(246, 195, 68, 0.45);
  background: linear-gradient(140deg, rgba(5, 11, 22, 0.9), rgba(12, 20, 38, 0.95));
  box-shadow: 0 18px 35px rgba(0, 0, 0, 0.55);
}

.hero-photo-mini .hero-image {
  min-height: 120px;
  height: 120px;
}

.hero-photo-mini .hero-upload {
  margin: 6px;
  gap: 6px;
}

.hero-right.image-failed::after {
  content: 'Vehicle image unavailable';
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  background: linear-gradient(120deg, rgba(12, 17, 26, 0.85), rgba(17, 22, 33, 0.9));
}

.hero-image {
  width: 100%;
  height: 100%;
  min-height: 220px;
  object-fit: cover;
  filter: saturate(1.2) contrast(1.05);
}

.hero-upload {
  margin: 8px 10px 10px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.row {
  display: flex;
  flex-direction: column;
  margin-bottom: 12px;
  gap: 6px;
}

label {
  font-size: 13px;
  color: var(--muted);
}

input, select, button {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--stroke);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

select option {
  color: #0a0d16;
  background: #f2f4f9;
}

input[type='range'] {
  padding: 0;
  height: 6px;
  accent-color: var(--accent);
}

button {
  cursor: pointer;
  background: linear-gradient(120deg, var(--accent), #ffe08c);
  border: none;
  font-weight: 700;
  color: #0a0d16;
  box-shadow: 0 8px 24px rgba(246, 195, 68, 0.18);
}

button.sidebar-link {
  font: inherit;
}

button.ghost {
  background: transparent;
  border: 1px solid rgba(44, 88, 255, 0.6);
  color: var(--text);
  box-shadow: 0 0 24px rgba(44, 88, 255, 0.12);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(246, 195, 68, 0.7);
  box-shadow: 0 0 0 2px rgba(246, 195, 68, 0.15);
}

.actions {
  display: flex;
  gap: 10px;
}

.login-helper {
  margin-top: 12px;
}

.login-helper a {
  color: rgba(97, 243, 255, 0.9);
  text-decoration: none;
}

.login-helper a:hover {
  color: #ffffff;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.metric {
  background: linear-gradient(145deg, rgba(10, 16, 32, 0.96), rgba(14, 25, 46, 0.78));
  border-radius: 8px;
  padding: 10px;
  border: 1px solid rgba(68, 87, 125, 0.55);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.metric span {
  display: block;
  font-size: 11px;
  color: var(--muted);
}

.metric strong {
  font-size: 18px;
  color: var(--text);
}

.map {
  width: 100%;
  height: 320px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(44, 88, 255, 0.35);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.55);
}

.map-placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  background: linear-gradient(120deg, rgba(12, 17, 26, 0.85), rgba(17, 22, 33, 0.9));
}

.hidden {
  display: none;
}

.error {
  margin-top: 10px;
  color: #ff8080;
}

.small {
  font-size: 12px;
  color: var(--muted);
}

.pid-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 6px;
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--stroke);
  border-radius: 10px;
  padding: 10px;
  background: var(--panel-2);
}

.pid-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: #cbd5e1;
}

.pid-item input {
  accent-color: var(--accent);
}

.pid-item-label {
  flex: 1;
  min-width: 0;
}

.pid-item-value {
  font-family: 'Sora', system-ui, sans-serif;
  font-size: 12px;
  color: #f8fafc;
  white-space: nowrap;
}

.kv-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.kv-list.tight {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
}

.kv-item {
  background: var(--panel-2);
  border: 1px solid var(--stroke);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
}

.kv-item span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.kv-item strong {
  color: var(--text);
  font-size: 14px;
}

.alert-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.badge {
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid transparent;
}

.badge.ok {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
  border-color: rgba(16, 185, 129, 0.4);
}

.badge.warn {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.4);
}

.badge.danger {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.4);
}

.chart-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.chart-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.presentation-mode .pid-chart-card {
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
}

.pid-charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}

.pid-charts-grid.compare-mode {
  grid-template-columns: repeat(var(--compare-cols, 3), minmax(220px, 1fr));
  overflow-x: auto;
  padding-bottom: 8px;
}

.pid-chart-card {
  background: var(--panel-2);
  border: 1px solid var(--stroke);
  border-radius: 10px;
  padding: 8px;
}

.pid-chart-title {
  font-size: 11px;
  color: #9fb3c8;
  margin-bottom: 4px;
  font-family: 'Sora', system-ui, sans-serif;
  letter-spacing: 0.06em;
}

.pid-chart-card canvas {
  height: 110px !important;
}

.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 320px;
  overflow-y: auto;
  padding: 12px;
  border: 1px solid var(--stroke);
  border-radius: 12px;
  background: var(--panel-2);
  margin-bottom: 10px;
}

.card-mechanic .chat-messages {
  max-height: 360px;
}

.chat-bubble {
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.4;
  max-width: 80%;
}

.chat-bubble.user {
  align-self: flex-end;
  background: rgba(255, 59, 59, 0.18);
  color: var(--text);
  border: 1px solid rgba(255, 59, 59, 0.35);
}

.chat-bubble.ai {
  align-self: flex-start;
  background: rgba(61, 219, 217, 0.16);
  color: var(--text);
  border: 1px solid rgba(61, 219, 217, 0.35);
}

.chat-bubble.assistant {
  align-self: flex-start;
  background: rgba(61, 219, 217, 0.16);
  color: var(--text);
  border: 1px solid rgba(61, 219, 217, 0.35);
}

.chat-input {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
}

.chat-input textarea {
  resize: vertical;
  min-height: 64px;
}

.gauge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.card-gauges {
  background: radial-gradient(circle at 50% 0%, rgba(52, 211, 153, 0.12), transparent 48%),
    linear-gradient(145deg, rgba(15, 23, 45, 0.92), rgba(7, 12, 25, 0.82));
}

.card-live {
  background: radial-gradient(circle at 12% 0%, rgba(44, 88, 255, 0.16), transparent 45%),
    linear-gradient(145deg, rgba(15, 23, 45, 0.92), rgba(7, 12, 25, 0.82));
}

.live-sensor-board-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.sensor-board {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 10px;
  max-height: min(70vh, 720px);
  overflow: auto;
  padding-right: 4px;
}

.sensor-group {
  border: 1px solid rgba(148, 176, 220, 0.14);
  border-radius: 14px;
  padding: 12px;
  background: rgba(4, 10, 20, 0.35);
}

.sensor-group-title {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #d4b56a;
  margin-bottom: 10px;
  font-weight: 650;
}

.sensor-group-chips {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
}

.sensor-chip {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(68, 87, 125, 0.55);
  background: linear-gradient(145deg, rgba(10, 16, 32, 0.96), rgba(14, 25, 46, 0.78));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.sensor-chip.is-empty {
  opacity: 0.55;
}

.sensor-chip span {
  display: block;
  font-size: 11px;
  color: var(--muted);
}

.sensor-chip strong {
  display: block;
  margin-top: 4px;
  font-size: 15px;
  color: #eef3fb;
}

.sensor-chip em {
  font-style: normal;
  font-size: 11px;
  color: #9eafc8;
  font-weight: 500;
}

.live-legend {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 18px;
}

.live-legend-compact {
  grid-template-columns: 1fr;
}

.status-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 20px;
  padding: 14px 18px;
  margin-bottom: 14px;
}

.status-bar-copy {
  min-width: 120px;
}

.status-bar .overview-title {
  font-size: 1rem;
  margin: 0;
}

.status-bar-tiles {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1 1 420px;
}

.status-pill {
  display: grid;
  gap: 2px;
  min-width: 92px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid rgba(148, 176, 220, 0.16);
  background: rgba(6, 12, 24, 0.55);
}

.status-pill-wide {
  min-width: 140px;
}

.status-pill span {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #9eafc8;
}

.status-pill strong {
  font-size: 13px;
  color: #eef3fb;
  word-break: break-word;
}

.live-legend-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(148, 176, 220, 0.14);
  background: rgba(8, 16, 30, 0.55);
  font-size: 13px;
  color: #b7c6dc;
  line-height: 1.35;
}

.live-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 4px;
  flex: 0 0 auto;
}

.live-legend-dot.tone-map { background: #3ddbd9; }
.live-legend-dot.tone-gauge { background: #f6c344; }
.live-legend-dot.tone-board { background: #4d79d6; }
.live-legend-dot.tone-chart { background: #a855f7; }

.live-core-metrics {
  margin-top: 8px;
}

.hero-live-hint {
  margin: 10px 2px 0;
  font-size: 12px;
  color: #9eafc8;
  line-height: 1.4;
}

.hero-live-hint a {
  color: #e8cd86;
  text-decoration: underline;
}

.overview-copy strong {
  color: #e8cd86;
  font-weight: 650;
}

@media (max-width: 900px) {
  .live-legend {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .live-legend {
    grid-template-columns: 1fr;
  }
}
  margin-top: 4px;
  font-size: 14px;
  color: var(--text);
  line-height: 1.3;
}

.sensor-chip.is-selected {
  border-color: rgba(246, 195, 68, 0.5);
  box-shadow: inset 0 0 18px rgba(246, 195, 68, 0.08), 0 0 18px rgba(246, 195, 68, 0.08);
}

.card-timeline {
  background: radial-gradient(circle at 10% 0%, rgba(61, 219, 217, 0.12), transparent 44%),
    linear-gradient(145deg, rgba(15, 23, 45, 0.92), rgba(7, 12, 25, 0.82));
}

.playback-status {
  margin-bottom: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(61, 219, 217, 0.35);
  background: linear-gradient(145deg, rgba(10, 24, 42, 0.85), rgba(7, 15, 29, 0.8));
  color: #cdeef1;
  font-size: 12px;
  letter-spacing: 0.02em;
}

.playback-route-summary {
  margin-bottom: 10px;
  font-size: 13px;
  line-height: 1.5;
  color: rgba(213, 232, 246, 0.88);
}

.playback-checkpoint-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.playback-checkpoints {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.playback-checkpoint {
  border-radius: 14px;
  border: 1px solid rgba(61, 219, 217, 0.2);
  background: linear-gradient(145deg, rgba(6, 16, 32, 0.86), rgba(12, 22, 43, 0.72));
  color: var(--text);
  padding: 12px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.playback-checkpoint:hover,
.playback-checkpoint:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(246, 195, 68, 0.42);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.32), 0 0 18px rgba(246, 195, 68, 0.12);
}

.playback-checkpoint.is-active {
  border-color: rgba(246, 195, 68, 0.58);
  box-shadow: 0 0 0 1px rgba(246, 195, 68, 0.2), 0 12px 32px rgba(0, 0, 0, 0.36);
  background: linear-gradient(145deg, rgba(33, 23, 7, 0.9), rgba(12, 22, 43, 0.78));
}

.playback-checkpoint:nth-child(2n) {
  border-radius: 18px 12px 18px 12px;
}

.playback-checkpoint:nth-child(2n + 1) {
  border-radius: 12px 18px 12px 18px;
}

.playback-checkpoint-label {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(246, 195, 68, 0.88);
}

.playback-checkpoint-time {
  font-family: 'Sora', system-ui, sans-serif;
  font-size: 15px;
  color: #f8fbff;
}

.playback-checkpoint-meta {
  font-size: 12px;
  color: rgba(195, 214, 236, 0.82);
}

.playback-checkpoint-note {
  font-size: 11px;
  color: rgba(170, 196, 224, 0.74);
}

.overview-tile,
.sidebar-card,
.playback-checkpoint {
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.overview-tile:hover,
.sidebar-card:hover {
  transform: translateY(-2px);
}

#live-timeline-snapshot {
  min-height: 120px;
}

.gauge-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 12px 12px;
  background: radial-gradient(circle at 50% 20%, rgba(61, 219, 217, 0.16), rgba(7, 12, 25, 0.92) 58%);
  border: 1px solid rgba(246, 195, 68, 0.36);
  border-radius: 18px;
  box-shadow: inset 0 0 30px rgba(44, 88, 255, 0.08), 0 0 22px rgba(246, 195, 68, 0.16);
  transition: box-shadow 0.22s ease, border-color 0.22s ease, transform 0.22s ease;
}

.gauge-card:hover {
  transform: translateY(-2px);
  border-color: rgba(246, 195, 68, 0.62);
  box-shadow: inset 0 0 30px rgba(44, 88, 255, 0.12), 0 0 28px rgba(246, 195, 68, 0.28);
}

.gauge-card.is-critical {
  border-color: rgba(239, 68, 68, 0.74);
  box-shadow: inset 0 0 24px rgba(239, 68, 68, 0.18), 0 0 30px rgba(239, 68, 68, 0.34);
}

.gauge-label {
  font-size: 11px;
  color: #a7b8d8;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.gauge-value {
  font-family: 'Sora', system-ui, sans-serif;
  font-size: 24px;
  color: #ecf5ff;
  letter-spacing: 0.06em;
  line-height: 1;
  text-shadow: 0 0 16px rgba(93, 189, 255, 0.22);
}

.gauge-card canvas {
  width: 220px;
  height: 220px;
  max-width: 100%;
}

@media (max-width: 900px) {
  .dashboard-shell {
    grid-template-columns: 1fr;
  }

  body.sidebar-collapsed .dashboard-shell {
    grid-template-columns: 1fr;
  }

  .overview-ribbon,
  .overview-tile-grid {
    grid-template-columns: 1fr;
  }

  .overview-tile-wide {
    grid-column: auto;
  }

  .live-grid,
  .history-grid,
  .analytics-grid {
    grid-template-columns: 1fr;
  }

  .live-grid .card-live,
  .live-grid .card-timeline,
  .live-grid .card-state-trace,
  .live-grid .card-dtcs,
  .history-card.drives-card,
  .history-card.vin-card,
  .history-card.drive-summary-card,
  .history-card.ai-card,
  .analytics-grid .card-charts,
  .analytics-grid .card-focus,
  .analytics-grid .card:last-child {
    grid-column: auto;
  }

  .hero-cluster {
    grid-template-columns: 1fr;
  }

  .mechanic-float {
    position: static;
  }

  .hero {
    grid-template-columns: 1fr;
  }

  .hero-right {
    padding: 10px;
  }

  .hero-map-frame {
    height: 220px;
  }

  .hero-gauge-rail {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-between;
    padding: 10px;
  }

  .drive-health-wrap {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-primary-gauges .gauge-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
  }

  .topbar-leading,
  .topbar-actions {
    width: auto;
    flex: 1 1 auto;
    justify-content: space-between;
    min-width: 0;
  }

  .chart-toolbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .dtc-cause-row {
    grid-template-columns: 1fr;
  }

  .dtc-cause-values {
    text-align: left;
  }
}

@media (max-width: 980px) {
  .mobile-only {
    display: inline-flex;
  }

  #sidebar-toggle {
    display: none;
  }

  .dashboard-shell {
    grid-template-columns: 1fr;
  }

  .dashboard-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(320px, calc(100vw - 48px));
    max-height: none;
    overflow: auto;
    padding: 18px 14px 24px;
    margin: 0;
    border-radius: 0 18px 18px 0;
    background:
      linear-gradient(165deg, rgba(7, 14, 28, 0.98), rgba(8, 18, 36, 0.97));
    border-right: 1px solid rgba(96, 165, 250, 0.28);
    box-shadow: 24px 0 48px rgba(0, 0, 0, 0.45);
    z-index: 40;
    transform: translateX(-110%);
    transition: transform 0.24s ease;
    overscroll-behavior: contain;
  }

  body.mobile-sidebar-open .dashboard-sidebar {
    transform: translateX(0);
  }

  body.mobile-sidebar-open::before {
    z-index: 30;
  }

  .dashboard-main {
    gap: 18px;
  }
}

@media (min-width: 1100px) {
  .history-grid {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 20px;
  }

  .history-card {
    grid-column: span 12;
  }

  .history-card.drives-card,
  .history-card.vin-card {
    grid-column: span 6;
  }

  .history-card.drive-summary-card,
  .history-card.ai-card {
    grid-column: span 6;
  }

  .analytics-grid {
    grid-template-columns: repeat(12, minmax(0, 1fr));
  }

  .analytics-grid .card-charts {
    grid-column: 1 / -1;
  }

  .analytics-grid .card-focus {
    grid-column: span 5;
  }

  .analytics-grid .card:last-child {
    grid-column: span 7;
  }
}

@keyframes floatIn {
  from {
    transform: translateY(8px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.dtc-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.dtc-ai-analysis {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.dtc-analysis-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(248, 113, 113, 0.24);
  background: linear-gradient(145deg, rgba(25, 9, 12, 0.76), rgba(17, 12, 24, 0.62));
}

.dtc-analysis-card.is-active {
  border-color: rgba(248, 113, 113, 0.5);
  box-shadow: 0 0 0 1px rgba(248, 113, 113, 0.14), 0 14px 30px rgba(0, 0, 0, 0.3);
}

.dtc-analysis-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.dtc-analysis-code-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.dtc-analysis-code-row strong {
  font-family: 'Sora', system-ui, sans-serif;
  font-size: 16px;
  color: #fff1f2;
}

.dtc-analysis-hint,
.dtc-analysis-time {
  font-size: 12px;
  line-height: 1.45;
  color: rgba(252, 217, 217, 0.82);
}

.dtc-primary-cause {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(246, 195, 68, 0.3);
  background: linear-gradient(145deg, rgba(55, 30, 8, 0.44), rgba(25, 18, 7, 0.3));
}

.dtc-primary-label,
.dtc-analysis-section-title {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(246, 195, 68, 0.88);
}

.dtc-primary-title-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.dtc-primary-title-row strong {
  color: #fff9e6;
  font-size: 15px;
}

.dtc-primary-cause p {
  margin: 0;
  color: rgba(236, 240, 246, 0.9);
  font-size: 13px;
  line-height: 1.5;
}

.dtc-probability-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dtc-probability-pill.rating-high {
  border-color: rgba(248, 113, 113, 0.44);
  color: #fecaca;
  background: rgba(127, 29, 29, 0.34);
}

.dtc-probability-pill.rating-medium {
  border-color: rgba(246, 195, 68, 0.4);
  color: #fde68a;
  background: rgba(120, 53, 15, 0.28);
}

.dtc-probability-pill.rating-low {
  border-color: rgba(94, 234, 212, 0.34);
  color: #ccfbf1;
  background: rgba(17, 94, 89, 0.24);
}

.dtc-analysis-bars {
  display: grid;
  gap: 10px;
}

.dtc-cause-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 12px;
  align-items: center;
}

.dtc-cause-copy {
  display: grid;
  gap: 4px;
}

.dtc-cause-copy strong {
  color: #f8fafc;
  font-size: 13px;
}

.dtc-cause-copy span {
  color: rgba(203, 213, 225, 0.84);
  font-size: 12px;
  line-height: 1.45;
}

.dtc-cause-score {
  display: grid;
  gap: 6px;
}

.dtc-cause-bar {
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(148, 163, 184, 0.14);
  border: 1px solid rgba(148, 163, 184, 0.14);
}

.dtc-cause-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(248, 113, 113, 0.92), rgba(246, 195, 68, 0.92));
}

.dtc-cause-values {
  text-align: right;
  color: rgba(252, 217, 217, 0.82);
  font-size: 11px;
}

.dtc-analysis-section {
  display: grid;
  gap: 8px;
}

.dtc-feedback-section {
  padding-top: 4px;
  border-top: 1px solid rgba(248, 113, 113, 0.16);
}

.dtc-web-research-section {
  padding-top: 10px;
  border-top: 1px solid rgba(99, 102, 241, 0.22);
  margin-top: 4px;
}
.dtc-web-subsection {
  margin-top: 10px;
}
.dtc-web-subsection > strong {
  display: block;
  color: #c7ceff;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}
ol.dtc-web-list {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 4px;
  color: rgba(255,255,255,.82);
  font-size: 13px;
}
.dtc-recall-item {
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(248, 113, 113, 0.08);
  border: 1px solid rgba(248, 113, 113, 0.16);
  margin-top: 6px;
  font-size: 13px;
}
.dtc-recall-item strong {
  color: #fff1f2;
}
.dtc-recall-remedy {
  margin-top: 4px;
  color: rgba(255,255,255,.68);
  font-size: 12px;
}

.dtc-feedback-list {
  display: grid;
  gap: 10px;
}

.dtc-feedback-item {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(248, 113, 113, 0.14);
  background: linear-gradient(145deg, rgba(36, 11, 16, 0.62), rgba(15, 14, 28, 0.46));
}

.dtc-feedback-item strong {
  color: #fff1f2;
  font-size: 13px;
}

.dtc-feedback-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.dtc-analysis-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge.neutral {
  border-color: rgba(148, 163, 184, 0.32);
  background: rgba(148, 163, 184, 0.12);
  color: #e2e8f0;
}

.dtc-evidence-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
  color: rgba(236, 240, 246, 0.88);
  font-size: 12px;
  line-height: 1.5;
}

.dtc-item {
  display: grid;
  gap: 6px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(248, 113, 113, 0.28);
  border-left: 4px solid rgba(248, 113, 113, 0.9);
  background: linear-gradient(145deg, rgba(44, 12, 17, 0.7), rgba(17, 12, 24, 0.74));
  font-size: 12px;
  color: #fca5a5;
  text-align: left;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.dtc-item:hover,
.dtc-item:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(252, 165, 165, 0.44);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.24);
  outline: none;
}

.dtc-item-kicker,
.dtc-item-link {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.dtc-item-kicker {
  color: rgba(252, 165, 165, 0.76);
}

.dtc-item strong {
  font-family: 'Sora', system-ui, sans-serif;
  font-size: 16px;
  color: #fff1f2;
}

.dtc-item-copy {
  color: rgba(255, 228, 230, 0.84);
  line-height: 1.45;
}

.dtc-item-link {
  color: rgba(253, 186, 116, 0.82);
}

.ai-watchouts {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.ai-watchout {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(64, 101, 137, 0.45);
  background: rgba(8, 17, 30, 0.72);
}

.ai-watchout.warn {
  border-color: rgba(246, 195, 68, 0.38);
  background: rgba(58, 42, 10, 0.28);
}

.ai-watchout.danger {
  border-color: rgba(248, 113, 113, 0.42);
  background: rgba(72, 18, 23, 0.3);
}

.ai-watchout.ok {
  border-color: rgba(52, 211, 153, 0.36);
  background: rgba(10, 49, 39, 0.28);
}

.ai-watchout-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ai-watchout strong {
  color: #e5eef8;
  font-size: 13px;
}

.ai-watchout span {
  color: #9fb3c8;
  font-size: 12px;
  line-height: 1.45;
}

.ai-watchout-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.ai-section-block {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.ai-section-title {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(246, 195, 68, 0.9);
}

.ai-context-grid {
  display: grid;
  gap: 10px;
}

.ai-context-item {
  display: grid;
  gap: 6px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(64, 101, 137, 0.45);
  background: rgba(8, 17, 30, 0.72);
}

.ai-context-item strong {
  color: #e5eef8;
  font-size: 13px;
}

.ai-context-item span {
  color: #9fb3c8;
  font-size: 12px;
  line-height: 1.45;
}

.ai-context-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.storyboard-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.storyboard-item {
  width: 100%;
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  text-align: left;
  border-radius: 18px;
  border: 1px solid rgba(68, 87, 125, 0.55);
  background: linear-gradient(145deg, rgba(7, 15, 30, 0.94), rgba(12, 22, 43, 0.82));
  padding: 14px;
  color: var(--text);
}

.storyboard-item:hover,
.storyboard-item:focus-visible {
  border-color: rgba(246, 195, 68, 0.46);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.34), 0 0 18px rgba(246, 195, 68, 0.1);
}

.storyboard-step {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, rgba(246, 195, 68, 0.22), rgba(44, 88, 255, 0.18));
  font-family: 'Sora', system-ui, sans-serif;
  font-size: 16px;
  color: #fff7dd;
}

.storyboard-content {
  display: grid;
  gap: 6px;
}

.storyboard-title-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}

.storyboard-title-row strong {
  font-size: 15px;
  color: #f8fbff;
}

.storyboard-time {
  font-size: 12px;
  color: rgba(246, 195, 68, 0.85);
}

.storyboard-meta,
.storyboard-note {
  font-size: 12px;
  line-height: 1.5;
  color: rgba(196, 214, 236, 0.82);
}

.state-badge {
  background: rgba(9, 19, 33, 0.84);
  border: 1px solid rgba(69, 111, 151, 0.45);
  color: #cfe0f3;
}

/* ===== 2026-02-28 Cockpit Redesign ===== */

body.cockpit {
  background:
    radial-gradient(circle at 74% 8%, rgba(56, 189, 248, 0.24) 0%, transparent 42%),
    radial-gradient(circle at 6% 18%, rgba(44, 88, 255, 0.20) 0%, transparent 40%),
    radial-gradient(circle at 86% 88%, rgba(246, 195, 68, 0.14) 0%, transparent 36%),
    linear-gradient(146deg, #020812 0%, #071322 38%, #060d1b 64%, #040a16 100%);
}

body.cockpit::before {
  background-image:
    radial-gradient(circle at 0 10%, rgba(34, 211, 238, 0.12), transparent 56%),
    radial-gradient(circle at 96% 24%, rgba(44, 88, 255, 0.14), transparent 58%),
    radial-gradient(circle at 50% 100%, rgba(246, 195, 68, 0.10), transparent 52%);
  opacity: 1;
}

body.cockpit::after {
  background-image:
    linear-gradient(transparent 95%, rgba(56, 189, 248, 0.08) 95%),
    linear-gradient(90deg, transparent 95%, rgba(56, 189, 248, 0.05) 95%);
  background-size: 100px 100px, 130px 130px;
  opacity: 0.3;
}

.cockpit .app {
  max-width: 1520px;
  padding: 20px;
}

.cockpit .overview-ribbon {
  grid-template-columns: minmax(260px, 0.72fr) minmax(0, 2.28fr);
}

.cockpit .overview-tile-grid {
  grid-template-columns: 1.2fr 0.9fr 0.9fr 1fr;
  grid-auto-rows: minmax(98px, auto);
}

.cockpit .overview-tile {
  min-height: 98px;
}

.cockpit .overview-tile-wide {
  min-height: 116px;
}

.cockpit .topbar {
  border-radius: 14px;
  border: 1px solid rgba(58, 182, 255, 0.5);
  background:
    linear-gradient(106deg, rgba(6, 20, 37, 0.95), rgba(8, 26, 44, 0.85) 52%, rgba(8, 16, 34, 0.88) 100%);
  box-shadow:
    inset 0 0 0 1px rgba(246, 195, 68, 0.08),
    0 16px 44px rgba(1, 8, 18, 0.72),
    0 0 28px rgba(41, 167, 255, 0.16),
    0 0 22px rgba(246, 195, 68, 0.1);
}

.cockpit .brand {
  letter-spacing: 0.14em;
  font-size: 17px;
  color: #e8f8ff;
  font-family: 'Sora', system-ui, sans-serif;
  text-shadow: 0 0 18px rgba(56, 189, 248, 0.45), 0 0 6px rgba(246, 195, 68, 0.25);
}

.cockpit .brand-sub {
  color: rgba(161, 231, 255, 0.9);
  font-size: 9px;
}

.cockpit .hero {
  border-radius: 16px;
  border: 1px solid rgba(64, 174, 255, 0.42);
  background:
    linear-gradient(132deg, rgba(6, 20, 36, 0.95) 0%, rgba(8, 30, 50, 0.85) 55%, rgba(7, 20, 36, 0.94) 100%);
  box-shadow:
    inset 0 0 0 1px rgba(246, 195, 68, 0.06),
    0 24px 66px rgba(2, 10, 20, 0.75),
    0 0 28px rgba(56, 189, 248, 0.12);
}

.cockpit .hero::after {
  background:
    radial-gradient(circle at 72% 18%, rgba(56, 189, 248, 0.22), transparent 48%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 26%),
    linear-gradient(90deg, transparent 0%, rgba(246, 195, 68, 0.08) 50%, transparent 100%);
}

.cockpit .hero-command-deck {
  grid-template-columns: minmax(300px, 0.74fr) minmax(0, 1.26fr);
}

.cockpit .hero-map-frame {
  border-radius: 10px;
  border: 1px solid rgba(63, 180, 255, 0.42);
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(246, 195, 68, 0.08);
  /* Do not use unbounded min-height alone — pairs with operational-deck lock. */
  min-height: 260px;
  max-height: 480px;
}

.cockpit .hero-map-overlay {
  backdrop-filter: blur(10px);
  box-shadow: 0 0 22px rgba(56, 189, 248, 0.18);
}

.cockpit .hero-gauge-rail .mini-gauge {
  border-color: rgba(63, 183, 255, 0.52);
  box-shadow: inset 0 0 0 1px rgba(246, 195, 68, 0.08), 0 0 16px rgba(56, 189, 248, 0.12);
}

.cockpit .hero-gauge-rail .mini-gauge::before {
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.3), 0 0 10px rgba(246, 195, 68, 0.1);
}

.cockpit .hero-gauge-rail .mini-gauge:nth-child(2n)::before,
.cockpit .hero-gauge-rail .mini-gauge:nth-child(5)::before {
  box-shadow: 0 0 16px rgba(246, 195, 68, 0.34), 0 0 10px rgba(56, 189, 248, 0.08);
}

.cockpit .hero-gauge-rail .mini-gauge-label,
.cockpit .hero-gauge-rail .mini-gauge-unit {
  color: rgba(170, 233, 255, 0.92);
}

.cockpit .hero-photo-mini {
  border: 1px solid rgba(60, 187, 255, 0.5);
  box-shadow: 0 10px 28px rgba(1, 9, 18, 0.72), 0 0 20px rgba(246, 195, 68, 0.16);
}

.cockpit .section-title {
  letter-spacing: 0.14em;
  color: rgba(222, 236, 255, 0.9);
  text-shadow: none;
}

.cockpit .grid {
  gap: 12px;
}

.cockpit .card {
  border-radius: 14px;
  padding: 14px 16px;
  border: 1px solid rgba(148, 176, 220, 0.12);
  background: linear-gradient(160deg, rgba(12, 20, 36, 0.95), rgba(8, 14, 26, 0.92));
  box-shadow: 0 14px 32px rgba(1, 8, 17, 0.45);
  position: relative;
}

.cockpit .card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 14px;
  border: 0;
  background: linear-gradient(115deg, rgba(255, 255, 255, 0.02), transparent 45%);
  pointer-events: none;
}

.cockpit .card::after {
  content: '';
  position: absolute;
  top: 0;
  left: -32%;
  width: 28%;
  height: 100%;
  background: linear-gradient(100deg, transparent 0%, rgba(56, 189, 248, 0.12) 48%, transparent 100%);
  transform: skewX(-18deg);
  opacity: 0;
  pointer-events: none;
  animation: panelSweep 7.5s ease-in-out infinite;
}

.cockpit .card:hover {
  border-color: rgba(246, 195, 68, 0.6);
  box-shadow:
    inset 0 0 0 1px rgba(246, 195, 68, 0.12),
    0 22px 52px rgba(1, 8, 17, 0.76),
    0 0 26px rgba(246, 195, 68, 0.24);
}

.cockpit .row label,
.cockpit .small,
.cockpit label {
  color: rgba(173, 214, 238, 0.88);
}

.cockpit input,
.cockpit select,
.cockpit textarea {
  border: 1px solid rgba(71, 114, 154, 0.72);
  background: linear-gradient(165deg, rgba(5, 14, 25, 0.96), rgba(8, 18, 33, 0.9));
  color: #e8f3ff;
}

.cockpit select option {
  background: rgba(5, 12, 24, 0.95);
  color: #e8f3ff;
}

.cockpit input:focus,
.cockpit select:focus,
.cockpit textarea:focus {
  border-color: rgba(56, 189, 248, 0.86);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.16), 0 0 16px rgba(56, 189, 248, 0.2);
}

.cockpit button {
  background: linear-gradient(135deg, #dc2626 0%, #ef4444 50%, #f87171 100%);
  color: #ffffff;
  box-shadow: 0 8px 24px rgba(220, 38, 38, 0.32);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  letter-spacing: 0.04em;
}

.cockpit button.ghost {
  background: linear-gradient(145deg, rgba(7, 24, 41, 0.9), rgba(6, 17, 30, 0.95));
  border: 1px solid rgba(63, 183, 255, 0.64);
  color: #d6efff;
  box-shadow: inset 0 0 0 1px rgba(246, 195, 68, 0.08), 0 0 16px rgba(56, 189, 248, 0.16);
}

.cockpit .metric,
.cockpit .kv-item,
.cockpit .pid-chart-card,
.cockpit .chat-messages,
.cockpit .playback-status,
.cockpit .pid-list {
  border: 1px solid rgba(60, 103, 145, 0.66);
  background: linear-gradient(162deg, rgba(5, 14, 25, 0.95), rgba(7, 19, 33, 0.88));
}

.cockpit .metric strong,
.cockpit .gauge-value,
.cockpit .hero-title {
  color: #e9f8ff;
  font-family: 'Sora', system-ui, sans-serif;
  text-shadow: 0 0 12px rgba(56, 189, 248, 0.2);
}

.cockpit h2,
.cockpit h3 {
  font-family: 'Sora', system-ui, sans-serif;
  letter-spacing: 0.05em;
}

.cockpit .badge.ok {
  background: rgba(20, 212, 184, 0.16);
  border-color: rgba(20, 212, 184, 0.46);
  color: #8ff6dd;
}

.cockpit .badge.warn {
  background: rgba(246, 195, 68, 0.16);
  border-color: rgba(246, 195, 68, 0.48);
  color: #ffd785;
}

.cockpit .badge.danger {
  background: rgba(251, 113, 133, 0.16);
  border-color: rgba(251, 113, 133, 0.44);
  color: #ffb3c0;
}

.cockpit .chat-bubble.user {
  background: linear-gradient(135deg, rgba(251, 113, 133, 0.24), rgba(246, 195, 68, 0.14));
  border-color: rgba(251, 113, 133, 0.4);
}

.cockpit .chat-bubble.ai,
.cockpit .chat-bubble.assistant {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.2), rgba(44, 88, 255, 0.14));
  border-color: rgba(56, 189, 248, 0.4);
}

.cockpit .gauge-card {
  border: 1px solid rgba(56, 189, 248, 0.44);
  background:
    radial-gradient(circle at 50% 16%, rgba(56, 189, 248, 0.26) 0%, rgba(7, 18, 31, 0.92) 52%),
    linear-gradient(160deg, rgba(7, 19, 32, 0.95), rgba(5, 14, 25, 0.92));
}

.cockpit .gauge-label {
  color: rgba(169, 230, 255, 0.88);
}

.cockpit .pid-charts-grid.compare-mode {
  border-radius: 10px;
  padding: 10px;
  border: 1px solid rgba(56, 189, 248, 0.24);
  grid-template-columns: repeat(var(--compare-cols, 4), minmax(190px, 1fr));
}

.cockpit .bottom-graphs {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

.cockpit .tone-blue,
.cockpit .tone-ai {
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.08), 0 20px 48px rgba(1, 8, 17, 0.72), 0 0 22px rgba(56, 189, 248, 0.14);
}

.cockpit .tone-copper,
.cockpit .tone-alert {
  box-shadow: inset 0 0 0 1px rgba(246, 195, 68, 0.08), 0 20px 48px rgba(1, 8, 17, 0.72), 0 0 22px rgba(246, 195, 68, 0.14);
}

.cockpit .tone-violet {
  box-shadow: inset 0 0 0 1px rgba(167, 139, 250, 0.08), 0 20px 48px rgba(1, 8, 17, 0.72), 0 0 22px rgba(167, 139, 250, 0.14);
}

.cockpit .bottom-graphs .card-charts {
  grid-column: 1 / -1;
}

.cockpit .bottom-graphs .card-focus,
.cockpit .bottom-graphs .card:nth-child(3) {
  min-height: 280px;
}

@keyframes panelSweep {
  0% {
    left: -32%;
    opacity: 0;
  }
  10% {
    opacity: 0.45;
  }
  60% {
    opacity: 0.15;
  }
  100% {
    left: 132%;
    opacity: 0;
  }
}

@media (min-width: 1360px) {
  .cockpit .live-grid,
  .cockpit .history-grid,
  .cockpit .analytics-grid {
    gap: 24px;
  }
}

@media (max-width: 1100px) {
  .hero-command-deck {
    min-height: 0;
  }

  .cockpit .hero-command-deck {
    grid-template-columns: 1fr;
  }

  .cockpit .hero-map-frame {
    min-height: 280px;
  }
}

/* ===== 2026-03-26 Portal Visual Revamp ===== */

/* Live Drive is primary; AI Desk lives in its own section below All Sensors */
.cockpit .hero-cluster {
  display: block;
}

.cockpit .hero-command-deck {
  width: 100%;
}

.cockpit .mechanic-float {
  position: relative;
  top: auto;
  align-self: stretch;
  border: 1px solid rgba(255, 59, 59, 0.45);
  border-left: 4px solid var(--accent-red);
  background:
    linear-gradient(145deg, rgba(18, 8, 12, 0.96), rgba(8, 14, 30, 0.88));
  box-shadow:
    0 25px 60px rgba(0, 0, 0, 0.65),
    0 0 32px rgba(255, 59, 59, 0.18),
    0 0 16px rgba(56, 189, 248, 0.08);
  border-radius: 18px;
  padding: 24px;
}

.cockpit .mechanic-float:hover {
  border-color: rgba(255, 59, 59, 0.7);
  box-shadow:
    0 28px 66px rgba(0, 0, 0, 0.7),
    0 0 40px rgba(255, 59, 59, 0.28),
    0 0 20px rgba(56, 189, 248, 0.12);
}

.cockpit .mechanic-float .chat-messages {
  min-height: 180px;
  max-height: 380px;
}

.ai-sensor-health {
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(61, 219, 217, 0.08);
  border: 1px solid rgba(61, 219, 217, 0.22);
  color: #c7f6f5;
  line-height: 1.35;
}

.cockpit .card-mechanic h3 {
  color: var(--accent-red);
  font-family: 'Sora', system-ui, sans-serif;
  font-size: 20px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-shadow: 0 0 18px rgba(255, 59, 59, 0.3);
}

.cockpit .card-mechanic .chat-input textarea {
  border-color: rgba(255, 59, 59, 0.3);
}

.cockpit .card-mechanic .chat-input textarea:focus {
  border-color: rgba(255, 59, 59, 0.7);
  box-shadow: 0 0 0 2px rgba(255, 59, 59, 0.12), 0 0 16px rgba(255, 59, 59, 0.15);
}

/* --- Red accent kickers and labels --- */
.cockpit .overview-kicker {
  color: rgba(255, 100, 100, 0.95);
  text-shadow: 0 0 10px rgba(255, 59, 59, 0.2);
}

.cockpit .sidebar-brand-kicker {
  color: rgba(255, 120, 120, 0.92);
}

/* --- Red section accent bars --- */
.cockpit .workspace-section-live .section-head::before {
  background: linear-gradient(180deg, rgba(255, 59, 59, 0.92), rgba(220, 38, 38, 0.4));
  box-shadow: 0 0 18px rgba(255, 59, 59, 0.22);
}

/* --- Telemetry scorer: red glow at poor health --- */
.cockpit .drive-health-circle.is-poor {
  border-color: rgba(255, 59, 59, 0.75);
  box-shadow: 0 0 40px rgba(255, 59, 59, 0.4), inset 0 0 24px rgba(255, 59, 59, 0.1);
}

/* --- Button hover and active states --- */
.cockpit button:hover {
  background: linear-gradient(135deg, #b91c1c 0%, #dc2626 50%, #ef4444 100%);
  box-shadow: 0 12px 30px rgba(220, 38, 38, 0.4);
  transform: translateY(-1px);
}

.cockpit button:active {
  transform: translateY(0);
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

.cockpit button.ghost:hover {
  background: linear-gradient(145deg, rgba(15, 30, 50, 0.95), rgba(10, 22, 38, 0.98));
  border-color: rgba(97, 210, 255, 0.85);
  box-shadow: 0 0 24px rgba(56, 189, 248, 0.25);
  transform: translateY(-1px);
}

.cockpit button.sidebar-link:hover {
  background: none;
  transform: translateY(-1px);
}

/* --- Prominent fault code card red styling --- */
.cockpit .card-dtcs {
  border-color: rgba(255, 59, 59, 0.4);
  box-shadow:
    inset 0 0 0 1px rgba(255, 59, 59, 0.08),
    0 20px 48px rgba(1, 8, 17, 0.72),
    0 0 22px rgba(255, 59, 59, 0.14);
}

.cockpit .card-dtcs h3 {
  color: rgba(255, 130, 130, 0.95);
}

/* --- AI Desk prominent card --- */
.cockpit .ai-card {
  border-left: 4px solid var(--accent-red);
  border-color: rgba(255, 59, 59, 0.35);
}

.cockpit .ai-card h3 {
  color: rgba(255, 130, 130, 0.95);
  text-shadow: 0 0 12px rgba(255, 59, 59, 0.2);
}

/* --- Health circle pulse animation when live --- */
@keyframes healthPulse {
  0%, 100% { box-shadow: 0 0 28px rgba(246, 195, 68, 0.28), inset 0 0 20px rgba(56, 189, 248, 0.12); }
  50% { box-shadow: 0 0 42px rgba(246, 195, 68, 0.45), inset 0 0 28px rgba(56, 189, 248, 0.2); }
}

.drive-health-circle.is-live {
  animation: healthPulse 2.5s ease-in-out infinite;
}

/* --- Topbar red accent line --- */
.cockpit .topbar::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 20%;
  right: 20%;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(255, 59, 59, 0.6), rgba(255, 59, 59, 0.8), rgba(255, 59, 59, 0.6), transparent);
  border-radius: 999px;
}

.cockpit .topbar {
  position: sticky;
  overflow: visible;
}

/* --- Login button - special prominent styling --- */
#login-btn {
  font-size: 15px;
  padding: 12px 28px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* --- Card mechanic send button --- */
#ai-chat-send {
  font-size: 13px;
  padding: 10px 20px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* --- Overview tile hover red glow --- */
.cockpit .overview-tile:hover {
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.5), 0 0 18px rgba(255, 59, 59, 0.12);
}

/* --- Red accent on fault tile --- */
.cockpit .overview-tile-accent {
  border-color: rgba(255, 59, 59, 0.38);
  background: linear-gradient(145deg, rgba(36, 8, 12, 0.92), rgba(13, 21, 39, 0.88));
}

.cockpit .overview-tile-accent strong {
  color: rgba(255, 150, 150, 0.98);
}

/* --- Hero red glow line at top --- */
.cockpit .hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 15%;
  right: 15%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 59, 59, 0.5), transparent);
  z-index: 2;
}

/* --- Storyboard time red tint --- */
.cockpit .storyboard-time {
  color: rgba(255, 120, 120, 0.9);
}

/* --- DTC primary label red --- */
.cockpit .dtc-primary-label {
  color: rgba(255, 100, 100, 0.92);
}

/* --- Responsive: keep Live Drive first --- */
@media (max-width: 900px) {
  .cockpit .mechanic-float {
    position: relative;
    top: auto;
  }
}

/* ===== PID Expand Modal ===== */
.pid-expand-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(2, 6, 14, 0.88);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.18s ease-out;
}

.pid-expand-modal {
  width: min(96vw, 1200px);
  max-height: 92vh;
  overflow-y: auto;
  background: var(--panel-2, #0d1527);
  border: 1px solid var(--stroke, rgba(56, 189, 248, 0.12));
  border-radius: 16px;
  padding: 20px 24px 24px;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.6), 0 0 40px rgba(255, 59, 59, 0.08);
}

.pid-expand-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.pid-expand-title {
  font-family: 'Sora', system-ui, sans-serif;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #e9eef5;
}

.pid-expand-close {
  font-size: 13px;
  padding: 6px 16px;
}

.pid-expand-grid {
  display: grid;
  grid-template-columns: repeat(var(--expand-cols, 1), 1fr);
  gap: 16px;
}

.pid-expand-card {
  background: var(--panel, #0a1626);
  border: 1px solid var(--stroke, rgba(56, 189, 248, 0.12));
  border-radius: 12px;
  padding: 14px 16px 10px;
}

.pid-expand-card-title {
  font-family: 'Sora', system-ui, sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: #9fb3c8;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.pid-expand-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  font-size: 12px;
  color: var(--muted, #5a7a9b);
  margin-bottom: 10px;
}

.pid-expand-stats strong {
  color: #e9eef5;
}

.pid-expand-card canvas {
  width: 100% !important;
  height: 300px !important;
}

/* Hover glow on expandable cards */
.pid-chart-card[title="Click to expand"]:hover {
  border-color: rgba(255, 59, 59, 0.4);
  box-shadow: 0 4px 20px rgba(255, 59, 59, 0.1);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.pid-expand-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.pid-expand-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pid-expand-live-badge {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: #052e16;
  background: #4ade80;
  padding: 3px 8px;
  border-radius: 999px;
}

.pid-expand-hint {
  font-size: 12px;
  color: #7a91a8;
  margin: -6px 0 14px;
}

.pid-expand-now {
  font-size: 28px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #e9eef5;
  margin: 0 0 8px;
  line-height: 1.1;
}

.pid-expand-card canvas {
  width: 100% !important;
  height: 260px !important;
}

/* Compare button row */
.pid-compare-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 8px 0 12px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(56, 189, 248, 0.18);
  background: rgba(8, 18, 36, 0.92);
}

.pid-compare-bar button {
  font-size: 12px;
  padding: 5px 14px;
}

.pid-chart-card.pid-selected,
.hud-sensor-cell.pid-selected,
.sensor-chip.pid-selected,
.sensor-chip.is-selected,
.ops-spark.pid-selected {
  border-color: rgba(255, 59, 59, 0.6) !important;
  box-shadow: 0 0 14px rgba(255, 59, 59, 0.15);
}

.hud-sensor-cell,
.ops-spark,
.sensor-chip {
  cursor: pointer;
}

.hud-sensor-cell[data-sensor-key="fuel_sys"] {
  min-width: 0;
}

.hud-sensor-cell[data-sensor-key="fuel_sys"] [data-sensor-value],
.hud-sensor-cell[data-sensor-key="fuel_sys"] strong {
  font-size: 0.68rem;
  line-height: 1.2;
  white-space: normal;
  word-break: break-word;
  max-height: 2.6em;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.hud-sensor-cell[data-sensor-key="fuel_sys"] .hud-climate-track,
.hud-sensor-cell[data-sensor-key="fuel_sys"] .bar-track {
  display: none;
}

.hud-sensor-cell:hover,
.ops-spark:hover,
.sensor-chip:hover {
  border-color: rgba(56, 189, 248, 0.45);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.login-card {
  max-width: 440px;
  margin: 48px auto 24px;
  width: min(100%, 440px);
}

.login-resume {
  width: 100%;
  margin-top: 10px;
}

.login-helper kbd {
  font-family: 'Orbitron', 'Sora', sans-serif;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid rgba(212, 181, 106, 0.45);
  background: rgba(212, 181, 106, 0.12);
  color: var(--accent);
}

.hud-ai-row {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "kicker expand"
    "messages messages"
    "compose compose";
  gap: 8px;
  align-items: start;
}

.hud-ai-row .ai-dock-kicker { grid-area: kicker; align-self: center; }
.hud-ai-row #ai-dock-expand { grid-area: expand; align-self: center; }
.hud-ai-row .ai-dock-messages,
.hud-ai-row .hud-ai-toast { grid-area: messages; }
.hud-ai-row .ai-dock-compose { grid-area: compose; width: 100%; }

.hud-ai-toast:empty {
  display: none;
}

.hud-ai-toast .chat-bubble,
.ai-dock-messages .chat-bubble {
  max-width: 100%;
  white-space: pre-wrap;
  word-break: break-word;
}

.hud-playback-status:empty,
.hud-route-summary:empty {
  display: none;
}


.login-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.login-actions button {
  flex: 1 1 160px;
}

@media (max-width: 640px) {
  .app {
    padding: 12px 10px 28px;
  }

  .login-card {
    margin: 18px auto 12px;
    padding: 18px 14px;
    border-radius: 16px;
  }

  .brand-sub,
  .brand-wrap .brand-sub {
    display: none;
  }

  .brand {
    font-size: 14px;
    letter-spacing: 0.08em;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
  }

  .topbar {
    padding: 10px 12px;
    border-radius: 12px;
  }

  .user-info {
    max-width: 42vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
  }

  .card {
    padding: 14px;
    border-radius: 14px;
  }

  .cockpit .overview-tile-grid {
    grid-template-columns: 1fr 1fr;
    grid-auto-rows: minmax(84px, auto);
  }

  .cockpit .overview-tile,
  .cockpit .overview-tile-wide {
    min-height: 84px;
  }

  .hero-primary-gauges .gauge-card canvas,
  .gauge-card canvas {
    width: min(100%, 180px);
    height: auto;
    aspect-ratio: 1;
  }

  .hero-map-frame {
    height: 200px;
  }

  .table-wrap,
  .drives-table-wrap,
  table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .pid-expand-modal {
    width: 100vw;
    max-height: 100vh;
    border-radius: 0;
    padding: 14px 12px 20px;
  }

  .pid-expand-card canvas {
    height: 220px !important;
  }
}

/* ===== Operational view: one-screen map + dials + scrubber ===== */
.operational-deck {
  display: flex !important;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  padding: 14px 16px 16px;
}

.ops-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px 18px;
  align-items: flex-start;
  position: relative;
  z-index: 1;
}

.ops-header-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.ops-header .hero-title {
  font-size: 1.35rem;
  line-height: 1.2;
}

.ops-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.ops-stage {
  display: grid;
  grid-template-columns: minmax(160px, 0.72fr) minmax(0, 1.6fr) minmax(108px, 0.55fr);
  gap: 12px;
  align-items: stretch;
  position: relative;
  z-index: 1;
}

.ops-dials {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  justify-content: flex-start;
}

.ops-dial {
  padding: 6px 4px 8px;
  border-radius: 16px;
  width: 100%;
  max-width: 190px;
  text-align: center;
}

.ops-dial canvas {
  width: 148px;
  height: 148px;
  display: block;
  margin: 0 auto;
}

.ops-dial .gauge-value {
  font-size: 16px;
}

.ops-sparks {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.ops-spark {
  width: 100%;
  max-width: 220px;
  padding: 10px 10px 8px;
  border-radius: 14px;
  border: 1px solid rgba(148, 176, 220, 0.16);
  background: rgba(8, 14, 26, 0.72);
}

.ops-spark-head {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 4px;
}

.ops-spark-title {
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(158, 175, 200, 0.92);
  font-weight: 650;
}

.ops-spark-now {
  margin-left: auto;
  font-size: 1.05rem;
  font-weight: 700;
  color: #eef3fb;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.ops-spark-unit {
  font-size: 0.68rem;
  color: rgba(158, 175, 200, 0.85);
}

.ops-spark canvas {
  width: 100%;
  height: 52px;
  display: block;
  border-radius: 8px;
}

.ops-spark-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin-top: 6px;
}

.ops-spark-stats span {
  font-size: 0.62rem;
  color: rgba(158, 175, 200, 0.78);
  letter-spacing: 0.02em;
}

.ops-spark-stats b {
  display: block;
  margin-top: 1px;
  color: #e8eef8;
  font-size: 0.78rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.ops-map-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.operational-deck .hero-map-frame {
  /* Fixed box — height:auto + flex:1 lets Leaflet grow the page forever. */
  height: 320px;
  min-height: 220px;
  max-height: 360px;
  flex: 0 0 auto;
  border-radius: 16px;
  overflow: hidden;
  position: relative;
}

.cockpit .operational-deck .hero-map-frame {
  height: 320px;
  min-height: 220px;
  max-height: 360px;
}

.ops-scrubber {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(246, 195, 68, 0.28);
  background: linear-gradient(160deg, rgba(18, 14, 8, 0.94), rgba(8, 14, 26, 0.96));
  position: sticky;
  bottom: 10px;
  z-index: 35;
  backdrop-filter: blur(12px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
  contain: layout style;
}

.ops-scrubber-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  justify-content: space-between;
}

.ops-scrubber-head strong {
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 230, 170, 0.95);
}

.ops-scrubber input[type="range"] {
  width: 100%;
  accent-color: #f6c344;
  height: 28px;
  cursor: pointer;
  touch-action: none;
}

.ops-scrub-snapshot {
  max-height: 110px !important;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)) !important;
}

.ops-scrub-snapshot .kv-item,
.ops-scrub-snapshot > div {
  padding: 6px 8px !important;
  font-size: 11px !important;
}

.ops-checkpoints {
  max-height: 72px;
  overflow-x: auto;
  overflow-y: hidden;
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  padding-bottom: 2px;
}

.ops-checkpoints .playback-checkpoint {
  flex: 0 0 auto;
  min-width: 118px;
}

.ops-rail {
  display: grid !important;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 8px;
  align-content: start;
  max-height: 100%;
  overflow: auto;
}

.ops-moment-strip {
  display: grid;
  gap: 8px;
  position: relative;
  z-index: 1;
}

.ops-kv-strip {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  max-height: 132px;
  overflow: auto;
}

.ops-kv-strip .kv-item,
.ops-kv-strip > div {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(148, 176, 220, 0.12);
  background: rgba(6, 14, 26, 0.65);
  font-size: 12px;
}

@media (max-width: 1180px) {
  .ops-stage {
    grid-template-columns: minmax(140px, 0.8fr) minmax(0, 1.4fr);
  }

  .ops-rail {
    grid-column: 1 / -1;
    grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
    flex-direction: row;
  }
}

@media (max-width: 820px) {
  .ops-stage {
    grid-template-columns: 1fr;
  }

  .ops-dials {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
  }

  .ops-sparks {
    flex: 1 1 100%;
  }

  .ops-rail {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }

  .operational-deck .hero-map-frame,
  .cockpit .operational-deck .hero-map-frame {
    height: min(36vh, 320px);
    min-height: 200px;
    max-height: 360px;
  }
}

/* ===== Website-matched professional look (2026-09-18) ===== */
:root {
  --accent-strong: #e8cd86;
  --soft: #7f91ad;
  --race: "Orbitron", "Sora", system-ui, sans-serif;
  --site-panel: rgba(12, 20, 36, 0.92);
  --site-edge: rgba(148, 176, 220, 0.16);
}

/* Fixed race stripes like the marketing site ? keep content clear of them */
body.cockpit {
  background:
    radial-gradient(900px 480px at 8% -10%, rgba(77, 121, 214, 0.14), transparent 55%),
    radial-gradient(700px 400px at 100% 8%, rgba(212, 181, 106, 0.08), transparent 50%),
    linear-gradient(165deg, #060b14, #0a1322 48%, #101b2e);
}

body.cockpit::before {
  content: "";
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 6px;
  z-index: 0;
  background: repeating-linear-gradient(
    180deg,
    var(--accent-strong) 0 14px,
    #0b1526 14px 28px
  );
  opacity: 0.55;
  pointer-events: none;
}

body.cockpit::after {
  content: "";
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  width: 6px;
  z-index: 0;
  background: repeating-linear-gradient(
    180deg,
    rgba(239, 68, 68, 0.85) 0 14px,
    #0b1526 14px 28px
  );
  opacity: 0.45;
  pointer-events: none;
}

.cockpit .app {
  max-width: 1480px;
  padding: 22px 28px 28px;
  margin: 0 auto;
}

.cockpit .topbar {
  margin-left: 0;
  border-radius: 16px;
  border: 1px solid var(--site-edge);
  background:
    linear-gradient(160deg, rgba(8, 16, 30, 0.94), rgba(10, 20, 36, 0.88)),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.015) 0 2px, transparent 2px 6px);
  box-shadow: 0 12px 32px rgba(2, 6, 14, 0.45), inset 0 0 0 1px rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(10px);
}

.cockpit .topbar::after {
  background: linear-gradient(90deg, transparent, rgba(212, 181, 106, 0.55), transparent);
}

.cockpit .brand {
  font-family: var(--race);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 15px;
  color: #f7fbff;
  text-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
}

.cockpit .brand-sub {
  font-family: "Sora", system-ui, sans-serif;
  color: var(--soft);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.cockpit .brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  box-shadow: none;
}

/* Primary actions = website gold, not cockpit red */
.cockpit button {
  background: linear-gradient(135deg, #e8cd86, #d4b56a);
  color: #0b1020 !important;
  border: 1px solid rgba(212, 181, 106, 0.55);
  box-shadow: 0 8px 20px rgba(212, 181, 106, 0.18);
  text-shadow: none;
  letter-spacing: 0.02em;
}

.cockpit button:hover {
  background: linear-gradient(135deg, #f0d99a, #e0c174);
  box-shadow: 0 10px 24px rgba(212, 181, 106, 0.24);
  transform: translateY(-1px);
}

.cockpit button:active {
  transform: translateY(0);
  box-shadow: 0 4px 12px rgba(212, 181, 106, 0.2);
}

.cockpit button.ghost {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--site-edge);
  color: var(--text) !important;
  box-shadow: none;
}

.cockpit button.ghost:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(148, 176, 220, 0.35);
  box-shadow: none;
  color: #fff !important;
}

/* Sidebar nav: clean dark cards like website cockpit tiles */
.cockpit button.sidebar-link,
.cockpit .sidebar-link {
  background:
    linear-gradient(160deg, rgba(8, 16, 30, 0.96), rgba(10, 20, 36, 0.9)) !important;
  border: 1px solid var(--site-edge) !important;
  color: var(--text) !important;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03) !important;
  text-shadow: none !important;
}

.cockpit button.sidebar-link:hover,
.cockpit .sidebar-link:hover,
.cockpit .sidebar-link:focus-visible {
  border-color: rgba(212, 181, 106, 0.35) !important;
  background:
    linear-gradient(160deg, rgba(12, 22, 40, 0.98), rgba(10, 20, 36, 0.94)) !important;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28) !important;
  transform: translateY(-1px);
}

.cockpit .sidebar-link.is-active {
  border-color: rgba(212, 181, 106, 0.42) !important;
  box-shadow:
    inset 3px 0 0 var(--accent-strong),
    0 14px 30px rgba(0, 0, 0, 0.32) !important;
}

.cockpit .sidebar-link::before {
  font-family: var(--race);
  border-color: rgba(212, 181, 106, 0.28);
  color: var(--accent-strong);
  background: rgba(8, 14, 26, 0.95);
  box-shadow: none;
}

.cockpit .sidebar-brand-panel {
  border: 1px solid var(--site-edge);
  background:
    linear-gradient(160deg, rgba(8, 16, 30, 0.98), rgba(10, 20, 36, 0.92));
  box-shadow: 0 12px 32px rgba(2, 6, 14, 0.4);
}

.cockpit .sidebar-brand-name {
  font-family: var(--race);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.cockpit .sidebar-brand-kicker {
  color: var(--accent-strong);
}

.cockpit .sidebar-brand-system,
.cockpit .sidebar-brand-title,
.cockpit .sidebar-brand-meta {
  color: var(--soft);
}

/* Cards / panels match website live demo shell */
.cockpit .card,
.cockpit .hero,
.cockpit .ai-dock,
.cockpit .metric,
.cockpit .kv-item,
.cockpit .pid-chart-card,
.cockpit .chat-messages,
.cockpit .playback-status,
.cockpit .pid-list,
.cockpit .overview-tile {
  border: 1px solid rgba(148, 176, 220, 0.22) !important;
  background:
    linear-gradient(160deg, rgba(8, 16, 30, 0.92), rgba(10, 20, 36, 0.82)) !important;
  box-shadow: 0 12px 32px rgba(2, 6, 14, 0.35), inset 0 0 0 1px rgba(255, 255, 255, 0.03) !important;
  backdrop-filter: blur(8px);
}

.cockpit .card::before,
.cockpit .hero::before {
  opacity: 0.35;
}

.cockpit .section-title,
.cockpit h2,
.cockpit h3,
.cockpit .metric strong,
.cockpit .gauge-value,
.cockpit .hero-title {
  font-family: var(--race);
  letter-spacing: 0.06em;
  text-shadow: none;
  color: #f7fbff;
}

.cockpit .overview-kicker,
.cockpit .ai-dock-kicker {
  color: var(--accent-strong) !important;
  text-shadow: none !important;
  font-family: var(--race);
}

.cockpit .mechanic-float,
.cockpit .card-mechanic {
  border-color: rgba(148, 176, 220, 0.28) !important;
  border-left: 3px solid var(--accent-strong) !important;
  background:
    linear-gradient(160deg, rgba(8, 16, 30, 0.94), rgba(10, 20, 36, 0.86)) !important;
  box-shadow: 0 12px 32px rgba(2, 6, 14, 0.4) !important;
}

.cockpit .card-mechanic h3 {
  color: var(--accent-strong) !important;
  text-shadow: none !important;
}

.cockpit .card-dtcs {
  border-color: rgba(248, 113, 113, 0.35) !important;
}

.cockpit .workspace-section-live .section-head::before {
  background: linear-gradient(180deg, var(--accent-strong), rgba(212, 181, 106, 0.25));
  box-shadow: none;
}

.cockpit .hero-map-frame {
  border-color: rgba(148, 176, 220, 0.28);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.cockpit .stream-status.live {
  border-color: rgba(52, 211, 153, 0.45);
  background: rgba(16, 185, 129, 0.14);
  color: #6ee7b7;
  box-shadow: none;
}

.cockpit .ai-dock {
  border-color: rgba(212, 181, 106, 0.28) !important;
}

@media (max-width: 900px) {
  .cockpit .app {
    padding: 16px 16px 24px;
  }
}

/* ===== Top menu layout + professional cards (2026-09-18b) ===== */
.alert-prefs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}
.alert-pref-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 10px;
  align-items: start;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(148, 176, 220, 0.16);
  background: rgba(6, 12, 22, 0.45);
  min-width: 0;
}
.alert-pref-item strong { display: block; font-size: 13px; }
.alert-pref-item span { display: block; font-size: 12px; color: var(--muted); line-height: 1.4; }
.alert-pref-group {
  grid-column: 1 / -1;
  margin-top: 4px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(158, 175, 200, 0.85);
  font-weight: 700;
}
.portal-coming-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin: 0 0 12px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(212, 181, 106, 0.32);
  background: linear-gradient(90deg, rgba(212, 181, 106, 0.14), rgba(77, 121, 214, 0.1));
  color: #e8eef8;
  font-size: 0.88rem;
}
.portal-coming-strip strong {
  font-family: var(--race, "Orbitron", "Sora", sans-serif);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--accent-strong, #e8cd86);
}
.portal-coming-sep { opacity: 0.45; }

.portal-top-menu {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: stretch;
  margin: 0 0 16px;
  padding: 10px;
  border-radius: 16px;
  border: 1px solid rgba(148, 176, 220, 0.2);
  background:
    linear-gradient(160deg, rgba(8, 16, 30, 0.96), rgba(10, 20, 36, 0.9));
  box-shadow: 0 12px 28px rgba(2, 6, 14, 0.35);
  position: sticky;
  top: 86px;
  z-index: 35;
}

.cockpit button.portal-top-link,
.portal-top-link {
  display: inline-flex !important;
  align-items: center;
  gap: 10px;
  padding: 10px 12px !important;
  border-radius: 12px !important;
  border: 1px solid rgba(148, 176, 220, 0.18) !important;
  background: rgba(255, 255, 255, 0.02) !important;
  color: var(--text) !important;
  box-shadow: none !important;
  text-shadow: none !important;
  cursor: pointer;
  min-width: 0;
}

.cockpit button.portal-top-link:hover,
.portal-top-link:hover {
  border-color: rgba(212, 181, 106, 0.35) !important;
  background: rgba(255, 255, 255, 0.05) !important;
  transform: none !important;
}

.cockpit button.portal-top-link.is-active,
.portal-top-link.is-active {
  border-color: rgba(212, 181, 106, 0.45) !important;
  background: linear-gradient(145deg, rgba(212, 181, 106, 0.14), rgba(77, 121, 214, 0.1)) !important;
  box-shadow: inset 0 0 0 1px rgba(212, 181, 106, 0.12) !important;
}

.portal-top-num {
  font-family: var(--race, "Orbitron", "Sora", sans-serif);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--accent-strong, #e8cd86);
  min-width: 1.6rem;
}

.portal-top-copy {
  display: grid;
  gap: 2px;
  text-align: left;
}
.portal-top-copy strong {
  font-size: 0.86rem;
  font-weight: 650;
  color: #f7fbff;
}
.portal-top-copy small {
  font-size: 0.68rem;
  color: var(--soft, #7f91ad);
  letter-spacing: 0.02em;
}

.portal-top-link-ai .portal-top-num {
  color: #7dd3fc;
}

.portal-top-soon {
  margin-left: auto;
  align-self: center;
  font-family: var(--race, "Orbitron", "Sora", sans-serif);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-strong, #e8cd86);
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px dashed rgba(212, 181, 106, 0.4);
}

.top-nav-shell {
  grid-template-columns: 220px minmax(0, 1fr) !important;
}

.dashboard-sidebar.is-compact-rail {
  gap: 12px;
}

.dashboard-sidebar.is-compact-rail .sidebar-brand-panel,
.dashboard-sidebar.is-compact-rail .sidebar-menu {
  display: none !important;
}

/* Stop gold primary from painting every button yellow */
.cockpit button.storyboard-item,
.cockpit .storyboard-item,
.cockpit button.playback-checkpoint,
.cockpit .playback-checkpoint,
.cockpit button.mode-tab,
.cockpit .mode-tab,
.cockpit button.dtc-item,
.cockpit button.overview-tile,
.cockpit button.topbar-icon {
  background:
    linear-gradient(160deg, rgba(8, 16, 30, 0.96), rgba(10, 20, 36, 0.88)) !important;
  color: #eef3fb !important;
  border: 1px solid rgba(148, 176, 220, 0.22) !important;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03) !important;
  text-shadow: none !important;
}

.cockpit button.storyboard-item:hover,
.cockpit .storyboard-item:hover,
.cockpit button.playback-checkpoint:hover,
.cockpit .playback-checkpoint:hover {
  border-color: rgba(110, 184, 212, 0.45) !important;
  background:
    linear-gradient(160deg, rgba(10, 22, 40, 0.98), rgba(12, 24, 44, 0.92)) !important;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28) !important;
  transform: translateY(-1px);
}

.cockpit .storyboard-item {
  display: grid !important;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 14px;
  text-align: left;
  padding: 14px 16px !important;
  border-radius: 14px !important;
}

.cockpit .storyboard-step {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(77, 121, 214, 0.18);
  border: 1px solid rgba(110, 184, 212, 0.35);
  color: #dbeafe;
  font-family: var(--race, "Orbitron", "Sora", sans-serif);
  font-size: 0.95rem;
}

.cockpit .storyboard-title-row strong {
  color: #f7fbff;
  font-size: 0.95rem;
}

.cockpit .storyboard-time {
  color: #93c5fd !important;
  font-variant-numeric: tabular-nums;
}

.cockpit .storyboard-meta,
.cockpit .storyboard-note {
  color: #9eafc8 !important;
}

.cockpit button.mode-tab.is-active,
.cockpit .mode-tab.is-active {
  border-color: rgba(110, 184, 212, 0.55) !important;
  background: linear-gradient(145deg, rgba(56, 189, 248, 0.16), rgba(10, 20, 36, 0.92)) !important;
  color: #e0f2fe !important;
}

/* Premium Master Mechanic dock */
.cockpit .ai-dock-premium,
.ai-dock-premium {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(212, 181, 106, 0.38) !important;
  background:
    linear-gradient(155deg, rgba(7, 14, 28, 0.98), rgba(12, 24, 46, 0.94) 55%, rgba(8, 18, 34, 0.96)),
    radial-gradient(circle at 88% 12%, rgba(232, 205, 134, 0.16), transparent 42%) !important;
  box-shadow:
    0 18px 40px rgba(0, 0, 0, 0.45),
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    0 0 40px rgba(77, 121, 214, 0.08) !important;
  padding: 16px 18px 14px !important;
}

.ai-dock-glow {
  position: absolute;
  inset: -40% auto auto 55%;
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, rgba(110, 184, 212, 0.18), transparent 68%);
  pointer-events: none;
}

.ai-dock-premium .ai-dock-kicker {
  font-family: var(--race, "Orbitron", "Sora", sans-serif);
  letter-spacing: 0.14em;
  color: var(--accent-strong, #e8cd86) !important;
}

.ai-dock-premium strong {
  font-family: var(--race, "Orbitron", "Sora", sans-serif);
  letter-spacing: 0.04em;
  font-size: 1.05rem;
}

.ai-dock-premium .ai-dock-messages {
  border: 1px solid rgba(148, 176, 220, 0.2);
  background: rgba(2, 8, 18, 0.55);
  border-radius: 14px;
  min-height: 88px;
}

.ai-dock-premium .chat-bubble.ai,
.ai-dock-premium .chat-bubble.assistant {
  background: linear-gradient(145deg, rgba(56, 189, 248, 0.14), rgba(12, 24, 44, 0.9));
  border-color: rgba(110, 184, 212, 0.35);
}

.ai-dock-premium .chat-bubble.user {
  background: linear-gradient(145deg, rgba(212, 181, 106, 0.16), rgba(18, 16, 10, 0.85));
  border-color: rgba(212, 181, 106, 0.35);
}

.ai-dock-premium #ai-chat-input {
  border: 1px solid rgba(148, 176, 220, 0.28);
  background: rgba(2, 8, 18, 0.72);
  border-radius: 12px;
  color: #eef3fb;
}

.ai-dock-premium #ai-chat-send {
  background: linear-gradient(135deg, #e8cd86, #d4b56a) !important;
  color: #0b1020 !important;
  border-radius: 12px;
  min-width: 72px;
}

@media (max-width: 1100px) {
  .top-nav-shell {
    grid-template-columns: 1fr !important;
  }
  .dashboard-sidebar.is-compact-rail {
    position: static;
    max-height: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }
  .portal-top-soon { margin-left: 0; width: 100%; text-align: center; }
}

/* Crystal ball panel + workshop feedback */
.ai-crystal-panel { margin-top: 10px; }
.ai-driver-coach {
  margin-top: 10px;
  border: 1px solid rgba(125, 211, 252, 0.28);
  border-radius: 14px;
  padding: 12px;
  background: linear-gradient(160deg, rgba(8, 28, 48, 0.75), rgba(2, 8, 18, 0.55));
}
.ai-driver-coach-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 8px;
}
.ai-driver-coach-head strong {
  color: #7dd3fc;
  letter-spacing: 0.04em;
  font-size: 13px;
}
.ai-driver-coach-list {
  display: grid;
  gap: 8px;
}
.ai-driver-coach-item {
  display: grid;
  gap: 2px;
}
.ai-driver-coach-item strong {
  font-size: 12px;
  color: #e9eef5;
}
.ai-driver-coach-item span,
.ai-driver-coach-item em {
  font-size: 11px;
  color: #9eafc8;
  line-height: 1.35;
  font-style: normal;
}
.vin-identity-form {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(148, 176, 220, 0.18);
  display: grid;
  gap: 8px;
}
.vin-identity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
}
.vin-identity-grid label {
  display: grid;
  gap: 4px;
  font-size: 11px;
  color: #9eafc8;
}
.vin-identity-grid input {
  width: 100%;
  border-radius: 8px;
  border: 1px solid rgba(148, 176, 220, 0.28);
  background: rgba(2, 8, 18, 0.55);
  color: #e9eef5;
  padding: 6px 8px;
}
.ai-crystal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}
.ai-crystal-chip {
  border: 1px solid rgba(148, 176, 220, 0.22);
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(2, 8, 18, 0.45);
  display: grid;
  gap: 4px;
}
.ai-crystal-chip strong {
  font-size: 12px;
  color: #e8cd86;
  letter-spacing: 0.04em;
}
.ai-crystal-chip span {
  font-size: 11px;
  color: #9eafc8;
  line-height: 1.35;
}
.ai-crystal-pattern strong { color: #7dd3fc; }
.ai-feedback-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(148, 176, 220, 0.14);
}

/* ===== Focused live cockpit layout (2026-09-18c) ===== */
.portal-panel-hidden {
  display: none !important;
}

.portal-focus-shell,
.top-nav-shell.portal-focus-shell {
  grid-template-columns: minmax(0, 1fr) !important;
  gap: 16px !important;
}

.portal-focus-shell .dashboard-sidebar,
.portal-focus-shell .is-compact-rail {
  display: none !important;
}

/* Stop sticky stacking / overlap ? one calm scroll */
.cockpit .ai-dock,
.ai-dock,
.ai-dock-premium,
.ai-dock-inline {
  position: relative !important;
  top: auto !important;
  z-index: 1 !important;
}

.cockpit .mode-control-bar,
.mode-control-bar {
  position: relative !important;
  top: auto !important;
  z-index: 1 !important;
  margin-bottom: 12px;
}

.portal-top-menu {
  position: sticky;
  top: 12px;
  z-index: 30;
}

.cockpit .topbar {
  position: sticky;
  top: 0;
  z-index: 50;
}

/* Race stripes behind content, not over it */
body.cockpit::before,
body.cockpit::after {
  z-index: 0 !important;
  pointer-events: none;
}

.cockpit .app {
  padding-left: 22px;
  padding-right: 22px;
  overflow: visible;
}

.dashboard-main {
  gap: 16px !important;
  min-width: 0;
}

.live-cockpit-panel {
  padding: 16px !important;
}

.ops-stage-focus {
  display: grid !important;
  grid-template-columns: minmax(168px, 0.85fr) minmax(0, 1.55fr) minmax(150px, 0.8fr) !important;
  grid-template-areas: "instruments map sparks" !important;
  gap: 12px !important;
  align-items: stretch;
}

.ops-stage-focus .ops-prime,
.ops-stage-focus .cockpit-instruments {
  grid-area: instruments;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  min-height: 0;
  overflow: auto;
}

.ops-stage-focus .ops-dials {
  flex-direction: column !important;
  flex-wrap: nowrap;
  justify-content: flex-start;
  gap: 10px;
  align-items: stretch;
}

.ops-stage-focus .ops-live-board {
  min-width: 0;
}

.ops-stage-focus .ops-map-col,
.ops-stage-focus .cockpit-map {
  grid-area: map;
  min-width: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}

.ops-stage-focus .ops-sparks,
.ops-stage-focus .cockpit-sparks {
  grid-area: sparks;
  display: flex !important;
  flex-direction: column !important;
  gap: 8px;
  min-width: 0;
  min-height: 0;
  overflow: auto;
}

.ops-stage-focus .ops-map-col .hero-map-frame {
  width: 100%;
  flex: 1 1 auto;
  min-height: 200px;
  height: auto !important;
  max-height: none !important;
}

.ops-stage-focus .ops-map-col .ops-scrubber {
  min-width: 0;
  width: 100%;
}

.ops-stage-focus .ops-dial {
  max-width: none;
  width: 100%;
  flex: 0 0 auto;
  padding: 10px 12px 8px !important;
  border-radius: 16px !important;
  background:
    radial-gradient(circle at 50% 18%, rgba(56, 189, 248, 0.14), transparent 52%),
    linear-gradient(165deg, rgba(10, 18, 32, 0.96), rgba(6, 12, 22, 0.94)) !important;
  border: 1px solid rgba(148, 176, 220, 0.28) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 10px 22px rgba(0, 0, 0, 0.32) !important;
}

.ops-dial-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 2px;
}

.ops-dial-kicker {
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(127, 145, 173, 0.95);
}

.ops-stage-focus .ops-dial .gauge-label {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  color: rgba(232, 205, 134, 0.92);
}

.ops-stage-focus .ops-dial canvas {
  width: 168px !important;
  height: 168px !important;
  max-width: 100%;
  margin: 0 auto;
}

.ops-stage-focus .ops-dial .gauge-value {
  font-family: var(--race, "Orbitron", "Sora", sans-serif);
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  color: #f7fbff;
  text-shadow: none;
}

.ops-dial-readout {
  display: none;
}

/* Live panel: dials first — keep chrome compact so gauges aren't below the fold */
body.portal-authed .portal-coming-strip {
  display: none;
}

body.portal-authed .portal-top-menu {
  position: relative;
  top: auto;
  z-index: 5;
  padding: 6px;
  gap: 6px;
  margin-bottom: 8px;
}

body.portal-authed .portal-top-link {
  padding: 8px 10px;
}

body.portal-authed .overview-ribbon {
  display: none;
}

body.portal-authed .mode-control-bar {
  margin-bottom: 10px !important;
  padding: 8px 10px !important;
}

#live-drive-deck {
  scroll-margin-top: 12px;
}

/* History / Sensors / Graphs keep the cockpit deck above supporting cards */
#history-cycles-card,
#live-operations-card,
#graphs-workbench-card {
  scroll-margin-top: 12px;
}

body.workspace-history .hero-kicker .live-pulse-dot {
  display: none;
}

body.workspace-history #playback-mode-pill {
  border-color: rgba(246, 195, 68, 0.45);
  color: #fde68a;
}

.ops-live-board {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.ops-metric-bars {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

/* Website-style horizontal bars instead of side conic dials */
.bar-gauge.mini-gauge {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  grid-template-areas:
    "label value unit"
    "bar bar bar";
  gap: 4px 8px;
  justify-items: start;
  align-items: baseline;
  padding: 10px 12px !important;
  border-radius: 12px !important;
  border: 1px solid rgba(148, 176, 220, 0.2) !important;
  background: rgba(8, 16, 30, 0.72) !important;
  box-shadow: none !important;
}

.bar-gauge.mini-gauge::before,
.bar-gauge.mini-gauge::after {
  display: none !important;
}

.bar-gauge .mini-gauge-label {
  grid-area: label;
  font-family: var(--race, "Orbitron", "Sora", sans-serif);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  color: #7f91ad;
}

.bar-gauge strong {
  grid-area: value;
  font-family: var(--race, "Orbitron", "Sora", sans-serif);
  font-size: 1rem;
  color: #f7fbff;
}

.bar-gauge .mini-gauge-unit {
  grid-area: unit;
  font-size: 0.68rem;
  color: #7f91ad;
}

.bar-gauge .bar-track {
  grid-area: bar;
  display: block;
  width: 100%;
  height: 7px;
  border-radius: 999px;
  background: rgba(148, 176, 220, 0.14);
  overflow: hidden;
  margin-top: 2px;
}

.bar-gauge .bar-track i {
  display: block;
  height: 100%;
  width: var(--fill, 0%);
  border-radius: inherit;
  background: linear-gradient(90deg, #6eb8d4, #e8cd86);
  transition: width 0.25s ease;
}

.ops-stage-focus .ops-sparks {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 0;
}

.ops-stage-focus .ops-spark {
  max-width: none;
}

.ops-stage-focus .hero-map-frame {
  height: 320px !important;
  min-height: 220px !important;
  max-height: 360px !important;
  flex: 0 0 auto !important;
  overflow: hidden !important;
}

/* Leaflet must fill the frame — never drive document height. */
.hero-map-frame .hero-map,
.hero-map-frame .leaflet-container,
#map.leaflet-container {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
}

.live-pulse-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 50%;
  background: #f87171;
  box-shadow: 0 0 0 0 rgba(248, 113, 113, 0.5);
  animation: livePulse 1.4s ease-out infinite;
  vertical-align: middle;
}

.ai-dock-inline {
  margin-top: 4px;
}

.ai-dock-inline .ai-dock-messages {
  max-height: 140px;
}

@media (max-width: 1100px) {
  .ops-stage-focus {
    grid-template-columns: 1fr !important;
    grid-template-areas: "instruments" "map" "sparks" !important;
  }
  .ops-stage-focus .ops-dials {
    flex-direction: row !important;
    justify-content: center;
    flex-wrap: wrap;
  }
  .ops-stage-focus .ops-dial {
    max-width: 190px;
  }
  .ops-stage-focus .ops-sparks,
  .ops-stage-focus .cockpit-sparks {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
  .ops-metric-bars {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .ops-stage-focus .ops-sparks {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 720px) {
  .ops-metric-bars {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .portal-top-menu {
    position: relative;
    top: auto;
  }
}

/* ===== Cockpit shell + meter modes (pit-wall) ===== */
.cockpit-shell {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cockpit-ai.ai-dock-inline {
  margin: 0;
  padding: 12px 14px 10px;
  border-radius: 16px;
  border: 1px solid rgba(212, 181, 106, 0.28);
  background:
    radial-gradient(circle at 12% 0%, rgba(212, 181, 106, 0.12), transparent 45%),
    linear-gradient(165deg, rgba(14, 20, 34, 0.98), rgba(8, 14, 26, 0.96));
}

.cockpit-ai .ai-dock-head {
  margin-bottom: 6px;
}

.cockpit-ai .ai-dock-sub {
  margin: 2px 0 0;
  font-size: 12px;
}

.cockpit-ai .ai-dock-compose {
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
}

.cockpit-ai #ai-chat-input {
  min-height: 38px;
  max-height: 64px;
}

.meter-mode-toggle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  border: 1px solid rgba(148, 176, 220, 0.22);
  background: rgba(6, 12, 22, 0.72);
}

.meter-mode-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
}

.meter-mode-btn.is-active {
  background: linear-gradient(135deg, rgba(212, 181, 106, 0.95), rgba(232, 205, 134, 0.88));
  color: #0b1220;
}

.ops-dial-bar {
  display: none;
  width: 100%;
  height: 14px;
  margin: 8px 0 4px;
  border-radius: 999px;
  background: rgba(8, 14, 26, 0.85);
  border: 1px solid rgba(148, 176, 220, 0.2);
  overflow: hidden;
}

.ops-dial-bar i {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #38bdf8, #d4b56a 55%, #ef4444);
  transition: width 80ms linear;
}

body.meter-mode-bars .ops-dial canvas {
  display: none !important;
}

body.meter-mode-bars .ops-dial-bar {
  display: block;
  height: 18px;
  margin: 14px 0 8px;
}

body.meter-mode-bars .ops-dial-readout .gauge-value {
  font-size: 1.65rem;
  font-family: 'Orbitron', 'Sora', sans-serif;
  letter-spacing: 0.04em;
}

body.meter-mode-compact .ops-dial canvas {
  width: 112px !important;
  height: 112px !important;
}

body.meter-mode-compact .ops-metric-bars {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

body.meter-mode-compact .ops-checkpoints,
body.meter-mode-compact #playback-status,
body.meter-mode-compact #route-state-summary {
  display: none !important;
}

.cockpit-sparks .ops-spark {
  flex: 1 1 auto;
  min-height: 0;
}

@media (max-width: 720px) {
  .meter-mode-toggle {
    width: 100%;
    justify-content: stretch;
  }
  .meter-mode-btn {
    flex: 1;
    text-align: center;
  }
  .ops-stage-focus .ops-sparks,
  .ops-stage-focus .cockpit-sparks {
    grid-template-columns: 1fr !important;
  }
}

/* ===== HUD deck polish (reference-inspired pit wall) ===== */
.hud-chrome-left,
.hud-chrome-center,
.hud-chrome-right {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex-wrap: wrap;
  overflow: visible;
}

.hud-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'Orbitron', 'Sora', sans-serif;
  font-size: 11px;
  letter-spacing: 0.16em;
  color: #3ddbd9;
  font-weight: 700;
}

.hud-vin-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.hud-vin-block strong {
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  white-space: normal;
  overflow: visible;
  word-break: break-word;
}

.hud-muted {
  color: var(--muted);
  font-size: 12px;
}

.hud-meta {
  max-width: min(280px, 100%);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hud-ai {
  border-radius: 14px !important;
  border: 1px solid rgba(212, 181, 106, 0.28) !important;
  background:
    radial-gradient(circle at 8% 0%, rgba(212, 181, 106, 0.12), transparent 42%),
    rgba(8, 14, 26, 0.82) !important;
}

.hud-ai-main {
  display: grid;
  gap: 6px;
}

.hud-ai-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.hud-ai .ai-dock-compose {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.hud-ai #ai-chat-input {
  min-height: 36px;
  max-height: 48px;
  resize: none;
}

.hud-ai-status:empty { display: none; }

.hud-panel {
  border-radius: 14px;
  border: 1px solid rgba(148, 176, 220, 0.16);
  background: rgba(8, 14, 26, 0.72);
  backdrop-filter: blur(10px);
  padding: 10px;
  min-height: 0;
  overflow: auto;
}

.hud-panel-grow { flex: 1 1 auto; }

.hud-panel-title {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(158, 175, 200, 0.9);
  margin-bottom: 8px;
  font-weight: 700;
}

.hud-sparks {
  display: flex !important;
  flex-direction: column !important;
  gap: 8px !important;
}

.hud-sparks .ops-spark {
  max-width: none !important;
  width: 100% !important;
  background: rgba(6, 12, 22, 0.7);
  border: 1px solid rgba(255, 79, 163, 0.14);
}

.hud-metric-bars {
  display: grid !important;
  grid-template-columns: 1fr !important;
  gap: 8px !important;
}

.hud-metric-bars .mini-gauge {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
}

.hud-metric-bars .bar-track {
  grid-column: 1 / -1;
}

.hud-map-halo {
  pointer-events: none;
  position: absolute;
  left: 50%;
  bottom: -8%;
  width: 78%;
  height: 34%;
  transform: translateX(-50%);
  border-radius: 50%;
  background:
    radial-gradient(ellipse at center, rgba(61, 219, 217, 0.22), transparent 62%),
    radial-gradient(ellipse at center, rgba(255, 79, 163, 0.12), transparent 70%);
  filter: blur(2px);
  z-index: 0;
}

.hud-map-stage .hud-map-frame {
  z-index: 1;
}

.hud-scrubber {
  border-color: rgba(255, 79, 163, 0.22) !important;
  background:
    linear-gradient(160deg, rgba(22, 10, 18, 0.92), rgba(8, 14, 26, 0.94)) !important;
}

.hud-hero-gauge {
  text-align: center;
  background:
    radial-gradient(circle at 50% 20%, rgba(255, 79, 163, 0.16), transparent 50%),
    linear-gradient(165deg, rgba(12, 18, 32, 0.98), rgba(6, 10, 18, 0.96)) !important;
  border-color: rgba(255, 79, 163, 0.28) !important;
}

.hud-hero-gauge .gauge-value {
  font-family: 'Orbitron', 'Sora', sans-serif;
  font-size: 1.55rem !important;
  letter-spacing: 0.04em;
}

.hud-dial-pair .ops-dial {
  text-align: center;
}

.hud-panel-gauges {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

body.meter-mode-compact .hud-scrubber .ops-checkpoints,
body.meter-mode-compact .hud-scrubber #playback-status,
body.meter-mode-compact .hud-scrubber #route-state-summary {
  display: none !important;
}

/* ===== Concept HUD modules (rings / climate / boost) ===== */
.hud-box {
  border: 1px solid rgba(255, 79, 163, 0.16) !important;
  box-shadow: inset 0 0 0 1px rgba(61, 219, 217, 0.06), 0 10px 28px rgba(0,0,0,0.28) !important;
}

.hud-climate {
  display: grid;
  gap: 10px;
}

.hud-climate-row {
  display: grid;
  grid-template-columns: 64px 40px minmax(0, 1fr) 28px;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  color: #c5d4e8;
}

.hud-climate-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(8, 14, 26, 0.9);
  border: 1px solid rgba(148, 176, 220, 0.2);
  overflow: hidden;
}

.hud-climate-track i {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #3ddbd9, #ff4fa3);
}

.hud-rings {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

.hud-ring {
  display: grid;
  justify-items: center;
  gap: 2px;
  text-align: center;
}

.hud-ring svg {
  width: 54px;
  height: 54px;
  transform: rotate(-90deg);
}

.hud-ring-bg {
  fill: none;
  stroke: rgba(148, 176, 220, 0.16);
  stroke-width: 3;
}

.hud-ring-fg {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  transition: stroke-dasharray 120ms linear;
}

.hud-ring strong {
  font-size: 12px;
  margin-top: -6px;
}

.hud-ring span {
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.hud-speedo-head {
  display: flex !important;
  justify-content: space-between;
  align-items: center;
}

.hud-boost {
  margin: 4px 0 10px;
}

.hud-boost-labels,
.hud-boost-scale {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}

.hud-boost-track,
.hud-power-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(8, 14, 26, 0.9);
  border: 1px solid rgba(255, 79, 163, 0.22);
  overflow: hidden;
}

.hud-boost-track i {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #ff4fa3, #fb923c, #ef4444);
}

.hud-power-bars {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.hud-power-row {
  display: grid;
  grid-template-columns: 44px 36px minmax(0, 1fr) 28px;
  gap: 8px;
  align-items: center;
  font-size: 12px;
}

.hud-power-track i {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #3ddbd9, #ff4fa3);
}

/* desk v2 — kill sticky overlays that cover the mechanic bay when scrolling */
body.portal-authed #hud-deck #ai-dock.ai-dock,
body.portal-authed #hud-deck .hud-ai {
  position: relative !important;
  top: auto !important;
  z-index: 1 !important;
}
body.portal-authed #hud-stage .ops-scrubber {
  position: relative !important;
  bottom: auto !important;
  contain: none !important;
}
