/* MyCourtAccess - Gestion d'académie de tennis
   Design : typographie Geist auto-hébergée, barre latérale claire,
   palette tonale autour du vert court #1F9D6B, modes clair / sombre.
   Base reprise de MyFleetAccess, tokens de couleur re-teintés. */

@font-face {
  font-family: 'Geist';
  src: url('../fonts/geist-var-latin.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0000-00FF, U+2013-2014, U+2018-201A, U+201C-201E, U+2026;
}
@font-face {
  font-family: 'Geist';
  src: url('../fonts/geist-var-latin-ext.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0100-024F, U+1E00-1EFF, U+20AC;
}
@font-face {
  font-family: 'Geist Mono';
  src: url('../fonts/geistmono-var-latin.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  /* neutres froids */
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f1f4f8;
  --ink: #101520;
  --muted: #5c6573;
  --line: #e3e7ed;
  --row-line: #edf0f5;
  --hover: #f4f7fb;

  /* gamme tonale du vert de marque : profond pour les actions, vif pour les accents */
  --primary: #146b4e;
  --primary-dark: #0f5540;
  --accent: #1f9d6b;
  --accent-soft: #e3f5ec;
  --accent-deep: #11624a;
  /* jaune optique : micro-accents seulement (balle, jalons), jamais du texte sur blanc */
  --ball: #b5c400;

  --ok: #178a52;
  --ok-soft: #e0f4e9;
  --warn: #96650f;
  --warn-soft: #fbf0d8;
  --danger: #bb2d24;
  --danger-soft: #fce6e4;
  --info: #22608f;
  --info-soft: #e3eef8;
  --chart-grid: #e8ecf2;

  --shadow: 0 1px 2px rgba(16, 21, 32, .05), 0 5px 18px rgba(16, 21, 32, .06);
  --shadow-lift: 0 4px 10px rgba(16, 21, 32, .09), 0 14px 34px rgba(16, 21, 32, .11);

  --radius: 14px;
  --radius-sm: 9px;
  --font: 'Geist', 'Segoe UI', system-ui, sans-serif;
  --mono: 'Geist Mono', Consolas, ui-monospace, monospace;
}

[data-theme="dark"] {
  --bg: #0c0f15;
  --surface: #131822;
  --surface-2: #1a202c;
  --ink: #e7ebf1;
  --muted: #8b95a5;
  --line: #242c39;
  --row-line: #1f2632;
  --hover: #1b2230;

  --primary: #34c48c;
  --primary-dark: #5fd6a5;
  --accent: #34c48c;
  --accent-soft: #12362a;
  --accent-deep: #9fe8c8;
  --ball: #d7e34a;

  --ok: #4fc98a;
  --ok-soft: #123321;
  --warn: #e2b45f;
  --warn-soft: #33270f;
  --danger: #f0786f;
  --danger-soft: #3b1613;
  --info: #7fb9de;
  --info-soft: #14293c;
  --chart-grid: #222a37;

  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 6px 22px rgba(0, 0, 0, .3);
  --shadow-lift: 0 6px 14px rgba(0, 0, 0, .4), 0 18px 40px rgba(0, 0, 0, .38);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  transition: background .25s, color .25s;
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
.spacer { flex: 1; }
.num { font-family: var(--mono); font-size: 12.5px; font-variant-numeric: tabular-nums; }

h1, h2, h3 { margin: 0; font-weight: 630; letter-spacing: -0.015em; text-wrap: balance; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.brand-logo { height: 44px; width: auto; display: block; }
[data-theme="dark"] .brand-logo { filter: brightness(1.18); }

/* ---------- Connexion ---------- */
.login-screen {
  min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(1000px 560px at 88% -12%, var(--accent-soft) 0%, transparent 58%),
    radial-gradient(760px 430px at -12% 112%, var(--info-soft) 0%, transparent 55%),
    var(--bg);
  padding: 24px;
}
.login-panel {
  width: 414px; max-width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-lift);
  padding: 34px;
}
.login-brand { display: flex; flex-direction: column; gap: 8px; align-items: center; text-align: center; margin-bottom: 24px; }
.login-brand .brand-logo { height: 40px; }
.login-brand .muted { font-size: 12.5px; }
.login-panel h1 { font-size: 23px; font-weight: 660; margin-bottom: 18px; }
.login-form label { display: block; margin-bottom: 14px; font-weight: 550; }
.login-form .input { margin-top: 6px; }
.form-error { color: var(--danger); min-height: 18px; margin: 0 0 10px; font-size: 13px; }
.login-hint { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); }
.login-hint table { width: 100%; margin-top: 8px; border-collapse: collapse; }
.login-hint td { padding: 3px 0; font-size: 12.5px; color: var(--muted); }
.login-hint td.num { text-align: right; color: var(--ink); }

/* ---------- Structure : barre latérale gauche + contenu ---------- */
.app { display: flex; height: 100dvh; overflow: hidden; }

.sidebar {
  width: 234px; flex: none;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  padding: 18px 12px 14px;
}
.brand { padding: 2px 8px 20px; }
.brand .brand-logo { height: 42px; }
/* Logo d'agence (image uploadée) : ratio préservé, plafonné pour tenir dans la barre */
.brand .agency-logo { height: auto; max-height: 52px; max-width: 100%; object-fit: contain; border-radius: 8px; }
[data-theme="dark"] .brand .agency-logo { filter: none; }

.nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9.5px 11px;
  border: 0; background: none;
  border-radius: var(--radius-sm);
  font: inherit; font-size: 13.5px; font-weight: 500;
  color: var(--muted);
  cursor: pointer; text-align: left; white-space: nowrap;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--hover); color: var(--ink); }
.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-weight: 620;
}
.nav-ic { width: 19px; height: 19px; display: inline-flex; flex: none; opacity: .85; }
.nav-item.active .nav-ic { opacity: 1; }
.nav-ic svg { width: 100%; height: 100%; }
.nav-dot {
  margin-left: auto;
  min-width: 17px; height: 17px; padding: 0 5px;
  display: grid; place-items: center;
  background: var(--danger); color: #fff;
  border-radius: 9px; font-size: 10.5px; font-weight: 700;
}

