@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ---- Theme tokens ---- */
html[data-theme="light"] {
  --bg: #F7F8FA;
  --bg-elevated: #FFFFFF;
  --bg-sunken: #F1F2F5;
  --text-primary: #12141A;
  --text-secondary: #6B7280;
  --hairline: #E5E7EB;
  --hairline-strong: #D1D5DB;
  --shadow: 0 1px 2px rgba(16,24,40,0.04), 0 1px 3px rgba(16,24,40,0.06);
}
html[data-theme="dark"] {
  --bg: #0F1319;
  --bg-elevated: #171B22;
  --bg-sunken: #12151B;
  --text-primary: #F5F5F2;
  --text-secondary: #8B93A1;
  --hairline: rgba(255,255,255,0.12);
  --hairline-strong: rgba(255,255,255,0.24);
  --shadow: 0 1px 2px rgba(0,0,0,0.3), 0 4px 12px rgba(0,0,0,0.25);
}
:root {
  --accent: #4F46E5;
  --accent-hover: #4338CA;
  --amber: #D97706;
  --amber-bg-light: rgba(217,119,6,0.12);
  --green: #16A34A;
  --green-bg-light: rgba(22,163,74,0.12);
  --red: #DC2626;
  --red-bg-light: rgba(220,38,38,0.12);
  --blue: #2563EB;
  --blue-bg-light: rgba(37,99,235,0.12);
  --teal: #0D9488;
  --teal-bg-light: rgba(13,148,136,0.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  transition: background-color 150ms ease, color 150ms ease;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--hairline);
  background: var(--bg-elevated);
}
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--hairline);
  background: var(--bg);
  color: var(--text-primary);
  cursor: pointer;
  flex-shrink: 0;
}
.icon-btn:hover { border-color: var(--hairline-strong); }
.icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.icon-btn svg { width: 18px; height: 18px; }
.topbar-brand-inline {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
}
.topbar-search {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 480px;
  margin: 0 auto;
  background: var(--bg);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  padding: 8px 14px;
  color: var(--text-secondary);
}
.topbar-search svg { width: 16px; height: 16px; flex-shrink: 0; }
.topbar-search input {
  border: none;
  background: none;
  outline: none;
  font-family: inherit;
  font-size: 13px;
  color: var(--text-primary);
  width: 100%;
}
.topbar-search input::placeholder { color: var(--text-secondary); }
.topbar-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.tab-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
}
.tab-btn:hover { color: var(--text-primary); background: var(--bg-sunken); }
.tab-btn--active { color: var(--accent); background: rgba(79,70,229,0.1); }
.tab-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- Slide-out sidebar ---- */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 40;
}
.sidebar-overlay[hidden] { display: none; }
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 260px;
  background: var(--bg-elevated);
  border-right: 1px solid var(--hairline);
  z-index: 50;
  display: flex;
  flex-direction: column;
  padding: 8px;
  overflow-y: auto;
  box-shadow: 4px 0 24px rgba(0,0,0,0.15);
  transform: translateX(0);
  transition: transform 180ms ease;
}
.sidebar[hidden] { display: none; }
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 10px 16px;
}
.sidebar-brand { font-size: 16px; font-weight: 700; color: var(--text-primary); }
.sidebar-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  padding: 14px 12px 6px;
}
.sidebar-section-label:first-of-type { padding-top: 4px; }
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 2px;
}
.sidebar-link svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-link:hover { background: var(--bg-sunken); }
.sidebar-link--active { background: var(--accent); color: #FFFFFF; font-weight: 600; }
.sidebar-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- Finance / Reports internal tabs ---- */
.finance-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--hairline);
  padding-bottom: 10px;
}
.finance-subview[hidden] { display: none; }

