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

:root {
  --bg:       #0f1117;
  --surface:  #1a1d27;
  --border:   #2a2d3a;
  --text:     #e8eaf0;
  --text-dim: #8b90a8;
  --muted:    #8b90a8;
  --accent:   #f5a623;
  --accent2:  #4eff8a;
  --danger:   #ff5252;
  --success:  #4eff8a;
  --radius:   10px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ────────────────────────────────────────────────────────── */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}
.site-header nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
}
.site-header nav a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
}
.site-header nav a:hover { color: var(--text); background: var(--border); }

/* ── Admin subnav ──────────────────────────────────────────────────── */
.admin-subnav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  overflow-x: auto;
}
.admin-subnav-inner {
  display: flex;
  max-width: 1200px;
  margin: 0 auto;
}
.admin-subnav a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.6rem 1rem;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
  display: block;
}
.admin-subnav a:hover { color: var(--text); }
.admin-subnav a.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ── Main ──────────────────────────────────────────────────────────── */
main {
  flex: 1;
  padding: 2rem 1.5rem;
  max-width: 680px;
  margin: 0 auto;
  width: 100%;
}
main.main-wide { max-width: 1200px; }

/* ── Footer ────────────────────────────────────────────────────────── */
.site-footer {
  text-align: center;
  padding: 1rem;
  color: var(--text-dim);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
}

/* ── Buttons ───────────────────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: 0.75rem 1.75rem;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: opacity 0.15s;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary   { background: var(--accent); color: #000; }
.btn-primary:hover:not(:disabled) { opacity: 0.88; }
.btn-outline   { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: var(--surface); }
.btn-small     { padding: 0.35rem 0.8rem; font-size: 0.82rem; border-radius: 6px; }
.btn-danger    { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: 0.85; }
.btn-success   { background: #2e7d32; color: #fff; }
.btn-success:hover { opacity: 0.85; }
.btn-muted     { background: var(--border); color: var(--text-dim); }

/* ── Forms ─────────────────────────────────────────────────────────── */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="password"],
input[type="date"],
select,
textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 0.45rem 0.65rem;
  font-size: 0.95rem;
  width: 100%;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
}
textarea { resize: vertical; min-height: 80px; }
label { display: block; font-size: 0.85rem; color: var(--text-dim); margin-bottom: 0.25rem; }

.form-row { margin-bottom: 0.85rem; }
.form-row label { font-size: 0.85rem; color: var(--text-dim); margin-bottom: 0.3rem; display: block; }
.form-inline {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
  flex-wrap: wrap;
}
.form-inline .form-row { margin-bottom: 0; }