.sidebar-foot { border-top: 1px solid var(--line); padding-top: 12px; }
.user-chip { display: flex; gap: 10px; align-items: center; padding: 0 4px; }
.user-meta { min-width: 0; }
.user-meta strong { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta .muted { font-size: 11.5px; }

.user-btn {
  border: 0; background: none; padding: 0;
  cursor: pointer;
  border-radius: 50%;
}
.user-btn .cli-avatar { width: 36px; height: 36px; border-radius: 50%; transition: box-shadow .15s; }
.user-btn:hover .cli-avatar { box-shadow: 0 0 0 3px var(--accent-soft); }
.user-menu { width: 250px; }
.user-menu-head { padding: 10px 12px 8px; display: flex; flex-direction: column; gap: 2px; }
.user-menu-head strong { font-size: 13.5px; }
.user-menu-head .muted { font-size: 12px; }

.body-col { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: 62px; flex: none;
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px;
  padding: 0 26px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 19px; font-weight: 650; letter-spacing: -.02em; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.main { flex: 1; overflow-y: auto; padding: 24px 28px 44px; scroll-behavior: smooth; }
#view { max-width: 1560px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }

/* ---------- Boutons, champs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px;
  background: var(--primary); color: #fff;
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
  font: inherit; font-weight: 560; font-size: 13.5px;
  cursor: pointer; text-decoration: none;
  transition: background .16s, border-color .16s, transform .07s, box-shadow .16s;
}
[data-theme="dark"] .btn { color: #0a1119; }
.btn:hover { background: var(--primary-dark); border-color: var(--primary-dark); box-shadow: 0 4px 14px color-mix(in srgb, var(--primary) 35%, transparent); }
.btn:active { transform: translateY(1px) scale(.99); box-shadow: none; }
.btn.ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { background: var(--hover); box-shadow: none; }
.btn.small { padding: 5px 12px; font-size: 12.5px; }
.btn.big { padding: 12px 24px; font-size: 14.5px; }
.btn.wide { width: 100%; }
.btn.cta { font-weight: 620; }
.btn { white-space: nowrap; }
.btn.wa { color: #128c4b; border-color: #35b26f66; }
[data-theme="dark"] .btn.wa { color: #4fc98a; }
.danger-text { color: var(--danger) !important; }
.link-btn {
  border: 0; background: none; padding: 0;
  font: inherit; font-size: 12px; font-weight: 600;
  color: var(--accent-deep); cursor: pointer; text-transform: none; letter-spacing: 0;
}
.link-btn:hover { text-decoration: underline; }

.icon-btn {
  min-width: 38px; height: 38px; padding: 0 8px;
  display: inline-grid; place-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink); font-size: 18px;
  cursor: pointer;
  transition: background .15s, transform .07s;
}
.icon-btn:hover { background: var(--hover); }
.icon-btn:active { transform: translateY(1px); }
.icon-btn.lang { font-size: 12px; font-weight: 700; font-family: var(--mono); }
.bell { position: relative; }
.notif-badge {
  position: absolute; top: -6px; right: -6px;
  min-width: 18px; height: 18px; padding: 0 4px;
  display: grid; place-items: center;
  background: var(--danger); color: #fff;
  font-size: 10.5px; font-weight: 700;
  border-radius: 9px; border: 2px solid var(--surface);
}

.input {
  width: 100%;
  padding: 9px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font: inherit; font-size: 13.5px; color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.input::placeholder { color: color-mix(in srgb, var(--muted) 72%, transparent); }
.input.invalid, input.invalid, select.invalid {
  border-color: var(--danger) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 20%, transparent);
  background: var(--danger-soft);
}
textarea.input { resize: vertical; }
.sel { width: auto; min-width: 160px; }
input[type="color"] {
  width: 52px; height: 38px; padding: 3px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); cursor: pointer;
}
.color-field { display: flex; align-items: center; gap: 10px; }
.check-inline { display: flex; align-items: center; gap: 7px; margin-top: 7px; font-weight: 480; font-size: 12.5px; color: var(--muted); }
.check-inline input { width: 15px; height: 15px; accent-color: var(--primary); }
.check-inline label { cursor: pointer; }
.photo-preview { display: block; margin-top: 8px; }
.photo-preview img { height: 84px; border-radius: var(--radius-sm); border: 1px solid var(--line); }

.swatch {
  display: inline-block; width: 11px; height: 11px;
  border-radius: 3px; border: 1px solid var(--line);
  vertical-align: -1px;
}

/* ---------- Cartes, listes, tableaux ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 19px 21px;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 14px;
}
.card-head h2 { font-size: 15.5px; }

.pill {
  padding: 2px 9px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px; font-weight: 620;
  font-variant-numeric: tabular-nums;
}
.pill.danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar .input[type="search"] { max-width: 340px; }

.table-wrap { overflow-x: auto; margin: -4px; padding: 4px; }
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; padding: 9px 10px;
  font-size: 11px; font-weight: 620; color: var(--muted);
  text-transform: uppercase; letter-spacing: .07em;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table td { padding: 10.5px 10px; border-bottom: 1px solid var(--row-line); vertical-align: middle; }
.table tbody tr { cursor: pointer; transition: background .12s; }
.table tbody tr.no-click { cursor: default; }
.table tbody tr:hover { background: var(--hover); }
.table tbody tr:last-child td { border-bottom: 0; }

.cell-veh { display: flex; align-items: center; gap: 10px; }

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px; font-weight: 600;
  white-space: nowrap;
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.neutral { background: var(--surface-2); color: var(--muted); }
.badge.muted-b { background: var(--surface-2); color: var(--muted); text-decoration: line-through; }
.badge.accent-b { background: var(--accent-soft); color: var(--accent-deep); }
.badge.float { position: absolute; top: 10px; right: 10px; }
.badge.wa-badge { background: #e7f8ee; color: #128c4b; font-size: 10px; padding: 2px 6px; }
[data-theme="dark"] .badge.wa-badge { background: #10301d; color: #4fc98a; }

.list { display: flex; flex-direction: column; }
.list-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 2px;
  border-bottom: 1px solid var(--row-line);
}
.list-row:last-child { border-bottom: 0; }
.list-row.clickable { cursor: pointer; border-radius: var(--radius-sm); transition: background .12s; }
.list-row.clickable:hover { background: var(--hover); }
.list-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.list-main strong { font-size: 13.5px; font-weight: 580; }
.list-main .muted { font-size: 12px; }
.rank {
  width: 24px; height: 24px; flex: none;
  display: grid; place-items: center;
  background: var(--surface-2); border-radius: 7px;
  font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.scroll-y { overflow-y: auto; }
.empty { color: var(--muted); padding: 18px 4px; margin: 0; }

/* ---------- KPI ---------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
}
.kpi-grid.four { grid-template-columns: repeat(4, 1fr); }
.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 17px 14px;
  display: flex; flex-direction: column; gap: 3px;
  transition: transform .18s, box-shadow .18s;
}
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.kpi-label { font-size: 12px; color: var(--muted); font-weight: 500; }
.kpi-value {
  font-size: 23px; font-weight: 680; letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.kpi-value.sm { font-size: 17px; }
.kpi-sub { font-size: 11.5px; color: var(--muted); }
.kpi.accent { border-top: 3px solid var(--accent); }
.kpi.ok { border-top: 3px solid var(--ok); }
.kpi.danger { border-top: 3px solid var(--danger); }

.dash-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.dash-cols.three { grid-template-columns: 1fr 1fr 1fr; }
.chart-wrap { height: 260px; }
.chart-wrap.big { height: 320px; }

/* Bande des prochains retours */
.returns-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}
.return-tile {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  transition: transform .15s, box-shadow .15s;
}
.return-tile:hover { transform: translateY(-1px); box-shadow: var(--shadow); }

/* ---------- Entrées animées ---------- */
@keyframes riseIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
.anim-in { animation: riseIn .45s cubic-bezier(.16, 1, .3, 1) both; animation-delay: calc(var(--d, 0) * 70ms); }

/* ---------- Carrousel véhicules ---------- */
.carousel-nav { display: flex; gap: 6px; }
.carousel {
  display: flex; gap: 14px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 6px;
}
.veh-card {
  width: 262px; flex: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  scroll-snap-align: start;
  background: var(--surface);
}
.veh-card.lift { transition: transform .2s, box-shadow .2s; }
.veh-card.lift:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.veh-visual {
  position: relative;
  height: 132px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #17293f, #33506f);
  overflow: hidden;
}
.veh-visual img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s; }
.veh-card.lift:hover .veh-visual img { transform: scale(1.06); }
.veh-glyph { width: 110px; height: 56px; opacity: .95; }
.veh-glyph svg { width: 100%; height: 100%; }
.veh-body { padding: 12px 14px 14px; }
.veh-title strong { display: block; font-size: 14px; font-weight: 600; }
.veh-title .muted { font-size: 11.5px; }
.veh-specs { display: flex; gap: 6px; flex-wrap: wrap; margin: 9px 0 11px; }
.veh-specs span {
  padding: 3px 8px;
  background: var(--surface-2);
  border-radius: 6px;
  font-size: 11.5px; color: var(--muted); font-weight: 480;
}
.veh-foot { display: flex; align-items: center; justify-content: space-between; }
.price { font-weight: 680; font-size: 15.5px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.price em { font-style: normal; font-size: 11px; color: var(--muted); font-weight: 450; }

.veh-avatar {
  width: 40px; height: 40px; flex: none;
  display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 13px;
  border-radius: 10px;
  overflow: hidden;
  background: linear-gradient(135deg, #22354d, #46617f);
}
.veh-avatar.sm { width: 34px; height: 34px; font-size: 11px; border-radius: 8px; }
.veh-avatar.photo img { width: 100%; height: 100%; object-fit: cover; }
.cli-avatar {
  width: 32px; height: 32px; flex: none;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-deep);
  font-weight: 700; font-size: 11.5px;
  border-radius: 10px;
}
.cli-avatar.lg { width: 44px; height: 44px; font-size: 14px; }
.cli-avatar.avatar-warn { background: var(--warn-soft); color: var(--warn); }
.cli-avatar.avatar-danger { background: var(--danger-soft); color: var(--danger); }
.row-blacklist td { opacity: .75; }

/* Filtres par période + champs de date compacts */
.period-bar { margin-top: -8px; }
.date-mini { max-width: 170px; }
.risk-box {
  display: flex; flex-direction: column; gap: 4px;
  padding: 10px 12px;
  background: var(--danger-soft);
  border: 1px solid color-mix(in srgb, var(--danger) 25%, transparent);
  border-radius: var(--radius-sm);
}
.risk-box .muted { font-size: 11.5px; }
.danger-check { color: var(--danger); font-weight: 600; }
.danger-check input { accent-color: var(--danger); }

/* ---------- Alertes ---------- */
.alert-ic { width: 20px; height: 20px; flex: none; color: var(--muted); }
.alert-ic svg { width: 100%; height: 100%; }
.alert-ic.big { width: 28px; height: 28px; }
.alert-danger .alert-ic, .alert-ic.alert-danger { color: var(--danger); }
.alert-warn .alert-ic, .alert-ic.alert-warn { color: var(--warn); }
.alert-info .alert-ic, .alert-ic.alert-info { color: var(--info); }

/* ---------- Menus déroulants ---------- */
.menu-anchor { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 8px);
  width: 282px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
  padding: 6px;
  display: none;
  z-index: 50;
}
.menu.open { display: block; animation: riseIn .22s cubic-bezier(.16, 1, .3, 1) both; }
.menu.wide-menu { width: 432px; }
.menu-head {
  padding: 8px 10px 6px;
  font-size: 11px; font-weight: 620; color: var(--muted);
  text-transform: uppercase; letter-spacing: .07em;
  display: flex; align-items: center; gap: 8px;
}
.menu-item {
  display: block; width: 100%;
  padding: 9px 10px;
  border: 0; background: none;
  border-radius: var(--radius-sm);
  font: inherit; font-size: 13.5px; color: var(--ink);
  text-align: left; cursor: pointer;
  transition: background .12s;
}
.menu-item:hover { background: var(--hover); }
.menu-sep { height: 1px; background: var(--line); margin: 6px 4px; }

