/* ===================================================================
   Quads & Excursions — thème "piste & atelier"
   Palette : nuit de dune + rouille + ocre. Chiffres clés en style
   compteur kilométrique (odomètre) pour ancrer le thème quad.
   =================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@500;600;700&family=Work+Sans:wght@400;500;600&family=JetBrains+Mono:wght@500;700&display=swap');

:root {
  --bg: #15130f;
  --surface: #201c15;
  --surface-2: #2a251c;
  --line: #3a3226;
  --sand: #e7dcc2;
  --sand-dim: #b9ac8f;
  --rust: #bd5a24;
  --rust-bright: #e0752f;
  --ochre: #d6a339;
  --scrub: #5e8c61;
  --danger: #b23a3a;
  --radius: 6px;
  --tread: repeating-linear-gradient(90deg, var(--line) 0 10px, transparent 10px 18px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--sand);
  font-family: 'Work Sans', sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .display {
  font-family: 'Barlow Condensed', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--sand);
  margin: 0 0 8px 0;
}

h1 { font-size: 1.9rem; font-weight: 700; }
h2 { font-size: 1.35rem; font-weight: 600; }
h3 { font-size: 1.05rem; font-weight: 600; color: var(--sand-dim); }

a { color: var(--rust-bright); text-decoration: none; }
a:hover { text-decoration: underline; }

.odometer {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

/* ---------- layout shell ---------- */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar .brand {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--sand);
  display: flex;
  align-items: center;
  gap: 8px;
}
.topbar .brand .mark { color: var(--rust-bright); }

.topbar .user-chip {
  font-size: 0.8rem;
  color: var(--sand-dim);
  display: flex;
  align-items: center;
  gap: 10px;
}
.topbar .user-chip .role-badge {
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tread-divider {
  height: 3px;
  background: var(--tread);
}

nav.mainnav {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  overflow-x: auto;
  scrollbar-width: none;
}
nav.mainnav::-webkit-scrollbar { display: none; }
nav.mainnav a {
  flex: none;
  padding: 12px 16px;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.03em;
  color: var(--sand-dim);
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}
nav.mainnav a:hover { color: var(--sand); text-decoration: none; }
nav.mainnav a.active { color: var(--rust-bright); border-bottom-color: var(--rust); }

main.content {
  flex: 1;
  padding: 18px 16px 90px 16px;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

/* ---------- cards / kpi ---------- */
.grid { display: grid; gap: 14px; }
.grid.kpis { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}

.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  position: relative;
  overflow: hidden;
}
.kpi::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--rust);
}
.kpi .label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--sand-dim);
  margin-bottom: 6px;
}
.kpi .value {
  font-size: 1.9rem;
  color: var(--sand);
}
.kpi.warn::before { background: var(--ochre); }
.kpi.bad::before { background: var(--danger); }
.kpi.good::before { background: var(--scrub); }

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; }
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
th, td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
}
th {
  font-family: 'Barlow Condensed', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.75rem;
  color: var(--sand-dim);
  background: var(--surface-2);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.02); }

/* stacked table on small screens */
@media (max-width: 640px) {
  table.stack, table.stack thead { display: none; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack tr { border-bottom: 1px solid var(--line); padding: 10px 12px; }
  table.stack td { border: none; padding: 4px 0; display: flex; justify-content: space-between; gap: 10px; }
  table.stack td::before { content: attr(data-label); color: var(--sand-dim); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; }
}

/* ---------- badges / status ---------- */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 600;
  border: 1px solid transparent;
}
.badge.disponible, .badge.confirmee, .badge.validee, .badge.terminee { background: rgba(94,140,97,0.15); color: var(--scrub); border-color: var(--scrub); }
.badge.en_mission, .badge.en_cours, .badge.en_attente { background: rgba(214,163,57,0.15); color: var(--ochre); border-color: var(--ochre); }
.badge.en_entretien, .badge.normale { background: rgba(189,90,36,0.15); color: var(--rust-bright); border-color: var(--rust); }
.badge.en_panne, .badge.annulee, .badge.refusee, .badge.urgente { background: rgba(178,58,58,0.15); color: #e07a7a; border-color: var(--danger); }
.badge.non_paye { background: rgba(178,58,58,0.15); color: #e07a7a; border-color: var(--danger); }
.badge.especes, .badge.virement, .badge.achetee { background: rgba(94,140,97,0.15); color: var(--scrub); border-color: var(--scrub); }

/* ---------- forms ---------- */
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
label { display: block; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--sand-dim); margin-bottom: 5px; }
input, select, textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--sand);
  padding: 10px 11px;
  border-radius: var(--radius);
  font-family: 'Work Sans', sans-serif;
  font-size: 0.92rem;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--rust-bright);
  outline-offset: 1px;
  border-color: var(--rust-bright);
}
textarea { resize: vertical; min-height: 70px; }
.field { margin-bottom: 0; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--rust);
  color: #fff8ef;
  border: 1px solid var(--rust);
  padding: 10px 18px;
  border-radius: var(--radius);
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.88rem;
  cursor: pointer;
}
.btn:hover { background: var(--rust-bright); text-decoration: none; }
.btn.secondary { background: transparent; color: var(--sand); border-color: var(--line); }
.btn.secondary:hover { border-color: var(--sand-dim); background: var(--surface-2); }
.btn.danger { background: var(--danger); border-color: var(--danger); }
.btn.small { padding: 6px 12px; font-size: 0.78rem; }

/* ---------- alerts ---------- */
.alert { padding: 12px 14px; border-radius: var(--radius); margin-bottom: 14px; font-size: 0.9rem; border: 1px solid; }
.alert.error { background: rgba(178,58,58,0.12); border-color: var(--danger); color: #e6a3a3; }
.alert.success { background: rgba(94,140,97,0.12); border-color: var(--scrub); color: #b7d6b9; }
.alert.warn { background: rgba(214,163,57,0.12); border-color: var(--ochre); color: var(--ochre); }

.empty {
  text-align: center;
  color: var(--sand-dim);
  padding: 40px 20px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.muted { color: var(--sand-dim); font-size: 0.85rem; }
.mt { margin-top: 16px; }
.actions-cell { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- login page ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--bg);
  background-image: var(--tread);
  background-size: 100% 3px;
  background-repeat: no-repeat;
  background-position: bottom;
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 34px 28px;
  width: 100%;
  max-width: 360px;
}
.login-card .brand { text-align: center; margin-bottom: 22px; }
.login-card .brand .mark { color: var(--rust-bright); font-size: 2rem; display: block; }
.login-card .brand .name { font-family: 'Barlow Condensed', sans-serif; text-transform: uppercase; letter-spacing: 0.05em; font-size: 1.3rem; }
