/* TDV Contacts — feuille de style unique.
   Couleurs des applications TDV (bureaux, chambres, onboarding) ; mise en page inspirée d'Outlook :
   bandeau supérieur, volet de dossiers, liste de personnes, fiche à droite. */

:root {
  --tdv: #2a6980;
  --tdv-fonce: #1e4f63;
  --tdv-clair: #e3f0f5;
  --aqua: #82c9c9;
  --aqua-pale: #a5d5cf;
  --accent: #2a6980;          /* liens, focus, éléments actifs */
  --entete: #2a6980;

  --fond: #f3f6f8;
  --surface: #ffffff;
  --surface-2: #f7f9fa;
  --survol: #eef4f6;
  --selection: #dcedf2;
  --bord: #dde5ea;
  --bord-fort: #c3cfd6;
  --texte: #1e3a4a;
  --texte-doux: #5c7583;
  --texte-pale: #8aa0ab;

  --vert: #2e7d32;   --vert-clair: #e8f5e9;
  --orange: #c56a00; --orange-clair: #fff3e0;
  --rouge: #c62828;  --rouge-clair: #fdecea;

  --ombre: 0 1px 3px rgba(0, 0, 0, .08), 0 1px 2px rgba(0, 0, 0, .05);
  --ombre-forte: 0 12px 40px rgba(0, 0, 0, .18);
  --rayon: 8px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --accent: #82c9c9;
  --entete: #15262e;
  --tdv-clair: #1a2e36;

  --fond: #0f1a1f;
  --surface: #17252c;
  --surface-2: #1b2b33;
  --survol: #1f323b;
  --selection: #1f3d47;
  --bord: #29404a;
  --bord-fort: #3a5663;
  --texte: #dbe8ed;
  --texte-doux: #9db4be;
  --texte-pale: #6f8a96;

  --vert: #66bb6a;   --vert-clair: #1e3320;
  --orange: #ffb74d; --orange-clair: #3d2e1a;
  --rouge: #ef5350;  --rouge-clair: #3d1f1f;

  --ombre: 0 1px 3px rgba(0, 0, 0, .4);
  --ombre-forte: 0 12px 40px rgba(0, 0, 0, .55);
  color-scheme: dark;
}

* { box-sizing: border-box; }
.cache { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 15px; line-height: 1.5; color: var(--texte); background: var(--fond);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
input:not([type=checkbox]):not([type=radio]), select, textarea {
  background: var(--surface); color: var(--texte);
  border: 1px solid var(--bord-fort); border-radius: 6px; padding: 8px 10px;
}
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: -1px; }
input::placeholder, textarea::placeholder { color: var(--texte-pale); }
a { color: var(--accent); }
h1, h2, h3 { margin: 0; }

/* ─────────────── Bandeau de test (DEV_AUTH) ─────────────── */

#bandeau { display: none; }
body.avec-bandeau #bandeau {
  display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap;
  background: #e07b00; color: #fff; font-size: 13px; padding: 6px 12px;
}
#bandeau .selecteur button {
  border: 1px solid rgba(255, 255, 255, .6); background: transparent; color: #fff;
  border-radius: 999px; padding: 2px 11px; margin: 0 2px; cursor: pointer; font-size: 12.5px;
}
#bandeau .selecteur button.actif { background: #fff; color: #8a4b00; font-weight: 600; }

/* ─────────────── Bandeau supérieur ─────────────── */

