/* Portail SenaM : couleurs de la charte graphique 1.1 (vert #8CC63F et texte blanc dessus, bleu nuit #003366, gris ardoise, vert brume) depuis le 23/11, Nunito. */
@font-face { font-family: Nunito; src: url(fonts/Nunito-Regular.ttf); font-weight: 400; font-display: swap; }
@font-face { font-family: Nunito; src: url(fonts/Nunito-SemiBold.ttf); font-weight: 600; font-display: swap; }
@font-face { font-family: Nunito; src: url(fonts/Nunito-Bold.ttf); font-weight: 700; font-display: swap; }
@font-face { font-family: Nunito; src: url(fonts/Nunito-ExtraBold.ttf); font-weight: 800; font-display: swap; }
@font-face { font-family: Nunito; src: url(fonts/Nunito-Black.ttf); font-weight: 900; font-display: swap; }

:root {
  --green: #8CC63F; --green-ink: #3B6A12; --green-soft: #F2F9E8; --mint: #8CC63F; --navy: #003366; --on-green: #fff;
  --yellow: #F2B705; --warn-ink: #6E5100; --warn-soft: #FFF6D6; --bad: #B3261E; --bad-soft: #FCE8E6;
  --info: #2457C5; --info-soft: #E6EDFB;
  --bg: #F3F6F4; --card: #FFFFFF; --ink: #003366; --mute: #475569; --line: #DCE4DF; --line2: #C8D2CC; --chip: #E6ECE9;
  --bar: #8CC63F; --rentals: #F2B705;
  color-scheme: light;
}
/* Thème sombre : choisi dans la barre latérale, ou celui de l'appareil en mode Auto (index.html). */
:root[data-theme="dark"] {
  color-scheme: dark;
    --green: #8CC63F; --green-ink: #A9D96E; --green-soft: #13372A; --on-green: #FFFFFF; --navy: #0B1424;
    --warn-ink: #F2D27A; --warn-soft: #3A2F0A; --bad: #FF8A80; --bad-soft: #3B1A18; --info: #8FB0FF; --info-soft: #18264A;
    --bg: #0E1A16; --card: #16241F; --ink: #EEF2F0; --mute: #A9B8B0; --line: #2A3A33; --line2: #34453D; --chip: #22322C; --bar: #557A24; --rentals: #F2B705;
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.45 Nunito, system-ui, sans-serif; background: var(--bg); color: var(--ink); }
/* Le vert de la charte (#8CC63F) sert aux aplats ; écrit sur fond clair, il descend à 2:1 de
   contraste. Les textes verts prennent un vert foncé de la même teinte (6:1 sur blanc, 23/11). */
a { color: var(--green-ink); }
.hide { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--info); outline-offset: 2px; }

/* Boutons à la taille de leur texte, 44 px de haut au moins (règle ergonomique de l'application). */
button, a.button { font: inherit; font-weight: 800; font-size: 14px; min-height: 40px; padding: 0 16px; border-radius: 20px; border: 1px solid var(--line2);
  background: var(--card); color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; white-space: nowrap; }
