/* Espace flotte : carte en direct, revenus, documents. Tokens de app.css, mise en page de web.css. */

.fleet-main { padding-bottom: 60px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.panel-head.wrap { flex-wrap: wrap; }
.panel-head h2, .panel-head h3 { margin: 0; }
.panel-head .btn { width: auto; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.head-actions .btn { width: auto; }
.nav-count:empty { display: none; }
.nav-count { display: inline-block; min-width: 18px; padding: 0 6px; margin-left: 4px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 11px; line-height: 18px; text-align: center; }

/* Carte : une seule instance, déplacée d'un emplacement à l'autre */
.map-slot { height: 360px; border-radius: 16px; overflow: hidden; position: relative; background: var(--track); }
.map-slot-tall { height: calc(100vh - 190px); min-height: 420px; }
.map-slot .map-box, #fleetMap { height: 100%; width: 100%; border-radius: 0; }
body > #fleetMap { position: absolute; left: -9999px; width: 600px; height: 400px; }
.state-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: 13px; color: var(--ink-2); }
.state-legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; background: var(--ink-3); flex: none; }
.dot.on_trip { background: var(--primary); }
.dot.online { background: var(--success); }
.dot.offline { background: var(--line-strong); }
.dot.suspended { background: var(--ink); }
.fleet-car.alert::before {
  content: ''; position: absolute; top: -9px; right: -9px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--danger); border: 2px solid var(--surface); z-index: 1; animation: fleet-pulse 1.4s ease-in-out infinite;
}
.fleet-car.focus::after { border-width: 3.5px; inset: -7px; }
@keyframes fleet-pulse { 50% { transform: scale(1.35); } }
@media (prefers-reduced-motion: reduce) { .fleet-car.alert::before { animation: none; } }

