/* ============================================================
   BOUTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: .88rem;
  border: 1px solid var(--ligne);
  background: var(--surface);
  color: var(--texte);
  padding: 8px 14px;
  border-radius: var(--border-radius);
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: var(--transition);
}
.btn:hover {
  border-color: var(--doux);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--texte);
}
.btn:active { transform: translateY(1px); }
.btn.primaire,
.btn-primary {
  background: var(--primary-color);
  color: #fff;
  border-color: var(--primary-color);
}
.btn.primaire:hover,
.btn-primary:hover {
  background: var(--primary-light);
  color: #fff;
}
.btn.danger,
.btn-danger {
  background: var(--danger-color);
  color: #fff;
  border-color: var(--danger-color);
}
.btn.danger:hover { background: #c0392b; color: #fff; }
.btn.danger-outline {
  color: var(--danger-color);
  border-color: var(--danger-color);
  background: var(--surface);
}
.btn.accent,
.btn-accent {
  background: var(--accent-color);
  color: var(--secondary-color);
  border-color: var(--accent-color);
  font-weight: 700;
}
.btn.petit,
.btn-sm {
  padding: 4px 10px;
  font-size: .8rem;
}
.btn[disabled],
.btn:disabled {
  opacity: .5;
  cursor: not-allowed;
  box-shadow: none;
}

/* Lien stylisé inline */
.lien {
  background: none;
  border: 0;
  padding: 0;
  color: var(--info-color);
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.lien:hover { color: var(--primary-light); }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: .77rem;
  font-weight: 600;
  white-space: nowrap;
  background: var(--neutre-fond);
  color: var(--neutre);
}
.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.badge[data-t="ok"]      { background: var(--ok-fond);      color: var(--ok); }
.badge[data-t="alerte"]  { background: var(--alerte-fond);  color: var(--alerte); }
.badge[data-t="attente"] { background: var(--attente-fond); color: var(--attente); }
.badge[data-t="info"]    { background: var(--info-fond);    color: var(--info); }
.badge[data-t="sceau"]   { background: var(--sceau-fond);   color: var(--sceau); }
.badge[data-t="neutre"]  { background: var(--neutre-fond);  color: var(--neutre); }

.badge--outline {
  background: transparent;
  border: 1px solid var(--ligne);
  color: var(--doux);
}
.badge--outline::before { display: none; }

.badge--count {
  padding: 0 7px;
  font-size: .72rem;
  border-radius: 4px;
}
.badge--count::before { display: none; }

/* Puces de qualification (matrice) */
.puces {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.qbadge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 4px;
  font-size: .74rem;
  font-weight: 600;
  background: var(--neutre-fond);
  color: var(--neutre);
  white-space: nowrap;
}
.qbadge[data-t="ok"]      { background: var(--ok-fond);      color: var(--ok); }
.qbadge[data-t="attente"] { background: var(--attente-fond); color: var(--attente); }
.qbadge[data-t="alerte"]  { background: var(--alerte-fond);  color: var(--alerte); text-decoration: line-through; }

/* ============================================================
   CHAÎNE DE CERTIFICATION
   ============================================================ */
.chaine {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  list-style: none;
  margin: 0 0 22px;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--ligne);
  border-radius: 10px;
  overflow: hidden;
}
.chaine li { position: relative; }
.chaine li + li { border-left: 1px solid var(--ligne); }

.chaine-btn {
  position: relative;
  display: grid;
  gap: 4px;
  width: 100%;
  height: 100%;
  text-align: left;
  background: var(--surface);
  border: 0;
  padding: 18px 18px 16px 22px;
  cursor: pointer;
  color: inherit;
  text-decoration: none;
  transition: var(--transition);
}
.chaine-btn::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 4px;
  background: var(--c, var(--info-color));
}
.chaine-btn:hover { background: var(--surface-2); text-decoration: none; }
.chaine-btn[aria-pressed="true"] {
  background: var(--surface-2);
}
.chaine-btn[aria-pressed="true"]::before { height: 6px; }

.chaine .n {
  font-size: 2.1rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -.02em;
}
.chaine .l {
  font-size: .86rem;
  color: var(--doux);
  font-weight: 500;
}
.chaine .e {
  font-size: .74rem;
  color: var(--doux);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-top: 2px;
}

