/* ═══════════════════════════════════════════════════════════════
   OptiCar — Design System
   ═══════════════════════════════════════════════════════════════ */

/* ── Variables ───────────────────────────────────────────────── */
:root {
  --primary:        #6366f1;
  --primary-hover:  #4f46e5;
  --primary-light:  #eef2ff;
  --primary-dark:   #3730a3;
  --success:        #10b981;
  --success-light:  #ecfdf5;
  --warning:        #f59e0b;
  --warning-light:  #fffbeb;
  --danger:         #ef4444;
  --danger-light:   #fef2f2;
  --info:           #3b82f6;
  --info-light:     #eff6ff;

  --sidebar-w:      260px;
  --topbar-h:       60px;
  --sidebar-bg:     #0f172a;
  --sidebar-hover:  rgba(255,255,255,.07);
  --sidebar-active-bg: rgba(99,102,241,.18);
  --sidebar-active-border: #6366f1;
  --sidebar-text:   #94a3b8;
  --sidebar-text-active: #e2e8f0;
  --sidebar-border: rgba(255,255,255,.07);

  --surface:        #ffffff;
  --bg:             #f8fafc;
  --bg-subtle:      #f1f5f9;
  --border:         #e2e8f0;
  --border-focus:   #6366f1;
  --text:           #0f172a;
  --text-secondary: #475569;
  --text-muted:     #94a3b8;

  --radius-sm:      8px;
  --radius:         12px;
  --radius-lg:      16px;
  --radius-xl:      20px;
  --shadow-sm:      0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow:         0 1px 3px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.06);
  --shadow-lg:      0 4px 6px rgba(0,0,0,.05), 0 10px 30px rgba(0,0,0,.08);

  --font: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', ui-monospace, monospace;
  --transition: .18s cubic-bezier(.4,0,.2,1);
}

/* ── Reset ───────────────────────────────────────────────────── */
*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ── Layout ──────────────────────────────────────────────────── */
.app-layout { display: flex; min-height: 100vh; }

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  z-index: 200;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 20px 18px;
  border-bottom: 1px solid var(--sidebar-border);
  text-decoration: none;
}
.sidebar-logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sidebar-logo-icon svg { width: 20px; height: 20px; color: #fff; }
.sidebar-logo-text {
  font-size: 1.125rem;
  font-weight: 700;
  color: #f1f5f9;
  letter-spacing: -.3px;
}

.sidebar-nav { padding: 12px 10px; flex: 1; }
.sidebar-section-label {
  font-size: .6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #475569;
  padding: 8px 10px 4px;
  margin-top: 4px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-size: .875rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
  margin-bottom: 2px;
  position: relative;
  text-decoration: none;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: var(--sidebar-hover); color: #e2e8f0; }
.nav-item.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-text-active);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 6px; bottom: 6px;
  width: 3px;
  background: var(--sidebar-active-border);
  border-radius: 0 2px 2px 0;
}
.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: .6875rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 12px 16px 16px;
  border-top: 1px solid var(--sidebar-border);
}
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 8px;
  border-radius: var(--radius-sm);
}
.user-avatar {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .8125rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: .8125rem; font-weight: 600; color: #e2e8f0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-email { font-size: .6875rem; color: #475569; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-logout {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  border-radius: 6px;
  color: #64748b;
  transition: background var(--transition), color var(--transition);
  flex-shrink: 0;
}
.sidebar-logout:hover { background: var(--sidebar-hover); color: var(--danger); }
.sidebar-logout svg { width: 16px; height: 16px; }

/* ── Main wrapper ────────────────────────────────────────────── */
.main-wrapper {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* ── Topbar ──────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0;
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 24px;
  gap: 16px;
  z-index: 100;
}
.topbar-hamburger {
  display: none;
  background: none; border: none;
  color: var(--text-secondary);
  padding: 4px;
  border-radius: 6px;
  transition: color var(--transition);
}
.topbar-hamburger:hover { color: var(--text); }
.topbar-hamburger svg { width: 22px; height: 22px; }
.topbar-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  flex: 1;
}
.topbar-actions { display: flex; align-items: center; gap: 8px; }

/* ── Page content ────────────────────────────────────────────── */
.page-content { padding: 24px; flex: 1; max-width: 1200px; width: 100%; }