/* Carte en direct */
.live-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; }
.live-map-panel { padding: 0; overflow: hidden; }
.live-side { display: flex; flex-direction: column; max-height: calc(100vh - 150px); padding: 16px; }
.live-counts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 12px; }
.live-counts div { background: var(--bg); border-radius: 12px; padding: 8px; text-align: center; }
.live-counts b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; }
.live-counts span { font-size: 11px; color: var(--ink-2); display: inline-flex; gap: 4px; align-items: center; }
.driver-list { list-style: none; margin: 10px 0 0; padding: 0; overflow-y: auto; flex: 1; }
.driver-list li { padding: 10px; border-radius: 12px; cursor: pointer; display: grid; grid-template-columns: auto 1fr auto; gap: 4px 10px; align-items: center; }
.driver-list li:hover, .driver-list li.sel { background: var(--bg); }
.driver-list li .dot { grid-row: span 2; }
.driver-list .nm { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.driver-list .meta { grid-column: 2 / 4; font-size: 12px; color: var(--ink-2); }
.driver-list .flags { grid-column: 2 / 4; display: flex; flex-wrap: wrap; gap: 4px; }
.driver-list .bat { font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
@media (max-width: 900px) {
  .live-grid { grid-template-columns: 1fr; }
  .map-slot-tall { height: 55vh; min-height: 300px; }
  .live-side { max-height: none; }
}

.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; background: var(--track); border-radius: 12px; padding: 3px; }
.seg button { border: 0; background: none; padding: 7px 11px; border-radius: 9px; font-weight: 600; font-size: 13px; color: var(--ink-2); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.seg-sm button { padding: 5px 9px; font-size: 12px; }
.rev-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.custom-range { display: flex; gap: 6px; align-items: center; }
.custom-range input { padding: 7px 8px; border-radius: 10px; border: 1.5px solid var(--border); background: var(--surface); color: var(--ink); }
.custom-range .btn { width: auto; }
.history-tools { display: flex; gap: 8px; align-items: center; }
.history-tools input { padding: 7px 8px; border-radius: 10px; border: 1.5px solid var(--border); background: var(--surface); color: var(--ink); }

.kpis-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1000px) { .kpis-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.mini-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin: 12px 0; }
.mini-kpis div { background: var(--bg); border-radius: 12px; padding: 10px 12px; }
.mini-kpis b { display: block; font-size: 18px; font-variant-numeric: tabular-nums; }
.mini-kpis span { font-size: 12px; color: var(--ink-2); }

/* Graphiques : une seule série, un seul axe, info au survol */
.chart { position: relative; height: 170px; }
.chart-lg { height: 240px; }
.chart svg { width: 100%; height: 100%; overflow: visible; display: block; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .axis-label { fill: var(--ink-3); font-size: 11px; }
.chart .bar { fill: var(--primary); }
.chart .bar.zero { fill: var(--line-strong); }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover + .bar, .chart .bar.hover { fill: var(--primary-hover); }
.chart-empty { display: flex; height: 100%; align-items: center; justify-content: center; color: var(--ink-3); font-size: 14px; }
.chart-tip {
  position: fixed; z-index: 100; pointer-events: none; background: var(--ink); color: var(--surface); padding: 8px 10px;
  border-radius: 10px; font-size: 12px; line-height: 1.45; box-shadow: var(--shadow); max-width: 240px;
}
.chart-tip b { font-size: 13px; }
.hbar { height: 6px; border-radius: 3px; background: var(--primary); margin-top: 5px; min-width: 2px; }

/* Listes */
.alert-list, .stop-list, .pending-list { list-style: none; margin: 0; padding: 0; }
.alert-list li, .stop-list li, .pending-list li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.alert-list li:last-child, .stop-list li:last-child, .pending-list li:last-child { border-bottom: 0; }
.alert-list .lvl { flex: none; margin-top: 2px; }
.alert-list .lvl.critical { color: var(--danger); }
.alert-list .lvl.warning { color: var(--warning-ink); }
.alert-list button { margin-left: auto; }
.stop-list .t { font-variant-numeric: tabular-nums; color: var(--ink-2); min-width: 92px; }
.pending-list .grow { flex: 1; min-width: 0; }
.pending-list .row-actions { flex: none; }
.progress { height: 6px; border-radius: 3px; background: var(--track); overflow: hidden; margin-top: 6px; max-width: 240px; }
.progress i { display: block; height: 100%; background: var(--success); }
.empty-line { color: var(--ink-3); font-size: 14px; padding: 8px 0; }

.flag { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: var(--track); color: var(--ink-2); }
.flag.critical { background: var(--danger-50); color: var(--danger); }
.flag.warning { background: var(--warning-50); color: var(--warning-ink); }

.doc-inputs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.doc-input { border: 1.5px dashed var(--border); border-radius: 12px; padding: 10px 12px; font-size: 13px; }
.doc-input.has { border-style: solid; border-color: var(--success); }
.doc-input b { display: block; margin-bottom: 6px; }
.doc-input .row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.doc-input input[type="date"] { padding: 5px 6px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--ink); font-size: 12px; }
.doc-input input[type="file"] { font-size: 12px; max-width: 100%; }
.doc-input .req { color: var(--danger); }
@media (max-width: 720px) { .doc-inputs { grid-template-columns: 1fr; } }

/* Tableaux en cartes sur téléphone */
@media (max-width: 720px) {
  table.resp thead { display: none; }
  table.resp, table.resp tbody, table.resp tr, table.resp td { display: block; width: 100%; }
  table.resp tr { border: 1px solid var(--line); border-radius: 14px; padding: 6px 10px; margin-bottom: 10px; }
  table.resp td { border: 0; padding: 5px 0; text-align: left; }
  table.resp td.num { text-align: left; }
  table.resp td[data-l]::before { content: attr(data-l); display: block; font-size: 11px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
  table.resp .row-actions { justify-content: flex-start; flex-wrap: wrap; }
  .kpi .v { font-size: 22px; }
}
.linkish { background: none; border: 0; padding: 0; color: var(--primary-text); font-weight: 700; cursor: pointer; text-align: left; }
.flags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
/* Le marqueur voiture doit épouser l'icône (sinon l'anneau d'état s'étire sur toute la carte). */
.fleet-car { width: max-content; height: max-content; }
.alert-list .btn { width: auto; flex: none; }

/* Dépôt de pièce : bouton « Ajouter une photo » avec aperçu (au lieu du champ fichier natif). */
.doc-pick { position: relative; display: inline-flex; align-items: center; gap: 10px; padding: 6px 12px 6px 6px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--ink); font-size: 13px; font-weight: 600; cursor: pointer; min-height: 48px; }
.doc-pick:hover { border-color: var(--primary); }
.doc-pick:focus-within { outline: 2px solid var(--primary); outline-offset: 2px; }
.doc-pick input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.doc-pick img, .doc-pick .doc-cam, .doc-pick .doc-pdf { width: 36px; height: 36px; border-radius: 6px; object-fit: cover; flex: 0 0 auto; }
.doc-pick .doc-cam, .doc-pick .doc-pdf { display: inline-flex; align-items: center; justify-content: center; background: var(--bg); color: var(--primary); }
.doc-input label.small { display: inline-flex; flex-direction: column; gap: 4px; }
.doc-input input[type="date"] { min-height: 40px; padding: 6px 10px; font: inherit; font-size: 13px; }

/* ---------- Carte en direct : plein écran (Fullscreen API ou repli CSS) ---------- */
.live-map-panel { position: relative; }
.fs-tools { position: absolute; top: 12px; right: 12px; display: flex; gap: 8px; z-index: 5; }
.fs-btn { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; box-shadow: var(--shadow); cursor: pointer; }
.fs-btn:hover { border-color: var(--primary); }
.fs-only { display: none !important; }
.follow-chip { position: absolute; left: 12px; top: 12px; z-index: 5; background: var(--ink); color: var(--surface); border-radius: 999px;
  padding: 6px 8px 6px 12px; font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 8px; box-shadow: var(--shadow); }
.follow-chip button { border: 0; background: rgba(255, 255, 255, .15); color: inherit; border-radius: 999px; padding: 3px 9px; font-weight: 700; cursor: pointer; }
.live-search { width: 100%; padding: 9px 12px; border-radius: 10px; border: 1.5px solid var(--border); background: var(--surface); color: var(--ink); margin: 0 0 10px; font: inherit; }
.live-counts div { cursor: pointer; }
.live-counts div.on { outline: 2px solid var(--primary); }
.live-counts { grid-template-columns: repeat(4, 1fr); }
.traffic-box { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; font-size: 12px; }
.traffic-box:empty { display: none; }
.traffic-box span { display: inline-flex; align-items: center; gap: 4px; padding: 4px 9px; border-radius: 999px; background: var(--bg); font-weight: 600; }
.traffic-box span.warn { background: var(--warning-50); color: var(--warning-ink); }
.live-alerts { margin-top: 10px; font-size: 13px; }
.live-alerts summary { cursor: pointer; font-weight: 700; padding: 4px 0; }
.live-alerts .alert-list li { padding: 6px 0; font-size: 13px; }
.sheet-grip { display: none; }
.side-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.side-head .btn { width: auto; }

#liveShell.fs { position: fixed; inset: 0; z-index: 400; margin: 0; gap: 0; background: var(--bg);
  grid-template-columns: 360px minmax(0, 1fr); grid-template-areas: "side map"; }