button.primary, a.button.primary { background: var(--green); border-color: var(--green); color: var(--on-green); }
button.small, a.button.small { min-height: 34px; padding: 0 12px; font-size: 13px; }
button:disabled { opacity: .55; cursor: not-allowed; }
/* Bouton principal désactivé : gris lisible plutôt qu'un vert pâle qui ne se lit plus. */
button.primary:disabled { opacity: 1; background: var(--chip); border-color: var(--line2); color: var(--mute); }
/* Taille et graisse fixées : dans un label, le champ héritait de l'intitulé (12 px, gras). */
input, select, textarea { font: inherit; font-size: 14px; font-weight: 400; padding: 9px 12px; border: 1px solid var(--line2); border-radius: 12px; background: var(--card); color: var(--ink); min-height: 40px; }
textarea { resize: vertical; flex: 1; }
input[type=search] { min-width: min(360px, 100%); }
label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; line-height: 16px; font-weight: 700; color: var(--mute); }
/* Champ sans label natif (sélecteur à positions) : même intitulé et même écart qu'un label. */
.field { display: flex; flex-direction: column; gap: 4px; }
.field .caption { font-size: 12px; line-height: 16px; font-weight: 700; color: var(--mute); }
.field .seg { flex-wrap: nowrap; white-space: nowrap; }
.field .seg.small button { min-height: 34px; }
/* Grilles de prix : champs sans aide en dessous, alignés par le bas quand un intitulé passe sur deux lignes. */
form.grid[data-tariff], #rf fieldset > .grid { align-items: end; }
/* Création de compte : le rôle prend la largeur de ses trois positions, les champs se partagent le reste. */
#uf { grid-template-columns: max-content repeat(2, minmax(150px, 1fr)) max-content; }
/* Message après un envoi de code ; le code dicté par un administrateur ressort en grand. */
.notice { margin: 8px 0 0; padding: 12px 16px; border-radius: 14px; background: var(--green-soft); font-weight: 700; line-height: 1.5; }
.otp { font-size: 20px; letter-spacing: 3px; white-space: nowrap; }
/* Recherche d'un compte : champ à la largeur d'un numéro, bouton à sa taille juste à côté,
   au lieu d'un bouton étiré sur la moitié de la carte (22/11). */
#af { grid-template-columns: minmax(200px, 380px) max-content; justify-content: start; }
/* Flotte : bouton à sa taille au bout de la ligne des champs, comme pour la création de compte. */
/* Six champs : sur une ligne en grand écran, en deux lignes de trois ailleurs, boutons à la suite. */
#vf { grid-template-columns: repeat(6, minmax(120px, 1fr)) max-content; }
#vf:has(#vcancel:not(.hide)) { grid-template-columns: repeat(6, minmax(120px, 1fr)) max-content max-content; }
@media (max-width: 1700px) {
  #vf, #vf:has(#vcancel:not(.hide)) { grid-template-columns: repeat(3, minmax(150px, 1fr)); }
  #vf > button { justify-self: start; }
}
@media (max-width: 1100px) {
  #uf { grid-template-columns: 1fr 1fr; } #uf .field { grid-column: 1 / -1; }
  #uf > button { justify-self: start; }
  #vf, #vf:has(#vcancel:not(.hide)) { grid-template-columns: 1fr 1fr; } #vf > button { justify-self: start; }
}
/* Sur téléphone, une colonne : les trois rôles se partagent la largeur au lieu de déborder. */
@media (max-width: 600px) {
  #uf, #af, #vf, #vf:has(#vcancel:not(.hide)) { grid-template-columns: minmax(0, 1fr); }
  #uf .field .seg { display: flex; }
  #uf .field .seg button { flex: 1; padding: 0 6px; }
  #uf > button, #af > button, #vf > button { margin-top: 0; justify-self: stretch; }
}
label.inline { flex-direction: row; align-items: center; gap: 10px; line-height: normal; font-size: 14px; color: var(--ink); margin: 10px 0; }
label.check { flex-direction: row; align-items: flex-start; gap: 8px; line-height: normal; color: var(--ink); font-size: 14px; }
.hint { font-size: 12px; color: var(--mute); }
.mute { color: var(--mute); } .small { font-size: 12px; } .bad, .down { color: var(--bad); } .up { color: var(--green-ink); }
h2 { font-size: 16px; font-weight: 900; margin: 16px 0 10px; display: flex; align-items: center; gap: 8px; }
.card > h2:first-child { margin-top: 0; }
h2 .more { margin-left: auto; font-size: 13px; font-weight: 800; text-decoration: none; }

