/* Clients, équipe et accès : styles propres à ces écrans. Le système commun est dans styles.css.
   Aucune couleur en dur : uniquement les variables du thème. Les couleurs de statut (rouge, ambre, vert) ne servent
   qu'à l'urgence, au retard, au problème et à la confirmation ; un état est toujours écrit ou accompagné d'une icône. */

/* ───────── Fiches (client, membre, accès) ───────── */
.fiche-tete { flex-wrap: wrap; }
.fiche-identite { flex: 1 1 220px; min-width: 0; }
.fiche-sous { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 6px; color: var(--encre-2); font-size: 13px; }
.fiche-sous > span { display: inline-flex; align-items: center; gap: 5px; min-width: 0; }
.fiche-sous > span > .ic { color: var(--encre-3); }
.fiche-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; align-items: center; }

/* État écrit en toutes lettres, avec icône : Actif / Inactif / Archivé, Ouvert / Coupé */
.pastille-etat { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px 0 7px; border-radius: 12px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--fond-2); color: var(--encre-2); }
.pastille-etat .ic { width: 13px; height: 13px; }
.pastille-etat.oui { background: var(--menthe-pale); color: var(--foret-700); }
.pastille-etat.contour { background: transparent; box-shadow: inset 0 0 0 1px var(--bord-fort); }

/* Contact en un clic : téléphone et e-mail copiables dès le haut de la fiche */
.contact-rapide { display: flex; align-items: center; gap: 8px 22px; flex-wrap: wrap; padding: 9px 22px; border-top: 1px solid var(--bord); background: var(--surface-2); font-size: 14px; }
.contact-rapide .contact { display: inline-flex; align-items: center; gap: 8px; min-width: 0; font-weight: 550; }
.contact-rapide .contact > .ic { color: var(--encre-3); }
.contact-rapide .copiable .ic { opacity: .55; }
.tel-direct { display: none; }

/* Bandeau de chiffres sous l'en-tête d'une fiche : autant de cases que ce profil a le droit d'en voir */
.rel-stats { display: flex; flex-wrap: wrap; border-top: 1px solid var(--bord); overflow: hidden; border-radius: 0 0 var(--rayon) var(--rayon); }
.rel-stats > div { flex: 1 1 150px; min-width: 0; padding: 11px 18px; box-shadow: 1px 0 0 var(--bord), 0 1px 0 var(--bord); }
.rel-stats b { display: block; font-family: var(--police-titre); font-size: 20px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.2; }
.rel-stats b.moyen { font-size: 15px; letter-spacing: 0; line-height: 1.6; }
.rel-stats small { display: block; margin-top: 2px; color: var(--encre-3); font-size: 12px; }
.rel-stats .stat-argent small { color: var(--laiton); }
.rel-stats .stat-argent small .ic { vertical-align: -2px; margin-right: 4px; }
.a-faire { color: var(--t-ambre); font-weight: 600; }

/* Onglets et barre d'outils posés dans une carte */
.onglets.onglets-carte { margin: 0; padding: 0 8px; }
.carte-barre { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 16px; border-bottom: 1px solid var(--bord); }
.carte-barre .badge-patron { margin-left: auto; }
.carte-barre .segment .compteur { height: 18px; min-width: 18px; font-size: 10.5px; }

/* Champs personnalisés : visiblement à part des champs essentiels (cadre pointillé, fond discret) */
.carte-champs-perso { border-style: dashed; border-color: var(--bord-fort); background: var(--surface-2); box-shadow: none; }
.carte-champs-perso .carte-tete, .carte-champs-perso .carte-pied { border-color: var(--bord); }
.adresse-bloc + .btn-icone.sm { vertical-align: middle; }
.adresse-bloc { display: inline-block; vertical-align: top; }

