/* ============================================================================
   Beaver — l'espace de travail de la campagne (T-UX-2)
   Portée : `body.ui-v2 .v2-cw-*`. Consomme les jetons de `tokens.css` et les
   composants normalisés de `shell.css` (boutons, badges, cartes). Les états
   sont des MOTS ; la couleur ne fait que les qualifier.
   ============================================================================ */

/* ─── En-tête de contexte ──────────────────────────────────────────────────*/
body.ui-v2 .v2-cw-context {
  display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4);
  align-items: center; margin-top: var(--space-2);
  font-size: var(--text-sm); color: var(--text-muted);
}
body.ui-v2 .v2-cw-context dt { display: inline; font-weight: 700; color: var(--text-secondary); }
body.ui-v2 .v2-cw-context dd { display: inline; margin: 0 var(--space-2) 0 var(--space-1); }
body.ui-v2 .v2-cw-context .is-absent { color: var(--text-faint); font-style: italic; }

/* L'état : un mot, en pastille. La teinte qualifie, le mot porte le sens. */
body.ui-v2 .v2-cw-state {
  display: inline-flex; align-items: center; gap: var(--space-2);
  border-radius: var(--radius-pill); padding: 4px 12px;
  font-size: var(--text-xs); font-weight: 700; letter-spacing: var(--tracking-wide);
  text-transform: uppercase; border: 1px solid var(--border-default);
  background: var(--bg-surface); color: var(--text-secondary);
}
body.ui-v2 .v2-cw-state.is-PRETE   { border-color: var(--success); color: var(--success-text); background: var(--success-subtle); }
body.ui-v2 .v2-cw-state.is-BLOQUEE { border-color: var(--danger); color: var(--danger); background: var(--danger-subtle); }
body.ui-v2 .v2-cw-state.is-EN_COURS { border-color: var(--accent); color: var(--accent-text-on-tint); background: var(--accent-subtle); }
body.ui-v2 .v2-cw-state.is-TERMINEE { border-color: var(--border-strong); color: var(--text-muted); }

/* ─── La ligne du haut : indicateur + prochaine action ─────────────────────*/
body.ui-v2 .v2-cw-top {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--space-4); margin-top: var(--space-4);
}
body.ui-v2 .v2-cw-card {
  background: var(--bg-surface); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-card);
  padding: var(--space-4) var(--space-5);
}
body.ui-v2 .v2-cw-card-label {
  font-size: var(--text-2xs); letter-spacing: var(--tracking-wide); text-transform: uppercase;
  color: var(--accent-text); font-weight: 700; margin: 0 0 var(--space-2);
}
/* Le chiffre clé : Open Sans gras, violet des données. Indisponible : un mot,
   sa raison, jamais 0. */
body.ui-v2 .v2-cw-kpi {
  font-size: var(--text-data); font-weight: 700; line-height: 1.05;
  color: var(--data-violet); font-variant-numeric: tabular-nums; letter-spacing: var(--tracking-tight);
}
body.ui-v2 .v2-cw-kpi.is-unavailable { font-size: var(--text-lg); color: var(--text-muted); font-weight: 600; }
body.ui-v2 .v2-cw-kpi-note { margin: var(--space-1) 0 0; font-size: var(--text-xs); color: var(--text-muted); }
body.ui-v2 .v2-cw-next { display: flex; flex-direction: column; gap: var(--space-2); }
body.ui-v2 .v2-cw-next-title { margin: 0; font-size: var(--text-lg); font-weight: 700; color: var(--text-primary); }
body.ui-v2 .v2-cw-next-why { margin: 0; font-size: var(--text-sm); color: var(--text-muted); }
body.ui-v2 .v2-cw-next .v2-btn { align-self: flex-start; }