#liveShell.fs .fs-only { display: flex !important; }
#liveShell.fs .live-map-panel { grid-area: map; border-radius: 0; border: 0; margin: 0; }
#liveShell.fs .map-slot-tall { height: 100vh; min-height: 0; border-radius: 0; }
#liveShell.fs .live-side { grid-area: side; border-radius: 0; margin: 0; max-height: 100vh; height: 100vh; border-width: 0 1px 0 0; }
#liveShell.fs.side-collapsed { grid-template-columns: 0 minmax(0, 1fr); }
#liveShell.fs.side-collapsed .live-side { display: none; }
@media (max-width: 720px) {
  #liveShell.fs { grid-template-columns: 1fr; grid-template-areas: "map"; }
  #liveShell.fs .live-side { position: fixed; left: 0; right: 0; bottom: 0; top: auto; height: var(--sheet-h, 42vh); max-height: 88vh;
    border-radius: 18px 18px 0 0; border-width: 1px 0 0; box-shadow: var(--shadow-lg); z-index: 6; padding-top: 4px; overflow-y: auto; overscroll-behavior: contain; }
  #liveShell.fs .sheet-grip { position: sticky; top: -4px; background: var(--surface); z-index: 1; touch-action: none; }
  #liveShell.fs .driver-list { overflow: visible; flex: none; }
  #liveShell.fs .sheet-grip { display: flex; justify-content: center; padding: 6px 0 10px; cursor: grab; }
  #liveShell.fs .sheet-grip i { width: 44px; height: 5px; border-radius: 3px; background: var(--line-strong); }
  #liveShell.fs.side-collapsed .live-side { display: flex; height: 64px; overflow: hidden; }
}

