/* Covoit'Bleau — feuille de style commune.
   Mise en page : une colonne calme pensée pour le pouce (mobile d'abord), élargie sur ordinateur ;
   jaune « panneau » pour l'action principale, encre bleu nuit pour le texte. */
:root {
  --bg: #EEF1F6;
  --surface: #FFFFFF;
  --ink: #18203A;
  --muted: #586179;
  --line: #D9DEE8;
  --signal: #F2B200;
  --signal-ink: #18203A;
  --go: #1B7F55;
  --go-soft: #E2F3EA;
  --warn: #B4440E;
  --warn-soft: #FCEBDF;
  --chip: #E5E9F1;
  --foot-bg: #18203A;
  --foot-fg: #C9CFDD;
  --shadow: 0 1px 2px rgba(24,32,58,.06), 0 4px 14px rgba(24,32,58,.05);
  --f-display: "Familjen Grotesk", "Segoe UI", system-ui, sans-serif;
  --f-body: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
  --r: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0F1320; --surface: #181E2E; --ink: #E7EBF4; --muted: #9AA3B8; --line: #2A3248;
    --signal: #FFC83A; --signal-ink: #141A2C; --go: #55C995; --go-soft: #173327;
    --warn: #FF9A5C; --warn-soft: #3A2117; --chip: #242C40;
    --foot-bg: #0A0D17; --foot-fg: #A9B1C4;
    --shadow: 0 1px 2px rgba(0,0,0,.3);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--ink);
  font-family: var(--f-body); font-size: 16px; line-height: 1.45;
}
body.has-dock { padding-bottom: calc(92px + env(safe-area-inset-bottom, 0px)); }
.wrap { width: 100%; max-width: 760px; margin: 0 auto; padding: 14px 16px 24px; display: grid; gap: 18px; align-content: start; flex: 1; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--signal); outline-offset: 2px; }

/* ---------- En-tête ---------- */
.top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding-top: env(safe-area-inset-top, 0px); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand h1, .brand span { font-family: var(--f-display); font-weight: 700; font-size: 1.5rem; letter-spacing: -0.02em; margin: 0; }
.logo { width: 34px; height: 34px; border-radius: 9px; background: var(--signal); display: grid; place-items: center; flex: none; }
.logo svg { width: 22px; height: 22px; }
.top-right { display: flex; align-items: center; gap: 8px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); font-weight: 700; display: grid; place-items: center; font-size: .95rem; }
.seg { display: inline-flex; background: var(--chip); border-radius: 999px; padding: 3px; }
.seg button { border: 0; background: transparent; padding: 7px 14px; border-radius: 999px; font-weight: 700; font-size: .9rem; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* ---------- Semaine ---------- */
.week { display: grid; gap: 10px; }
.week-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.week-nav h2 { font-family: var(--f-display); font-size: 1.15rem; font-weight: 600; margin: 0; text-align: center; text-wrap: balance; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; flex: none; }
.icon-btn svg { width: 18px; height: 18px; }
.days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.day { border: 0; background: transparent; border-radius: 12px; padding: 6px 0 8px; display: grid; justify-items: center; gap: 2px; color: var(--muted); }
.day b { font-family: var(--f-display); font-size: 1.1rem; color: var(--ink); font-variant-numeric: tabular-nums; }
.day small { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; }
.day .dots { display: flex; gap: 3px; height: 6px; }
.day .dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--ink); opacity: .55; }
.day .dots i.need { background: var(--warn); opacity: 1; }
.day.today b { text-decoration: underline 3px var(--signal); text-underline-offset: 4px; }
.day:hover { background: var(--chip); }
.today-link { border: 0; background: none; color: var(--muted); font-size: .85rem; text-decoration: underline; justify-self: center; padding: 0; }
.summary { font-size: .92rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 14px; }
.summary strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.summary .need strong { color: var(--warn); }

