/* ===================================================================
   Auto IT Overblik Design System - Biltorvet Analytics
   =================================================================== */

:root {
  /* Brand & Core Palette */
  --primary: #0284c7;
  --primary-hover: #0369a1;
  --primary-light: #e0f2fe;
  --primary-border: #bae6fd;
  
  --secondary: #0f172a;
  --secondary-muted: #475569;
  --text-muted: #64748b;
  --text-subtle: #94a3b8;
  
  --success: #10b981;
  --success-light: #ecfdf5;
  --success-border: #a7f3d0;
  
  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --warning-border: #fde68a;
  
  --danger: #ef4444;
  --danger-light: #fef2f2;
  --danger-border: #fecaca;

  /* Surfaces & Canvas */
  --canvas: #f8fafc;
  --card-bg: #ffffff;
  --card-border: #e2e8f0;
  --card-border-hover: #cbd5e1;
  --border-color: #cbd5e1;
  --header-bg: #f8fafc;
  --row-hover: #f1f5f9;

  /* Elevations */
  --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.04);
  --shadow-card: 0 1px 3px 0 rgba(15, 23, 42, 0.05), 0 1px 2px -1px rgba(15, 23, 42, 0.03);
  --shadow-hover: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
  --shadow-panel: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);

  /* Typography */
  --font-heading: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-pill: 9999px;
}

/* Core Utility Classes */
.hidden {
  display: none !important;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  background-color: var(--canvas);
  color: var(--secondary);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* App Container */
.app-container {
  max-width: min(2180px, 98vw);
  margin: 0 auto;
  padding: 20px 32px 60px 32px;
  position: relative;
}

/* ===================================================================
   Stitch Top App Bar
   =================================================================== */
.stitch-app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 12px 20px;
  box-shadow: var(--shadow-sm);
}

.app-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-cluster {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo-icon {
  width: 40px;
  height: 40px;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  filter: drop-shadow(0 2px 6px rgba(0, 187, 43, 0.3));
  transition: transform 0.2s ease;
}

.brand-logo-icon:hover {
  transform: scale(1.05);
}

.brand-logo-icon svg {
  width: 40px;
  height: 40px;
  display: block;
}

.brand-titles {
  display: flex;
  flex-direction: column;
}

.brand-main-title {
  font-family: var(--font-heading);
  font-size: 17px;
  font-weight: 700;
  color: var(--secondary);
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.01em;
}

.badge-pro {
  background: #0f172a;
  color: #38bdf8;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.05em;
}

.brand-sub-title {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.app-header-center {
  flex: 1;
  max-width: 460px;
}

.global-search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--canvas);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-pill);
  padding: 8px 16px;
  transition: all 0.2s ease;
}

.global-search-box:focus-within {
  border-color: var(--primary);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.12);
}

.search-icon {
  color: var(--text-muted);
}

.global-search-box input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 12px;
  width: 100%;
  color: var(--secondary);
  font-family: var(--font-body);
}

.app-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-pill-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary-light);
  color: var(--primary-hover);
  border: 1px solid var(--primary-border);
  padding: 7px 13px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-pill-action:hover {
  background: #bae6fd;
  color: #0284c7;
}

/* Date Preset Select & Date Picker Pill */
.date-preset-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--canvas);
  border: 1px solid var(--card-border);
  padding: 6px 12px 6px 10px;
  border-radius: var(--radius-pill);
  transition: all 0.15s ease;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.date-preset-pill:hover {
  border-color: var(--primary);
  background: #ffffff;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.12);
}

.date-preset-pill:focus-within {
  border-color: var(--primary);
  background: #ffffff;
  box-shadow: 0 0 0 2px var(--primary-light);
}

.preset-icon {
  color: var(--primary);
  flex-shrink: 0;
}

.date-preset-select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  border: none;
  background: transparent;
  font-family: var(--font-body);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--secondary);
  outline: none;
  cursor: pointer;
  padding: 0;
  margin: 0;
}

.preset-arrow {
  color: var(--text-muted);
  flex-shrink: 0;
  pointer-events: none;
  transition: transform 0.15s ease;
}

.date-preset-pill:hover .preset-arrow {
  color: var(--primary);
  transform: translateY(1px);
}

.date-picker-box {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--canvas);
  border: 1px solid var(--card-border);
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  font-weight: 500;
  color: var(--secondary);
  transition: all 0.15s ease;
}

.date-picker-box:hover {
  border-color: var(--primary);
}

.date-picker-box input[type="date"] {
  border: none;
  background: transparent;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  color: var(--secondary);
  outline: none;
  cursor: pointer;
}

.date-separator {
  color: var(--text-muted);
  font-weight: 600;
}

.date-sub-badge {
  font-size: 10px;
  color: var(--text-muted);
  background: #e2e8f0;
  padding: 2px 6px;
  border-radius: 4px;
}

.user-profile-badge {
  width: 34px;
  height: 34px;
  background: #e2e8f0;
  color: var(--secondary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  border: 1px solid #cbd5e1;
}

/* ===================================================================
   Filter Bar & Searchable Dealer Combo-box
   =================================================================== */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-card);
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 130px;
  position: relative;
}

.dealer-search-group {
  flex: 2.2;
  min-width: 260px;
}

.filter-group label {
  font-size: 11px;
  font-weight: 600;
  color: var(--secondary-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.filter-select,
.filter-input-search {
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  background: var(--canvas);
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--secondary);
  outline: none;
  transition: all 0.15s ease;
  width: 100%;
}

.filter-select:hover,
.filter-input-search:hover {
  border-color: var(--card-border-hover);
}

.filter-select:focus,
.filter-input-search:focus {
  border-color: var(--primary);
  background: #ffffff;
  box-shadow: 0 0 0 2px var(--primary-light);
}

/* Searchable Combobox Container */
.searchable-combobox {
  position: relative;
  width: 100%;
}

.combobox-toggle-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 10px;
  padding: 4px;
}

.combobox-options-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #ffffff;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-panel);
  max-height: 280px;
  overflow-y: auto;
  z-index: 1000;
}

.combobox-item {
  padding: 8px 12px;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.15s ease;
}

.combobox-item:hover,
.combobox-item.selected {
  background: var(--primary-light);
}

.combobox-chain-item {
  font-weight: 700;
  color: #0369a1;
  background: #f0f9ff;
}

.combobox-branch-item {
  padding-left: 24px;
  color: var(--secondary);
}

.combobox-badge {
  font-size: 10px;
  background: #e2e8f0;
  color: var(--secondary-muted);
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 500;
}

.filter-actions {
  display: flex;
  gap: 8px;
  align-self: flex-end;
}

.btn {
  height: 38px;
  padding: 0 16px;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  border: 1px solid var(--primary);
}

.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.btn-secondary {
  background: var(--card-bg);
  color: var(--secondary);
  border: 1px solid var(--card-border);
}

.btn-secondary:hover {
  background: var(--row-hover);
  border-color: var(--card-border-hover);
}

/* ===================================================================
   Main Layout: Content & Sidebar
   =================================================================== */
.main-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
  align-items: start;
}

.content-column {
  min-width: 0;
}

.sidebar-column {
  position: sticky;
  top: 24px;
}

/* ===================================================================
   KPI Scorecards (8 Master Metrics Grid)
   =================================================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-card);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  position: relative;
  overflow: hidden;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.accent-neutral::before { background: #64748b; }
.accent-primary::before { background: var(--primary); }
.accent-success::before { background: var(--success); }
.accent-indigo::before  { background: #6366f1; }
.accent-amber::before   { background: var(--warning); }

.kpi-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.kpi-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.kpi-icon {
  font-size: 16px;
}

.kpi-value-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.kpi-value {
  font-family: var(--font-heading);
  font-size: 23px;
  font-weight: 700;
  color: var(--secondary);
  line-height: 1.2;
}

.kpi-trend {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
}

.trend-up {
  color: #059669;
  background: #ecfdf5;
}

.trend-down {
  color: #dc2626;
  background: #fef2f2;
}

.trend-neutral {
  color: #64748b;
  background: #f1f5f9;
}

.kpi-subtext {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge-success {
  background: var(--success-light);
  color: #047857;
  border: 1px solid var(--success-border);
}

.badge-warning {
  background: var(--warning-light);
  color: #b45309;
  border: 1px solid var(--warning-border);
}

.badge-danger {
  background: var(--danger-light);
  color: #b91c1c;
  border: 1px solid var(--danger-border);
}

.badge-neutral {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}

.badge-primary {
  background: #f0f9ff;
  color: #0284c7;
  border: 1px solid #bae6fd;
}

.badge-sold {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #cbd5e1;
  font-size: 10px;
}

/* ===================================================================
   Navigation Tabs
   =================================================================== */