.notif-row {
  display: flex; gap: 10px;
  padding: 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  position: relative;
  transition: background .12s;
}
.notif-row:hover { background: var(--hover); }
.notif-row > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.notif-row .badge { align-self: flex-start; }
.notif-row strong { font-size: 13px; font-weight: 580; }
.notif-row .muted { font-size: 12px; }
.notif-row.unread::after {
  content: '';
  position: absolute; top: 14px; right: 10px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
}
.notif-row.read { opacity: .6; }

/* ---------- Modales ---------- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(8, 15, 26, .52);
  backdrop-filter: blur(3px);
  display: none;
  align-items: flex-start; justify-content: center;
  padding: 5vh 20px;
  z-index: 100;
}
.modal-overlay.open { display: flex; }
.modal-box {
  width: 780px; max-width: 100%;
  max-height: 88vh; overflow-y: auto;
  background: var(--surface);
  border-radius: 16px;
  box-shadow: 0 24px 70px rgba(8, 15, 26, .45);
  padding: 24px 26px;
  animation: riseIn .3s cubic-bezier(.16, 1, .3, 1) both;
}
.modal-photo { margin: -24px -26px 18px; height: 210px; overflow: hidden; border-radius: 16px 16px 0 0; }
.modal-photo img { width: 100%; height: 100%; object-fit: cover; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 18px;
}
.modal-head h2 { font-size: 17.5px; }
.modal-actions { display: flex; gap: 10px; align-items: center; margin-top: 20px; flex-wrap: wrap; }

.detail-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px 24px;
}
.detail-grid > div { display: flex; flex-direction: column; gap: 1px; padding: 7px 0; border-bottom: 1px solid var(--row-line); }
.dt { font-size: 11px; color: var(--muted); font-weight: 540; text-transform: uppercase; letter-spacing: .05em; }
.dd { font-size: 13.5px; font-weight: 520; }
.note {
  margin: 14px 0 0;
  padding: 10px 12px;
  background: var(--warn-soft);
  border-radius: var(--radius-sm);
  font-size: 13px;
}
.note.warn-note { border-left: 3px solid var(--warn); }
.note.danger-note { background: var(--danger-soft); border-left: 3px solid var(--danger); color: var(--danger); font-weight: 600; }
.sub { font-size: 12px; margin: 20px 0 8px; color: var(--muted); font-weight: 620; text-transform: uppercase; letter-spacing: .07em; }

/* ---------- Formulaires ---------- */
.form-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
}
.form-grid label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; font-weight: 550; color: var(--ink); }
.form-grid .wide { grid-column: 1 / -1; }
.form-grid .modal-actions { grid-column: 1 / -1; }

