/* ==========================================================================
   EOR IMSA / GTD Distribution Viewer — Elbows Out Racing Theme Stylesheet
   Scoped under .dist-app & distribution modals so it integrates seamlessly
   with EOR's Tailwind layout, racing typography, and Dark/Light themes.
   ========================================================================== */

.dist-app {
  --dist-bg: #070a10;
  --dist-card: rgba(13, 19, 32, 0.84);
  --dist-card-solid: #0f1624;
  --dist-input: #0a0f1a;
  --dist-border: rgba(148, 163, 184, 0.16);
  --dist-border-strong: rgba(244, 131, 0, 0.35);
  --dist-text: #f1f5f9;
  --dist-muted: #94a3b8;
  --dist-dim: #64748b;

  /* Official EOR / IMSA Class Accents */
  --dist-orange: #f48300;
  --dist-red: #ff0015;
  --dist-pro: #dc2626;
  --dist-pro-soft: rgba(220, 38, 38, 0.18);
  --dist-pro-border: rgba(239, 68, 68, 0.48);
  --dist-gtd: #059669;
  --dist-gtd-soft: rgba(5, 150, 105, 0.18);
  --dist-gtd-border: rgba(16, 185, 129, 0.45);
  --dist-lmp2: #0072ce;
  --dist-amber: #f59e0b;
  --dist-amber-soft: rgba(245, 158, 11, 0.16);
  --dist-amber-border: rgba(245, 158, 11, 0.45);
  --dist-radius: 14px;
  --dist-radius-sm: 8px;
  --dist-mono: "Cascadia Code", "Consolas", "JetBrains Mono", ui-monospace, monospace;
  color: var(--dist-text);
  font-size: 13px;
  line-height: 1.45;
}

.dist-app .hidden {
  display: none !important;
}

.dist-app .page-shell {
  max-width: 80rem;
  margin: 0 auto;
  padding: 24px 16px 48px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

@media (min-width: 640px) {
  .dist-app .page-shell {
    padding: 28px 24px 56px;
  }
}

@media (min-width: 1024px) {
  .dist-app .page-shell {
    padding: 32px 32px 64px;
  }
}

body.embed-mode .dist-app .page-shell {
  max-width: 100%;
  padding: 12px 14px 24px;
}

/* Sub-Header Card inside Distribution workspace */
.dist-app .viewer-header {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.92) 0%, rgba(10, 14, 24, 0.96) 100%);
  border: 1px solid var(--dist-border);
  border-left: 4px solid var(--dist-orange);
  border-radius: var(--dist-radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  backdrop-filter: blur(12px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.dist-app .brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.dist-app .brand-logo {
  height: 40px;
  width: auto;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 2px 8px rgba(244, 131, 0, 0.28));
}

.dist-app .brand-text h1 {
  font-family: var(--font-racing);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #f8fafc;
  line-height: 1.2;
}

.dist-app .brand-sub {
  font-size: 12px;
  color: var(--dist-muted);
  margin-top: 3px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.dist-app .header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Sync Status Pill */
.dist-sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--dist-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: 0.03em;
}

.dist-sync-badge.sync-ok {
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid rgba(16, 185, 129, 0.42);
  color: #6ee7b7;
}

.dist-sync-badge.sync-busy {
  background: rgba(244, 131, 0, 0.16);
  border: 1px solid rgba(244, 131, 0, 0.45);
  color: #fdba74;
}

.dist-sync-badge.sync-err {
  background: rgba(239, 68, 68, 0.16);
  border: 1px solid rgba(239, 68, 68, 0.45);
  color: #fca5a5;
}

/* Buttons */
.dist-app .btn,
.dist-modal .btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--dist-radius-sm);
  border: 1px solid transparent;
  font-family: var(--font-racing);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: all 0.16s ease;
}

.dist-app .btn-primary,
.dist-modal .btn-primary {
  background: linear-gradient(135deg, #f48300 0%, #ff0015 100%);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(244, 131, 0, 0.28);
}

.dist-app .btn-primary:hover,
.dist-modal .btn-primary:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(244, 131, 0, 0.4);
}

