:root {
  /* Thème principal */
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f5f5f5;
  --text: #0a0a0a;
  --text-muted: #6b6b6b;
  --border: #e5e5e5;
  --border-strong: #d4d4d4;
  --accent: #000000;
  --accent-hover: #1a1a1a;
  --accent-text: #ffffff;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 8px 24px rgba(0,0,0,.08);
  --shadow-lg: 0 20px 50px rgba(0,0,0,.12);

  /* 🔁 Alias rétro-compatibles (utilisés dans les HTML) */
  --beige: var(--bg);
  --white: var(--surface);
  --black: var(--accent);
  --dark: var(--accent);
  --gold: var(--accent);
  --gold-dark: var(--text);
  --sand: var(--surface-2);
  --muted: var(--text-muted);
  --green: var(--text);
  --red: var(--text);
}
[data-theme="dark"] {
  --bg: #0a0a0a;
  --surface: #141414;
  --surface-2: #1e1e1e;
  --text: #f5f5f5;
  --text-muted: #a3a3a3;
  --border: #262626;
  --border-strong: #3a3a3a;
  --accent: #ffffff;
  --accent-hover: #e5e5e5;
  --accent-text: #0a0a0a;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow-md: 0 8px 24px rgba(0,0,0,.5);
  --shadow-lg: 0 20px 50px rgba(0,0,0,.6);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: system-ui, -apple-system, 'Segoe UI', 'Inter', sans-serif;
  background: var(--bg); color: var(--text);
  line-height: 1.6; transition: background .3s, color .3s;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; border: none; background: none; color: inherit; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--text-muted); }
.hidden { display: none !important; }