.tabs-container {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--card-border);
  margin-bottom: 20px;
  overflow-x: auto;
  overflow-y: hidden !important;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.tabs-container::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

.tab-btn {
  background: none;
  border: none;
  padding: 12px 16px;
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--secondary);
}

.tab-btn.active {
  color: var(--primary);
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--primary);
}

.tab-btn:disabled,
.tab-btn.tab-btn-disabled {
  opacity: 0.4;
  cursor: not-allowed !important;
  color: var(--text-subtle) !important;
  pointer-events: auto !important;
}

.tab-btn:disabled:hover,
.tab-btn.tab-btn-disabled:hover {
  color: var(--text-subtle) !important;
  background: transparent !important;
}

.tab-btn:disabled::after,
.tab-btn.tab-btn-disabled::after {
  display: none !important;
}

.tab-counter {
  background: #e2e8f0;
  color: var(--secondary-muted);
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  font-size: 10px;
  font-weight: 700;
}

.tab-btn.active .tab-counter {
  background: var(--primary-light);
  color: var(--primary-hover);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ===================================================================
   Section Cards & Data Tables
   =================================================================== */
.section-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  margin-bottom: 24px;
}

.section-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--card-border);
}

.section-card-title {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 700;
  color: var(--secondary);
}

.section-card-subtitle {
  font-size: 11px;
  color: var(--text-muted);
}

.data-table-wrapper {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 12px;
}

.data-table th {
  background: #f8fafc;
  color: var(--secondary-muted);
  font-weight: 600;
  padding: 10px 14px;
  border-bottom: 1px solid var(--card-border);
  white-space: nowrap;
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #f1f5f9;
  color: var(--secondary);
  vertical-align: middle;
}

.data-table tbody tr:hover {
  background: var(--row-hover);
}

/* Inactive / Sold Cars Row Styling */
tr.row-inactive {
  opacity: 0.65;
  background-color: #fafbfc;
}

tr.row-inactive td {
  color: #64748b;
}

tr.row-current-dealer {
  background-color: #f0f9ff !important;
  font-weight: 600;
}

.text-right {
  text-align: right;
}

.text-center {
  text-align: center;
}

.text-primary {
  color: var(--primary) !important;
}

.text-success {
  color: var(--success) !important;
}

/* Vehicle Cell */
.vehicle-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.vehicle-thumb {
  width: 54px;
  height: 38px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--card-border);
  background: #f1f5f9;
  flex-shrink: 0;
}

.vehicle-placeholder-thumb {
  width: 54px;
  height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--card-border);
  background: #e2e8f0;
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.vehicle-info-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.vehicle-title {
  font-weight: 600;
  color: var(--secondary);
  text-decoration: none;
}

.vehicle-title:hover {
  color: var(--primary);
}

.vehicle-meta {
  font-size: 11px;
  color: var(--text-muted);
}

/* Pagination Bar */
.pagination-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  border-top: 1px solid var(--card-border);
  font-size: 12px;
  color: var(--text-muted);
}

.pagination-controls {
  display: flex;
  gap: 8px;
}

.page-btn {
  padding: 6px 12px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  color: var(--secondary);
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ===================================================================
   Peer Benchmark Calculation Grid
   =================================================================== */
.calculation-steps-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  padding: 20px;
  background: #f8fafc;
  border-bottom: 1px solid var(--card-border);
}

.calc-step-card {
  background: #ffffff;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 16px;
  position: relative;
  box-shadow: var(--shadow-sm);
}

.step-num {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--primary);
  background: var(--primary-light);
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  margin-bottom: 6px;
}

.calc-step-card h4 {
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 700;
  color: var(--secondary);
  margin-bottom: 4px;
}

.calc-step-card p {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 12px;
}

.step-result {
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 700;
  color: var(--secondary);
  border-top: 1px dashed var(--card-border);
  padding-top: 8px;
}

/* Trend column in Segment table */
.trend-arrow {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-weight: 600;
  font-size: 11px;
}