.topbar-controls input {
  background: var(--bg);
  border: 1px solid var(--hairline);
  border-radius: 6px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  padding: 8px 12px;
  width: 200px;
}
.topbar-controls input:focus { outline: none; border-color: var(--accent); }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--hairline);
  background: var(--bg);
  color: var(--text-secondary);
  cursor: pointer;
}
.theme-toggle:hover { border-color: var(--hairline-strong); color: var(--text-primary); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-toggle svg { width: 17px; height: 17px; }
.theme-toggle .icon-moon { display: none; }
html[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

.btn {
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  border: none;
}
.btn-primary { background: var(--accent); color: #FFFFFF; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: transparent; color: var(--text-primary); border: 1px solid var(--hairline-strong); }
.btn-secondary:hover { border-color: var(--accent); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

main { padding: 24px 28px; max-width: 1400px; margin: 0 auto; }

.notice {
  background: var(--bg-elevated);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  padding: 16px 20px;
  color: var(--text-secondary);
  font-size: 13px;
}
.notice--error { color: var(--red); border-color: var(--red); }
.notice--success { color: var(--green); border-color: var(--green); }

/* ---- Stat cards ---- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.stat-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.stat-icon {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.stat-icon svg { width: 20px; height: 20px; }
.stat-icon--text { font-weight: 700; font-size: 17px; }
.stat-card--indigo .stat-icon { background: rgba(79,70,229,0.12); color: var(--accent); }
.stat-card--green .stat-icon { background: var(--green-bg-light); color: var(--green); }
.stat-card--amber .stat-icon { background: var(--amber-bg-light); color: var(--amber); }
.stat-card--blue .stat-icon { background: var(--blue-bg-light); color: var(--blue); }
.stat-card--teal .stat-icon { background: var(--teal-bg-light); color: var(--teal); }
.stat-value { font-size: 22px; font-weight: 700; color: var(--text-primary); line-height: 1.2; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.stat-text { min-width: 0; }
.stat-text .stat-label { margin-top: 0; }
.stat-label { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.stat-delta { font-size: 11px; margin-top: 5px; color: var(--text-secondary); }
.stat-delta .delta-up { color: var(--green); font-weight: 700; }
.stat-delta .delta-down { color: var(--red); font-weight: 700; }
.stat-delta .delta-flat { color: var(--text-secondary); font-weight: 700; }

/* ---- Panels row ---- */
.panels-row {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
  align-items: start;
  margin-bottom: 20px;
}
.panels-row--triple {
  grid-template-columns: 1fr 1.3fr 1fr;
  align-items: start;
}
.panels-row--triple .panel { display: flex; flex-direction: column; height: 100%; }
.panels-row--triple .panel--donut .donut-wrap { flex: 1; display: flex; align-items: center; justify-content: center; }
@media (max-width: 1000px) {
  .panels-row { grid-template-columns: 1fr; }
}
.panel {
  background: var(--bg-elevated);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 20px 22px;
}
.panel--table-full { margin-bottom: 20px; }
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}
.panel-header h2 { margin: 0; font-size: 15px; font-weight: 700; color: var(--text-primary); }
.panel-subtitle { font-size: 12px; color: var(--text-secondary); }

.filters { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.filter-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  font-weight: 600;
}
.filter-field select {
  background: var(--bg);
  border: 1px solid var(--hairline);
  border-radius: 6px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  padding: 6px 9px;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 500;
}
.result-count { font-size: 12px; color: var(--text-secondary); }

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}
thead th {
  text-align: left;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  font-weight: 600;
  padding: 0 12px 10px;
  border-bottom: 1px solid var(--hairline);
  white-space: nowrap;
}
tbody td {
  padding: 12px;
  border-bottom: 1px solid var(--hairline);
  font-size: 13px;
  white-space: nowrap;
  color: var(--text-primary);
}
tbody tr:hover { background: var(--bg-sunken); }
tbody tr { cursor: pointer; }

.ref-cell { font-weight: 700; }

.status-badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.status-pending_payment { background: var(--amber-bg-light); color: var(--amber); }
.status-confirmed { background: var(--green-bg-light); color: var(--green); }
.status-cancelled { background: var(--red-bg-light); color: var(--red); }
.status-completed { background: var(--blue-bg-light); color: var(--blue); }

.source-badge {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.row-action-btn {
  background: transparent;
  border: 1px solid var(--hairline-strong);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
}
.row-action-btn:hover { border-color: var(--accent); color: var(--accent); }
.row-action-btn:disabled { opacity: 0.35; cursor: default; pointer-events: none; }

/* ---- Donut chart ---- */
.donut-wrap { display: flex; flex-direction: column; align-items: center; gap: 20px; }
.donut-chart {
  position: relative;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: conic-gradient(var(--hairline) 0deg 360deg);
  display: flex;
  align-items: center;
  justify-content: center;
}
.donut-hole {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--bg-elevated);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.donut-total { font-size: 24px; font-weight: 700; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.donut-total-label { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.donut-legend { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.legend-row { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.legend-swatch { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.legend-label { color: var(--text-secondary); flex: 1; }
.legend-value { font-weight: 700; color: var(--text-primary); font-variant-numeric: tabular-nums; }

/* ---- Revenue chart (plain CSS bars, no charting library) ---- */
.revenue-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 200px;
  padding-top: 10px;
}
.revenue-bar-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
  gap: 6px;
}
.revenue-bar {
  width: 100%;
  max-width: 28px;
  background: var(--accent);
  border-radius: 4px 4px 0 0;
  min-height: 2px;
  transition: background-color 150ms ease;
}
.revenue-bar:hover { background: var(--accent-hover); }
.revenue-bar-date {
  font-size: 9px;
  color: var(--text-secondary);
  white-space: nowrap;
}
.revenue-empty-note {
  color: var(--text-secondary);
  font-size: 13px;
  text-align: center;
  padding: 70px 0;
}

/* ---- Detail panel ---- */
.detail-panel {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 60px 20px;
  overflow-y: auto;
}
.detail-panel[hidden] { display: none; }
.detail-panel-inner {
  position: relative;
  background: var(--bg-elevated);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  padding: 28px;
  width: 100%;
  max-width: 560px;
  box-shadow: var(--shadow);
}
.detail-panel-inner--wide { max-width: 780px; }
.detail-panel-inner--wide { max-width: 720px; }
.qb-mode-tabs {
  display: flex;
  gap: 4px;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  padding: 4px;
  margin-bottom: 16px;
  width: fit-content;
}
.qb-tab-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
}
.qb-tab-btn:hover { color: var(--text-primary); }
.qb-tab-btn--active { background: var(--accent); color: #FFFFFF; }
.qb-tab-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.detail-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--hairline-strong);
  background: transparent;
  color: var(--text-primary);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.detail-close:hover { background: var(--bg-sunken); }

.detail-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 7px 0;
  border-bottom: 1px solid var(--hairline);
  font-size: 13px;
}
.detail-row span:first-child { color: var(--text-secondary); }
.detail-row span:last-child { color: var(--text-primary); font-weight: 500; text-align: right; }
.detail-section-label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  font-weight: 600;
  margin: 18px 0 6px;
}
.detail-section-label:first-child { margin-top: 0; }

/* ---- Compact 3-column row (Source / Status / Action Requested) ---- */
.detail-row-columns {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid var(--hairline);
}
.detail-row-column { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.detail-row-column-label { font-size: 11px; color: var(--text-secondary); }
.detail-row-column-value { font-size: 13px; color: var(--text-primary); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- A field (select/input) with its action button inline, same row,
   rather than the button stacked in its own full-width row below ---- */
.form-field-inline-action { display: flex; align-items: flex-end; gap: 10px; }
.form-field-inline-action .form-field { flex: 1; min-width: 0; }
.form-field-inline-action .btn { flex-shrink: 0; }

.detail-status-row {
  display: flex;
  gap: 8px;
  margin-top: 18px;
  flex-wrap: wrap;
}

/* ---- Panel intro text (Drivers/Suppliers/Settings explanatory copy) ---- */
.panel-intro {
  font-size: 13px;
  color: var(--text-secondary);
  margin: -8px 0 16px;
  line-height: 1.5;
}
.invite-code-generate-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  font-size: 13px;
  color: var(--text-secondary);
}
.invite-code-generate-row input[type="number"] {
  width: 64px;
  padding: 7px 8px;
  border: 1px solid var(--hairline-strong);
  border-radius: 8px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
}
.invite-code-value { font-family: 'SF Mono', 'Consolas', monospace; font-size: 12.5px; letter-spacing: 0.02em; }
.invite-code-badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 100px; }
.invite-code-badge--available { background: var(--green-bg); color: var(--green); }
.invite-code-badge--used { background: var(--hairline); color: var(--text-secondary); }

/* ---- Forms (driver/supplier add-edit modals) ---- */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 4px;
}
.form-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  font-weight: 600;
}
.form-field--checkbox { flex-direction: row; align-items: center; gap: 8px; }
.form-field--checkbox input[type="checkbox"] { width: 16px; height: 16px; }
.qb-address-field { position: relative; }
.address-suggestions {
  position: absolute;
  top: 100%; left: 0; right: 0;
  margin-top: 4px;
  background: var(--bg-elevated);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  box-shadow: var(--shadow);
  max-height: 220px;
  overflow-y: auto;
  z-index: 40;
}
.address-suggestions[hidden] { display: none; }
.address-suggestion-item {
  padding: 10px 12px;
  cursor: pointer;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
  border-bottom: 1px solid var(--hairline);
}
.address-suggestion-item:last-child { border-bottom: none; }
.address-suggestion-item:hover { background: var(--bg-sunken); }
.address-suggestion-name { font-size: 13px; color: var(--text-primary); }
.address-suggestion-detail { font-size: 11px; color: var(--text-secondary); margin-top: 1px; }
.form-field[hidden] { display: none; }
.form-field--wide { grid-column: 1 / -1; }
.form-field input, .form-field select, .form-field textarea {
  background: var(--bg);
  border: 1px solid var(--hairline);
  border-radius: 6px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: normal;
  padding: 8px 10px;
  width: 100%;
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.form-field textarea { resize: vertical; font-family: inherit; }
.form-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  margin-top: 4px;
}

/* ---- Settings: integrations list ---- */
.integration-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--hairline);
  font-size: 13px;
  color: var(--text-primary);
}
.integration-row:last-child { border-bottom: none; }