/* ---------- Connexion ---------- */
#login, #recover, #setpwd { max-width: 380px; width: calc(100% - 32px); margin: 64px auto; display: flex; flex-direction: column; gap: 12px; }
#login .brand, #recover .brand, #setpwd .brand { color: var(--ink); padding: 0 0 8px; }
#err, #rerr, #serr { color: var(--bad); min-height: 20px; font-weight: 700; }
/* Case « Afficher les mots de passe » : la case garde sa taille, à gauche de son texte. */
#recover label.check, #setpwd label.check { align-items: center; }
#recover label.check input, #setpwd label.check input { width: 20px; height: 20px; min-height: 0; padding: 0; margin: 0; flex: none; }

/* ---------- Cadre ---------- */
.shell { display: flex; min-height: 100vh; }
aside { width: 232px; background: var(--navy); color: #E7ECF5; padding: 18px 12px; display: flex; flex-direction: column; gap: 2px; flex-shrink: 0; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-weight: 900; font-size: 17px; color: #fff; }
/* Logo de la charte sur carré blanc : lisible sur le bleu nuit du menu comme sur l'écran de connexion. */
.brand .logo { width: 30px; height: 30px; border-radius: 8px; background: #fff; box-shadow: 0 0 0 1px var(--line); }
#menu { display: flex; flex-direction: column; gap: 2px; }
#menu a { display: flex; align-items: center; gap: 10px; padding: 10px; min-height: 44px; border-radius: 10px; color: #C9D3E3; text-decoration: none; font-weight: 700; }
#menu a svg { width: 18px; height: 18px; flex-shrink: 0; }
#menu a.on { background: rgba(61, 214, 140, .16); color: #fff; }
#menu a:hover { color: #fff; }
#menu .count { margin-left: auto; background: var(--yellow); color: #003366; border-radius: 10px; padding: 0 7px; font-size: 12px; font-weight: 900; }
#who { margin-top: auto; padding: 10px; font-size: 12px; color: #A9B6CA; display: flex; flex-direction: column; }
#who b { color: #fff; font-size: 13px; }
#out { margin: 4px 10px 0; background: transparent; color: #E7ECF5; border-color: rgba(255,255,255,.25); align-self: flex-start; }
#theme { margin: 12px 10px 0; align-self: flex-start; background: rgba(255,255,255,.08); }
#theme button { color: #C9D3E3; min-height: 32px; padding: 0 12px; font-size: 12px; }
#theme button.on { background: rgba(61, 214, 140, .22); color: #fff; box-shadow: none; }
main { flex: 1; padding: 22px 28px 40px; min-width: 0; max-width: 1480px; }
.top { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.top h1 { margin: 0; font-size: 22px; font-weight: 900; letter-spacing: -.3px; flex: 1; }
#tick { font-size: 12px; color: var(--mute); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.tabs button { border: 0; border-radius: 0; background: transparent; border-bottom: 3px solid transparent; color: var(--mute); padding: 0 14px; min-height: 44px; }
.tabs button.on { color: var(--green-ink); border-bottom-color: var(--green); }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar > :last-child:not(:first-child) { margin-left: auto; }

/* ---------- Éléments ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; min-width: 0; }
.card + .card, .stack > .card + .card { margin-top: 0; }
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.stack.grow, .grow { flex: 1; min-width: 0; }
.card .stack, .row .stack { gap: 0; }
.right { align-items: flex-end; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; } .row.between { justify-content: space-between; }
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.kpis.six { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.kpis.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
/* Courses et paiements groupés par jour : un intertitre par jour, sur toute la largeur. */
table.by-day tr.day th { text-align: left; font-size: 13px; font-weight: 900; color: var(--ink); background: var(--bg); padding: 10px 8px; border-bottom: 1px solid var(--line); }
table.by-day tbody + tbody tr.day th { border-top: 12px solid var(--card); }
.kpi .label { font-size: 13px; font-weight: 700; color: var(--mute); }
.kpi .value { font-size: 28px; font-weight: 900; letter-spacing: -.5px; margin: 2px 0; font-variant-numeric: tabular-nums; }
.kpis.six .value { font-size: 24px; }
.kpi .delta { font-size: 12px; font-weight: 800; }
.cols-2-1 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; margin-bottom: 16px; }
.cols-3 { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.seg { display: inline-flex; background: var(--chip); border-radius: 22px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; color: var(--mute); min-height: 36px; border-radius: 18px; padding: 0 14px; font-size: 13px; }
.seg button.on { background: var(--card); color: var(--green-ink); box-shadow: 0 1px 3px rgba(4,30,22,.12); }
.seg button.on.none { color: var(--bad); }
.seg.small button { min-height: 32px; padding: 0 10px; font-size: 12px; }
/* Dans un tableau, les deux positions restent côte à côte. */
td .seg { flex-wrap: nowrap; white-space: nowrap; }
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 800; padding: 2px 9px; border-radius: 10px; white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.p-free { background: var(--green-soft); color: var(--green-ink); }
.p-ride { background: var(--info-soft); color: var(--info); }
.p-pause { background: var(--warn-soft); color: var(--warn-ink); }
.p-off { background: var(--chip); color: var(--mute); }
.p-bad { background: var(--bad-soft); color: var(--bad); }
.tag { padding: 2px 8px; border-radius: 10px; border: 1px solid var(--line2); font-size: 12px; font-weight: 700; white-space: nowrap; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--green-soft); color: var(--green-ink); display: inline-grid; place-items: center; font-weight: 900; font-size: 13px; flex-shrink: 0; }
.avatar.big { width: 60px; height: 60px; font-size: 21px; }
.title { font-size: 19px; font-weight: 900; }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 800; color: var(--green-ink); }
.live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 3px rgba(61,214,140,.25); }
h2 .live { margin-left: auto; }
.empty { color: var(--mute); margin: 6px 0; }
.empty.ok::before { content: "✓ "; color: var(--green-ink); font-weight: 900; }
.note { background: var(--bg); border-radius: 12px; padding: 10px 12px; font-size: 13px; }
table { border-collapse: collapse; width: 100%; }
th { text-align: left; font-size: 12px; color: var(--mute); font-weight: 800; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.wrap { white-space: normal; min-width: 220px; }
td.wrap.narrow { min-width: 150px; }
.nowrap, td.nowrap { white-space: nowrap; }
td .row { white-space: nowrap; }
tr.link { cursor: pointer; } tr.link:hover td { background: var(--bg); }
.card > table { display: table; }
.card { overflow-x: auto; }
table.kv td:first-child { color: var(--mute); white-space: nowrap; width: 1%; }
/* Fiches côte à côte (support) : même colonne d'intitulés d'une carte à l'autre. */
.stack > .card > table.kv td:first-child { width: 96px; }
/* Le texte des tableaux part du même bord que le titre de la carte. Les listes cliquables gardent
   leur marge : le fond de survol en a besoin. */
table:not(:has(tr.link)) :is(th, td):first-child { padding-left: 0; }
table:not(:has(tr.link)) :is(th, td):last-child { padding-right: 0; }
.kv-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 10px 0; }
.kv-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kv-grid > div { background: var(--bg); border-radius: 12px; padding: 8px 10px; display: flex; flex-direction: column; }
.kv-grid b { font-size: 16px; font-weight: 900; }
.line { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.line:last-child { border-bottom: 0; }
/* Plusieurs actions dans une cellule : côte à côte s'il y a la place, sinon l'une sous l'autre. */
.actions { display: flex; flex-wrap: wrap; gap: 6px; }
/* Tarifs de location : neuf champs sur une ligne, ou cinq puis quatre, jamais sept puis deux. */
#rf legend { margin-bottom: 6px; }
.rate-grid { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 8px; align-items: end; }
@media (max-width: 1500px) { .rate-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
@media (max-width: 700px) { .rate-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* Pièces du chauffeur : pastilles de même largeur, les noms des pièces partent du même bord. */
.line > .pill:first-child { min-width: 96px; justify-content: center; }
.alert { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); align-items: flex-start; color: inherit; text-decoration: none; }
.alert:last-of-type { border-bottom: 0; }
.alert > span:last-child { display: flex; flex-direction: column; }
.alert .ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; font-weight: 900; }
.ico.bad { background: var(--bad-soft); color: var(--bad); } .ico.warn { background: var(--warn-soft); color: var(--warn-ink); } .ico.info { background: var(--info-soft); color: var(--info); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; font-weight: 700; margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
svg .grid-line { stroke: var(--line); } svg .axis { font-size: 11px; fill: var(--mute); font-family: Nunito, sans-serif; } svg .axis.strong { font-weight: 800; fill: var(--ink); }
svg .bar { fill: var(--bar); } svg .bar-now { fill: var(--green); }
.sw-rides { fill: var(--green); background: var(--green); } .sw-rentals { fill: var(--rentals); background: var(--rentals); }
.head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
/* Sur écran étroit, la note et « Appeler » passent sous le nom au lieu de le couper mot par mot. */
.head > .stack.grow { flex: 1 1 200px; }

/* ---------- Carte ---------- */
.map-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; }
.map-card { padding: 0; overflow: hidden; position: relative; display: flex; flex-direction: column; }
/* Sélecteur Plan / Satellite posé sur la carte : fond plein pour rester lisible sur les photos. */
.leaflet-control.basemap-switch { background: var(--card); box-shadow: 0 2px 8px rgba(4,30,22,.25); flex-wrap: nowrap; }
.leaflet-control.basemap-switch button { min-height: 32px; padding: 0 12px; font-size: 12px; font-weight: 800; }
.leaflet-control.basemap-switch button.on { background: var(--green); color: var(--on-green); }
/* La carte remplit son cadre, même quand le panneau de droite le fait grandir (22/11). */
#livemap { flex: 1; height: calc(100vh - 170px); min-height: 520px; }
.map-legend { position: absolute; left: 12px; bottom: 12px; background: var(--card); border-radius: 12px; padding: 8px 12px; z-index: 500; margin: 0; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: -1px; }
.dot.free { background: #8CC63F; } .dot.ride { background: #2457C5; } .dot.off { background: #8A968F; } .dot.vehicle { background: #003366; border-radius: 3px; } .dot.wait { background: #fff; border: 3px solid #B3261E; }
.pin { display: block; width: 24px; height: 24px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 2px 6px rgba(4,30,22,.35); }
.pin.free { background: #8CC63F; } .pin.ride { background: #2457C5; } .pin.off { background: #8A968F; } .pin.vehicle { background: #003366; border-radius: 6px; }
.pin.wait { background: #fff; border: 5px solid #B3261E; width: 20px; height: 20px; margin: 2px; }
/* Attente anormale (22/11) : repère plein, pour se distinguer sans dépendre de la seule nuance. */
.pin.wait.stale { background: #B3261E; border-color: #fff; width: 24px; height: 24px; margin: 0; }
.dot.wait.stale { background: #B3261E; border: 2px solid #fff; box-shadow: 0 0 0 1px #B3261E; }
.pin.pickup { background: #fff; border: 5px solid #8CC63F; width: 20px; height: 20px; margin: 2px; }
.pin.drop { background: #F2B705; border-color: #003366; border-radius: 4px; }
.dot.pickup { background: #fff; border: 3px solid #8CC63F; } .dot.drop { background: #F2B705; border: 2px solid #003366; }
#drvlive-map { height: 380px; border-radius: 12px; }
.ride-live { margin-bottom: 12px; }
.pin.sel { outline: 5px solid rgba(36,87,197,.35); }
.leaflet-container { font-family: Nunito, sans-serif; }

/* ---------- Support ---------- */
.support-cols { display: grid; grid-template-columns: 320px minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.queue { display: flex; flex-direction: column; gap: 8px; max-height: calc(100vh - 170px); overflow-y: auto; }
.q { display: flex; flex-direction: column; align-items: stretch; text-align: left; gap: 2px; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); white-space: normal; min-height: 0; font-weight: 600; }
.q.on { border: 2px solid var(--green); background: var(--green-soft); }
.conversation { display: flex; flex-direction: column; min-height: 520px; }
.msgs { display: flex; flex-direction: column; gap: 10px; flex: 1; overflow-y: auto; padding: 12px 0; max-height: calc(100vh - 360px); }
.m { max-width: 76%; padding: 10px 12px; border-radius: 14px; display: flex; flex-direction: column; }
.m.in { background: var(--bg); align-self: flex-start; border-bottom-left-radius: 4px; }
.m.out { background: var(--green); color: var(--on-green); align-self: flex-end; border-bottom-right-radius: 4px; }
.m .t { font-size: 11px; opacity: .8; margin-top: 3px; }
.compose { border-top: 1px solid var(--line); padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { min-height: 32px; font-size: 12px; padding: 0 10px; border-radius: 16px; white-space: normal; text-align: left; }

/* ---------- Équipe ---------- */
.team-cols { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 16px; align-items: start; }
.member { display: flex; width: 100%; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; border: 0; background: transparent; text-align: left; font-weight: 600; min-height: 56px; white-space: normal; }
.member.on { background: var(--green-soft); }
.cols-access { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 24px; }
/* Le nom garde sa largeur ; les boutons passent dessous plutôt que d'écraser le nom. */
.team-cols .row.wrap > .stack.grow { flex: 1 1 240px; min-width: 0; }
/* Modules et données sensibles côte à côte seulement quand les sélecteurs tiennent sur leur ligne. */
@media (max-width: 1500px) { .cols-access { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 1200px) { .team-cols { grid-template-columns: minmax(0, 1fr); } }
.switch { flex-direction: row; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); color: var(--ink); font-size: 14px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 40px; height: 24px; border-radius: 12px; background: var(--line2); position: relative; flex-shrink: 0; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: left .15s; }
.switch input:checked + .track { background: var(--green); } .switch input:checked + .track::after { left: 19px; }
.switch input:focus-visible + .track { outline: 3px solid var(--info); outline-offset: 2px; }
.switch input:disabled + .track { opacity: .6; }
/* Interrupteur dans une cellule de tableau : sans le trait ni la marge de la liste des droits. */
.switch.inline-switch { display: inline-flex; padding: 0; border-bottom: 0; gap: 10px; white-space: nowrap; font-weight: 700; }

/* ---------- États ---------- */
.skeleton { display: flex; flex-direction: column; gap: 12px; }
.skeleton div { height: 18px; border-radius: 8px; background: linear-gradient(90deg, var(--chip), var(--bg), var(--chip)); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
.skeleton div:nth-child(2) { width: 70%; } .skeleton div:nth-child(3) { width: 45%; }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton div { animation: none; } }
.failure { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 12px 18px; border-radius: 14px; font-weight: 700; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 1000; max-width: calc(100% - 32px); }
#toast.on { opacity: 1; }
#update { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 1001; display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--card); color: var(--ink); border: 1px solid var(--line2); border-radius: 14px; padding: 10px 12px 10px 16px; font-weight: 700;
  box-shadow: 0 6px 24px rgba(4,30,22,.18); max-width: calc(100% - 32px); }
#update.hide { display: none; }
#update span { flex: 1 1 300px; }
@media (min-width: 701px) { #update { width: max-content; max-width: min(880px, calc(100% - 32px)); } }

/* ---------- Formulaires et fenêtres des vues reprises ---------- */
form.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: 12px; }
/* Boutons sur la ligne des champs, pas sur celle des aides placées sous un champ (21/11) :
   décalés de la hauteur de l'intitulé (16 px) et de l'écart qui le suit (4 px). */
form.grid > button { align-self: start; margin-top: 20px; }
dialog { border: 1px solid var(--line); border-radius: 16px; background: var(--card); color: var(--ink); max-width: 460px; width: calc(100% - 32px); padding: 18px; }
dialog form { display: flex; flex-direction: column; gap: 10px; }
dialog .actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
dialog.wide { max-width: 760px; max-height: calc(100vh - 48px); overflow-y: auto; }
.fault { background: var(--bad-soft); color: var(--bad); border: 1.5px solid var(--bad); border-radius: 12px; padding: 10px 14px; margin: 6px 0; }
.fault ul, .fault p { margin: 4px 0 0; } .fault ul { padding-left: 18px; }
.tgroup { font-size: 14px; font-weight: 900; margin: 14px 0 6px; }
/* Largeurs fixes : les colonnes restent alignées d'un groupe à l'autre. */
table.tdata { width: 100%; table-layout: fixed; }
table.tdata th:nth-child(1) { width: 46%; } table.tdata th:nth-child(2) { width: 34%; }
table.tdata td { overflow-wrap: anywhere; }
dialog::backdrop { background: rgba(4, 18, 14, .45); }
#view > .card + .card, #view > .card + h2, #view > h2 + .card { margin-top: 12px; }

/* ---------- Écrans étroits ---------- */
@media (max-width: 1200px) {
  .kpis, .kpis.six { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpis.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols-3 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .support-cols { grid-template-columns: 280px minmax(0, 1fr); }
  .support-cols > :last-child { grid-column: 1 / -1; }
  .map-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .shell { flex-direction: column; }
  aside { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; flex-wrap: wrap; padding: 10px 12px; }
  .brand { padding: 0 10px 0 0; }
  #menu { flex-direction: row; overflow-x: auto; flex: 1 1 100%; order: 3; }
  #menu a span:not(.count) { white-space: nowrap; }
  #who { margin: 0 0 0 auto; flex-direction: row; gap: 6px; }
  #out, #theme { margin: 0; }
  main { padding: 16px; }
  .cols-2-1, .cols-3, .team-cols, .cols-access, .support-cols { grid-template-columns: minmax(0, 1fr); }
  .kpis, .kpis.six { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #livemap { height: 60vh; min-height: 360px; }
}
/* Sur téléphone, chaque ligne de tableau devient une fiche : l'intitulé passe devant la valeur. */
@media (max-width: 700px) {
  /* 16 px au moins : en dessous, l'iPhone agrandit la page à chaque saisie. */
  input, select, textarea { font-size: 16px; }
  .card table, .card tbody, .card tr, .card td { display: block; width: 100%; }
  .card thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .card tr { padding: 8px 0; border-bottom: 1px solid var(--line); }
  .card td { display: grid; grid-template-columns: 38% 1fr; gap: 8px; border: 0; padding: 4px 0; white-space: normal; overflow-wrap: anywhere; text-align: left !important; }
  .card td[data-label]::before { content: attr(data-label); color: var(--mute); font-weight: 700; }
  .card td:not([data-label]) { display: block; }
  .card td button { margin: 0 6px 6px 0; }
  .kpis, .kpis.six { grid-template-columns: minmax(0, 1fr); }
  /* Courses et paiements : les quatre chiffres en deux colonnes, pour garder la liste en vue. */
  .kpis.four { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpis.four .kpi { padding: 12px; } .kpis.four .value { font-size: 22px; }
  table.by-day tr.day th { display: block; white-space: normal; }
  input[type=search] { min-width: 0; width: 100%; }
  /* Périodes sur une ligne qui défile, plutôt qu'une position isolée sur une deuxième ligne. */
  .toolbar .seg { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; }
  .toolbar .seg button { flex-shrink: 0; }
  /* Les statuts portent leur nombre : sur plusieurs lignes plutôt qu'à moitié cachés. */
  #rides-status, #pay-status { flex-wrap: wrap; overflow: visible; }
}