.trend-arrow-up { color: #059669; }
.trend-arrow-down { color: #dc2626; }
.trend-arrow-flat { color: #64748b; }

/* ===================================================================
   Correlation Container
   =================================================================== */
.correlation-container {
  padding: 20px;
}

.correlation-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.stat-box {
  background: var(--canvas);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
}

.stat-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}

.stat-val {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 700;
  color: var(--secondary);
}

.stat-desc {
  font-size: 11px;
  color: var(--text-muted);
}

.chart-wrapper {
  position: relative;
  width: 100%;
  height: 360px;
}

/* ===================================================================
   Sidebar: Business Info Panel
   =================================================================== */
.info-panel {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-card);
}

.info-panel-title {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 700;
  color: var(--secondary);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.info-intro {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 18px;
  line-height: 1.5;
}

.definition-item {
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid #f1f5f9;
}

.def-heading {
  font-size: 12px;
  font-weight: 700;
  color: var(--secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.def-text {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.45;
}

.info-callout {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
  padding: 12px;
  border-radius: var(--radius-md);
  font-size: 11.5px;
  line-height: 1.45;
  margin-top: 14px;
}

/* Loading skeleton & spinner */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(2, 132, 199, 0.2);
  border-radius: 50%;
  border-top-color: var(--primary);
  animation: spin 0.8s linear infinite;
}

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

.empty-state {
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
}

/* Responsive Breakpoints */
@media (max-width: 1200px) {
  .main-layout {
    grid-template-columns: 1fr;
  }
  .sidebar-column {
    position: static;
  }
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .calculation-steps-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .app-container {
    padding: 12px;
  }
  .stitch-app-header {
    flex-direction: column;
    align-items: stretch;
  }
  .app-header-center {
    max-width: 100%;
  }
  .kpi-grid {
    grid-template-columns: 1fr;
  }
  .calculation-steps-grid {
    grid-template-columns: 1fr;
  }
}

/* ===================================================================
   Working Loading Modal Overlay
   =================================================================== */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.loading-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loading-card {
  background: #ffffff;
  border-radius: 16px;
  padding: 30px 38px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 10px 10px -5px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 360px;
  animation: modalScaleIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalScaleIn {
  from { transform: scale(0.93); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.spinner-ring {
  width: 42px;
  height: 42px;
  border: 4px solid #e2e8f0;
  border-top-color: var(--primary);
  border-right-color: #38bdf8;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  margin-bottom: 14px;
}

.loading-text {
  font-family: var(--font-heading);
  font-size: 17px;
  font-weight: 700;
  color: var(--secondary);
  margin-bottom: 4px;
}

.loading-subtext {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ===================================================================
   Header Dealer Quick Search & Clear Button
   =================================================================== */
.header-dealer-search-box {
  position: relative;
  width: 100%;
  max-width: 440px;
}

.header-dealer-search-box input {
  width: 100%;
  height: 38px;
  padding: 0 34px 0 36px;
  border-radius: 9999px;
  border: 1px solid var(--border-color);
  background: #f8fafc;
  font-size: 13px;
  color: var(--text-main);
  transition: all 0.2s ease;
}

.header-dealer-search-box input:focus {
  background: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
  outline: none;
}

.header-dealer-search-box .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.btn-clear-search {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: none;
  background: #e2e8f0;
  color: #64748b;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-clear-search:hover {
  background: #cbd5e1;
  color: #0f172a;
}

.btn-clear-search.hidden {
  display: none;
}

.header-search-results-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 100%;
  max-height: 360px;
  overflow-y: auto;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 10px 25px -5px rgba(0,0,0,0.15);
  z-index: 2000;
}

.header-search-results-dropdown.hidden {
  display: none;
}

.header-search-item {
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
  font-size: 13px;
  transition: background 0.15s ease;
}

.header-search-item:hover {
  background: #f0f9ff;
}

.header-search-item strong {
  color: var(--secondary);
}

.header-search-item .item-sub {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* ===================================================================
   Peer Comparison Card & Visual Volume Bars (Feedback #16 & #17)
   =================================================================== */
.peer-comparison-card {
  margin-top: 24px;
  padding: 24px;
  background: #ffffff;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.peer-header-wrap {
  margin-bottom: 18px;
}

.peer-header-title {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 700;
  color: var(--secondary);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.peer-header-subtitle {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.45;
}

.peer-vol-bar-bg {
  width: 100%;
  max-width: 110px;
  height: 5px;
  background: #e2e8f0;
  border-radius: 3px;
  overflow: hidden;
}

.peer-vol-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #0284c7, #38bdf8);
  border-radius: 3px;
}

.step-period-badge {
  display: inline-block;
  font-size: 11px;
  background: rgba(2, 132, 199, 0.1);
  color: var(--primary);
  padding: 2px 8px;
  border-radius: 9999px;
  margin-bottom: 6px;
  font-weight: 600;
}

.kpi-tag-ga4 {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: #0284c7;
  background: #e0f2fe;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: auto;
}

.kpi-tag-leads {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: #059669;
  background: #d1fae5;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: auto;
}

.kpi-subtext-detail {
  font-size: 10.5px;
  color: #94a3b8;
  margin-top: 2px;
}

/* ===================================================================
   Dealer Benchmark Cost & Sales Summary Cards & Trend
   =================================================================== */
.dealer-cost-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 16px;
  margin-bottom: 24px;
}

@media (max-width: 900px) {
  .dealer-cost-summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.cost-summary-card {
  background: #ffffff;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-card);
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.cost-summary-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--card-border-hover);
}

.cost-summary-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--card-border);
}

.cost-summary-card.accent-primary::before { background: var(--primary); }
.cost-summary-card.accent-success::before { background: var(--success); }
.cost-summary-card.accent-amber::before   { background: var(--warning); }
.cost-summary-card.accent-indigo::before  { background: #6366f1; }

.cost-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.cost-card-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.cost-card-icon {
  font-size: 15px;
}

.cost-card-val {
  font-family: var(--font-heading);
  font-size: 23px;
  font-weight: 700;
  color: var(--secondary);
  line-height: 1.2;
}

.cost-card-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
}

.benchmark-trend-card {
  background: #ffffff;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-card);
}

/* ===================================================================
   Unified Date Range Picker & Popover (Stitch Design System)
   =================================================================== */
.date-range-container {
  position: relative;
  display: inline-block;
}

.date-range-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 28px;
  padding: 6px 14px 6px 12px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  font-family: var(--font-body);
}

.date-range-trigger:hover {
  border-color: #0284c7;
  background: #f8fafc;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.12);
}

.date-range-trigger[aria-expanded="true"] {
  border-color: #0284c7;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.18);
  background: #ffffff;
}

.date-range-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0284c7;
}

.date-range-text-cluster {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.date-range-preset-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #0284c7;
  line-height: 1.1;
}

.date-range-value-display {
  font-size: 12.5px;
  font-weight: 600;
  color: #1e293b;
  line-height: 1.25;
}

.date-range-arrow {
  color: #64748b;
  transition: transform 0.2s ease;
}

.date-range-trigger[aria-expanded="true"] .date-range-arrow {
  transform: rotate(180deg);
  color: #0284c7;
}

/* Floating Date Range Popover */
.date-range-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  box-shadow: 0 20px 45px -8px rgba(15, 23, 42, 0.2), 0 0 0 1px rgba(15, 23, 42, 0.05);
  z-index: 1050;
  width: 860px;
  min-width: 860px;
  max-width: 95vw;
  overflow: hidden;
  transition: opacity 0.18s cubic-bezier(0.16, 1, 0.3, 1), transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.18s;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.date-range-popover.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-6px) scale(0.98);
}

.popover-main {
  display: flex;
  border-bottom: 1px solid #f1f5f9;
}

/* Presets Panel (Left Column) */
.popover-presets-panel {
  width: 220px;
  min-width: 220px;
  background: #f8fafc;
  padding: 16px 12px;
  border-right: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.presets-section-title {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #94a3b8;
  margin-bottom: 6px;
  padding-left: 6px;
}

.preset-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
  font-family: var(--font-body);
}

.preset-btn:hover {
  background: #f1f5f9;
  border-color: #e2e8f0;
}

.preset-btn.active {
  background: #ffffff;
  border-color: #0284c7;
  box-shadow: 0 1px 4px rgba(2, 132, 199, 0.12);
}

.preset-btn-icon {
  font-size: 14px;
}

.preset-btn-texts {
  display: flex;
  flex-direction: column;
}

.preset-btn-name {
  font-size: 12px;
  font-weight: 600;
  color: #334155;
  line-height: 1.2;
}

.preset-btn.active .preset-btn-name {
  color: #0284c7;
}

.preset-btn-sub {
  font-size: 10.5px;
  color: #64748b;
  margin-top: 2px;
}

/* Calendar Panel (Right Column) */
.popover-calendar-panel {
  flex: 1;
  padding: 16px 20px;
  background: #ffffff;
}

.popover-calendar-header {
  margin-bottom: 12px;
}

.calendar-hint-title {
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
}

.calendar-hint-sub {
  font-size: 11.5px;
  color: #64748b;
  margin-top: 2px;
}

/* Flatpickr Theme Customization */
.flatpickr-custom-container {
  display: flex;
  justify-content: center;
}

.flatpickr-custom-container .flatpickr-calendar,
.flatpickr-custom-container .flatpickr-calendar.inline {
  box-shadow: none !important;
  border: none !important;
  background: transparent !important;
  width: 616px !important;
  min-width: 616px !important;
  max-width: 616px !important;
  display: block !important;
  font-family: var(--font-body) !important;
}

.flatpickr-custom-container .flatpickr-innerContainer {
  width: 616px !important;
  min-width: 616px !important;
  max-width: 616px !important;
  display: block !important;
}

.flatpickr-custom-container .flatpickr-rContainer {
  width: 616px !important;
  min-width: 616px !important;
  max-width: 616px !important;
  display: block !important;
}

.flatpickr-custom-container .flatpickr-weekdays {
  width: 616px !important;
  min-width: 616px !important;
  max-width: 616px !important;
  display: flex !important;
}

.flatpickr-custom-container .flatpickr-days {
  width: 616px !important;
  min-width: 616px !important;
  max-width: 616px !important;
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
}

.flatpickr-custom-container .dayContainer {
  min-width: 308px !important;
  max-width: 308px !important;
  width: 308px !important;
  display: inline-block !important;
  flex: 0 0 308px !important;
}

.flatpickr-custom-container .flatpickr-months {
  margin-bottom: 6px;
  width: 616px !important;
}

.flatpickr-custom-container .flatpickr-month {
  color: #0f172a !important;
  fill: #0f172a !important;
}

.flatpickr-custom-container .flatpickr-current-month {
  font-size: 13px !important;
  font-weight: 700 !important;
}

.flatpickr-custom-container .flatpickr-weekday {
  font-size: 11px !important;
  font-weight: 600 !important;
  color: #64748b !important;
  text-transform: capitalize !important;
}

.flatpickr-custom-container .flatpickr-day {
  border-radius: 8px !important;
  font-size: 12.5px !important;
  font-weight: 500 !important;
  color: #334155 !important;
  height: 34px !important;
  line-height: 34px !important;
  border: 1px solid transparent !important;
  margin: 1px !important;
}

.flatpickr-custom-container .flatpickr-day:hover {
  background: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
}

.flatpickr-custom-container .flatpickr-day.selected,
.flatpickr-custom-container .flatpickr-day.startRange,
.flatpickr-custom-container .flatpickr-day.endRange {
  background: #0284c7 !important;
  border-color: #0284c7 !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.3) !important;
}

.flatpickr-custom-container .flatpickr-day.inRange {
  background: #e0f2fe !important;
  border-color: #bae6fd !important;
  color: #0369a1 !important;
}

/* Popover Footer */
.popover-footer {
  padding: 12px 20px;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.popover-footer-summary {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.footer-summary-label {
  color: #64748b;
}

.footer-summary-value {
  color: #0f172a;
  font-weight: 600;
}

.popover-footer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-popover-cancel {
  padding: 7px 14px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-popover-cancel:hover {
  background: #f1f5f9;
  color: #1e293b;
}

.btn-popover-apply {
  padding: 7px 16px;
  background: #0284c7;
  border: 1px solid #0284c7;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  color: #ffffff;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 1px 3px rgba(2, 132, 199, 0.25);
}

.btn-popover-apply:hover {
  background: #0369a1;
  border-color: #0369a1;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.35);
}

/* Vehicle Charts Grid: Narrower Line Chart + Fuel Type Breakdown */
.vehicle-charts-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(0, 1.15fr);
  gap: 16px;
  margin-bottom: 16px;
}

@media (max-width: 1100px) {
  .vehicle-charts-grid {
    grid-template-columns: 1fr;
  }
}

.vehicle-chart-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px 20px 14px 20px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
  display: flex;
  flex-direction: column;
}

.fuel-chart-content-row {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 220px;
}

.fuel-chart-canvas-wrap {
  width: 165px;
  max-width: 165px;
  height: 165px !important;
  flex-shrink: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}

.fuel-breakdown-legend {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  justify-content: center;
  min-width: 0;
}

.fuel-legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 10px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid #f1f5f9;
  font-size: 11.5px;
  transition: all 0.15s ease;
}

.fuel-legend-item:hover {
  background: #f1f5f9;
  border-color: #e2e8f0;
}

.fuel-legend-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.fuel-color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.fuel-type-name {
  font-weight: 600;
  color: #334155;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fuel-legend-right {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-shrink: 0;
}

.fuel-views-num {
  font-variant-numeric: tabular-nums;
  color: #64748b;
  font-size: 11px;
}

.fuel-pct-badge {
  font-weight: 700;
  color: #0f172a;
  font-size: 11.5px;
  background: #ffffff;
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid #e2e8f0;
  font-variant-numeric: tabular-nums;
}


.chart-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.chart-header-title {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
  font-family: var(--font-heading);
}

.chart-header-subtitle {
  font-size: 11.5px;
  color: #64748b;
  margin-top: 2px;
  display: block;
}

.chart-header-stat {
  display: flex;
  align-items: baseline;
  gap: 6px;
  background: #f8fafc;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.chart-stat-label {
  font-size: 11.5px;
  color: #64748b;
  font-weight: 500;
}

.chart-stat-value {
  font-size: 14px;
  font-weight: 700;
  color: #0284c7;
  font-family: var(--font-heading);
}

/* Enterprise Peer Benchmark Table Two-Tier Headers & Cell Rhythm */
.peer-comparison-card .data-table-wrapper {
  overflow-x: hidden;
  box-shadow: none;
}

@media (max-width: 1100px) {
  .peer-comparison-card .data-table-wrapper {
    overflow-x: auto;
  }
}

.peer-comparison-card .data-table {
  width: 100%;
  table-layout: fixed;
}

.peer-comparison-card .data-table th,
.peer-comparison-card .data-table td {
  padding: 8px 10px;
  vertical-align: middle;
}

.data-table thead tr.benchmark-group-row th {
  background: #f1f5f9;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #475569;
  padding: 6px 10px;
  border-bottom: 1px solid #cbd5e1;
  border-right: 1px solid #cbd5e1;
}

.data-table thead tr.benchmark-group-row th:last-child {
  border-right: none;
}

.data-table thead tr.benchmark-col-row th {
  background: #f8fafc;
  font-size: 11px;
  font-weight: 600;
  color: #334155;
  padding: 8px 10px;
  border-bottom: 2px solid #cbd5e1;
}

.peer-cell-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.peer-cell-primary {
  font-size: 12.5px;
  font-weight: 600;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
}

.peer-cell-sub {
  font-size: 11px;
  color: #64748b;
  font-weight: normal;
  line-height: 1.2;
}

.peer-pending-text {
  font-size: 11px;
  color: #94a3b8;
  font-style: italic;
  font-weight: normal;
}

.peer-muted-dash {
  color: #cbd5e1;
  font-weight: 400;
  font-size: 13px;
}

/* High-Contrast Lead Index Badges */
.badge-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.badge-index-green {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.badge-index-yellow {
  background: #fefce8;
  color: #854d0e;
  border: 1px solid #fef08a;
}

.badge-index-red {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.badge-index-neutral {
  background: #f8fafc;
  color: #64748b;
  border: 1px solid #e2e8f0;
}

/* ===================================================================
   Top Navigation View Switcher (AI Rapport vs Dybdegående analyse)
   =================================================================== */
.top-nav-switcher {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f1f5f9;
  padding: 4px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--card-border);
  margin-bottom: 24px;
  width: fit-content;
}

.nav-switch-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--secondary-muted);
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-switch-btn:hover {
  color: var(--secondary);
  background: rgba(255, 255, 255, 0.6);
}

.nav-switch-btn.active {
  background: #ffffff;
  color: var(--primary);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.nav-switch-btn .nav-icon {
  font-size: 14px;
}

.nav-switch-btn .nav-badge {
  background: #e0f2fe;
  color: #0284c7;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 9999px;
  border: 1px solid #bae6fd;
}

.nav-switch-btn .nav-badge-sub {
  color: var(--text-subtle);
  font-size: 10px;
  font-weight: 500;
}

/* ===================================================================
   Clean AI Reporting Frontpage View
   =================================================================== */
.ai-report-view {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Hero Section */
.ai-hero-card {
  text-align: center;
  padding: 36px 24px 28px 24px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.ai-hero-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 320px;
  height: 120px;
  background: radial-gradient(ellipse at top, rgba(2, 132, 199, 0.12), transparent 70%);
  pointer-events: none;
}

.ai-hero-badge-wrap {
  margin-bottom: 12px;
}

.ai-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 9999px;
  color: #0369a1;
  font-family: var(--font-heading);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.ai-hero-title {
  font-family: var(--font-heading);
  font-size: 28px;
  font-weight: 800;
  color: var(--secondary);
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.ai-hero-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  max-width: 680px;
  margin: 0 auto;
  line-height: 1.6;
}

/* Query Panel & Steps */
.ai-query-panel {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 28px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.ai-step-block {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ai-step-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.ai-step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #0284c7;
  color: #ffffff;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
  margin-top: 1px;
}

.ai-step-titles h3 {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  color: var(--secondary);
}

.ai-step-titles p {
  font-size: 12px;
  color: var(--text-muted);
}

/* Dealer Picker Box */
.ai-dealer-picker-wrap {
  max-width: 600px;
}

.ai-dealer-search-box {
  position: relative;
  display: flex;
  align-items: center;
  background: #f8fafc;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 0 14px;
  height: 44px;
  transition: all 0.2s ease;
}

.ai-dealer-search-box:focus-within {
  background: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.12);
}

.ai-dealer-search-box input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--secondary);
  padding-left: 8px;
}

/* AI Dealer Dropdown & Item Styles */
.header-search-results-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 100%;
  max-height: 360px;
  overflow-y: auto;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  box-shadow: 0 12px 28px -6px rgba(15, 23, 42, 0.18), 0 4px 10px -2px rgba(15, 23, 42, 0.06);
  z-index: 2000;
}