.dist-app .btn-ghost,
.dist-modal .btn-ghost {
  background: rgba(15, 23, 42, 0.65);
  color: #cbd5e1;
  border-color: rgba(148, 163, 184, 0.22);
}

.dist-app .btn-ghost:hover,
.dist-modal .btn-ghost:hover {
  color: #ffffff;
  background: rgba(30, 41, 59, 0.9);
  border-color: rgba(244, 131, 0, 0.45);
}

.dist-app .btn-secondary,
.dist-modal .btn-secondary {
  background: #1e293b;
  color: #f8fafc;
  border-color: rgba(148, 163, 184, 0.3);
}

.dist-app .btn-secondary:hover,
.dist-modal .btn-secondary:hover {
  background: #334155;
  border-color: rgba(244, 131, 0, 0.45);
}

.dist-app .btn-amber,
.dist-modal .btn-amber {
  background: linear-gradient(135deg, rgba(244, 131, 0, 0.2), rgba(245, 158, 11, 0.14));
  color: #fcd34d;
  border-color: rgba(244, 131, 0, 0.5);
}

.dist-app .btn-amber:hover,
.dist-modal .btn-amber:hover {
  background: linear-gradient(135deg, #f48300, #ea580c);
  color: #ffffff;
  border-color: #f48300;
}

.dist-app .btn-sm,
.dist-modal .btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.dist-app .btn-xs,
.dist-modal .btn-xs {
  padding: 4px 9px;
  font-size: 11px;
}

/* Scope Bar & Controls */
.dist-app .scope-bar {
  background: var(--dist-card);
  border: 1px solid var(--dist-border);
  border-radius: var(--dist-radius);
  padding: 11px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  backdrop-filter: blur(12px);
}

.dist-app .scope-bar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.dist-app .scope-label {
  font-family: var(--font-racing);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--dist-muted);
}

.dist-app .select-input,
.dist-app .text-input,
.dist-modal .select-input,
.dist-modal .text-input {
  background: var(--dist-input);
  color: var(--dist-text);
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: var(--dist-radius-sm);
  padding: 6px 10px;
  font-family: inherit;
  font-size: 12.5px;
  outline: none;
  transition: border-color 0.15s ease;
}

.dist-app .select-input:focus,
.dist-app .text-input:focus,
.dist-modal .select-input:focus,
.dist-modal .text-input:focus {
  border-color: var(--dist-orange);
}

.dist-app .scope-select {
  min-width: 240px;
  font-weight: 600;
}

.dist-app .season-select {
  min-width: 165px;
  font-weight: 700;
}

.dist-modal .field-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11.5px;
  color: #94a3b8;
}

.dist-modal .pr-controls-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
  align-items: end;
}

@media (max-width: 820px) {
  .dist-modal .pr-controls-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* Class & View Tabs */
.dist-app .class-tabs,
.dist-app .view-tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  background: var(--dist-input);
  border: 1px solid var(--dist-border);
  border-radius: 9px;
}

.dist-app .class-tab-btn,
.dist-app .view-tab-btn {
  border: none;
  background: transparent;
  color: var(--dist-muted);
  font-family: var(--font-racing);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.dist-app .class-tab-btn:hover,
.dist-app .view-tab-btn:hover {
  color: #ffffff;
}

.dist-app .view-tab-btn.active {
  background: linear-gradient(135deg, #f48300 0%, #ea580c 100%);
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(244, 131, 0, 0.35);
}

.dist-app .class-tab-btn.active {
  background: #1e293b;
  color: #f8fafc;
}

.dist-app .class-tab-btn.cls-gt3.active {
  background: rgba(5, 150, 105, 0.28);
  color: #6ee7b7;
  box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.5);
}

.dist-app .class-tab-btn.cls-lmp2.active {
  background: rgba(0, 114, 206, 0.32);
  color: #93c5fd;
  box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.55);
}

