:root {
  --fond: #f4f6f9;
  --carte: #ffffff;
  --texte: #1d2433;
  --discret: #667085;
  --bord: #dde2ea;
  --accent: #1f6feb;
  --accent-fonce: #1857c0;
  --accent-clair: #e8f0fe;
  --ok: #1a7f37;
  --ok-clair: #e6f4ea;
  --alerte: #b42318;
  --alerte-clair: #fdecea;
  --rayon: 10px;
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--fond); color: var(--texte);
  font: 15px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 15px; margin: 0 0 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--discret); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
kbd { font: 11px monospace; border: 1px solid var(--bord); border-radius: 4px; padding: 0 4px; color: var(--discret); background: #fff; }
.discret { color: var(--discret); margin: 0; }

/* En-tête */
.entete {
  display: flex; align-items: center; gap: 24px; padding: 0 20px; height: 52px;
  background: #fff; border-bottom: 1px solid var(--bord); position: sticky; top: 0; z-index: 10;
}
.marque { font-weight: 700; font-size: 17px; color: var(--texte); }
.logo { color: var(--accent); }
.menus { display: flex; gap: 4px; flex: 1; }
.menu { position: relative; }
.menu > button { background: none; border: 0; padding: 8px 12px; border-radius: 6px; font: inherit; cursor: pointer; color: var(--texte); }
.menu:hover > button, .menu:focus-within > button { background: var(--accent-clair); }
.sous-menu {
  display: none; position: absolute; top: 100%; left: 0; min-width: 280px; padding: 6px;
  background: #fff; border: 1px solid var(--bord); border-radius: var(--rayon); box-shadow: 0 8px 24px rgba(16,24,40,.12);
}
.menu:hover .sous-menu, .menu:focus-within .sous-menu { display: block; }
.sous-menu a, .sous-menu span { display: flex; justify-content: space-between; padding: 8px 10px; border-radius: 6px; color: var(--texte); }
.sous-menu a:hover { background: var(--accent-clair); text-decoration: none; }
.sous-menu .bientot { color: #a0a7b4; cursor: default; }
.sous-menu .bientot::after { content: "bientôt"; font-size: 11px; }
.session { display: flex; align-items: center; gap: 12px; }
.session .labo { color: var(--discret); font-size: 13px; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session .qui { font-weight: 600; background: var(--accent-clair); padding: 3px 10px; border-radius: 99px; }

/* Mise en page */
.page { max-width: 1400px; margin: 0 auto; padding: 20px; }
.carte { background: var(--carte); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 16px; margin-bottom: 16px; }

/* Formulaires */
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--discret); }
input, select {
  font: inherit; color: var(--texte); padding: 7px 9px; border: 1px solid var(--bord); border-radius: 7px; background: #fff; min-width: 0;
}
input:focus, select:focus { outline: 2px solid var(--accent-clair); border-color: var(--accent); }
input[readonly] { background: var(--fond); }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset:disabled input, fieldset:disabled select { background: var(--fond); }
button, .bouton {
  font: inherit; padding: 7px 14px; border-radius: 7px; border: 1px solid var(--bord); background: #fff; color: var(--texte); cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
button:hover, .bouton:hover { background: var(--fond); text-decoration: none; }
button.principal { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.principal:hover { background: var(--accent-fonce); }
button.grand { padding: 11px 22px; font-size: 16px; }
button.lien { border: 0; background: none; padding: 0; color: var(--accent); }
button.danger { color: var(--alerte); }

.grille { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.c1 { grid-column: span 1; } .c2 { grid-column: span 2; } .c3 { grid-column: span 3; } .c4 { grid-column: span 4; }
.cases { justify-content: flex-end; display: flex; flex-direction: column; gap: 6px; }
label.case { flex-direction: row; align-items: center; gap: 6px; color: var(--texte); font-size: 14px; }

.message { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }
.message.ok { background: var(--ok-clair); color: var(--ok); }
.message.erreur { background: var(--alerte-clair); color: var(--alerte); }

/* Tableaux */
.tableau { width: 100%; border-collapse: collapse; font-size: 14px; }
.tableau th { text-align: left; font-weight: 600; color: var(--discret); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; padding: 8px; border-bottom: 1px solid var(--bord); }
.tableau td { padding: 8px; border-bottom: 1px solid #eef1f5; }
.tableau tbody tr:hover { background: #f8fafc; cursor: pointer; }
.nombre { text-align: right; font-variant-numeric: tabular-nums; }
.pastille { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 99px; background: #eef1f5; color: var(--discret); }
.pastille.ok { background: var(--ok-clair); color: var(--ok); }
.mode { font-weight: 600; }

/* Connexion */
.page-connexion { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(135deg, #e8f0fe, #f4f6f9); }
.connexion { width: 360px; display: flex; flex-direction: column; gap: 14px; padding: 32px; }
.connexion h1 { text-align: center; font-size: 18px; }
.connexion .discret { text-align: center; }
.logo-grand { font-size: 40px; text-align: center; color: var(--accent); }

/* Accueil */
.accueil { display: grid; grid-template-columns: 1fr; gap: 20px; }
.bienvenue { background: #fff; border: 1px solid var(--bord); border-radius: var(--rayon); padding: 28px; display: flex; flex-direction: column; gap: 12px; }
.recherche-rapide { display: flex; gap: 8px; margin: 8px 0 16px; max-width: 720px; }
.recherche-rapide input { flex: 1; font-size: 16px; padding: 10px 12px; }
.raccourcis { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.raccourci {
  background: #fff; border: 1px solid var(--bord); border-radius: var(--rayon); padding: 18px; min-height: 88px;
  display: flex; flex-direction: column; justify-content: space-between; color: var(--texte); font-weight: 600;
}
a.raccourci:hover { border-color: var(--accent); box-shadow: 0 4px 14px rgba(31,111,235,.12); text-decoration: none; }
.raccourci.bientot { color: #a0a7b4; }
.raccourci small { font-weight: 400; }

/* Dossier */
.barre-dossier { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.actions { display: flex; align-items: center; gap: 8px; }
.dossier { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 16px; }
.analyses { min-height: 360px; display: flex; flex-direction: column; }
.analyses .tableau { flex: none; }
.analyses .totaux { margin-top: auto; }
.ajout-analyse { position: relative; margin-bottom: 10px; }
.ajout-analyse input { width: 100%; font-size: 15px; padding: 9px 11px; }
.suggestions {
  position: absolute; z-index: 5; left: 0; right: 0; top: 100%; margin: 4px 0 0; padding: 4px; list-style: none;
  background: #fff; border: 1px solid var(--bord); border-radius: 8px; box-shadow: 0 8px 24px rgba(16,24,40,.12); max-height: 320px; overflow: auto;
}
.suggestions li { display: grid; grid-template-columns: 90px 1fr auto; gap: 10px; padding: 7px 9px; border-radius: 6px; cursor: pointer; }
.suggestions li.actif, .suggestions li:hover { background: var(--accent-clair); }
.suggestions em { color: var(--discret); font-style: normal; font-size: 13px; }
.retirer { border: 0; background: none; color: var(--discret); font-size: 18px; padding: 0 6px; }
.retirer:hover { color: var(--alerte); background: none; }
.totaux { display: flex; flex-wrap: wrap; gap: 18px; align-items: baseline; padding-top: 12px; border-top: 1px solid var(--bord); margin-top: 12px; color: var(--discret); }
.totaux .du { margin-left: auto; font-size: 17px; color: var(--texte); }
.totaux .du strong { font-size: 22px; }
.enregistrer { display: flex; justify-content: flex-end; }

.reglements { margin-top: 4px; }
.resume-paiement { display: flex; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.resume-paiement > div { flex: 1; min-width: 160px; padding: 12px 14px; border-radius: 8px; background: var(--fond); display: flex; flex-direction: column; }
.resume-paiement strong { font-size: 20px; }
.resume-paiement .alerte { background: var(--alerte-clair); }
.resume-paiement .alerte strong { color: var(--alerte); }
.resume-paiement .solde { background: var(--ok-clair); }
.resume-paiement .solde strong { color: var(--ok); }
.nouveau-reglement { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 14px; }
.nouveau-reglement label { min-width: 130px; }
.nouveau-reglement h3 { flex-basis: 100%; margin: 0; font-size: 13px; color: var(--discret); text-transform: uppercase; letter-spacing: .03em; }
.nouveau-reglement .note-reglement { flex-basis: 100%; margin: 0; font-size: 12px; }
.nouveau-reglement .reste-apres { align-self: center; white-space: nowrap; }
.nouveau-reglement .alerte-texte strong { color: var(--alerte); }
.groupe-banque { flex-basis: 100%; display: flex; gap: 10px; margin: 0; padding: 4px 8px 6px; border: 1px solid var(--bord); border-radius: 6px; }
.groupe-banque legend { font-size: 12px; padding: 0 4px; }
.groupe-banque label { flex: 1 1 140px; }
.groupe-banque.inactif { opacity: .5; }
.historique { margin: 0; padding-left: 18px; }

/* Caisse */
.totaux-modes { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.total-mode { display: flex; flex-direction: column; margin: 0 0 16px; }
.total-mode strong { font-size: 22px; font-variant-numeric: tabular-nums; }
.total-mode.general { background: var(--accent-clair); border-color: var(--accent); }

@media (max-width: 900px) {
  .dossier { grid-template-columns: 1fr; }
  .menus { display: none; }
  .grille { grid-template-columns: repeat(2, 1fr); }
  .c3, .c4 { grid-column: span 2; }
}
[hidden] { display: none !important; }
.tableau th.nombre { text-align: right; }
.ajout-analyse { display: flex; gap: 8px; }
.ajout-analyse input { flex: 1; }
.bouton-liste { white-space: nowrap; }
.liste-a-cocher {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 4px 10px;
  padding: 10px; margin-bottom: 10px; background: var(--fond); border-radius: 8px; max-height: 260px; overflow: auto;
}
.liste-a-cocher label.case { font-size: 13px; font-weight: 600; }
.raccourci kbd { align-self: flex-start; }

/* Validation des résultats */
.validation { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 16px; align-items: start; }
.filtres { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 68px; }
.choix-radio { border: 1px solid var(--bord); border-radius: 8px; padding: 6px 10px 8px; display: flex; gap: 16px; }
.choix-radio legend { font-size: 13px; color: var(--discret); padding: 0 4px; }
.filtres .urgent { color: var(--alerte); }
.vide { color: var(--discret); text-align: center; padding: 60px 0; }
.barre-resultats { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; margin-bottom: 12px; }
.qui-dossier h1 a { color: var(--texte); }
.manque { color: var(--alerte); font-weight: 600; margin: 4px 0 0; }
.rouge { color: var(--alerte); }
.navigation { display: flex; align-items: center; gap: 12px; }
.navigation strong { color: var(--alerte); font-size: 17px; min-width: 48px; text-align: center; }
.bouton.fleche { font-size: 20px; padding: 4px 16px; }
.bouton.inactif { color: #c0c6d0; cursor: default; }
.etat { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.pastille.alerte { background: var(--alerte-clair); color: var(--alerte); }
.grille-resultats tbody tr:hover { cursor: default; }
.grille-resultats td { padding: 4px 8px; }
.grille-resultats tr.titre td { font-weight: 700; padding-top: 12px; color: var(--texte); background: var(--fond); }
.grille-resultats tr.titre.niveau1 td { background: var(--accent-clair); color: var(--accent-fonce); letter-spacing: .02em; }
.grille-resultats .retrait { padding-left: 24px; }
.grille-resultats input.valeur { width: 160px; font-weight: 600; }
.grille-resultats input.commentaire { width: 100%; min-width: 160px; }
.grille-resultats tr.anormal input.valeur { color: var(--alerte); border-color: var(--alerte); background: var(--alerte-clair); }
.fleche-anormal { color: var(--alerte); font-weight: 700; margin-left: 4px; display: inline-block; width: 12px; }
.grille-resultats small { font-size: 11px; }
.actions-resultats { display: flex; gap: 12px; align-items: center; justify-content: flex-end; margin-top: 14px; flex-wrap: wrap; }
.impression { display: flex; gap: 8px; margin-right: auto; order: -1; }
@media (max-width: 900px) { .validation { grid-template-columns: 1fr; } .filtres { position: static; } }

/* Paramètres du laboratoire */
.parametres-labo { max-width: 900px; margin: 0 auto; }
.parametres-labo .carte > label { margin-top: 10px; }
.apercu-image { display: block; max-width: 100%; max-height: 160px; border: 1px solid var(--bord); border-radius: 6px; margin: 8px 0; }
textarea { font: inherit; color: var(--texte); padding: 7px 9px; border: 1px solid var(--bord); border-radius: 7px; resize: vertical; }

/* Barre de boutons du dossier (comme EasyLab) */
.barre-outils { display: flex; align-items: stretch; gap: 4px; flex-wrap: wrap; background: #fff; border: 1px solid var(--bord);
  border-radius: var(--rayon); padding: 6px; margin-bottom: 14px; }
.barre-outils > a, .barre-outils > button, .barre-outils > span:not(.separateur) {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-width: 64px;
  padding: 5px 8px; border: 1px solid transparent; border-radius: 8px; background: none; font: inherit; font-size: 18px;
  color: var(--texte); cursor: pointer; line-height: 1.1; position: relative; }
.barre-outils span > span, .barre-outils a > span, .barre-outils button > span { font-size: 11px; color: var(--discret); }
.barre-outils kbd { position: absolute; top: 2px; right: 2px; font-size: 9px; padding: 0 2px; }
.barre-outils > a:hover, .barre-outils > button:hover:not(:disabled) { background: var(--accent-clair); border-color: var(--accent); text-decoration: none; }
.barre-outils .inactif, .barre-outils button:disabled { opacity: .35; cursor: default; }
.barre-outils .separateur { width: 1px; background: var(--bord); margin: 4px 6px; }
.barre-outils .quitter { margin-left: auto; }
#table-analyses tr.choisie { background: var(--accent-clair); }

/* Tarifs - Infos */
#table-tarifs { margin-top: 12px; }
#table-tarifs tbody tr:hover { cursor: default; }
.vide-tarifs { text-align: center; padding: 30px 0; }
.totaux-tarifs { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.totaux-tarifs label { min-width: 140px; }
.totaux-tarifs .montant { margin-left: auto; }
.totaux-tarifs .montant input { font-size: 20px; font-weight: 700; color: var(--accent-fonce); background: var(--accent-clair); text-align: right; }
a.principal-lien { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
a.principal-lien:hover { background: var(--accent-fonce); }

/* Retraits du jour */
.retraits tbody tr:hover { cursor: default; }
.retraits .groupe-heure td { background: var(--accent-clair); color: var(--accent-fonce); font-weight: 700; }
.retraits .case-col { text-align: center; width: 70px; }
.retraits tr.retire td { color: var(--discret); }
.retraits tr.retire td a { color: var(--discret); text-decoration: line-through; }
.retraits input.destinataire { width: 100%; min-width: 120px; padding: 4px 6px; }
.actions input[type=date] { padding: 6px 8px; }
@media print { .entete, .barre-dossier .actions { display: none; } .carte { border: 0; } }

/* --- Répertoire téléphonique -------------------------------------------- */
.astuce { margin: -6px 0 12px; }
.repertoire tbody tr { cursor: pointer; }
.fiche-prescripteur { margin-bottom: 16px; }
.fiche-prescripteur h2 { margin-top: 0; }
.grille-fiche { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px 14px; margin-bottom: 12px; }
.grille-fiche label { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; color: var(--discret); }
.grille-fiche .large { grid-column: span 2; }
.fiche-prescripteur .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.fiche-prescripteur button.danger { margin-left: auto; }

/* --- Dépenses de caisse ------------------------------------------------- */
.onglets { display: flex; gap: 4px; }
.onglets a { padding: 8px 16px; border: 1px solid var(--bord, #d0d5dd); border-radius: 8px 8px 0 0; text-decoration: none; color: inherit; background: #fff; }
.onglets a.actif { background: var(--accent-clair); color: var(--accent-fonce); font-weight: 700; }
.saisie-depense, .filtres-ligne { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; margin-bottom: 16px; }
.saisie-depense label, .filtres-ligne label { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; color: var(--discret); }
.saisie-depense input.court { width: 110px; }
.entete-liste { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.entete-liste h2 { margin: 0; }
.depenses tbody tr:hover { cursor: default; }
.depenses tfoot td { font-weight: 600; border-top: 2px solid var(--bord, #d0d5dd); }
.depenses .groupe-rubrique td { background: var(--accent-clair); color: var(--accent-fonce); font-weight: 700; }
.depenses td.retrait { padding-left: 28px; }
.corbeille { background: none; border: none; padding: 2px 6px; font-size: 1rem; cursor: pointer; }
@media (max-width: 700px) { .grille-fiche .large { grid-column: auto; } }

/* --- Recherche de dossiers ---------------------------------------------- */
.onglets-recherche { flex-wrap: wrap; margin-bottom: -1px; }
.critere-recherche { border-top-left-radius: 0; }
.critere-recherche label.large { flex: 1 1 320px; }
.critere-recherche .choix-radio { display: flex; gap: 12px; align-items: center; border: 0; padding: 0; margin: 0; }
.bouton.whatsapp { color: #1a8f4c; border-color: #1a8f4c; }
.envoi-mail { display: flex; flex-direction: column; gap: 12px; max-width: 860px; }
.envoi-mail label { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; color: var(--discret); }
.envoi-mail label.case { flex-direction: row; align-items: center; color: inherit; }
.envoi-mail .etapes { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.envoi-mail .etapes .bouton { margin-right: 8px; }
.avec-bouton { display: flex; gap: 4px; }
.avec-bouton input { flex: 1; min-width: 0; }
.bouton.petit { padding: 4px 10px; display: inline-flex; align-items: center; }
.etat-dossier { float: right; font-size: .8rem; font-weight: 600; background: var(--accent-clair); color: var(--accent-fonce); padding: 2px 10px; border-radius: 6px; }
.avec-bouton input.taux { flex: 0 0 64px; }
.avec-bouton .unite { align-self: center; color: var(--discret); font-size: .85rem; }
.avec-bouton.remise input:not(.taux) { flex: 0 0 120px; }
.sous-titre-grille { margin: 6px 0 -4px; font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--discret); }
.libelle-choix { display: block; font-size: .85rem; color: var(--accent-fonce); margin-bottom: 4px; }
.astuce-recherche { margin: 6px 0 10px; font-size: .8rem; color: #2f7a3b; font-weight: 600; }
/* Fenêtre « Liste à cocher » façon EasyLab : liste verticale + OK / ✕ */
.fenetre-cocher { border: 1px solid #c9d0db; border-radius: 10px; padding: 0; display: none; }
.fenetre-cocher[open] { display: flex; }
.fenetre-cocher::backdrop { background: rgba(15, 23, 42, .25); }
.cases-cocher { display: flex; flex-direction: column; max-height: 75vh; overflow-y: auto; padding: 10px 14px; min-width: 220px; }
.cases-cocher label.case { font-weight: 600; padding: 3px 4px; border-radius: 4px; }
.cases-cocher label.case:hover { background: var(--accent-clair); }
.boutons-cocher { display: flex; flex-direction: column; justify-content: space-between; padding: 10px; border-left: 1px solid #e3e7ee; }
.rond { width: 52px; height: 52px; border-radius: 50%; font-weight: 800; border: 2px solid; cursor: pointer; }
.rond.ok { background: #22c55e; border-color: #15803d; color: #fff; }
.rond.annuler { background: #fff; border-color: #dc2626; color: #dc2626; font-size: 1.3rem; }
/* Fenêtre « Liste déroulante » : tout le catalogue */
.fenetre-deroulante { border: 1px solid #c9d0db; border-radius: 10px; padding: 12px; width: min(520px, 94vw); }
.fenetre-deroulante::backdrop { background: rgba(15, 23, 42, .25); }
.fenetre-deroulante input { width: 100%; margin-bottom: 8px; }
.liste-deroulante { list-style: none; margin: 0; padding: 0; height: 60vh; overflow-y: auto; border: 1px solid #e3e7ee; border-radius: 6px; font-size: 13px; }
.liste-deroulante li { padding: 3px 8px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-transform: uppercase; }
.liste-deroulante li:hover { background: var(--accent-clair); }
.liste-deroulante li.choisie { background: var(--accent); color: #fff; }
.liste-deroulante li.deja { color: var(--discret); font-style: italic; }
.boutons-deroulante { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.boutons-deroulante .discret { flex: 1; font-size: .8rem; }

/* ======================================================================
   Affichage compact « écran unique » (demande d'ELG : pas de défilement)
   Chaque écran tient dans la fenêtre ; seules les longues listes défilent
   à l'intérieur de leur cadre, comme les grilles d'EasyLab.
   ====================================================================== */
@media (min-width: 901px) {
  body { font-size: 13px; line-height: 1.3; }
  h1 { font-size: 17px; margin: 0; }
  h2 { font-size: 11.5px; margin: 0 0 6px; }
  .entete { height: 40px; }
  .page { max-width: none; padding: 8px 12px; }
  .carte { padding: 8px 10px; margin-bottom: 8px; }
  label { font-size: 11px; gap: 1px; }
  label.case { font-size: 12.5px; }
  input, select { padding: 3px 6px; border-radius: 5px; }
  button, .bouton { padding: 4px 10px; border-radius: 5px; }
  button.grand { padding: 7px 16px; font-size: 14px; }
  .grille { gap: 5px 8px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .grille > label { min-width: 0; white-space: nowrap; }
  .grille > label > input, .grille > label > select, .grille > label > .avec-bouton { width: 100%; }
  .grille > label small { white-space: normal; }
  .cases { gap: 2px; }
  .discret { font-size: 12px; }
  .barre-dossier { margin-bottom: 6px; gap: 8px; }
  .barre-outils { padding: 3px; margin-bottom: 6px; }
  .barre-outils > a, .barre-outils > button, .barre-outils > span:not(.separateur) { font-size: 15px; padding: 2px 6px; min-width: 56px; }
  .barre-outils span > span, .barre-outils a > span, .barre-outils button > span { font-size: 10px; }
  .tableau { font-size: 12.5px; }
  .tableau th { padding: 4px 6px; font-size: 10.5px; }
  .tableau td { padding: 3px 6px; }
  .message { padding: 6px 10px; margin-bottom: 6px; }
  .sous-titre-grille { margin: 2px 0 -2px; font-size: 10.5px; }

  /* Dossier patient sur 3 colonnes : patient + retrait | prescription + règlements | analyses */
  .dossier { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.05fr); gap: 8px; align-items: start; }
  .dossier > .colonne { display: flex; flex-direction: column; min-width: 0; }
  .analyses { min-height: 0; }
  .ajout-analyse { margin-bottom: 4px; }
  .ajout-analyse input { font-size: 13px; padding: 4px 8px; }
  .astuce-recherche { margin: 2px 0 4px; font-size: 11px; }
  .libelle-choix { font-size: 11px; margin-bottom: 1px; }
  #table-analyses { display: block; max-height: calc(100vh - 420px); min-height: 90px; overflow-y: auto; }
  #table-analyses thead, #table-analyses tbody { display: table; width: 100%; table-layout: fixed; }
  #table-analyses th:nth-child(1), #table-analyses td:nth-child(1) { width: auto; }
  #table-analyses th:nth-child(n+2), #table-analyses td:nth-child(n+2) { width: 62px; }
  #table-analyses th:last-child, #table-analyses td:last-child { width: 28px; }
  .totaux { gap: 10px; padding-top: 6px; margin-top: 6px; font-size: 12px; }
  .totaux .du { font-size: 13px; }
  .totaux .du strong { font-size: 18px; }
  .enregistrer { margin-top: 2px; }
  .resume-paiement { gap: 6px; margin-bottom: 6px; }
  .resume-paiement > div { padding: 4px 8px; min-width: 0; }
  .resume-paiement strong { font-size: 15px; }
  .nouveau-reglement { gap: 5px; margin-bottom: 6px; }
  .nouveau-reglement label { min-width: 0; flex: 1 1 90px; }
  .reglements .tableau { display: block; max-height: 22vh; overflow-y: auto; }
  .zone-historique .historique { max-height: 14vh; overflow-y: auto; margin: 0; }
  .zone-historique li { font-size: 12px; }

  /* Listes longues (répertoire, recherche, retraits, dépenses...) : défilement dans le cadre */
  .carte:has(> table.tableau), .carte:has(> .tableau-defilant) { max-height: calc(100vh - 150px); overflow-y: auto; }
  .carte > table.tableau thead th { position: sticky; top: -8px; background: #fff; z-index: 1; }
  .totaux-modes { gap: 6px; }
  .total-mode { margin-bottom: 8px; padding: 6px 10px; }
  .total-mode strong { font-size: 17px; }
  .raccourci { padding: 10px; }
}
@media (min-width: 901px) {
  .parametres-labo { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 8px; align-items: start; }
  .parametres-labo .enregistrer { grid-column: 1 / -1; }
  .parametres-labo .carte > label { margin-top: 4px; }
  .parametres-labo .carte > p.discret { font-size: 11px; }
  .parametres-labo .apercu-image { max-height: 60px; max-width: 100%; }
  .parametres-labo textarea { font: inherit; }
}

/* Panneau de droite du dossier (comme EasyLab) */
.panneau-dossier .infos-dossier { display: flex; flex-direction: column; gap: 4px; }
.panneau-dossier .infos-dossier div { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.panneau-dossier .infos-dossier span { color: var(--accent-fonce); font-size: 12px; }
.panneau-dossier .infos-dossier strong { background: var(--ok-clair); border: 1px solid #b7dcc2; border-radius: 4px; padding: 1px 6px; min-width: 0; width: 88px; text-align: center; }
.panneau-dossier .infos-dossier strong.rouge { color: var(--alerte); }
.boutons-panneau { display: flex; justify-content: space-around; }
.boutons-panneau a, .boutons-panneau button, .boutons-panneau span { font-size: 24px; border: 0; background: none; padding: 2px 6px; border-radius: 6px; line-height: 1.2; }
.boutons-panneau a:hover, .boutons-panneau button:hover { background: var(--accent-clair); text-decoration: none; }
.boutons-panneau .inactif { opacity: .3; cursor: default; }
.horloge { background: #000; color: #ffe27a; font: 700 13px/1.3 "Segoe UI", sans-serif; text-align: center; padding: 4px; border-radius: 6px; margin-bottom: 8px; }
.grille-raccourcis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.grille-raccourcis a { font-size: 22px; text-align: center; padding: 4px 0; border: 1px solid var(--bord); border-radius: 6px; background: #fff; }
.grille-raccourcis a:hover { background: var(--accent-clair); border-color: var(--accent); text-decoration: none; }
.totaux .ech { font-weight: 600; color: var(--texte); }
@media (min-width: 901px) {
  .dossier { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.05fr) 170px; }
}
@media (max-width: 900px) { .panneau-dossier { display: none; } }

/* Passe d'ergonomie */
.icone-raccourci { font-size: 30px; line-height: 1; }
.raccourci { align-items: center; text-align: center; gap: 6px; }
.etat-panneau { display: block; text-align: center; margin-bottom: 4px; }
.bouton-valider { width: 100%; justify-content: center; margin-bottom: 6px; }
.infos-creation { font-size: 11px; text-align: center; margin: 0 0 6px; }
@media (min-width: 901px) {
  .dossier { grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr) minmax(0, .95fr) 160px; }
  .accueil .raccourcis { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}
.raccourci { position: relative; justify-content: center; }
.raccourci kbd { position: absolute; top: 6px; right: 6px; }
@media (min-width: 901px) { .analyses { flex: 1; } }

/* ===== Thème « laboratoire » : fond bleu-vert médical, texte plus contrasté ===== */
:root {
  --texte: #0f1b2d;
  --discret: #3f4d63;
  --bord: #c5d0dc;
  --fond: #eef4f8;
  --accent: #0b6e99;
  --accent-fonce: #08587b;
  --accent-clair: #e1f1f8;
  --labo-1: #0a4f6e;
  --labo-2: #0e7c86;
}
body {
  background-color: #dbeaf1;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='104' viewBox='0 0 120 104'%3E%3Cg fill='none' stroke='%230e7c86' stroke-opacity='.10' stroke-width='1.5'%3E%3Cpath d='M30 2l26 15v30L30 62 4 47V17z'/%3E%3Cpath d='M90 44l26 15v30L90 104 64 89V59z'/%3E%3Ccircle cx='96' cy='18' r='5'/%3E%3Ccircle cx='24' cy='86' r='4'/%3E%3Cpath d='M56 32h8M90 23v21'/%3E%3C/g%3E%3C/svg%3E"),
    linear-gradient(160deg, #e6f2f7 0%, #d3e6ee 55%, #cfe3e6 100%);
  background-attachment: fixed;
}
/* Bandeau du haut aux couleurs du labo */
.entete { background: linear-gradient(90deg, var(--labo-1), var(--labo-2)); border-bottom: 0; box-shadow: 0 2px 6px rgba(10,79,110,.25); }
.entete .marque, .entete .logo, .entete .menu > button, .entete .session .labo, .entete .session button.lien { color: #fff; }
.entete .session .labo { font-weight: 600; }
.entete .menu:hover > button, .entete .menu:focus-within > button { background: rgba(255,255,255,.18); }
.entete .session .qui { background: rgba(255,255,255,.2); color: #fff; }
/* Cartes : blanches et nettes sur le fond */
.carte, .barre-outils { border-color: #c9d6e0; box-shadow: 0 1px 3px rgba(15,27,45,.08); }
.carte { border-top: 3px solid var(--labo-2); }
h2 { color: var(--labo-1); font-weight: 700; }
label { color: #2b3a50; font-weight: 500; }
input, select { border-color: #b4c1cf; color: #0b1626; }
input[readonly], fieldset:disabled input, fieldset:disabled select { background: #f1f5f8; color: #22314a; }
.barre-outils span > span, .barre-outils a > span, .barre-outils button > span { color: #2b3a50; }
.tableau th { color: var(--labo-1); }
@media (min-width: 901px) {
  body { font-size: 13.5px; }
  label { font-size: 11.5px; }
}
.page-connexion { background: transparent; }
@media print { body { background: #fff !important; } .carte { box-shadow: none; border-top-width: 1px; } }
.entete .session .labo { max-width: 420px; }
.session .labo { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; }
.session .labo-nom, .session .labo-bio { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.session .labo-bio { font-size: 12px; font-weight: 500; opacity: .9; }
.nouveau-reglement .impressions { flex-basis: 100%; display: flex; gap: 14px; }
.marque { display: inline-flex; align-items: center; gap: 8px; }
.logo-labo { height: 34px; width: auto; background: #fff; border-radius: 6px; padding: 2px; }
.logo-connexion { display: block; margin: 0 auto; max-height: 150px; max-width: 100%; }
.logo-parametre { display: flex; align-items: center; gap: 10px; margin-top: 6px; flex-wrap: wrap; }
.logo-parametre .apercu-image { max-height: 50px; }
@media (min-width: 901px) { .logo-labo { height: 32px; } }
/* Anciens patients proposés pendant la saisie */
.carte:has(> .suggestions-patients) { position: relative; }
.suggestions-patients { position: absolute; z-index: 30; min-width: 320px; max-width: 460px; max-height: 300px; overflow: auto;
  margin: 0; padding: 4px; list-style: none; background: #fff; border: 1px solid var(--bord); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(16,24,40,.18); }
.suggestions-patients li { display: flex; flex-direction: column; padding: 5px 8px; border-radius: 6px; cursor: pointer; }
.suggestions-patients li span { font-size: 11.5px; color: var(--discret); }
.suggestions-patients li:hover, .suggestions-patients li.actif { background: var(--accent-clair); }
.patient-connu { font-size: 11px; color: var(--ok); font-weight: 600; }
.provisoire { color: var(--discret) !important; font-style: italic; }
.obligatoire { color: var(--alerte); font-weight: 700; }

/* --- Automates ------------------------------------------------------- */
.actions-automates { display: flex; gap: 8px; align-items: center; }
.actions-automates form { margin: 0; }
.bouton.principal { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.bouton.principal:hover { background: var(--accent-fonce); }
.voyant { display: inline-block; width: 11px; height: 11px; border-radius: 50%; vertical-align: -1px; margin-right: 3px; box-shadow: 0 0 0 2px rgba(0,0,0,.06); }
.voyant.vert { background: #1a7f37; } .voyant.orange { background: #e08a00; }
.voyant.rouge { background: #b42318; } .voyant.gris { background: #9aa5b1; }
.legende-voyants { margin-top: 10px; font-size: 13px; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.tableau.automates td { padding: 6px 8px; }
.liens-ligne { white-space: nowrap; } .liens-ligne a + a { margin-left: 10px; }
.fiche-automate { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.fiche-automate form.carte, .fiche-automate .carte { margin-bottom: 0; padding: 12px 16px; }
.fiche-automate h2 { margin: 8px 0 6px; font-size: 13px; }
.fiche-automate h2:first-of-type { margin-top: 0; }
.fiche-automate .grille { gap: 8px 12px; margin-bottom: 4px; }
.fiche-automate label.case { align-self: end; padding-bottom: 6px; }
.boutons-fiche { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }
.guide-automate ol.etapes { margin: 0 0 8px; padding-left: 0; list-style: none; counter-reset: etape; font-size: 13.5px; }
.guide-automate ol.etapes li { counter-increment: etape; padding: 3px 0 3px 30px; position: relative; }
.guide-automate ol.etapes li::before { content: counter(etape); position: absolute; left: 0; top: 2px; width: 21px; height: 21px; border-radius: 50%;
  border: 1.5px solid var(--bord); text-align: center; font-size: 12px; line-height: 18px; font-weight: 700; color: var(--discret); background: #fff; }
.guide-automate ol.etapes li.fait::before { content: "✓"; background: var(--ok); border-color: var(--ok); color: #fff; }
.guide-automate ol.etapes li.fait { color: var(--discret); }
.derniers-logs { list-style: none; margin: 0; padding: 0; font-size: 12.5px; }
.derniers-logs li { padding: 2px 0; border-bottom: 1px solid #eef1f5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.derniers-logs li.erreur { color: var(--alerte); } .derniers-logs li.alerte { color: #a15c00; }
.filtres-journal { display: flex; gap: 8px; } .filtres-journal select, .filtres-journal input { width: auto; }
.journal-automates tr.niveau-erreur td { color: var(--alerte); }
.journal-automates tr.niveau-alerte td { color: #a15c00; }
.journal-automates tbody tr:hover { cursor: default; }
.journal-automates pre { white-space: pre-wrap; font-size: 12px; background: var(--fond); padding: 6px; margin: 4px 0 0; max-width: 60ch; }
.alerte-texte { color: var(--alerte); }
.saisie-depense label.large { flex: 2; }
.fiche-automate label.case input { width: auto; margin: 0; }
.fiche-automate label.case { font-size: 13.5px; }
.journal-automates { max-height: calc(100vh - 150px); overflow: auto; padding-top: 0; }
.journal-automates thead th { position: sticky; top: 0; background: var(--carte); padding-top: 12px; }

/* --- Grille NFS -------------------------------------------------------- */
.grille-nfs .nfs-champs { border: 0; padding: 0; margin: 0; display: grid; gap: 10px 12px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr) minmax(0, 1.1fr); }
.grille-nfs .carte { margin: 0; padding: 8px 12px; }
.grille-nfs h2 { margin: 0 0 4px; font-size: 12.5px; }
.nfs-milieu, .nfs-droite { display: flex; flex-direction: column; gap: 10px; }
.nfs-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.nfs-table td, .nfs-table th { padding: 2px 4px; }
.nfs-table th { font-size: 12px; color: var(--accent-fonce); font-weight: 600; text-align: left; }
.nfs-table td:first-child { color: var(--accent-fonce); white-space: nowrap; }
.nfs-table input { width: 84px; padding: 3px 6px; font-weight: 700; background: #fffde8; }
.nfs-table input.element { width: 100%; min-width: 120px; font-weight: 400; }
.nfs-table input.pourcent-anormal { width: 64px; }
.nfs-table output.absolu { display: inline-block; min-width: 76px; padding: 3px 6px; border: 1px solid var(--bord); border-radius: 6px;
  color: var(--texte, #1d2733); font-weight: 700; background: #fff; min-height: 28px; }
.nfs-table tr.haut input, .nfs-table tr.bas input, .nfs-table tr.haut output, .nfs-table tr.bas output { color: var(--alerte); border-color: var(--alerte); background: var(--alerte-clair); }
.nfs-table tr.haut td:last-child::after { content: " ↑"; color: var(--alerte); font-weight: 700; }
.nfs-table tr.bas td:last-child::after { content: " ↓"; color: var(--alerte); font-weight: 700; }
#total-formule { font-weight: 700; color: var(--ok); font-size: 13px; padding-left: 6px; }
#total-formule.faux { color: var(--alerte); }
.nfs-retic { display: flex; gap: 12px; } .nfs-retic label { flex: 1; font-size: 13px; } .nfs-retic input { font-weight: 700; background: #fffde8; }
.nfs-normales { background: #e3f1ec !important; font-size: 14px; display: flex; flex-direction: column; gap: 2px; min-height: 60px; }
.nfs-commentaires { grid-column: 1 / -1; }
.nfs-comm { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 10px; }
.nfs-comm textarea { width: 100%; resize: vertical; font: inherit; font-size: 14px; padding: 4px 8px; background: #fffde8; }
.nfs-aides { display: flex; flex-direction: column; gap: 8px; }
.propositions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; }
button.puce { padding: 2px 10px; border-radius: 999px; font-size: 13px; background: var(--accent-clair); border-color: var(--accent); color: var(--accent-fonce); }
.actions-nfs { display: flex; justify-content: flex-end; gap: 10px; margin-top: 10px; }
.ligne-nfs td { padding: 6px 8px 10px; } .ligne-nfs .resume-nfs { margin-left: 12px; font-weight: 600; }
.grille-resultats tr.ligne-nfs:hover { background: transparent; }
.parametres-nfs { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.parametres-nfs .carte { margin: 0; padding: 10px 14px; }
.normales-nfs td, .normales-nfs th { padding: 2px 4px; } .normales-nfs input { width: 70px; padding: 2px 5px; }
.normales-nfs tbody tr:hover { cursor: default; }
.ajout-commentaire { display: flex; gap: 8px; margin-bottom: 8px; }
.liste-commentaires { list-style: none; margin: 0; padding: 0; max-height: calc(100vh - 250px); overflow: auto; font-size: 14px; }
.liste-commentaires li { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #eef1f5; padding: 1px 0; }
.liste-commentaires form { margin: 0; }
.nfs-retic label { min-width: 0; } .nfs-retic input { width: 100%; }
.boutons-blocs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: -4px 0 10px; padding: 8px 10px; background: var(--fond); border-radius: 8px; }
.boutons-blocs .bloc-btn { min-width: 84px; font-weight: 600; text-align: center; padding: 5px 12px; }
.boutons-blocs .bloc-btn.actif { background: var(--accent); border-color: var(--accent); color: #fff; }
.boutons-blocs .bloc-btn.complet:not(.actif) { color: var(--ok); border-color: var(--ok); }
.separateur-blocs { font-size: 12px; font-weight: 700; color: var(--discret); text-transform: uppercase; letter-spacing: .03em; margin: 0 4px 0 10px; }
.zone-grille { max-height: calc(100vh - 300px); min-height: 160px; overflow: auto; }
.zone-grille .grille-resultats thead th { position: sticky; top: 0; background: var(--carte); z-index: 1; }
.colonne-listes { display: flex; flex-direction: column; gap: 12px; }
.liste-commentaires.courte { max-height: 120px; }
.colonne-listes .liste-commentaires:not(.courte) { max-height: calc(100vh - 420px); }
.nfs-table select.element { width: 100%; min-width: 120px; padding: 3px 6px; background: #fffde8; }
/* Dossier validé : cases cliquables (valeurs normales, copier) mais non modifiables */
.lecture-seule { border: 0; padding: 0; margin: 0; min-width: 0; }
.lecture-seule input[readonly], .lecture-seule textarea[readonly] { background: #f1f5f8 !important; cursor: default; }
.lecture-seule select[data-fige] { background: #f1f5f8 !important; }
.lecture-seule input[readonly]:focus, .lecture-seule textarea[readonly]:focus { outline: 2px solid var(--accent-clair); }

/* Aide aux commentaires de la grille des résultats */
.grille-resultats input.commentaire::placeholder { color: #8a8f98; font-style: italic; }
.grille-resultats input.commentaire.a-proposer { border-color: #d9a400; background: #fffbea; }
.seuils-nfs { width: 100%; font-size: 13px; border-collapse: collapse; }
.seuils-nfs td { padding: 2px 4px; }
.seuils-nfs input { width: 80px; }

/* Fenêtre intégrée (au lieu d'un nouvel onglet) */
dialog.fenetre-integree { width: min(1200px, 94vw); height: 92vh; padding: 0; border: 0; border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .35); display: flex; flex-direction: column; overflow: hidden; }
dialog.fenetre-integree:not([open]) { display: none; }
dialog.fenetre-integree::backdrop { background: rgba(15, 27, 45, .45); }
.fenetre-barre { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 10px;
  background: var(--accent, #0f6c8c); color: #fff; }
.fenetre-titre { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fenetre-boutons { display: flex; gap: 6px; }
.fenetre-boutons button { padding: 3px 10px; background: rgba(255, 255, 255, .15); color: #fff; border: 1px solid rgba(255, 255, 255, .4); }
.fenetre-boutons button:hover { background: rgba(255, 255, 255, .3); }
dialog.fenetre-integree iframe { flex: 1; width: 100%; border: 0; background: #fff; }
html.dans-fenetre header.entete { display: none !important; }

/* Confirmation d'ajout de commentaire */
dialog.confirmation { max-width: 520px; border: 0; border-radius: 10px; padding: 18px 20px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
dialog.confirmation::backdrop { background: rgba(15, 27, 45, .4); }
dialog.confirmation .question { margin: 0 0 8px; font-weight: 600; }
dialog.confirmation .texte { margin: 0 0 14px; padding: 8px 12px; border-left: 3px solid var(--accent, #0f6c8c); background: #f1f7fa; white-space: pre-line; }
dialog.confirmation .boutons { display: flex; justify-content: flex-end; gap: 8px; }
.note-ajout { margin: 0 0 6px; padding: 6px 10px; border-radius: 6px; background: #fffbea; border: 1px solid #d9a400; font-size: 13px; }

/* Feuille de maladie */
.bandeau-feuille { margin-bottom: 10px; padding: 8px 12px; border-radius: 8px; background: #d9efe4; font-weight: 700; text-align: center; }
.feuille-maladie { display: grid; grid-template-columns: minmax(0, 1fr) 190px; gap: 12px; }
.fm-gauche { display: flex; flex-direction: column; gap: 10px; }
.fm-ligne { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.fm-assurance { flex: 1; min-width: 260px; }
.avec-bouton { display: flex; gap: 6px; }
.avec-bouton input { flex: 1; }
.fm-tarif { flex: 1; display: flex; flex-direction: column; }
.fm-tarif strong { padding: 6px 10px; border-radius: 6px; background: #d9efe4; }
.fm-grille { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 14px; }
.fm-grille label { display: flex; flex-direction: column; gap: 2px; }
.fm-grille .large { grid-column: 1 / -1; }
.fm-grille input, .fm-grille textarea { background: #fffde8; }
.fm-grille input.montant { font-weight: 700; font-size: 15px; }
.fm-grille input[readonly] { background: #f1f5f8; }
.fm-droite { display: flex; flex-direction: column; gap: 8px; }
.fm-droite .bouton, .fm-droite button { text-align: center; }
.fm-etat { margin: 6px 0 0; font-weight: 700; color: var(--alerte, #c0392b); text-align: center; }
.fm-etat.ok { color: #1a8f4c; }
label.case.rouge { color: var(--alerte, #c0392b); font-weight: 700; }
.liste-assurances { max-width: 620px; }
.ligne-assurance { display: grid; grid-template-columns: minmax(0, 1fr) 150px auto auto; gap: 6px; padding: 3px 0; }
.ligne-assurance.nouvelle { grid-template-columns: minmax(0, 1fr) 150px auto; padding-bottom: 10px; border-bottom: 1px solid var(--bord); margin-bottom: 6px; }
.entetes-assurances { display: grid; grid-template-columns: minmax(0, 1fr) 150px 80px; font-weight: 700; font-size: 13px; }
.filtres-factures { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: flex-end; margin-bottom: 10px; }
.compteur-factures { max-width: 460px; display: flex; gap: 12px; align-items: flex-end; }
@media (max-width: 760px) { .feuille-maladie { grid-template-columns: 1fr; } .fm-grille { grid-template-columns: 1fr; } }

/* Module Scanner */
.scanner { display: flex; flex-direction: column; gap: 8px; height: calc(100vh - 110px); min-height: 480px; }
html.dans-fenetre .scanner { height: calc(100vh - 30px); }
.sc-barre { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sc-barre form { margin: 0; }
.sc-bandeau { flex: 1; min-width: 200px; text-align: center; font-weight: 700; padding: 5px 10px; border-radius: 6px; background: #d9efe4; }
.sc-compte { font-weight: 700; color: var(--alerte, #c0392b); }
.sc-corps { flex: 1; min-height: 0; display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 8px; }
.sc-panneau { display: flex; flex-direction: column; gap: 6px; overflow: auto; }
.sc-panneau fieldset { margin: 0; padding: 6px 8px; border: 1px solid var(--bord); border-radius: 8px; background: #fff; display: flex; flex-direction: column; gap: 5px; font-size: 13px; }
.sc-panneau legend { font-weight: 700; font-size: 12px; padding: 0 4px; }
.sc-panneau input[type=range] { width: 100%; }
.sc-panneau input[type=number] { width: 70px; }
.sc-rotation { display: flex; gap: 4px; }
.sc-rotation button { flex: 1; font-size: 16px; padding: 2px; }
.sc-vue { position: relative; overflow: auto; border-radius: 8px; background: #c9c8f5; display: flex; align-items: flex-start; justify-content: center; padding: 10px; }
.sc-vue canvas { background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.25); }
.sc-vue iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.sc-vue.envoi { opacity: .5; cursor: progress; }
.sc-vide { margin: auto; text-align: center; color: #333; line-height: 1.8; }
.sc-depot { position: absolute; inset: 6px; border: 3px dashed #0f6c8c; border-radius: 8px; background: rgba(255,255,255,.7);
  display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 700; }
.sc-depot[hidden] { display: none; }
.sc-vue video { position: absolute; inset: 10px; width: calc(100% - 20px); height: calc(100% - 20px); object-fit: contain; background: #000; border-radius: 6px; }
.sc-miniatures { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.sc-miniatures a { flex: 0 0 auto; width: 70px; height: 56px; border: 2px solid transparent; border-radius: 6px; overflow: hidden; background: #fff; display: flex; align-items: center; justify-content: center; }
.sc-miniatures a.actif { border-color: var(--accent, #0f6c8c); }
.sc-miniatures img { width: 100%; height: 100%; object-fit: cover; }
.sc-pdf { font-weight: 700; color: #b42318; }
.sc-note { margin: 0; font-size: 12px; }
@media (max-width: 760px) { .sc-corps { grid-template-columns: 1fr; } .scanner { height: auto; } .sc-vue { min-height: 360px; } }

/* Recherche avancée des examens (*mot / +mot) */
dialog.recherche-examens { width: min(760px, 96vw); max-height: 86vh; padding: 0; border: 0; border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3); display: flex; flex-direction: column; }
dialog.recherche-examens:not([open]) { display: none; }
dialog.recherche-examens::backdrop { background: rgba(10,30,40,.35); }
.re-barre { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; background: var(--accent); color: #fff; margin: 0; }
.re-barre .re-fermer { background: transparent; color: #fff; border: 0; font-size: 18px; cursor: pointer; }
dialog.recherche-examens .re-champ { display: flex; flex-direction: row; gap: 10px; align-items: center; padding: 10px 14px; font-weight: 600; text-align: left; }
dialog.recherche-examens .re-champ input { flex: 1; width: auto; max-width: none; }
.re-liste { overflow: auto; flex: 1; min-height: 160px; max-height: 55vh; padding: 0 14px; outline: none; }
.re-liste tbody tr { cursor: pointer; }
.re-liste tbody tr.actif td { background: var(--accent-clair); font-weight: 600; }
.re-pied { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 8px 14px 12px; margin: 0; font-size: 13px; }
/* Envois */
.actions-envoi { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; margin-top: 10px; }
.tableau-envois td:first-child, .tableau-envois th:first-child { width: 30px; }
.actions-ligne { display: flex; gap: 4px; align-items: center; }
.actions-ligne form { display: flex; gap: 4px; margin: 0; }
.deux-colonnes { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; }
.ligne-labo { display: grid; grid-template-columns: 110px minmax(0, 1fr) minmax(0, 1.4fr) 120px 120px 90px; gap: 6px; padding: 3px 0; }
.ligne-labo.entetes { font-weight: 700; font-size: 13px; }
.ligne-labo.nouvelle { padding-bottom: 10px; border-bottom: 1px solid var(--bord); margin-bottom: 6px; }
@media (max-width: 900px) { .ligne-labo { grid-template-columns: 1fr 1fr; } .ligne-labo.entetes { display: none; } }

/* Fenêtre du bouton Rm : montant demandé -> remise et % */
dialog.fenetre-rm { border: 0; border-radius: 12px; padding: 18px 20px; width: min(340px, 92vw); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
dialog.fenetre-rm::backdrop { background: rgba(10,30,40,.3); }
dialog.fenetre-rm h3 { margin: 0 0 6px; }
dialog.fenetre-rm label { display: grid; gap: 4px; font-weight: 600; }
dialog.fenetre-rm .rm-montant { font-size: 20px; text-align: right; }
dialog.fenetre-rm .rm-apercu { min-height: 1.3em; color: var(--accent); font-weight: 600; }
dialog.fenetre-rm .actions { display: flex; flex-direction: row-reverse; justify-content: flex-start; gap: 8px; }
.infos-tarifs { display: flex; gap: 28px; flex-wrap: wrap; align-items: baseline; }
.infos-tarifs > div { display: flex; flex-direction: column; gap: 2px; }
.infos-tarifs .etiquette-info { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--texte-discret, #567); }
.infos-tarifs .jeun-non { color: #c62828; }
.infos-tarifs .jeun-oui { color: #c62828; text-transform: uppercase; }
.fiches tr.urgent td { background: #fff1f1; }
.fiches .badge-urgent { color: #c62828; font-size: 11px; }
.fiches .manquantes { color: #c62828; font-weight: 600; }
.sous-menu .groupe-menu { padding: 6px 14px 2px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; opacity: .7; }
.sous-menu a.retrait-menu { padding-left: 28px; }
.raccourci-menu { position: relative; }
.raccourci-menu > summary { list-style: none; cursor: pointer; }
.raccourci-menu > summary::-webkit-details-marker { display: none; }
.raccourci-menu .menu-raccourci { position: absolute; right: 0; top: 100%; z-index: 20; background: #fff; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.2); padding: 6px; display: flex; flex-direction: column; min-width: 230px; }
.raccourci-menu .menu-raccourci a { padding: 7px 10px; border-radius: 6px; font-size: 14px; text-align: left; white-space: nowrap; width: auto; height: auto; }
.raccourci-menu .menu-raccourci a:hover { background: var(--accent-clair); }
.grille-raccourcis .raccourci-menu > summary { font-size: 22px; text-align: center; padding: 4px 0; border: 1px solid var(--bord); border-radius: 6px; background: #fff; }
.grille-raccourcis .raccourci-menu > summary:hover, .grille-raccourcis .raccourci-menu[open] > summary { background: var(--accent-clair); border-color: var(--accent); }
.grille-raccourcis .menu-raccourci { right: 0; left: auto; }
.grille-raccourcis .menu-raccourci a { border: 0; font-size: 14px; text-align: left; padding: 7px 10px; background: transparent; }
.clinique-groupe h2 { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.clinique-groupe .reste, .clinique-groupe td.reste { color: #c62828; }
.reglement-groupe { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; position: sticky; bottom: 0; }
@media print { .reglement-groupe, .tout-cocher, input[name=visite] { display: none; } }
.resume-suivi { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.resume-suivi div { display: flex; flex-direction: column; gap: 2px; }
.resume-suivi span { font-size: 12px; text-transform: uppercase; color: var(--discret); }
.resume-suivi strong { font-size: 18px; }
.resume-suivi .rouge strong, .rouge, .suivi td.reste { color: #c62828; }
.suivi tfoot th { border-top: 2px solid var(--bord); }
.liens-suivi { margin: 2px 0; }
.ligne-prel { display: grid; grid-template-columns: 2fr 1fr 80px auto; gap: 8px; align-items: center; margin-bottom: 6px; }
.ligne-prel.entetes { font-size: 12px; text-transform: uppercase; color: var(--discret); }
.sous-menu hr { border: 0; border-top: 1px solid var(--bord); margin: 4px 6px; }
.sous-menu .imbrique { position: relative; }
.sous-menu .imbrique > .ouvre { cursor: default; }
.sous-menu .imbrique > .ouvre b { font-weight: 400; }
.sous-menu .imbrique:hover > .ouvre, .sous-menu .imbrique:focus-within > .ouvre { background: var(--accent-clair); }
.sous-menu-2 { display: none; position: absolute; left: 100%; top: -6px; min-width: 260px; padding: 6px; background: #fff;
  border: 1px solid var(--bord); border-radius: var(--rayon); box-shadow: 0 8px 24px rgba(16,24,40,.12); z-index: 30; }
.sous-menu .imbrique:hover > .sous-menu-2, .sous-menu .imbrique:focus-within > .sous-menu-2 { display: block; }

/* ---- Statistiques ---- */
.stat-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin: 12px 0; }
.stat-kpis .carte { padding: 14px 16px; display: flex; flex-direction: column; gap: 3px; }
.stat-kpis small { color: var(--discret); font-size: 12.5px; }
.stat-kpis strong { font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; }
.stat-kpis strong em { font-style: normal; font-size: 13px; color: var(--discret); font-weight: 500; }
.stat-kpis .discret { font-size: 12px; }
.stat-grille { display: grid; gap: 12px; margin-bottom: 12px; }
.stat-grille.deux { grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); }
.stat-grille.trois { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.stat-grille .carte { padding: 16px 18px; min-width: 0; }
.stat-grille hr { border: 0; border-top: 1px solid var(--bord); margin: 10px 0; }
/* Histogramme vertical : une seule série, une seule couleur, valeur au survol */
.histo { display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 2px; align-items: end; height: 190px;
  border-bottom: 1px solid var(--bord); padding-top: 22px; }
.histo-col { position: relative; height: 100%; display: flex; align-items: flex-end; justify-content: center; cursor: default; outline: none; }
.histo-col::before { content: ""; position: absolute; inset: 0 -1px; }
.histo-col i { display: block; width: min(100%, 34px); min-height: 1px; background: var(--accent); border-radius: 4px 4px 0 0; }
.histo-col:hover i, .histo-col:focus i { background: var(--accent-fonce); }
.histo-max { position: absolute; top: -18px; font-style: normal; font-size: 11.5px; color: var(--texte); white-space: nowrap; font-variant-numeric: tabular-nums; }
.histo-bulle { display: none; position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); z-index: 3; white-space: nowrap;
  background: var(--texte); color: var(--carte); font-size: 12px; padding: 4px 8px; border-radius: 6px; pointer-events: none; }
.histo-col:hover .histo-bulle, .histo-col:focus .histo-bulle { display: block; }
.histo-col:hover .histo-max, .histo-col:focus .histo-max { visibility: hidden; }
.histo-axe { display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 2px; font-size: 11px; color: var(--discret); margin-top: 4px; }
.histo-axe span { text-align: center; white-space: nowrap; overflow: visible; }
/* Barres horizontales (classements) */
.stat-ligne { display: grid; grid-template-columns: minmax(110px, 38%) 1fr auto; gap: 10px; align-items: center; padding: 4px 0; font-size: 13px; }
.stat-nom { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-nom b { color: var(--discret); font-weight: 600; }
.stat-barre { height: 10px; background: var(--fond); border-radius: 4px; overflow: hidden; }
.stat-barre i { display: block; height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; min-width: 2px; }
.stat-val { font-variant-numeric: tabular-nums; min-width: 60px; text-align: right; }
.stat-tableau summary { cursor: pointer; padding: 10px 14px; color: var(--accent); }
@media print { .stat-tableau { display: block; } .stat-tableau > summary { display: none; } .histo-bulle { display: none !important; } }

/* ---- Utilisateurs et droits, journal ---- */
.tableau.utilisateurs td { vertical-align: middle; }
.tableau.utilisateurs th:not(:first-child), .tableau.utilisateurs td:not(:first-child) { text-align: center; }
.tableau.utilisateurs tr.inactif td { opacity: .55; }
.mdp-ligne { display: flex; gap: 6px; justify-content: center; }
.mdp-ligne input { width: 120px; }
.ajout-utilisateur { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: flex-end; }
.ajout-utilisateur label.case { display: flex; gap: 6px; align-items: center; }
tr.journal-suppr td { color: var(--alerte); }
tr.journal-modif td:nth-child(3) { font-weight: 600; }

/* ---- Aide à la validation ---- */
.badge-critique { display: none; margin-left: 6px; font-size: 11px; font-weight: 700; color: #fff; background: var(--alerte);
  border-radius: 5px; padding: 1px 6px; vertical-align: middle; }
.grille-resultats tr.critique .badge-critique { display: inline-block; }
.grille-resultats tr.critique td { background: var(--alerte-clair); }
.grille-resultats tr.critique input.valeur { border-color: var(--alerte) !important; color: var(--alerte); font-weight: 700; }
.ecart-ant { display: inline-block; margin-left: 6px; font-size: 11.5px; font-weight: 700; color: #a15c00; background: #fff3dc;
  border-radius: 5px; padding: 0 5px; }
.points-verif { border: 1px solid #f0c36d; background: #fffaf0; border-radius: 10px; padding: 10px 14px; margin: 10px 0; font-size: 13.5px; }
.points-verif.avec-critiques { border-color: var(--alerte); background: var(--alerte-clair); }
.points-verif p { margin: 4px 0; }
.points-verif .pv-critique { color: var(--alerte); }
@media print { .points-verif, .badge-critique, .ecart-ant { display: none !important; } }

/* ---- Réception des tubes ---- */
.scan-tube { display: flex; gap: 10px; align-items: center; padding: 14px 16px; margin: 10px 0; }
.scan-tube label { font-weight: 600; }
.scan-tube input { flex: 1; font-size: 18px; padding: 10px 12px; }
.filtres-tubes { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 10px; }
.filtres-tubes a { text-decoration: none; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--bord); color: var(--texte); background: var(--carte); }
.filtres-tubes a.actif { outline: 2px solid var(--accent); }
.pastille-tube { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 6px; background: #eef1f5; color: #475467; white-space: nowrap; }
.pastille-tube.recu { background: var(--ok-clair); color: var(--ok); }
.pastille-tube.rejete { background: var(--alerte-clair); color: var(--alerte); font-weight: 600; }
.pastille-tube.retard { background: #fff3dc; color: #a15c00; font-weight: 600; }
.pastille-tube.incomplet { background: #e8f0fe; color: #1857c0; }
.tube-ligne { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 2px 0; }
.tube-actions { display: flex; gap: 4px; align-items: center; }
.tube-actions button.petit, .tube-actions .bouton.petit { padding: 2px 8px; font-size: 12px; }
.tube-actions button.lien { border: 0; background: none; color: var(--discret); text-decoration: underline; }
.rejet { position: relative; }
.rejet > summary { list-style: none; cursor: pointer; }
.rejet > summary::-webkit-details-marker { display: none; }
.rejet-panneau { position: absolute; z-index: 20; right: 0; top: 100%; margin-top: 4px; background: var(--carte); border: 1px solid var(--bord);
  border-radius: 8px; box-shadow: 0 8px 24px rgba(16,24,40,.15); padding: 8px; display: flex; flex-direction: column; gap: 6px; min-width: 240px; }
.tableau.tubes tr.dernier td { background: var(--accent-clair); }
.delai-tubes { padding: 10px 14px; font-size: 13px; }
@media print { .scan-tube, .tube-actions, .delai-tubes, .filtres-tubes { display: none !important; } }
.carte:has(> .tableau.tubes) { overflow: visible; }

/* Retour à l'écran principal du dossier : visible en haut de chaque sous-écran */
.retour-barre { margin: 0 0 12px; }
a.bouton.retour-dossier { display: inline-block; background: #12395b; color: #fff; border: 1px solid #12395b; font-weight: 700; font-size: 15px; padding: 9px 18px; border-radius: 8px; text-decoration: none; }
a.bouton.retour-dossier:hover { background: #0d2c47; }