.ai-search-item {
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.15s ease;
  font-family: var(--font-body);
}

.ai-search-item:last-child {
  border-bottom: none;
}

.ai-search-item:hover {
  background: #f0f9ff;
}

.ai-search-item-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.ai-search-item-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--secondary);
}

.ai-search-item-title strong {
  font-weight: 600;
  color: #0f172a;
}

.ai-search-item-icon {
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
}

.ai-search-item-sub {
  font-size: 11px;
  color: var(--text-muted);
  padding-left: 22px;
}

.ai-search-badge {
  padding: 3px 8px;
  border-radius: 9999px;
  font-family: var(--font-heading);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.ai-search-badge.badge-chain {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}

.ai-search-badge.badge-branch {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}

.search-result-empty,
.search-result-loading {
  padding: 16px;
  text-align: center;
  font-size: 12.5px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-body);
}

.search-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(2, 132, 199, 0.2);
  border-top-color: #0284c7;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

/* Pre-configured Suggestion Labels placed UNDER textbox */
.ai-suggestions-labels-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}

.ai-suggestions-caption {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ai-suggestions-labels {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ai-suggestion-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: #f1f5f9;
  border: 1px solid var(--card-border);
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: var(--font-body);
  user-select: none;
}

.ai-suggestion-chip:hover {
  background: #e0f2fe;
  border-color: #7dd3fc;
  color: #0284c7;
  transform: translateY(-1px);
  box-shadow: 0 2px 5px rgba(2, 132, 199, 0.12);
}

.ai-suggestion-chip .chip-icon {
  font-size: 14px;
  line-height: 1;
}

.ai-suggestion-chip .chip-title {
  font-size: 12.5px;
  font-weight: 600;
  color: #334155;
  white-space: nowrap;
}

.ai-suggestion-chip:hover .chip-title {
  color: #0284c7;
}

/* Smart Unified Query Bar & Mention Dropdown */
.smart-query-panel {
  padding: 24px 28px;
}

.ai-smart-search-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ai-smart-input-wrap {
  position: relative;
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 10px;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 12px;
  padding: 8px 10px 8px 14px;
  min-height: 56px;
  box-shadow: 0 4px 14px -2px rgba(15, 23, 42, 0.06);
  transition: all 0.2s ease;
  cursor: text;
}

.ai-magic-icon {
  margin-top: 10px;
  flex-shrink: 0;
  color: #0284c7;
}

.ai-smart-input-wrap:focus-within {
  border-color: #0284c7;
  box-shadow: 0 0 0 4px rgba(2, 132, 199, 0.14), 0 4px 16px -2px rgba(2, 132, 199, 0.1);
}

.ai-selected-dealer-chips {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.ai-dealer-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #f0fdf4 0%, #e0f2fe 100%);
  border: 1.5px solid #0284c7;
  color: #0369a1;
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 700;
  padding: 4px 8px 4px 10px;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(2, 132, 199, 0.15);
  animation: chipPopIn 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  user-select: none;
}

@keyframes chipPopIn {
  from {
    opacity: 0;
    transform: scale(0.85);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.ai-dealer-chip-icon {
  font-size: 14px;
  line-height: 1;
}

.ai-dealer-chip-name {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-dealer-chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: none;
  background: rgba(2, 132, 199, 0.12);
  color: #0284c7;
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
  transition: all 0.15s ease;
  line-height: 1;
}

.ai-dealer-chip-remove:hover {
  background: #ef4444;
  color: #ffffff;
  transform: scale(1.1);
}

.ai-smart-input-wrap input {
  flex: 1 1 200px;
  min-width: 160px;
  border: none;
  background: transparent;
  outline: none;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--secondary);
  line-height: 1.5;
  padding: 4px 0;
}

.ai-smart-input-wrap input::placeholder {
  color: #94a3b8;
  font-size: 13px;
}

.ai-smart-editable {
  flex: 1 1 240px;
  min-width: 180px;
  min-height: 40px;
  max-height: 220px;
  overflow-y: auto;
  border: none;
  background: transparent;
  outline: none;
  font-family: var(--font-body);
  font-size: 14.5px;
  color: var(--secondary);
  line-height: 1.6;
  padding: 8px 0;
  cursor: text;
  word-break: break-word;
  white-space: pre-wrap;
  display: block;
}

.ai-smart-editable:empty::before {
  content: attr(data-placeholder);
  color: #94a3b8;
  font-size: 13.5px;
  pointer-events: none;
  display: inline-block;
  white-space: normal;
}

.ai-dealer-inline-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: linear-gradient(135deg, #eff6ff 0%, #e0f2fe 100%);
  border: 1.5px solid #0284c7;
  color: #0369a1;
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 700;
  padding: 2px 8px 2px 10px;
  border-radius: 9999px;
  margin: 0 4px;
  vertical-align: middle;
  line-height: 1.4;
  user-select: none;
  box-shadow: 0 1px 4px rgba(2, 132, 199, 0.18);
  transition: all 0.15s ease;
  animation: chipPopIn 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.ai-dealer-inline-badge:hover {
  background: #dbeafe;
  border-color: #0369a1;
}

.ai-dealer-inline-badge .ai-badge-icon {
  font-size: 13px;
  line-height: 1;
}

.ai-dealer-inline-badge .ai-badge-text {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-dealer-inline-badge .ai-badge-del {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  color: #0284c7;
  background: rgba(2, 132, 199, 0.14);
  border-radius: 50%;
  cursor: pointer;
  margin-left: 2px;
  transition: all 0.15s ease;
}

.ai-dealer-inline-badge .ai-badge-del:hover {
  background: #ef4444;
  color: #ffffff;
  transform: scale(1.1);
}

.ai-smart-tip {
  font-size: 12px;
  color: #64748b;
  padding-left: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.ai-smart-tip strong {
  color: #0284c7;
  font-weight: 700;
}

.ai-mention-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 100%;
  max-height: 380px;
  overflow-y: auto;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  box-shadow: 0 16px 36px -6px rgba(15, 23, 42, 0.2), 0 4px 12px -2px rgba(15, 23, 42, 0.08);
  z-index: 2500;
}

.ai-mention-dropdown .ai-search-item.active {
  background: #e0f2fe;
}

/* Free Text Query Bar */
.ai-input-group {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

.ai-input-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f8fafc;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 0 16px;
  height: 48px;
  transition: all 0.2s ease;
}

.ai-input-wrap:focus-within {
  background: #ffffff;
  border-color: #0284c7;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.12);
}

.ai-magic-icon {
  color: #0284c7;
  flex-shrink: 0;
}

.ai-input-wrap input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-family: var(--font-body);
  font-size: 13.5px;
  color: var(--secondary);
}

.btn-ai-analyze {
  display: flex;
  align-items: center;
  align-self: flex-start;
  flex-shrink: 0;
  margin-top: 2px;
  gap: 8px;
  padding: 0 20px;
  height: 48px;
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  font-family: var(--font-heading);
  font-size: 13.5px;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.25);
  transition: all 0.2s ease;
}

.btn-ai-analyze:hover {
  background: linear-gradient(135deg, #0369a1 0%, #075985 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(2, 132, 199, 0.35);
}

.btn-ai-analyze:disabled,
.btn-ai-analyze.is-busy {
  background: #94a3b8 !important;
  color: #f1f5f9 !important;
  cursor: not-allowed !important;
  transform: none !important;
  box-shadow: none !important;
  opacity: 0.75;
}

.ai-smart-input-wrap.is-busy {
  background: #f8fafc !important;
  border-color: #cbd5e1 !important;
  cursor: not-allowed !important;
  opacity: 0.7;
}

.ai-smart-input-wrap.is-busy .ai-smart-editable {
  pointer-events: none;
  cursor: not-allowed;
}

/* Loading Card */
.ai-loading-card {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 24px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  box-shadow: var(--shadow-card);
}

.ai-loading-card.hidden,
.ai-result-card.hidden,
.ai-chart-card.hidden,
.ai-cars-card.hidden,
.ai-geomap-card.hidden,
.ai-table-card.hidden,
.ai-highlights-grid.hidden {
  display: none !important;
}

.ai-spinner-wrap {
  position: relative;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ai-pulsing-orbit {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2.5px solid rgba(2, 132, 199, 0.15);
  border-top-color: #0284c7;
  animation: spinOrbit 0.9s linear infinite;
}

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

.ai-spinner-icon {
  font-size: 18px;
}

.ai-loading-texts h4 {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  color: var(--secondary);
  margin-bottom: 3px;
}

.ai-loading-texts p {
  font-size: 12.5px;
  color: var(--text-muted);
}

/* ===================================================================
   Continuous Conversational Workspace & Thread Sidebar (Google Stitch)
   =================================================================== */

.ai-result-workspace {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  width: 100%;
  animation: fadeInResult 0.3s ease-out;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.ai-result-workspace.hidden {
  display: none !important;
}

.ai-report-main-canvas {
  flex: 1 1 0;
  min-width: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.ai-result-workspace.thread-collapsed .ai-report-thread-sidebar {
  display: none !important;
}

.ai-result-workspace.thread-collapsed .ai-report-main-canvas {
  width: 100%;
  max-width: 100%;
}

/* Thread Sidebar Container */
.ai-report-thread-sidebar {
  width: clamp(380px, 28vw, 440px);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border: 1px solid var(--card-border);
  border-radius: 16px;
  box-shadow: var(--shadow-panel);
  height: calc(100vh - 120px);
  max-height: 860px;
  min-height: 580px;
  position: sticky;
  top: 24px;
  overflow: hidden;
  transition: all 0.25s ease;
  z-index: 20;
}

/* Thread Header */
.ai-thread-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 18px;
  background: #ffffff;
  border-bottom: 1px solid #f1f5f9;
}

.ai-thread-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.ai-thread-icon-wrap {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  color: #0284c7;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ai-thread-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-thread-title {
  font-family: var(--font-heading);
  font-size: 14.5px;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
}

.ai-thread-badge-ai {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  background: #0284c7;
  color: #ffffff;
  border-radius: 4px;
  text-transform: uppercase;
}

.ai-thread-context-label {
  font-size: 11.5px;
  color: #64748b;
  margin: 2px 0 0 0;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 250px;
}

.ai-thread-context-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  display: inline-block;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
  flex-shrink: 0;
}

.ai-thread-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-thread-action {
  background: transparent;
  border: none;
  color: #94a3b8;
  padding: 6px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.btn-thread-action:hover {
  background: #f1f5f9;
  color: #0f172a;
}

/* Thread Messages Stream */
.ai-thread-messages-stream {
  flex: 1 1 auto;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.4) transparent;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: #f8fafc;
}

.ai-thread-messages-stream::-webkit-scrollbar {
  width: 5px;
}

.ai-thread-messages-stream::-webkit-scrollbar-track {
  background: transparent;
}

.ai-thread-messages-stream::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.35);
  border-radius: 9999px;
  transition: background 0.2s ease;
}

.ai-thread-messages-stream::-webkit-scrollbar-thumb:hover {
  background: rgba(100, 116, 139, 0.6);
}

.ai-thread-intro-chip {
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  color: #475569;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.ai-thread-intro-chip svg {
  color: #0284c7;
}

/* Thread Messages - User vs Assistant */
.ai-thread-msg {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 90%;
  animation: fadeInResult 0.2s ease-out;
}

.ai-thread-msg.user {
  align-self: flex-end;
}

.ai-thread-msg.user .ai-thread-bubble {
  background: #0f172a;
  color: #ffffff;
  border-radius: 14px 14px 2px 14px;
  padding: 10px 14px;
  font-size: 12.5px;
  line-height: 1.5;
  box-shadow: 0 2px 4px rgba(15, 23, 42, 0.08);
}

.ai-thread-msg.assistant {
  align-self: flex-start;
  max-width: 96%;
  width: 100%;
}

.ai-thread-msg.assistant .ai-thread-bubble {
  background: #ffffff;
  color: #1e293b;
  border: 1px solid #f1f5f9;
  border-radius: 14px 14px 14px 4px;
  padding: 14px 16px;
  font-size: 13px;
  line-height: 1.6;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.05);
}

.ai-thread-bubble-title {
  font-family: var(--font-heading);
  font-size: 12.5px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ai-thread-bubble-title svg {
  color: #0284c7;
}

.ai-thread-bubble-narrative {
  color: #334155;
  font-size: 13px;
  line-height: 1.6;
}

.ai-thread-bubble-narrative p {
  margin: 0 0 8px 0;
}

.ai-thread-bubble-narrative p:last-child {
  margin-bottom: 0;
}

.ai-thread-bubble-narrative ol,
.ai-thread-bubble-narrative ul {
  padding-left: 20px;
  margin: 6px 0 10px 0;
}

.ai-thread-bubble-narrative li {
  margin-bottom: 5px;
  color: #334155;
}

/* Inline Mini-Chart Canvas in Thread (Compact & Form-fitting) */
.ai-thread-chart-container {
  margin-top: 12px;
  margin-bottom: 8px;
  height: 185px;
  width: 100%;
  position: relative;
  border: 1px solid #f1f5f9;
  border-radius: 10px;
  padding: 8px;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.ai-thread-chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
  padding: 0 2px;
}

.ai-thread-chart-title {
  font-size: 11px;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.ai-thread-chart-canvas-wrap {
  height: 155px;
  position: relative;
  width: 100%;
}

/* Inline Mini-Car Cards in Thread */
.ai-thread-cars-container {
  margin-top: 10px;
  margin-bottom: 8px;
  width: 100%;
  border: 1px solid #f1f5f9;
  border-radius: 10px;
  padding: 10px;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.ai-thread-cars-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  padding: 0 2px;
}

.ai-thread-cars-title {
  font-size: 11.5px;
  font-weight: 700;
  color: #334155;
  letter-spacing: 0.01em;
}

.ai-thread-cars-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}

.ai-thread-car-card {
  display: flex;
  flex-direction: column;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.ai-thread-car-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.08);
  border-color: #cbd5e1;
}

.ai-thread-car-img-wrap {
  position: relative;
  width: 100%;
  height: 95px;
  background: #e2e8f0;
  overflow: hidden;
}

.ai-thread-car-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ai-thread-car-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  font-size: 26px;
  color: #94a3b8;
}