/* Historique sur une période : jours cliquables (pagination par jour), export CSV */
.history-tools { flex-wrap: wrap; }
.history-tools .btn { width: auto; }
.history-days { max-height: 320px; overflow-y: auto; }
.history-days tr[data-day] { cursor: pointer; }
.history-days tr[data-day].sel td { background: var(--primary-50); }
.head-actions select { padding: 7px 10px; border-radius: 10px; border: 1.5px solid var(--border); background: var(--surface); color: var(--ink); font: inherit; font-size: 13px; }
.leg-trip { color: var(--primary-text); font-weight: 700; }
.leg-empty { color: var(--ink-2); font-weight: 700; }
.stop-list .btn, .stop-list a.btn { width: auto; flex: none; margin-left: auto; }
.stop-list li > span:not(.t) { flex: 1; min-width: 0; }

/* Aide « Où trouver ce document ? », liste des pièces obligatoires, blocages expliqués, résultat de recherche d'un chauffeur */
.field-help { margin-top: 6px; font-size: 12px; color: var(--ink-2); }
.field-help summary { cursor: pointer; font-weight: 600; color: var(--primary); }
.field-help[open] { background: var(--bg); border-radius: 10px; padding: 8px 10px; }
.doc-summary { background: var(--bg); border-radius: 12px; padding: 12px 14px; margin: 8px 0 14px; }
.doc-summary ul { margin: 6px 0; padding-left: 18px; font-size: 13px; }
.block-note { margin-top: 6px; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; font-size: 12px; color: var(--ink-2); max-width: 280px; }
.block-note b { color: var(--danger); }
.block-note .btn { width: auto; }
.lookup-note { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: var(--bg); font-size: 13px; margin: 10px 0; }
.lookup-note.warn { background: color-mix(in srgb, var(--warning, #f59e0b) 14%, transparent); }
#dlgDriver .grid .f .btn { width: auto; }
.web-header #langSwitch:empty { display: none; }

/* ======================================================================
   Espace flotte v2 : menu latéral (barre fixe repliable, tiroir ≤ 900 px),
   en-tête de l'entreprise, onglet Sécurité. Couleur Drivo #c8102e.
   ====================================================================== */
.fleet-page {
  --primary: #c8102e; --primary-hover: #a80d26; --primary-pressed: #8a0b1f; --brand: #c8102e;
  --fl-brand: #c8102e; --fl-brand-ink: #b00e28; --fl-brand-soft: rgba(200, 16, 46, .08); --fl-brand-line: rgba(200, 16, 46, .28);
  --fl-side: 252px; --fl-side-mini: 76px; --fl-top: 64px;
}
@media (prefers-color-scheme: dark) {
  .fleet-page { --fl-brand-ink: #ff8595; --fl-brand-soft: rgba(255, 110, 130, .13); --fl-brand-line: rgba(255, 110, 130, .35); --primary-text: #ff8595; }
}
.fleet-page :focus-visible { outline: 2px solid var(--fl-brand); outline-offset: 2px; border-radius: 8px; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 500; background: var(--surface); color: var(--ink); padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow); font-weight: 700; }
.skip-link:focus { top: 10px; }
.fl-ic { display: inline-flex; flex: none; width: 20px; height: 20px; align-items: center; justify-content: center; }

/* Barre du haut : l'essentiel (logo, langue, compte) */
.fleet-top { height: var(--fl-top); padding: 0 20px; gap: 12px; z-index: 60; flex-wrap: nowrap !important; }
.fleet-top .logo { font-size: 22px; }
.fl-menu-btn { width: 44px; height: 44px; border-radius: 12px; display: none; align-items: center; justify-content: center; color: var(--ink); }
.fl-menu-btn:hover { background: var(--track); }
.fl-user { display: flex; align-items: center; gap: 10px; min-width: 0; }
.fl-user .who { font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.fl-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--track); color: var(--ink-2); font-size: 13px; font-weight: 800; display: grid; place-items: center; flex: none; }
.fl-user .btn { width: auto; display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; font-size: 13px; }
.fl-user .btn .fl-ic { width: 16px; height: 16px; }
.fl-user .btn svg { width: 16px; height: 16px; }

/* Menu latéral */
.fl-side { position: fixed; z-index: 40; left: 0; top: var(--fl-top); bottom: 0; width: var(--fl-side); background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; transition: width .2s ease, transform .22s ease; }
.fl-side-head { display: none; }
#nav { flex: 1; overflow-y: auto; padding: 14px 12px 12px; overscroll-behavior: contain; }
.fl-group + .fl-group { margin-top: 14px; }
.fl-group-t { margin: 0 12px 6px; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); white-space: nowrap; }
.fl-group ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
#nav button { position: relative; width: 100%; display: flex; align-items: center; gap: 12px; padding: 9px 12px; min-height: 42px; border-radius: 10px;
  color: var(--ink-2); font-weight: 600; font-size: 14px; text-align: left; }
