/* ═══════════════════════════════════════════════════════════════════════════════════════════════
   CONTRÔLE CROISÉ CONTRATS × COMMISSIONS (js/81, 20.09.2026)

   Un écran de contrôle doit hiérarchiser par la gravité, pas par la chronologie. Les tuiles
   d'anomalie gardent donc un fond coloré même quand elles sont à zéro : leur absence de couleur
   est l'information — on voit d'un coup d'œil s'il reste quelque chose à traiter.
   ═══════════════════════════════════════════════════════════════════════════════════════════════ */

.ccx-section { margin-top: 18px; }

/* ── La jauge de couverture ────────────────────────────────────────────────────────────────────── */
.ccx-jauge {
  font-size: var(--t-2xl); font-weight: var(--t-moyen, 600); letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums lining-nums;
}
.ccx-jauge.ok { color: var(--c-succes, #16A34A); }
.ccx-jauge.moyen { color: var(--c-alerte, #F59E0B); }
.ccx-jauge.faible { color: var(--c-danger, #EF4444); }

/* ── Les tuiles d'état ─────────────────────────────────────────────────────────────────────────── */
.ccx-tuiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: var(--e-2, 8px); }
.ccx-tuile {
  display: flex; flex-direction: column; gap: 1px; text-align: left; cursor: pointer;
  padding: 11px 13px; border-radius: var(--r-s, 10px); font-family: inherit;
  border: 1px solid var(--border); background: var(--surface-alt);
  transition: border-color var(--v-court, .15s), transform var(--v-court, .15s);
}
.ccx-tuile:hover { transform: translateY(-1px); border-color: var(--accent-border); }
.ccx-tuile.actif { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.ccx-tuile-n { font-size: 22px; font-weight: var(--t-moyen, 600); letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums lining-nums; color: var(--text); }
.ccx-tuile-nom { font-size: var(--t-s, 12.5px); font-weight: 500; color: var(--text); line-height: 1.3; }
.ccx-tuile small { font-size: var(--t-xs, 11px); color: var(--text-muted); font-variant-numeric: tabular-nums; }

.ccx-tuile.ton-ok .ccx-tuile-n { color: var(--c-succes, #16A34A); }
.ccx-tuile.ton-attente .ccx-tuile-n { color: var(--c-info, #0EA5E9); }
.ccx-tuile.ton-alerte { background: var(--c-danger-fond); border-color: color-mix(in srgb, var(--c-danger, #EF4444) 34%, transparent); }
.ccx-tuile.ton-alerte .ccx-tuile-n { color: var(--c-danger-texte, #B91C1C); }
/* Une tuile d'anomalie à zéro n'est plus une alerte : elle se calme sans disparaître, parce que
   la voir à zéro est justement l'information rassurante. */
.ccx-tuile.ton-alerte.vide { background: var(--surface-alt); border-color: var(--border); }
.ccx-tuile.ton-alerte.vide .ccx-tuile-n { color: var(--c-succes, #16A34A); }
.ccx-tuile.ton-alerte.vide .ccx-tuile-nom, .ccx-tuile.ton-alerte.vide small { color: var(--text-muted); }
.ccx-note { margin: 12px 0 0; font-size: var(--t-s, 12.5px); color: var(--text-muted); line-height: 1.55; text-wrap: pretty; }
.ccx-note-ok { color: var(--c-succes, #16A34A); }

/* ── Les filtres ───────────────────────────────────────────────────────────────────────────────── */
.ccx-filtres { display: flex; gap: var(--e-2, 8px); flex-wrap: wrap; align-items: center; }
.ccx-filtres .form-input { max-width: 230px; }
.ccx-filtres .form-select { max-width: 210px; }

/* ── Le tableau ────────────────────────────────────────────────────────────────────────────────── */
.ccx-table-enveloppe { overflow-x: auto; margin-top: var(--e-3, 12px); }
.ccx-table { width: 100%; border-collapse: collapse; font-size: var(--t-m, 13.5px); }
.ccx-table th {
  text-align: left; padding: 8px 10px; font-size: var(--t-xs); text-transform: uppercase;
  letter-spacing: .07em; color: var(--text-muted); font-weight: 600;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.ccx-table td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.ccx-table tr:last-child td { border-bottom: none; }
.ccx-table tbody tr:hover { background: var(--surface-hover); }
.ccx-table td b { display: block; font-weight: 500; color: var(--text); }
.ccx-table td small { display: block; margin-top: 1px; font-size: var(--t-xs, 11px); color: var(--text-muted); }
.ccx-table .d { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums lining-nums; }
.ccx-vide { color: var(--text-dim); }

/* Une rangée en anomalie porte un liseré à gauche : la couleur seule ne suffit pas à la repérer
   dans un long tableau, la position, si. */
.ccx-table tr.ton-alerte td:first-child { box-shadow: inset 3px 0 0 var(--c-danger, #EF4444); }

.ccx-pastille {
  display: inline-block; padding: 3px 8px; border-radius: var(--r-rond, 999px);
  font-size: var(--t-xs, 11px); font-weight: 500; white-space: nowrap;
  background: var(--surface-alt); color: var(--text-muted); border: 1px solid var(--border);
}
.ccx-pastille.ton-ok { background: var(--c-succes-fond); color: var(--c-succes-texte, #15803D);
  border-color: color-mix(in srgb, var(--c-succes, #16A34A) 30%, transparent); }
.ccx-pastille.ton-attente { background: var(--c-info-fond); color: var(--c-info-texte, #0369A1);
  border-color: color-mix(in srgb, var(--c-info, #0EA5E9) 30%, transparent); }
.ccx-pastille.ton-alerte { background: var(--c-danger-fond); color: var(--c-danger-texte, #B91C1C);
  border-color: color-mix(in srgb, var(--c-danger, #EF4444) 34%, transparent); }

/* ── Les actions ───────────────────────────────────────────────────────────────────────────────── */
.ccx-actions { white-space: nowrap; }
.ccx-act {
  padding: 5px 10px; border-radius: var(--r-s, 10px); cursor: pointer; font-family: inherit;
  font-size: var(--t-xs, 11px); font-weight: 500;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-muted);
  transition: color var(--v-court, .15s), border-color var(--v-court, .15s);
}
.ccx-act:hover { color: var(--text); border-color: var(--accent-border); }
.ccx-act-vert { color: var(--c-succes-texte, #15803D); border-color: color-mix(in srgb, var(--c-succes, #16A34A) 34%, transparent); }
.ccx-act-vert:hover { color: var(--c-succes, #16A34A); border-color: var(--c-succes, #16A34A); }

@media (max-width: 700px) {
  .ccx-table th:nth-child(3), .ccx-table td:nth-child(3) { display: none; }
  .ccx-filtres .form-input, .ccx-filtres .form-select { max-width: none; flex: 1 1 140px; }
}