/* ---- Checkbox group (supplier "supplies" field) ---- */
.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 2px;
}
.checkbox-option {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: normal;
  color: var(--text-primary);
  cursor: pointer;
}
.checkbox-option input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ---- Supply tags (suppliers table) ---- */
.supply-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-sunken);
  border-radius: 999px;
  padding: 2px 8px;
  margin: 0 4px 4px 0;
}

/* ---- Flight status badge ---- */
.flight-status-badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--bg-sunken);
  color: var(--text-secondary);
}

/* ---- Quick Book modal: wider 3-column grid for this form specifically ---- */
#quickbook-panel .form-grid {
  grid-template-columns: repeat(3, 1fr);
}
@media (max-width: 700px) {
  #quickbook-panel .form-grid { grid-template-columns: 1fr; }
}

/* ---- Corporate account balance display ---- */
.corporate-balance {
  margin-top: 16px;
  padding: 16px 18px;
  background: var(--bg-sunken);
  border-radius: 10px;
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
.corporate-balance span {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ---- Notifications ---- */
#notifications-toggle { position: relative; }
.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 3px;
  border-radius: 999px;
  background: var(--red);
  color: #FFFFFF;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}
.notif-badge[hidden] { display: none; }
.notifications-panel {
  position: fixed;
  top: 62px;
  right: 24px;
  width: 320px;
  max-height: 420px;
  overflow-y: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  box-shadow: var(--shadow);
  z-index: 60;
}
.notifications-panel[hidden] { display: none; }
.notifications-header {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  padding: 14px 16px;
  border-bottom: 1px solid var(--hairline);
}
.staff-push-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--hairline);
}
.staff-push-row-label { font-size: 12.5px; color: var(--text-secondary); }
.staff-push-row .btn { flex-shrink: 0; padding: 6px 12px; font-size: 12px; }
.notification-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-bottom: 1px solid var(--hairline);
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
}
.notification-item:last-child { border-bottom: none; }
.notification-item:hover { background: var(--bg-sunken); }
.notification-item-meta {
  display: block;
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}
.notifications-empty {
  padding: 24px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary);
}