#nav button:hover { background: var(--track); color: var(--ink); }
#nav button.on { background: var(--fl-brand-soft); color: var(--fl-brand-ink); }
#nav button.on::before { content: ''; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--fl-brand); }
#nav button .fl-l { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#nav .nav-count { margin-left: auto; background: var(--fl-brand); min-width: 20px; line-height: 20px; font-weight: 800; }
.fl-collapse { display: flex; align-items: center; gap: 12px; margin: 0 12px 14px; padding: 9px 12px; border-radius: 10px; color: var(--ink-3); font-size: 13px; font-weight: 600; border-top: 1px solid var(--line); border-radius: 0; padding-top: 14px; }
.fl-collapse:hover { color: var(--ink); }
.fl-collapse .fl-ic { transition: transform .2s ease; }
.fl-scrim { position: fixed; inset: 0; z-index: 280; background: rgba(20, 20, 24, .45); }

body.fl-in .fleet-main { margin-left: var(--fl-side); max-width: none; transition: margin-left .2s ease; }
body.fl-in .fleet-main > * { max-width: 1240px; margin-left: auto; margin-right: auto; }
body.fl-in .fleet-main > section.panel, body.fl-in .fleet-main > .panel { max-width: 1240px; }

/* Replié : icônes seules, libellés en info-bulle (title), pastille en coin */
@media (min-width: 901px) {
  body.fl-collapsed .fl-side { width: var(--fl-side-mini); }
  body.fl-collapsed.fl-in .fleet-main { margin-left: var(--fl-side-mini); }
  body.fl-collapsed .fl-group-t { height: 1px; margin: 6px 14px 8px; overflow: hidden; color: transparent; background: var(--line); }
  body.fl-collapsed #nav button { justify-content: center; padding: 10px 0; }
  body.fl-collapsed #nav button .fl-l { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  body.fl-collapsed #nav .nav-count { position: absolute; top: 3px; right: 6px; min-width: 16px; line-height: 16px; font-size: 10px; padding: 0 4px; }
  body.fl-collapsed .fl-collapse { justify-content: center; padding-left: 0; padding-right: 0; }
  body.fl-collapsed .fl-collapse .fl-l { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  body.fl-collapsed .fl-collapse .fl-ic { transform: rotate(180deg); }
}

/* Tiroir (tablette et téléphone) */
@media (max-width: 900px) {
  .fleet-top { padding: 0 12px 0 8px; }
  body.fl-in .fl-menu-btn { display: inline-flex; }
  .fl-side { top: 0; z-index: 300; width: min(300px, 86vw); transform: translateX(-102%); box-shadow: var(--shadow-lg); visibility: hidden; }
  body.fl-drawer-open .fl-side { transform: none; visibility: visible; }
  .fl-side-head { display: flex; align-items: center; justify-content: space-between; height: var(--fl-top); padding: 0 12px 0 24px; border-bottom: 1px solid var(--line); }
  .fl-side-title { font-size: 16px; }
  .fl-side-close { width: 44px; height: 44px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; color: var(--ink); }
  .fl-side-close:hover { background: var(--track); }
  .fl-collapse { display: none; }
  #nav button { min-height: 46px; font-size: 15px; }
  body.fl-in .fleet-main { margin-left: 0; }
  body.fl-drawer-open { overflow: hidden; }
}
@media (max-width: 560px) {
  .fl-user .who, .fl-hide-sm, .fl-avatar { display: none; }
  .fleet-top { gap: 6px; }
  .fl-user .btn { padding: 8px 10px; }
  .fleet-top .logo { font-size: 20px; }
}
@media (prefers-reduced-motion: reduce) { .fl-side, body.fl-in .fleet-main, .fl-collapse .fl-ic { transition: none; } }

/* En-tête de l'entreprise */
.fl-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "id stats" "actions actions"; gap: 18px 24px; align-items: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 22px 24px; margin-bottom: 20px; box-shadow: var(--shadow-sm);
  background-image: linear-gradient(120deg, var(--fl-brand-soft), transparent 42%); }