/* Archivage, suppression, retrait : textes d'explication et gestes */
.separer { font-size: 13px; color: var(--encre-2); line-height: 1.5; }
.separer p + p { margin-top: 8px; }
.separer .rangee { margin-top: 12px; }
.separer .non-simule { margin-top: 14px; }
.btn-risque { color: var(--t-rouge); }
.btn-risque:hover { background: var(--t-rouge-f); border-color: var(--t-rouge); }
.bilan-suppression { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.bilan-suppression .bilan { border: 1px solid var(--bord); border-radius: var(--rayon); padding: 12px 14px; }
.bilan-suppression ul { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 7px; font-size: 13.5px; }
.bilan-suppression li { display: flex; gap: 8px; align-items: flex-start; }
.bilan-suppression li .ic { margin-top: 3px; }
.bilan-suppression .part { background: var(--t-rouge-f); }
.bilan-suppression .part .surtitre, .bilan-suppression .part .ic { color: var(--t-rouge); }
.bilan-suppression .reste { background: var(--t-vert-f); }
.bilan-suppression .reste .surtitre, .bilan-suppression .reste .ic { color: var(--t-vert); }

/* Ce que la maquette ne simule pas : dit clairement, sans bouton */
.non-simule { display: flex; gap: 10px; padding: 12px 14px; border: 1px dashed var(--bord-fort); border-radius: var(--rayon); background: var(--surface-2); color: var(--encre-2); font-size: 13px; line-height: 1.5; }
.non-simule > .ic { flex: none; margin-top: 2px; color: var(--encre-3); }
.non-simule ul { margin: 6px 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }

/* ───────── Clients ───────── */
.lien-nom { color: inherit; }
.lien-nom:hover { color: var(--foret-600); }
.tableau tr.ligne-archivee .cellule-principale { opacity: .62; }
.contact-cellule { font-size: 13px; }
.contact-cellule .copiable { display: flex; width: fit-content; margin: 0 -6px; }

/* ───────── Équipe ───────── */
.equipe-grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
a.membre-carte { color: inherit; transition: box-shadow var(--vite), border-color var(--vite); }
a.membre-carte:hover { text-decoration: none; border-color: var(--bord-fort); box-shadow: var(--ombre-2); }
.membre-carte .lignes { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.membre-carte .lignes b { font-weight: 620; font-size: 15px; }
.membre-carte .lignes small { color: var(--encre-3); font-size: 12.5px; }
.membre-carte .stats-m small { line-height: 1.35; display: block; }
.membre-carte .carte-pied { margin-top: auto; font-size: 12.5px; min-height: 40px; }
.membre-carte.inactif { background: var(--surface-2); border-style: dashed; border-color: var(--bord-fort); box-shadow: none; }
.membre-carte.inactif .avatar { filter: grayscale(1); opacity: .6; }
.membre-carte.inactif .lignes b, .membre-carte.inactif .stats-m b { color: var(--encre-2); }
.a-reverser { display: inline-flex; align-items: center; gap: 5px; color: var(--laiton); font-weight: 550; }

/* ───────── Accès ───────── */
/* Réglages à gauche, aperçu de l'interface toujours visible à droite ; sur une colonne : réglages, aperçu, connexion. */
.acces-fiche { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.acces-fiche > * { grid-column: 1; min-width: 0; }
.acces-fiche > .acces-apercu { grid-column: 2; grid-row: 1 / span 2; position: sticky; top: calc(var(--barre-h) + 16px); }
@media (max-width: 1240px) { .acces-fiche { grid-template-columns: minmax(0, 1fr) 320px; } }
@media (max-width: 1080px) {
  .acces-fiche { grid-template-columns: minmax(0, 1fr); }
  .acces-fiche > .acces-apercu { grid-column: 1; grid-row: auto; position: static; }
}
.qui-liste { display: flex; flex-wrap: wrap; gap: 10px; }
.qui-item { display: flex; align-items: center; gap: 10px; min-width: 230px; padding: 8px 14px 8px 8px; border: 1px solid var(--bord); border-radius: var(--rayon); background: var(--laiton-pale); color: inherit; }
.qui-item:hover { text-decoration: none; border-color: var(--laiton); }
.qui-item .lignes { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.qui-item b { font-weight: 600; }
.qui-item small { color: var(--encre-2); font-size: 12px; }
.resume-droits { font-size: 13px; color: var(--encre-2); line-height: 1.5; }
.cellule-droits { max-width: 440px; }

.droits-table td { vertical-align: middle; }
.droits-table th:first-child, .droits-table .partie { padding-left: 18px; }
.droits-table tr:last-child td { border-bottom: 0; }
.droits-table .partie { min-width: 200px; padding-top: 9px; padding-bottom: 9px; }
.droits-table .partie-nom { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.droits-table .partie-nom > .ic { color: var(--encre-3); }
.droits-table .partie b { font-weight: 600; }
.droits-table .partie small { display: block; margin: 2px 0 0 26px; max-width: 440px; color: var(--encre-3); font-size: 12px; line-height: 1.35; }
.droits-table .ligne-argent { background: var(--laiton-pale); }
.droits-table .ligne-argent .partie-nom > .ic { color: var(--laiton); }
.droits-table .ligne-verrou td { background: var(--surface-2); }
/* Le niveau choisi se lit au libellé et à l'emphase croissante (aucun, voir, modifier), dans la seule teinte d'accent */
.seg-droit button { height: 28px; padding: 0 11px; font-size: 12.5px; }
.seg-droit .actif { font-weight: 650; }
.seg-droit .actif.niv-aucun { color: var(--encre-2); }
.seg-droit .actif.niv-voir { background: var(--menthe-pale); color: var(--foret-700); box-shadow: 0 0 0 1px var(--menthe); }
.seg-droit .actif.niv-agir { background: var(--foret-700); color: var(--surface); box-shadow: none; }
.legende-droits { flex-wrap: wrap; gap: 4px 18px; color: var(--encre-3); font-size: 12.5px; }

.profils-types { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.profil-type { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border: 1px solid var(--bord); border-radius: var(--rayon); background: var(--surface); }
.profil-type p { font-size: 13px; color: var(--encre-2); }
.profil-type small { flex: 1; }
.profil-type .btn { align-self: flex-start; margin-top: 6px; }
.profil-type.en-place { border-color: var(--foret-600); background: var(--menthe-pale); box-shadow: 0 0 0 1px var(--foret-600) inset; }

.apercu-menu { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.apercu-menu .rubrique { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 9px; border-radius: 8px; font-size: 12.5px; font-weight: 550; }
.apercu-menu .rubrique.oui { background: var(--menthe-pale); color: var(--foret-700); }
.apercu-menu .rubrique.non { color: var(--encre-3); box-shadow: inset 0 0 0 1px var(--bord); text-decoration: line-through; text-decoration-color: var(--bord-fort); }
.apercu-argent { display: flex; gap: 10px; margin-top: 14px; padding: 10px 12px; border-radius: var(--rayon); background: var(--fond-2); color: var(--encre-2); font-size: 13px; }
.apercu-argent > .ic { flex: none; margin-top: 1px; color: var(--encre-3); }
.apercu-argent.voit { background: var(--laiton-pale); color: var(--encre); }
.apercu-argent.voit > .ic { color: var(--laiton); }

/* ───────── Téléphone ───────── */
@media (max-width: 760px) {
  .fiche-tete { padding: 16px; gap: 12px; align-items: flex-start; }
  .fiche-tete h1 { font-size: 20px; }
  .fiche-tete > .avatar.xl { width: 48px; height: 48px; font-size: 16px; }
  .fiche-actions { width: 100%; justify-content: stretch; }
  .fiche-actions .btn { flex: 1 1 auto; }
  .contact-rapide { padding: 10px 16px; gap: 8px 14px; }
  .contact-rapide .espace { display: none; }
  .contact-rapide .contact { width: 100%; }
  .tel-direct { display: inline-flex; align-items: center; height: 32px; margin-left: auto; padding: 0 12px; border-radius: 16px; background: var(--menthe-pale); color: var(--foret-700); font-weight: 600; font-size: 13px; white-space: nowrap; }
  .tel-direct:hover { text-decoration: none; }
  .rel-stats > div { flex-basis: 40%; padding: 11px 14px; }
  .rel-stats b { font-size: 18px; }
  .carte-barre { padding: 10px 14px; }
  .carte-barre .segment { display: flex; width: 100%; }
  .carte-barre .segment button { flex: 1; justify-content: center; height: 36px; padding: 0 8px; }
  .carte-barre .badge-patron { margin-left: 0; }
  .bilan-suppression { grid-template-columns: minmax(0, 1fr); }
  .equipe-grille { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .acces-fiche { gap: 12px; }
  .qui-item { min-width: 0; width: 100%; }
  .cellule-droits { max-width: none; }
  .rel-table td.droite:not(.m-droite) { text-align: left; }

  /* La matrice des droits : une carte par partie, deux réglages pleine largeur */
  .droits-table, .droits-table tbody, .droits-table tr, .droits-table td { display: block; }
  .droits-table thead { display: none; }
  .droits-table tr { padding: 12px 14px; border-bottom: 1px solid var(--bord); }
  .droits-table tr:last-child { border-bottom: 0; }
  .droits-table td { padding: 0; border: 0; }
  .droits-table .partie { min-width: 0; padding: 0 0 4px; }
  .droits-table .partie small { max-width: none; }
  .droits-table td[data-lib] { display: grid; grid-template-columns: 58px minmax(0, 1fr); align-items: center; gap: 8px; margin-top: 8px; }
  .droits-table td[data-lib]::before { content: attr(data-lib); font-size: 11.5px; font-weight: 600; color: var(--encre-3); }
  .droits-table .ligne-verrou td { background: none; }
  .droits-table .ligne-verrou { background: var(--surface-2); }
  .seg-droit { display: flex; }
  .seg-droit button { flex: 1; justify-content: center; height: 38px; padding: 0 6px; font-size: 13.5px; }
}

/* ═════════ Lot V4 · OUT, Client et dates d'une commande ═════════
   « clients » en interne = OUT à l'écran (la rubrique OUT garde les styles « Clients » ci-dessus).
   Le Client de l'écran est un simple nom : sa rubrique, son champ dans le formulaire de commande, sa ligne en tête
   de la fiche commande. Avec lui, le bloc « Dates » de la fiche commande. Préfixes : kc- (rubrique Clients),
   fcm-k (formulaire), cde-client / cde-date / cde-kc (fiche commande). */

/* ───────── Rubrique Clients (liste + fiche) ───────── */
.duo .lg.kc-archive .lg-t { color: var(--encre-2); font-weight: 600; }
.duo .lg .kc-etat { font-size: 13px; font-weight: 600; color: var(--encre-2); }
.kc-bascule { padding: 14px 12px 4px; }
.fiche .kc-note { display: flex; align-items: baseline; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; }
.fiche .kc-note > span { flex: 1 1 260px; min-width: 0; }
.fiche a.kc-cmd { color: inherit; }
.fiche a.kc-cmd:hover { text-decoration: none; background: var(--survol); }
.kc-cmd-quoi { display: flex; flex-direction: column; min-width: 0; }
.kc-cmd-quoi b { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kc-cmd-quoi b .mono { font-size: 13.5px; font-weight: 500; }
.kc-cmd-quoi small { font-size: 13.5px; color: var(--encre-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fiche .kc-vide { color: var(--encre-2); }

/* ───────── Formulaire de commande : le champ « Client », à part de l'OUT ───────── */
.fcm-kclient { display: flex; flex-direction: column; gap: 8px; padding-top: 14px; border-top: 1px solid var(--ligne); }
.fcm-kclient .fcm-facultatif { font-size: 13.5px; font-weight: 500; margin-left: 4px; }
.fcm-ksugg-l { display: flex; align-items: baseline; gap: 2px 6px; flex-wrap: wrap; width: 100%; min-height: 44px; padding: 10px 14px; border: 0; border-bottom: 1px solid var(--ligne); background: none; text-align: left; color: inherit; overflow-wrap: anywhere; }
.fcm-ksugg-l:last-child { border-bottom: 0; }
.fcm-ksugg-l:hover { background: var(--survol); }
.fcm-ksugg-l:focus-visible { background: var(--selection); outline: none; box-shadow: inset 0 0 0 2px var(--bleu-600); border-radius: 0; }
.fcm-ksugg-l b { font-weight: 700; }
.fcm-ksugg-l.fcm-ksugg-ajout { color: var(--bleu-600); font-weight: 600; }

/* ───────── Fiche commande : le Client en tête ───────── */
.tete-fiche .sous.cde-client { margin-top: 4px; color: var(--encre); }
.tete-fiche .cde-client b { font-weight: 700; }
.tete-fiche .cde-client-vide { color: var(--encre-2); }
.cde-kc-choix { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.cde-kc-choix:empty { display: none; }
.cde-kc-nom { display: inline-flex; align-items: center; min-height: 40px; max-width: 100%; padding: 6px 14px; border-radius: 10px; border: 1px solid var(--bord-fort); background: var(--surface); font-weight: 700; font-size: 14.5px; text-align: left; overflow-wrap: anywhere; color: inherit; }
.cde-kc-nom:hover { background: var(--survol); }
.cde-kc-nom.actuel { background: var(--encre); border-color: var(--encre); color: #fff; }
.cde-kc-reste { align-self: center; color: var(--encre-2); font-size: 13.5px; }

/* ───────── Fiche commande : le bloc « Dates » ───────── */
.cde-dates .cde-dates-grille { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 20px; border-top: 1px solid var(--ligne); }
.cde-dates .cde-date { min-width: 0; padding: 9px 0 10px; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; }
.cde-dates .cde-date .etq { font-size: 13px; }
.cde-dates .cde-date-val { font-size: 16px; font-weight: 600; line-height: 1.35; color: inherit; text-align: left; max-width: 100%; }
.cde-dates button.cde-date-val { padding: 2px 6px; margin: -2px -6px; border: 0; border-radius: 6px; background: none; cursor: pointer; }
.cde-dates button.cde-date-val:hover { background: var(--fond-2); }
.cde-dates .cde-date-vide { color: var(--encre-3); font-size: 15px; font-weight: 400; }
.cde-dates-form { display: flex; flex-direction: column; gap: 12px; }
.cde-date-saisie { display: flex; align-items: center; gap: 14px; }
.cde-date-saisie input { flex: 1; min-width: 0; }
.cde-dates-aide { margin-top: 12px; color: var(--encre-2); font-size: 13px; }

@media (max-width: 760px) {
  .cde-dates .cde-dates-grille { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cde-dates .cde-date { padding: 10px 0; min-height: 58px; justify-content: center; }
  .cde-dates .cde-date:nth-child(n + 3) { border-top: 1px solid var(--ligne); }
  .cde-dates button.cde-date-val { min-height: 30px; }
  .tete-fiche .cde-client button.lien { position: relative; }
  .tete-fiche .cde-client button.lien::after { content: ""; position: absolute; left: -6px; right: -6px; top: 50%; height: 42px; transform: translateY(-50%); }
  .cde-date-saisie input { font-size: 16px; min-height: 44px; }
  .cde-date-saisie button.lien { min-height: 44px; }
  .cde-kc-nom { min-height: 44px; }
}

@media print {
  .tete-fiche .cde-client .nowrap, .cde-dates .carte-titre button.lien { display: none !important; }
}
