:root {
  --bg-dark: #070b14;
  --sidebar-bg: #0f172a;
  --panel-bg: #1e293b;
  --panel-border: #334155;
  --card-bg: #0f172a;
  --emerald: #10b981;
  --emerald-dark: #059669;
  --amber: #f59e0b;
  --red: #ef4444;
  --blue: #3b82f6;
  --text-light: #f8fafc;
  --text-muted: #94a3b8;
  --font-main: 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-dark);
  color: var(--text-light);
  line-height: 1.5;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ==========================================
   1. ADMIN LOGIN GATE OVERLAY (PRIVATE)
   ========================================== */
.admin-gate-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: radial-gradient(circle at center, #1e293b 0%, #070b14 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.admin-gate-overlay.hidden {
  display: none;
}

.gate-card {
  background: var(--sidebar-bg);
  border: 1.5px solid var(--panel-border);
  border-radius: 20px;
  padding: 32px 28px;
  width: 100%;
  max-width: 420px;
  text-align: center;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.6);
}

.gate-icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid var(--emerald);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin: 0 auto 16px;
}

.gate-card h2 {
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.gate-card p {
  font-size: 0.84rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.gate-input {
  width: 100%;
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--bg-dark);
  border: 1.5px solid #475569;
  color: #fde047;
  font-family: inherit;
  font-size: 1.1rem;
  font-weight: 800;
  text-align: center;
  letter-spacing: 0.2em;
  margin-bottom: 14px;
}

.btn-gate-login {
  width: 100%;
  padding: 13px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, var(--emerald) 0%, var(--emerald-dark) 100%);
  color: #fff;
  font-family: inherit;
  font-weight: 800;
  font-size: 0.95rem;
  cursor: pointer;
}

/* ==========================================
   2. DASHBOARD SHELL (SIDEBAR + MAIN CONTENT)
   ========================================== */
.dashboard-layout {
  display: grid;
  grid-template-columns: 250px 1fr;
  min-height: 100vh;
}

.db-sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--panel-border);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 18px;
  border-bottom: 1px solid var(--panel-border);
  margin-bottom: 16px;
}

.sb-badge {
  background: linear-gradient(135deg, var(--emerald) 0%, var(--emerald-dark) 100%);
  color: #fff;
  font-weight: 900;
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 0.78rem;
  line-height: 1.1;
  text-align: center;
}

.sidebar-brand h2 {
  font-size: 0.96rem;
  font-weight: 800;
  color: #fff;
}

.sidebar-brand span {
  font-size: 0.72rem;
  color: #34d399;
  display: block;
}

.sb-menu {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sb-nav-btn {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 11px 12px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.2s;
}

.sb-nav-btn:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
}

.sb-nav-btn.active {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.4);
}