.ai-thread-car-days {
  position: absolute;
  bottom: 5px;
  right: 5px;
  font-size: 9.5px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 4px;
}

.ai-thread-car-days.badge-success {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.ai-thread-car-days.badge-warning {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
}

.ai-thread-car-days.badge-danger {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.ai-thread-car-info {
  padding: 7px 8px;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 2px;
}

.ai-thread-car-title {
  font-size: 11.5px;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ai-thread-car-variant {
  font-size: 10px;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ai-thread-car-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 2px;
}

.ai-thread-car-price {
  font-size: 11.5px;
  font-weight: 700;
  color: #0284c7;
}

.ai-thread-car-dealer {
  font-size: 9.5px;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100px;
}

.btn-thread-car-link {
  display: inline-block;
  text-align: center;
  margin-top: 4px;
  padding: 3px 6px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  color: #0284c7;
  font-size: 10px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.15s ease;
}

.btn-thread-car-link:hover {
  background: #0284c7;
  color: #ffffff;
  border-color: #0284c7;
}

/* Thread Action Bar: [📊 Kør fuld analyse på dette] */
.ai-thread-actions-bar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #f1f5f9;
}

.btn-thread-full-analysis {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  color: #0369a1;
  border-radius: 8px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-thread-full-analysis:hover {
  background: #0284c7;
  border-color: #0284c7;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.2);
  transform: translateY(-1px);
}

.btn-thread-full-analysis svg {
  color: currentColor;
}

.ai-thread-kept-badge {
  font-size: 11px;
  color: #0284c7;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Typing / Busy Indicator in Thread */
.ai-thread-loading-bubble {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 11.5px;
  color: #64748b;
}

.ai-thread-loading-dots {
  display: flex;
  gap: 4px;
}

.ai-thread-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #0284c7;
  animation: threadDotBlink 1.4s infinite ease-in-out both;
}

.ai-thread-dot:nth-child(1) { animation-delay: -0.32s; }
.ai-thread-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes threadDotBlink {
  0%, 80%, 100% { transform: scale(0); opacity: 0.3; }
  40% { transform: scale(1); opacity: 1; }
}

/* Quick Suggestion Chips */
.ai-thread-quick-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding: 8px 16px;
  background: #f8fafc;
  border-top: 1px solid #f1f5f9;
  border-bottom: 1px solid #f1f5f9;
  flex-shrink: 0;
}

.ai-thread-chip {
  white-space: nowrap;
  padding: 4px 10px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 500;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.ai-thread-chip:hover {
  background: #f0f9ff;
  border-color: #0284c7;
  color: #0284c7;
  transform: translateY(-1px);
}

/* Thread Input Dock */
.ai-thread-input-dock {
  padding: 12px 16px;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.ai-thread-context-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ai-context-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  color: #0284c7;
  transition: all 0.15s ease;
}

.ai-context-pill.inactive {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #64748b;
}

.btn-toggle-context {
  background: transparent;
  border: none;
  color: inherit;
  font-size: 11px;
  cursor: pointer;
  padding: 0 0 0 3px;
  line-height: 1;
}

.btn-toggle-context:hover {
  color: #ef4444;
}

.ai-thread-version {
  font-size: 10px;
  color: #94a3b8;
  font-family: var(--font-heading);
  letter-spacing: 0.02em;
}

.ai-thread-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.ai-thread-input {
  flex: 1;
  padding: 8px 12px;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  font-size: 12.5px;
  font-family: var(--font-body);
  outline: none;
  transition: all 0.15s ease;
  background: #f8fafc;
}

.ai-thread-input:focus {
  background: #ffffff;
  border-color: #0284c7;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.1);
}

.btn-submit-thread {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: #0284c7;
  color: #ffffff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.btn-submit-thread:hover {
  background: #0369a1;
}

.btn-submit-thread:disabled {
  background: #cbd5e1;
  cursor: not-allowed;
}

/* Header Toggle Button for Thread */
.btn-thread-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  position: relative;
}

.btn-thread-toggle.active {
  background: #f0f9ff !important;
  color: #0284c7 !important;
  border-color: #bae6fd !important;
}

.ai-thread-badge-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  background: #0284c7;
  color: #ffffff;
  border-radius: 9999px;
  font-size: 10px;
  font-weight: 700;
}

/* Responsive Rules for Split Layout */
@media (max-width: 1200px) {
  .ai-result-workspace {
    flex-direction: column;
  }
  .ai-report-thread-sidebar {
    width: 100%;
    position: static;
    max-height: 600px;
    height: auto;
  }
}

/* Result Presentation Card */
.ai-result-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 28px;
  box-shadow: var(--shadow-panel);
  display: flex;
  flex-direction: column;
  gap: 24px;
  animation: fadeInResult 0.3s ease-out;
}