.res-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.res-layout > .card:last-child { grid-column: 1 / -1; }

.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 3px; gap: 2px; }
.seg-btn {
  padding: 7px 14px;
  border: 0; background: none;
  border-radius: 6px;
  font: inherit; font-weight: 540; font-size: 13px; color: var(--muted);
  cursor: pointer;
  transition: background .14s, color .14s;
}
.seg.small .seg-btn { padding: 5px 11px; font-size: 12px; }
.seg-btn.active { background: var(--surface); color: var(--ink); font-weight: 620; box-shadow: 0 1px 4px rgba(16, 21, 32, .16); }

/* Sélecteur niveau d'essence en barres */
.fuel-picker { display: flex; align-items: flex-end; gap: 5px; padding: 6px 0 2px; }
.fuel-bar {
  width: 22px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-2);
  cursor: pointer;
  transition: background .12s, transform .12s, border-color .12s;
}
.fuel-bar:nth-child(1) { height: 14px; } .fuel-bar:nth-child(2) { height: 18px; }
.fuel-bar:nth-child(3) { height: 22px; } .fuel-bar:nth-child(4) { height: 26px; }
.fuel-bar:nth-child(5) { height: 30px; } .fuel-bar:nth-child(6) { height: 34px; }
.fuel-bar:nth-child(7) { height: 38px; } .fuel-bar:nth-child(8) { height: 42px; }
.fuel-bar:hover { transform: translateY(-2px); }
.fuel-bar.on { background: var(--accent); border-color: var(--accent); }
.fuel-val { margin-left: 8px; font-weight: 700; }
.fuel-mini { display: inline-flex; gap: 2px; align-items: flex-end; vertical-align: middle; margin-right: 4px; }
.fuel-mini i { width: 5px; background: var(--line); border-radius: 1px; display: inline-block; }
.fuel-mini i:nth-child(1) { height: 5px; } .fuel-mini i:nth-child(2) { height: 7px; }
.fuel-mini i:nth-child(3) { height: 9px; } .fuel-mini i:nth-child(4) { height: 11px; }
.fuel-mini i:nth-child(5) { height: 13px; } .fuel-mini i:nth-child(6) { height: 15px; }
.fuel-mini i:nth-child(7) { height: 17px; } .fuel-mini i:nth-child(8) { height: 19px; }
.fuel-mini i.on { background: var(--accent); }