.dist-app .class-tab-btn.cls-gtp.active {
  background: rgba(244, 131, 0, 0.26);
  color: #fdba74;
  box-shadow: inset 0 0 0 1px rgba(244, 131, 0, 0.55);
}

.dist-app .rack-mode .gt3-only {
  display: none !important;
}

.dist-app .rack-mode .kpi-strip {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.dist-app .readonly-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--dist-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 99px;
  background: rgba(244, 131, 0, 0.14);
  border: 1px solid rgba(244, 131, 0, 0.42);
  color: #fdba74;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Weight Pills */
.dist-app .weight-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.dist-app .wpill {
  font-family: var(--dist-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 99px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.2);
  color: #cbd5e1;
}

/* KPI Strip */
.dist-app .kpi-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}

@media (max-width: 960px) {
  .dist-app .kpi-strip,
  .dist-app .rack-mode .kpi-strip {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 540px) {
  .dist-app .kpi-strip,
  .dist-app .rack-mode .kpi-strip {
    grid-template-columns: 1fr;
  }
}

.dist-app .kpi-card {
  background: var(--dist-card);
  border: 1px solid var(--dist-border);
  border-top: 3px solid #475569;
  border-radius: var(--dist-radius);
  padding: 14px 16px;
  backdrop-filter: blur(12px);
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.dist-app .kpi-card:hover {
  transform: translateY(-2px);
}

.dist-app .kpi-amber { border-top-color: var(--dist-orange); }
.dist-app .kpi-pro { border-top-color: var(--dist-pro); }
.dist-app .kpi-gtd { border-top-color: var(--dist-gtd); }
.dist-app .kpi-neutral { border-top-color: #64748b; }

.dist-app .kpi-label {
  font-family: var(--font-racing);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--dist-muted);
  margin-bottom: 5px;
}

.dist-app .kpi-value {
  font-family: var(--font-racing);
  font-size: 26px;
  font-weight: 700;
  color: #f8fafc;
  line-height: 1.15;
}

.dist-app .kpi-pro .kpi-value { color: #f87171; }
.dist-app .kpi-gtd .kpi-value { color: #34d399; }
.dist-app .kpi-amber .kpi-value { color: #fb923c; }

.dist-app .kpi-sub {
  font-size: 11.5px;
  color: var(--dist-dim);
  margin-top: 4px;
}

/* Panels & Charts */
.dist-app .panel {
  background: var(--dist-card);
  border: 1px solid var(--dist-border);
  border-radius: var(--dist-radius);
  padding: 16px 18px;
  backdrop-filter: blur(12px);
}

.dist-app .panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.dist-app .panel-header h2 {
  font-family: var(--font-racing);
  font-size: 13.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #e2e8f0;
}

.dist-app .panel-hint,
.dist-modal .panel-hint {
  font-size: 11.5px;
  color: var(--dist-muted);
}

.dist-app .charts-grid {
  display: grid;
  grid-template-columns: 2.35fr 1fr;
  gap: 14px;
}

@media (max-width: 960px) {
  .dist-app .charts-grid {
    grid-template-columns: 1fr;
  }
}

.dist-app .chart-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--dist-muted);
}

.dist-app .dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 4px;
}

.dist-app .dot-pro { background: var(--dist-pro); }
.dist-app .dot-gtd { background: var(--dist-gtd); }
.dist-app .dot-amber { background: var(--dist-amber); }

.dist-app .chart-canvas-wrap {
  position: relative;
  width: 100%;
  height: 245px;
}

.dist-app .chart-svg,
.dist-modal .chart-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.dist-app .chart-tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(7, 10, 16, 0.96);
  border: 1px solid rgba(244, 131, 0, 0.45);
  border-radius: 9px;
  padding: 9px 12px;
  font-size: 11.5px;
  color: #f1f5f9;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.65);
  z-index: 25;
  min-width: 205px;
}

.dist-app .formula-bar,
.dist-modal .formula-bar {
  margin-top: 10px;
  padding: 8px 12px;
  background: rgba(8, 12, 22, 0.85);
  border: 1px solid var(--dist-border);
  border-left: 3px solid var(--dist-orange);
  border-radius: 7px;
  font-size: 11.5px;
  color: var(--dist-muted);
}

/* Historical Trends */
.dist-app .hist-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  align-items: center;
}