@keyframes fadeInResult {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.ai-result-header {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-bottom: 18px;
  border-bottom: 1px solid #f1f5f9;
}

.ai-result-top-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  width: 100%;
}

.ai-badge-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.ai-report-period-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  background: #f1f5f9;
  color: #334155;
  border-radius: 9999px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.ai-result-saved-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.ai-saved-date-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  background: #ecfdf5;
  color: #059669;
  border-radius: 9999px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.ai-result-title-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.ai-result-dealer-title {
  font-family: var(--font-heading);
  font-size: 26px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.02em;
  margin: 2px 0 0 0;
  line-height: 1.25;
}

.ai-result-question-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 16px;
  background: #f8fafc;
  border-left: 3.5px solid #0284c7;
  border-radius: 8px;
  width: 100%;
  box-sizing: border-box;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.ai-question-bubble-icon {
  color: #0284c7;
  flex-shrink: 0;
  margin-top: 2px;
}

.ai-question-bubble-text {
  font-size: 13.5px;
  line-height: 1.5;
  color: #334155;
  font-style: italic;
  font-weight: 500;
}

.ai-export-btn-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-export-action,
.btn-jump-indepth {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 12px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #1e293b;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-export-action:hover,
.btn-jump-indepth:hover {
  background: #f8fafc;
  border-color: #0284c7;
  color: #0284c7;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.12);
}

.btn-export-action:active,
.btn-jump-indepth:active {
  transform: translateY(0);
}

.btn-export-action svg,
.btn-jump-indepth svg {
  color: #0284c7;
}

/* Freshness Banner */
.ai-freshness-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: #f8fafc;
  border-left: 3px solid #0284c7;
  border-radius: 6px;
  font-size: 11.5px;
  color: var(--secondary-muted);
}