/* Couleurs des étapes */
[data-t="info"]   { --c: var(--info-color); }
[data-t="sceau"]  { --c: var(--sceau); }
[data-t="attente"]{ --c: var(--attente); }
[data-t="ok"]     { --c: var(--ok); }
[data-t="neutre"] { --c: var(--neutre); }
[data-t="alerte"] { --c: var(--alerte); }

/* ============================================================
   FIL D'ÉTAPES (détail audit)
   ============================================================ */
.etapes {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
}
.etapes li {
  flex: 1;
  display: grid;
  justify-items: center;
  gap: 6px;
  text-align: center;
  font-size: .78rem;
  color: var(--doux);
  position: relative;
}
.etapes li::before {
  content: "";
  position: absolute;
  top: 13px; left: -50%;
  width: 100%;
  height: 2px;
  background: var(--ligne);
  z-index: 0;
}
.etapes li:first-child::before { display: none; }
.etapes li[data-e="fait"]::before,
.etapes li[data-e="actuel"]::before { background: var(--ok); }

.pastille {
  position: relative;
  z-index: 1;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: .8rem;
  background: var(--surface);
  border: 2px solid var(--ligne);
}
.etapes li[data-e="fait"] .pastille {
  background: var(--ok);
  border-color: var(--ok);
  color: #fff;
}
.etapes li[data-e="actuel"] .pastille {
  background: var(--btn);
  border-color: var(--btn);
  color: var(--btn-txt);
}
.etapes li[data-e="actuel"] {
  color: var(--texte);
  font-weight: 600;
}

/* ============================================================
   FLASH
   ============================================================ */
.flash-stack {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}
.flash {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: .9rem;
  font-weight: 500;
  border-left: 4px solid currentColor;
}
.flash--success { background: var(--ok-fond);      color: var(--ok); }
.flash--danger  { background: var(--alerte-fond);  color: var(--alerte); }
.flash--warning { background: var(--attente-fond); color: var(--attente); }
.flash--info    { background: var(--info-fond);    color: var(--info); }
.flash-icone {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: currentColor;
  color: var(--surface);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: .75rem;
  flex: none;
}
.flash-message { flex: 1; }
.flash-fermer {
  background: none;
  border: 0;
  color: currentColor;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0 4px;
  opacity: .6;
}
.flash-fermer:hover { opacity: 1; }

/* ============================================================
   INDICATEURS (dl.indicateurs)
   ============================================================ */
.indicateurs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  background: var(--surface);
  border: 1px solid var(--ligne);
  border-radius: 10px;
  margin: 0 0 22px;
  padding: 0;
}
.indicateurs > div { padding: 14px 18px; }
.indicateurs > div + div { border-left: 1px solid var(--ligne); }
.indicateurs dt { font-size: .82rem; color: var(--doux); margin: 0; }
.indicateurs dd {
  margin: 4px 0 0;
  font-size: 1.3rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
}

/* ============================================================
   PANNEAUX
   ============================================================ */
.panneau {
  background: var(--surface);
  border: 1px solid var(--ligne);
  border-radius: 10px;
  margin-bottom: 20px;
  min-width: 0;
}
.panneau > h2,
.panneau > .tete {
  font-size: 1rem;
  font-weight: 600;
  padding: 14px 18px;
  border-bottom: 1px solid var(--ligne);
  margin: 0;
}
.panneau > .tete {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.panneau > .tete h2 { font-size: 1rem; font-weight: 600; margin: 0; }
.panneau .vide { padding: 22px 18px; color: var(--doux); margin: 0; }
.panneau .pied {
  padding: 12px 18px;
  color: var(--doux);
  font-size: .85rem;
  border-top: 1px solid var(--ligne);
  margin: 0;
}

/* Deux colonnes */
.deux-col {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

/* ============================================================
   TABLEAUX
   ============================================================ */
.tableau-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .89rem;
}
th {
  text-align: left;
  font-weight: 600;
  color: var(--doux);
  font-size: .8rem;
  padding: 10px 14px;
  border-bottom: 1px solid var(--ligne);
  white-space: nowrap;
  background: var(--surface-2);
}
td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--ligne);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: 0; }
tr.cliquable { cursor: pointer; }
tr.cliquable:hover td { background: var(--surface-2); }
td.r, th.r { text-align: right; }
td.nowrap { white-space: nowrap; }

/* Matrice de compétences */
.matrice td, .matrice th { text-align: center; }
.matrice td:first-child, .matrice th:first-child {
  text-align: left;
  white-space: nowrap;
}
.legende {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: .8rem;
  color: var(--doux);
  padding: 12px 18px;
  border-top: 1px solid var(--ligne);
}

