:root {
  --bg: #0f172a;
  --bg-card: #1e293b;
  --bg-surface: #334155;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --accent: #f59e0b;
  --accent-green: #22c55e;
  --accent-red: #ef4444;
  --accent-blue: #3b82f6;
  --radius: 14px;
  --max-width: 760px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; }

body {
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.container { max-width: var(--max-width); margin: 0 auto; padding: 1rem; }

/* ---------- boutons ---------- */
.btn {
  display: inline-block;
  width: 100%;
  min-height: 52px;
  padding: 0.8rem 1rem;
  border: none;
  border-radius: var(--radius);
  background: var(--accent);
  color: #1c1917;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  transition: transform 0.1s;
}
.btn:active { transform: scale(0.98); }
.btn.secondary { background: var(--bg-surface); color: var(--text); }
.btn.danger { background: var(--accent-red); color: white; }
.btn.success { background: var(--accent-green); color: #052e16; }
.btn.small { width: auto; min-height: 44px; padding: 0.5rem 0.9rem; font-size: 0.95rem; }

/* ---------- formulaires ---------- */
label { display: block; margin: 0.9rem 0 0.3rem; font-weight: 600; color: var(--text-muted); font-size: 0.9rem; }
input, select, textarea {
  width: 100%;
  min-height: 50px;
  padding: 0.7rem 0.9rem;
  border-radius: 12px;
  border: 1px solid var(--bg-surface);
  background: var(--bg-card);
  color: var(--text);
  font-size: 1rem;
}
input:focus, select:focus { outline: 2px solid var(--accent); }

/* ---------- cartes ---------- */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 0.8rem;
}

/* ---------- navigation onglets ---------- */
.tabs {
  display: flex;
  gap: 0;
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--bg);
  border-bottom: 1px solid var(--bg-surface);
}
.tab-btn {
  flex: 1;
  padding: 0.85rem 0.3rem;
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}
.tab-btn.active { color: var(--accent); border-bottom: 3px solid var(--accent); }

/* ---------- liste courses ---------- */
.ride-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 0.9rem;
  margin-bottom: 0.7rem;
  border-left: 5px solid var(--bg-surface);
}
.ride-card.done { border-left-color: var(--accent-green); opacity: 0.65; }
.ride-card.cancelled { border-left-color: var(--accent-red); opacity: 0.5; }
.ride-time { font-size: 1.3rem; font-weight: 800; color: var(--accent); }
.ride-addr { margin-top: 0.3rem; font-size: 0.95rem; }
.ride-addr .arrow { color: var(--accent); font-weight: 800; }
.ride-client { color: var(--text-muted); font-size: 0.9rem; margin-top: 0.2rem; }
.ride-actions { display: flex; gap: 0.5rem; margin-top: 0.7rem; flex-wrap: wrap; }
.ride-actions .btn { min-height: 46px; font-size: 0.95rem; }

/* ---------- badges ---------- */
.badge {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  background: var(--bg-surface);
  color: var(--text-muted);
}
.badge.driver { background: #1e3a8a; color: #bfdbfe; }
.badge.done { background: #14532d; color: #86efac; }
.badge.unassigned { background: #7c2d12; color: #fed7aa; }

/* ---------- login ---------- */
.login-wrap { max-width: 400px; margin: 8vh auto 0; padding: 1rem; }
.logo { text-align: center; font-size: 2.4rem; margin-bottom: 0.4rem; }
.login-title { text-align: center; font-size: 1.25rem; font-weight: 800; margin-bottom: 1.4rem; }

/* ---------- en-tête ---------- */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.8rem 1rem;
  background: var(--bg-card);
  border-bottom: 1px solid var(--bg-surface);
}
.header .title { font-weight: 800; font-size: 1.1rem; }
.header .whoami { color: var(--text-muted); font-size: 0.85rem; }

/* ---------- barre de progression chauffeur ---------- */
.progress {
  height: 12px;
  border-radius: 999px;
  background: var(--bg-surface);
  overflow: hidden;
  margin: 0.6rem 0 1rem;
}
.progress > div { height: 100%; background: var(--accent-green); transition: width 0.4s; }

/* ---------- message flash ---------- */
.flash {
  padding: 0.8rem 1rem;
  border-radius: 12px;
  margin-bottom: 0.8rem;
  font-weight: 600;
  display: none;
}
.flash.error { background: #7f1d1d; color: #fecaca; }
.flash.ok { background: #14532d; color: #bbf7d0; }

/* ---------- autocomplete ---------- */
.autocomplete { position: relative; }
.autocomplete-list {
  position: absolute;
  top: 100%; left: 0; right: 0;
  background: var(--bg-card);
  border: 1px solid var(--bg-surface);
  border-radius: 0 0 12px 12px;
  max-height: 240px;
  overflow-y: auto;
  z-index: 40;
  display: none;
}
.autocomplete-item {
  padding: 0.75rem 0.9rem;
  cursor: pointer;
  border-bottom: 1px solid var(--bg-surface);
  font-size: 0.92rem;
}
.autocomplete-item:active, .autocomplete-item:hover { background: var(--bg-surface); }

/* ---------- ligne d'info ---------- */
.row { display: flex; gap: 0.6rem; align-items: center; }
.row .grow { flex: 1; }
.muted { color: var(--text-muted); font-size: 0.88rem; }
.spacer { flex: 1; }

/* ---------- modale ---------- */
.modal-bg {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 50;
  display: none;
  align-items: flex-end;
}
.modal-bg.open { display: flex; }
.modal {
  background: var(--bg);
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-width: var(--max-width);
  max-height: 88vh;
  overflow-y: auto;
  padding: 1.2rem 1rem 2rem;
}
.modal h3 { margin-bottom: 0.6rem; }

/* section chauffeur dans la planification */
.driver-block h4 { color: var(--accent); margin-bottom: 0.4rem; }
.driver-block .sub { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 0.6rem; }

select.hide-native { display: none; }

/* dialogue confirmation déplacement de course */
.move-select {
  display: flex; gap: 0.5rem; margin-top: 0.6rem; flex-wrap: wrap;
}
.move-select select { flex: 1; }