.sidebar-footer {
  border-top: 1px solid var(--panel-border);
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-lock {
  width: 100%;
  background: #1e293b;
  border: 1px solid #475569;
  color: #cbd5e1;
  padding: 9px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

/* MAIN AREA */
.db-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* TOP HEADER */
.dp-header {
  background: rgba(15, 23, 42, 0.95);
  border-bottom: 1px solid var(--panel-border);
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  position: sticky;
  top: 0;
  z-index: 90;
  backdrop-filter: blur(10px);
}

.dp-header-title h1 {
  font-size: 1.1rem;
  font-weight: 800;
}

.dp-header-title p {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.dp-header-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.config-pill {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.config-pill select {
  background: var(--card-bg);
  color: #fde047;
  border: 1px solid #475569;
  padding: 3px 8px;
  border-radius: 6px;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.78rem;
}

/* KPI BAR */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  padding: 18px 24px 6px;
}

.kpi-card {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.kpi-info span {
  font-size: 0.76rem;
  color: var(--text-muted);
  display: block;
  margin-bottom: 4px;
}

.kpi-info strong {
  font-size: 1.4rem;
  font-weight: 900;
  color: #fff;
}

.kpi-info small {
  display: block;
  font-size: 0.73rem;
  color: #34d399;
  margin-top: 2px;
}

.kpi-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(16, 185, 129, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

/* TAB VIEWS */
.db-tab-view {
  display: none;
  padding: 14px 24px 32px;
}

.db-tab-view.active {
  display: block;
}

/* TAB 1: 3-COLUMN LIVE DISPATCH WORKSPACE */
.dp-workspace {
  display: grid;
  grid-template-columns: 1.05fr 1.35fr 0.95fr;
  gap: 18px;
  align-items: start;
}

.dp-panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--panel-border);
}

.panel-title-row h2 {
  font-size: 1rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge-live {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid #10b981;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
}

/* Scenario presets & NLP box */
.scenario-presets {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.preset-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
}

.preset-btn {
  background: var(--card-bg);
  border: 1px solid var(--panel-border);
  color: var(--text-light);
  text-align: left;
  padding: 9px 12px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.preset-btn:hover {
  border-color: var(--emerald);
  background: rgba(16, 185, 129, 0.08);
}

.preset-btn strong {
  color: #fde047;
  font-size: 0.78rem;
}

.transcript-box {
  background: var(--card-bg);
  border: 1.5px solid #475569;
  border-radius: 12px;
  padding: 12px;
}

.transcript-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 0.76rem;
  color: #38bdf8;
  font-weight: 700;
}

.transcript-textarea {
  width: 100%;
  background: transparent;
  border: none;
  color: #fff;
  font-family: inherit;
  font-size: 0.88rem;
  resize: vertical;
  min-height: 64px;
  line-height: 1.45;
}

.transcript-textarea:focus {
  outline: none;
}

.ai-action-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 8px;
}

.btn-ai-extract {
  background: linear-gradient(135deg, var(--emerald) 0%, var(--emerald-dark) 100%);
  color: #fff;
  border: none;
  padding: 11px 14px;
  border-radius: 10px;
  font-family: inherit;
  font-weight: 800;
  font-size: 0.85rem;
  cursor: pointer;
}

.btn-mic {
  background: #334155;
  color: #fff;
  border: 1px solid #475569;
  padding: 11px 12px;
  border-radius: 10px;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
}

.extracted-card {
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.12) 0%, rgba(15, 23, 42, 0.9) 100%);
  border: 1.5px solid var(--emerald);
  border-radius: 12px;
  padding: 14px;
}

.extracted-card h3 {
  font-size: 0.86rem;
  color: #34d399;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
}

.extracted-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  font-size: 0.8rem;
}

.ext-item {
  background: rgba(15, 23, 42, 0.7);
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid #334155;
}

.ext-item span {
  display: block;
  font-size: 0.68rem;
  color: var(--text-muted);
}

.ext-item strong {
  color: #fff;
  font-size: 0.84rem;
}

.ext-item.highlight strong {
  color: #fde047;
  font-size: 0.95rem;
}

/* Pooling & Queue */
.pooling-box {
  background: var(--card-bg);
  border: 1px solid #3b82f6;
  border-radius: 12px;
  padding: 14px;
}

.pooling-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 0.82rem;
}

.seat-slots {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}

.seat-slot {
  background: #1e293b;
  border: 1px dashed #475569;
  border-radius: 8px;
  padding: 8px 4px;
  text-align: center;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.seat-slot.occupied {
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid var(--emerald);
  color: #fff;
  font-weight: 700;
}

.queue-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.q-tab {
  background: var(--card-bg);
  border: 1px solid var(--panel-border);
  color: var(--text-muted);
  padding: 9px 12px;
  border-radius: 10px;
  font-family: inherit;
  font-weight: 800;
  font-size: 0.8rem;
  cursor: pointer;
}

.q-tab.active {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}

.driver-queue-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 450px;
  overflow-y: auto;
  padding-right: 4px;
}