/* Focus visible global (accessibilité) */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- Header ---------- */
.header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,.85); backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
[data-theme="dark"] .header { background: rgba(10,10,10,.85); }
.header-inner { height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--accent); color: var(--accent-text);
  font-weight: 900; display: grid; place-items: center;
  letter-spacing: -.02em; flex-shrink: 0;
}
.brand small { display: block; font-size: .7rem; color: var(--text-muted); }
.brand strong { font-weight: 800; letter-spacing: -.01em; }
.nav { display: flex; gap: 22px; }
.nav a { font-size: .95rem; font-weight: 500; transition: opacity .2s; }
.nav a:hover, .nav a.active { opacity: .55; }
.header-actions { display: flex; gap: 10px; align-items: center; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 22px; border-radius: 999px; font-weight: 600;
  font-size: .9rem; transition: all .25s; white-space: nowrap;
  border: 1px solid transparent;
}
.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-2px); }
.btn-ghost { background: transparent; border-color: var(--border-strong); color: var(--text); }
.btn-ghost:hover { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.btn-danger { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn-danger:hover { background: var(--accent); color: var(--accent-text); }
.btn-whatsapp { background: var(--accent); color: var(--accent-text); }
.btn-whatsapp:hover { background: var(--accent-hover); }
.btn-sm { padding: 7px 14px; font-size: .8rem; }
.btn-lg { padding: 15px 32px; font-size: 1rem; }
.btn-full { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.icon-btn {
  width: 40px; height: 40px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface);
  display: grid; place-items: center; font-size: 1rem;
  transition: all .2s; flex-shrink: 0;
}
.icon-btn:hover { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }

/* ---------- Fields ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label {
  font-size: .72rem; font-weight: 700;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em;
}
.field input, .field select, .field textarea {
  padding: 12px 14px; border: 1px solid var(--border-strong);
  border-radius: 10px; background: var(--surface); color: var(--text);
  transition: border .2s, box-shadow .2s; width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0,0,0,.08);
}
[data-theme="dark"] .field input:focus,
[data-theme="dark"] .field select:focus,
[data-theme="dark"] .field textarea:focus { box-shadow: 0 0 0 3px rgba(255,255,255,.1); }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: .9rem; cursor: pointer; }
.checkbox-row input { accent-color: var(--accent); cursor: pointer; }

/* ---------- Hero ---------- */
.hero {
  padding: 80px 0 70px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: relative; z-index: 0;
  overflow: hidden;
}
.hero::before {
  content: ''; position: absolute; inset: 0; z-index: 0;
  background-image:
    linear-gradient(rgba(0,0,0,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,0,0,.035) 1px, transparent 1px);
  background-size: 40px 40px;
  -webkit-mask-image: radial-gradient(circle at 70% 50%, black 0%, transparent 70%);
  mask-image: radial-gradient(circle at 70% 50%, black 0%, transparent 70%);
  pointer-events: none;
}
[data-theme="dark"] .hero::before {
  background-image:
    linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
}
.hero-inner {
  display: grid; grid-template-columns: 1.1fr 1fr;
  gap: 50px; align-items: center;
  position: relative; z-index: 1;
}
.hero h1 {
  font-size: clamp(2.2rem, 4.5vw, 3.5rem);
  line-height: 1.08; margin-bottom: 18px;
  font-weight: 800; letter-spacing: -.03em;
}
.hero .lead { font-size: 1.1rem; color: var(--text-muted); margin-bottom: 24px; }
.eyebrow {
  display: inline-block; padding: 6px 14px;
  background: transparent; color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 999px; font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em; margin-bottom: 20px;
}
.hero-badges { display: flex; gap: 10px; flex-wrap: wrap; }
.hero-badges span {
  padding: 6px 14px; background: var(--surface-2);
  border-radius: 999px; font-size: .8rem; font-weight: 500;
  border: 1px solid var(--border);
}

/* ---------- Search box ---------- */
.search-box {
  background: var(--surface); padding: 26px; border-radius: 20px;
  box-shadow: var(--shadow-lg);
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
  border: 1px solid var(--border);
}
.search-box .full { grid-column: 1 / -1; }

/* ---------- Sections ---------- */
.section { padding: 70px 0; }
.section-title { font-size: 2rem; margin-bottom: 30px; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; }
.section-head { display: flex; justify-content: space-between; align-items: end; margin-bottom: 36px; gap: 20px; flex-wrap: wrap; }
.section-head p { color: var(--text-muted); }

/* ---------- Grid ---------- */
.grid { display: grid; gap: 20px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-cars { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

/* ---------- Car card ---------- */
.car-card {
  background: var(--surface); border-radius: 16px; overflow: hidden;
  border: 1px solid var(--border); transition: all .3s;
  display: flex; flex-direction: column;
}
.car-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--border-strong); }
.car-img {
  aspect-ratio: 16/10; background: var(--surface-2);
  overflow: hidden; position: relative;
  display: grid; place-items: center;
}
.car-img img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .5s cubic-bezier(.22,.61,.36,1);
  filter: contrast(1.04);
}
.car-card:hover .car-img img { transform: scale(1.06); }
.car-img .img-fallback {
  position: absolute; inset: 0;
  display: none; place-items: center;
  font-size: 3rem; color: var(--text-muted);
  background: var(--surface-2);
}
.car-img.broken .img-fallback { display: grid; }
.car-img.broken img { display: none; }
.car-body { padding: 18px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.car-body h3 { font-size: 1.1rem; margin: 0; font-weight: 700; letter-spacing: -.01em; }
.car-meta { font-size: .8rem; color: var(--text-muted); }
.car-specs {
  display: flex; gap: 10px; flex-wrap: wrap;
  font-size: .78rem; color: var(--text-muted);
  padding: 10px 0;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.car-price { font-size: 1.4rem; font-weight: 800; color: var(--text); margin-top: auto; letter-spacing: -.02em; }
.car-price small { font-size: .75rem; color: var(--text-muted); font-weight: 400; letter-spacing: 0; }

/* ---------- Feature ---------- */
.feature {
  padding: 28px 24px; background: var(--surface);
  border-radius: 16px; border: 1px solid var(--border);
  transition: all .3s;
}
.feature:hover { border-color: var(--border-strong); transform: translateY(-3px); }
.feature-icon {
  font-size: 1.4rem; margin-bottom: 14px;
  width: 48px; height: 48px; border-radius: 12px;
  background: var(--accent); color: var(--accent-text);
  display: grid; place-items: center;
}
.feature h3 { margin-bottom: 6px; font-size: 1rem; font-weight: 700; }
.feature p { color: var(--text-muted); font-size: .9rem; margin: 0; }

/* ---------- Auth ---------- */
.auth-page {
  min-height: 100vh; display: grid; place-items: center;
  padding: 30px 20px; background: var(--bg);
}
.auth-card {
  background: var(--surface); padding: 40px; border-radius: 20px;
  max-width: 420px; width: 100%; box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}
.auth-card h1 { font-size: 1.5rem; text-align: center; margin-bottom: 6px; font-weight: 800; letter-spacing: -.02em; }
.auth-card > p { text-align: center; color: var(--text-muted); margin-bottom: 24px; font-size: .9rem; }
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.tabs {
  display: flex; background: var(--surface-2);
  border-radius: 999px; padding: 4px; margin-bottom: 24px;
  border: 1px solid var(--border);
}
.tab {
  flex: 1; padding: 10px; border-radius: 999px; font-weight: 600;
  font-size: .9rem; color: var(--text-muted); transition: all .2s;
}
.tab.active { background: var(--accent); color: var(--accent-text); }
.divider {
  display: flex; align-items: center; gap: 12px;
  color: var(--text-muted); font-size: .72rem;
  text-transform: uppercase; letter-spacing: .1em; margin: 20px 0;
}
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.auth-footer { text-align: center; margin-top: 18px; font-size: .9rem; }
.auth-footer a { font-weight: 700; text-decoration: underline; }
.demo-hint {
  margin-top: 20px; padding: 14px 16px; background: var(--surface-2);
  border-radius: 10px; font-size: .8rem; color: var(--text-muted);
  border-left: 3px solid var(--accent); line-height: 1.7;
}
.demo-hint code {
  font-family: ui-monospace, 'SF Mono', monospace;
  background: var(--surface); padding: 2px 6px; border-radius: 4px;
  font-size: .78rem; color: var(--text); font-weight: 600;
  border: 1px solid var(--border);
}
.demo-hint strong { color: var(--text); }

/* ---------- App layout ---------- */
.app { display: grid; grid-template-columns: 240px 1fr; min-height: calc(100vh - 72px); }
.sidebar {
  background: var(--accent); color: var(--accent-text);
  padding: 26px 16px; border-right: 1px solid var(--border);
}
/* Dark mode : sidebar légèrement plus claire que le fond + bordure visible */
[data-theme="dark"] .sidebar {
  background: var(--surface-2); color: var(--text);
  border-right-color: var(--border-strong);
}
.sidebar nav { display: flex; flex-direction: column; gap: 4px; }
.sidebar nav a, .sidebar nav button {
  padding: 11px 14px; border-radius: 10px; font-size: .9rem;
  color: rgba(255,255,255,.72); display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left; transition: all .2s; font-weight: 500;
}
[data-theme="dark"] .sidebar nav a,
[data-theme="dark"] .sidebar nav button { color: var(--text-muted); }
.sidebar nav a:hover, .sidebar nav button:hover { background: rgba(255,255,255,.1); color: #fff; }
[data-theme="dark"] .sidebar nav a:hover,
[data-theme="dark"] .sidebar nav button:hover { background: var(--surface); color: var(--text); }
.sidebar nav a.active { background: rgba(255,255,255,.18); color: #fff; font-weight: 700; }
[data-theme="dark"] .sidebar nav a.active { background: var(--accent); color: var(--accent-text); font-weight: 700; }
.main { padding: 32px; background: var(--bg); min-width: 0; }
.main h1 { font-size: 1.75rem; margin-bottom: 6px; font-weight: 800; letter-spacing: -.02em; }

/* Fix : textes inline "color:#fff" dans dashboard */
[data-theme="dark"] #admin-name { color: var(--text) !important; }
/* Fix : avatar avec bg accent en dark */
[data-theme="dark"] #avatar { color: var(--accent-text) !important; }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 30px; }
.stat {
  padding: 22px; background: var(--surface);
  border-radius: 14px; border: 1px solid var(--border);
  min-width: 0; overflow: hidden;
}
.stat .lbl {
  font-size: .72rem; text-transform: uppercase;
  color: var(--text-muted); letter-spacing: .06em; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.stat .val {
  font-size: clamp(1.4rem, 3vw, 2rem); font-weight: 800;
  margin-top: 8px; letter-spacing: -.03em;
  overflow-wrap: anywhere; line-height: 1.1;
}

/* ---------- Panel ---------- */
.panel {
  background: var(--surface); padding: 26px; border-radius: 16px;
  border: 1px solid var(--border); margin-bottom: 20px;
  min-width: 0;
}
.panel h3 { margin-bottom: 16px; font-size: 1.05rem; font-weight: 700; }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: 14px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th {
  font-size: .72rem; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .06em; font-weight: 700;
  background: var(--surface);
}
tbody tr:hover { background: var(--surface-2); }
td code {
  font-family: ui-monospace, 'SF Mono', monospace;
  background: var(--surface-2); padding: 3px 7px; border-radius: 4px;
  font-size: .75rem;
}

/* ---------- Pills (B&W mais différenciés) ---------- */
.pill {
  display: inline-block;
  padding: 4px 10px; border-radius: 999px;
  font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border-strong);
}
.pill-pending { border-style: dashed; }
.pill-confirmed { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.pill-active { border-width: 2px; }
.pill-completed { opacity: .65; }
.pill-cancelled { opacity: .5; text-decoration: line-through; }

/* ---------- Skeleton ---------- */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 0%, var(--border) 50%, var(--surface-2) 100%);
  background-size: 200% 100%; animation: sk 1.4s infinite;
  border-radius: 16px; min-height: 300px;
}
@keyframes sk { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

/* ---------- Toast ---------- */
.toast-stack {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 9999; max-width: calc(100vw - 48px);
  pointer-events: none;
}
.toast {
  padding: 14px 20px; background: var(--accent); color: var(--accent-text);
  border-radius: 10px; box-shadow: var(--shadow-lg);
  min-width: 240px; max-width: 380px;
  animation: slide .3s; font-size: .9rem; font-weight: 500;
  pointer-events: auto;
}
@keyframes slide { from{opacity:0;transform:translateX(30px)} to{opacity:1;transform:translateX(0)} }

/* ---------- Spinner ---------- */
.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.3); border-top-color: currentColor;
  animation: spin .7s linear infinite; display: inline-block;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Footer ---------- */
.footer {
  background: var(--accent); color: var(--accent-text);
  padding: 50px 0 24px; margin-top: 60px;
}
[data-theme="dark"] .footer {
  background: var(--surface); color: var(--text);
  border-top: 1px solid var(--border);
}
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 30px; margin-bottom: 30px; }
.footer-grid h4 { margin-bottom: 12px; font-weight: 800; }
.footer-grid h5 {
  margin-bottom: 12px; color: rgba(255,255,255,.5);
  font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700;
}
[data-theme="dark"] .footer-grid h5 { color: var(--text-muted); }
.footer-grid a { display: block; padding: 5px 0; color: rgba(255,255,255,.75); font-size: .9rem; transition: color .2s; }
[data-theme="dark"] .footer-grid a { color: var(--text-muted); }
.footer-grid a:hover { color: #fff; }
[data-theme="dark"] .footer-grid a:hover { color: var(--text); }
.footer-grid p { color: rgba(255,255,255,.75); font-size: .9rem; }
[data-theme="dark"] .footer-grid p { color: var(--text-muted); }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,.15); padding-top: 20px;
  text-align: center; color: rgba(255,255,255,.5); font-size: .82rem;
}
[data-theme="dark"] .footer-bottom { border-top-color: var(--border); color: var(--text-muted); }

/* ---------- FAQ ---------- */
.faq-list { max-width: 780px; margin: 0 auto; }
.faq-item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; margin-bottom: 10px; overflow: hidden;
  transition: border-color .2s;
}
.faq-item.open { border-color: var(--border-strong); }
.faq-q {
  width: 100%; padding: 20px 24px; display: flex; justify-content: space-between;
  align-items: center; gap: 16px;
  font-size: 1rem; font-weight: 600; text-align: left;
  color: var(--text);
}
.faq-q .chev { transition: transform .3s; flex-shrink: 0; }
.faq-item.open .chev { transform: rotate(180deg); }
.faq-a { max-height: 0; overflow: hidden; transition: max-height .35s ease; padding: 0 24px; }
.faq-item.open .faq-a { max-height: 400px; padding-bottom: 20px; }
.faq-a p { color: var(--text-muted); margin: 0; }

/* ---------- Modal ---------- */
.modal-bg {
  position: fixed; inset: 0; background: rgba(0,0,0,.6);
  display: grid; place-items: center; z-index: 999;
  opacity: 0; pointer-events: none; transition: opacity .25s;
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  padding: 20px;
}
.modal-bg.open { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--surface); border-radius: 16px; padding: 28px;
  max-width: 500px; width: 100%; max-height: 90vh;
  overflow-y: auto; transform: scale(.95); transition: transform .25s;
  border: 1px solid var(--border);
}
.modal-bg.open .modal { transform: scale(1); }