/* ---------- Trajets ---------- */
.list { display: grid; gap: 18px; }
.daygroup { display: grid; gap: 10px; scroll-margin-top: 16px; }
.daygroup h3 { margin: 6px 0 0; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.trip { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); display: grid; grid-template-columns: 78px minmax(0,1fr); overflow: hidden; }
.trip.need { box-shadow: inset 4px 0 0 var(--warn), var(--shadow); }
.trip.past { opacity: .62; }
.time { padding: 14px 0 14px 14px; display: grid; align-content: start; gap: 4px; }
.time b { font-family: var(--f-display); font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.time span { font-size: .75rem; color: var(--muted); }
.tbody { padding: 12px 14px 14px 10px; display: grid; gap: 10px; min-width: 0; }
.thead { display: flex; justify-content: space-between; align-items: start; gap: 8px; }
.thead h4 { margin: 0; font-family: var(--f-display); font-size: 1.15rem; font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; }
.dir { display: inline-flex; align-items: center; gap: 4px; font-size: .78rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--chip); white-space: nowrap; }
.meta { display: grid; gap: 3px; font-size: .9rem; color: var(--muted); }
.meta span { overflow-wrap: anywhere; }
.meta b { color: var(--ink); font-weight: 700; }
.driver { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: .95rem; }
.driver .wanted { color: var(--warn); font-weight: 700; }
.driver .tel { color: var(--muted); font-size: .88rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.seats { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.seatrow { display: flex; gap: 4px; }
.seat { width: 14px; height: 17px; border-radius: 6px 6px 3px 3px; border: 2px solid var(--ink); }
.seat.taken { background: var(--ink); }
.seat.over { background: var(--warn); border-color: var(--warn); }
.seatlabel { font-size: .85rem; font-weight: 700; padding: 2px 8px; border-radius: 6px; }
.seatlabel.free { color: var(--go); background: var(--go-soft); }
.seatlabel.full { color: var(--muted); background: var(--chip); }
.seatlabel.over { color: var(--warn); background: var(--warn-soft); }
.kids { display: flex; flex-wrap: wrap; gap: 6px; }
.kid { display: inline-flex; align-items: center; gap: 6px; background: var(--chip); border-radius: 999px; padding: 4px 6px 4px 12px; font-size: .9rem; max-width: 100%; }
.kid em { font-style: normal; color: var(--muted); font-size: .78rem; }
.kid button { border: 0; background: transparent; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); }
.kid button:hover { background: var(--line); }
.kid.solo { padding-right: 12px; }
.note { font-size: .88rem; color: var(--muted); border-left: 2px solid var(--line); padding-left: 8px; overflow-wrap: anywhere; white-space: pre-line; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.inline-box { display: grid; gap: 8px; padding: 10px; border-radius: 10px; background: var(--bg); }
.inline-box .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline-box input { flex: 1; min-width: 0; }
.inline-box p { margin: 0; font-weight: 700; font-size: .92rem; }
.quick { display: flex; flex-wrap: wrap; gap: 6px; }
.quick button { border: 1px dashed var(--muted); background: transparent; border-radius: 999px; padding: 5px 12px; font-size: .9rem; }
.quick button:hover { background: var(--chip); }

/* ---------- Boutons et champs ---------- */
.btn { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 8px 12px; font-weight: 700; font-size: .9rem; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; line-height: 1.3; }
.btn:hover:not(:disabled) { background: var(--chip); }
.btn.primary { background: var(--signal); color: var(--signal-ink); border-color: transparent; }
.btn.primary:hover:not(:disabled) { background: var(--signal); filter: brightness(.95); }
.btn.warn { color: var(--warn); border-color: var(--warn); }
.btn.ghost { border-color: transparent; color: var(--muted); background: transparent; }
.btn.block { width: 100%; justify-content: center; padding: 12px 16px; font-size: 1rem; }
.field { display: grid; gap: 5px; min-width: 0; }
.field label, .field .lbl { font-size: .85rem; font-weight: 700; color: var(--muted); }
.field small { color: var(--muted); font-size: .8rem; }
.input, .field input, .field select, .field textarea, .inline-box input {
  border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 10px 12px; width: 100%; min-width: 0;
}
.field input:focus, .field select:focus, .field textarea:focus, .inline-box input:focus { border-color: var(--ink); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--signal) 55%, transparent); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle label { border: 1px solid var(--line); border-radius: 10px; padding: 10px; text-align: center; font-weight: 700; color: var(--ink); background: var(--bg); cursor: pointer; }
.toggle input:checked + label { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.toggle input:focus-visible + label { outline: 3px solid var(--signal); outline-offset: 2px; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.check input { width: 20px; height: 20px; accent-color: var(--ink); margin: 0; }
.err { color: var(--warn); font-size: .92rem; font-weight: 700; margin: 0; }
.ok { color: var(--go); font-size: .92rem; font-weight: 700; margin: 0; }

/* ---------- États ---------- */
.empty { background: var(--surface); border-radius: var(--r); padding: 22px 18px; display: grid; gap: 12px; box-shadow: var(--shadow); }
.empty h3 { margin: 0; font-family: var(--f-display); font-size: 1.2rem; text-wrap: balance; }
.empty p { margin: 0; color: var(--muted); max-width: 60ch; }
.banner { background: var(--warn-soft); color: var(--ink); border-radius: 12px; padding: 12px 14px; font-size: .92rem; }
.loading { color: var(--muted); font-size: .95rem; padding: 12px 0; margin: 0; }

/* ---------- Barre d'action ---------- */
.dock { position: fixed; left: 0; right: 0; bottom: 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); background: linear-gradient(to top, var(--bg) 65%, transparent); display: flex; justify-content: center; z-index: 5; pointer-events: none; }
.dock .btn { pointer-events: auto; font-size: 1rem; padding: 14px 22px; border-radius: 14px; width: 100%; max-width: 420px; justify-content: center; box-shadow: var(--shadow); }

/* ---------- Feuilles (formulaires) ---------- */
.sheet-back { position: fixed; inset: 0; background: rgba(10,14,26,.5); z-index: 10; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--surface); width: 100%; max-width: 560px; max-height: 92vh; max-height: 92dvh; overflow-y: auto; border-radius: 20px 20px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 14px; }
@media (min-width: 640px) { .sheet-back { align-items: center; padding: 16px; } .sheet { border-radius: 20px; padding: 22px; } }
.sheet h2 { margin: 0; font-family: var(--f-display); font-size: 1.35rem; }
.sheet h3 { margin: 6px 0 0; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.sheet p.help { margin: 0; color: var(--muted); font-size: .92rem; }
.sheet-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.sheet hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; width: 100%; }
.chips-edit { display: flex; flex-wrap: wrap; gap: 6px; }
.stack { display: grid; gap: 14px; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(90px + env(safe-area-inset-bottom, 0px)); background: var(--ink); color: var(--surface); padding: 10px 16px; border-radius: 10px; font-size: .92rem; font-weight: 700; z-index: 30; max-width: calc(100% - 32px); text-align: center; }

/* ---------- Connexion ---------- */
.auth { flex: 1; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border-radius: 20px; box-shadow: var(--shadow); padding: 26px 22px; display: grid; gap: 16px; }
.auth-card .brand { justify-content: center; }
.auth-card .lead { margin: 0; text-align: center; color: var(--muted); }
.auth-card .hint { margin: 0; font-size: .85rem; color: var(--muted); text-align: center; }

/* ---------- Administration ---------- */
.stats { display: flex; flex-wrap: wrap; gap: 8px 18px; color: var(--muted); font-size: .92rem; }
.stats strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.panel { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px; display: grid; gap: 12px; }
.panel h2 { margin: 0; font-family: var(--f-display); font-size: 1.2rem; }
.add-user { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.3fr) auto; gap: 10px; align-items: end; }
@media (max-width: 640px) { .add-user { grid-template-columns: 1fr; } }
.cred { background: var(--go-soft); border-radius: 12px; padding: 14px; display: grid; gap: 10px; }
.cred pre { margin: 0; white-space: pre-wrap; font-family: var(--f-body); font-size: .92rem; background: var(--surface); border-radius: 8px; padding: 10px 12px; overflow-wrap: anywhere; }
.cred .pw { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 1.15rem; font-weight: 700; letter-spacing: .04em; }
.users { display: grid; gap: 8px; }
.user { background: var(--surface); border-radius: 12px; box-shadow: var(--shadow); padding: 12px 14px; display: grid; gap: 8px; }
.user.off { opacity: .65; }
.user-main { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: start; }
.user-id { min-width: 0; display: grid; gap: 2px; }
.user-id b { font-size: 1.02rem; overflow-wrap: anywhere; }
.user-id span { color: var(--muted); font-size: .9rem; overflow-wrap: anywhere; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badge { font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 3px 8px; border-radius: 6px; background: var(--chip); color: var(--muted); }
.badge.admin { background: var(--ink); color: var(--surface); }
.badge.off { background: var(--warn-soft); color: var(--warn); }
.badge.temp { background: color-mix(in srgb, var(--signal) 30%, transparent); color: var(--ink); }
.user-meta { color: var(--muted); font-size: .85rem; display: flex; gap: 4px 14px; flex-wrap: wrap; }
.search { max-width: 320px; }
.users-wrap { display: grid; gap: 12px; }
.panel-title { margin: 0; font-family: var(--f-display); font-size: 1.2rem; }
.add-user .check { grid-column: 1 / -1; font-weight: 400; }
.list-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ---------- Pied de page Infocilla ---------- */
.site-foot { background: var(--foot-bg); color: var(--foot-fg); font-size: .78rem; }
.site-foot .in { max-width: 760px; margin: 0 auto; padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; }
.site-foot a { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 10px; }
.site-foot a:hover span { text-decoration: underline; }
.site-foot img { height: 20px; width: auto; display: block; }
.site-foot .alt { font-family: var(--f-display); font-weight: 700; letter-spacing: .12em; color: #FFFFFF; font-size: .85rem; }

@media (prefers-reduced-motion: no-preference) { .toast { animation: rise .18s ease-out; } @keyframes rise { from { transform: translate(-50%, 8px); opacity: 0; } } }

/* ---------- Inscription ---------- */
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.auth-card .hint a { color: inherit; font-weight: 700; }
.field textarea { resize: vertical; font: inherit; }
.user.pending { box-shadow: var(--shadow), inset 4px 0 0 var(--signal); }
.user .note-req { margin: 0; font-size: .92rem; background: var(--bg); border-radius: 8px; padding: 8px 10px; overflow-wrap: anywhere; }
.auth-card .stack-sm { display: grid; gap: 10px; }

/* ---------- Illustration : salamandre de Fontainebleau ---------- */
.auth { gap: 10px; align-content: center; }
.auth-card .hero { display: block; width: 92px; height: auto; margin: -4px auto -6px; filter: drop-shadow(0 4px 10px rgb(24 32 58 / .25)); }
.credit { margin: 0; max-width: 400px; text-align: center; font-size: .72rem; color: var(--muted); }
.credit a { color: inherit; }