.ai-freshness-banner svg {
  color: #0284c7;
  flex-shrink: 0;
}

/* Highlights Grid */
.ai-highlights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.ai-highlight-card {
  padding: 14px 16px;
  background: #f8fafc;
  border: none;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ai-hl-label {
  font-size: 11.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 600;
}

.ai-hl-value {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 800;
  color: var(--secondary);
}

.ai-hl-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 9999px;
  font-size: 10.5px;
  font-weight: 600;
  width: fit-content;
}

/* Summary Card */
.ai-summary-card {
  padding: 18px 20px;
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border: 1px solid #bae6fd;
  border-radius: var(--radius-lg);
}

.ai-summary-label {
  font-family: var(--font-heading);
  font-size: 11px;
  font-weight: 800;
  color: #0369a1;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.ai-summary-text {
  font-size: 14.5px;
  font-weight: 500;
  color: #0c4a6e;
  line-height: 1.6;
}

/* Narrative */
.ai-analysis-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ai-card-title {
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 700;
  color: var(--secondary);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.ai-analysis-narrative {
  font-size: 13.5px;
  color: #334155;
  line-height: 1.7;
}

.ai-analysis-narrative p {
  margin-bottom: 12px;
}

.ai-analysis-narrative ul {
  padding-left: 20px;
  margin-bottom: 12px;
}

.ai-analysis-narrative li {
  margin-bottom: 6px;
}

/* Dual Charts Grid */
.ai-charts-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  width: 100%;
}

@media (min-width: 960px) {
  .ai-charts-grid {
    grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  }
}

/* Chart Canvas Card */
.ai-chart-card {
  background: #f8fafc;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
}

/* Geographical Interactive Map Card */
.ai-geomap-card {
  background: #ffffff;
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 22px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ai-geomap-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.ai-geomap-title {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  color: var(--secondary);
  margin-bottom: 2px;
}

.ai-geomap-subtitle {
  font-size: 12.5px;
  color: var(--text-muted);
}

.ai-geomap-badge {
  font-size: 11px;
  font-weight: 700;
  color: #0369a1;
  background: #e0f2fe;
  padding: 3px 9px;
  border-radius: 9999px;
  white-space: nowrap;
}

.ai-geomap-container-wrap {
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  box-shadow: inset 0 1px 3px rgba(15, 23, 42, 0.05);
}

.ai-geomap-container {
  height: 480px;
  width: 100%;
  background: #f8fafc;
}

/* Leaflet Map DivIcon & Permanent Pill Label */
.ai-map-div-icon {
  background: transparent !important;
  border: none !important;
}

.ai-map-pill-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(15, 23, 42, 0.92);
  color: #ffffff;
  padding: 3px 8px;
  border-radius: 9999px;
  font-family: var(--font-body, 'Inter', sans-serif);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.25);
  transform: translate(-50%, -145%);
  pointer-events: none;
}

/* Leaflet Popup Styling */
.leaflet-popup-content-wrapper {
  border-radius: 10px !important;
  box-shadow: 0 8px 24px -4px rgba(15, 23, 42, 0.18) !important;
  border: 1px solid #cbd5e1 !important;
  padding: 4px !important;
}

.leaflet-popup-content {
  font-family: var(--font-body) !important;
  margin: 10px 12px !important;
  line-height: 1.4 !important;
}

.ai-map-popup-title {
  font-family: var(--font-heading);
  font-size: 13.5px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 6px;
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 4px;
}

.ai-map-popup-stat {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 12px;
  color: #475569;
  margin-bottom: 3px;
}

.ai-map-popup-stat strong {
  color: #0f172a;
  font-weight: 600;
}

/* Leaflet Custom Permanent Map Pill Labels */
.ai-map-div-icon {
  background: transparent !important;
  border: none !important;
}

.ai-map-pill-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(0, 59, 92, 0.92);
  color: #ffffff;
  padding: 3px 9px;
  border-radius: 12px;
  font-size: 11px;
  font-family: var(--font-body, -apple-system, sans-serif);
  font-weight: 500;
  white-space: nowrap;
  box-shadow: 0 3px 8px rgba(15, 23, 42, 0.28);
  border: 1.5px solid rgba(255, 255, 255, 0.85);
  pointer-events: none;
  transform: translate(-50%, -100%);
  margin-top: -8px;
}

.ai-map-pill-label strong {
  font-weight: 700;
  color: #ffffff;
}

/* Structured Data Table Card */
.ai-table-card {
  background: #ffffff;
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 22px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ai-table-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.ai-table-title {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  color: var(--secondary);
  margin-bottom: 2px;
}

.ai-table-subtitle {
  font-size: 12.5px;
  color: var(--text-muted);
}

.ai-table-badge {
  font-size: 11px;
  font-weight: 700;
  color: #047857;
  background: #d1fae5;
  padding: 3px 9px;
  border-radius: 9999px;
  white-space: nowrap;
}

.ai-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03);
}

.ai-report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  text-align: left;
  background: #ffffff;
}

.ai-report-table thead {
  background: #f8fafc;
  position: sticky;
  top: 0;
  z-index: 2;
  border-bottom: 1.5px solid #e2e8f0;
}

.ai-report-table th {
  padding: 10px 14px;
  font-family: var(--font-heading);
  font-size: 11.5px;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.ai-report-table td {
  padding: 10px 14px;
  border-bottom: 1px solid #f1f5f9;
  color: #1e293b;
  vertical-align: middle;
  white-space: nowrap;
}

.ai-report-table tbody tr:last-child td {
  border-bottom: none;
}

.ai-report-table tbody tr:hover {
  background: #f8fafc;
}

.ai-report-table tbody tr:nth-child(even) {
  background: #fafcff;
}

.ai-report-table tbody tr:nth-child(even):hover {
  background: #f1f5f9;
}

.ai-table-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

.ai-table-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
}