/* ---- Compact panel variant (Booking Status / Revenue, resized per redesign) ---- */
.panel--compact { padding: 16px 18px; }
.panel--compact .panel-header { margin-bottom: 10px; }
.donut-wrap--compact { gap: 16px; flex-direction: row; align-items: center; }
.donut-chart--compact { width: 92px; height: 92px; flex-shrink: 0; }
.donut-hole--compact { width: 58px; height: 58px; }
.donut-hole--compact .donut-total { font-size: 14px; }
.donut-legend--tight {
  display: grid;
  grid-template-columns: 1fr auto auto;
  column-gap: 14px;
  row-gap: 7px;
  align-items: center;
  width: 100%;
}
.donut-legend--tight .legend-row { display: contents; }
.legend-category { display: flex; align-items: center; gap: 7px; min-width: 0; }
.legend-count { font-weight: 700; color: var(--text-primary); font-variant-numeric: tabular-nums; text-align: right; }
.legend-pct { color: var(--text-secondary); font-variant-numeric: tabular-nums; text-align: right; font-size: 11.5px; }

/* ---- God's Eye ---- */
.panel--godseye { display: flex; flex-direction: column; }
.panel-intro--tight { margin: 0 0 12px; font-size: 12px; }
.detail-status-note {
  margin: 10px 0;
  padding: 10px 12px;
  background: var(--amber-bg-light);
  border-radius: 8px;
  font-size: 12.5px;
  color: var(--amber);
  line-height: 1.4;
}
.detail-conversation { display: flex; flex-direction: column; gap: 8px; max-height: 360px; overflow-y: auto; }
.conversation-message {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 12px;
  border-radius: 8px;
  border-left: 3px solid var(--hairline-strong);
  background: var(--bg-sunken);
}
.conversation-message--driver { border-left-color: var(--blue); }
.conversation-message-who { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-secondary); }
.conversation-message-text { font-size: 13.5px; color: var(--text-primary); line-height: 1.4; }
.conversation-message-time { font-size: 11px; color: var(--text-secondary); }
.detail-favorite-drivers-note {
  margin: 0 0 10px;
  padding: 10px 12px;
  background: var(--blue-bg-light);
  border-radius: 8px;
  font-size: 12.5px;
  color: var(--blue);
  line-height: 1.4;
}
.ota-payment-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.ota-payment-card {
  background: var(--bg-elevated);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--shadow);
}
.ota-payment-card h3 { font-family: 'Fraunces', Georgia, serif; font-size: 16px; margin: 0 0 10px; color: var(--text-primary); }
.ota-payment-cycle { font-size: 12px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px; }
.ota-payment-amount { font-family: 'Fraunces', Georgia, serif; font-size: 28px; color: var(--text-primary); margin-bottom: 10px; }
.ota-payment-detail { font-size: 13px; color: var(--text-primary); margin-bottom: 3px; }
.ota-payment-note { font-size: 12px; color: var(--text-secondary); margin-top: 10px; line-height: 1.4; }
.ota-payment-received-badge { display: inline-block; font-size: 12.5px; font-weight: 700; color: var(--green); background: var(--green-bg); padding: 5px 12px; border-radius: 100px; margin-top: 8px; }
.ota-payment-mark-btn { margin-top: 8px; }
.godseye-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: calc(5 * 32px + 4 * 8px); /* exactly 5 full rows, then scroll — no partial row peeking through */
  overflow-y: auto;
}
.godseye-row {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 32px;
  padding: 0 10px;
  background: var(--bg-sunken);
  border-radius: 8px;
  font-size: 12px;
}
.godseye-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
}
.godseye-dot--offline { background: var(--text-secondary); }
.godseye-name { flex: 1; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.godseye-location { color: var(--text-secondary); font-style: italic; white-space: nowrap; flex-shrink: 0; }
.godseye-location--live { color: var(--accent); font-style: normal; font-weight: 600; text-decoration: none; }
.godseye-location--live:hover { text-decoration: underline; }

/* ---- Revenue line chart ---- */
.revenue-range-select {
  background: var(--bg);
  border: 1px solid var(--hairline);
  border-radius: 6px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  padding: 5px 8px;
}
.revenue-line-chart {
  width: 100%;
  height: 100px;
  display: block;
  overflow: visible;
}
.revenue-line-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ---- Document uploads (driver/vehicle) ---- */
.documents-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.document-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--bg-sunken);
  border-radius: 8px;
  font-size: 12px;
}
.document-thumb {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-elevated);
}
.document-icon {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
}
.document-info { flex: 1; min-width: 0; }
.document-name {
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.document-meta { color: var(--text-secondary); font-size: 11px; margin-top: 1px; }
.documents-empty { font-size: 12px; color: var(--text-secondary); padding: 4px 0; }

/* ---- Driver profile photo ---- */
.photo-upload-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--hairline);
}
.photo-upload-row[hidden] { display: none; }
.photo-preview {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-sunken);
  flex-shrink: 0;
  border: 1px solid var(--hairline);
}
.driver-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-sunken);
  vertical-align: middle;
  margin-right: 8px;
}
.driver-avatar-placeholder {
  display: inline-flex;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-sunken);
  color: var(--text-secondary);
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  vertical-align: middle;
  margin-right: 8px;
}