/* ---------- Empilement automatique des grilles inline sur mobile ---------- */
@media (max-width: 900px) {
  .grid[style*="grid-template-columns:1fr 1fr"],
  .grid[style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
}

/* ---------- Mobile ---------- */
.menu-toggle { display: none; }
@media (max-width: 900px) {
  .hero-inner { grid-template-columns: 1fr; gap: 30px; }
  .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .sidebar.open {
    display: block; position: fixed;
    top: 72px; left: 0; right: 0; bottom: 0;
    z-index: 90; overflow-y: auto; border-right: none;
  }
  .main { padding: 20px 14px; }
  .menu-toggle { display: grid; }
  .nav {
    display: none; position: fixed;
    top: 72px; left: 0; right: 0;
    background: var(--surface); padding: 20px;
    flex-direction: column; gap: 4px;
    border-bottom: 1px solid var(--border);
    z-index: 99; max-height: calc(100vh - 72px);
    overflow-y: auto;
  }
  .nav.open { display: flex; }
  .nav a { padding: 12px 0; border-bottom: 1px solid var(--border); }
  .nav a:last-child { border-bottom: none; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 24px; }
  .section { padding: 50px 0; }
  .section-title { font-size: 1.6rem; }
}
@media (max-width: 500px) {
  .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .search-box { grid-template-columns: 1fr; padding: 20px; }
  .search-box .full { grid-column: 1; }
  .auth-card { padding: 26px 22px; }
  .footer-grid { grid-template-columns: 1fr; }
  .hero { padding: 50px 0; }
  .section { padding: 40px 0; }
  .main { padding: 16px 12px; }
  .toast-stack { bottom: 16px; right: 16px; left: 16px; max-width: none; }
  .toast { min-width: 0; }
  th, td { padding: 10px 12px; font-size: .82rem; }
  .stat { padding: 18px; }
  .panel { padding: 20px; }
  .container { padding: 0 16px; }
}
@media (max-width: 360px) {
  .brand small { display: none; }
  .header-inner { gap: 12px; }
  .btn { padding: 10px 18px; font-size: .85rem; }
}