/* ============================================================
   FORMULAIRES
   ============================================================ */
input, select, textarea {
  padding: 8px 10px;
  border: 1px solid var(--ligne);
  border-radius: 6px;
  background: var(--surface);
  width: 100%;
  min-width: 0;
  font: inherit;
  color: inherit;
  transition: var(--transition);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(27, 94, 32, 0.12);
}
textarea { resize: vertical; min-height: 76px; }

.champ {
  display: grid;
  gap: 5px;
  align-content: start;
}
.champ > label,
.champ > .lbl {
  font-size: .84rem;
  font-weight: 600;
}
.aide {
  font-size: .8rem;
  color: var(--doux);
  margin: 0;
}

.grille2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grille3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

.case {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: .9rem;
}
.case input[type="checkbox"],
.case input[type="radio"] { width: auto; margin-top: 4px; }

.erreur {
  margin: 0;
  padding: 9px 12px;
  border-radius: 6px;
  background: var(--alerte-fond);
  color: var(--alerte);
  font-weight: 600;
  font-size: .88rem;
}
.erreur:empty { display: none; }

.encadre {
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--surface-2);
  font-size: .9rem;
}
.encadre[data-t="attente"] { background: var(--attente-fond); }
.encadre[data-t="alerte"]  { background: var(--alerte-fond); }
.encadre p { margin: 0; }
.encadre p + p { margin-top: 6px; }

.liste-cases {
  display: grid;
  gap: 6px;
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--ligne);
  border-radius: 6px;
  padding: 10px 12px;
}

.recap {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 16px;
  font-size: .92rem;
  padding: 12px 14px;
  background: var(--surface-2);
  border-radius: 8px;
}
.recap .total { font-weight: 700; font-size: 1.02rem; }
.recap span:nth-child(even) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Outils au-dessus des tableaux */
.outils {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 14px;
}
.outils input[type="search"] { flex: 1 1 240px; max-width: 360px; }
.outils select, .outils input { width: auto; }

/* Segment */
.segment {
  display: inline-flex;
  border: 1px solid var(--ligne);
  border-radius: 6px;
  overflow: hidden;
}
.segment button,
.segment a {
  border: 0;
  background: var(--surface);
  padding: 7px 13px;
  font-weight: 600;
  font-size: .85rem;
  cursor: pointer;
  color: var(--doux);
  text-decoration: none;
}
.segment button[aria-pressed="true"],
.segment a[aria-pressed="true"] {
  background: var(--primary-color);
  color: #fff;
}
.segment > * + * { border-left: 1px solid var(--ligne); }

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  padding: 14px 18px;
  border-top: 1px solid var(--ligne);
}
.pagination-lien {
  padding: 5px 10px;
  border-radius: 6px;
  font-weight: 600;
  font-size: .85rem;
  color: var(--info-color);
  text-decoration: none;
}
.pagination-lien:hover { background: var(--surface-2); text-decoration: none; }
.pagination-lien--off { color: var(--doux); pointer-events: none; }
.pagination-nums {
  display: flex;
  gap: 2px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.pagination-num {
  display: inline-block;
  min-width: 30px;
  text-align: center;
  padding: 5px 8px;
  border-radius: 6px;
  font-size: .85rem;
  color: var(--texte);
  text-decoration: none;
}
.pagination-num:hover { background: var(--surface-2); text-decoration: none; }
.pagination-num.is-actif {
  background: var(--primary-color);
  color: #fff;
  font-weight: 700;
}
.pagination-ellipse { padding: 5px 6px; color: var(--doux); }
.pagination-resume { color: var(--doux); font-size: .82rem; }

/* ============================================================
   MODALE
   ============================================================ */
.voile {
  position: fixed;
  inset: 0;
  background: rgba(8, 18, 24, 0.55);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: calc(28px + env(safe-area-inset-top)) 14px
           calc(28px + env(safe-area-inset-bottom));
  overflow-y: auto;
  z-index: 50;
}
.voile[hidden] { display: none; }

.fenetre {
  background: var(--surface);
  border: 1px solid var(--ligne);
  border-radius: 12px;
  width: 100%;
  max-width: 720px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}
.fenetre.large { max-width: 980px; }
.fenetre > header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--ligne);
}
.fenetre > header h2 {
  font-size: 1.15rem;
  font-weight: 700;
}
.fenetre > header p {
  margin: 4px 0 0;
  color: var(--doux);
  font-size: .88rem;
}
.fermer {
  background: none;
  border: 0;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--doux);
  padding: 2px 6px;
  border-radius: 6px;
}
.fermer:hover { color: var(--texte); background: var(--surface-2); }

