/* =====================================================================
   ESPRIT SERVICES — interface de gestion
   Couleurs pilotées par l'administration (variables --primaire,
   --secondaire, --accent, --fond-app injectées par le gabarit).
   Mobile d'abord, thème clair / sombre, contrastes WCAG AA.
   ===================================================================== */

@font-face { font-family: "Inter"; src: url("../fonts/inter/inter-latin-wght-normal.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Nunito Sans"; src: url("../fonts/nunito-sans/nunito-sans-latin-wght-normal.woff2") format("woff2"); font-weight: 200 1000; font-display: swap; }

:root {
  --primaire: #315C52; --primaire-fonce: #23453D; --primaire-clair: #E5EEEA; --sur-primaire: #fff;
  --secondaire: #17324D; --secondaire-clair: #2a4560; --sur-secondaire: #fff;
  --accent: #CF684D; --accent-clair: #FBEDE8; --fond-app: #F7F4ED;
  --surface: #ffffff; --surface-2: #faf8f3; --texte: #17324D; --texte-doux: #52667a; --bord: #e4ded0;
  --ok: #1E6B4B; --ok-fond: #E3F2EA; --warn: #8A5A00; --warn-fond: #FFF4D6;
  --danger: #A12A1A; --danger-fond: #FCEAE6; --info: #1d5a8c; --info-fond: #E4EFF8; --muted: #5b6b7a; --muted-fond: #EEF0F2;
  --ombre: 0 1px 2px rgba(23,50,77,.06), 0 6px 20px rgba(23,50,77,.06);
  --rayon: 14px; --rayon-petit: 9px;
  --titres: "Nunito Sans", "Segoe UI", system-ui, sans-serif;
  --corps: "Inter", "Segoe UI", system-ui, sans-serif;
  --largeur-nav: 264px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --surface: #18222d; --surface-2: #1e2a37; --texte: #e8edf2; --texte-doux: #a7b4c2; --bord: #2c3a48; --fond-app: #111a23;
    --ok-fond: #12382a; --ok: #7fd8ac; --warn-fond: #3d2f0b; --warn: #f3c969; --danger-fond: #3f1a14; --danger: #ff9f8c;
    --info-fond: #13304a; --info: #8cc4f2; --muted-fond: #25313d; --muted: #b3bfcb; --primaire-clair: #1f3a33; --accent-clair: #3a2620;
    --ombre: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --surface: #18222d; --surface-2: #1e2a37; --texte: #e8edf2; --texte-doux: #a7b4c2; --bord: #2c3a48; --fond-app: #111a23;
  --ok-fond: #12382a; --ok: #7fd8ac; --warn-fond: #3d2f0b; --warn: #f3c969; --danger-fond: #3f1a14; --danger: #ff9f8c;
  --info-fond: #13304a; --info: #8cc4f2; --muted-fond: #25313d; --muted: #b3bfcb; --primaire-clair: #1f3a33; --accent-clair: #3a2620;
  --ombre: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25); color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--corps); font-size: 15px; line-height: 1.55; color: var(--texte); background: var(--fond-app); }
