/* ============================================================
   Cap sur Meuzac — le style
   Clair : blanc, gris très clair, bleu clair. Une couleur par
   transport : bleu pour les voitures, vert d'eau pour les trains.
   ============================================================ */

:root {
  --bg:      #F5F7FA;
  --card:    #FFFFFF;
  --card2:   #EEF2F7;
  --border:  #DDE4EC;
  --border2: #C6D1DE;

  --text:    #1E2A3A;
  --text2:   #5B6B7F;
  --dim:     #94A3B8;

  --accent:  #3B82F6;             /* bleu */
  --accent2: #2563EB;
  --soft:    #E8F0FE;
  --car:     #3B82F6;
  --car-bg:  #F1F6FE;
  --car-line:#BFD4F8;
  --train:   #14A38B;             /* vert d'eau */
  --train-bg:#EEF9F6;
  --train-line:#B6E6DA;
  --red:     #D9534F;

  --hf: 'Chakra Petch', sans-serif;   /* titres, étiquettes, codes */
  --bf: 'Outfit', sans-serif;         /* texte */

  --nav-h: 56px;
  --radius: 12px;
  --seat: 58px;
  --maxw: 1120px;
  --shadow: 0 1px 2px rgba(30,42,58,.04), 0 10px 24px -16px rgba(30,42,58,.18);
}

* { margin:0; padding:0; box-sizing:border-box; }
html { scroll-behavior:smooth; }
body {
  background: var(--bg); color: var(--text);
  font-family: var(--bf); font-size:16px; line-height:1.55;
  -webkit-font-smoothing: antialiased;
  padding-top: var(--nav-h);
  overflow-x: hidden;
}
button, input, select { font: inherit; color: inherit; }
button { cursor:pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- NAV ---------- */
nav.top {
  position: fixed; inset: 0 0 auto 0; z-index: 200; height: var(--nav-h);
  background: rgba(255,255,255,.92); backdrop-filter: blur(10px);
  border-bottom: 2px solid var(--border);
  display:flex; align-items:center; justify-content:space-between; gap:14px; padding: 0 18px;
}
.logo { font-family: var(--hf); font-weight:700; font-size:15px; letter-spacing:.14em; color: var(--text2); text-decoration:none; white-space:nowrap; }
.logo span { color: var(--accent); }
.top-right { display:flex; align-items:center; gap:12px; }
.status { font-family: var(--hf); font-size:12px; letter-spacing:.04em; color: var(--dim); white-space:nowrap; display:inline-flex; align-items:center; gap:6px; }
.status:not(:empty)::before { content:''; width:8px; height:8px; border-radius:50%; background: currentColor; flex:0 0 auto; }
.status.ok { color: var(--train); }
.status.local { color: var(--text2); }

/* ---------- LAYOUT ---------- */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.section { padding: 40px 0 8px; }
.section.tight { padding: 22px 0; }

.eyebrow {
  font-family: var(--hf); font-weight:600; font-size:12px; letter-spacing:.14em; text-transform:uppercase;
  color: var(--accent); margin-bottom: 12px; display:flex; align-items:center; gap:12px;
}
.eyebrow::after { content:''; flex:1; height:2px; background: linear-gradient(90deg, var(--border2), transparent); }
h1 { font-family: var(--hf); font-weight:700; font-size: clamp(30px, 4.6vw, 46px); line-height:1.1; letter-spacing:.02em; }
h2 { font-family: var(--hf); font-weight:700; font-size:18px; text-transform:uppercase; letter-spacing:.06em; margin-bottom: 14px; }
h2 .count { font-weight:500; color: var(--dim); }
p.lead { color: var(--text2); font-size:17px; max-width: 64ch; margin-top: 14px; }

.card { background: var(--card); border: 2px solid var(--border); border-radius: var(--radius); padding: 18px 20px; }
.label { font-family: var(--hf); font-weight:600; font-size:12px; letter-spacing:.12em; color: var(--dim); }
.hint { font-size:13px; color: var(--dim); margin-top: 10px; }
.row { display:flex; align-items:flex-start; gap:14px; flex-wrap:wrap; }
.row > .label { padding-top: 22px; }

/* ---------- BOUTONS ---------- */
.btn {
  display:inline-flex; align-items:center; gap:8px;
  font-family: var(--hf); font-weight:700; font-size:13px; text-transform:uppercase; letter-spacing:.06em;
  padding: 10px 16px; border-radius: 9px; border: 2px solid var(--border2); background: var(--card); color: var(--text);
  transition: border-color .15s, background .15s, color .15s; white-space:nowrap;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.sm { font-size:11px; padding: 7px 12px; }
.btn.car { border-color: var(--car-line); background: var(--car-bg); color: var(--car); }
.btn.car:hover { border-color: var(--car); }
.btn.train { border-color: var(--train-line); background: var(--train-bg); color: var(--train); }
.btn.train:hover { border-color: var(--train); }

/* ---------- JETONS : un prénom = un carré qu'on glisse ---------- */
.tok {
  width: var(--seat); height: var(--seat); border-radius: 11px;
  border: 2px solid var(--border2); background: var(--card);
  display:grid; place-items:center;
  font-family: var(--hf); font-weight:700; font-size:15px; letter-spacing:.06em; color: var(--text);
  cursor: grab; user-select:none; -webkit-user-select:none; touch-action: manipulation;
  box-shadow: 0 1px 0 rgba(30,42,58,.06);
  transition: border-color .14s, transform .12s, box-shadow .12s;
}
.tok:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
.tok.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--soft); }
.tok.drag { opacity: .35; }
.tok.out { opacity: .45; border-style: dashed; background: var(--card2); }