.ai-table-pill.negative {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.ai-table-pill.positive {
  background: #f0fdf4;
  color: #16a34a;
  border: 1px solid #bbf7d0;
}

.ai-table-pill.neutral {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}

.ai-chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.ai-chart-title {
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 700;
  color: var(--secondary);
}

.ai-chart-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-copy-chart {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #334155;
  border-radius: 6px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-copy-chart:hover {
  background: #e2e8f0;
  color: #0f172a;
  border-color: #94a3b8;
}

.btn-copy-chart.btn-copied {
  background: #dcfce7;
  border-color: #86efac;
  color: #15803d;
}

.ai-chart-badge {
  font-size: 11px;
  color: var(--text-muted);
  background: #e2e8f0;
  padding: 2px 8px;
  border-radius: 9999px;
}

.ai-chart-canvas-wrap {
  position: relative;
  height: 280px;
  width: 100%;
}

/* Car Cards Grid */
.ai-cars-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ai-cars-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ai-cars-title {
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 700;
  color: var(--secondary);
}

.ai-cars-count {
  font-size: 11px;
  font-weight: 600;
  background: #e0f2fe;
  color: #0369a1;
  padding: 2px 8px;
  border-radius: 9999px;
}

.ai-cars-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.ai-car-card {
  background: #ffffff;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ai-car-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.ai-car-image-wrap {
  position: relative;
  height: 120px;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.ai-car-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ai-car-img-placeholder {
  font-size: 32px;
}

.ai-car-days-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 9999px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.ai-car-days-badge.badge-neutral { background: #f1f5f9; color: #475569; }
.ai-car-days-badge.badge-success { background: #dcfce7; color: #166534; }
.ai-car-days-badge.badge-warning { background: #fef3c7; color: #92400e; }
.ai-car-days-badge.badge-danger  { background: #fee2e2; color: #991b1b; }
.ai-car-days-badge.badge-muted   { background: #e2e8f0; color: #64748b; }


.ai-car-details {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.ai-car-title {
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 700;
  color: var(--secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ai-car-variant {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ai-car-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
}

.ai-car-price {
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 800;
  color: var(--secondary);
}

.ai-car-fuel {
  font-size: 10.5px;
  color: var(--text-subtle);
}

.btn-car-link {
  display: inline-block;
  margin-top: 8px;
  font-size: 11px;
  font-weight: 600;
  color: #0284c7;
  text-decoration: none;
}

.btn-car-link:hover {
  text-decoration: underline;
}

/* Takeaways */
.ai-takeaways-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ai-takeaways-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ai-takeaway-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
}

.ai-takeaway-item .takeaway-icon {
  font-size: 16px;
  flex-shrink: 0;
  margin-top: 1px;
}

.ai-takeaway-item .takeaway-text {
  font-size: 13px;
  color: #334155;
  line-height: 1.5;
}

/* Shake Animation on Validation Error */
.input-shake {
  animation: shake 0.5s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

/* Saved Questions Dropdown & Metadata Bar */
.ai-badge-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 2px;
}

.ai-report-period-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 9999px;
  font-size: 11.5px;
  font-weight: 600;
  color: #0369a1;
}

.ai-result-saved-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.ai-saved-date-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 9999px;
  font-size: 11.5px;
  font-weight: 600;
  color: #475569;
}

.ai-saved-date-badge.live {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #047857;
}

.btn-refresh-saved-report {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  background: #ffffff;
  border: 1px solid #0284c7;
  color: #0284c7;
  border-radius: 9999px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 1px 2px rgba(2, 132, 199, 0.08);
}

.btn-refresh-saved-report:hover {
  background: #0284c7;
  color: #ffffff;
}

.ai-saved-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #ffffff;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.06);
  max-height: 280px;
  overflow-y: auto;
  z-index: 1000;
}

.saved-dropdown-header {
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: #f8fafc;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.saved-question-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid #f8fafc;
  transition: background 0.12s ease;
}

.saved-question-item:last-child {
  border-bottom: none;
}

.saved-question-item:hover,
.saved-question-item.active {
  background: #f0f9ff;
}

.saved-question-icon {
  font-size: 15px;
  color: #0284c7;
  flex-shrink: 0;
}

.saved-question-content {
  flex: 1;
  min-width: 0;
}

.saved-question-title {
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.saved-question-date {
  font-size: 11px;
  color: #64748b;
  margin-top: 1px;
}

.btn-delete-saved {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 14px;
  padding: 2px 6px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.12s ease;
}

.btn-delete-saved:hover {
  color: #ef4444;
  background: #fee2e2;
}

.saved-dropdown-section-title {
  padding: 6px 14px;
  font-size: 11px;
  font-weight: 700;
  color: #0369a1;
  background: #f0f9ff;
  border-top: 1px solid #e0f2fe;
  border-bottom: 1px solid #e0f2fe;
  display: flex;
  align-items: center;
  gap: 6px;
}

.saved-question-dealer-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 7px;
  background: #e0f2fe;
  color: #0369a1;
  font-size: 11px;
  font-weight: 700;
  border-radius: 4px;
  margin-right: 6px;
  flex-shrink: 0;
}

/* PDF Export Styling & Print Layout */
.ai-pdf-page-container {
  background: #ffffff;
  color: #1e293b;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  padding: 0 8px !important;
  width: 100% !important;
  max-width: 680px !important;
  margin: 0 auto !important;
  box-sizing: border-box !important;
}

.ai-pdf-header {
  display: flex !important;
  justify-content: space-between !important;
  align-items: flex-start !important;
  padding-bottom: 12px !important;
  margin-bottom: 16px !important;
  border-bottom: 2px solid #00bb2b !important;
  box-sizing: border-box !important;
  width: 100% !important;
}

.ai-pdf-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ai-pdf-brand-icon {
  width: 44px !important;
  height: 44px !important;
  background: transparent !important;
  color: inherit;
  border-radius: 0 !important;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ai-pdf-title-block h1 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 20px;
  font-weight: 800;
  color: #003B5C;
  margin: 0 0 3px 0;
}

.ai-pdf-title-block p {
  font-size: 12px;
  color: #64748b;
  margin: 0;
}

.ai-pdf-meta {
  text-align: right;
  font-size: 11px;
  color: #475569;
  line-height: 1.4;
  white-space: nowrap;
  padding-right: 4px;
  flex-shrink: 0;
}

.ai-pdf-meta strong {
  color: #0f172a;
}

.ai-pdf-section {
  margin-bottom: 20px;
  page-break-inside: auto;
  break-inside: auto;
}

.ai-pdf-section-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: #003B5C;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 10px;
  padding-bottom: 5px;
  border-bottom: 1.5px solid #e2e8f0;
}

.ai-pdf-footer {
  margin-top: 30px;
  padding-top: 12px;
  border-top: 1px solid #cbd5e1;
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: #94a3b8;
}

.html2pdf__page-break {
  page-break-before: always;
}

/* AI Analysis Mode Selector (Standard vs. Deepdive Agent) */
.ai-mode-selector-wrap {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 12px;
}

.ai-mode-pills {
  display: inline-flex;
  gap: 8px;
  background: #f1f5f9;
  padding: 4px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
}

.ai-mode-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  color: #64748b;
  text-align: left;
}

.ai-mode-pill:hover {
  color: #0f172a;
  background: rgba(255, 255, 255, 0.6);
}

.ai-mode-pill.active {
  background: #ffffff;
  color: #003B5C;
  border-color: #cbd5e1;
  box-shadow: 0 2px 6px -1px rgba(0, 59, 92, 0.1), 0 1px 3px rgba(0, 0, 0, 0.05);
}

.ai-mode-pill-icon {
  font-size: 16px;
  line-height: 1;
}

.ai-mode-pill-title {
  font-weight: 700;
  font-size: 12.5px;
  display: block;
}

.ai-mode-pill-sub {
  font-size: 10.5px;
  color: #94a3b8;
  display: block;
}

.ai-mode-pill.active .ai-mode-pill-sub {
  color: #0284c7;
}

#btnModeDeepdive.active {
  border-color: #38bdf8;
  box-shadow: 0 2px 8px -1px rgba(2, 132, 199, 0.2);
}

#btnModeDeepdive.active .ai-mode-pill-title {
  color: #0284c7;
}

/* Deepdive Mode Status Pulse Animation */
.pulse-status {
  animation: pulseStatusText 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes pulseStatusText {
  0% { transform: translateY(-2px); color: #0284c7; opacity: 0.7; }
  100% { transform: translateY(0); color: inherit; opacity: 1; }
}

/* Deepdive Badge & Investigation Steps Trail */
.ai-report-mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
  border: 1px solid #c4b5fd;
  color: #6d28d9;
  border-radius: 9999px;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(109, 40, 217, 0.08);
}

.ai-deepdive-steps-container {
  margin: 14px 0 6px 0;
  background: #faf5ff;
  border: 1px solid #e9d5ff;
  border-radius: 12px;
  padding: 12px 16px;
  transition: all 0.2s ease;
}

.ai-deepdive-steps-container.hidden {
  display: none !important;
}

.ai-deepdive-steps-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
}

.ai-deepdive-steps-badge {
  display: flex;
  align-items: center;
  gap: 8px;
}

.deepdive-badge-icon {
  font-size: 16px;
}

.deepdive-badge-title {
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 700;
  color: #581c87;
}

.deepdive-badge-count {
  font-size: 11px;
  font-weight: 600;
  background: #ede9fe;
  color: #6d28d9;
  padding: 2px 8px;
  border-radius: 10px;
}

.deepdive-toggle-icon {
  font-size: 11px;
  color: #7e22ce;
  transition: transform 0.2s ease;
}

.ai-deepdive-steps-container.collapsed .deepdive-toggle-icon {
  transform: rotate(-90deg);
}

.ai-deepdive-steps-container.collapsed .ai-deepdive-steps-body {
  display: none;
}

.ai-deepdive-steps-body {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed #e9d5ff;
}

.ai-deepdive-steps-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.ai-deepdive-steps-list li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12.5px;
  color: #4c1d95;
  line-height: 1.45;
}

.deepdive-step-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  background: #7e22ce;
  color: #ffffff;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 800;
  flex-shrink: 0;
  margin-top: 1px;
}