.driver-row {
  background: var(--card-bg);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 10px 12px;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
}

.driver-row.top-queue {
  border: 1.5px solid #fde047;
  background: rgba(250, 204, 21, 0.07);
}

.rank-badge {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #334155;
  color: #fff;
  font-weight: 900;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.driver-row.top-queue .rank-badge {
  background: #fde047;
  color: #0f172a;
}

.driver-meta strong {
  display: block;
  color: #fff;
  font-size: 0.84rem;
}

.driver-meta small {
  color: var(--text-muted);
  font-size: 0.72rem;
}

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

.driver-wallet span {
  display: block;
  font-size: 0.68rem;
  color: var(--text-muted);
}

.driver-wallet strong {
  color: #34d399;
  font-size: 0.84rem;
}

.btn-topup {
  background: #1e293b;
  border: 1px solid #475569;
  color: #38bdf8;
  padding: 5px 9px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
}

/* Phone Mockup */
.phone-mockup {
  background: #090d16;
  border: 3px solid #475569;
  border-radius: 24px;
  padding: 15px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
}

.phone-notch {
  width: 80px;
  height: 12px;
  background: #1e293b;
  border-radius: 999px;
  margin: 0 auto 10px;
}

.phone-status-bar {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #1e293b;
}

.dispatch-alert-card {
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  border: 2px solid #fde047;
  border-radius: 14px;
  padding: 13px;
}

.timer-ring {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.countdown-badge {
  background: var(--red);
  color: #fff;
  font-weight: 900;
  font-size: 0.85rem;
  padding: 4px 10px;
  border-radius: 999px;
}

.alert-route-box {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 10px;
  font-size: 0.8rem;
}

.alert-route-box p {
  margin-bottom: 4px;
}

.alert-financials {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 12px;
  text-align: center;
}

.fin-box {
  background: #090d16;
  padding: 6px 4px;
  border-radius: 8px;
  border: 1px solid #334155;
}

.fin-box small {
  display: block;
  font-size: 0.66rem;
  color: var(--text-muted);
}

.fin-box strong {
  font-size: 0.82rem;
  color: #fff;
}

.driver-decision-btns {
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  gap: 8px;
}

.btn-accept-trip {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff;
  border: none;
  padding: 11px 8px;
  border-radius: 10px;
  font-family: inherit;
  font-weight: 900;
  font-size: 0.84rem;
  cursor: pointer;
}

.btn-skip-trip {
  background: #334155;
  color: #cbd5e1;
  border: none;
  padding: 11px 8px;
  border-radius: 10px;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.78rem;
  cursor: pointer;
}

.activity-log-box {
  background: var(--card-bg);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 12px;
  max-height: 210px;
  overflow-y: auto;
  font-size: 0.76rem;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.log-entry {
  padding-bottom: 6px;
  border-bottom: 1px dashed #1e293b;
  color: #cbd5e1;
}

.log-entry strong {
  color: #34d399;
}

/* ==========================================
   3. ADMIN DATA TABLES (TABS 2 & 3)
   ========================================== */
.admin-table-card {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 20px;
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.84rem;
}

.admin-table th {
  background: var(--card-bg);
  color: var(--text-muted);
  padding: 12px 14px;
  font-size: 0.76rem;
  text-transform: uppercase;
  border-bottom: 1px solid var(--panel-border);
}

.admin-table td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  color: #e2e8f0;
}

.status-pill {
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
}

.status-pill.done {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
}

.status-pill.refund {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

@media (max-width: 1180px) {
  .dashboard-layout {
    grid-template-columns: 1fr;
  }
  .db-sidebar {
    height: auto;
    position: relative;
  }
  .kpi-strip {
    grid-template-columns: repeat(2, 1fr);
  }
  .dp-workspace {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .kpi-strip {
    grid-template-columns: 1fr;
  }
}