.total-box {
  margin-top: 16px;
  padding: 15px 17px;
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
  border-radius: var(--radius-sm);
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
}
.total-box > div { display: flex; flex-direction: column; gap: 2px; }
.total-box span { font-size: 11px; color: var(--muted); font-weight: 540; text-transform: uppercase; letter-spacing: .05em; }
.total-box strong { font-size: 15.5px; font-weight: 680; font-variant-numeric: tabular-nums; }
.total-box .grand strong { font-size: 20px; color: var(--accent-deep); }

/* ---------- Rapports ---------- */
.report-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.report-card h2 { font-size: 15.5px; }
.report-card .muted { font-size: 12.5px; }
.report-kpis { display: flex; gap: 28px; margin: 16px 0 18px; }
.report-kpis > div { display: flex; flex-direction: column; gap: 3px; }

/* ---------- Toasts ---------- */
.toasts {
  position: fixed; bottom: 20px; right: 20px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 200;
}
.toast {
  padding: 11px 16px;
  background: #101724; color: #eaf1f9;
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 480;
  box-shadow: var(--shadow-lift);
  opacity: 0; transform: translateY(8px);
  transition: opacity .25s, transform .25s;
  max-width: 380px;
}
[data-theme="dark"] .toast { background: #e7ebf1; color: #101724; }
.toast.show { opacity: 1; transform: none; }
.toast.warn { background: #7a4d08; color: #fff; }

/* ---------- Date picker (flatpickr) ---------- */
.flatpickr-calendar {
  border-radius: 14px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lift);
  background: var(--surface);
  font-family: var(--font);
  overflow: hidden;
}
.flatpickr-months {
  background: linear-gradient(120deg, var(--primary), var(--accent));
  padding: 8px 0 6px;
  border-radius: 14px 14px 0 0;
}
.flatpickr-months .flatpickr-month,
.flatpickr-months .flatpickr-prev-month, .flatpickr-months .flatpickr-next-month,
.flatpickr-current-month .flatpickr-monthDropdown-months,
.flatpickr-current-month input.cur-year { color: #fff !important; fill: #fff !important; }
.flatpickr-current-month .flatpickr-monthDropdown-months { background: transparent; font-weight: 700; }
.flatpickr-current-month .flatpickr-monthDropdown-months option { color: #101520; }
.flatpickr-months .flatpickr-prev-month:hover svg, .flatpickr-months .flatpickr-next-month:hover svg { fill: #d9f0ff !important; }
.flatpickr-weekdays { background: var(--surface); margin-top: 4px; }
span.flatpickr-weekday { color: var(--muted); font-weight: 620; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.flatpickr-day {
  color: var(--ink);
  border-radius: 9px;
  font-weight: 480;
  border: 0;
  transition: background .12s;
}
.flatpickr-day:hover { background: var(--accent-soft); border-color: transparent; }
.flatpickr-day.today { border: 1px solid var(--accent); background: transparent; }
.flatpickr-day.selected, .flatpickr-day.selected:hover {
  background: var(--primary); border-color: var(--primary); color: #fff;
  box-shadow: 0 4px 12px color-mix(in srgb, var(--primary) 40%, transparent);
}
.flatpickr-day.flatpickr-disabled, .flatpickr-day.prevMonthDay, .flatpickr-day.nextMonthDay {
  color: color-mix(in srgb, var(--muted) 45%, transparent);
}
.flatpickr-day.flatpickr-disabled { text-decoration: line-through; }
.flatpickr-calendar.arrowTop::before, .flatpickr-calendar.arrowTop::after { border-bottom-color: var(--primary); }
.flatpickr-calendar.arrowBottom::before, .flatpickr-calendar.arrowBottom::after { border-top-color: var(--surface); }
[data-theme="dark"] .flatpickr-day.selected { color: #0a1119; }

/* ---------- Réactif ---------- */
@media (max-width: 1280px) {
  #exportLabel { display: none; }
}
@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .dash-cols, .dash-cols.three { grid-template-columns: 1fr; }
  .res-layout { grid-template-columns: 1fr; }
  .report-grid { grid-template-columns: 1fr; }
}
/* Bouton menu (hamburger) et fond du tiroir : cachés sur bureau */
.menu-btn { display: none; }
.side-backdrop {
  position: fixed; inset: 0;
  background: rgba(8, 15, 26, .45);
  opacity: 0; pointer-events: none;
  transition: opacity .2s;
  z-index: 110;
}
body.nav-open .side-backdrop { opacity: 1; pointer-events: auto; }

/* Tablette : barre latérale resserrée, contenus plus compacts */
@media (max-width: 1024px) {
  .sidebar { width: 208px; padding: 14px 10px 12px; }
  .main { padding: 18px 18px 36px; }
  .topbar { padding: 0 18px; }
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
}

/* Mobile : la barre latérale devient un tiroir ouvert par le bouton menu */
@media (max-width: 820px) {
  .menu-btn { display: inline-grid; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: 272px; max-width: 84vw;
    transform: translateX(-105%);
    transition: transform .25s cubic-bezier(.16, 1, .3, 1);
    z-index: 120;
    padding: 18px 12px 14px;
  }
  body.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lift); }

  .topbar { padding: 0 12px; gap: 8px; height: 58px; }
  .topbar h1 { font-size: 15.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
  .topbar-actions { gap: 6px; }
  .main { padding: 12px 12px 32px; }
  #view { gap: 12px; }

  /* cibles tactiles confortables */
  .btn, .icon-btn { min-height: 40px; }
  .nav-item { padding: 11px; min-height: 42px; }
  .table td { padding: 12px 10px; }

  /* barres d'outils : la recherche prend toute la largeur disponible */
  .toolbar .input[type="search"] { max-width: none; flex: 1 1 160px; }
  .toolbar .sel { flex: 1 1 40%; min-width: 0; }

  /* menus déroulants : jamais plus larges que l'écran */
  .menu, .menu.wide-menu, .menu.user-menu { width: min(432px, calc(100vw - 24px)); }

  /* tableaux : défilement horizontal fluide plutôt qu'écrasement des colonnes */
  .table-wrap { -webkit-overflow-scrolling: touch; }
  .table { min-width: 720px; }

  /* modales quasi plein écran */
  .modal-overlay { padding: 3vh 8px; }
  .modal-box { padding: 18px 14px; border-radius: 14px; }
  .modal-photo { margin: -18px -14px 14px; height: 160px; }

  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .kpi-grid.four { grid-template-columns: repeat(2, 1fr); }
  .kpi-value { font-size: 19px; }
  .form-grid, .detail-grid { grid-template-columns: 1fr; }
  .total-box { grid-template-columns: 1fr 1fr; }
  .returns-strip { grid-template-columns: 1fr; }
  .carousel .veh-card { width: 236px; }
  .chart-wrap.big { height: 240px; }
  .report-kpis { flex-wrap: wrap; gap: 14px; }
  .card { padding: 15px 14px; }
}

/* Très petits écrans : thème et langue passent dans le menu du profil */
@media (max-width: 560px) {
  #langBtn, #themeBtn { display: none; }
  .fuel-bar { width: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ---------- Profil dans la barre latérale ---------- */
.side-user {
  width: 100%;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 9px;
  border: 0; background: none;
  border-radius: var(--radius-sm);
  font: inherit; text-align: left;
  cursor: pointer;
  transition: background .15s;
}
.side-user:hover { background: var(--hover); }
.side-user .user-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.side-user .user-meta strong { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user .user-meta .muted { font-size: 11.5px; }
.side-user .chev { color: var(--muted); flex: none; }

/* Menus ancrés vers le haut (pied de barre latérale) ou alignés à gauche (cartes) */
.menu.menu-up { top: auto; bottom: calc(100% + 8px); left: 0; right: auto; }
.menu.menu-left { left: 0; right: auto; }


/* ================================================================
   CALQUE D'ÉLÉVATION PREMIUM « Aurora » (high-end-visual-design)
   Profondeur haptique, dégradés d'accent vert→lime, verre dépoli,
   motion à ressort. N'altère aucune structure : apparence seule.
   Pour revenir en arrière, supprimer tout ce bloc.
   ================================================================ */

:root {
  --grad-primary: linear-gradient(135deg, #0f5c43 0%, #1c8a63 100%);
  --grad-accent: linear-gradient(135deg, #1f9d6b 0%, #62b83f 100%);
  --ease-spring: cubic-bezier(.32, .72, 0, 1);
  --shadow: 0 1px 2px rgba(16, 33, 60, .05), 0 10px 26px -8px rgba(16, 33, 60, .12);
  --shadow-lift: 0 2px 6px rgba(16, 33, 60, .08), 0 24px 50px -14px rgba(16, 46, 90, .24);
  --hi: inset 0 1px 0 rgba(255, 255, 255, .7);
}
[data-theme="dark"] {
  --grad-primary: linear-gradient(135deg, #1f9d6b 0%, #4fd6a5 100%);
  --grad-accent: linear-gradient(135deg, #34c48c 0%, #86d84e 100%);
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 28px -8px rgba(0, 0, 0, .5);
  --shadow-lift: 0 2px 6px rgba(0, 0, 0, .5), 0 28px 56px -14px rgba(0, 0, 0, .62);
  --hi: inset 0 1px 0 rgba(255, 255, 255, .06);
}

/* Voile aurora fixe derrière le contenu qui défile (aucun repaint : background local) */
.main {
  background:
    radial-gradient(1200px 620px at 100% -6%, color-mix(in srgb, var(--accent) 11%, transparent) 0%, transparent 56%),
    radial-gradient(1020px 560px at -8% 6%, color-mix(in srgb, #62b83f 9%, transparent) 0%, transparent 52%),
    var(--bg);
}

/* Barre du haut : verre dépoli translucide */
.topbar {
  background: color-mix(in srgb, var(--surface) 76%, transparent);
  backdrop-filter: saturate(1.4) blur(16px);
  -webkit-backdrop-filter: saturate(1.4) blur(16px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 65%, transparent);
}

/* Barre latérale : surface translucide, item actif en dégradé + liseré */
.sidebar {
  background: color-mix(in srgb, var(--surface) 84%, transparent);
  backdrop-filter: saturate(1.3) blur(14px);
  -webkit-backdrop-filter: saturate(1.3) blur(14px);
}
.nav-item { border-radius: 11px; transition: background .25s var(--ease-spring), color .25s var(--ease-spring); }
.nav-item.active { background: color-mix(in srgb, var(--accent) 13%, transparent); color: var(--accent-deep); position: relative; }
.nav-item.active::before {
  content: ''; position: absolute; left: 3px; top: 22%; bottom: 22%;
  width: 3px; border-radius: 3px; background: var(--grad-accent);
}

/* Cartes : double-biseau (ombre teintée + liseré interne haut), coins premium */
.card, .kpi {
  border-color: color-mix(in srgb, var(--line) 82%, transparent);
  box-shadow: var(--shadow), var(--hi);
  border-radius: 18px;
}
.card { transition: transform .4s var(--ease-spring), box-shadow .4s var(--ease-spring); }

/* KPI : barre d'accent dégradée en haut + halo au survol */
.kpi { position: relative; overflow: hidden; transition: transform .4s var(--ease-spring), box-shadow .4s var(--ease-spring); }
.kpi::before {
  content: ''; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: var(--grad-accent); opacity: .5;
}
.kpi.accent, .kpi.ok, .kpi.danger { border-top: 1px solid color-mix(in srgb, var(--line) 82%, transparent); }
.kpi.accent::before { opacity: 1; }
.kpi.ok::before { background: linear-gradient(135deg, var(--ok), #34d399); opacity: 1; }
.kpi.danger::before { background: linear-gradient(135deg, var(--danger), #fb7185); opacity: 1; }
.kpi:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lift), var(--hi), 0 0 0 1px color-mix(in srgb, var(--accent) 20%, transparent);
}
.kpi-value { font-size: 25px; letter-spacing: -0.035em; }

/* Boutons : dégradé premium, ressort à la pression, halo maîtrisé */
.btn {
  background: var(--grad-primary); border-color: transparent; border-radius: 11px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), 0 4px 12px -4px color-mix(in srgb, var(--primary) 45%, transparent);
  transition: transform .25s var(--ease-spring), box-shadow .25s var(--ease-spring), filter .25s var(--ease-spring);
}
.btn:hover {
  filter: brightness(1.06) saturate(1.05); transform: translateY(-1px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 9px 24px -6px color-mix(in srgb, var(--primary) 55%, transparent);
}
.btn:active { transform: translateY(0) scale(.97); }
.btn.ghost { background: var(--surface); box-shadow: var(--shadow); }
.btn.ghost:hover { background: var(--hover); filter: none; box-shadow: var(--shadow-lift); transform: translateY(-1px); }
.btn.cta { border-radius: 999px; padding-left: 18px; padding-right: 18px; }
.btn.wa { background: linear-gradient(135deg, #0f9d58, #22c55e); color: #fff; }

.icon-btn { border-radius: 11px; transition: background .22s var(--ease-spring), transform .22s var(--ease-spring), box-shadow .22s var(--ease-spring); }
.icon-btn:hover { box-shadow: var(--shadow); transform: translateY(-1px); }

/* Champs : coins doux */
.input { border-radius: 11px; }

/* Menus + modales : verre dépoli */
.menu {
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(20px);
  -webkit-backdrop-filter: saturate(1.4) blur(20px);
  border-color: color-mix(in srgb, var(--line) 66%, transparent);
  border-radius: 16px;
}
.modal-box {
  border: 1px solid color-mix(in srgb, var(--line) 55%, transparent);
  box-shadow: var(--shadow-lift), var(--hi);
  border-radius: 22px;
}
.modal-overlay { background: color-mix(in srgb, #081019 55%, transparent); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }

/* Avatars client : pastille dégradée de marque (sauf états risque / blacklist) */
.cli-avatar:not(.avatar-warn):not(.avatar-danger) { background: var(--grad-accent); color: #fff; }
[data-theme="dark"] .cli-avatar:not(.avatar-warn):not(.avatar-danger) { color: #06202e; }

/* Léger relief sur les pastilles */
.pill { box-shadow: var(--hi); }

/* Entrée : fondu ascendant avec micro-flou (motion premium) */
@keyframes riseIn {
  from { opacity: 0; transform: translateY(16px); filter: blur(6px); }
  to { opacity: 1; transform: none; filter: blur(0); }
}
.anim-in { animation: riseIn .6s var(--ease-spring) both; animation-delay: calc(var(--d, 0) * 65ms); }

/* Carrousel + tuiles : ressort au survol, coins premium */
.veh-card { border-radius: 18px; }
.veh-card.lift { transition: transform .4s var(--ease-spring), box-shadow .4s var(--ease-spring); }
.return-tile { transition: transform .3s var(--ease-spring), box-shadow .3s var(--ease-spring); }

@media (prefers-reduced-motion: reduce) {
  @keyframes riseIn { from { opacity: 0; } to { opacity: 1; } }
}

/* Contraste AA garanti du texte blanc sur boutons (extrémité claire assombrie) */
:root { --grad-primary: linear-gradient(135deg, #0d5340 0%, #157a58 100%); }

/* Perf : barre latérale en surface pleine (pas de flou sur grande zone) */
.sidebar { background: var(--surface); backdrop-filter: none; -webkit-backdrop-filter: none; }

/* CTA « button-in-button » : libellé + flèche dans un cercle imbriqué (tension kinétique) */
.btn.cta { gap: 4px; padding-right: 5px; }
.btn.cta .cta-label { padding-left: 6px; }
.btn.cta .cta-orb {
  width: 30px; height: 30px; flex: none;
  display: grid; place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, .18);
  color: #fff;
  transition: transform .3s var(--ease-spring), background .3s var(--ease-spring);
}
[data-theme="dark"] .btn.cta .cta-orb { background: rgba(6, 17, 25, .22); color: #06202e; }
.btn.cta:hover .cta-orb { transform: rotate(90deg) scale(1.06); background: rgba(255, 255, 255, .28); }
[data-theme="dark"] .btn.cta:hover .cta-orb { background: rgba(6, 17, 25, .3); }

/* CTA : hauteur ajustée pour s'insérer proprement dans la barre du haut (~42px) */
.btn.cta { padding-top: 6px; padding-bottom: 6px; }
.btn.cta .cta-orb { width: 26px; height: 26px; }

/* Réaffirme le dégradé clair des boutons en mode sombre (texte foncé lisible) — doit rester le DERNIER */
[data-theme="dark"] { --grad-primary: linear-gradient(135deg, #34c48c 0%, #6fdba8 100%); }

/* Correctif empilement : la barre du haut (et ses menus) doit passer AU-DESSUS du contenu */
.topbar { position: relative; z-index: 40; }
.menu { z-index: 60; }

/* ===== Ajustements MyFleetAccess (8 juil.) ===== */
/* Alternative accessible des graphiques : tableau masqué visuellement */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
/* Menus du header (notifications / export / profil) : opaques, sans transparence ni flou */
.menu { background: var(--surface) !important; backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
/* Thème et langue restent accessibles dans la barre du haut, même sur petit écran */
@media (max-width: 560px) { #langBtn, #themeBtn { display: inline-grid !important; } }

/* Correctif responsive : permet aux cartes en grille/flex de rétrécir sous la largeur
   de leur contenu (sinon une table large gonfle la carte et déborde) → la table défile en interne */
#view > *, .dash-cols > *, .res-layout > * { min-width: 0; }
.card { min-width: 0; }