/* ── Breadcrumb ──────────────────────────────────────────────── */
.breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: .8125rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}
.breadcrumb a { color: var(--primary); }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb-sep { color: var(--border); }
.breadcrumb-cur { color: var(--text-secondary); font-weight: 500; }

/* ── Cards ───────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 24px;
  border: 1px solid rgba(0,0,0,.04);
}
.card-sm { padding: 16px; }
.card-header {
  display: flex; align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}
.card-title {
  font-size: .9375rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.2px;
}
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 20px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 20px; }

/* ── Stat grid ───────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}
.stat-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 20px 20px 18px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(0,0,0,.04);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stat-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 8px;
  flex-shrink: 0;
}
.stat-icon svg { width: 20px; height: 20px; }
.stat-icon.blue { background: var(--info-light); color: var(--info); }
.stat-icon.green { background: var(--success-light); color: var(--success); }
.stat-icon.amber { background: var(--warning-light); color: var(--warning); }
.stat-icon.red { background: var(--danger-light); color: var(--danger); }
.stat-icon.purple { background: var(--primary-light); color: var(--primary); }
.stat-label { font-size: .75rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; }
.stat-value { font-size: 1.5rem; font-weight: 800; color: var(--text); letter-spacing: -.5px; line-height: 1.2; }
.stat-sub { font-size: .75rem; color: var(--text-muted); }

/* ── Vehicle card (dashboard) ────────────────────────────────── */
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.vehicle-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(0,0,0,.04);
  transition: box-shadow var(--transition), transform var(--transition);
  cursor: pointer;
}
.vehicle-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }

/* ── Maintenance card ────────────────────────────────────────── */
.maintenance-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(0,0,0,.04);
  transition: box-shadow var(--transition), transform var(--transition);
}
.maintenance-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  font-size: .875rem;
  font-weight: 600;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(99,102,241,.3);
}
.btn-primary:hover { background: linear-gradient(135deg, var(--primary-hover) 0%, var(--primary-dark) 100%); box-shadow: 0 4px 12px rgba(99,102,241,.4); }
.btn-secondary { background: var(--bg-subtle); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-danger { background: var(--danger-light); color: var(--danger); border-color: rgba(239,68,68,.2); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-ghost { background: transparent; color: var(--text-secondary); border-color: var(--border); }
.btn-ghost:hover { background: var(--bg-subtle); color: var(--text); }
.btn-success { background: var(--success-light); color: var(--success); border-color: rgba(16,185,129,.2); }
.btn-success:hover { background: var(--success); color: #fff; }
.btn-sm { font-size: .8125rem; padding: 6px 13px; }
.btn-lg { font-size: .9375rem; padding: 12px 24px; }
.btn-icon {
  background: none; border: none; padding: 6px;
  border-radius: 6px;
  color: var(--text-muted);
  transition: background var(--transition), color var(--transition);
  display: inline-flex; align-items: center; justify-content: center;
}
.btn-icon svg { width: 16px; height: 16px; }
.btn-icon:hover { background: var(--bg-subtle); color: var(--text); }
.btn-icon.danger:hover { background: var(--danger-light); color: var(--danger); }

/* ── Forms ───────────────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.span-2 { grid-column: span 2; }
.form-label { font-size: .8125rem; font-weight: 600; color: var(--text-secondary); }
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: .875rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-hint { font-size: .75rem; color: var(--text-muted); }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; padding-top: 8px; }
.form-error { font-size: .8125rem; color: var(--danger); }

/* Auth form */
.auth-wrap {
  min-height: 100vh; background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.auth-card {
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 40px;
  width: 100%; max-width: 400px;
}
.auth-logo {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 28px;
}
.auth-logo-icon {
  width: 42px; height: 42px;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
}
.auth-logo-icon svg { width: 22px; height: 22px; color: #fff; }
.auth-logo-text { font-size: 1.25rem; font-weight: 800; color: var(--text); letter-spacing: -.4px; }
.auth-title { font-size: 1.25rem; font-weight: 700; margin-bottom: 6px; }
.auth-sub { font-size: .875rem; color: var(--text-muted); margin-bottom: 24px; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-link { font-size: .875rem; color: var(--text-muted); text-align: center; margin-top: 16px; }
.auth-link a { color: var(--primary); font-weight: 600; }
.password-strength {
  height: 3px; border-radius: 2px;
  background: var(--border);
  margin-top: 4px;
  overflow: hidden;
}
.password-strength-bar {
  height: 100%; border-radius: 2px;
  transition: width .3s, background .3s;
}

/* ── Tables ──────────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; border-radius: var(--radius-sm); }
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}
.table thead th {
  text-align: left;
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 10px 12px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table thead th:first-child { border-radius: var(--radius-sm) 0 0 0; }
.table thead th:last-child  { border-radius: 0 var(--radius-sm) 0 0; }
.table tbody td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--bg-subtle);
  color: var(--text);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: var(--bg-subtle); }
.td-num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--font-mono); font-size: .8125rem; }
.td-actions { text-align: right; white-space: nowrap; }
.font-semibold { font-weight: 600; }

/* ── Badges ──────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  font-size: .6875rem; font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
  letter-spacing: .02em;
  white-space: nowrap;
}
.badge-green  { background: var(--success-light); color: #065f46; }
.badge-amber  { background: var(--warning-light); color: #92400e; }
.badge-red    { background: var(--danger-light); color: #991b1b; }
.badge-blue   { background: var(--info-light); color: #1e40af; }
.badge-purple { background: var(--primary-light); color: var(--primary-dark); }
.badge-gray   { background: var(--bg-subtle); color: var(--text-secondary); border: 1px solid var(--border); }
.badge-orange { background: #fff7ed; color: #c2410c; }

/* ── Progress / Wear bars ────────────────────────────────────── */
.wear-item { margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--bg-subtle); }
.wear-item:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.wear-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.wear-name { font-size: .875rem; font-weight: 600; }
.wear-pct { font-size: .875rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.wear-pct.ok       { color: var(--success); }
.wear-pct.warning  { color: var(--warning); }
.wear-pct.critical { color: var(--danger); }
.wear-pct.unknown  { color: var(--text-muted); }
.progress {
  height: 8px;
  background: var(--bg-subtle);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 6px;
}
.progress-fill {
  height: 100%;
  border-radius: 4px;
  transition: width .6s cubic-bezier(.4,0,.2,1);
}
.progress-fill.ok       { background: linear-gradient(90deg, #10b981, #059669); }
.progress-fill.warning  { background: linear-gradient(90deg, #f59e0b, #d97706); }
.progress-fill.critical { background: linear-gradient(90deg, #ef4444, #dc2626); }
.progress-fill.unknown  { background: var(--border); }
.wear-meta {
  display: flex; gap: 12px; flex-wrap: wrap;
  font-size: .75rem; color: var(--text-muted);
}

/* ── Timeline ────────────────────────────────────────────────── */
.timeline-item {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--bg-subtle);
}
.timeline-item:last-child { border-bottom: none; }
.timeline-dot {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}
.timeline-dot.ok       { background: var(--success); }
.timeline-dot.warning  { background: var(--warning); }
.timeline-dot.critical { background: var(--danger); }
.timeline-dot.unknown  { background: var(--text-muted); }
.timeline-name { font-size: .875rem; font-weight: 600; }
.timeline-date { font-size: .75rem; color: var(--text-muted); }

/* ── Tabs ────────────────────────────────────────────────────── */
.tabs {
  display: flex; gap: 2px;
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  padding: 3px;
  border: 1px solid var(--border);
  width: fit-content;
}
.tab-btn {
  padding: 7px 16px;
  font-size: .8125rem;
  font-weight: 600;
  border-radius: 6px;
  background: none; border: none;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition), color var(--transition), box-shadow var(--transition);
}
.tab-btn.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Flash messages ──────────────────────────────────────────── */
.flash { padding: 12px 16px; border-radius: var(--radius-sm); font-size: .875rem; margin-bottom: 16px; display: flex; align-items: center; gap: 10px; }
.flash svg { width: 18px; height: 18px; flex-shrink: 0; }
.flash-error   { background: var(--danger-light); color: #991b1b; border: 1px solid rgba(239,68,68,.2); }
.flash-success { background: var(--success-light); color: #065f46; border: 1px solid rgba(16,185,129,.2); }
.flash-info    { background: var(--info-light); color: #1e40af; border: 1px solid rgba(59,130,246,.2); }

/* ── Chart ───────────────────────────────────────────────────── */
.chart-wrapper { position: relative; max-height: 320px; }

/* ── Empty state ─────────────────────────────────────────────── */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  padding: 48px 24px; text-align: center; gap: 8px;
}
.empty-icon {
  width: 56px; height: 56px;
  background: var(--bg-subtle);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 8px;
  color: var(--text-muted);
}
.empty-icon svg { width: 28px; height: 28px; }
.empty-title { font-size: 1rem; font-weight: 700; color: var(--text); }
.empty-desc  { font-size: .875rem; color: var(--text-muted); max-width: 320px; }

/* ── Confirm modal ───────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.5);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  padding: 16px;
  opacity: 0; pointer-events: none;
  transition: opacity var(--transition);
}
.modal-overlay.visible { opacity: 1; pointer-events: auto; }
.modal-box {
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 28px;
  max-width: 400px; width: 100%;
  box-shadow: var(--shadow-lg);
  transform: scale(.95);
  transition: transform var(--transition);
}
.modal-overlay.visible .modal-box { transform: scale(1); }
.modal-icon {
  width: 48px; height: 48px;
  background: var(--danger-light);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
  color: var(--danger);
}
.modal-icon svg { width: 24px; height: 24px; }
.modal-title { font-size: 1rem; font-weight: 700; margin-bottom: 8px; }
.modal-desc  { font-size: .875rem; color: var(--text-secondary); margin-bottom: 24px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* ── Toast ───────────────────────────────────────────────────── */
#toast-container {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 2000;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--text);
  color: #f8fafc;
  font-size: .875rem; font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toast-in .25s ease;
  min-width: 240px; max-width: 380px;
}
.toast.success { background: #065f46; }
.toast.error   { background: #991b1b; }
.toast.info    { background: #1e40af; }
.toast svg { width: 18px; height: 18px; flex-shrink: 0; }
@keyframes toast-in { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }

/* ── OCR button ──────────────────────────────────────────────── */
.ocr-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  background: var(--bg-subtle);
}
.ocr-zone:hover { border-color: var(--primary); background: var(--primary-light); }
.ocr-zone.dragover { border-color: var(--primary); background: var(--primary-light); }
.ocr-icon { margin: 0 auto 8px; color: var(--text-muted); width: 32px; height: 32px; }

/* ── Source badge ────────────────────────────────────────────── */
.source-ocr    { background: #f5f3ff; color: #5b21b6; font-size: .6875rem; padding: 2px 6px; border-radius: 4px; font-weight: 600; }
.source-ticket { background: #eff6ff; color: #1d4ed8; font-size: .6875rem; padding: 2px 6px; border-radius: 4px; font-weight: 600; }
.source-pump   { background: #ecfdf5; color: #065f46; font-size: .6875rem; padding: 2px 6px; border-radius: 4px; font-weight: 600; }
.source-manual { background: var(--bg-subtle); color: var(--text-muted); font-size: .6875rem; padding: 2px 6px; border-radius: 4px; }

/* ── Utilities ───────────────────────────────────────────────── */
.text-xs  { font-size: .75rem; }
.text-sm  { font-size: .8125rem; }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.flex-1 { flex: 1; }
.ml-auto { margin-left: auto; }
.w-full { width: 100%; }
.inline-edit-input {
  border: 1.5px solid var(--primary);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: .875rem;
  outline: none;
  width: 100%;
  max-width: 140px;
  box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}

/* ── Sidebar overlay (mobile) ────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(15,23,42,.5);
  z-index: 190;
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform var(--transition);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay { display: block; pointer-events: none; opacity: 0; transition: opacity var(--transition); }
  .sidebar-overlay.visible { pointer-events: auto; opacity: 1; }
  .main-wrapper { margin-left: 0; }
  .topbar-hamburger { display: flex; }
  .page-content { padding: 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-group.span-2 { grid-column: span 1; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .auth-card { padding: 28px 20px; }
}

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr; }
  .grid-auto { grid-template-columns: 1fr; }
  .topbar-actions .btn-sm span { display: none; }
}