.fl-head-id { grid-area: id; display: flex; align-items: center; gap: 16px; min-width: 0; }
.fl-logo { width: 60px; height: 60px; border-radius: 16px; flex: none; display: grid; place-items: center; font-size: 22px; font-weight: 900; letter-spacing: -.02em;
  color: #fff; background: linear-gradient(145deg, #e0213f, #c8102e 55%, #8f0a20); box-shadow: 0 6px 16px rgba(200, 16, 46, .25); }
.fl-head-txt { min-width: 0; }
.fl-head h1 { margin: 0; font-size: 22px; line-height: 1.2; letter-spacing: -.02em; overflow-wrap: anywhere; }
.fl-head-meta { margin: 6px 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-size: 13px; }
.fl-status { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px 3px 8px; border-radius: 999px; font-weight: 700; font-size: 12px; }
.fl-status.ok { background: var(--success-50); color: #0f7c52; }
.fl-status.pending { background: var(--warning-50); color: var(--warning-ink); }
@media (prefers-color-scheme: dark) { .fl-status.ok { color: var(--success-bright); } }
.fl-head-stats { grid-area: stats; display: flex; gap: 0; margin: 0; }
.fl-head-stats > div { padding: 2px 18px; border-left: 1px solid var(--line); min-width: 0; }
.fl-head-stats > div:first-child { border-left: 0; padding-left: 0; }
.fl-head-stats dt { font-size: 12px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; }
.fl-head-stats dd { margin: 4px 0 0; font-size: 20px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fl-head-stats dd small { font-size: 14px; color: var(--ink-3); font-weight: 700; }
.fl-head-stats .s { display: block; font-size: 12px; color: var(--ink-2); margin-top: 2px; white-space: nowrap; }
.fl-head-actions { grid-area: actions; position: relative; display: flex; flex-wrap: wrap; gap: 8px; padding-top: 16px; border-top: 1px solid var(--line); }
.fl-head-actions .btn { width: auto; display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; font-size: 14px; border-radius: 11px; }
.fl-head-actions .btn-ghost { background: var(--surface); border: 1px solid var(--line-strong); }
.fl-head-actions .btn-ghost:hover { border-color: var(--fl-brand-line); color: var(--fl-brand-ink); }
.fl-menu-pop { position: absolute; z-index: 30; top: calc(100% + 6px); right: 0; min-width: 240px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; display: grid; }
.fl-menu-pop button { text-align: left; padding: 10px 12px; border-radius: 8px; font-size: 14px; font-weight: 600; }
.fl-menu-pop button:hover, .fl-menu-pop button:focus-visible { background: var(--track); }
@media (max-width: 1180px) {
  .fl-head { grid-template-columns: 1fr; grid-template-areas: "id" "stats" "actions"; }
  .fl-head-stats > div { flex: 1; }
}
@media (max-width: 640px) {
  .fl-head { padding: 16px; gap: 14px; border-radius: 18px; }
  .fl-logo { width: 48px; height: 48px; border-radius: 13px; font-size: 18px; }
  .fl-head h1 { font-size: 19px; }
  .fl-head-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .fl-head-stats > div { border-left: 0; padding: 10px; background: var(--bg); border-radius: 12px; }
  .fl-head-stats > div:first-child { padding-left: 10px; }
  .fl-head-stats dt { font-size: 10px; white-space: normal; }
  .fl-head-stats dd { font-size: 15px; white-space: normal; overflow-wrap: anywhere; }
  .fl-head-stats dd small { font-size: 12px; }
  .fl-head-stats .s { white-space: normal; font-size: 11px; }
  .fl-head-actions { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 14px 16px 2px; scrollbar-width: none; }
  .fl-head-actions::-webkit-scrollbar { display: none; }
  .fl-head-actions .btn { flex: none; white-space: nowrap; }
  .fl-menu-pop { position: fixed; left: 16px; right: 16px; top: auto; bottom: 16px; }
}

/* Primes, sécurité, Ville à ville */
#tabRewards h2:first-child { margin-top: 0 !important; }
.switch-row { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; cursor: pointer; font-size: 14px; }
.switch-row input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--fl-brand); flex: none; }
td select[data-ic-vehicle] { max-width: 210px; padding: 6px 8px; border-radius: 9px; border: 1.5px solid var(--border); background: var(--surface); color: var(--ink); font: inherit; font-size: 13px; }
#sessionsBody tr.cur td { background: var(--fl-brand-soft); }
.audit-list { list-style: none; margin: 0; padding: 0; }
.audit-list li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.audit-list li:last-child { border-bottom: 0; }
.audit-list .audit-ic { flex: none; width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--track); color: var(--ink-2); }
.audit-list li.warn .audit-ic { background: var(--danger-50); color: var(--danger); }
.audit-list .grow { flex: 1; min-width: 0; }
.tips { margin: 0; padding-left: 18px; line-height: 1.7; color: var(--ink-2); font-size: 14px; }
.btn-danger.btn-sm { border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent); }
#dlgConfirm { max-width: 460px; }
#dlgConfirm .seg { margin-top: 4px; }