.corps {
  padding: 20px 22px;
  display: grid;
  gap: 16px;
}
.actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
  padding: 14px 22px;
  border-top: 1px solid var(--ligne);
  background: var(--surface-2);
  border-radius: 0 0 12px 12px;
}
.actions .gauche { margin-right: auto; }

/* ============================================================
   TOAST
   ============================================================ */
#toast {
  position: fixed;
  left: 50%;
  bottom: calc(22px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--texte);
  color: var(--surface);
  padding: 11px 18px;
  border-radius: 8px;
  font-weight: 600;
  font-size: .9rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  z-index: 80;
  max-width: calc(100vw - 32px);
}
#toast[hidden] { display: none; }
#toast[data-t="alerte"] { background: var(--danger-color); color: #fff; }
#toast[data-t="ok"]     { background: var(--primary-color); color: #fff; }

/* ============================================================
   CALENDRIER
   ============================================================ */
.cal-tete {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.cal-tete h2 { font-size: 1.1rem; text-transform: capitalize; }

.cal-wrap { overflow-x: auto; }
.cal {
  display: grid;
  grid-template-columns: repeat(7, minmax(96px, 1fr));
  border: 1px solid var(--ligne);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface);
  min-width: 700px;
}
.cal .js {
  font-size: .78rem;
  font-weight: 600;
  color: var(--doux);
  padding: 8px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--ligne);
}
.cal .jour {
  min-height: 100px;
  padding: 6px;
  border-right: 1px solid var(--ligne);
  border-bottom: 1px solid var(--ligne);
  font-size: .8rem;
  min-width: 0;
}
.cal .jour:nth-child(7n) { border-right: 0; }
.cal .hors {
  background: var(--surface-2);
  color: var(--doux);
}
.cal .nj {
  display: inline-block;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding: 0 5px;
  border-radius: 999px;
}
.cal .auj .nj {
  background: var(--primary-color);
  color: #fff;
}
.puce-cal {
  display: block;
  width: 100%;
  text-align: left;
  font-size: .74rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  border: 0;
  margin-top: 3px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: var(--neutre-fond);
  color: var(--neutre);
  border-left: 3px solid var(--c, var(--info-color));
  text-decoration: none;
}
.puce-cal:hover { filter: brightness(0.96); text-decoration: none; }

/* ============================================================
   CERTIFICAT (document imprimable)
   ============================================================ */
