/* ═══════════════════════════════════════════════════════════
   DRIVERGUARD — Responsive Stylesheet (All Devices)
   Breakpoints:
     xs  : < 360px   (small phones)
     sm  : 360–479px (phones)
     md  : 480–767px (large phones / small tablets)
     lg  : 768–1023px (tablets / landscape phones)
     xl  : 1024–1279px (small laptops)
     2xl : ≥ 1280px  (desktops)
   ═══════════════════════════════════════════════════════════ */

/* ── CSS CUSTOM PROPERTIES ─────────────────────────────── */
:root {
  --primary: #3b5bdb;
  --primary-dark: #2f4ac0;
  --primary-light: #e8edff;
  --accent: #f03e3e;
  --success: #2f9e44;
  --warning: #e67700;
  --info: #1098ad;

  --bg: #f4f6fb;
  --card-bg: #ffffff;
  --sidebar-bg: #1a1f36;
  --sidebar-text: #a8b5d1;
  --sidebar-active: #3b5bdb;

  --text: #1a1f36;
  --text-muted: #6b7280;
  --border: #e2e8f0;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 2px 12px rgba(0,0,0,.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.12);

  /* Layout dimensions — overridden per breakpoint */
  --sidebar-w: 240px;
  --topbar-h: 60px;

  /* Spacing scale */
  --space-xs: 8px;
  --space-sm: 12px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* Font scale */
  --text-xs: 11px;
  --text-sm: 12px;
  --text-base: 14px;
  --text-md: 15px;
  --text-lg: 18px;
  --text-xl: 24px;
  --text-2xl: 32px;
  --text-3xl: 48px;
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: var(--text-base);
  line-height: 1.5;
  overflow-x: hidden;
}

img, video { max-width: 100%; height: auto; display: block; }

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

.hidden { display: none !important; }

/* ═══════════════════════════════════════════════════════════
   AUTH PAGE
   ═══════════════════════════════════════════════════════════ */
.auth-page {
  min-height: 100vh;
  min-height: 100dvh; /* dynamic viewport for mobile browsers */
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #1a1f36 0%, #2d3561 100%);
  padding: var(--space-md);
}

.auth-bg { position: absolute; inset: 0; overflow: hidden; }
.auth-shapes .shape {
  position: absolute;
  border-radius: 50%;
  opacity: .08;
  background: white;
  animation: float 6s ease-in-out infinite;
}
.shape.s1 { width: 400px; height: 400px; top: -100px; right: -100px; animation-delay: 0s; }
.shape.s2 { width: 250px; height: 250px; bottom: -50px; left: -50px; animation-delay: 2s; }
.shape.s3 { width: 180px; height: 180px; top: 50%; left: 40%; animation-delay: 4s; }

@keyframes float {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-20px) scale(1.05); }
}

.auth-card {
  background: white;
  border-radius: 20px;
  padding: 40px;
  width: 420px;
  max-width: 100%;
  max-height: 95vh;
  max-height: 95dvh;
  overflow-y: auto;
  box-shadow: 0 24px 64px rgba(0,0,0,.4);
  position: relative;
  z-index: 10;
}

.auth-logo {
  text-align: center;
  margin-bottom: 28px;
}
.auth-logo .logo-icon { font-size: 48px; display: block; margin-bottom: 8px; }
.auth-logo h1 { font-size: 24px; font-weight: 800; color: var(--primary); }
.auth-logo p { color: var(--text-muted); font-size: 13px; margin-top: 4px; }

.auth-tabs {
  display: flex;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 24px;
}
.tab-btn {
  flex: 1;
  padding: 8px;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  font-size: 13px;
  color: var(--text-muted);
  transition: all .2s;
  touch-action: manipulation;
}
.tab-btn.active {
  background: white;
  color: var(--primary);
  box-shadow: var(--shadow);
}

.auth-form { display: flex; flex-direction: column; gap: var(--space-md); }
.auth-hint {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
}
.auth-error {
  background: #fff5f5;
  border: 1px solid #fca5a5;
  color: #dc2626;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
}
.auth-success {
  background: #f0fff4;
  border: 1px solid #86efac;
  color: #16a34a;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
}

/* ═══════════════════════════════════════════════════════════
   SIDEBAR
   ═══════════════════════════════════════════════════════════ */
.sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform .3s ease, width .3s ease;
  will-change: transform;
}

/* Mobile overlay backdrop */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 99;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.sidebar.open ~ .sidebar-backdrop,
.sidebar-backdrop.active { display: block; }

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}
.sidebar-logo .logo-icon { font-size: 24px; flex-shrink: 0; }
.sidebar-logo .logo-text { font-weight: 700; font-size: 16px; color: white; white-space: nowrap; overflow: hidden; }

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: var(--sidebar-text);
  text-decoration: none;
  transition: all .2s;
  font-weight: 500;
  font-size: 13.5px;
  cursor: pointer;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: white; }