.dist-app .hist-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 600;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.25);
  color: #e2e8f0;
  cursor: pointer;
}

.dist-app .hist-pill:hover {
  border-color: #f87171;
}

.dist-app .hist-swatch {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
}

.dist-app .trend-up { color: #34d399; font-weight: 700; }
.dist-app .trend-down { color: #f87171; font-weight: 700; }
.dist-app .trend-flat { color: var(--dist-muted); }

.dist-modal .career-chart-wrap {
  position: relative;
  width: 100%;
  height: 180px;
  margin-bottom: 10px;
}

.dist-app .hist-check {
  width: 15px;
  height: 15px;
  cursor: pointer;
  accent-color: #f48300;
}

/* Table Controls & Data Table */
.dist-app .controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--dist-border);
}

.dist-app .roster-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.dist-app .search-input {
  background: var(--dist-input);
  color: var(--dist-text);
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: var(--dist-radius-sm);
  padding: 6px 11px;
  font-family: inherit;
  font-size: 12.5px;
  width: 230px;
  outline: none;
}

.dist-app .search-input:focus {
  border-color: var(--dist-orange);
}

.dist-app .filter-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.dist-app .chip {
  padding: 4px 11px;
  border-radius: 99px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  background: var(--dist-input);
  color: var(--dist-muted);
  font-family: var(--font-racing);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.14s ease;
}

.dist-app .chip:hover {
  color: #ffffff;
  border-color: rgba(244, 131, 0, 0.45);
}

.dist-app .chip.active {
  background: rgba(244, 131, 0, 0.24);
  color: #ffffff;
  border-color: rgba(244, 131, 0, 0.65);
}

.dist-app .chip-pro.active {
  background: var(--dist-pro-soft);
  color: #fca5a5;
  border-color: var(--dist-pro-border);
}

.dist-app .chip-gtd.active {
  background: var(--dist-gtd-soft);
  color: #6ee7b7;
  border-color: var(--dist-gtd-border);
}

.dist-app .chip-amber.active {
  background: var(--dist-amber-soft);
  color: #fcd34d;
  border-color: var(--dist-amber-border);
}

.dist-app .table-wrap,
.dist-modal .table-wrap {
  width: 100%;
  overflow-x: auto;
}

.dist-app .data-table,
.dist-modal .data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.dist-app .data-table th,
.dist-modal .data-table th {
  background: rgba(8, 12, 22, 0.92);
  color: #94a3b8;
  font-family: var(--font-racing);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: left;
  padding: 10px 10px;
  border-bottom: 1px solid rgba(244, 131, 0, 0.28);
  cursor: pointer;
  white-space: nowrap;
}

.dist-app .data-table th:hover,
.dist-modal .data-table th:hover {
  color: #ffffff;
}

.dist-app .data-table th.num,
.dist-app .data-table td.num,
.dist-modal .data-table th.num,
.dist-modal .data-table td.num {
  text-align: right;
  font-family: var(--dist-mono);
}

.dist-app .data-table td,
.dist-modal .data-table td {
  padding: 9px 10px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
  vertical-align: middle;
}

.dist-app .data-table tbody tr:hover,
.dist-modal .data-table tbody tr:hover {
  background: rgba(244, 131, 0, 0.07);
}

.dist-app .data-table tbody tr.row-bubble {
  background: rgba(245, 158, 11, 0.07);
}

.dist-app .data-table tbody tr.row-bubble:hover {
  background: rgba(245, 158, 11, 0.14);
}

.dist-app .driver-cell-name {
  font-weight: 600;
  color: #f8fafc;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.dist-app .driver-cell-sub {
  font-size: 11px;
  color: var(--dist-muted);
  margin-top: 2px;
}