.certificat {
  background: #fffdf7;
  color: #1f1b12;
  border: 2px solid #9a6a12;
  padding: 6px;
  font-family: Georgia, "Times New Roman", serif;
}
.certificat .cadre {
  border: 1px solid #c9a25a;
  padding: 30px 28px 24px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.certificat .org {
  font-family: "Public Sans", system-ui, sans-serif;
  font-weight: 600;
  font-size: .85rem;
  color: #6b5a36;
  margin: 0;
}
.certificat h3 {
  font-size: 2.3rem;
  font-weight: 400;
  margin: 10px 0 14px;
  color: var(--primary-dark);
  letter-spacing: .02em;
}
.certificat p { margin: 6px 0; }
.certificat .nom { font-size: 1.45rem; font-weight: 700; margin: 10px 0 2px; }
.certificat .adr { font-size: .88rem; color: #5d5546; }
.certificat .norme {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin-top: 10px;
}
.certificat .perim {
  font-style: italic;
  max-width: 52ch;
  margin: 4px auto 0;
}
.certificat .bas {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 14px;
  align-items: center;
  margin-top: 24px;
  font-family: "Public Sans", system-ui, sans-serif;
  font-size: .8rem;
  color: #4a4434;
}
.certificat .bas > div:first-child { text-align: left; }
.certificat .bas > div:last-child  { text-align: right; }
.certificat .bas svg { color: #9a6a12; }

.filigrane {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 4rem;
  font-weight: 700;
  color: rgba(166, 61, 38, 0.18);
  transform: rotate(-18deg);
  pointer-events: none;
  font-family: "Public Sans", system-ui, sans-serif;
}

/* ============================================================
   FACTURE (document imprimable)
   ============================================================ */
.facture-doc {
  background: #fff;
  color: #1a241c;
  border: 1px solid #d6ded6;
  border-radius: 8px;
  padding: 24px;
}
.facture-doc table th { background: #eef2ee; color: #5b6b60; }
.facture-doc td, .facture-doc th { border-color: #d6ded6; }
.facture-doc .fd-tete {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.facture-doc h3 { font-size: 1.3rem; }

/* ============================================================
   ALERTES (tableau de bord)
   ============================================================ */
.alertes {
  list-style: none;
  margin: 0;
  padding: 0;
}
.alertes li {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 11px 18px 11px 16px;
  border-bottom: 1px solid var(--ligne);
  border-left: 3px solid var(--c, var(--info-color));
}
.alertes li:last-child { border-bottom: 0; }
.alertes p { margin: 0; font-size: .9rem; }

/* ============================================================
   PROCHAINS AUDITS
   ============================================================ */
.prochains { list-style: none; margin: 0; padding: 0; }
.prochains li {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--ligne);
  align-items: center;
}
.prochains li:last-child { border-bottom: 0; }
.date-bloc {
  text-align: center;
  border: 1px solid var(--ligne);
  border-radius: 6px;
  padding: 4px 0;
  line-height: 1.1;
}
.date-bloc b { display: block; font-size: 1.25rem; }
.date-bloc span { font-size: .72rem; color: var(--doux); }
.prochains p { margin: 0; font-size: .9rem; }
.prochains small { color: var(--doux); }

/* ============================================================
   ONGLETS
   ============================================================ */
.onglets {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--ligne);
  margin-bottom: 18px;
  overflow-x: auto;
}
.onglets button,
.onglets a {
  background: none;
  border: 0;
  padding: 10px 14px;
  font-weight: 600;
  color: var(--doux);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  text-decoration: none;
}
.onglets button[aria-selected="true"],
.onglets a[aria-selected="true"] {
  color: var(--texte);
  border-bottom-color: var(--primary-color);
}

/* ============================================================
   ÉQUIPE, HISTORIQUE
   ============================================================ */
.equipe { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.equipe li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid var(--ligne);
  border-radius: 8px;
  flex-wrap: wrap;
}
.equipe small { color: var(--doux); display: block; }

.histo { list-style: none; margin: 0; padding: 0; font-size: .85rem; display: grid; gap: 6px; }
.histo time { color: var(--doux); margin-right: 8px; font-variant-numeric: tabular-nums; }

details summary { cursor: pointer; font-weight: 600; font-size: .9rem; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1080px) {
  .deux-col { grid-template-columns: 1fr; }
  .indicateurs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .indicateurs > div:nth-child(3) { border-left: 0; }
  .indicateurs > div:nth-child(n+3) { border-top: 1px solid var(--ligne); }
}
@media (max-width: 860px) {
  .chaine { display: flex; overflow-x: auto; }
  .chaine li { flex: 0 0 160px; }
  .grille2, .grille3 { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .indicateurs { grid-template-columns: 1fr; }
  .indicateurs > div + div { border-left: 0; border-top: 1px solid var(--ligne); }
}

@media (prefers-reduced-motion: no-preference) {
  .fenetre { animation: entree .16s ease-out; }
  @keyframes entree {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: none; }
  }
}
/* ============================================================
   Non-conformités — liste
   ============================================================ */

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.page-header h1 {
  margin: 0;
  color: var(--primary-dark);
  font-size: 1.6rem;
}
.page-sous-titre {
  margin: 4px 0 0;
  color: var(--doux);
  font-size: 0.9rem;
}
.page-actions { display: flex; gap: 8px; }

/* ---- Filtres chips ---- */
.filtres {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}
.filtre-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border: 1px solid var(--ligne);
  border-radius: 999px;
  background: var(--surface);
  color: var(--texte);
  font-size: 0.875rem;
  text-decoration: none;
  transition: var(--transition);
}
.filtre-chip:hover {
  border-color: var(--primary-light);
  background: var(--surface-2);
}
.filtre-chip--actif {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: var(--btn-txt);
}
.filtre-count {
  display: inline-block;
  min-width: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.12);
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
}
.filtre-chip--actif .filtre-count {
  background: rgba(255, 255, 255, 0.25);
  color: var(--btn-txt);
}

/* ---- Carte générique ---- */
.carte {
  background: var(--surface);
  border: 1px solid var(--ligne);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.carte--vide {
  padding: 40px 24px;
  text-align: center;
  color: var(--doux);
}

/* ---- Tableau ---- */
.tableau {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.tableau thead {
  background: var(--surface-2);
}
.tableau th {
  text-align: left;
  padding: 12px 14px;
  font-weight: 600;
  color: var(--secondary-color);
  border-bottom: 1px solid var(--ligne);
  white-space: nowrap;
}
.tableau td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--ligne);
  vertical-align: top;
}
.tableau tbody tr:last-child td { border-bottom: none; }
.tableau tbody tr:hover { background: var(--surface-2); }
.tableau .meta {
  color: var(--doux);
  font-size: 0.8rem;
  margin-top: 2px;
}
.tableau code {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.85rem;
  padding: 2px 6px;
  background: var(--surface-2);
  border-radius: 4px;
}
.tableau .col-actions { width: 1%; white-space: nowrap; }
.tableau .ligne--alerte { background: var(--alerte-fond); }
.tableau .ligne--alerte:hover { background: #f4d7cf; }

/* ---- Badges (si pas déjà définis) ---- */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}
.badge--ok       { background: var(--ok-fond);      color: var(--ok); }
.badge--alerte   { background: var(--alerte-fond);  color: var(--alerte); }
.badge--attente  { background: var(--attente-fond); color: var(--attente); }
.badge--info     { background: var(--info-fond);    color: var(--info); }
.badge--neutre   { background: var(--neutre-fond);  color: var(--neutre); }
.badge--sceau    { background: var(--sceau-fond);   color: var(--sceau); }

/* ---- Boutons (si pas déjà définis) ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--border-radius);
  border: 1px solid transparent;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
}
.btn--primaire {
  background: var(--primary-color);
  color: var(--btn-txt);
}
.btn--primaire:hover { background: var(--primary-dark); }

.btn--contour {
  background: transparent;
  border-color: var(--primary-color);
  color: var(--primary-color);
}
.btn--contour:hover {
  background: var(--primary-color);
  color: var(--btn-txt);
}
.btn--petit { padding: 5px 10px; font-size: 0.8rem; }
/* Formulaire NC */
.formulaire {
  background: var(--surface);
  border: 1px solid var(--ligne);
  border-radius: var(--border-radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.form-grille {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}
.form-champ { display: flex; flex-direction: column; margin-bottom: 16px; }
.form-champ label {
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 6px;
  color: var(--secondary-color);
}
.form-champ .req { color: var(--alerte); }
.form-champ input,
.form-champ select,
.form-champ textarea {
  padding: 9px 12px;
  border: 1px solid var(--ligne);
  border-radius: var(--border-radius);
  font-family: inherit;
  font-size: 0.9rem;
  background: var(--surface);
  color: var(--texte);
  transition: var(--transition);
}
.form-champ input:focus,
.form-champ select:focus,
.form-champ textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(27, 94, 32, 0.15);
}
.form-champ .aide {
  margin-top: 4px;
  font-size: 0.78rem;
  color: var(--doux);
}
.form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding-top: 16px;
  border-top: 1px solid var(--ligne);
}

/* Encart info audit */
.carte--info-audit {
  background: var(--surface-2);
  border: 1px solid var(--ligne);
  border-radius: var(--border-radius);
  padding: 16px 20px;
  margin-bottom: 20px;
}
.info-audit {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}
.info-audit .meta {
  display: block;
  font-size: 0.75rem;
  color: var(--doux);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}
/* Layout NC détail */
.nc-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
}
@media (max-width: 900px) {
  .nc-layout { grid-template-columns: 1fr; }
}

/* Cartes */
.carte-entete {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 16px 20px;
  border-bottom: 1px solid var(--ligne);
  background: var(--surface-2);
}
.carte-entete h2 { margin: 0; font-size: 1rem; color: var(--primary-dark); }
.carte-entete h3 { margin: 0; }
.carte-corps { padding: 20px; }
.carte-corps h3 {
  margin-top: 20px;
  margin-bottom: 8px;
  font-size: 0.95rem;
  color: var(--secondary-color);
}
.carte-corps h3:first-child { margin-top: 0; }

/* Liste de définitions inline */
.dl-inline {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  margin: 0 0 16px;
}
.dl-inline > div { display: flex; flex-direction: column; }
.dl-inline dt {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--doux);
}
.dl-inline dd { margin: 2px 0 0; font-weight: 500; }