.nav-item.active {
  background: var(--primary);
  color: white;
  margin: 0 8px;
  border-radius: var(--radius-sm);
  padding: 12px 12px;
}
.nav-icon { font-size: 18px; width: 22px; text-align: center; flex-shrink: 0; }
.nav-label { overflow: hidden; text-overflow: ellipsis; }

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
  min-width: 0;
}
.user-avatar {
  width: 36px; height: 36px;
  background: var(--primary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 14px;
  flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name {
  color: white; font-weight: 600; font-size: 13px;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.user-role { color: var(--sidebar-text); font-size: 11px; text-transform: capitalize; }
.logout-btn {
  background: none; border: none; color: var(--sidebar-text);
  cursor: pointer; font-size: 18px; padding: 4px;
  transition: color .2s;
  flex-shrink: 0;
  touch-action: manipulation;
}
.logout-btn:hover { color: var(--accent); }

/* ═══════════════════════════════════════════════════════════
   TOPBAR
   ═══════════════════════════════════════════════════════════ */
.topbar {
  position: fixed;
  top: 0; left: var(--sidebar-w); right: 0;
  height: var(--topbar-h);
  background: white;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 0 24px;
  z-index: 90;
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
  transition: left .3s ease;
}
.menu-toggle {
  display: none;
  background: none; border: none;
  font-size: 20px; cursor: pointer; color: var(--text);
  padding: 4px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.page-title {
  font-size: var(--text-lg);
  font-weight: 700; color: var(--text);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.notif-badge {
  font-size: 20px; cursor: pointer;
  touch-action: manipulation;
}

/* ═══════════════════════════════════════════════════════════
   MAIN CONTENT
   ═══════════════════════════════════════════════════════════ */
.main-content {
  margin-left: var(--sidebar-w);
  padding-top: var(--topbar-h);
  min-height: 100vh;
  min-height: 100dvh;
  transition: margin-left .3s ease;
}

.page-content {
  padding: var(--space-lg);
  animation: fadeIn .25s ease;
}

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

/* ═══════════════════════════════════════════════════════════
   CARDS
   ═══════════════════════════════════════════════════════════ */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  padding: var(--space-md) 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-xs);
}
.card-header h3 { font-size: var(--text-md); font-weight: 600; }

/* ═══════════════════════════════════════════════════════════
   STATS GRID
   ═══════════════════════════════════════════════════════════ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-lg);
  margin-bottom: var(--space-lg);
}

.stat-card {
  background: white;
  border-radius: var(--radius);
  padding: var(--space-lg);
  display: flex;
  align-items: center;
  gap: 20px;
  box-shadow: var(--shadow);
  border-left: 4px solid transparent;
  transition: transform .2s, box-shadow .2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-card.blue { border-left-color: var(--primary); }
.stat-card.red { border-left-color: var(--accent); }
.stat-card.green { border-left-color: var(--success); }
.stat-card.yellow { border-left-color: var(--warning); }
.stat-card.purple { border-left-color: #8b5cf6; }
.stat-card.teal { border-left-color: #06b6d4; }

.stat-icon { font-size: 32px; color: var(--text-muted); flex-shrink: 0; }
.stat-info { flex: 1; min-width: 0; }
.stat-value {
  font-size: 32px;
  font-weight: 800;
  color: var(--text);
  display: block;
  margin-bottom: 4px;
  line-height: 1;
}
.stat-label { font-size: var(--text-base); color: var(--text-muted); font-weight: 500; }

/* ═══════════════════════════════════════════════════════════
   DASHBOARD GRID
   ═══════════════════════════════════════════════════════════ */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--space-md);
}

/* ═══════════════════════════════════════════════════════════
   TOP DRIVERS
   ═══════════════════════════════════════════════════════════ */
.top-drivers-list { padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.top-driver-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  transition: background .2s;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.top-driver-item:hover { background: var(--primary-light); }
.top-driver-rank {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.top-driver-rank.gold { background: #f59e0b; }
.top-driver-rank.silver { background: #94a3b8; }
.top-driver-rank.bronze { background: #b45309; }
.top-driver-name { flex: 1; font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-driver-score { font-weight: 700; color: var(--warning); flex-shrink: 0; }

/* ═══════════════════════════════════════════════════════════
   VIOLATIONS
   ═══════════════════════════════════════════════════════════ */
.violation-list { padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.violation-item {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border-left: 3px solid;
  background: var(--bg);
  font-size: 13px;
}
.violation-item.minor { border-left-color: #94a3b8; }
.violation-item.moderate { border-left-color: var(--warning); }
.violation-item.severe { border-left-color: var(--accent); }
.violation-item.critical { border-left-color: #7c3aed; background: #faf5ff; }
.violation-driver { font-weight: 600; }
.violation-meta { color: var(--text-muted); font-size: 12px; margin-top: 2px; }

/* ═══════════════════════════════════════════════════════════
   SEVERITY CHART
   ═══════════════════════════════════════════════════════════ */
.severity-chart { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.severity-bar-label {
  display: flex; justify-content: space-between;
  font-size: 12px; font-weight: 500; margin-bottom: 4px;
}
.severity-bar-track {
  height: 8px; background: var(--border); border-radius: 99px; overflow: hidden;
}
.severity-bar-fill {
  height: 100%; border-radius: 99px;
  transition: width .6s ease;
}
.sev-minor .severity-bar-fill { background: #94a3b8; }
.sev-moderate .severity-bar-fill { background: var(--warning); }
.sev-severe .severity-bar-fill { background: var(--accent); }
.sev-critical .severity-bar-fill { background: #7c3aed; }

/* ═══════════════════════════════════════════════════════════
   TOOLBAR
   ═══════════════════════════════════════════════════════════ */
.page-toolbar {
  display: flex; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; align-items: center;
}
.search-input {
  flex: 1; min-width: 200px;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--text-base);
  outline: none;
  transition: border-color .2s;
  /* Prevent iOS zoom on focus (must be ≥16px on mobile) */
}
.search-input:focus { border-color: var(--primary); }
.filter-select {
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--text-base);
  outline: none;
  background: white;
  cursor: pointer;
  max-width: 100%;
}

/* ═══════════════════════════════════════════════════════════
   DRIVERS GRID
   ═══════════════════════════════════════════════════════════ */
.drivers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-md);
}

.driver-card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  cursor: pointer;
  transition: transform .2s, box-shadow .2s;
  border: 2px solid transparent;
  touch-action: manipulation;
}
.driver-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-light);
}
.driver-card-header {
  display: flex; align-items: center; gap: 12px; margin-bottom: 14px;
}
.btn-edit-card {
  margin-left: auto;
  padding: 6px 8px;
  border: none;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: var(--radius-sm);
  font-size: 14px;
  cursor: pointer;
  transition: all .2s;
  opacity: 0.7;
  flex-shrink: 0;
  touch-action: manipulation;
}
.btn-edit-card:hover { background: var(--primary); color: white; opacity: 1; }

.driver-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #6366f1);
  color: white;
  font-weight: 700; font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.driver-name { font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.driver-nik { color: var(--text-muted); font-size: 12px; font-family: monospace; }

.driver-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11px; font-weight: 600;
}
.badge-blue { background: var(--primary-light); color: var(--primary); }
.badge-red { background: #fff0f0; color: var(--accent); }
.badge-green { background: #f0fff4; color: var(--success); }
.badge-gray { background: var(--bg); color: var(--text-muted); }
.badge-orange { background: #fff7ed; color: var(--warning); }
.badge-purple { background: #faf5ff; color: #7c3aed; }

.driver-stats {
  display: flex; gap: 12px; align-items: center;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 12px; color: var(--text-muted);
  flex-wrap: wrap;
}
.driver-stat { display: flex; align-items: center; gap: 4px; }
.driver-rating { font-weight: 700; color: var(--warning); font-size: 14px; }

/* ═══════════════════════════════════════════════════════════
   TABLE
   ═══════════════════════════════════════════════════════════ */
.table-wrapper {
  background: white; border-radius: var(--radius); box-shadow: var(--shadow);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.data-table { width: 100%; border-collapse: collapse; min-width: 600px; }
.data-table th {
  background: var(--bg);
  padding: 12px 16px;
  text-align: left;
  font-size: 12px; font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .5px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg); }

/* ═══════════════════════════════════════════════════════════
   SEVERITY BADGES
   ═══════════════════════════════════════════════════════════ */
.sev-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11px; font-weight: 700;
  white-space: nowrap;
}
.sev-badge.minor { background: #f1f5f9; color: #64748b; }
.sev-badge.moderate { background: #fff7ed; color: #ea580c; }
.sev-badge.severe { background: #fff0f0; color: #dc2626; }
.sev-badge.critical { background: #faf5ff; color: #7c3aed; }

/* ═══════════════════════════════════════════════════════════
   BACKGROUND CHECK
   ═══════════════════════════════════════════════════════════ */
.bg-check-hero {
  text-align: center;
  padding: 32px 20px 24px;
  margin-bottom: 24px;
}
.bg-check-hero h2 { font-size: var(--text-xl); font-weight: 800; margin-bottom: 8px; }
.bg-check-hero p { color: var(--text-muted); max-width: 500px; margin: 0 auto; }

.bg-search-box { padding: 24px; margin-bottom: 24px; }
.bg-search-row {
  display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap;
}
.bg-search-row .form-group { flex: 1; min-width: 180px; }
.bg-or {
  color: var(--text-muted); font-weight: 600; padding-bottom: 10px; flex-shrink: 0;
}

.bg-result-card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  overflow: hidden;
}
.bg-result-header {
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.bg-result-body { padding: 24px; }

.rec-badge {
  display: inline-block;
  padding: 6px 16px;
  border-radius: 99px;
  font-weight: 700; font-size: 14px;
  margin-left: auto;
  white-space: nowrap;
}
.rec-excellent { background: #f0fff4; color: var(--success); border: 2px solid var(--success); }
.rec-good { background: #f0fff4; color: #16a34a; border: 2px solid #86efac; }
.rec-fair { background: #fff7ed; color: var(--warning); border: 2px solid #fbbf24; }
.rec-poor { background: #fff0f0; color: var(--accent); border: 2px solid #fca5a5; }
.rec-blacklist { background: #faf5ff; color: #7c3aed; border: 2px solid #c084fc; }

.bg-sections { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

.bg-section-title {
  font-size: 13px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px;
  color: var(--text-muted); margin-bottom: 10px;
}

.risk-meter { margin: 8px 0 16px; }
.risk-track {
  height: 12px; background: var(--border); border-radius: 99px; overflow: hidden; margin-top: 6px;
}
.risk-fill {
  height: 100%; border-radius: 99px;
  background: linear-gradient(to right, var(--success), var(--warning), var(--accent));
  transition: width .6s ease;
}

/* ═══════════════════════════════════════════════════════════
   FORMS
   ═══════════════════════════════════════════════════════════ */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  transition: color .3s ease;
}
.form-group input,
.form-group select,
.form-group textarea {
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 16px; /* ≥16px prevents iOS auto-zoom */
  outline: none;
  transition: all .3s ease;
  background: white;
  color: var(--text);
  resize: vertical;
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  position: relative;
}
.form-group select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}
.form-group input:hover,
.form-group select:hover,
.form-group textarea:hover {
  border-color: var(--primary-light);
  transform: translateY(-0.5px);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
  transform: translateY(-1px);
}

.form-group:focus-within label {
  color: var(--primary);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 16px;
}
.form-grid .full { grid-column: 1 / -1; }

/* ═══════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════ */
.btn-primary {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  font-size: var(--text-base);
  font-weight: 600;
  cursor: pointer;
  transition: background .2s, transform .1s;
  white-space: nowrap;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  /* Min touch target 44px */
  min-height: 44px;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:active { transform: scale(.98); }
.btn-full { width: 100%; padding: 12px; font-size: 15px; }

.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: all .2s;
  touch-action: manipulation;
  min-height: 32px;
}
.btn-view { background: var(--primary-light); color: var(--primary); }
.btn-rate { background: #fff7ed; color: var(--warning); }
.btn-danger { background: #fff0f0; color: var(--accent); }
.btn-view:hover { background: var(--primary); color: white; }
.btn-rate:hover { background: var(--warning); color: white; }
.btn-danger:hover { background: var(--accent); color: white; }

.doc-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.doc-link:hover {
  text-decoration: underline;
}

.file-input-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: white;
  transition: all .3s ease;
}

.file-input-wrapper:hover {
  border-color: var(--primary-light);
  transform: translateY(-0.5px);
}

.file-input-btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all .3s ease;
}

.file-input-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.file-name {
  font-size: 14px;
  color: var(--text-muted);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ═══════════════════════════════════════════════════════════
   MODALS
   ═══════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  padding: var(--space-md);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fadeIn .2s ease;
  overscroll-behavior: contain;
}
.modal {
  background: white;
  border-radius: var(--radius);
  width: 500px;
  max-width: 100%;
  max-height: 90vh;
  max-height: 90dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: 0 24px 64px rgba(0,0,0,.3);
}
.modal-lg { width: 780px; }

.modal-xl { width: 900px; }

.modal-xxl { width: 98vw; max-width: none; }

.modal-xxl .modal-body { padding: 16px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: white; z-index: 10;
  gap: var(--space-sm);
}
.modal-header h3 { font-size: 16px; font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-close {
  background: none; border: none;
  font-size: 20px; cursor: pointer; color: var(--text-muted);
  line-height: 1; padding: 4px 8px; border-radius: 6px;
  transition: all .2s;
  flex-shrink: 0;
  min-width: 36px; min-height: 36px;
  display: flex; align-items: center; justify-content: center;
  touch-action: manipulation;
}
.modal-close:hover { background: var(--bg); color: var(--accent); }
.modal-body { padding: 24px; }

/* ═══════════════════════════════════════════════════════════
   DRIVER DETAIL
   ═══════════════════════════════════════════════════════════ */
.driver-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}
.detail-section { margin-bottom: 20px; }
.detail-section-title {
  font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px;
  color: var(--text-muted); margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.detail-row { display: flex; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.detail-label { font-size: 12px; color: var(--text-muted); width: 120px; flex-shrink: 0; }
.detail-value { font-size: 13px; font-weight: 500; flex: 1; min-width: 0; word-break: break-word; }

.stats-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 12px; margin-bottom: 20px;
}
.stat-mini {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: center;
}
.stat-mini-val { font-size: 22px; font-weight: 800; }
.stat-mini-label { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ═══════════════════════════════════════════════════════════
   STAR RATING
   ═══════════════════════════════════════════════════════════ */
.star-rating { display: flex; gap: 4px; margin: 8px 0; flex-wrap: wrap; }
.star {
  font-size: 28px;
  color: var(--border);
  cursor: pointer;
  transition: color .15s, transform .15s;
  touch-action: manipulation;
}
.star.active, .star:hover { color: #f59e0b; }
.star:hover { transform: scale(1.1); }

.rating-driver-info {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 16px;
  font-weight: 600;
}

/* ═══════════════════════════════════════════════════════════
   TOAST
   ═══════════════════════════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: 24px; right: 24px;
  background: #1a1f36;
  color: white;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500;
  z-index: 9999;
  box-shadow: var(--shadow-lg);
  animation: slideUp .3s ease;
  max-width: calc(100vw - 48px);
}
@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.toast.success { background: var(--success); }
.toast.error { background: var(--accent); }

/* ═══════════════════════════════════════════════════════════
   EMPTY STATE
   ═══════════════════════════════════════════════════════════ */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* ═══════════════════════════════════════════════════════════
   HISTORY ITEM
   ═══════════════════════════════════════════════════════════ */
.history-item {
  display: flex; gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.history-item:last-child { border-bottom: none; }
.history-timeline {
  width: 4px; background: var(--primary-light); border-radius: 99px; flex-shrink: 0;
}
.history-content { flex: 1; min-width: 0; }
.history-company { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ═══════════════════════════════════════════════════════════
   LOADING
   ═══════════════════════════════════════════════════════════ */
.spinner {
  display: inline-block;
  width: 20px; height: 20px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-center { display: flex; justify-content: center; padding: 40px; }

/* ═══════════════════════════════════════════════════════════
   PHOTO / AVATAR
   ═══════════════════════════════════════════════════════════ */
.photo-preview {
  margin-top: 8px;
  max-width: 200px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}
.photo-preview img { width: 100%; height: auto; display: block; }
.driver-avatar-img {
  width: 40px; height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
}

/* ═══════════════════════════════════════════════════════════
   ADMIN PANEL
   ═══════════════════════════════════════════════════════════ */
.admin-tabs {
  display: flex;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-top: 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  gap: 2px;
}
.admin-tabs::-webkit-scrollbar { display: none; }
.admin-tabs .tab-btn {
  flex: 1;
  min-width: max-content;
  padding: 8px 16px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
  touch-action: manipulation;
}
.admin-tabs .tab-btn.active { background: var(--primary); color: white; }
.admin-section { margin-top: 20px; }
.admin-charts { margin-top: 20px; }
.chart-bars {
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 8px;
  height: 120px;
  margin-top: 20px;
  flex-wrap: wrap;
}
.bar {
  width: 40px;
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-light) 100%);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.landing-editor { padding: 20px; }
.editor-section {
  margin-bottom: 24px;
  padding: 20px;
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.editor-section h4 { margin-bottom: 16px; color: var(--primary); font-weight: 600; }
.form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

/* ═══════════════════════════════════════════════════════════
   LANDING PAGE
   ═══════════════════════════════════════════════════════════ */
.landing-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 1000;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}
.landing-nav {
  max-width: 1200px; margin: 0 auto;
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 20px;
  gap: var(--space-md);
}
.nav-logo { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.nav-logo .logo-icon { font-size: 24px; }
.nav-logo .logo-text { font-weight: 700; color: var(--primary); }

.hero {
  min-height: 100vh;
  min-height: 100dvh;
  padding: 120px 20px 80px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  text-align: center;
}
.hero .container { display: flex; flex-direction: column; align-items: center; }
.hero-badge {
  background: rgba(255,255,255,0.2);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px; font-weight: 600;
  margin-bottom: 24px;
}
.hero-content { max-width: 800px; margin-bottom: 40px; }
.hero h1 { font-size: var(--text-3xl); font-weight: 800; margin-bottom: 16px; line-height: 1.2; }
.hero p { font-size: 18px; margin-bottom: 32px; opacity: 0.9; }
.hero-buttons { display: flex; gap: 16px; margin-bottom: 40px; flex-wrap: wrap; justify-content: center; }
.btn-large { padding: 16px 32px; font-size: 16px; }
.btn-secondary { background: transparent; border: 2px solid white; color: white; }
.btn-secondary:hover { background: white; color: var(--primary); }

.hero-image { width: 100%; display: flex; justify-content: center; }
.hero-placeholder {
  background: rgba(255,255,255,0.1);
  border-radius: 20px;
  padding: 60px;
  text-align: center;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  max-width: 400px;
  width: 100%;
}
.hero-placeholder span { font-size: 64px; display: block; margin-bottom: 16px; }
.hero-placeholder p { font-size: 18px; opacity: 0.9; }

.stats-bar {
  padding: 40px 20px;
  background: white;
  border-bottom: 1px solid var(--border);
}
.stats-bar .stats-grid {
  display: flex; justify-content: center; gap: 64px;
  max-width: 1200px; margin: 0 auto;
  flex-wrap: wrap;
}
.stat-item { text-align: center; }
.stat-number { font-size: 32px; font-weight: 700; color: var(--primary); }
.stat-item .stat-label { font-size: 14px; color: var(--text-muted); margin-top: 4px; }

.partners { padding: 60px 20px; background: var(--bg); }
.partners h2 {
  text-align: center; font-size: 28px; font-weight: 700; margin-bottom: 40px; color: var(--text);
}
.partners-logos {
  display: flex; justify-content: center; gap: 40px; flex-wrap: wrap;
  max-width: 1200px; margin: 0 auto;
}
.partner-logo {
  background: white; padding: 20px 30px; border-radius: 8px;
  box-shadow: var(--shadow); font-weight: 600; color: var(--text-muted);
}

.features { padding: 80px 20px; background: var(--bg); }
.container { max-width: 1200px; margin: 0 auto; }
.features h2 {
  text-align: center; font-size: 32px; font-weight: 700; margin-bottom: 48px; color: var(--text);
}
.features-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 32px;
}
.feature-card {
  background: white; padding: 32px; border-radius: var(--radius); box-shadow: var(--shadow);
  text-align: center; transition: transform 0.2s;
}
.feature-card:hover { transform: translateY(-4px); }
.feature-icon { font-size: 48px; margin-bottom: 16px; }
.feature-card h3 { font-size: 20px; font-weight: 600; margin-bottom: 12px; }
.feature-card p { color: var(--text-muted); line-height: 1.6; }

.how-it-works { padding: 80px 20px; background: white; }
.how-it-works h2 {
  text-align: center; font-size: 32px; font-weight: 700; margin-bottom: 48px; color: var(--text);
}
.steps { display: flex; justify-content: center; gap: 32px; flex-wrap: wrap; }
.step {
  background: var(--bg); padding: 32px; border-radius: var(--radius); text-align: center;
  max-width: 250px; box-shadow: var(--shadow); flex: 1; min-width: 200px;
}
.step-number {
  width: 60px; height: 60px; background: var(--primary); color: white;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 700; margin: 0 auto 16px;
  flex-shrink: 0;
}
.step h3 { font-size: 20px; font-weight: 600; margin-bottom: 12px; }
.step p { color: var(--text-muted); line-height: 1.6; }

.testimonials { padding: 80px 20px; background: var(--bg); }
.testimonials h2 {
  text-align: center; font-size: 32px; font-weight: 700; margin-bottom: 48px; color: var(--text);
}
.testimonials-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 32px;
}
.testimonial-card { background: white; padding: 32px; border-radius: var(--radius); box-shadow: var(--shadow); }
.testimonial-quote {
  font-style: italic; font-size: 16px; line-height: 1.6; margin-bottom: 20px;
  position: relative; padding-top: 24px;
}
.testimonial-quote:before {
  content: '"'; font-size: 48px; color: var(--primary);
  position: absolute; top: -12px; left: -4px; line-height: 1;
}
.testimonial-author { border-top: 1px solid var(--border); padding-top: 16px; }
.author-name { font-weight: 600; }
.author-role { font-size: 14px; color: var(--text-muted); margin-top: 4px; }

.pricing { padding: 80px 20px; background: white; }
.pricing h2 {
  text-align: center; font-size: 32px; font-weight: 700; margin-bottom: 48px; color: var(--text);
}
.pricing-grid {
  display: flex; justify-content: center; gap: 32px; flex-wrap: wrap;
}
.pricing-card {
  background: white; padding: 40px; border-radius: var(--radius); box-shadow: var(--shadow);
  text-align: center; border: 2px solid transparent; position: relative;
  max-width: 300px; width: 100%;
}
.pricing-card.featured { border-color: var(--primary); }
.pricing-card h3 { font-size: 24px; font-weight: 700; margin-bottom: 8px; }
.price { font-size: 32px; font-weight: 800; color: var(--primary); margin-bottom: 4px; }
.pricing-card > p { color: var(--text-muted); margin-bottom: 24px; }
.pricing-card ul { list-style: none; padding: 0; margin-bottom: 32px; text-align: left; }
.pricing-card li { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px; }

.cta { padding: 80px 20px; background: var(--primary); color: white; text-align: center; }
.cta h2 { font-size: 32px; font-weight: 700; margin-bottom: 16px; }
.cta p { font-size: 18px; margin-bottom: 32px; opacity: 0.9; }

.landing-footer {
  padding: 60px 20px 20px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
}
.footer-content {
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 40px; margin-bottom: 40px;
}
.footer-logo { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.footer-logo .logo-icon { font-size: 24px; }
.footer-logo .logo-text { font-weight: 700; color: white; }
.footer-section h4 { font-size: 16px; font-weight: 600; margin-bottom: 16px; color: white; }
.footer-section ul { list-style: none; padding: 0; }
.footer-section li { margin-bottom: 8px; }
.footer-section a { color: var(--sidebar-text); text-decoration: none; }
.footer-section a:hover { color: white; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.1); padding-top: 20px; text-align: center; }
.footer-bottom p { margin: 0; font-size: 14px; }

/* ═══════════════════════════════════════════════════════════
   ██████████████████  RESPONSIVE BREAKPOINTS  ████████████
   ═══════════════════════════════════════════════════════════ */

/* ── 2XL: 1280px+ (large desktops) ────────────────────── */
@media (min-width: 1280px) {
  :root {
    --sidebar-w: 260px;
  }
  .stats-grid {
    gap: 28px;
  }
  .page-content { padding: 28px; }
}

/* ── XL: 1024–1279px (small laptops) ──────────────────── */
@media (max-width: 1279px) {
  .dashboard-grid { grid-template-columns: 1fr 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
  .footer-content { grid-template-columns: 1fr 1fr; gap: 28px; }
  .pricing-card.featured { transform: none; }
}

/* ── LG: 768–1023px (tablets / landscape phones) ──────── */
@media (max-width: 1023px) {
  :root {
    --sidebar-w: 220px;
  }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .features-grid { grid-template-columns: repeat(2, 1fr); }
  .partners-logos { gap: 20px; }
  .stats-bar .stats-grid { gap: 32px; }
}

/* ── MD: 768px (tablet breakpoint — sidebar collapse) ──── */
@media (max-width: 768px) {
  :root {
    --topbar-h: 56px;
  }

  /* Sidebar off-canvas */
  .sidebar {
    transform: translateX(-100%);
    box-shadow: none;
    width: var(--sidebar-w);
    z-index: 200;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 8px 0 32px rgba(0,0,0,.3);
  }

  /* Main layout */
  .main-content { margin-left: 0; }
  .topbar { left: 0; }
  .menu-toggle { display: flex; align-items: center; justify-content: center; }

  /* Stats */
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
  .stat-card { padding: 16px 14px; gap: 12px; }
  .stat-icon { font-size: 24px; }
  .stat-value { font-size: 24px; }
  .stat-label { font-size: 12px; }

  /* Dashboard */
  .dashboard-grid { grid-template-columns: 1fr; gap: 12px; }

  /* Drivers */
  .drivers-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

  /* BG Check */
  .bg-search-row { flex-direction: column; }
  .bg-or { display: none; }
  .bg-sections { grid-template-columns: 1fr; }
  .bg-result-header { flex-direction: column; align-items: flex-start; }
  .rec-badge { margin-left: 0; }

  /* Forms */
  .form-grid { grid-template-columns: 1fr; }

  /* Footer */
  .footer-content { grid-template-columns: 1fr 1fr; gap: 24px; }

  /* Hero */
  .hero { padding: 100px 16px 60px; }
  .hero h1 { font-size: 32px; }
  .hero p { font-size: 16px; }
  .hero-placeholder { padding: 40px 24px; }
  .hero-placeholder span { font-size: 48px; }

  /* Sections */
  .features { padding: 60px 16px; }
  .how-it-works { padding: 60px 16px; }
  .testimonials { padding: 60px 16px; }
  .pricing { padding: 60px 16px; }
  .cta { padding: 60px 16px; }
  .partners { padding: 40px 16px; }
  .features-grid { grid-template-columns: 1fr; gap: 16px; }
  .testimonials-grid { grid-template-columns: 1fr; gap: 16px; }
  .pricing-grid { flex-direction: column; align-items: center; gap: 16px; }
  .pricing-card { max-width: 100%; }

  /* Modal */
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal {
    border-radius: var(--radius) var(--radius) 0 0;
    max-height: 92vh;
    max-height: 92dvh;
    width: 100%;
  }
  .modal-lg { width: 100%; }

  /* Driver detail */
  .driver-detail-grid { grid-template-columns: 1fr; }

  /* Auth */
  .auth-card { padding: 28px 20px; border-radius: 16px; }
  .auth-logo .logo-icon { font-size: 40px; }
  .auth-logo h1 { font-size: 20px; }
}

/* ── SM: 480–767px (large phones) ─────────────────────── */
@media (max-width: 600px) {
  .bg-check-hero h2 { font-size: 20px; }

  .steps { flex-direction: column; align-items: center; }
  .step { max-width: 100%; }

  .stats-bar .stats-grid { gap: 24px; }
  .stat-number { font-size: 24px; }

  .landing-nav { padding: 0 16px; }
  .hero-buttons { flex-direction: column; align-items: center; gap: 10px; }
  .btn-large { width: 100%; max-width: 320px; text-align: center; }

  .footer-content { grid-template-columns: 1fr; gap: 24px; }

  .page-toolbar { gap: 8px; }
  .search-input { min-width: 100%; }
  .filter-select { width: 100%; }

  .form-actions { flex-direction: column-reverse; }
  .form-actions .btn-primary { width: 100%; }

  .bg-search-row .form-group { min-width: 100%; }

  .admin-tabs .tab-btn { padding: 8px 10px; font-size: 12px; }
}

/* ── XS: < 480px (small phones) ───────────────────────── */
@media (max-width: 479px) {
  :root {
    --topbar-h: 52px;
    --space-lg: 16px;
  }

  .page-content { padding: 12px; }

  .stats-grid { grid-template-columns: 1fr; gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-value { font-size: 22px; }

  .page-title { font-size: 15px; }
  .topbar { padding: 0 12px; }

  .card-header { padding: 12px 14px; }
  .card-header h3 { font-size: 14px; }

  .modal-body { padding: 16px; }
  .modal-header { padding: 16px; }

  .driver-avatar { width: 38px; height: 38px; font-size: 15px; }
  .driver-name { font-size: 14px; }

  .bg-result-body { padding: 16px; }
  .bg-result-header { padding: 14px 16px; }

  .hero { padding: 90px 12px 48px; }
  .hero h1 { font-size: 26px; }
  .hero-badge { font-size: 12px; }

  .features h2, .how-it-works h2, .testimonials h2,
  .pricing h2, .partners h2 { font-size: 22px; margin-bottom: 28px; }
  .cta h2 { font-size: 22px; }
  .cta p { font-size: 15px; }

  .feature-card { padding: 20px; }
  .testimonial-card { padding: 20px; }

  .auth-card { padding: 24px 16px; }

  .toast { bottom: 16px; right: 16px; left: 16px; max-width: none; text-align: center; }

  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .stat-mini-val { font-size: 18px; }

  .top-drivers-list { padding: 8px; }
  .violation-list { padding: 8px; }
}

/* ── TOUCH DEVICE OPTIMIZATIONS ────────────────────────── */
@media (hover: none) and (pointer: coarse) {
  /* Enlarge all interactive elements for fat fingers */
  .nav-item { padding-top: 14px; padding-bottom: 14px; }
  .tab-btn { min-height: 40px; }
  .btn-sm { min-height: 36px; padding: 8px 14px; }
  .btn-primary { min-height: 48px; }
  .star { font-size: 36px; }
  .data-table td, .data-table th { padding: 14px 12px; }

  /* Disable hover effects that cause sticky states on touch */
  .stat-card:hover { transform: none; box-shadow: var(--shadow); }
  .driver-card:hover { transform: none; box-shadow: var(--shadow); }
  .feature-card:hover { transform: none; }
  .top-driver-item:hover { background: var(--bg); }
}

/* ── LANDSCAPE PHONE (special case) ───────────────────── */
@media (max-height: 500px) and (orientation: landscape) {
  .auth-page { align-items: flex-start; padding-top: 16px; }
  .auth-card { max-height: 100vh; max-height: 100dvh; }
  .auth-logo { margin-bottom: 16px; }
  .auth-logo .logo-icon { font-size: 32px; }
  .hero { min-height: auto; padding: 80px 16px 40px; }
  .hero h1 { font-size: 24px; }
  .modal { max-height: 96vh; max-height: 96dvh; }
}

/* ── PRINT ─────────────────────────────────────────────── */
@media print {
  .sidebar, .topbar, .menu-toggle, .toast,
  .btn-primary, .btn-sm { display: none !important; }
  .main-content { margin-left: 0; padding-top: 0; }
  .page-content { padding: 0; }
  .card { box-shadow: none; border: 1px solid var(--border); }
  .data-table th { background: #f0f0f0 !important; -webkit-print-color-adjust: exact; }
}

/* ── REDUCED MOTION ────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .shape { animation: none; }
}

/* CARD MODAL PELANGGARAN */

/* =========================
   FORM GRID
========================= */

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group.full {
  grid-column: 1 / -1;
}

/* =========================
   INPUT STYLE
========================= */

.form-group label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  background: white;
  transition: 0.2s;
  outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

/* =========================
   LOCATION SECTION
========================= */

.location-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 8px;
}

.location-status {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.location-map-wrapper {
  display: none;
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  background: #fafafa;
}

.location-search-wrapper {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.location-search-wrapper input {
  flex: 1;
}

.location-search-wrapper button {
  padding: 10px 16px;
  border: none;
  border-radius: 10px;
  background: var(--primary);
  color: white;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}

.location-search-wrapper button:hover {
  opacity: 0.9;
}

/* =========================
   MAP
========================= */

#mapContainer {
  width: 100%;
  height: 380px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.map-info {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-muted);
}

/* =========================
   MODAL
========================= */

.modal-xxl {
  width: min(1000px, 95vw);
  max-height: 92vh;
  overflow-y: auto;
}

/* =========================
   RESPONSIVE
========================= */

@media (max-width: 768px) {

  .form-grid {
    grid-template-columns: 1fr;
  }

  .location-search-wrapper {
    flex-direction: column;
  }

  .location-search-wrapper button {
    width: 100%;
  }

  #mapContainer {
    height: 300px;
  }

}

/* ── DARK MODE (system preference) ────────────────────── */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1117;
    --card-bg: #1a1f36;
    --border: #2d3561;
    --text: #e2e8f0;
    --text-muted: #8892a4;
    --primary-light: #1e2d6b;
    --shadow: 0 2px 12px rgba(0,0,0,.3);
    --shadow-lg: 0 8px 32px rgba(0,0,0,.5);
  }
  body { background: var(--bg); }
  .topbar, .modal, .auth-card, .driver-card,
  .stat-card, .feature-card, .testimonial-card,
  .pricing-card, .step, .partner-logo,
  .table-wrapper, .bg-result-card { background: var(--card-bg); }
  .form-group input,
  .form-group select,
  .form-group textarea { background: #0f1117; color: var(--text); border-color: var(--border); }
  .filter-select { background-color: #0f1117; color: var(--text); }
  .auth-tabs, .tab-btn, .admin-tabs { background: #0f1117; }
  .tab-btn.active { background: white; color: var(--primary); }
  .admin-tabs .tab-btn.active { background: var(--primary); color: white; }
  .data-table th { background: #0f1117; }
  .top-driver-item, .stat-mini,
  .rating-driver-info, .auth-hint { background: #0f1117; }
  .violation-item { background: #0f1117; }
  .violation-item.critical { background: #1a0d2e; }
  .landing-header { background: rgba(15,17,23,.95); }
  .partners, .features, .testimonials, .stats-bar { background: var(--bg); }
  .how-it-works, .pricing { background: var(--card-bg); }
  .bg-search-box, .editor-section { background: #0f1117; border-color: var(--border); }
}