/* ─── Bandeau d'étapes ─────────────────────────────────────────────────────*/
body.ui-v2 .v2-cw-steps {
  display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: var(--space-2);
  list-style: none; margin: var(--space-4) 0 0; padding: 0;
}
body.ui-v2 .v2-cw-step {
  border: 1px solid var(--border-subtle); border-radius: var(--radius-sm);
  background: var(--bg-surface); padding: var(--space-2) var(--space-3);
  display: flex; flex-direction: column; gap: 2px; min-width: 0;
  border-top: 3px solid var(--border-default);
}
body.ui-v2 .v2-cw-step a { color: inherit; text-decoration: none; }
body.ui-v2 .v2-cw-step-name { font-size: var(--text-sm); font-weight: 700; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.ui-v2 .v2-cw-step-state { font-size: var(--text-2xs); letter-spacing: var(--tracking-wide); text-transform: uppercase; color: var(--text-muted); font-weight: 700; }
body.ui-v2 .v2-cw-step.is-COMPLETE { border-top-color: var(--success); }
body.ui-v2 .v2-cw-step.is-COMPLETE .v2-cw-step-state { color: var(--success-text); }
body.ui-v2 .v2-cw-step.is-EN_COURS { border-top-color: var(--accent); }
body.ui-v2 .v2-cw-step.is-EN_COURS .v2-cw-step-state { color: var(--accent-hover); }
body.ui-v2 .v2-cw-step.is-BLOQUEE { border-top-color: var(--danger); }
body.ui-v2 .v2-cw-step.is-BLOQUEE .v2-cw-step-state { color: var(--danger); }

/* ─── Préparation : un tableau, pas des cartes ─────────────────────────────*/
body.ui-v2 .v2-cw-grid {
  display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: var(--space-4); margin-top: var(--space-4);
}
body.ui-v2 .v2-cw-readiness { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
body.ui-v2 .v2-cw-readiness th {
  text-align: left; font-size: var(--text-2xs); letter-spacing: var(--tracking-wide);
  text-transform: uppercase; color: var(--text-muted); font-weight: 700;
  padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--border-default);
}
body.ui-v2 .v2-cw-readiness td { padding: var(--space-3); border-bottom: 1px solid var(--border-subtle); vertical-align: top; }
/* La colonne du libellé porte la raison et la source : elle a la place ; la
   colonne d'action ne déborde pas d'une note en une seule ligne. */
body.ui-v2 .v2-cw-readiness td:nth-child(2) { width: 48%; }
body.ui-v2 .v2-cw-readiness td:nth-child(1) { width: 32px; }
body.ui-v2 .v2-cw-row-next { white-space: normal; max-width: 30ch; }
body.ui-v2 .v2-cw-readiness tr:last-child td { border-bottom: none; }
body.ui-v2 .v2-cw-mark {
  display: inline-block; width: 18px; font-family: var(--font-mono); font-weight: 700; text-align: center;
}
body.ui-v2 .v2-cw-row.is-OK .v2-cw-mark { color: var(--success-text); }
body.ui-v2 .v2-cw-row.is-BLOQUEE .v2-cw-mark { color: var(--danger); }
body.ui-v2 .v2-cw-row.is-INCONNUE .v2-cw-mark { color: var(--text-faint); }
body.ui-v2 .v2-cw-row-label { font-weight: 700; color: var(--text-primary); }
body.ui-v2 .v2-cw-row-reason { display: block; color: var(--text-secondary); margin-top: 2px; }
body.ui-v2 .v2-cw-row-source { display: block; color: var(--text-faint); font-size: var(--text-xs); margin-top: 2px; }
body.ui-v2 .v2-cw-row-next .v2-btn { padding: 4px var(--space-3); font-size: var(--text-xs); }
body.ui-v2 .v2-cw-readiness-foot {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  padding: var(--space-3); border-top: 1px solid var(--border-default);
  font-size: var(--text-sm);
}
body.ui-v2 .v2-cw-readiness-verdict { font-weight: 700; letter-spacing: var(--tracking-wide); }
body.ui-v2 .v2-cw-readiness-verdict.is-ready { color: var(--success-text); }
body.ui-v2 .v2-cw-readiness-verdict.is-not-ready { color: var(--danger); }
body.ui-v2 .v2-cw-side { display: flex; flex-direction: column; gap: var(--space-4); }
body.ui-v2 .v2-cw-side .v2-cw-card p { margin: 0 0 var(--space-2); font-size: var(--text-sm); color: var(--text-secondary); }
body.ui-v2 .v2-cw-side .v2-cw-card p:last-child { margin-bottom: 0; }
body.ui-v2 .v2-cw-blockers { margin: 0; padding-left: var(--space-5); font-size: var(--text-sm); color: var(--text-secondary); }
body.ui-v2 .v2-cw-blockers li { margin-bottom: var(--space-1); }
body.ui-v2 .v2-cw-note { font-size: var(--text-xs); color: var(--text-faint); margin: var(--space-2) 0 0; }

/* ─── Liste ────────────────────────────────────────────────────────────────*/
body.ui-v2 .v2-cw-list .v2-cw-state { padding: 2px 8px; }

/* ─── Étroit ───────────────────────────────────────────────────────────────*/
@media (max-width: 1100px) {
  body.ui-v2 .v2-cw-steps { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  body.ui-v2 .v2-cw-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 700px) {
  body.ui-v2 .v2-cw-top { grid-template-columns: minmax(0, 1fr); }
  body.ui-v2 .v2-cw-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body.ui-v2 .v2-cw-readiness th:nth-child(3), body.ui-v2 .v2-cw-readiness td:nth-child(3) { display: none; }
  body.ui-v2 .v2-cw-row-next { white-space: normal; }
}

/* ─── T-UX-4 — le discours, dans la campagne ───────────────────────────────*/
body.ui-v2 .v2-cd-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 1fr); gap: var(--space-4); margin-top: var(--space-4); }
body.ui-v2 .v2-cd-main { display: flex; flex-direction: column; gap: var(--space-4); min-width: 0; }
body.ui-v2 .v2-cd-head { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-3); }
body.ui-v2 .v2-cd-version { font-family: var(--font-display); font-size: var(--text-lg); font-weight: 700; color: var(--brand-aubergine); }
body.ui-v2 .v2-cd-rate { font-size: var(--text-xs); color: var(--text-muted); }
body.ui-v2 .v2-cd-facet { margin-top: var(--space-4); }
body.ui-v2 .v2-cd-facet-title { font-size: var(--text-2xs); letter-spacing: var(--tracking-wide); text-transform: uppercase; color: var(--text-muted); font-weight: 700; margin: 0 0 var(--space-1); }
body.ui-v2 .v2-cd-text { margin: 0; white-space: pre-wrap; font-size: var(--text-md); color: var(--text-primary); max-width: 80ch; overflow-wrap: anywhere; }
body.ui-v2 .v2-cd-disclosure { border-left: 3px solid var(--brand-aubergine); padding-left: var(--space-3); }
body.ui-v2 .v2-cd-template { font-family: var(--font-mono); font-size: var(--text-xs); }
body.ui-v2 .v2-cd-absent { margin: 0; font-size: var(--text-sm); color: var(--text-muted); font-style: italic; }
body.ui-v2 .v2-cd-table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
body.ui-v2 .v2-cd-table th { text-align: left; font-size: var(--text-2xs); letter-spacing: var(--tracking-wide); text-transform: uppercase; color: var(--text-muted); font-weight: 700; padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--border-default); }
body.ui-v2 .v2-cd-table td { padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--border-subtle); vertical-align: top; }
body.ui-v2 .v2-cd-table tr:last-child td { border-bottom: none; }
body.ui-v2 .v2-cd-table .is-right { text-align: right; }
body.ui-v2 .v2-cd-compare tbody th { text-align: left; font-size: var(--text-sm); text-transform: none; letter-spacing: 0; color: var(--text-secondary); border-bottom: 1px solid var(--border-subtle); vertical-align: top; padding: var(--space-2) var(--space-3); }
body.ui-v2 .v2-cd-accroche { max-width: 36ch; overflow-wrap: anywhere; }
body.ui-v2 .v2-cd-change { color: var(--text-muted); font-size: var(--text-xs); }
body.ui-v2 .v2-cd-compare-form { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: flex-end; margin-bottom: var(--space-3); }
body.ui-v2 .v2-cd-label { display: flex; flex-direction: column; gap: 4px; font-size: var(--text-xs); color: var(--text-muted); font-weight: 700; text-transform: uppercase; letter-spacing: var(--tracking-wide); }
body.ui-v2 .v2-cd-feedback { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); font-size: var(--text-sm); }
body.ui-v2 .v2-cd-lab-actions { margin: var(--space-2) 0; padding-left: var(--space-4); font-size: var(--text-sm); color: var(--text-secondary); }
body.ui-v2 .v2-cd-lab-actions li { margin-bottom: var(--space-1); }
@media (max-width: 1100px) { body.ui-v2 .v2-cd-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 700px) {
  body.ui-v2 .v2-cd-table th:nth-child(n+6), body.ui-v2 .v2-cd-table td:nth-child(n+6) { display: none; }
  body.ui-v2 .v2-cd-compare th, body.ui-v2 .v2-cd-compare td { display: table-cell; }
}

/* T-UX-7 — plusieurs plans d'appels rattachés (vagues successives) : une
   liste, chaque plan avec son geste ; le premier conduit la préparation. */
body.ui-v2 .v2-cw-plans { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
body.ui-v2 .v2-cw-plans li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2); }
body.ui-v2 .v2-cw-plans em { font-style: normal; color: var(--text-secondary); font-size: var(--text-xs); }