.entete {
  position: sticky; top: 0; z-index: 50;
  background: var(--entete); color: #fff;
  display: flex; align-items: center; gap: 22px;
  height: 56px; padding: 0 20px; box-shadow: 0 1px 4px rgba(0, 0, 0, .15);
}
.entete .marque { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; flex: 0 0 auto; }
.entete .marque img { height: 30px; filter: brightness(0) invert(1); }
.entete .marque span { font-size: 17px; font-weight: 600; letter-spacing: .01em; }
.onglets-app { display: flex; gap: 4px; height: 100%; overflow-x: auto; scrollbar-width: none; }
.onglets-app a {
  display: flex; align-items: center; gap: 7px; padding: 0 12px; height: 100%;
  color: rgba(255, 255, 255, .82); text-decoration: none; font-size: 14.5px; white-space: nowrap;
  border-bottom: 3px solid transparent; border-top: 3px solid transparent;
}
.onglets-app a:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.onglets-app a.actif { color: #fff; font-weight: 600; border-bottom-color: var(--aqua); }
.onglets-app .lib-court { display: none; }
.onglets-app .badge-nb { background: var(--aqua); color: #10313d; border-radius: 999px; font-size: 11.5px; font-weight: 700; padding: 0 7px; }

.utilisateur { margin-left: auto; position: relative; flex: 0 0 auto; }
.utilisateur > button {
  display: flex; align-items: center; gap: 9px; background: transparent; border: 0; color: #fff; cursor: pointer;
  padding: 4px 6px; border-radius: 999px;
}
.utilisateur > button:hover { background: rgba(255, 255, 255, .1); }
.utilisateur .nom-court { font-size: 14px; }
.menu-utilisateur {
  position: absolute; right: 0; top: 48px; min-width: 250px; z-index: 60;
  background: var(--surface); color: var(--texte); border: 1px solid var(--bord); border-radius: 10px;
  box-shadow: var(--ombre-forte); overflow: hidden;
}
.menu-utilisateur .tete { padding: 14px 16px; border-bottom: 1px solid var(--bord); }
.menu-utilisateur .tete strong { display: block; }
.menu-utilisateur .tete span { font-size: 13px; color: var(--texte-doux); word-break: break-all; }
.menu-utilisateur button {
  display: flex; width: 100%; align-items: center; gap: 10px; padding: 11px 16px;
  background: none; border: 0; text-align: left; cursor: pointer; font-size: 14px;
}
.menu-utilisateur button:hover { background: var(--survol); }

#contenu { max-width: 1280px; margin: 0 auto; padding: 22px 22px 100px; }
.titre-page { margin-bottom: 18px; }
.titre-page h1 { font-size: 24px; font-weight: 600; letter-spacing: -.01em; }
.titre-page p { margin: 4px 0 0; color: var(--texte-doux); }

/* ─────────────── Étapes ─────────────── */

.etapes { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; font-size: 14px; }
.etapes .etape { display: flex; align-items: center; gap: 8px; color: var(--texte-pale); }
.etapes .etape .n {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px;
  border: 2px solid var(--bord-fort); color: var(--texte-pale);
}
.etapes .etape.faite { color: var(--texte-doux); }
.etapes .etape.faite .n { background: var(--aqua); border-color: var(--aqua); color: #10313d; }
.etapes .etape.active { color: var(--texte); font-weight: 600; }
.etapes .etape.active .n { background: var(--tdv); border-color: var(--tdv); color: #fff; }
.etapes .sep { width: 34px; height: 2px; background: var(--bord-fort); margin: 0 4px; }

/* ─────────────── Accueil ─────────────── */

.accueil {
  background: var(--surface); border: 1px solid var(--bord); border-radius: 14px; box-shadow: var(--ombre);
  padding: 34px 36px; display: grid; grid-template-columns: 1.3fr 1fr; gap: 36px; align-items: center;
}
.accueil h2 { font-size: 24px; font-weight: 600; line-height: 1.3; margin-bottom: 10px; }
.accueil .intro { color: var(--texte-doux); font-size: 16px; margin: 0 0 22px; }
.accueil .trois { list-style: none; padding: 0; margin: 0 0 26px; display: grid; gap: 12px; }
.accueil .trois li { display: flex; gap: 12px; align-items: flex-start; }
.accueil .trois .n {
  flex: 0 0 30px; height: 30px; border-radius: 50%; background: var(--tdv-clair); color: var(--accent);
  display: grid; place-items: center; font-weight: 700;
}
.accueil .trois strong { display: block; }
.accueil .trois span { color: var(--texte-doux); font-size: 14px; }
.accueil .illustration {
  border-radius: 12px; background: linear-gradient(150deg, var(--tdv), #3d8aa0 55%, var(--aqua));
  padding: 26px; color: #fff; display: grid; gap: 10px;
}
.accueil .illustration .ligne-demo {
  display: flex; align-items: center; gap: 10px; background: rgba(255, 255, 255, .14); border-radius: 9px; padding: 9px 12px;
}
.accueil .illustration .ligne-demo .avatar { border: 2px solid rgba(255, 255, 255, .5); }
.accueil .illustration .ligne-demo small { display: block; opacity: .8; font-size: 12px; }
.accueil .illustration .ligne-demo .ok { margin-left: auto; font-size: 18px; }
.confidentialite { margin-top: 16px; font-size: 13.5px; color: var(--texte-doux); display: flex; gap: 10px; }

/* ─────────────── Volets (dossiers | liste | fiche) ─────────────── */

.volets { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 16px; align-items: start; }
.volets.fiche-a-droite { grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); }
.panneau { background: var(--surface); border: 1px solid var(--bord); border-radius: 10px; box-shadow: var(--ombre); overflow: hidden; }
.panneau > .tete-panneau {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 14px; border-bottom: 1px solid var(--bord);
}
.panneau > .tete-panneau h2 { font-size: 15px; font-weight: 600; }
.panneau > .tete-panneau .droite { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.collant { position: sticky; top: 72px; }

.dossiers { padding: 8px; }
.dossiers .titre-dossiers { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--texte-pale); font-weight: 600; padding: 8px 10px 4px; }
.dossiers button {
  display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 6px;
  background: none; border: 0; cursor: pointer; text-align: left; font-size: 14.5px; color: var(--texte);
}
.dossiers button:hover { background: var(--survol); }
.dossiers button.actif { background: var(--selection); font-weight: 600; }
.dossiers button .ic { width: 20px; text-align: center; }
.dossiers button .nb { margin-left: auto; font-size: 12.5px; color: var(--texte-doux); font-weight: 600; }
.dossiers .reglage { padding: 10px; border-top: 1px solid var(--bord); margin-top: 6px; display: grid; gap: 6px; }
.dossiers .reglage label { font-size: 12.5px; color: var(--texte-doux); }
.dossiers .reglage select { width: 100%; padding: 6px 8px; font-size: 14px; }

.recherche { position: relative; flex: 1 1 260px; }
.recherche input[type=search] { width: 100%; padding: 9px 12px 9px 40px; border-radius: 999px; background: var(--surface-2); }
.recherche::before { content: '🔍'; position: absolute; left: 14px; top: 50%; transform: translateY(-50%); font-size: 13px; opacity: .55; pointer-events: none; }

/* ─────────────── Personnes ─────────────── */

.personnes { list-style: none; margin: 0; padding: 0; }
.personne {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  border-bottom: 1px solid var(--bord); cursor: pointer; user-select: none;
}
.personne:last-child { border-bottom: 0; }
.personne:hover { background: var(--survol); }
.personne.choisie, .personne.courante { background: var(--selection); }
.personne.courante { box-shadow: inset 3px 0 0 var(--accent); }
.personne .infos { min-width: 0; flex: 1; }
.personne .nom { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.personne .sous { font-size: 13px; color: var(--texte-doux); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.personne .meta { font-size: 12.5px; color: var(--texte-doux); text-align: right; white-space: nowrap; }
.personne .meta .fort { color: var(--texte); font-weight: 600; }
.personne .etat { font-size: 12px; }
.bouton-choix {
  flex: 0 0 auto; min-width: 96px; padding: 6px 12px; border-radius: 999px; cursor: pointer;
  border: 1.5px solid var(--accent); background: transparent; color: var(--accent); font-weight: 600; font-size: 13.5px;
}
.personne.choisie .bouton-choix { background: var(--tdv); border-color: var(--tdv); color: #fff; }
:root[data-theme="dark"] .personne.choisie .bouton-choix { background: var(--aqua); border-color: var(--aqua); color: #10313d; }

.avatar {
  flex: 0 0 auto; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  color: #fff; font-weight: 600; font-size: 14.5px; letter-spacing: .02em; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.petit { width: 32px; height: 32px; font-size: 12.5px; }
.avatar.grand { width: 64px; height: 64px; font-size: 22px; }
.personne.choisie .avatar { background: var(--tdv) !important; font-size: 19px; }
:root[data-theme="dark"] .personne.choisie .avatar { background: var(--aqua) !important; color: #10313d; }

.point-etat { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.point-etat.ok { background: var(--vert); }
.point-etat.manque { background: var(--orange); }

/* ─────────────── Fiche ─────────────── */

.fiche { padding: 22px 24px; }
.fiche .tete-fiche { display: flex; gap: 16px; align-items: center; margin-bottom: 18px; }
.fiche .tete-fiche h2 { font-size: 21px; font-weight: 600; }
.fiche .tete-fiche .sous { color: var(--texte-doux); font-size: 14px; word-break: break-all; }
.fiche .compteur-fiche { margin-left: auto; color: var(--texte-doux); font-size: 13.5px; white-space: nowrap; align-self: flex-start; }
.champs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.champs .large { grid-column: 1 / -1; }
.champ label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 5px; color: var(--texte-doux); }
.champ label .requis { color: var(--orange); }
.champ input:not([type=checkbox]):not([type=radio]), .champ select, .champ textarea { width: 100%; padding: 10px 12px; font-size: 15px; }
.champ textarea { min-height: 80px; resize: vertical; }
.champ input.manque { border-color: var(--orange); background: var(--orange-clair); }
.champ input.devine { border-style: dashed; border-color: var(--accent); }
.champ .aide { font-size: 12.5px; color: var(--texte-pale); margin-top: 4px; }
details.plus { margin-top: 14px; }
details.plus summary { cursor: pointer; color: var(--accent); font-size: 14px; margin-bottom: 12px; }
.actions-fiche { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--bord); }
.actions-fiche .pousse { margin-left: auto; }
/* Boutons de la fiche toujours visibles en bas de l'écran */
.panneau.fiche, #mes-fiche { overflow: visible; }
.fiche .actions-fiche { position: sticky; bottom: 0; z-index: 2; background: var(--surface); margin: 22px -24px -22px; padding: 14px 24px; border-radius: 0 0 10px 10px; }
#modale .fiche .actions-fiche { margin: 22px -20px -20px; padding: 14px 20px; border-radius: 0; }
.raccourci { font-size: 12px; color: var(--texte-pale); }
kbd { font-family: inherit; font-size: 11.5px; border: 1px solid var(--bord-fort); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; background: var(--surface-2); }

/* ─────────────── Boutons ─────────────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px; border-radius: 6px; border: 1px solid var(--bord-fort);
  background: var(--surface); color: var(--texte); cursor: pointer; font-size: 14.5px; font-weight: 500;
  white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--survol); }
.btn.principal { background: var(--tdv); border-color: var(--tdv); color: #fff; }
.btn.principal:hover { background: var(--tdv-fonce); }
.btn.grand { padding: 12px 22px; font-size: 16px; font-weight: 600; }
.btn.petit { padding: 5px 11px; font-size: 13px; }
.btn.danger { color: var(--rouge); border-color: var(--rouge); background: transparent; }
.btn.danger:hover { background: var(--rouge-clair); }
.btn.vert { background: var(--vert); border-color: var(--vert); color: #fff; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.occupe { opacity: .6; pointer-events: none; }
.lien-action { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; font-size: 14px; }
.lien-action:hover { text-decoration: underline; }

/* ─────────────── Badges, puces ─────────────── */

.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.badge.ok { background: var(--vert-clair); color: var(--vert); }
.badge.info { background: var(--tdv-clair); color: var(--accent); }
.badge.attente { background: var(--orange-clair); color: var(--orange); }
.badge.danger { background: var(--rouge-clair); color: var(--rouge); }
.badge.neutre { background: var(--surface-2); color: var(--texte-doux); border: 1px solid var(--bord); }
.puce { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--bord); color: var(--texte-doux); margin: 1px 0; white-space: nowrap; }
.puces-choix { display: flex; flex-wrap: wrap; gap: 8px; }
.puces-choix input { width: auto; margin: 0; }
.puces-choix label {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px; border-radius: 999px; cursor: pointer;
  border: 1.5px solid var(--bord-fort); background: var(--surface); font-size: 14.5px;
}
.puces-choix label:has(input:checked) { border-color: var(--accent); background: var(--selection); font-weight: 600; }

/* ─────────────── Barre de sélection ─────────────── */

.barre-selection {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: var(--surface); border-top: 1px solid var(--bord); box-shadow: 0 -6px 24px rgba(0, 0, 0, .1);
}
.barre-selection > div { max-width: 1280px; margin: 0 auto; padding: 12px 22px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.barre-selection .avatars { display: flex; }
.barre-selection .avatars .avatar { margin-left: -8px; border: 2px solid var(--surface); }
.barre-selection .avatars .avatar:first-child { margin-left: 0; }
.barre-selection .pousse { margin-left: auto; }

/* ─────────────── Cartes, tableaux (gestion du CRM) ─────────────── */

.carte { background: var(--surface); border: 1px solid var(--bord); border-radius: 10px; box-shadow: var(--ombre); overflow: hidden; }
.carte > header { padding: 12px 16px; border-bottom: 1px solid var(--bord); display: flex; align-items: center; gap: 10px; }
.carte > header h2 { font-size: 15px; font-weight: 600; }
.carte > header .droite { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.carte .corps { padding: 16px; }
.grille { display: grid; gap: 12px; }
.g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.chiffre { padding: 14px 16px; }
.chiffre .val { font-size: 28px; font-weight: 700; line-height: 1.1; }
.chiffre .lib { font-size: 13px; color: var(--texte-doux); }
.chiffre.info .val { color: var(--accent); }
.chiffre.ok .val { color: var(--vert); }
.chiffre.attente .val { color: var(--orange); }
.pile { display: flex; flex-direction: column; gap: 14px; }

.barre-outils { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--bord); }
.barre-outils select { padding: 7px 9px; font-size: 14px; }
.case { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; cursor: pointer; }
.enveloppe-table { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th {
  text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--texte-pale);
  font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--bord); background: var(--surface-2); white-space: nowrap;
}
table.t td { padding: 10px 12px; border-bottom: 1px solid var(--bord); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr:hover { background: var(--survol); }
table.t tr.choisi, table.t tr.choisi:hover { background: var(--selection); }
table.t tr.cliquable { cursor: pointer; }
table.t td.num { text-align: right; font-variant-numeric: tabular-nums; }
.col-case { width: 38px; }
.principal-txt { font-weight: 600; }
.mini { font-size: 13px; color: var(--texte-doux); }
.mono { font-family: Consolas, 'SF Mono', ui-monospace, monospace; }
.rang { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pousse { margin-left: auto; }
.vide { padding: 36px 16px; text-align: center; color: var(--texte-doux); }

/* ─────────────── Encadrés ─────────────── */

.avert { border-radius: 8px; padding: 11px 14px; font-size: 14px; display: flex; gap: 10px; align-items: flex-start; margin-bottom: 14px; }
.avert.attention { background: var(--orange-clair); color: var(--orange); }
.avert.danger { background: var(--rouge-clair); color: var(--rouge); }
.avert.info { background: var(--tdv-clair); color: var(--texte); }
.avert.ok { background: var(--vert-clair); color: var(--vert); }
.avert strong { display: block; }
.encadre-info { background: var(--tdv-clair); border-radius: 8px; padding: 12px 14px; font-size: 14px; }
.note { font-size: 13.5px; margin-top: 4px; padding: 6px 10px; border-left: 3px solid var(--aqua); background: var(--surface-2); white-space: pre-wrap; }
.sous-titre { font-size: 12.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--texte-pale); margin: 20px 0 6px; font-weight: 600; }
.liste-simple { list-style: none; margin: 0; padding: 0; }
.liste-simple > li { padding: 9px 0; border-bottom: 1px solid var(--bord); }
.liste-simple > li:last-child { border-bottom: 0; }
details.historique { margin-top: 14px; font-size: 13.5px; }
details.historique summary { cursor: pointer; color: var(--accent); }

/* ─────────────── Merci ─────────────── */

.merci { text-align: center; padding: 50px 20px; }
.merci .grand-ic { font-size: 54px; }
.merci h2 { font-size: 24px; margin: 10px 0 6px; }
.merci p { color: var(--texte-doux); margin: 0 0 24px; }
.merci .rang { justify-content: center; }

/* ─────────────── Modale, toast, chargement ─────────────── */

#voile { position: fixed; inset: 0; background: rgba(10, 25, 32, .55); display: grid; place-items: center; padding: 20px; z-index: 100; overflow-y: auto; }
#modale { background: var(--surface); border-radius: 12px; box-shadow: var(--ombre-forte); width: 100%; max-width: 560px; max-height: calc(100vh - 40px); overflow-y: auto; }
#modale.large { max-width: 760px; }
#modale > header { padding: 16px 20px; border-bottom: 1px solid var(--bord); display: flex; align-items: center; gap: 12px; position: sticky; top: 0; background: var(--surface); z-index: 1; }
#modale > header h2 { font-size: 18px; font-weight: 600; }
#modale > header .fermer { margin-left: auto; background: none; border: 0; font-size: 24px; cursor: pointer; color: var(--texte-pale); line-height: 1; }
#modale .corps { padding: 20px; }
#modale .corps .fiche { padding: 0; }
#modale > footer { padding: 14px 20px; border-top: 1px solid var(--bord); display: flex; gap: 10px; justify-content: flex-end; position: sticky; bottom: 0; background: var(--surface); }

#toast { position: fixed; bottom: 86px; left: 50%; transform: translateX(-50%); z-index: 200; background: #16313b; color: #fff; padding: 12px 20px; border-radius: 8px; box-shadow: var(--ombre-forte); font-size: 14.5px; max-width: 90vw; text-align: center; }
#toast.succes { background: var(--vert); }
#toast.erreur { background: var(--rouge); }

.chargement { padding: 50px 20px; text-align: center; color: var(--texte-doux); }
.chargement::before { content: ''; display: block; width: 30px; height: 30px; margin: 0 auto 14px; border-radius: 50%; border: 3px solid var(--bord); border-top-color: var(--accent); animation: tourne .8s linear infinite; }
@keyframes tourne { to { transform: rotate(360deg); } }
.progression { height: 6px; border-radius: 999px; background: var(--bord); overflow: hidden; max-width: 320px; margin: 14px auto 0; }
.progression > i { display: block; height: 100%; width: 40%; background: var(--accent); border-radius: 999px; animation: va-vient 1.2s ease-in-out infinite; }
@keyframes va-vient { 0% { transform: translateX(-100%); } 100% { transform: translateX(260%); } }

/* ─────────────── Connexion ─────────────── */

#vue-connexion { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(150deg, #1e4f63, #2a6980 55%, #4f9fae); }
.boite-connexion { background: var(--surface); border-radius: 16px; padding: 36px 34px; max-width: 430px; width: 100%; text-align: center; box-shadow: var(--ombre-forte); }
.boite-connexion img { height: 64px; margin-bottom: 14px; }
.boite-connexion h1 { font-size: 24px; margin-bottom: 8px; }
.boite-connexion p { color: var(--texte-doux); margin: 0 0 24px; }
.boite-connexion .btn { width: 100%; }
.boite-connexion .erreur { color: var(--rouge); font-size: 13.5px; margin-top: 14px; }
.boite-connexion .bas { margin-top: 18px; display: flex; justify-content: center; gap: 16px; }

/* ─────────────── Petits écrans ─────────────── */

@media (max-width: 1000px) {
  .g5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .accueil { grid-template-columns: 1fr; }
  .accueil .illustration { display: none; }
}
@media (max-width: 820px) {
  .entete { gap: 10px; padding: 0 12px; }
  .entete .marque span, .utilisateur .nom-court { display: none; }
  .onglets-app a { padding: 0 9px; font-size: 14px; }
  .onglets-app a .lib-long { display: none; }
  .onglets-app:not(.nombreux) a .lib-court { display: inline; }
  #contenu { padding: 16px 12px 110px; }
  .volets, .volets.fiche-a-droite { grid-template-columns: minmax(0, 1fr); }
  .collant { position: static; }
  .dossiers { display: flex; gap: 6px; overflow-x: auto; padding: 8px; }
  .dossiers .titre-dossiers { display: none; }
  .dossiers button { width: auto; white-space: nowrap; flex: 0 0 auto; border: 1px solid var(--bord); border-radius: 999px; padding: 6px 12px; }
  .dossiers .reglage { display: none; }
  .volets.fiche-a-droite .liste-a-completer { display: none; }
  .champs { grid-template-columns: minmax(0, 1fr); }
  .personne .meta { display: none; }
  .bouton-choix { min-width: 0; }
  .g5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .accueil { padding: 22px; }
  .barre-selection .avatars { display: none; }
}
@media print { .entete, .barre-selection, #bandeau { display: none !important; } }

/* Filtres en ligne (puces) au-dessus d'une liste */
.dossiers.filtres-ligne { display: flex; gap: 6px; flex-wrap: wrap; padding: 8px 12px; border-bottom: 1px solid var(--bord); }
.dossiers.filtres-ligne button { width: auto; border: 1px solid var(--bord); border-radius: 999px; padding: 5px 12px; font-size: 14px; }
.dossiers.filtres-ligne button .nb { margin-left: 4px; }
