:root {
  --bg: #0d1117;
  --card: #161b22;
  --border: #30363d;
  --text: #e6edf3;
  --muted: #8b949e;
  --primary: #2563eb;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #06b6d4;
  --radius: 8px;
  --radius-lg: 12px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body { background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; min-height: 100vh; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

/* NAVBAR */
.navbar {
  position: sticky; top: 0; z-index: 100;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  display: flex; align-items: center; gap: 1.5rem;
  height: 56px;
}
.navbar-brand {
  font-size: 1.15rem; font-weight: 700; color: var(--text);
  text-decoration: none; white-space: nowrap;
}
.navbar-brand:hover { text-decoration: none; color: var(--primary); }
.navbar-nav { display: flex; gap: 0.25rem; margin-left: auto; }
.navbar-nav a {
  color: var(--muted); font-size: 0.9rem; font-weight: 500;
  padding: 0.35rem 0.75rem; border-radius: var(--radius);
  transition: background 0.15s, color 0.15s;
}
.navbar-nav a:hover, .navbar-nav a.active {
  background: rgba(37,99,235,0.15); color: var(--primary); text-decoration: none;
}

/* CONTAINER */
.container { max-width: 1200px; margin: 0 auto; padding: 1.5rem; }

/* PAGES */
.page { display: none; }
.page.active { display: block; }

/* CARD */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.25rem;
}
.card-title { font-size: 1rem; font-weight: 600; margin-bottom: 1rem; color: var(--text); }

/* STATS GRID */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-pill {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.25rem 1.5rem;
  display: flex; flex-direction: column; gap: 0.4rem;
  border-left: 4px solid var(--border);
}
.stat-pill-label { font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.stat-pill-value { font-size: 1.75rem; font-weight: 700; line-height: 1; }
.stat-pill-sub { font-size: 0.8rem; color: var(--muted); }
.stat-pill.blue { border-left-color: var(--primary); }
.stat-pill.blue .stat-pill-value { color: var(--primary); }
.stat-pill.green { border-left-color: var(--success); }
.stat-pill.green .stat-pill-value { color: var(--success); }
.stat-pill.amber { border-left-color: var(--warning); }
.stat-pill.amber .stat-pill-value { color: var(--warning); }
.stat-pill.red { border-left-color: var(--danger); }
.stat-pill.red .stat-pill-value { color: var(--danger); }
.stat-pill.cyan { border-left-color: var(--info); }
.stat-pill.cyan .stat-pill-value { color: var(--info); }

/* VEHICLES GRID */
.vehicles-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.25rem; }
.vehicle-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
  transition: border-color 0.2s, transform 0.15s;
  cursor: pointer;
}
.vehicle-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.vehicle-card-img {
  width: 100%; height: 180px; object-fit: cover;
  background: #1c2128;
}
.vehicle-card-img-placeholder {
  width: 100%; height: 180px; background: #1c2128;
  display: flex; align-items: center; justify-content: center;
  font-size: 3.5rem; color: var(--muted);
}
.vehicle-card-body { padding: 1rem; }
.vehicle-card-title { font-size: 1rem; font-weight: 600; margin-bottom: 0.35rem; }
.vehicle-card-sub { font-size: 0.82rem; color: var(--muted); margin-bottom: 0.6rem; }
.vehicle-card-meta { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.vehicle-card-footer {
  padding: 0.75rem 1rem; border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.8rem; color: var(--muted);
}

/* FUEL BADGE */
.fuel-badge {
  display: inline-block; font-size: 0.72rem; font-weight: 600;
  padding: 0.2rem 0.5rem; border-radius: 4px;
  text-transform: uppercase; letter-spacing: 0.03em;
}
.fuel-Essence { background: rgba(37,99,235,0.2); color: #60a5fa; }
.fuel-Diesel { background: rgba(139,92,246,0.2); color: #a78bfa; }
.fuel-Hybride { background: rgba(34,197,94,0.2); color: #4ade80; }
.fuel-Electrique { background: rgba(6,182,212,0.2); color: #22d3ee; }

/* PLATE */
.plate {
  display: inline-block; background: #fff; color: #111;
  font-family: 'Courier New', monospace; font-weight: 700;
  font-size: 0.82rem; padding: 0.2rem 0.5rem;
  border-radius: 4px; letter-spacing: 0.08em;
}

/* TABLE */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
.table-wrap table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.table-wrap table th {
  background: #1c2128; color: var(--muted); font-weight: 600;
  text-align: left; padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table-wrap table td { padding: 0.65rem 0.9rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table-wrap table tr:last-child td { border-bottom: none; }
.table-wrap table tr:hover td { background: rgba(255,255,255,0.03); }

/* BADGES */
.badge {
  display: inline-block; font-size: 0.72rem; font-weight: 600;
  padding: 0.22rem 0.55rem; border-radius: 999px;
}
.badge-green { background: rgba(34,197,94,0.15); color: #4ade80; }
.badge-blue { background: rgba(37,99,235,0.15); color: #60a5fa; }
.badge-amber { background: rgba(245,158,11,0.15); color: #fbbf24; }
.badge-red { background: rgba(239,68,68,0.15); color: #f87171; }
.badge-gray { background: rgba(139,148,158,0.15); color: var(--muted); }
.badge-purple { background: rgba(139,92,246,0.15); color: #a78bfa; }

/* BUTTONS */
.btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.5rem 1rem; border-radius: var(--radius);
  font-size: 0.875rem; font-weight: 500; cursor: pointer;
  border: 1px solid transparent; transition: all 0.15s;
  white-space: nowrap; text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: #1d4ed8; border-color: #1d4ed8; }
.btn-secondary { background: transparent; color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: rgba(255,255,255,0.05); border-color: var(--muted); }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: rgba(239,68,68,0.1); }
.btn-sm { padding: 0.3rem 0.65rem; font-size: 0.8rem; }
.btn-icon { padding: 0.35rem; min-width: 32px; justify-content: center; }

/* FORMS */
.form-group { display: flex; flex-direction: column; gap: 0.35rem; }
.form-label { font-size: 0.82rem; font-weight: 500; color: var(--muted); }
.form-control {
  background: #1c2128; border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius); padding: 0.5rem 0.75rem; font-size: 0.875rem;
  width: 100%; outline: none; transition: border-color 0.15s;
}
.form-control:focus { border-color: var(--primary); }
.form-control::placeholder { color: var(--muted); }
select.form-control option { background: #1c2128; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.9rem; }

/* MODALS */
.modal-backdrop {
  display: none; position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(2px);
  align-items: center; justify-content: center; padding: 1rem;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); width: 100%; max-width: 640px;
  max-height: 90vh; display: flex; flex-direction: column;
  animation: modalIn 0.18s ease;
}
.modal-lg { max-width: 780px; }
@keyframes modalIn { from { opacity: 0; transform: scale(0.95) translateY(-10px); } to { opacity: 1; transform: none; } }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.modal-header h3 { font-size: 1rem; font-weight: 600; }
.modal-close { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 1.25rem; line-height: 1; padding: 0.2rem; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 1.25rem; overflow-y: auto; display: flex; flex-direction: column; gap: 0.9rem; }
.modal-footer { padding: 1rem 1.25rem; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 0.5rem; flex-shrink: 0; }

/* VEHICLE DETAIL */
.vehicle-detail-header {
  display: flex; gap: 1.5rem; align-items: flex-start;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.5rem; margin-bottom: 1.5rem;
}
.vehicle-detail-img {
  width: 180px; height: 130px; object-fit: cover;
  border-radius: var(--radius); flex-shrink: 0; background: #1c2128;
}
.vehicle-detail-img-placeholder {
  width: 180px; height: 130px; background: #1c2128;
  border-radius: var(--radius); display: flex; align-items: center;
  justify-content: center; font-size: 3rem; flex-shrink: 0;
}
.vehicle-detail-info { flex: 1; min-width: 0; }
.vehicle-detail-name { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.35rem; }
.vehicle-detail-sub { font-size: 0.9rem; color: var(--muted); margin-bottom: 0.75rem; }
.vehicle-detail-stats { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.vehicle-detail-stat { display: flex; flex-direction: column; gap: 0.1rem; }
.vehicle-detail-stat-label { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; }
.vehicle-detail-stat-value { font-size: 1rem; font-weight: 600; }

/* TABS */
.tabs { display: flex; gap: 0.25rem; margin-bottom: 1rem; border-bottom: 1px solid var(--border); padding-bottom: 0; }
.tab-btn {
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 0.9rem; font-weight: 500;
  padding: 0.6rem 1rem; border-bottom: 2px solid transparent;
  margin-bottom: -1px; transition: color 0.15s, border-color 0.15s;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* PARTS */
.part-thumb {
  width: 40px; height: 40px; object-fit: cover;
  border-radius: 4px; background: #1c2128;
}
.part-thumb-placeholder {
  width: 40px; height: 40px; border-radius: 4px;
  background: #1c2128; display: flex; align-items: center;
  justify-content: center; font-size: 1rem; color: var(--muted);
}

/* EMPTY STATE */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  gap: 0.75rem; padding: 3rem 1rem; color: var(--muted); text-align: center;
}
.empty-state-icon { font-size: 2.5rem; opacity: 0.5; }
.empty-state p { font-size: 0.9rem; }

/* TOASTS */
.toast-container {
  position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 999;
  display: flex; flex-direction: column; gap: 0.5rem; pointer-events: none;
}
.toast {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.75rem 1rem;
  font-size: 0.875rem; min-width: 220px; max-width: 360px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  animation: slideIn 0.25s ease; pointer-events: auto;
  border-left: 4px solid var(--border);
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.info { border-left-color: var(--info); }
.toast.warning { border-left-color: var(--warning); }
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }

/* UPLOAD ZONE */
.upload-zone {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 1.5rem; text-align: center; color: var(--muted);
  cursor: pointer; transition: border-color 0.15s;
}
.upload-zone:hover { border-color: var(--primary); color: var(--text); }
.preview-img {
  max-height: 120px; border-radius: var(--radius);
  margin-top: 0.75rem; display: none;
}

/* SECTION HEADER */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.25rem;
}
.section-title { font-size: 1.1rem; font-weight: 600; }

/* PAGE HEADER */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.5rem; gap: 1rem;
}
.page-title { font-size: 1.4rem; font-weight: 700; }

/* REMINDERS */
.reminder-item {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.75rem 0; border-bottom: 1px solid var(--border);
}
.reminder-item:last-child { border-bottom: none; }
.reminder-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.reminder-dot.overdue { background: var(--danger); }
.reminder-dot.soon { background: var(--warning); }
.reminder-dot.ok { background: var(--success); }
.reminder-info { flex: 1; min-width: 0; }
.reminder-title { font-size: 0.875rem; font-weight: 500; }
.reminder-sub { font-size: 0.78rem; color: var(--muted); }
.reminder-date { font-size: 0.78rem; color: var(--muted); white-space: nowrap; }

/* DASHBOARD LAYOUT */
.dashboard-grid { display: grid; grid-template-columns: 1fr 340px; gap: 1.5rem; }

/* MISC */
.text-muted { color: var(--muted); }
.text-right { text-align: right; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.back-btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  color: var(--muted); font-size: 0.875rem; cursor: pointer;
  margin-bottom: 1rem; background: none; border: none; padding: 0;
  transition: color 0.15s;
}
.back-btn:hover { color: var(--text); }
.actions-cell { display: flex; gap: 0.35rem; }

/* RESPONSIVE */
@media (max-width: 768px) {
  .container { padding: 1rem; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .vehicle-detail-header { flex-direction: column; }
  .vehicle-detail-img, .vehicle-detail-img-placeholder { width: 100%; height: 200px; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .modal { max-height: 95vh; }
  .navbar { padding: 0 1rem; gap: 1rem; }
  .vehicles-grid { grid-template-columns: 1fr; }
}