.dist-app .class-badge,
.dist-modal .class-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 5px;
  font-family: var(--font-racing);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.dist-app .class-pro,
.dist-modal .class-pro {
  background: var(--dist-pro-soft);
  color: #fca5a5;
  border: 1px solid var(--dist-pro-border);
}

.dist-app .class-gtd,
.dist-modal .class-gtd {
  background: var(--dist-gtd-soft);
  color: #6ee7b7;
  border: 1px solid var(--dist-gtd-border);
}

.dist-app .class-unassigned,
.dist-modal .class-unassigned {
  background: rgba(148, 163, 184, 0.12);
  color: var(--dist-muted);
  border: 1px solid var(--dist-border);
}

.dist-app .badge,
.dist-modal .badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 700;
  font-family: var(--dist-mono);
}

.dist-app .badge-up,
.dist-modal .badge-up {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}

.dist-app .badge-down,
.dist-modal .badge-down {
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
}

.dist-app .badge-lock,
.dist-modal .badge-lock {
  background: rgba(99, 102, 241, 0.22);
  color: #c7d2fe;
}

.dist-app .badge-prov,
.dist-modal .badge-prov {
  background: rgba(148, 163, 184, 0.16);
  color: #cbd5e1;
}

.dist-app .score-cell {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
}

.dist-app .score-main {
  font-size: 13.5px;
  font-weight: 700;
  color: #f8fafc;
}

.dist-app .score-sub {
  font-size: 10.5px;
  color: var(--dist-dim);
}

.dist-app .mini-bar {
  width: 64px;
  height: 4px;
  border-radius: 99px;
  background: #1e293b;
  overflow: hidden;
}

.dist-app .mini-bar > span {
  display: block;
  height: 100%;
  border-radius: 99px;
}

.dist-app .delta-pos { color: #f87171; }
.dist-app .delta-neg { color: #34d399; }
.dist-app .delta-bubble { color: #fbbf24; font-weight: 700; }

/* Empty / Upload Dropzone */
.dist-app .upload-empty {
  border: 2px dashed rgba(244, 131, 0, 0.45);
  background: rgba(13, 19, 32, 0.85);
  border-radius: var(--dist-radius);
  padding: 48px 24px;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
}

.dist-app .upload-empty.drag-over {
  border-color: #f48300;
  background: rgba(244, 131, 0, 0.08);
}

.dist-app .upload-empty h3 {
  font-family: var(--font-racing);
  font-size: 18px;
  color: #f8fafc;
  margin-bottom: 8px;
}

.dist-app .upload-empty p {
  color: var(--dist-muted);
  max-width: 540px;
  margin: 0 auto 18px;
}

/* Modals (Driver Detail & Power Ranking PNG Studio) */
.dist-modal {
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 10, 0.82);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 70;
  padding: 20px;
  color: #f1f5f9;
  font-size: 13px;
}

.dist-modal.hidden {
  display: none !important;
}

.dist-modal .modal-card {
  width: 880px;
  max-width: 96vw;
  max-height: 90vh;
  background: #0d1320;
  border: 1px solid rgba(244, 131, 0, 0.35);
  border-radius: 16px;
  box-shadow: 0 24px 65px rgba(0, 0, 0, 0.72);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.dist-modal .modal-card.modal-xl {
  width: 1040px;
}

.dist-modal .modal-header {
  padding: 15px 20px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(8, 12, 20, 0.7);
}

.dist-modal .modal-header h2 {
  font-family: var(--font-racing);
  color: #f8fafc;
}

.dist-modal .modal-body {
  padding: 18px 20px;
  overflow-y: auto;
  flex: 1;
}

.dist-modal .modal-footer {
  padding: 13px 20px;
  border-top: 1px solid rgba(148, 163, 184, 0.16);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  background: rgba(8, 12, 20, 0.7);
}

.dist-modal .icon-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  font-size: 14px;
}

.dist-modal .icon-btn:hover {
  background: #1e293b;
  color: #ffffff;
  border-color: rgba(244, 131, 0, 0.45);
}

.dist-modal .driver-kpis {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

@media (max-width: 720px) {
  .dist-modal .driver-kpis {
    grid-template-columns: repeat(3, 1fr);
  }
}

.dist-modal .driver-kpi {
  background: #090e18;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 8px;
  padding: 10px 11px;
}

.dist-modal .driver-kpi span {
  display: block;
  font-family: var(--font-racing);
  font-size: 10.5px;
  color: #94a3b8;
  text-transform: uppercase;
}

.dist-modal .driver-kpi strong {
  font-family: var(--dist-mono);
  font-size: 16px;
  color: #f8fafc;
}

.dist-modal .row-dropped {
  opacity: 0.55;
}

.dist-modal .pr-preview-wrap {
  background: #05070c;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 10px;
  padding: 12px;
  max-height: 58vh;
  overflow: auto;
  display: flex;
  justify-content: center;
}

.dist-modal .pr-canvas {
  max-width: 100%;
  height: auto !important;
  border-radius: 6px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.6);
}

/* Drag & Drop Overlay */
.dist-drop-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 10, 0.88);
  z-index: 95;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dist-drop-overlay.hidden {
  display: none !important;
}

.dist-drop-overlay .drop-overlay-card {
  border: 2px dashed #f48300;
  background: #0f1624;
  padding: 40px 54px;
  border-radius: 16px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.65);
}