h1, h2, h3, h4 { font-family: var(--titres); line-height: 1.2; margin: 0 0 .6em; font-weight: 800; letter-spacing: -.01em; }
h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 .8em; }
a { color: var(--primaire); }
/* Thème sombre : liens et icônes éclaircis pour garder un contraste AA. */
:root[data-theme="dark"] .contenu a:not(.btn):not(.kpi):not(.creneau):not(.mission):not(.mini),
:root[data-theme="dark"] .auth-carte a, :root[data-theme="dark"] .auth-pied a { color: color-mix(in srgb, var(--primaire) 45%, #fff); }
:root[data-theme="dark"] .kpi-icone, :root[data-theme="dark"] .vide-icone { color: color-mix(in srgb, var(--primaire) 40%, #fff); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .contenu a:not(.btn):not(.kpi):not(.creneau):not(.mission):not(.mini),
  :root:not([data-theme="light"]) .auth-carte a, :root:not([data-theme="light"]) .auth-pied a { color: color-mix(in srgb, var(--primaire) 45%, #fff); }
  :root:not([data-theme="light"]) .kpi-icone, :root:not([data-theme="light"]) .vide-icone { color: color-mix(in srgb, var(--primaire) 40%, #fff); }
}
img, svg { max-width: 100%; }
.ic { width: 18px; height: 18px; flex-shrink: 0; vertical-align: middle; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.visuellement-cache { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.lien-evitement { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--surface); padding: 8px 14px; border-radius: 8px; }
.lien-evitement:focus { left: 8px; }
.muted { color: var(--texte-doux); } .petit { font-size: .85rem; } .gras { font-weight: 700; }
.droite { text-align: right; } .centre { text-align: center; } .nowrap { white-space: nowrap; }
.mt { margin-top: 1rem; } .mb0 { margin-bottom: 0; }
code, .mono { font-family: ui-monospace, Consolas, monospace; font-size: .88em; }

/* ── Coque : menu latéral + contenu ──────────────────────────────── */
.coque { display: flex; min-height: 100vh; }
.barre-laterale {
  width: var(--largeur-nav); flex-shrink: 0; background: var(--secondaire); color: var(--sur-secondaire);
  position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; z-index: 40;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.2) transparent;
}
.marque { display: flex; flex-direction: column; gap: 6px; padding: 18px 20px 14px; border-bottom: 1px solid rgba(255,255,255,.08); }
.marque-logo { max-height: 44px; width: auto; background: #fff; border-radius: 10px; padding: 5px 8px; }
.marque-nom { font-family: var(--titres); font-weight: 800; font-size: .95rem; opacity: .9; }
.nav { padding: 10px 10px 20px; flex: 1; }
.nav ul { list-style: none; margin: 0; padding: 0; }
.nav-groupe { font-size: .7rem; text-transform: uppercase; letter-spacing: .09em; opacity: .55; margin: 16px 12px 6px; font-weight: 700; }
.nav a, .nav-pied a {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px; color: inherit; text-decoration: none;
  font-weight: 500; opacity: .86; transition: background .15s, opacity .15s; position: relative;
}
.nav a:hover, .nav-pied a:hover { background: rgba(255,255,255,.08); opacity: 1; }
.nav a.actif { background: var(--primaire); color: var(--sur-primaire); opacity: 1; box-shadow: 0 4px 12px rgba(0,0,0,.18); }
.nav-pied { padding: 10px; border-top: 1px solid rgba(255,255,255,.08); }
.pastille { margin-left: auto; background: var(--accent); color: #fff; border-radius: 999px; font-size: .72rem; padding: 1px 7px; font-weight: 700; line-height: 1.5; }
.btn-icone .pastille { position: absolute; top: 2px; right: 0; margin: 0; }

.principal { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.barre-haut {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; padding: 12px 28px;
  background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--bord);
}
.barre-titre { flex: 1; min-width: 0; }
.barre-titre h1 { font-size: 1.35rem; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fil { display: flex; align-items: center; gap: 4px; font-size: .8rem; color: var(--texte-doux); flex-wrap: wrap; }
.fil a { color: inherit; text-decoration: none; } .fil a:hover { color: var(--primaire); } .fil .ic { width: 13px; height: 13px; }
.barre-outils { display: flex; align-items: center; gap: 6px; }
.btn-icone {
  position: relative; display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; border: 0;
  background: transparent; color: var(--texte); cursor: pointer; text-decoration: none;
}
.btn-icone:hover { background: var(--surface-2); }
.menu-mobile { display: none; }
.ic-soleil { display: none; }
:root[data-theme="dark"] .ic-soleil { display: block; } :root[data-theme="dark"] .ic-lune { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ic-soleil { display: block; } :root:not([data-theme="light"]) .ic-lune { display: none; } }

.menu-compte { position: relative; }
.menu-compte summary { list-style: none; display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 4px 8px 4px 4px; border-radius: 12px; }
.menu-compte summary::-webkit-details-marker { display: none; }
.menu-compte summary:hover { background: var(--surface-2); }
.avatar { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--primaire); color: var(--sur-primaire); font-weight: 700; font-size: .85rem; flex-shrink: 0; }
.compte-nom { display: flex; flex-direction: column; font-weight: 600; font-size: .88rem; line-height: 1.2; }
.compte-nom small { color: var(--texte-doux); font-weight: 400; }
.menu-compte-liste { position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--bord); border-radius: 12px; box-shadow: var(--ombre); padding: 6px; min-width: 230px; }
.menu-compte-liste a { display: flex; gap: 10px; align-items: center; padding: 9px 12px; border-radius: 8px; color: var(--texte); text-decoration: none; }
.menu-compte-liste a:hover { background: var(--surface-2); }

.contenu { padding: 24px 28px 40px; flex: 1; width: 100%; max-width: 1480px; }
.pied { padding: 16px 28px; font-size: .8rem; color: var(--texte-doux); display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.entete-page { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.entete-page .sous-titre { margin: 0; color: var(--texte-doux); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.voile { display: none; }

/* ── Cartes, grilles ─────────────────────────────────────────────── */
.carte { background: var(--surface); border: 1px solid var(--bord); border-radius: var(--rayon); box-shadow: var(--ombre); padding: 20px; margin-bottom: 20px; }
.carte > h2:first-child, .carte-entete h2 { font-size: 1.05rem; }
.carte-entete { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.carte-entete h2 { margin: 0; display: flex; gap: 8px; align-items: center; }
.carte-plate { padding: 0; overflow: hidden; }
.carte-plate .carte-entete { padding: 16px 20px 0; }
.grille { display: grid; gap: 20px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.grille > .carte { margin-bottom: 0; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-bottom: 20px; }
.kpi { display: flex; gap: 14px; align-items: flex-start; background: var(--surface); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 16px 18px; box-shadow: var(--ombre); color: var(--texte); text-decoration: none; transition: transform .15s; }
a.kpi:hover { transform: translateY(-2px); }
.kpi-icone { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--primaire-clair); color: var(--primaire); flex-shrink: 0; }
.kpi-libelle { margin: 0; color: var(--texte-doux); font-size: .82rem; font-weight: 500; }
.kpi-valeur { margin: 2px 0 0; font-family: var(--titres); font-size: 1.55rem; font-weight: 800; line-height: 1.1; }
.kpi-note { margin: 4px 0 0; font-size: .78rem; color: var(--texte-doux); }

/* ── Boutons ─────────────────────────────────────────────────────── */
.btn, button.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 16px; border-radius: 10px;
  border: 1px solid transparent; background: var(--primaire); color: var(--sur-primaire); font: 600 .9rem var(--corps); cursor: pointer;
  text-decoration: none; transition: background .15s, box-shadow .15s, transform .1s; white-space: nowrap;
}
.btn:hover { background: var(--primaire-fonce); }
.btn:active { transform: translateY(1px); }
.btn-secondaire { background: var(--surface); color: var(--texte); border-color: var(--bord); }
.btn-secondaire:hover { background: var(--surface-2); border-color: var(--primaire); }
.btn-accent { background: var(--accent); color: #fff; } .btn-accent:hover { filter: brightness(.92); background: var(--accent); }
.btn-danger { background: var(--danger-fond); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-lien { background: none; border: 0; color: var(--primaire); padding: 0; min-height: 0; font-weight: 600; cursor: pointer; text-decoration: underline; }
.btn-petit { min-height: 32px; padding: 5px 11px; font-size: .82rem; border-radius: 8px; }
.btn-large { width: 100%; min-height: 48px; font-size: 1rem; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
form.inline { display: inline; }

/* ── Badges, alertes ─────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: .75rem; font-weight: 600; white-space: nowrap; }
.badge-ok { background: var(--ok-fond); color: var(--ok); } .badge-warn { background: var(--warn-fond); color: var(--warn); }
.badge-danger { background: var(--danger-fond); color: var(--danger); } .badge-info { background: var(--info-fond); color: var(--info); }
.badge-muted { background: var(--muted-fond); color: var(--muted); }
.alerte { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-radius: 12px; margin-bottom: 16px; border: 1px solid transparent; }
.alerte .ic { margin-top: 2px; } .alerte div > :last-child { margin-bottom: 0; }
.alerte-success { background: var(--ok-fond); color: var(--ok); } .alerte-error { background: var(--danger-fond); color: var(--danger); }
.alerte-warning { background: var(--warn-fond); color: var(--warn); } .alerte-info { background: var(--info-fond); color: var(--info); }

/* ── Tableaux ────────────────────────────────────────────────────── */
.tableau-defile { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tableau { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tableau th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--texte-doux); font-weight: 700; padding: 10px 14px; border-bottom: 1px solid var(--bord); background: var(--surface-2); white-space: nowrap; }
.tableau td { padding: 11px 14px; border-bottom: 1px solid var(--bord); vertical-align: middle; }
.tableau tr:last-child td { border-bottom: 0; }
.tableau tbody tr:hover { background: color-mix(in srgb, var(--primaire-clair) 40%, transparent); }
.tableau a.ligne-lien { color: var(--texte); font-weight: 600; text-decoration: none; }
.tableau a.ligne-lien:hover { color: var(--primaire); text-decoration: underline; }
.tableau .actions-ligne { display: flex; gap: 6px; justify-content: flex-end; }
.tableau tfoot td { font-weight: 700; background: var(--surface-2); }
.carte-plate .tableau th:first-child, .carte-plate .tableau td:first-child { padding-left: 20px; }

/* ── Formulaires ─────────────────────────────────────────────────── */
.champ { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; min-width: 0; }
.champ label, .etiquette { font-weight: 600; font-size: .86rem; }
.champ .aide { font-size: .78rem; color: var(--texte-doux); }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number], input[type=date], input[type=time],
input[type=datetime-local], input[type=month], input[type=search], input[type=url], input[type=color], select, textarea {
  width: 100%; min-height: 42px; padding: 9px 12px; border: 1px solid var(--bord); border-radius: var(--rayon-petit); background: var(--surface);
  color: var(--texte); font: inherit; transition: border-color .15s, box-shadow .15s;
}
input[type=color] { padding: 3px; height: 42px; cursor: pointer; }
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primaire); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primaire) 22%, transparent); }
.case { display: flex; gap: 9px; align-items: flex-start; margin-bottom: 10px; cursor: pointer; }
.case input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--primaire); flex-shrink: 0; }
.form-ligne { display: grid; gap: 0 16px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; padding-top: 6px; }
fieldset { border: 1px solid var(--bord); border-radius: 12px; padding: 14px 16px 4px; margin: 0 0 16px; }
legend { font-weight: 700; padding: 0 6px; }
.filtres { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.filtres .champ { margin: 0; min-width: 150px; flex: 1; max-width: 260px; }
.recherche { position: relative; flex: 2; max-width: 360px; }
.recherche .ic { position: absolute; left: 12px; top: 12px; color: var(--texte-doux); }
.recherche input { padding-left: 38px; }

/* ── Onglets, listes de définitions, chronologie ─────────────────── */
.onglets { display: flex; gap: 4px; border-bottom: 1px solid var(--bord); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.onglets a { padding: 10px 16px; text-decoration: none; color: var(--texte-doux); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.onglets a.actif { color: var(--primaire); border-bottom-color: var(--primaire); }
.onglets a:hover { color: var(--texte); }
dl.infos { display: grid; grid-template-columns: minmax(110px, 38%) 1fr; gap: 8px 14px; margin: 0; font-size: .9rem; }
dl.infos dt { color: var(--texte-doux); } dl.infos dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.chrono { list-style: none; margin: 0; padding: 0; }
.chrono li { position: relative; padding: 0 0 16px 24px; border-left: 2px solid var(--bord); margin-left: 6px; }
.chrono li::before { content: ""; position: absolute; left: -7px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--primaire); }
.chrono li:last-child { border-left-color: transparent; }
.chrono .quand { font-size: .78rem; color: var(--texte-doux); }
.liste-simple { list-style: none; margin: 0; padding: 0; }
.liste-simple li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--bord); }
.liste-simple li:last-child { border-bottom: 0; }
.vide { text-align: center; padding: 40px 20px; color: var(--texte-doux); }
.vide-icone { display: inline-grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: var(--primaire-clair); color: var(--primaire); margin-bottom: 10px; }
.vide-icone .ic { width: 28px; height: 28px; }
.vide h2, .vide h3 { color: var(--texte); }
.pagination { display: flex; gap: 4px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.pagination a, .pagination span { min-width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: 8px; text-decoration: none; border: 1px solid var(--bord); background: var(--surface); color: var(--texte); }
.pagination .actuelle { background: var(--primaire); color: var(--sur-primaire); border-color: var(--primaire); }
.controle { display: flex; gap: 8px; align-items: flex-start; padding: 6px 0; font-size: .88rem; }
.controle .ic { margin-top: 2px; }
.controle.ok .ic { color: var(--ok); } .controle.ko .ic { color: var(--danger); } .controle.attention .ic { color: var(--warn); }
.pastille-couleur { display: inline-block; width: 12px; height: 12px; border-radius: 4px; vertical-align: middle; }
.progression { height: 8px; background: var(--muted-fond); border-radius: 99px; overflow: hidden; }
.progression > span { display: block; height: 100%; background: var(--primaire); border-radius: 99px; }
.barres { display: flex; align-items: flex-end; gap: 8px; height: 160px; padding-top: 10px; }
.barres .barre { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.barres .barre span { width: 100%; max-width: 44px; background: var(--primaire); border-radius: 6px 6px 2px 2px; min-height: 2px; }
.barres .barre small { font-size: .72rem; color: var(--texte-doux); }
.barres .barre b { font-size: .72rem; }

/* ── Planning hebdomadaire ───────────────────────────────────────── */
.planning-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.planning-semaine { display: grid; grid-template-columns: repeat(7, minmax(140px, 1fr)); gap: 10px; overflow-x: auto; padding-bottom: 6px; }
.planning-jour { background: var(--surface); border: 1px solid var(--bord); border-radius: 12px; min-height: 220px; display: flex; flex-direction: column; }
.planning-jour.aujourdhui { border-color: var(--primaire); box-shadow: 0 0 0 2px var(--primaire-clair); }
.planning-jour.ferie { background: var(--surface-2); }
.planning-jour-tete { padding: 9px 12px; border-bottom: 1px solid var(--bord); font-weight: 700; font-size: .85rem; display: flex; justify-content: space-between; }
.planning-jour-corps { padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.creneau { display: block; padding: 7px 9px; border-radius: 9px; background: var(--surface-2); border-left: 4px solid var(--c, var(--primaire)); text-decoration: none; color: var(--texte); font-size: .8rem; line-height: 1.35; }
.creneau:hover { box-shadow: var(--ombre); }
.creneau b { display: block; font-size: .82rem; }
.creneau.sans-intervenant { background: var(--danger-fond); }
.creneau.annulee { opacity: .55; text-decoration: line-through; }
.planning-mois { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.planning-mois .cellule { background: var(--surface); border: 1px solid var(--bord); border-radius: 8px; min-height: 90px; padding: 4px; font-size: .72rem; }
.planning-mois .cellule.hors { opacity: .45; }
.planning-mois .cellule .num { font-weight: 700; font-size: .78rem; }
.planning-mois .mini { display: block; padding: 1px 4px; margin-top: 2px; border-radius: 4px; background: var(--surface-2); border-left: 3px solid var(--c, var(--primaire)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--texte); text-decoration: none; }

/* ── Messagerie ──────────────────────────────────────────────────── */
.messagerie { display: grid; grid-template-columns: 340px 1fr; gap: 0; min-height: 70vh; padding: 0; overflow: hidden; }
.conv-liste { border-right: 1px solid var(--bord); overflow-y: auto; max-height: 78vh; }
.conv-liste a { display: block; padding: 13px 16px; border-bottom: 1px solid var(--bord); text-decoration: none; color: var(--texte); }
.conv-liste a:hover, .conv-liste a.actif { background: var(--primaire-clair); }
.conv-liste .conv-sujet { font-weight: 600; display: flex; justify-content: space-between; gap: 8px; }
.conv-liste .conv-apercu { font-size: .8rem; color: var(--texte-doux); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fil-messages { display: flex; flex-direction: column; min-width: 0; }
.fil-tete { padding: 14px 18px; border-bottom: 1px solid var(--bord); }
.fil-corps { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 12px; max-height: 60vh; background: var(--surface-2); }
.bulle { max-width: 78%; padding: 10px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--bord); align-self: flex-start; }
.bulle.moi { align-self: flex-end; background: var(--primaire); color: var(--sur-primaire); border-color: var(--primaire); }
.bulle.moi a { color: inherit; }
.bulle.urgent { border: 2px solid var(--danger); }
.bulle .meta { font-size: .72rem; opacity: .75; margin-bottom: 3px; }
.bulle.retire { font-style: italic; opacity: .6; }
.fil-saisie { padding: 12px; border-top: 1px solid var(--bord); display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.fil-saisie textarea { flex: 1; min-height: 46px; min-width: 200px; }
.canal-interne { background: var(--warn-fond); color: var(--warn); }

/* ── Pages d'authentification ────────────────────────────────────── */
.page-auth { background: var(--fond-app); }
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.auth-visuel {
  background: radial-gradient(1200px 600px at 10% 10%, color-mix(in srgb, var(--primaire) 85%, #fff) 0%, var(--primaire) 40%, var(--secondaire) 100%);
  color: #fff; display: flex; align-items: flex-end; padding: 56px; position: relative; overflow: hidden;
}
.auth-visuel::after { content: ""; position: absolute; width: 520px; height: 520px; border-radius: 50%; border: 70px solid rgba(255,255,255,.06); right: -160px; top: -160px; }
.auth-visuel-texte { max-width: 460px; position: relative; z-index: 1; font-size: 1.05rem; }
.auth-accroche { font-family: var(--titres); font-size: 2.2rem; font-weight: 900; line-height: 1.1; margin-bottom: 14px; }
.auth-visuel ul { list-style: none; padding: 0; margin: 22px 0 0; display: grid; gap: 10px; }
.auth-visuel li { display: flex; gap: 10px; align-items: center; opacity: .95; }
.auth-panneau { display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 32px 20px; }
.auth-carte { width: 100%; max-width: 430px; background: var(--surface); border: 1px solid var(--bord); border-radius: 20px; box-shadow: var(--ombre); padding: 32px; }
.auth-logo { height: 56px; width: auto; margin-bottom: 18px; background: #fff; border-radius: 10px; padding: 4px 8px; }
.auth-carte h1 { font-size: 1.5rem; margin-bottom: 4px; }
.auth-carte .intro { color: var(--texte-doux); margin-bottom: 20px; }
.auth-pied { font-size: .82rem; color: var(--texte-doux); margin-top: 18px; }
.code-saisie { font-size: 1.6rem !important; letter-spacing: .4em; text-align: center; font-family: ui-monospace, Consolas, monospace; }
.qr-enrol { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.qr-enrol img { width: 190px; height: 190px; background: #fff; border-radius: 12px; padding: 6px; border: 1px solid var(--bord); }
.codes-secours { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; font-family: ui-monospace, Consolas, monospace; font-size: 1rem; }
.codes-secours span { padding: 8px; background: var(--surface-2); border-radius: 8px; text-align: center; border: 1px dashed var(--bord); }

/* ── Espace intervenant : pointage ───────────────────────────────── */
.pointage-zone { text-align: center; }
.scanner { position: relative; width: 100%; max-width: 420px; aspect-ratio: 1; margin: 0 auto 16px; border-radius: 20px; overflow: hidden; background: #000; }
.scanner video { width: 100%; height: 100%; object-fit: cover; }
.scanner .viseur { position: absolute; inset: 18%; border: 3px solid rgba(255,255,255,.85); border-radius: 18px; box-shadow: 0 0 0 999px rgba(0,0,0,.35); }
.etat-reseau { display: inline-flex; gap: 6px; align-items: center; font-size: .8rem; padding: 4px 10px; border-radius: 99px; }
.etat-reseau.en-ligne { background: var(--ok-fond); color: var(--ok); } .etat-reseau.hors-ligne { background: var(--warn-fond); color: var(--warn); }
.mission { display: flex; gap: 14px; align-items: stretch; padding: 14px; border: 1px solid var(--bord); border-radius: 14px; background: var(--surface); margin-bottom: 12px; }
.mission-heure { display: flex; flex-direction: column; justify-content: center; align-items: center; min-width: 64px; padding: 6px; border-radius: 10px; background: var(--primaire-clair); font-weight: 800; font-family: var(--titres); }
.mission-heure small { font-weight: 500; font-size: .75rem; color: var(--texte-doux); }
.mission-corps { flex: 1; min-width: 0; }
.mission-corps h3 { margin: 0 0 3px; font-size: 1rem; }
.nav-bas { display: none; }

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3, .g-2-1 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .barre-laterale { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .25s ease; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  body.menu-ouvert .barre-laterale { transform: none; }
  body.menu-ouvert .voile { display: block; position: fixed; inset: 0; background: rgba(10,20,30,.45); z-index: 35; }
  .menu-mobile { display: inline-grid; }
  .barre-haut { padding: 10px 14px; }
  .contenu { padding: 16px 14px 32px; }
  .compte-nom { display: none; }
  .g2 { grid-template-columns: minmax(0, 1fr); }
  .auth { grid-template-columns: 1fr; }
  .auth-visuel { display: none; }
  .messagerie { grid-template-columns: 1fr; }
  .messagerie.conv-ouverte .conv-liste { display: none; }
  .messagerie:not(.conv-ouverte) .fil-messages { display: none; }
  .bulle { max-width: 92%; }
}
@media (max-width: 600px) {
  body { font-size: 15px; }
  .g4 { grid-template-columns: minmax(0, 1fr); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px; flex-direction: column; gap: 8px; }
  .kpi-valeur { font-size: 1.25rem; }
  .barre-titre h1 { font-size: 1.1rem; }
  .carte { padding: 16px; border-radius: 12px; }
  .auth-carte { padding: 22px; border-radius: 16px; }
  .filtres .champ, .recherche { max-width: none; flex-basis: 100%; }
  .form-actions .btn { flex: 1; }
  .espace-salarie .contenu { padding-bottom: 96px; }
  .espace-salarie .nav-bas {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 50; background: var(--surface); border-top: 1px solid var(--bord);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); justify-content: space-around; box-shadow: 0 -4px 20px rgba(0,0,0,.06);
  }
  .nav-bas a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .68rem; color: var(--texte-doux); text-decoration: none; padding: 4px 8px; }
  .nav-bas a .ic { width: 22px; height: 22px; }
  .nav-bas .nav-bas-principal { background: var(--primaire); color: var(--sur-primaire); border-radius: 16px; margin-top: -22px; padding: 10px 14px; box-shadow: 0 6px 16px rgba(0,0,0,.2); }
  .espace-salarie .pied { display: none; }
}

@media print {
  .barre-laterale, .barre-haut, .pied, .actions, .nav-bas, .form-actions, .filtres { display: none !important; }
  .contenu { padding: 0; } .carte { box-shadow: none; border: 0; }
  body { background: #fff; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