.pool { flex:1; min-width: 200px; display:flex; gap: 12px 10px; flex-wrap:wrap; align-items:flex-start; padding: 8px 6px; border-radius: 10px; min-height: 90px; transition: background .14s, outline-color .14s; outline: 2px dashed transparent; }
.pool.over { background: var(--soft); outline-color: var(--accent); }
.pool .who { display:grid; justify-items:center; gap: 5px; width: var(--seat); position:relative; }
.pool .who small { font-size: 12px; color: var(--text2); max-width: 66px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.pool .who .kill {
  position:absolute; top:-7px; right:-7px; width:20px; height:20px; border-radius:50%;
  border: 2px solid var(--border2); background: var(--card); color: var(--dim); font-size:10px; line-height:1; padding:0;
  opacity: 0; transition: opacity .12s;
}
.pool .who:hover .kill, .pool .who:focus-within .kill, .pool .who .kill.sure { opacity: 1; }
.pool .who .kill:hover { color: var(--red); border-color: var(--red); }
.pool .who .kill.sure { width:auto; padding: 0 7px; background: var(--red); border-color: var(--red); color:#fff; font-family: var(--hf); font-weight:700; font-size:10px; right:-14px; }
.pool .muted { color: var(--dim); padding: 16px 6px; font-size: 14px; }

.add { display:flex; gap: 8px; align-items:center; padding-top: 8px; }
.add input {
  width: 180px; padding: 8px 12px; border: 2px solid var(--border); border-radius: 9px; background: var(--bg); font-size: 14px;
}
.add input:focus { outline:none; border-color: var(--accent); background: var(--card); }

/* ---------- CALENDRIER ---------- */
.cal { display:grid; grid-auto-flow:column; grid-auto-columns: minmax(160px, 1fr); gap: 12px; overflow-x:auto; padding-bottom: 6px; }
.day-col { background: var(--card); border: 2px solid var(--border); border-radius: var(--radius); padding: 12px; display:grid; align-content:start; gap: 8px; min-height: 120px; }
.day-col.extra { border-style: dashed; }
.day-col h4 { font-family: var(--hf); font-weight:600; font-size:12px; letter-spacing:.12em; text-transform:uppercase; color: var(--dim); display:flex; justify-content:space-between; align-items:baseline; }
.day-col h4 b { font-size: 22px; color: var(--text); letter-spacing: 0; }
.pill {
  border: 2px solid var(--border); border-left-width: 4px; border-radius: 9px; background: var(--card2);
  padding: 7px 10px; text-align:left; display:grid; gap: 2px; color: var(--text); transition: border-color .14s;
}
.pill:hover { border-color: var(--accent); }
.pill.car { border-left-color: var(--car); background: var(--car-bg); }
.pill.train { border-left-color: var(--train); background: var(--train-bg); }
.pill .t { font-family: var(--hf); font-weight:600; font-size:12px; letter-spacing:.04em; color: var(--text2); display:flex; gap: 6px; }
.pill .t .fill { margin-left:auto; color: var(--dim); }
.pill .n { font-family: var(--hf); font-weight:700; font-size:14px; }
.pill .w { font-family: var(--hf); font-weight:600; font-size:11px; letter-spacing:.06em; color: var(--text2); }
.pill .w.none { font-family: var(--bf); font-weight:400; letter-spacing:0; font-style:italic; color: var(--dim); }
.day-col .none { color: var(--dim); font-size:12px; text-align:center; padding: 14px 0; }
.empty { border: 2px dashed var(--border2); border-radius: var(--radius); padding: 22px; text-align:center; color: var(--dim); }

/* ---------- LES VÉHICULES ---------- */
.bar { display:flex; align-items:center; gap: 10px; flex-wrap:wrap; margin-bottom: 14px; }
.bar h2 { margin: 0 auto 0 0; }
.fleet { display:grid; grid-template-columns: repeat(auto-fill, minmax(236px, 1fr)); gap: 22px 16px; align-items:start; }
.veh { display:grid; gap: 8px; min-width: 0; }
.veh.train { grid-column: span 2; }

/* au-dessus du cadre : le jour et les heures */
.when { display:flex; align-items:center; gap: 6px; padding: 0 6px; flex-wrap:wrap; }
.when select, .when .time, .when input[type=date] {
  background: var(--card); border: 2px solid var(--border); border-radius: 7px; color: var(--text);
  font-family: var(--hf); font-weight:700; font-size:12px; letter-spacing:.04em; padding: 4px 7px;
}
.when select { width: 92px; text-overflow: ellipsis; }
.when .time { width: 60px; text-align:center; color: var(--car); }
.when .time.arr { color: var(--train); }
.when .time::-webkit-calendar-picker-indicator { display:none; }
.when select:focus, .when .time:focus, .when input[type=date]:focus { outline:none; border-color: var(--accent); }
.when .arrow { color: var(--dim); font-size: 11px; }
.when .back { background:none; border:none; color: var(--dim); font-size: 13px; }

.body {
  background: var(--card); border: 2px solid var(--border); border-radius: var(--radius); padding: 14px;
  position:relative; display:grid; gap: 12px; min-width: 0; box-shadow: var(--shadow); transition: border-color .16s;
}
.body.flash { border-color: var(--accent); }
.veh.car .body { border-radius: 36px 36px 14px 14px; border-color: var(--car-line); background: var(--car-bg); }
.veh.train .body { border-radius: 18px; border-color: var(--train-line); background: var(--train-bg); }

.head { display:flex; align-items:center; gap: 8px; min-width: 0; }
.head .em { font-size: 18px; }
.head input {
  flex: 1 1 0; width: 0; min-width: 0; background: transparent; border: none; border-bottom: 2px dashed transparent;
  font-family: var(--hf); font-weight:700; font-size:15px; letter-spacing:.02em; padding: 2px 2px; color: var(--text);
}
.head input::placeholder { color: var(--dim); font-weight: 500; }
.head input:hover, .head input:focus { outline:none; border-bottom-color: var(--border2); }
.head .kill { background:none; border:none; color: var(--dim); font-size: 14px; padding: 2px 6px; border-radius: 6px; }
.head .kill:hover { color: var(--red); }
.head .kill.sure { background: var(--red); color: #fff; font-family: var(--hf); font-weight:700; font-size: 11px; }

/* sièges */
.seat {
  width: var(--seat); height: var(--seat); border-radius: 11px; border: 2px dashed var(--border2);
  display:grid; place-items:center; position:relative; transition: border-color .12s, background .12s;
}
.veh.car .seat { border-color: var(--car-line); background: rgba(59,130,246,.05); }
.veh.train .seat { border-color: var(--train-line); background: rgba(20,163,139,.06); }
.seat.over, .seat.aim { border-style: solid; border-color: var(--accent); background: var(--soft); }
.seat.full { border: none; background: transparent; }
.seat.driver::before {
  content: '🚗'; position:absolute; top:-10px; left:-10px; z-index:2; font-size:13px; line-height:1;
  background: var(--card); border: 2px solid var(--car-line); border-radius: 50%; padding: 2px;
}

/* habitacle : pare-brise, deux devant, deux derrière */
.cabin { display:grid; grid-template-columns: repeat(2, var(--seat)); justify-content:center; gap: 12px 22px; padding: 2px 0 4px; }
.cabin::before { content:''; grid-column: 1 / -1; height: 6px; border-radius: 4px; margin: 0 -10px 2px; background: linear-gradient(90deg, transparent, var(--car-line), transparent); }

/* wagon : bandeau de fenêtres, trois rangées, un couloir */
.veh.train .body::before {
  content:''; height: 8px; border-radius: 4px; margin: -4px 20px 0; opacity: .8;
  background: repeating-linear-gradient(90deg, var(--train-line) 0 26px, transparent 26px 36px);
}
.wagon { display:grid; grid-template-columns: repeat(3, auto); grid-template-rows: auto auto; justify-content: space-around; column-gap: 14px; row-gap: 24px; position:relative; padding: 4px 0 2px; }
.wagon::before { content:''; position:absolute; left: 4px; right: 4px; top: 50%; border-top: 2px dashed var(--train-line); }
.wagon .pair { display:flex; gap: 6px; }

/* ---------- BANDEAU SÉLECTION (téléphone) ---------- */
.selbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 16px; z-index: 150;
  background: var(--text); color: #fff; border-radius: 10px; padding: 8px 8px 8px 14px;
  display:flex; align-items:center; gap: 10px; font-family: var(--hf); font-weight:600; font-size: 13px;
  box-shadow: 0 10px 30px rgba(30,42,58,.3); max-width: calc(100% - 32px);
}
.selbar button { background: rgba(255,255,255,.14); border: none; color: inherit; border-radius: 6px; padding: 5px 9px; font-family: var(--hf); font-weight: 700; font-size: 11px; text-transform: uppercase; }

.toast {
  position: fixed; left: 50%; bottom: 70px; transform: translateX(-50%); z-index: 160;
  background: var(--card); border: 2px solid var(--border2); color: var(--text); padding: 10px 16px; border-radius: 9px;
  font-size: 14px; box-shadow: var(--shadow); max-width: calc(100% - 32px);
}

/* ---------- PIED ---------- */
footer.foot { border-top: 2px solid var(--border); margin-top: 60px; padding: 28px 20px 40px; text-align:center; color: var(--dim); font-size: 13px; }
footer.foot .logo { display:block; font-size: 12px; margin-bottom: 8px; }

@media (max-width: 640px) {
  .fleet { grid-template-columns: 1fr; }
  .veh.train { grid-column: auto; }
  .wagon { grid-template-columns: repeat(2, auto); grid-template-rows: auto; }
  .wagon::before { display:none; }
  .row > .label { padding-top: 0; width: 100%; }
  .add { width: 100%; }
  .add input { flex: 1; width: auto; }
  .status { font-size:0; gap:0; }
  .status:not(:empty)::before { width:10px; height:10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
  html { scroll-behavior: auto; }
}