/* ---- Number plate styling ---- */
.plate-badge {
  display: inline-block;
  font-family: 'Courier New', monospace;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border: 1.5px solid var(--text-primary);
  border-radius: 4px;
  background: var(--bg-elevated);
  color: var(--text-primary);
}

/* ---- Bookings table: fixed layout with wrapping instead of horizontal scroll ---- */
.bookings-table-fixed { table-layout: fixed; }
.bookings-table-fixed th:nth-child(1), .bookings-table-fixed td:nth-child(1) { width: 11%; }
.bookings-table-fixed th:nth-child(2), .bookings-table-fixed td:nth-child(2) { width: 11%; }
.bookings-table-fixed th:nth-child(3), .bookings-table-fixed td:nth-child(3) { width: 15%; }
.bookings-table-fixed th:nth-child(4), .bookings-table-fixed td:nth-child(4) { width: 23%; }
.bookings-table-fixed th:nth-child(5), .bookings-table-fixed td:nth-child(5) { width: 13%; }
.bookings-table-fixed th:nth-child(6), .bookings-table-fixed td:nth-child(6) { width: 13%; }
.bookings-table-fixed th:nth-child(7), .bookings-table-fixed td:nth-child(7) { width: 8%; }
.bookings-table-fixed th:nth-child(8), .bookings-table-fixed td:nth-child(8) { width: 6%; }
.bookings-table-fixed th { font-size: 9px; padding: 0 8px 8px; }
.bookings-table-fixed td {
  font-size: 11.5px;
  padding: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bookings-table-fixed .ref-cell { font-size: 11.5px; }
.bookings-table-fixed .status-badge { font-size: 9px; padding: 2px 7px; }

/* ---- Pagination ---- */
.pagination-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--hairline);
}
.pagination-row[hidden] { display: none; }

/* ---- Incident resolution ---- */
.penalty-guidance {
  background: var(--amber-bg-light);
  color: var(--amber);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 12px;
  margin: 10px 0;
}
.outcome-badge-none { background: var(--green-bg-light); color: var(--green); }
.outcome-badge-penalty { background: var(--red-bg-light); color: var(--red); }
.resolution-choice-row {
  display: flex;
  gap: 10px;
  margin: 10px 0;
}
.resolution-choice-btn {
  flex: 1;
  padding: 12px;
  border-radius: 8px;
  border: 1.5px solid var(--hairline-strong);
  background: var(--bg);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}
.resolution-choice-btn:hover { border-color: var(--accent); }
.resolution-choice-btn--active-no-penalty { border-color: var(--green); background: var(--green-bg-light); color: var(--green); }
.resolution-choice-btn--active-penalty { border-color: var(--red); background: var(--red-bg-light); color: var(--red); }

/* ---- Finance: cash flow chart + expense breakdown ---- */
.cashflow-chart {
  width: 100%;
  height: 200px;
  display: block;
  overflow: visible;
}
.cashflow-labels {
  display: flex;
  justify-content: space-around;
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 6px;
}
.expense-breakdown-bar {
  display: flex;
  width: 100%;
  height: 28px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-sunken);
}
.expense-breakdown-segment {
  height: 100%;
  transition: opacity 150ms ease;
}

/* ---- Sidebar dropdown groups (Reservations / Operations / Support) ---- */
.sidebar-group-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 2px;
}
.sidebar-group-toggle svg:not(.sidebar-chevron) { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-group-toggle:hover { background: var(--bg-sunken); }
.sidebar-group-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sidebar-group-toggle-label { flex: 1; }
.sidebar-chevron {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  transition: transform 150ms ease;
}
.sidebar-group-toggle[aria-expanded="true"] .sidebar-chevron { transform: rotate(180deg); }
.sidebar-group { padding-left: 14px; }
.sidebar-group[hidden] { display: none; }
.sidebar-link--sub {
  font-size: 13px;
  padding: 9px 12px 9px 30px;
  position: relative;
}
.sidebar-link--sub::before {
  content: '';
  position: absolute;
  left: 14px;
  top: 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-secondary);
  transform: translateY(-50%);
}
.sidebar-link--sub.sidebar-link--active::before { background: #FFFFFF; }

/* ---- Topbar left group (hamburger + brand, kept together now that
   search has moved into the sidebar and justify-content:space-between
   is doing the layout work) ---- */
.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

/* ---- Sidebar search (moved here from the topbar) ---- */
.sidebar-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  padding: 8px 12px;
  margin: 4px 4px 14px;
  color: var(--text-secondary);
}
.sidebar-search svg { width: 15px; height: 15px; flex-shrink: 0; }
.sidebar-search input {
  border: none;
  background: none;
  outline: none;
  font-family: inherit;
  font-size: 13px;
  color: var(--text-primary);
  width: 100%;
}
.sidebar-search input::placeholder { color: var(--text-secondary); }

