:root {
  /* Palette reprise du logo : bleu marine + rouge */
  --brand: #14427e;
  --brand-2: #1f5ea8;
  --brand-3: #2f74c0;
  --accent: #d4302d;
  --accent-2: #e8504d;
  --red: #d4302d;
  --bg: #eef2f7;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --text: #0f172a;
  --muted: #647386;
  --border: #e4e9f0;
  --ok: #16a34a;
  --warn: #d97706;
  --danger: #dc2626;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 6px 18px rgba(15, 23, 42, .05);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, .08), 0 18px 40px rgba(15, 23, 42, .10);
  --grad-brand: linear-gradient(135deg, #1b4f93, #14427e);
  --grad-accent: linear-gradient(135deg, #e8504d, #d4302d);
  --grad-sidebar: linear-gradient(180deg, #163f72, #122f53 60%, #0f2748);
  --ring: 0 0 0 3px rgba(31, 94, 168, .22);
  --ease: cubic-bezier(.4, 0, .2, 1);
  --sidebar-w: 252px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Segoe UI', Roboto, -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.boot { padding: 4rem; text-align: center; color: var(--muted); }

a { color: var(--brand-2); }
button { font-family: inherit; cursor: pointer; }

/* ---------------- Auth screens ---------------- */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
}
.auth-hero {
  background: linear-gradient(150deg, var(--red), #7c1a1a 45%, var(--brand) 55%, #0c2c5a);
  color: #fff;
  padding: 3rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.auth-hero .logo { font-size: 2.2rem; font-weight: 800; letter-spacing: .5px; display:flex; align-items:center; gap:.7rem;}
.auth-hero .hero-logo { width: 64px; height: 64px; border-radius: 12px; background:#fff; padding:4px; object-fit: contain; }
.auth-hero h1 { font-size: 2rem; margin: 1.5rem 0 .5rem; line-height: 1.2; }
.auth-hero p { opacity: .9; font-size: 1.05rem; max-width: 460px; line-height: 1.6; }
.auth-hero ul { margin-top: 1.5rem; padding-left: 1.1rem; line-height: 2; opacity: .92; }
.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2.2rem;
}
.auth-card h2 { margin: 0 0 .3rem; }
.auth-card .sub { color: var(--muted); margin: 0 0 1.6rem; font-size: .92rem; }
.auth-tabs { display: flex; gap: .5rem; margin-bottom: 1.5rem; }
.auth-tabs button {
  flex: 1; padding: .6rem; border: 1px solid var(--border); background: #fff;
  border-radius: 8px; color: var(--muted); font-weight: 600;
}
.auth-tabs button.active { background: var(--brand); color: #fff; border-color: var(--brand); }

@media (max-width: 860px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
}

/* ---------------- Forms ---------------- */
label { display: block; font-size: .85rem; font-weight: 600; margin: .9rem 0 .35rem; color: #334155; }
input, select, textarea {
  width: 100%; padding: .65rem .75rem; border: 1px solid var(--border);
  border-radius: 8px; font-size: .95rem; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-2); border-color: var(--brand-2); }
textarea { resize: vertical; min-height: 80px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .65rem 1.1rem; border: 0; border-radius: 8px; font-weight: 600; font-size: .95rem;
  background: var(--brand); color: #fff;
}
.btn:hover { background: #0a3257; }
.btn.full { width: 100%; margin-top: 1.4rem; }
.btn.accent { background: var(--accent); color: #fff; }
.btn.accent:hover { background: #b3211f; }
.btn.ok { background: var(--ok); }
.btn.danger { background: var(--danger); }
.btn.ghost { background: transparent; color: var(--brand); border: 1px solid var(--border); }
.btn.sm { padding: .4rem .7rem; font-size: .82rem; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.row { display: flex; gap: .8rem; }
.row > * { flex: 1; }

/* ---------------- App layout ---------------- */
.layout { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar {
  background: var(--brand); color: #cdd9e8; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar .brand { padding: 1.1rem 1.2rem; font-weight: 800; font-size: 1.1rem; color: #fff; display:flex; align-items:center; gap:.6rem; border-bottom: 1px solid rgba(255,255,255,.12); line-height:1.15;}
.sidebar .brand .brand-logo { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 8px; background:#fff; padding:2px; object-fit: contain; }
.nav-section { padding: .9rem .9rem .3rem; font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #8fa6c4; }
.sidebar nav { flex: 1; padding: .8rem; overflow-y: auto; }
.sidebar nav button {
  display: flex; align-items: center; gap: .7rem; width: 100%; text-align: left;
  padding: .7rem .8rem; margin-bottom: .25rem; border: 0; background: transparent;
  color: #cdd9e8; border-radius: 8px; font-size: .92rem; font-weight: 500;
}
.sidebar nav button:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar nav button.active { background: var(--brand-2); color: #fff; font-weight: 600; }
.sidebar nav button .ico { width: 20px; text-align: center; }
.sidebar nav .badge { margin-left: auto; background: var(--accent); color:#fff; border-radius: 999px; padding: 0 .5rem; font-size: .75rem; font-weight: 700;}
.sidebar .userbox { padding: 1rem 1.3rem; border-top: 1px solid rgba(255,255,255,.1); font-size: .85rem; }
.sidebar .userbox .name { color: #fff; font-weight: 600; }
.sidebar .userbox .role { color: #9fb6cf; font-size: .78rem; text-transform: uppercase; letter-spacing: .5px;}
.sidebar .userbox button { margin-top: .6rem; }

.main { padding: 1.8rem 2.2rem; max-width: 1280px; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.4rem; flex-wrap: wrap; gap: .8rem;}
.page-head h1 { margin: 0; font-size: 1.5rem; }
.page-head p { margin: .25rem 0 0; color: var(--muted); }

/* Bouton hamburger : masqué sur grand écran, visible sur mobile/tablette */
.nav-toggle { display: none; }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  /* Barre supérieure repliée par défaut ; quand le menu est ouvert, la barre
     latérale défile (logo + menu n'occupent plus tout l'écran). */
  .sidebar { position: sticky; top: 0; z-index: 20; height: auto; max-height: 64px; overflow: hidden; flex-direction: column; }
  .sidebar.nav-open { max-height: 100vh; overflow-y: auto; }
  /* Le logo/marque garde une hauteur fixe (ne s'étire plus sur toute la page) */
  .sidebar .brand { flex: 0 0 auto; min-height: 56px; padding-left: 4rem; }
  .sidebar .brand .brand-logo { width: 34px; height: 34px; flex-basis: 34px; }
  .nav-toggle {
    display: block; position: absolute; top: .6rem; left: .6rem; right: auto; z-index: 2;
    background: rgba(255,255,255,.22); color: #fff; border: 0; border-radius: 10px;
    padding: .55rem .8rem; font-weight: 700; font-size: 1.5rem; line-height: 1;
  }
  /* Menu replié par défaut ; ouvert via .nav-open (et défilable) */
  .sidebar nav { display: none; }
  .sidebar.nav-open nav { display: block; }
  .sidebar .userbox { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }
  .sidebar .userbox button { margin-top: 0; margin-left: auto; }
  .main { padding: 1rem; }
  .page-head h1 { font-size: 1.25rem; }
  .grid.cols-4, .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr 1fr; }
  .modal { max-width: 100%; }
}

@media (max-width: 520px) {
  .grid.cols-4, .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr; }
  .main { padding: .8rem; }
  .card { padding: 1rem; }
  .btn { padding: .6rem .9rem; }
  .row { flex-direction: column; }
  th, td { padding: .5rem .4rem; font-size: .82rem; }
  .month-grid .cell { min-height: 64px; }
  .stat .value { font-size: 1.5rem; }
  .page-head { flex-direction: column; align-items: stretch; }
  .page-head .btn, .page-head > div:last-child { width: 100%; }
}

/* ---------------- Cards & grids ---------------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.3rem; margin-bottom: 1.3rem;
}
.card h3 { margin: 0 0 1rem; font-size: 1.05rem; }
.grid { display: grid; gap: 1.1rem; }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 1000px) { .grid.cols-4 { grid-template-columns: repeat(2,1fr);} .grid.cols-3{grid-template-columns:1fr;} }
@media (max-width: 640px) { .grid.cols-4, .grid.cols-2 { grid-template-columns: 1fr; } .row{flex-direction:column;} }

.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.2rem; box-shadow: var(--shadow);}
.stat .value { font-size: 2rem; font-weight: 800; color: var(--brand); }
.stat .label { color: var(--muted); font-size: .85rem; margin-top: .2rem; }
.stat .unit { font-size: .9rem; color: var(--muted); font-weight: 600; }
.stat.alt .value { color: var(--accent); }

/* ---------------- Tables ---------------- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .7rem .6rem; border-bottom: 1px solid var(--border); font-size: .9rem; }
th { color: var(--muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .4px; }
tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }

.tag { display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 600; }
.tag.pending { background: #fef3c7; color: #92400e; }
.tag.approved { background: #dcfce7; color: #166534; }
.tag.rejected { background: #fee2e2; color: #991b1b; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.group-chip { display:inline-flex; align-items:center; gap:.4rem; padding:.15rem .55rem; border-radius:999px; font-size:.8rem; font-weight:600; color:#fff;}

/* ---------------- Calendar ---------------- */
.cal-toolbar { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: 1rem; }
.cal-toolbar .title { font-weight: 700; font-size: 1.15rem; min-width: 220px; text-transform: capitalize;}
.view-switch { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background:#fff;}
.view-switch button { border: 0; background: #fff; padding: .45rem .8rem; font-weight: 600; color: var(--muted); font-size:.85rem;}
.view-switch button.active { background: var(--brand); color: #fff; }
.nav-btn { border: 1px solid var(--border); background: #fff; border-radius: 8px; width: 36px; height: 36px; font-size: 1.1rem; }

.month-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;}
.month-grid .dow { background: #f8fafc; padding: .5rem; text-align: center; font-size: .78rem; font-weight: 700; color: var(--muted); text-transform: uppercase;}
.month-grid .cell { background: #fff; min-height: 96px; padding: .35rem; font-size: .8rem; position: relative;}
.month-grid .cell.out { background: #f8fafc; color: #cbd5e1; }
.month-grid .cell.sunday { background: #fdf6f6; }
.month-grid .cell.holiday { background: #fde68a; box-shadow: inset 0 0 0 2px #f59e0b; }
.month-grid .cell.school { background: #eff6ff; }
.month-grid .cell.closed { background: #fef2f2; box-shadow: inset 0 0 0 2px #fecaca; }
.week-grid .wcell.school { background: #eff6ff; }
.week-grid .wcell.closed { background: #fef2f2; }
.month-grid .cell .num { font-weight: 700; font-size: .8rem; }
.month-grid .cell.today .num { background: var(--brand); color: #fff; border-radius: 50%; width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center;}
.month-grid .cell .hol-label { font-size: .62rem; color: #92400e; font-weight: 700; display:block; margin-top:1px;}
.ev { display: block; color: #fff; border-radius: 5px; padding: 1px 5px; margin-top: 2px; font-size: .7rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; cursor: default;}
/* Demande en attente (DCP et autres) : hachuré / pointillés */
.ev.is-pending { background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.35) 0 4px, transparent 4px 8px); border: 1px dashed rgba(255,255,255,.9); }
.tag.is-pending, .group-chip.is-pending { border: 1px dashed rgba(255,255,255,.9); background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.3) 0 4px, transparent 4px 8px); }
.mini-grid span.has-ev.is-pending { outline: 1px dashed #fff; }

.week-grid { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.week-grid .wrow { display: grid; grid-template-columns: 150px repeat(6, 1fr); border-bottom: 1px solid var(--border);}
.week-grid .wrow:last-child { border-bottom: 0; }
.week-grid .whead { background: #f8fafc; font-weight: 700; font-size: .8rem; }
.week-grid .wcell { padding: .5rem; border-left: 1px solid var(--border); min-height: 44px; font-size:.8rem;}
.week-grid .wcell.namecol { border-left: 0; font-weight: 600; display:flex; align-items:center; gap:.4rem; }
.week-grid .wcell.holiday { background: #fde68a; box-shadow: inset 0 0 0 2px #f59e0b; }
.week-grid .whead .sub { font-weight: 500; color: var(--muted); font-size: .72rem; }

.year-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
@media (max-width: 1000px){ .year-grid { grid-template-columns: repeat(2,1fr);} }
@media (max-width: 600px){ .year-grid { grid-template-columns: 1fr;} }
.mini-month { border: 1px solid var(--border); border-radius: 10px; padding: .7rem; background:#fff;}
.mini-month h4 { margin: 0 0 .5rem; text-align: center; text-transform: capitalize; font-size: .95rem;}
.mini-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.mini-grid span { aspect-ratio: 1; display:flex; align-items:center; justify-content:center; font-size:.68rem; border-radius:4px; color:#475569;}
.mini-grid span.has-ev { color: #fff; font-weight: 700; }
.mini-grid span.dim { color: #cbd5e1; }
.mini-grid span.head { color: var(--muted); font-weight:700; }

.day-list .day-event { display:flex; align-items:center; gap:.8rem; padding:.7rem; border:1px solid var(--border); border-radius:10px; margin-bottom:.5rem; }
.day-list .bar { width:6px; align-self:stretch; border-radius:3px; }

.legend { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 1rem; }
.legend .item { display: flex; align-items: center; gap: .4rem; font-size: .85rem; color: var(--muted); }

.date-chip { display: inline-block; padding: .15rem .55rem; border-radius: 6px; font-size: .78rem; font-weight: 600; border: 1px solid transparent; }
.date-chip.past { background: #fef9c3; color: #854d0e; border-color: #fde68a; }      /* jaune : passées */
.date-chip.current { background: #dcfce7; color: #166534; border-color: #86efac; }   /* vert : en cours */
.date-chip.future { background: #dbeafe; color: #1e40af; border-color: #93c5fd; }    /* bleu : à venir */
.date-chip.is-pending { border-style: dashed; opacity: .85; }

.empty { text-align: center; color: var(--muted); padding: 2rem; }
.help { font-size: .82rem; color: var(--muted); margin-top: .3rem; }
.alert { padding: .8rem 1rem; border-radius: 8px; font-size: .9rem; margin-bottom: 1rem; }
.alert.info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.alert.warn { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

.info-content { white-space: pre-wrap; line-height: 1.7; font-size: .95rem; }

/* ---------------- Modal ---------------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.5); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 1rem;}
.modal { background: #fff; border-radius: var(--radius); width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow); }
.modal header { padding: 1.2rem 1.4rem; border-bottom: 1px solid var(--border); display:flex; justify-content:space-between; align-items:center;}
.modal header h3 { margin: 0; }
.modal .body { padding: 1.4rem; }
.modal .foot { padding: 1rem 1.4rem; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: .6rem; }
.close-x { border: 0; background: transparent; font-size: 1.4rem; color: var(--muted); cursor: pointer; }

/* ---------------- Toast ---------------- */
#toast-container { position: fixed; bottom: 1.2rem; right: 1.2rem; display: flex; flex-direction: column; gap: .6rem; z-index: 100;}
.toast { padding: .8rem 1.1rem; border-radius: 8px; color: #fff; box-shadow: var(--shadow); font-size: .9rem; animation: slideIn .25s ease; max-width: 360px;}
.toast.ok { background: var(--ok); }
.toast.err { background: var(--danger); }
.toast.info { background: var(--brand-2); }
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------------- Organigramme ---------------- */
.org-level { text-align: center; }
.org-level-title { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: .6rem; }
.org-row { display: flex; flex-wrap: wrap; gap: .8rem; justify-content: center; }
.org-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); padding: .7rem .9rem; min-width: 180px; text-align: center; }
.org-name { font-weight: 700; }
.org-role { font-size: .8rem; color: var(--muted); margin-top: .15rem; }
.org-mail { display: inline-block; margin-top: .35rem; font-size: .8rem; }
.org-connector { width: 2px; height: 26px; background: var(--border); margin: .2rem auto; }
.org-branch { margin-top: 1rem; }
.org-branch-title { margin-bottom: .5rem; }

/* ---------------- Rapport / impression PDF ---------------- */
.report-head h1 { font-size: 1.3rem; margin: 0 0 .2rem; color: var(--brand); }
.report-head p { margin: 0 0 1rem; color: var(--muted); font-size: .85rem; }
.report-table { width: 100%; border-collapse: collapse; margin-bottom: 1.2rem; }
.report-table th, .report-table td { border: 1px solid #cbd5e1; padding: .4rem .55rem; text-align: left; font-size: .85rem; }
.report-table thead th { background: #f1f5f9; }

@media print {
  body { background: #fff; }
  .sidebar, .page-head, #admin-tabs, #toast-container, .modal-overlay, #exp-print, #exp-month, .help { display: none !important; }
  .layout { display: block; }
  .main { padding: 0; max-width: none; }
  .card { box-shadow: none; border: none; margin: 0; padding: 0; }
  #print-area { display: block; }
}

/* ---------------- Organigramme en colonnes ---------------- */
.org-cols { display: flex; gap: 1rem; flex-wrap: wrap; align-items: flex-start; justify-content: center; }
.org-col { flex: 1 1 200px; max-width: 280px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.org-col-head { color: #fff; font-weight: 800; text-align: center; padding: .55rem; }
.org-resp { padding: .6rem; background: #f8fafc; }
.org-members { padding: .6rem; display: flex; flex-direction: column; gap: .5rem; }

/* ---------------- Mini-calendrier équipe ---------------- */
.team-weeks { display: flex; flex-wrap: wrap; gap: .35rem; margin: .4rem 0 .8rem; }
.team-week { width: 64px; border-radius: 8px; padding: .35rem; text-align: center; font-size: .72rem; border: 1px solid var(--border); }
.team-week.free { background: #dcfce7; border-color: #86efac; color: #166534; }
.team-week.busy { background: #fee2e2; border-color: #fca5a5; color: #991b1b; }
.team-week .tw-date { font-weight: 700; }
.team-week .tw-state { margin-top: .15rem; }

@media (max-width: 520px) {
  .org-col { max-width: 100%; flex-basis: 100%; }
  .team-week { width: 56px; }
}

/* ---------------- Gestion des absences : encadrés ---------------- */
.person-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .7rem; }
.person-box { border: 1px solid var(--border); border-radius: 10px; padding: .7rem .8rem; background: #f8fafc; }
.person-box .pb-name { font-weight: 700; }

/* Semaine "moi" dans le mini-calendrier d'année */
.team-week.mine { background: #dbeafe; border-color: #93c5fd; color: #1e40af; }

@media (max-width: 520px) {
  .person-grid { grid-template-columns: 1fr 1fr; }
}

/* ---------------- Retard chip & décompte saisie ---------------- */
.date-chip.retard { background: #fef9c3; color: #854d0e; border-color: #fde68a; }
.assign-solde { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; border-radius: 8px; padding: .55rem .7rem; margin: .5rem 0; font-size: .9rem; }
.mini-grid span.mini-closed { background: var(--danger); color: #fff; font-weight: 700; border-radius: 4px; }

/* ---------------- Page de garde / CGU ---------------- */
.cgu-wrap { min-height: 100vh; display: flex; align-items: flex-start; justify-content: center; padding: 2rem 1rem; background: var(--bg); }
.cgu-card { width: 100%; max-width: 760px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 2rem; }
.cgu-head { display: flex; align-items: center; gap: 1rem; margin-bottom: .5rem; }
.cgu-head h1 { margin: 0; font-size: 1.5rem; }
.cgu-logo { width: 56px; height: 56px; border-radius: 10px; background: #fff; object-fit: contain; }
.cgu-lead { color: var(--muted); }
.cgu-body { max-height: 48vh; overflow-y: auto; border: 1px solid var(--border); border-radius: 10px; padding: 1rem 1.2rem; margin: 1rem 0; background: #fafbfc; }
.cgu-body h3 { margin: 1rem 0 .3rem; font-size: 1rem; color: var(--brand); }
.cgu-body h3:first-child { margin-top: 0; }
.cgu-body p, .cgu-body li { font-size: .9rem; line-height: 1.55; }
.cgu-check { display: flex; align-items: flex-start; gap: .6rem; font-weight: 600; cursor: pointer; }
.cgu-check input { width: auto; margin-top: .2rem; }
.cgu-actions { display: flex; justify-content: space-between; gap: .8rem; margin-top: 1.2rem; flex-wrap: wrap; }

@media (max-width: 520px) { .cgu-card { padding: 1.2rem; } .cgu-body { max-height: 50vh; } }

/* ---------------- Règlement intérieur ---------------- */
.reglement { font-size: .9rem; line-height: 1.6; }
.reglement .ri-entete { text-align: center; border-bottom: 2px solid var(--brand); padding-bottom: 1rem; margin-bottom: 1rem; }
.reglement .ri-entete h1 { color: var(--brand); margin: .6rem 0 .3rem; font-size: 1.5rem; }
.reglement .ri-entete h2 { margin: 0; font-size: 1.1rem; }
.reglement h3 { color: var(--brand); border-top: 1px solid var(--border); padding-top: .8rem; margin: 1.2rem 0 .5rem; font-size: 1.05rem; }
.reglement h4 { margin: .9rem 0 .3rem; font-size: .95rem; color: #1e293b; }
.reglement ul { margin: .3rem 0 .6rem 1.1rem; }
.reglement p { margin: .4rem 0; }
.reglement-scroll { max-height: 50vh; overflow-y: auto; }

/* ---------------- Attestation PDF ---------------- */
.attestation { font-size: .95rem; line-height: 1.6; }
.attestation .att-head { display: flex; gap: 1rem; align-items: center; border-bottom: 2px solid var(--brand); padding-bottom: .8rem; }
.attestation .att-logo { width: 56px; height: 56px; object-fit: contain; }

/* ---------------- Véhicules ---------------- */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } }
.pill { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 700; background: #eef2f7; color: var(--brand); white-space: nowrap; }
.pill.ok { background: #dcfce7; color: #166534; }
.pill.warn { background: #fef3c7; color: #92400e; }
.pill.danger { background: #fee2e2; color: #991b1b; }
.pill.muted { background: #e2e8f0; color: var(--muted); }

.veh-issues { display: grid; grid-template-columns: 1fr 1fr; gap: .35rem .9rem; }
@media (max-width: 720px) { .veh-issues { grid-template-columns: 1fr; } }
.veh-check { display: flex; align-items: flex-start; gap: .5rem; font-size: .9rem; cursor: pointer; }
.veh-check input { width: auto; margin-top: .2rem; }

.veh-report { border: 1px solid var(--border); border-radius: 10px; padding: .7rem .9rem; margin-bottom: .7rem; }
.veh-report.card { border: 1px solid var(--border); }
.vr-head { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.vr-issues { margin: .4rem 0 0 1.1rem; }
.vr-issues li { margin: .1rem 0; }
.vr-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-top: .6rem; }
.vr-actions .vr-note { flex: 1 1 220px; }

.veh-table { width: 100%; border-collapse: collapse; }
.veh-table th, .veh-table td { padding: .45rem .5rem; border-bottom: 1px solid var(--border); text-align: left; font-size: .88rem; }
.veh-table tr.lvl-overdue td { background: #fef2f2; }
.veh-table tr.lvl-soon td { background: #fffbeb; }
.veh-alert-list { margin: .6rem 0 0; padding-left: 1.1rem; }
.veh-alert-list li { margin: .35rem 0; }

/* Schéma véhicule (tour du véhicule) */
.van-wrap { display: flex; justify-content: center; margin-top: .8rem; }
.van-svg { width: 260px; max-width: 100%; height: auto; }
.van-body { fill: #eef2f7; stroke: #94a3b8; stroke-width: 2; }
.van-cap { fill: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: 1px; }
.van-zone { fill: #cbd5e1; stroke: #fff; stroke-width: 2; opacity: .55; cursor: pointer; transition: opacity .15s, fill .15s; }
.van-zone:hover { opacity: .9; fill: var(--brand-2); }
.van-zone.has-mark { fill: var(--accent); opacity: .35; }
.van-mark circle { fill: var(--accent); }
.van-mark text { fill: #fff; font-size: 12px; font-weight: 700; pointer-events: none; }

.impact-row { display: flex; align-items: center; gap: .55rem; padding: .35rem 0; border-bottom: 1px solid var(--border); font-size: .9rem; }
.impact-row .btn { margin-left: auto; }
.dm-retard-list { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .3rem; }
.dm-retard-chip { display: inline-flex; align-items: center; gap: .35rem; font-size: .82rem; padding: .25rem .6rem; border: 1px solid var(--border); border-radius: 999px; background: #fff; cursor: pointer; }
.dm-retard-chip input { margin: 0; }
.bill-legend { display: flex; align-items: center; gap: .55rem; padding: .2rem 0 .3rem; font-size: .76rem; }
.il-kind { font-size: .68rem; font-weight: 800; border-radius: 999px; padding: .12rem .5rem; white-space: nowrap; min-width: 62px; text-align: center; }
.il-kind.kind-pts { background: #eff6ff; color: #1d4ed8; }
.il-kind.kind-days { background: #ecfeff; color: #0e7490; }
.il-kind.kind-amt { background: #fef3c7; color: #92400e; }
.impact-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); flex: none; }

.tr-checks { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem .9rem; }
@media (max-width: 720px) { .tr-checks { grid-template-columns: 1fr; } }
.tr-check-item { border: 1px solid var(--border); border-radius: 8px; padding: .5rem .6rem; }
.tr-check-item .tr-id { font-size: .85rem; }
.veh-warn-list li { margin: .5rem 0; }
.veh-warn-list .pill { margin-right: .35rem; }

/* Cartes véhicule repliables */
.veh-card { padding: 0; overflow: hidden; }
.veh-card-head { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; padding: .9rem 1.1rem; cursor: pointer; }
.veh-card-head:hover { background: #f8fafc; }
.veh-caret { color: var(--muted); font-size: .9rem; width: 1rem; }
.veh-card-body { padding: 0 1.1rem 1.1rem; }
.veh-usage-row { margin: 0 0 .6rem; font-size: .88rem; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.vr-reslist { margin: .4rem 0; display: grid; gap: .25rem; }

/* Bouton bascule ON/OFF (flotte active) */
.toggle { border: 0; border-radius: 999px; padding: .15rem .6rem; font-weight: 700; font-size: .72rem; color: #fff; }
.toggle.on { background: var(--ok); }
.toggle.off { background: #94a3b8; }

/* Étiquettes de zones sur le schéma véhicule */
.van-label { fill: #334155; font-size: 9px; font-weight: 600; pointer-events: none; }
.van-side-label { fill: #475569; font-size: 9px; font-weight: 600; pointer-events: none; }

/* Tour : base de référence + dommages réparés */
.veh-baseline { border-left: 4px solid var(--brand); }
.impact-row.repaired span { color: var(--muted); text-decoration: line-through; }
.tr-manq, .tr-dmg { margin-top: .2rem; }

/* Messagerie interne */
.msg-compose { display: grid; gap: .4rem; margin-bottom: .8rem; }
.msg-item { border: 1px solid var(--border); border-radius: 10px; padding: .6rem .8rem; margin-bottom: .6rem; }
.msg-item.unread { border-left: 4px solid var(--accent); background: #fff7f7; }
.msg-head { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.msg-body { margin: .3rem 0; font-size: .92rem; }

/* Responsable au-dessus de son équipe (gestion des absences) */
.abs-resp { background: #f1f5f9; border-radius: 10px; padding: .5rem .6rem; margin-bottom: .6rem; }

/* Compteur « déjà pris » (saisi) dans Salariés actifs */
.taken-base { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .3rem; align-items: center; }
.taken-base label { display: inline-flex; align-items: center; gap: .25rem; margin: 0; font-size: .72rem; color: var(--muted); font-weight: 600; }
.taken-base input { width: 58px; padding: .25rem .35rem; font-size: .82rem; }

/* Lignes de kit d'entretien / pièces additionnelles */
.kit-line { display: flex; gap: .4rem; align-items: center; margin: .3rem 0; flex-wrap: wrap; }
.kit-line .kit-cat { flex: 0 0 130px; font-size: .85rem; font-weight: 600; }
.kit-line select { flex: 1 1 160px; }
.kit-line input { width: 80px; }

/* Entretiens programmés */
.sched-box { background: #fffbeb; border-radius: 8px; padding: .4rem .6rem; margin-top: .6rem; }

/* Ordre de réparation (style garage) */
.repair-order { border-top: 4px solid var(--brand); }
.ro-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .4rem; border-bottom: 1px solid var(--border); padding-bottom: .5rem; margin-bottom: .5rem; }
.ro-tag { background: var(--brand); color: #fff; font-weight: 800; font-size: .72rem; padding: .15rem .5rem; border-radius: 4px; letter-spacing: .5px; }
.ro-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: .5rem; font-size: .9rem; }
.ro-checkup { grid-template-columns: 1fr 1fr; }
@media (max-width: 600px) { .ro-checkup { grid-template-columns: 1fr; } }

/* Tableau de bord estimation : indicateurs & feux tricolores */
.tnd-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .7rem; }
.tnd-ind { border: 1px solid var(--border); border-radius: 10px; padding: .7rem .8rem; }
.tnd-ind-top { display: flex; align-items: center; gap: .4rem; font-size: .82rem; color: var(--muted); font-weight: 600; }
.tnd-ind-val { font-size: 1.3rem; font-weight: 800; color: var(--brand); margin-top: .2rem; }
.feu { width: 12px; height: 12px; border-radius: 50%; display: inline-block; flex: none; }
.feu-green { background: var(--ok); }
.feu-orange { background: var(--warn); }
.feu-red { background: var(--danger); }

/* Plan de comptes (financière) */
.acct { border: 1px solid var(--border); border-radius: 8px; margin-bottom: .45rem; }
.acct-head { display: flex; align-items: center; gap: .5rem; padding: .55rem .7rem; cursor: pointer; }
.acct-head:hover { background: #f8fafc; }
.acct-caret { color: var(--muted); width: .9rem; }
.acct-total { margin-left: auto; font-weight: 700; }
.acct-subs { padding: 0 .7rem .5rem 2rem; }
.acct-sub { display: flex; justify-content: space-between; padding: .25rem 0; border-top: 1px dashed var(--border); font-size: .9rem; }

/* Coûts d'exploitation (barres) */
.cost-bar { height: 10px; background: #eef2f7; border-radius: 999px; overflow: hidden; margin: .5rem 0 .3rem; }
.cost-bar-fill { height: 100%; background: linear-gradient(90deg, var(--brand-2), var(--accent)); }

/* Graphiques financiers (barres résultat) */
.bars { display: flex; gap: .5rem; align-items: flex-end; overflow-x: auto; padding: .5rem 0; }
.bar-col { flex: 0 0 auto; min-width: 56px; text-align: center; }
.bar-wrap { height: 120px; display: flex; align-items: flex-end; justify-content: center; }
.bar { width: 26px; border-radius: 6px 6px 0 0; min-height: 3px; }
.bar.pos { background: var(--ok); }
.bar.neg { background: var(--danger); }
.bar-lbl { font-size: .72rem; color: var(--muted); margin-top: .25rem; white-space: nowrap; }
.bar-val { font-size: .72rem; font-weight: 700; }
.pos { color: #15803d; }
.neg { color: var(--danger); }
td.pos { color: #15803d; font-weight: 700; }
td.neg { color: var(--danger); font-weight: 700; }

/* ============== RESPONSIVE (mobile / tablette) ============== */
@media (max-width: 860px) {
  /* Évite le zoom auto iOS et améliore la lisibilité des champs */
  input, select, textarea { font-size: 16px; padding: .7rem .8rem; }
  label { font-size: .95rem; }
  /* Icône du menu nettement plus grande et lisible */
  .nav-toggle {
    top: .55rem; left: .6rem; padding: .55rem .8rem; font-size: 1.5rem;
    background: rgba(255,255,255,.22); border-radius: 10px;
  }
  .sidebar .brand { font-size: 1.05rem; padding-left: 4rem; min-height: 56px; }
  .sidebar .brand .brand-logo { width: 34px; height: 34px; flex-basis: 34px; }
  /* Cibles tactiles plus grandes dans le menu */
  .sidebar nav button { font-size: 1.05rem; padding: .9rem 1rem; }
  .nav-section { font-size: .8rem; }
  /* Onglets : défilables horizontalement, plus gros */
  .view-switch { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .view-switch button { font-size: .95rem; padding: .6rem .9rem; white-space: nowrap; flex: 0 0 auto; }
  .btn { font-size: 1rem; }
  .btn.sm { font-size: .9rem; padding: .45rem .75rem; }
  .page-head h1 { font-size: 1.35rem; }
  .bar-col { min-width: 64px; }
}
@media (max-width: 520px) {
  .main { padding: .7rem; }
  .grid2 { grid-template-columns: 1fr; }
  .person-grid { grid-template-columns: 1fr; }
  /* Tableaux larges : police lisible + scroll horizontal géré par .table-wrap */
  .veh-table th, .veh-table td { font-size: .9rem; padding: .5rem .45rem; }
}

/* Mise en avant au survol (« consultation ») : zoom léger + surlignage rouge.
   Utilisé sur les tableaux/cartes d'estimation de la Gestion des heures. */
.zoom-hover { transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
.zoom-hover:hover {
  transform: scale(1.025);
  border: 1px solid #dc2626 !important;
  box-shadow: 0 6px 22px rgba(220, 38, 38, .25);
  position: relative;
  z-index: 2;
}
.zoom-hover:hover .veh-table tbody tr:hover { background: rgba(220, 38, 38, .08); }

/* =========================================================================
   REFRESH UI/UX 2026 — surcouche moderne (additive, responsive préservé).
   Règles ajoutées en fin de fichier : priorité au plus récent à spécificité
   égale, donc enrichissement sans casser l'existant.
   ========================================================================= */

body {
  background:
    radial-gradient(1200px 600px at 100% -5%, rgba(31, 94, 168, .06), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(212, 48, 45, .05), transparent 55%),
    var(--bg);
  font-family: 'Inter', 'Segoe UI', Roboto, -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Transitions douces et globales (interactions) */
.btn, .sidebar nav button, .card, .stat, .view-switch button, input, select, textarea,
.pill, .tag, .nav-btn, .veh-card-head, table tbody tr, .auth-tabs button, .toggle {
  transition: background-color .18s var(--ease), color .18s var(--ease),
    border-color .18s var(--ease), box-shadow .22s var(--ease), transform .15s var(--ease);
}

/* ---- Boutons : dégradé, profondeur, hover/active ---- */
.btn {
  background: var(--grad-brand); color: #fff; border: 0; border-radius: var(--radius-sm);
  box-shadow: 0 1px 2px rgba(15,23,42,.12), 0 2px 6px rgba(20,66,126,.18);
  font-weight: 600; letter-spacing: .1px;
}
.btn:hover { background: var(--grad-brand); filter: brightness(1.07); box-shadow: 0 4px 12px rgba(20,66,126,.28); transform: translateY(-1px); }
.btn.accent:hover { background: var(--grad-accent); }
.btn.ok:hover { background: linear-gradient(135deg, #1bb255, #16a34a); }
.btn.danger:hover { background: linear-gradient(135deg, #ef4444, #dc2626); }
.btn:active { transform: translateY(0); filter: brightness(.97); box-shadow: 0 1px 2px rgba(15,23,42,.18); }
.btn.accent { background: var(--grad-accent); box-shadow: 0 2px 8px rgba(212,48,45,.25); }
.btn.ok { background: linear-gradient(135deg, #1bb255, #16a34a); box-shadow: 0 2px 8px rgba(22,163,74,.25); }
.btn.danger { background: linear-gradient(135deg, #ef4444, #dc2626); box-shadow: 0 2px 8px rgba(220,38,38,.25); }
/* Ghost : fond transparent (fonctionne sur fond clair ET sur la barre latérale
   sombre — sinon texte blanc sur blanc). On ne change PAS la couleur du texte. */
.btn.ghost { background: transparent; border: 1px solid var(--border); box-shadow: none; }
.btn.ghost:hover { background: rgba(127, 137, 153, .14); filter: none; box-shadow: none; transform: translateY(-1px); }
.btn:focus-visible, .nav-btn:focus-visible, .view-switch button:focus-visible { outline: none; box-shadow: var(--ring); }

/* ---- Champs de saisie ---- */
input, select, textarea {
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface);
  padding: .6rem .7rem;
}
input:hover, select:hover, textarea:hover { border-color: #cbd5e1; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand-2); box-shadow: var(--ring); }

/* ---- Cartes : profondeur + survol ---- */
.card {
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box;
}
.card:hover { box-shadow: var(--shadow-md); }
.stat { border-radius: var(--radius); position: relative; overflow: hidden; }
.stat::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--grad-brand); opacity: .9; }
.stat.alt::before { background: var(--grad-accent); }
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

/* ---- Barre latérale : dégradé + indicateur actif ---- */
.sidebar { background: var(--grad-sidebar); }
.sidebar nav button { position: relative; }
.sidebar nav button.active {
  background: rgba(255,255,255,.12); box-shadow: inset 0 0 0 1px rgba(255,255,255,.06);
}
.sidebar nav button.active::before {
  content: ""; position: absolute; left: -.2rem; top: 18%; bottom: 18%; width: 3px;
  border-radius: 3px; background: var(--accent);
}
.sidebar nav button:hover { transform: translateX(2px); }

/* ---- Onglets segmentés (view-switch) : RECTANGULAIRES, pas d'ovale ----
   rayon FAIBLE (10px) -> rectangle ; on garde overflow:hidden hérité, qui clippe
   proprement les coins (plus d'ovale). Le scroll horizontal mobile (défini plus
   haut) reste actif, on ne le contrarie pas. */
.view-switch { border-radius: var(--radius-sm); background: var(--surface-2); border-color: var(--border); box-shadow: inset 0 1px 2px rgba(15,23,42,.04); }
.view-switch button { border-radius: 8px; margin: 2px; }
.view-switch button.active { background: var(--grad-brand); color: #fff; box-shadow: 0 2px 6px rgba(20,66,126,.25); }

/* ---- Étiquettes : rectangles légèrement arrondis (préférence) ---- */
.pill, .tag, .group-chip { border-radius: 6px; }

/* ---- Tableaux : survol de ligne + en-tête doux ---- */
.table-wrap { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow-x: auto; overflow-y: hidden; }
.table-wrap table { margin: 0; }
table tbody tr:hover td { background: var(--surface-2); }
.veh-table tbody tr:hover td { background: var(--surface-2); }

/* ---- Pills & tags : léger relief ---- */
.pill, .tag { box-shadow: inset 0 0 0 1px rgba(15,23,42,.04); }

/* ---- Alertes : barre d'accent à gauche ---- */
.alert { border-radius: var(--radius-sm); border-left-width: 4px; }
.alert.info { border-left-color: #3b82f6; }
.alert.warn { border-left-color: var(--warn); }

/* ---- Page head : titre net ---- */
.page-head h1 { letter-spacing: -.2px; }

/* ---- Modale : flou d'arrière-plan + animation d'entrée ---- */
.modal-overlay { background: rgba(15,23,42,.45); backdrop-filter: blur(4px); animation: erp-fade .18s var(--ease); }
.modal { border-radius: var(--radius); box-shadow: var(--shadow-md); animation: erp-pop .2s var(--ease); }
@keyframes erp-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes erp-pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }

/* ---- Barres de défilement fines ---- */
* { scrollbar-width: thin; scrollbar-color: #c2ccd9 transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: #c2ccd9; border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: #a7b4c6; background-clip: padding-box; }

/* ---- Accessibilité : respect du « mouvement réduit » ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  .btn:hover, .stat:hover, .sidebar nav button:hover { transform: none; }
}

/* ---- Menu : groupes dépliables (sidebar) -------------------------------- */
.nav-group { margin-bottom: .1rem; }
.nav-group-head {
  display: flex; align-items: center; gap: .7rem; width: 100%; text-align: left;
  padding: .7rem .8rem; margin-bottom: .15rem; border: 0; background: transparent;
  color: #cdd9e8; border-radius: 8px; font-size: .92rem; font-weight: 600;
}
.nav-group-head:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-group-title { flex: 1; }
.nav-caret { font-size: .7rem; opacity: .65; transition: transform .18s var(--ease); }
.nav-group.open > .nav-group-head .nav-caret { transform: rotate(90deg); opacity: .9; }
.nav-group-items { display: none; }
.nav-group.open > .nav-group-items { display: block; }
.nav-group-items button[data-view] { padding-left: 2.3rem; font-size: .89rem; font-weight: 500; }
/* Repère discret quand un groupe replié contient la vue active */
.nav-group:not(.open) > .nav-group-head { position: relative; }

/* =========================================================================
   MODE APPLICATION (PWA) + ergonomie tactile mobile.
   Desktop inchangé : la barre de navigation basse et les marges « safe-area »
   ne s'activent que sur petit écran / en mode application installée.
   ========================================================================= */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { -webkit-tap-highlight-color: transparent; overscroll-behavior-y: contain; }
button, a, .btn, .sidebar nav button, .nav-group-head, .view-switch button { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }

/* Barre de navigation basse — style application native, mobile uniquement. */
.bottom-nav { display: none; }
@media (max-width: 860px) {
  .bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: rgba(255,255,255,.96); backdrop-filter: saturate(180%) blur(12px);
    border-top: 1px solid var(--border); box-shadow: 0 -2px 16px rgba(15,23,42,.08);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .bottom-nav button {
    flex: 1; border: 0; background: transparent; cursor: pointer;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    padding: .45rem 0 .4rem; min-height: 54px; color: var(--muted); font-size: .66rem; font-weight: 600;
    transition: color .15s var(--ease);
  }
  .bottom-nav button .bn-ico { font-size: 1.3rem; line-height: 1; }
  .bottom-nav button.active { color: var(--brand-2); }
  .bottom-nav button.active .bn-ico { transform: translateY(-1px); }
  .bottom-nav .bn-badge { position: absolute; top: 6px; margin-left: 18px; background: var(--accent); color: #fff; border-radius: 999px; font-size: .6rem; font-weight: 700; padding: 0 .3rem; line-height: 1.4; }

  /* Laisse la place à la barre basse et au notch. */
  .main { padding-bottom: calc(66px + env(safe-area-inset-bottom)); }
  /* La barre supérieure (logo + menu) passe sous l'encoche. */
  .sidebar { padding-top: env(safe-area-inset-top); max-height: calc(64px + env(safe-area-inset-top)); }
  .sidebar.nav-open { max-height: 100vh; }
  .nav-toggle { top: calc(.6rem + env(safe-area-inset-top)); }
  /* Cibles tactiles confortables. */
  .sidebar nav button, .nav-group-head { min-height: 44px; }
  /* Évite le zoom automatique iOS au focus d'un champ (police ≥ 16px). */
  input, select, textarea { font-size: 16px; }
}

/* En mode application installée (plein écran), on respecte aussi l'encoche. */
@media (display-mode: standalone) {
  .sidebar { padding-top: env(safe-area-inset-top); }
  .auth-wrap, .cgu-wrap { padding-top: env(safe-area-inset-top); }
}
/* ---- Vue Agenda du planning (lisible, idéale mobile) -------------------- */
.agenda { display: flex; flex-direction: column; gap: .5rem; }
.agenda-day { font-size: .8rem; font-weight: 700; color: var(--muted); text-transform: capitalize; margin-top: .5rem; padding-bottom: .1rem; border-bottom: 1px solid var(--border); }
.agenda-day:first-child { margin-top: 0; }
.agenda-item { display: flex; align-items: center; gap: .6rem; padding: .55rem .7rem; border: 1px solid var(--border); border-left: 4px solid var(--brand); border-radius: var(--radius-sm); background: var(--surface); box-shadow: var(--shadow); }
.agenda-main { flex: 1; min-width: 0; }
.agenda-top { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.agenda-item .help { margin-top: .15rem; }

/* ---- Calendrier : confort sur mobile ----------------------------------- */
.table-wrap { -webkit-overflow-scrolling: touch; }
@media (max-width: 860px) {
  .cal-toolbar { gap: .4rem; }
  .cal-toolbar .title { width: 100%; order: -1; font-size: 1.05rem; font-weight: 700; }
  .cal-toolbar .view-switch { overflow-x: auto; max-width: 100%; }
}
@media (max-width: 520px) {
  /* Mois : on garde l'aperçu mais en plus compact et lisible. */
  .month-grid .cell { min-height: 52px; padding: 2px; }
  .month-grid .cell .ev { font-size: .58rem; }
  .month-grid .dow { font-size: .62rem; }
  .legend { font-size: .72rem; }
}
/* ---- Mois compact (téléphone) : pastilles au lieu du détail texte -------- */
.month-grid.compact { gap: 2px; }
.month-grid.compact .cell { min-height: 46px; padding: 3px 0 2px; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; cursor: pointer; gap: 0; }
.month-grid.compact .cell .num { font-size: .82rem; font-weight: 600; }
.month-grid.compact .cell.today .num { background: var(--brand); color: #fff; border-radius: 50%; width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; }
.month-grid.compact .cell.out { opacity: .4; }
.month-grid.compact .day-flag { font-size: .58rem; line-height: 1; }
.month-grid.compact .ev-dots { display: flex; gap: 2px; justify-content: center; align-items: center; flex-wrap: wrap; margin-top: 3px; min-height: 8px; }
.month-grid.compact .ev-dot { width: 6px; height: 6px; border-radius: 50%; box-shadow: 0 0 0 1px rgba(255,255,255,.5) inset; }
.month-grid.compact .ev-more { font-size: .55rem; color: var(--muted); font-weight: 700; line-height: 1; }
.month-grid.compact .dow { font-size: .68rem; }

/* =========================================================================
   Géolocalisation — cartes véhicules responsives + tableaux
   ========================================================================= */
.geo-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .5rem; margin-bottom: .6rem; }
.geo-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: .7rem; }
.geo-card { border: 1px solid var(--border); border-left: 5px solid var(--muted); border-radius: 12px; padding: .7rem .8rem; background: #fff; box-shadow: 0 1px 3px rgba(15, 23, 42, .06); }
.geo-card.geo-green { border-left-color: #16a34a; }
.geo-card.geo-yellow { border-left-color: #eab308; }
.geo-card.geo-orange { border-left-color: #ea580c; }
.geo-card.geo-depot { border-left-color: #2563eb; }
.geo-card.geo-grey { border-left-color: #94a3b8; }
.geo-card-top { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.geo-name { font-weight: 700; display: flex; align-items: center; gap: .4rem; min-width: 0; }
.geo-name { overflow: hidden; text-overflow: ellipsis; }
.geo-dot { width: 11px; height: 11px; border-radius: 50%; flex: 0 0 auto; box-shadow: 0 0 0 2px rgba(255,255,255,.7) inset; }
.geo-speed { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--muted); background: #f1f5f9; border-radius: 999px; padding: .12rem .55rem; font-size: .82rem; white-space: nowrap; }
.geo-speed.on { color: #fff; background: #16a34a; }
.geo-sub { font-size: .78rem; color: var(--muted); margin-top: .1rem; }
.geo-addr { font-size: .86rem; margin: .45rem 0 .35rem; line-height: 1.35; }
.geo-maps { font-size: .78rem; white-space: nowrap; }
.geo-status-line { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.geo-badge { font-size: .74rem; font-weight: 700; border-radius: 6px; padding: .1rem .45rem; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-top: .4rem; }
.geo-recap-table .geo-wk-total { text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.geo-recap-table tr.geo-wk-hit .geo-wk-total { color: #ea580c; }
.geo-recap-table tr.geo-wk-zero td { color: var(--muted); }
@media (max-width: 600px) {
  .geo-cards { grid-template-columns: 1fr; }
}

/* Géolocalisation — menus déroulants (accueil) */
.geo-drop { border: 1px solid var(--border); border-radius: 10px; padding: .2rem .6rem; margin-top: .5rem; background: #fff; }
.geo-drop > summary { cursor: pointer; font-weight: 700; padding: .55rem .2rem; list-style: none; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.geo-drop > summary::-webkit-details-marker { display: none; }
.geo-drop > summary::before { content: '▸'; color: var(--muted); transition: transform .15s; }
.geo-drop[open] > summary::before { transform: rotate(90deg); }
.geo-drop-main { border-color: var(--brand); }
.geo-count { font-size: .74rem; font-weight: 700; background: #eef2ff; color: var(--brand); border-radius: 999px; padding: .1rem .5rem; }
.geo-count.alt { background: #eff6ff; color: #2563eb; }
.geo-drop > summary + * { margin-top: .3rem; }

/* Géolocalisation — kilométrage & consommation par véhicule */
.geo-stats { margin-top: .5rem; padding-top: .45rem; border-top: 1px dashed var(--border); display: flex; flex-direction: column; gap: .3rem; }
.geo-km { font-size: .8rem; }
.geo-rate { font-size: .8rem; font-weight: 700; border-radius: 6px; padding: .2rem .5rem; display: inline-block; }
.geo-rate-green { background: #dcfce7; color: #166534; }
.geo-rate-yellow { background: #fef9c3; color: #854d0e; }
.geo-rate-red { background: #fee2e2; color: #b91c1c; }
.geo-rate-na { background: #f1f5f9; color: #64748b; }

/* Accueil — sections repliables (accordéon) avec en-tête visible + KPI */
.dash-acc { margin: 0 0 .85rem; }
.dash-acc > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: .6rem; font-size: 1.02rem; color: var(--text); padding: .7rem .85rem; background: #fff; border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 1px 3px rgba(15,23,42,.06); transition: background .12s, box-shadow .12s; }
.dash-acc > summary::-webkit-details-marker { display: none; }
.dash-acc > summary:hover { background: #f8fafc; box-shadow: 0 2px 8px rgba(15,23,42,.10); }
.dash-chev { flex: 0 0 auto; width: 28px; height: 28px; border-radius: 50%; background: #eef2ff; color: var(--brand); display: inline-flex; align-items: center; justify-content: center; font-size: 1.25rem; font-weight: 800; line-height: 1; transition: transform .18s, background .18s, color .18s; }
.dash-acc[open] .dash-chev { transform: rotate(90deg); background: var(--brand); color: #fff; }
.dash-title { flex: 1; font-weight: 800; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.dash-kpi { flex: 0 0 auto; font-size: .8rem; font-weight: 800; border-radius: 999px; padding: .2rem .65rem; white-space: nowrap; }
.dash-kpi.tone-warn { background: #fee2e2; color: #b91c1c; }
.dash-kpi.tone-info { background: #eff6ff; color: #1d4ed8; }
.dash-kpi.tone-ok { background: #dcfce7; color: #166534; }
.dash-acc[open] > summary { border-radius: 14px 14px 0 0; border-bottom: none; }
.dash-acc > .card { margin: 0; border-top: none; border-radius: 0 0 14px 14px; box-shadow: none; }

/* Sur ordinateur : sections repliées en grille (plusieurs côte à côte) ;
   la section ouverte passe en pleine largeur pour révéler le détail. */
@media (min-width: 769px) {
  #dash-body { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); align-items: start; }
  #dash-body > :not(.dash-acc) { grid-column: 1 / -1; }   /* aperçu, géoloc, etc. en pleine largeur */
  #dash-body > .dash-acc { margin: 0; }
  #dash-body > .dash-acc[open] { grid-column: 1 / -1; }   /* section ouverte = pleine largeur */
}

/* Chevrons plus visibles sur les autres menus déroulants (géoloc…). */
.geo-drop > summary::before { content: '›'; display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; background: #eef2ff; color: var(--brand); font-size: 1.05rem; font-weight: 800; transition: transform .18s; }
.geo-drop[open] > summary::before { transform: rotate(90deg); }
.geo-drop-main > summary::before { background: rgba(255,255,255,.22); color: #fff; }

/* Géolocalisation — coût d'utilisation par pôle */
.geo-cost-legend { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .8rem; margin: .3rem 0; }
.geo-cost-legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: .3rem; vertical-align: -1px; }
.geo-cost-bar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: #eef2f7; margin: .15rem 0; }
.geo-cost-bar.geo-cost-grand { height: 18px; border-radius: 9px; margin-bottom: .6rem; }
.geo-cost-seg { display: block; height: 100%; }
.geo-cost-row { padding: .5rem 0; border-bottom: 1px solid var(--border); }
.geo-cost-head { display: flex; align-items: center; gap: .5rem; }
.geo-cost-total { margin-left: auto; font-weight: 800; font-variant-numeric: tabular-nums; }

/* Géolocalisation — pastilles de statut dans le résumé */
.geo-chip { font-size: .72rem; font-weight: 700; border-radius: 999px; padding: .12rem .5rem; background: #f1f5f9; color: #475569; white-space: nowrap; }

/* Géolocalisation — retard prise de poste + pied dépôt */
.geo-late { margin-top: .35rem; font-size: .82rem; font-weight: 700; color: #b91c1c; background: #fee2e2; border-radius: 6px; padding: .25rem .5rem; }
.geo-depot-foot { margin-top: .6rem; padding-top: .5rem; border-top: 1px dashed var(--border); font-size: .82rem; }
.geo-depot-foot ul { margin: .3rem 0 0; padding-left: 1.1rem; }
.geo-depot-foot li { margin: .15rem 0; }

/* Géolocalisation — sous-menus déroulants + récap hebdo en barres */
.geo-sub { margin-top: .5rem; }
.geo-drop-body { padding: .35rem .2rem .2rem; }
.geo-wk-row { padding: .4rem 0; border-bottom: 1px solid var(--border); }
.geo-wk-row.geo-wk-zero { opacity: .45; }
.geo-wk-top { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; font-size: .84rem; }
.geo-wk-week { color: var(--muted); }
.geo-wk-num { white-space: nowrap; }
.geo-wk-track { height: 8px; background: #eef2f7; border-radius: 4px; overflow: hidden; margin-top: .3rem; }
.geo-wk-fill { display: block; height: 100%; background: #ea580c; border-radius: 4px; }
.geo-wk-detail { margin-top: .3rem; }

/* Géolocalisation — mise en avant du panneau d'accueil */
.geo-drop-main { border: 2px solid var(--brand); border-radius: 14px; box-shadow: 0 4px 16px rgba(20,66,126,.16); overflow: hidden; }
.geo-drop-main > summary { background: linear-gradient(135deg, #14427e, #2563eb); color: #fff; padding: .85rem 1rem; font-size: 1.05rem; border-radius: 0; }
.geo-drop-main > summary::before { color: rgba(255,255,255,.8); }
.geo-drop-main > summary:hover { filter: brightness(1.06); background: linear-gradient(135deg, #14427e, #2563eb); }
.geo-main-title { font-weight: 800; letter-spacing: .2px; }
.geo-drop-main[open] > summary { box-shadow: 0 2px 6px rgba(0,0,0,.12); }
.geo-drop-main > .geo-drop-body, .geo-drop-main > *:not(summary) { padding: 0 .6rem; }

/* Géolocalisation — excès & récap en cartes responsives */
.geo-ex-card, .geo-wk-card { border: 1px solid var(--border); border-left: 4px solid #ea580c; border-radius: 10px; padding: .55rem .7rem; margin: .45rem 0; background: #fff; }
.geo-ex-head, .geo-wk-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap; }
.geo-ex-veh, .geo-wk-week { font-weight: 700; }
.geo-ex-count, .geo-wk-tot { font-size: .76rem; font-weight: 800; color: #b91c1c; background: #fee2e2; border-radius: 999px; padding: .14rem .6rem; white-space: nowrap; }
.geo-ex-chips, .geo-wk-chips { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .5rem; }
.geo-ex-chip, .geo-wk-chip { font-size: .76rem; background: #f1f5f9; color: #334155; border-radius: 6px; padding: .18rem .5rem; white-space: nowrap; }
.geo-recap-sum { background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; border-radius: 10px; padding: .55rem .75rem; font-size: .92rem; margin-bottom: .4rem; }

/* Géolocalisation — boutons PDF chauffeur */
.geo-pdf-row { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin: .2rem 0 .6rem; }
.geo-ex-head .btn.sm { margin-left: auto; }
.geo-chart-wrap { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: .6rem .7rem; margin: .4rem 0 .7rem; }
.geo-chart-title { font-size: .82rem; font-weight: 700; color: #334155; margin-bottom: .3rem; }
.geo-recap-proj { background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; border-radius: 8px; padding: .45rem .7rem; font-size: .85rem; margin: .3rem 0 .5rem; }
/* Le graphique « PC » est mis en avant sur grand écran, compact sur téléphone. */
@media (max-width: 768px) { .geo-chart-pc .geo-chart-title { font-size: .78rem; } }

/* Carburant — KPI & alertes */
.fuel-kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .7rem; margin-bottom: 1rem; }
.fuel-kpi { background: #fff; border: 1px solid var(--border); border-left: 4px solid #94a3b8; border-radius: 12px; padding: .75rem .9rem; box-shadow: 0 1px 3px rgba(15,23,42,.05); }
.fuel-kpi .fk-val { font-size: 1.6rem; font-weight: 800; color: #0f172a; line-height: 1.1; }
.fuel-kpi .fk-val small { font-size: .8rem; font-weight: 700; color: #64748b; }
.fuel-kpi .fk-lbl { font-size: .82rem; font-weight: 700; color: #334155; margin-top: .15rem; }
.fuel-kpi .fk-sub { font-size: .72rem; color: #94a3b8; }
.fuel-kpi.tone-ok { border-left-color: #16a34a; }
.fuel-kpi.tone-warn { border-left-color: #f59e0b; }
.fuel-kpi.tone-alert { border-left-color: #dc2626; }
.fuel-kpi.tone-alert .fk-val { color: #b91c1c; }
.fuel-alerts > summary { cursor: pointer; }
.fuel-alert-list { list-style: none; padding: 0; margin: .6rem 0 0; display: flex; flex-direction: column; gap: .35rem; }
.fuel-alert-list li { font-size: .84rem; padding: .4rem .6rem; border-radius: 8px; background: #f8fafc; border-left: 3px solid #94a3b8; }
.fuel-alert-list li.al-alert { background: #fef2f2; border-left-color: #dc2626; color: #7f1d1d; }
.fuel-alert-list li.al-warn { background: #fffbeb; border-left-color: #f59e0b; color: #78350f; }
.fuel-alert-list .al-veh { font-weight: 800; }
.fuel-alert-list .al-drv { font-weight: 700; }

/* Géolocalisation — gasoil consommé du jour (arrêt prolongé) */
.geo-fuelday { margin-top: .35rem; font-size: .82rem; background: #fff7ed; color: #9a3412; border: 1px solid #fed7aa; border-radius: 6px; padding: .25rem .5rem; }
.geo-odo { margin-top: .35rem; font-size: .82rem; background: #f1f5f9; color: #334155; border: 1px solid #e2e8f0; border-radius: 6px; padding: .25rem .5rem; }