/* Avertissement de fin de session */
.idle-warn { position: fixed; inset: 0; z-index: 900; display: grid; place-items: center; background: rgba(20, 20, 24, .5); padding: 16px; }
.idle-card { width: min(420px, 100%); background: var(--surface); color: var(--ink); border-radius: 20px; padding: 24px; box-shadow: var(--shadow-lg); }
.idle-card h2 { margin: 0 0 8px; font-size: 22px; }
.idle-card p { margin: 0 0 8px; color: var(--ink-2); }
.idle-card b { color: var(--ink); font-variant-numeric: tabular-nums; }
.idle-card .actions-bar .btn { width: auto; }
#vehiclesBody .ic-cell { margin-top: 8px; display: flex; flex-direction: column; gap: 3px; }
#vehiclesBody .ic-cell select { max-width: 190px; }
/* Téléphone : en-tête complet sur le tableau de bord, identité seule ailleurs (le contenu reste visible). */
@media (max-width: 640px) {
  body:not([data-tab="dashboard"]) .fl-head-stats, body:not([data-tab="dashboard"]) .fl-head-actions { display: none; }
  body:not([data-tab="dashboard"]) .fl-head { margin-bottom: 14px; grid-template-areas: "id"; }
}
/* Liste des chauffeurs : colonne nom lisible à côté du menu latéral */
@media (min-width: 721px) {
  #driversBody td:first-child { min-width: 210px; }
  #driversBody select[data-assign] { max-width: 180px !important; }
  #driversBody .row-actions { flex-wrap: wrap; }
}
