/* ==========================================================================
   Auditor Pro : composants reutilisables (Phase 2)
   --------------------------------------------------------------------------
   Petit jeu de composants construits uniquement sur les tokens (tokens.css).
   A consommer ecran par ecran a la place des styles inline et des hex en dur.

   Convention de nommage : bloc__element, bloc--variante.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Tuile de metrique (.metric-tile)
   Surface blanche, bordure fine, un chiffre, un libelle. Le statut passe par
   une pastille semantique discrete, jamais par la couleur de fond de la tuile.
   -------------------------------------------------------------------------- */
.metric-tile {
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-4) var(--space-3);
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.metric-tile__value {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--fs-2xl);
    font-weight: var(--fw-semibold);
    line-height: 1.1;
    color: var(--text-primary);
}

.metric-tile__value--muted {
    color: var(--text-muted);
}

.metric-tile__label {
    font-size: var(--fs-xs);
    color: var(--text-secondary);
}

/* Pastille de statut semantique, posee devant la valeur */
.metric-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.metric-dot--success { background: var(--success); }
.metric-dot--warning { background: var(--warning); }
.metric-dot--danger  { background: var(--danger); }
.metric-dot--neutral { background: var(--text-muted); }

/* --------------------------------------------------------------------------
   Tuile de score (.metric-tile--score)
   La valeur porte le niveau (bon / moyen / faible). L'etat est pose par le JS
   via une classe is-*, a partir du champ serveur cssClass.
   -------------------------------------------------------------------------- */
.metric-tile--score.is-good    .metric-tile__value { color: var(--success); }
.metric-tile--score.is-warning .metric-tile__value { color: var(--warning); }
.metric-tile--score.is-danger  .metric-tile__value { color: var(--danger); }
.metric-tile--score.is-neutral .metric-tile__value { color: var(--text-muted); }

.metric-tile--score.is-good    .metric-tile__label { color: var(--success-text); }
.metric-tile--score.is-warning .metric-tile__label { color: var(--warning-text); }
.metric-tile--score.is-danger  .metric-tile__label { color: var(--danger-text); }

/* ═══════════════════════════════════════════════════════════════════
   DLIST — liste maitre-detail (chantier interfaces/densite)
   Squelette commun aux listes denses de PCP, Remediation, EBIOS, Audit et
   Gestionnaire de preuves. Ecrit cinq fois a l'identique, il avait derive
   de 1 a 3 px d'un module a l'autre ; il est desormais defini une fois.

   Structure :
     .dlist > .dlist-row > [check] [rail metier] .dlist-main [colonnes] .dlist-act
     .dlist-main > .dlist-head (.dlist-code + .dlist-title) [.dlist-desc] .dlist-meta

   Ce qui reste au module : le rail de gauche (statut, severite, niveau,
   type), les colonnes propres au metier, et les pastilles d'etat.
   ═══════════════════════════════════════════════════════════════════ */
.dlist { display: flex; flex-direction: column; }

.dlist-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 8px;
    border-bottom: 1px solid #eef2f6;
}
.dlist-row:last-child { border-bottom: none; }
.dlist-row:hover { background: #f8fafc; }

.dlist-check { margin-top: 4px; flex: 0 0 auto; cursor: pointer; }

.dlist-main { flex: 1 1 auto; min-width: 0; }
.dlist-head { line-height: 1.4; margin-bottom: 3px; }

/* Identifiant : prefixe monospace discret, a position constante */
.dlist-code {
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 0.72rem; font-weight: 600; color: #94a3b8;
    margin-right: 9px; white-space: nowrap;
}
/* Intitule : jamais tronque, c'est tout l'objet du chantier */
.dlist-title { font-size: 0.845rem; font-weight: 500; color: #0f172a; line-height: 1.4; }
/* Ligne secondaire : description, recommandation, reference, commentaire */
.dlist-desc { font-size: 0.76rem; color: #64748b; line-height: 1.4; margin-top: 2px; }
/* Metadonnees : texte fin separe par des points medians, sans icones */
.dlist-meta { font-size: 0.75rem; color: #94a3b8; margin-top: 3px; }
.dlist-meta > span:not(:last-child)::after { content: "·"; margin: 0 8px; color: #d0d7e2; }

/* Echeance : colonne alignee a droite (scan vertical des dates) */
.dlist-due { flex: 0 0 auto; width: 92px; text-align: right; font-size: 0.75rem; color: #64748b; margin-top: 1px; white-space: nowrap; }
.dlist-due.is-overdue { color: var(--danger, #dc2626); font-weight: 600; }
.dlist-due--none { color: #cbd5e1; font-style: italic; }

.dlist-act { flex: 0 0 auto; display: flex; align-items: center; gap: 4px; }

/* Actions secondaires : bouton "..." et son menu */
.dlist-menu-wrap { display: inline-flex; }
.dlist-more {
    width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center;
    border-radius: 7px; color: #94a3b8; background: transparent; border: 1px solid transparent; cursor: pointer;
}
.dlist-more:hover { background: #f1f5f9; color: #475569; }

/* Menu ancre en position:fixed via JS (append au body) : jamais rogne par
   l'overflow d'un modal ou d'un conteneur scrollable. */
.dlist-menu {
    position: fixed; z-index: 3000; min-width: 190px;
    background: #fff; border: 1px solid #e2e8f0; border-radius: 10px;
    box-shadow: 0 8px 24px rgba(15,23,42,.12); padding: 5px; display: flex; flex-direction: column;
}
.dlist-menu button {
    display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
    font-size: 0.82rem; color: #0f172a; background: transparent; border: none;
    padding: 8px 10px; border-radius: 6px; cursor: pointer;
}
.dlist-menu button:hover { background: #f1f5f9; }
.dlist-menu button.danger { color: #dc2626; }
.dlist-menu button.danger:hover { background: #fef2f2; }
.dlist-menu button i { width: 15px; height: 15px; color: #64748b; flex: 0 0 auto; }
.dlist-menu button.danger i { color: #dc2626; }

/* Barre de selection groupee */
.dlist-toolbar { padding: 6px 6px 10px; border-bottom: 1px solid #eef2f6; }
.dlist-selectall {
    display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
    font-size: 0.78rem; color: #64748b; user-select: none;
}

/* Variantes : colonne d'actions a largeur fixe (aligne les actions d'une
   ligne a l'autre) et ligne secondaire bornee a 2 lignes (texte complet en
   infobulle) — utilisees respectivement par PCP et par le registre d'audit. */
.dlist-act--fixed { width: 176px; justify-content: flex-end; }
.dlist-desc--clamp {
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