/* ---- Pin Support + Settings to the bottom of the sidebar, leaving open
   room in the middle for future menu items rather than them just
   trailing wherever the list happens to end ---- */
.sidebar-group-toggle[data-group-toggle="support"] { margin-top: auto; }

/* ---- Revenue chart: smooth custom tooltip ---- */
.chart-tooltip-wrap { position: relative; }
.revenue-dot { transition: r 120ms ease; }
.revenue-dot-hit { cursor: pointer; }
.chart-tooltip {
  position: absolute;
  transform: translate(-50%, calc(-100% - 12px));
  background: var(--text-primary);
  color: var(--bg-elevated);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 120ms ease, transform 120ms ease;
  z-index: 5;
}
.chart-tooltip[hidden] { display: none; }
.chart-tooltip--visible { opacity: 1; transform: translate(-50%, calc(-100% - 16px)); }

/* ---- God's Eye: live driver map (Leaflet) ---- */
.godseye-map {
  width: 100%;
  height: 160px;
  border-radius: 10px;
  margin-bottom: 12px;
  background: var(--bg-sunken);
  z-index: 0;
}

/* ---- God's Eye: vehicle icon + rich popup ---- */
.godseye-vehicle-icon { background: none; border: none; }
.godseye-popup { font-size: 13px; line-height: 1.5; }
.godseye-popup-name { font-weight: 700; margin-bottom: 3px; }
.godseye-popup-line { color: var(--text-secondary); }

/* ---- Fleet Tracking: full-size map ---- */
.fleet-map {
  width: 100%;
  height: 480px;
  border-radius: 10px;
  margin-bottom: 16px;
  background: var(--bg-sunken);
  z-index: 0;
}

/* ---- Booking Status split into a stacked column ---- */
.panel-stack { display: flex; flex-direction: column; gap: 16px; }
.panel-stack .panel { display: flex; flex-direction: column; }

/* ---- Flight-Tracked Pickups ---- */
.flight-pickups-list { display: flex; flex-direction: column; gap: 10px; }
.flight-pickup-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--hairline);
  font-size: 12.5px;
}
.flight-pickup-row:last-child { border-bottom: none; }
.flight-pickup-main { flex: 1; min-width: 0; }
.flight-pickup-number { font-weight: 700; color: var(--text-primary); }
.flight-pickup-meta { color: var(--text-secondary); font-size: 11.5px; margin-top: 1px; }

/* ---- Revenue chart: period summary stats, filling the space below it ---- */
.section-heading--tight { margin: 10px 0 6px; font-size: 12px; }
.revenue-summary-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.revenue-summary-stat { text-align: center; }
.revenue-summary-stat-value { font-size: 16px; font-weight: 700; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.revenue-summary-stat-label { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }

/* ---- Vehicle Type Breakdown (Revenue Over Time panel) ---- */
.vehicle-type-breakdown { display: flex; flex-direction: column; gap: 8px; }
.vt-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 4px;
}
.vt-label { color: var(--text-primary); font-weight: 600; }
.vt-value { color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.vt-bar-track {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: var(--hairline);
  overflow: hidden;
}
.vt-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
}

/* ---- Panic Alerts ---- */
.sidebar-link--panic { color: var(--red); position: relative; }
.sidebar-link--panic:hover { background: var(--red-bg-light); }
.sidebar-panic-badge {
  margin-left: auto;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}
.sidebar-panic-badge[hidden] { display: none; }
.notification-item--urgent { background: var(--red-bg-light); border-left: 3px solid var(--red); }
.notification-item--urgent:hover { background: var(--red-bg-light); filter: brightness(0.97); }
.panic-alert-row--open { background: var(--red-bg-light); }

.form-field-hint {
  font-size: 11px;
  text-transform: none;
  letter-spacing: normal;
  color: var(--text-secondary);
  font-weight: 400;
}

.empty-inline-note { font-size: 13px; color: var(--text-secondary); }
.driver-linked-vehicles-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.driver-linked-vehicle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: var(--bg-sunken);
  border-radius: 8px;
  font-size: 13px;
}
.driver-linked-vehicle-type { color: var(--text-secondary); font-size: 12px; }

/* ---- Airport Info: now fully theme-aware, using the same shared
   variables as the rest of the dashboard (previously a dedicated,
   permanently-dark treatment independent of the light/dark toggle —
   changed on request so it matches everywhere else, day or night). ---- */