/* Bloc texte */
.bloc-texte {
  white-space: pre-wrap;
  line-height: 1.6;
  color: var(--texte);
}
.bloc-texte--doux {
  background: var(--surface-2);
  padding: 12px 14px;
  border-left: 3px solid var(--primary-light);
  border-radius: 4px;
  font-style: italic;
  color: var(--doux);
}

/* Liste fichiers */
.liste-fichiers {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
}
.liste-fichiers li {
  padding: 6px 10px;
  border-radius: 4px;
  background: var(--surface-2);
  margin-bottom: 4px;
}
.liste-fichiers a { color: var(--primary-color); text-decoration: none; }
.liste-fichiers a:hover { text-decoration: underline; }

/* Encarts */
.encart {
  padding: 12px 16px;
  border-radius: var(--border-radius);
  margin-bottom: 16px;
  border-left: 4px solid;
}
.encart--alerte { background: var(--alerte-fond); border-color: var(--alerte); }
.encart--attente { background: var(--attente-fond); border-color: var(--attente); }
.encart--compact { margin-top: 12px; margin-bottom: 0; }

/* Timeline */
.timeline {
  list-style: none;
  padding: 0;
  margin: 0;
  position: relative;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 120px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--ligne);
}
.timeline li {
  display: flex;
  gap: 16px;
  padding: 10px 0;
  position: relative;
}
.timeline li::before {
  content: "";
  position: absolute;
  left: 114px;
  top: 15px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--primary-color);
  border: 2px solid var(--surface);
  z-index: 1;
}
.timeline-date {
  width: 100px;
  font-size: 0.8rem;
  color: var(--doux);
  flex-shrink: 0;
  text-align: right;
}
.timeline-content {
  padding-left: 20px;
  flex: 1;
}