.dist-drop-overlay h2 {
  font-family: var(--font-racing);
  font-size: 20px;
  color: #f8fafc;
  margin-bottom: 6px;
}

/* ==========================================================================
   LIGHT MODE PARITY (html.light)
   ========================================================================== */
html.light .dist-app {
  --dist-bg: #f8fafc;
  --dist-card: #ffffff;
  --dist-card-solid: #ffffff;
  --dist-input: #f1f5f9;
  --dist-border: #cbd5e1;
  --dist-border-strong: rgba(244, 131, 0, 0.55);
  --dist-text: #0f172a;
  --dist-muted: #475569;
  --dist-dim: #64748b;
}

html.light .dist-app .viewer-header {
  background: #ffffff;
  border-color: #cbd5e1;
  border-left: 4px solid #f48300;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.07);
}

html.light .dist-app .brand-text h1,
html.light .dist-app .panel-header h2,
html.light .dist-app .kpi-value,
html.light .dist-app .driver-cell-name,
html.light .dist-app .score-main,
html.light .dist-app .upload-empty h3 {
  color: #0f172a;
}

html.light .dist-app .kpi-pro .kpi-value { color: #dc2626; }
html.light .dist-app .kpi-gtd .kpi-value { color: #059669; }
html.light .dist-app .kpi-amber .kpi-value { color: #ea580c; }

html.light .dist-app .panel,
html.light .dist-app .scope-bar,
html.light .dist-app .kpi-card {
  background: #ffffff;
  border-color: #cbd5e1;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.05);
}

html.light .dist-app .wpill,
html.light .dist-app .hist-pill {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #334155;
}

html.light .dist-app .formula-bar,
html.light .dist-modal .formula-bar {
  background: #fff7ed;
  border-color: #fed7aa;
  border-left-color: #f48300;
  color: #475569;
}

html.light .dist-app .data-table th,
html.light .dist-modal .data-table th {
  background: #f1f5f9;
  color: #334155;
  border-bottom-color: #cbd5e1;
}

html.light .dist-app .data-table th:hover,
html.light .dist-modal .data-table th:hover {
  color: #0f172a;
}

html.light .dist-app .data-table td,
html.light .dist-modal .data-table td {
  border-bottom-color: #e2e8f0;
  color: #0f172a;
}

html.light .dist-app .data-table tbody tr:hover,
html.light .dist-modal .data-table tbody tr:hover {
  background: #fff7ed;
}

html.light .dist-app .class-pro,
html.light .dist-modal .class-pro {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #fca5a5;
}

html.light .dist-app .class-gtd,
html.light .dist-modal .class-gtd {
  background: #d1fae5;
  color: #047857;
  border-color: #6ee7b7;
}

html.light .dist-app .class-tab-btn:hover,
html.light .dist-app .view-tab-btn:hover {
  color: #0f172a;
}

html.light .dist-app .class-tab-btn.cls-gt3.active {
  background: #d1fae5;
  color: #047857;
}

html.light .dist-app .class-tab-btn.cls-lmp2.active {
  background: #dbeafe;
  color: #1d4ed8;
}

html.light .dist-app .class-tab-btn.cls-gtp.active {
  background: #ffedd5;
  color: #c2410c;
}

html.light .dist-app .chip.active {
  background: #f48300;
  color: #ffffff;
  border-color: #ea580c;
}

html.light .dist-app .chip-pro.active {
  background: #dc2626;
  color: #ffffff;
  border-color: #b91c1c;
}

html.light .dist-app .chip-gtd.active {
  background: #059669;
  color: #ffffff;
  border-color: #047857;
}

html.light .dist-app .chip-amber.active {
  background: #d97706;
  color: #ffffff;
  border-color: #b45309;
}

html.light .dist-app .mini-bar {
  background: #e2e8f0;
}

html.light .dist-app .btn-ghost,
html.light .dist-modal .btn-ghost {
  background: #f1f5f9;
  color: #334155;
  border-color: #cbd5e1;
}

html.light .dist-app .btn-ghost:hover,
html.light .dist-modal .btn-ghost:hover {
  background: #e2e8f0;
  color: #0f172a;
}

html.light .dist-app .btn-amber {
  background: #fff7ed;
  color: #c2410c;
  border-color: #fb923c;
}

html.light .dist-app .btn-amber:hover {
  background: #f48300;
  color: #ffffff;
}

html.light .dist-sync-badge.sync-ok {
  background: #d1fae5;
  border-color: #6ee7b7;
  color: #047857;
}

html.light .dist-sync-badge.sync-busy {
  background: #ffedd5;
  border-color: #fdba74;
  color: #c2410c;
}

html.light .dist-sync-badge.sync-err {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #b91c1c;
}

html.light .dist-app .chart-tooltip {
  background: rgba(255, 255, 255, 0.98);
  color: #0f172a;
  border-color: #cbd5e1;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.16);
}

html.light .dist-app .chart-svg line[stroke="#1f2b40"],
html.light .dist-app .chart-svg line[stroke="#1c273b"],
html.light .dist-app .chart-svg line[stroke="#192338"] {
  stroke: #e2e8f0;
}

html.light .dist-app .chart-svg line[stroke="#324461"] {
  stroke: #cbd5e1;
}

html.light .dist-app .chart-svg text[fill="#f8fafc"],
html.light .dist-modal .chart-svg text[fill="#f8fafc"] {
  fill: #0f172a;
}

html.light .dist-app .chart-svg text[fill="#fcd34d"] {
  fill: #b45309;
}

html.light .dist-app .chart-svg text[fill="#93a4be"],
html.light .dist-app .chart-svg text[fill="#94a3b8"],
html.light .dist-app .chart-svg text[fill="#647692"],
html.light .dist-modal .chart-svg text[fill="#94a3b8"],
html.light .dist-modal .chart-svg text[fill="#647692"] {
  fill: #475569;
}

html.light .dist-modal .modal-card {
  background: #ffffff;
  color: #0f172a;
  border-color: #cbd5e1;
}

html.light .dist-modal .modal-header,
html.light .dist-modal .modal-footer {
  background: #f8fafc;
  border-color: #e2e8f0;
}

html.light .dist-modal .modal-header h2,
html.light .dist-modal .driver-kpi strong {
  color: #0f172a;
}

html.light .dist-modal .driver-kpi {
  background: #f8fafc;
  border-color: #e2e8f0;
}

html.light .dist-modal .select-input,
html.light .dist-modal .text-input {
  background: #f8fafc;
  color: #0f172a;
  border-color: #cbd5e1;
}

html.light .dist-app .upload-empty {
  background: #ffffff;
}