.ai-shell { color: var(--text-primary); }
.ai-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.ai-title { font-family: 'Fraunces', Georgia, serif; font-size: 24px; color: var(--text-primary); margin: 0 0 4px; }
.ai-subtitle { font-size: 13px; color: var(--text-secondary); margin: 0; max-width: 520px; line-height: 1.5; }
.ai-tabs { display: flex; gap: 8px; }
.ai-tabs[hidden] { display: none; }
.ai-tabs .tab-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--hairline);
  color: var(--text-secondary);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
}
.ai-tabs .tab-btn--active { background: var(--accent); border-color: var(--accent); color: #fff; }

.ai-notice {
  background: var(--bg-elevated);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  padding: 14px 16px;
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 16px;
}

.ai-main-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
.ai-panel {
  background: var(--bg-elevated);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 20px 22px;
}
.ai-panel-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.ai-panel-header h3 { font-family: 'Fraunces', Georgia, serif; font-size: 17px; color: var(--text-primary); margin: 0; font-weight: 500; }
.ai-panel-note { font-size: 12px; color: var(--text-secondary); }

.ai-map { width: 100%; height: 360px; border-radius: 12px; overflow: hidden; background: var(--bg-sunken); }
.route-incident-responder-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--bg-sunken);
  border-radius: 10px;
  font-size: 13px;
  color: var(--text-secondary);
}
.nav-security-dot { flex-shrink: 0; width: 9px; height: 9px; border-radius: 50%; }
.nav-security-dot--unknown { background: #8B95A8; }
.nav-security-dot--safe { background: #22C55E; }
.nav-security-dot--caution { background: #FBBF24; }
.nav-security-dot--danger { background: #EF4444; }
.ai-panel-header--terminal { margin-top: 16px; margin-bottom: 10px; }
.ai-terminal-map { height: 260px; }
.ai-map-unavailable {
  margin-top: 10px;
  font-size: 12.5px;
  color: var(--text-secondary);
  background: var(--bg-sunken);
  border-radius: 10px;
  padding: 10px 12px;
}

.ai-status-donut { display: flex; align-items: center; justify-content: center; margin-bottom: 16px; }
.ai-status-legend { display: flex; flex-direction: column; gap: 10px; }
.ai-status-legend-row { display: flex; align-items: center; justify-content: space-between; font-size: 13px; }
.ai-status-legend-left { display: flex; align-items: center; gap: 8px; color: var(--text-secondary); }
.ai-status-legend-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.ai-status-legend-value { font-family: 'Fraunces', Georgia, serif; color: var(--text-primary); font-size: 15px; }

.ai-bottom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 2fr;
  gap: 16px;
}
.ai-stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.ai-stat-value { font-family: 'Fraunces', Georgia, serif; font-size: 26px; color: var(--text-primary); }
.ai-stat-label { font-size: 11.5px; color: var(--text-secondary); margin-top: 2px; }

.ai-origins-list { display: flex; flex-direction: column; gap: 12px; }
.ai-origin-row { font-size: 13px; }
.ai-origin-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 5px; color: var(--text-secondary); }
.ai-origin-count { color: var(--text-primary); font-family: 'Fraunces', Georgia, serif; }
.ai-origin-bar-track { height: 5px; background: var(--bg-sunken); border-radius: 999px; overflow: hidden; }
.ai-origin-bar-fill { height: 100%; border-radius: 999px; background: var(--accent); }

.ai-activity-list { display: flex; flex-direction: column; gap: 4px; max-height: 230px; overflow-y: auto; }
.ai-activity-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--hairline);
}
.ai-activity-row:last-child { border-bottom: none; }
.ai-activity-icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--bg-sunken);
  color: var(--text-secondary);
  overflow: hidden;
}
.ai-activity-icon svg { width: 15px; height: 15px; }
.ai-activity-icon img { width: 100%; height: 100%; object-fit: cover; }
.ai-activity-body { flex: 1; min-width: 0; }
.ai-activity-flight { font-size: 13.5px; color: var(--text-primary); }
.ai-activity-meta { font-size: 11.5px; color: var(--text-secondary); margin-top: 1px; }
.ai-activity-time { font-size: 11.5px; color: var(--text-secondary); flex-shrink: 0; }

@media (max-width: 900px) {
  .ai-main-grid { grid-template-columns: 1fr; }
  .ai-bottom-grid { grid-template-columns: 1fr; }
}

.ai-map-airport-marker {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--red);
  border: 2px solid #fff;
  box-shadow: 0 0 0 4px rgba(220,38,38,0.25);
}
.ai-map-plane-marker { width: 22px; height: 22px; color: var(--blue); filter: drop-shadow(0 1px 3px rgba(0,0,0,0.4)); }

.js-error-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background: #7F1D1D;
  color: #FEE2E2;
  padding: 10px 16px;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.js-error-banner[hidden] { display: none; }
.js-error-banner button {
  background: none;
  border: none;
  color: #FEE2E2;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  flex-shrink: 0;
}

.map-unavailable-msg {
  width: 100%;
  height: 100%;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
  font-size: 13.5px;
  color: var(--text-secondary, #8B93A8);
}

/* ---- Driver Messages (staff-facing chat inbox) ---- */
.driver-messages-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 20px;
  align-items: start;
  height: calc(100vh - 180px);
  min-height: 420px;
}
@media (max-width: 900px) {
  .driver-messages-layout { grid-template-columns: 1fr; height: auto; }
}
.driver-messages-list-panel, .driver-messages-thread-panel {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
}
.driver-messages-conversation-list { overflow-y: auto; flex: 1; }
.driver-messages-conversation-item {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--hairline);
  background: none;
  border-left: 3px solid transparent;
  border-right: none; border-top: none;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}