/* Colonne latérale actions */
.carte--action h3 {
  margin: 0 0 8px;
  font-size: 0.95rem;
  color: var(--primary-dark);
}
.carte--action {
  padding: 20px;
  margin-bottom: 16px;
}
.form-stack { display: flex; flex-direction: column; gap: 10px; }
.form-stack label { font-weight: 600; font-size: 0.85rem; color: var(--secondary-color); }
.form-stack textarea,
.form-stack input[type="text"] {
  padding: 8px 10px;
  border: 1px solid var(--ligne);
  border-radius: var(--border-radius);
  font-family: inherit;
  font-size: 0.88rem;
}
.check {
  display: flex;
  gap: 8px;
  align-items: center;
  font-weight: 400 !important;
  cursor: pointer;
}
.sep { border: none; border-top: 1px solid var(--ligne); margin: 16px 0; }
.btn--bloc { width: 100%; justify-content: center; }
.btn--danger {
  background: var(--danger-color);
  color: #fff;
}
.btn--danger:hover { background: #c0392b; }

/* Récap */
.dl-recap { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; margin: 0; }
.dl-recap dt { color: var(--doux); font-size: 0.85rem; }
.dl-recap dd { margin: 0; font-weight: 500; text-align: right; }
/* ============================================================
   CRM — Organisations & sites
   ============================================================ */

.barre-recherche {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}
.barre-recherche input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--ligne);
  border-radius: var(--border-radius);
  font-size: 0.9rem;
  background: var(--surface);
}

.crm-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
}
@media (max-width: 900px) {
  .crm-layout { grid-template-columns: 1fr; }
}

.codes-grille {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}
.code-chip {
  display: inline-block;
  padding: 3px 8px;
  margin: 2px 4px 2px 0;
  border-radius: 4px;
  background: var(--surface-2);
  font-size: 0.78rem;
  color: var(--secondary-color);
  border: 1px solid var(--ligne);
}

.liste-contacts,
.liste-certificats {
  list-style: none;
  padding: 0;
  margin: 0;
}
.liste-contacts li,
.liste-certificats li {
  padding: 12px 0;
  border-bottom: 1px solid var(--ligne);
}
.liste-contacts li:last-child,
.liste-certificats li:last-child {
  border-bottom: none;
}

.ligne--inactive { opacity: 0.55; }
.nav-section {
  margin-top: 14px;
  padding: 6px 10px 2px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--texte-doux, #888);
  border-top: 1px solid var(--bordure, #e5e5e5);
}