/* ── Cards ─────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.card h2 { font-size: 1rem; margin-bottom: 1rem; }
.card h3 { font-size: 0.95rem; margin-bottom: 0.75rem; }

/* ── KPI tiles ─────────────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.kpi-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
}
.kpi-value {
  font-size: 2.25rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 0.35rem;
}
.kpi-label {
  font-size: 0.8rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.kpi-tile.accent  .kpi-value { color: var(--accent); }
.kpi-tile.success .kpi-value { color: var(--accent2); }
.kpi-tile.danger  .kpi-value { color: var(--danger); }

/* ── Data tables ───────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.data-table {
  width: 100%; border-collapse: collapse; font-size: 0.9rem;
}
.data-table th {
  text-align: left; padding: 0.45rem 0.75rem;
  border-bottom: 2px solid var(--border); color: var(--text-dim);
  font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em;
  white-space: nowrap;
}
.data-table td {
  padding: 0.55rem 0.75rem; border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(255,255,255,0.02); }

/* ── Badges ────────────────────────────────────────────────────────── */
.badge {
  font-size: 0.72rem; padding: 0.2rem 0.55rem; border-radius: 99px;
  font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em;
  white-space: nowrap;
}
.badge-available  { background: #1b5e20; color: #a5d6a7; }
.badge-busy       { background: #bf360c; color: #ffccbc; }
.badge-offline    { background: #37474f; color: #90a4ae; }
.badge-requested  { background: #1565c0; color: #90caf9; }
.badge-dispatched { background: #6a1b9a; color: #ce93d8; }
.badge-in_progress { background: #e65100; color: #ffcc80; }
.badge-completed  { background: #1b5e20; color: #a5d6a7; }
.badge-cancelled  { background: #37474f; color: #90a4ae; }
.badge-active     { background: #1b5e20; color: #a5d6a7; }
.badge-inactive   { background: #37474f; color: #90a4ae; }

/* ── Admin page ────────────────────────────────────────────────────── */
.admin-page h1 {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.admin-section {
  margin-bottom: 2.5rem;
}
.admin-section h2 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-dim);
}

/* ── Section header with action ────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.section-header h2 { margin-bottom: 0; border-bottom: none; padding-bottom: 0; }

/* ── Item rows ─────────────────────────────────────────────────────── */
.item-row {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.6rem 1rem; margin-bottom: 0.5rem;
  flex-wrap: wrap; gap: 0.5rem;
}

/* ── Filter bar ────────────────────────────────────────────────────── */
.filter-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: flex-end;
}
.filter-bar .form-row { margin-bottom: 0; min-width: 140px; }

/* ── Portal pages (driver / rider) ─────────────────────────────────── */
.portal-page {
  max-width: 520px;
  margin: 0 auto;
}
.portal-page h1 { font-size: 1.4rem; margin-bottom: 1.5rem; }

/* ── Login cards ───────────────────────────────────────────────────── */
.login-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 2.5rem 2rem;
  width: 100%; max-width: 380px; text-align: center; margin: 0 auto;
}
.login-card .logo { font-size: 3rem; display: block; margin-bottom: 0.5rem; }
.login-card h1 { font-size: 1.4rem; margin: 0 0 0.25rem; }
.login-card p.sub { color: var(--muted); font-size: 0.9rem; margin: 0 0 1.5rem; }
.error-msg {
  background: #3d1a1a; border: 1px solid #7a2a2a; color: #f88;
  border-radius: 6px; padding: 0.6rem 0.9rem;
  font-size: 0.88rem; margin-bottom: 1.25rem;
}
.success-msg {
  background: #1a3d1a; border: 1px solid #2a7a2a; color: #8f8;
  border-radius: 6px; padding: 0.6rem 0.9rem;
  font-size: 0.88rem; margin-bottom: 1.25rem;
}

/* ── Google button ─────────────────────────────────────────────────── */
.google-btn {
  display: inline-flex; align-items: center; gap: 0.6rem;
  background: #fff; color: #333; border: 1px solid #ddd;
  border-radius: 6px; padding: 0.7rem 1.4rem;
  font-size: 0.95rem; font-weight: 600; text-decoration: none;
  transition: box-shadow 0.15s;
}
.google-btn:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.25); }
.google-btn svg { flex-shrink: 0; }

/* ── Hero (index) ──────────────────────────────────────────────────── */
.hero { text-align: center; padding: 4rem 1rem; }
.hero h1 { font-size: 2.25rem; margin-bottom: 0.75rem; }
.hero-sub { color: var(--text-dim); margin-bottom: 2rem; font-size: 1.05rem; }

/* ── Ride page ─────────────────────────────────────────────────────── */
.ride-page { padding-top: 2rem; text-align: center; }
.ride-page h1 { font-size: 1.75rem; margin-bottom: 1rem; }
.pickup-address { font-size: 1.1rem; margin-bottom: 1.5rem; }
.muted { color: var(--text-dim); }

.spinner {
  width: 48px; height: 48px;
  border: 4px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 1.5rem auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.driver-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin: 1.5rem auto;
  max-width: 320px;
  text-align: left;
  line-height: 2;
}

/* ── Driver page ───────────────────────────────────────────────────── */
.driver-page h1 { font-size: 1.75rem; margin-bottom: 1.25rem; }
.driver-page h2 { font-size: 1.15rem; margin: 1.5rem 0 0.75rem; color: var(--text-dim); }

.driver-controls {
  display: flex; align-items: center; gap: 0.75rem;
  flex-wrap: wrap; margin-bottom: 1rem;
}
.driver-controls label { color: var(--text-dim); font-size: 0.9rem; }
.driver-controls input {
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); border-radius: 6px; padding: 0.3rem 0.5rem;
}

.ride-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem 1.25rem; margin-bottom: 0.75rem;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 0.5rem;
}
.ride-card p { margin-bottom: 0.25rem; }