.driver-messages-conversation-item-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.driver-messages-conversation-item:hover { background: var(--bg-sunken); }
.driver-messages-conversation-item--active { background: var(--bg-sunken); border-left-color: var(--accent); }
.driver-messages-conversation-item-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.driver-messages-conversation-name { font-weight: 600; color: var(--text-primary); font-size: 14px; }
.driver-messages-conversation-time { font-size: 11px; color: var(--text-secondary); flex-shrink: 0; }
.driver-messages-conversation-preview {
  font-size: 12.5px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.driver-messages-conversation-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.driver-messages-unread-dot {
  flex-shrink: 0;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.driver-messages-thread-placeholder {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 30px;
  color: var(--text-secondary);
  font-size: 13.5px;
}
#driver-messages-thread-content { display: flex; flex-direction: column; height: 100%; overflow: hidden; }
.driver-messages-thread-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--hairline);
  flex-shrink: 0;
}
.driver-messages-thread-header-name { font-family: 'Fraunces', Georgia, serif; font-size: 17px; color: var(--text-primary); }
.driver-messages-thread-list {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.dm-bubble-row { display: flex; }
.dm-bubble-row--staff { justify-content: flex-end; }
.dm-bubble-row--driver { justify-content: flex-start; }
.dm-bubble { max-width: 70%; padding: 9px 13px; border-radius: 14px; font-size: 13.5px; line-height: 1.45; text-align: center; }
.dm-bubble--staff { background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.dm-bubble--driver { background: var(--bg-sunken); border: 1px solid var(--hairline); color: var(--text-primary); border-bottom-left-radius: 4px; }
.dm-bubble-tag { display: block; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px; opacity: 0.8; }
.dm-bubble-meta { font-size: 11px; color: var(--text-secondary); margin-top: 3px; padding: 0 4px; }
.driver-messages-tag-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-top: 1px solid var(--hairline);
  flex-shrink: 0;
}
.driver-messages-tag-label { font-size: 12px; color: var(--text-secondary); white-space: nowrap; }
.driver-messages-tag-row input {
  flex: 1;
  max-width: 200px;
  background: var(--bg);
  border: 1px solid var(--hairline);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12.5px;
  color: var(--text-primary);
  font-family: inherit;
}
.driver-messages-reply-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--hairline);
  flex-shrink: 0;
}
.driver-messages-reply-row input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text-primary);
  font-family: inherit;
}
.driver-messages-reply-row input:focus { outline: none; border-color: var(--accent); }

.dm-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-sunken);
  flex-shrink: 0;
}
.dm-avatar-placeholder {
  display: inline-flex;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-sunken);
  color: var(--text-secondary);
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}
.dm-vehicle-info { font-size: 11.5px; color: var(--text-secondary); margin: 1px 0 3px; }

/* ---- Broadcast to drivers modal ---- */
.broadcast-modal-inner {
  position: relative;
  background: var(--bg-elevated);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  padding: 28px;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow);
}
.broadcast-modal-inner h2 { margin: 0 0 6px; font-size: 18px; color: var(--text-primary); }
.broadcast-modal-inner .panel-intro { margin: 0 0 18px; font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
.broadcast-modal-inner .form-field { margin-bottom: 16px; }
.broadcast-modal-inner textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text-primary);
  resize: vertical;
}
.broadcast-driver-select-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--text-primary);
  cursor: pointer;
}
.broadcast-driver-select-btn svg { width: 16px; height: 16px; color: var(--text-secondary); flex-shrink: 0; }
.broadcast-driver-dropdown {
  margin-top: 6px;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  background: var(--bg);
  max-height: 220px;
  overflow-y: auto;
}
.broadcast-driver-dropdown[hidden] { display: none; }
.broadcast-driver-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  font-size: 13.5px;
  color: var(--text-primary);
  cursor: pointer;
  border-bottom: 1px solid var(--hairline);
}
.broadcast-driver-option:last-child { border-bottom: none; }
.broadcast-driver-option:hover { background: var(--bg-sunken); }
.broadcast-driver-option--all { font-weight: 600; background: var(--bg-sunken); }
.broadcast-driver-option input[type="checkbox"] { width: 15px; height: 15px; flex-shrink: 0; cursor: pointer; }

/* ---- Flight Tracking preview (Overview, left column, beneath Booking
   Source) — deliberately minimal: exactly 3 rows max, no chart or
   graphic, so this stays shorter than the taller Revenue Over Time and
   God's Eye columns beside it rather than stretching the whole row. ---- */
.flight-tracking-list { display: flex; flex-direction: column; gap: 6px; }
.flight-tracking-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11.5px;
}
.flight-tracking-flight { color: var(--text-primary); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.flight-tracking-ref { color: var(--text-secondary); font-size: 10.5px; }
.flight-tracking-empty { font-size: 11.5px; color: var(--text-secondary); }
