/* ============================================================================
   Prospect 360 — dossier de renseignement (DESIGN-05)
   Porté par `body.ui-v2`. Réutilise les primitives de DESIGN-04 sans les
   dupliquer : `.v2-badge`, `.v2-empty-cell`, `.v2-inline-state`, `.v2-skel`,
   `.v2-btn-*`, la typographie et les jetons.
   ============================================================================ */

.v2-back {
  display: inline-flex; align-items: center; gap: var(--space-2);
  font-size: var(--text-sm); color: var(--text-muted); text-decoration: none;
  align-self: flex-start;
}
.v2-back:hover { color: var(--text-primary); }
.v2-back .v2-icon { width: 14px; height: 14px; }

/* ─── En-tête d'entité ──────────────────────────────────────────────────────
   Un seul bloc, pas six cartes (§52). L'identité domine ; le reste est de la
   métadonnée alignée. */
.v2-entity {
  display: flex; align-items: flex-start; gap: var(--space-4);
  padding-bottom: var(--space-5);
  border-bottom: 1px solid var(--border-default);
}
.v2-avatar-lg {
  flex: 0 0 auto; width: 44px; height: 44px;
  display: grid; place-items: center; border-radius: var(--radius-md);
  background: var(--bg-inverse); color: var(--text-inverse);
  font-family: var(--font-mono); font-size: var(--text-md);
}
.v2-entity-text { flex: 1 1 auto; min-width: 0; }
.v2-entity-name {
  font-size: var(--text-title); font-weight: 600; margin: 0;
  letter-spacing: var(--tracking-tight); line-height: 1.1; color: var(--text-primary);
}
.v2-entity-sub { margin-top: var(--space-1); font-size: var(--text-md); color: var(--text-muted); }
.v2-entity-contact {
  margin-top: var(--space-2); display: flex; gap: var(--space-4); flex-wrap: wrap;
  font-size: var(--text-sm); color: var(--text-secondary);
}
.v2-entity-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }

/* ─── Bandeau d'état ────────────────────────────────────────────────────────*/
.v2-strip {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-4) var(--space-6); margin: 0;
}
.v2-meta { min-width: 0; }
.v2-meta-label {
  font-size: var(--text-2xs); letter-spacing: var(--tracking-wide);
  text-transform: uppercase; color: var(--text-faint); font-weight: 500;
}
.v2-meta-value {
  margin: 2px 0 0; font-size: var(--text-md); color: var(--text-primary);
  overflow-wrap: anywhere;
}
.v2-metagrid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--space-3) var(--space-5); margin: 0;
}

/* ─── Onglets ───────────────────────────────────────────────────────────────*/
.v2-tabs {
  display: flex; gap: var(--space-1);
  border-bottom: 1px solid var(--border-default);
}
.v2-tab {
  background: transparent; border: none; cursor: pointer;
  font-family: var(--font-ui); font-size: var(--text-md);
  color: var(--text-muted); padding: var(--space-2) var(--space-3);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.v2-tab:hover { color: var(--text-primary); }
.v2-tab.is-active { color: var(--text-primary); border-bottom-color: var(--text-primary); font-weight: 500; }
.v2-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* ─── Grilles de panneaux ───────────────────────────────────────────────────*/
.v2-grid2 {
  display: grid; gap: var(--space-5);
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.v2-stack { display: flex; flex-direction: column; gap: var(--space-5); }
@media (max-width: 1100px) { .v2-grid2 { grid-template-columns: 1fr; } }

.v2-panel {
  border: 1px solid var(--border-default); border-radius: var(--radius-md);
  background: var(--bg-surface); display: flex; flex-direction: column;
}
.v2-panel-head {
  display: flex; align-items: baseline; gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
}
.v2-panel-title {
  font-size: var(--text-md); font-weight: 600; margin: 0;
  letter-spacing: var(--tracking-tight); color: var(--text-primary);
}
.v2-panel-meta { font-size: var(--text-xs); color: var(--text-faint); }
.v2-panel-head .v2-btn-ghost { margin-left: auto; }
/* `position: relative` fait du corps de panneau le BLOC CONTENEUR de ses
   descendants positionnés. Sans lui, un `.v2-sr-only` — `position: absolute`,
   1 px, invisible — se place par rapport au bloc conteneur initial : il quitte
   le défilement local de son panneau et sa position statique ALLONGE la page.
   Sur `#/voice-calls` en 390 px, ce repère unique, posé dans le neuvième
   en-tête d'un tableau large, valait 450 px de débordement horizontal.

   La règle vit ICI, à la définition de la classe, et pas dans les trois
   feuilles d'écran qui déclarent `overflow-x`. Elles sont toutes chargées en
   même temps et portent le même sélecteur global : y répéter la déclaration la
   rendrait ININSPECTABLE — retirer la règle d'une feuille laisserait les deux
   autres la fournir, et le défaut resterait masqué. Une seule déclaration, à
   un seul endroit, qu'un test peut réellement mettre en défaut. */
.v2-panel-body { padding: var(--space-4); position: relative; }
.v2-panel-note {
  margin-top: var(--space-3); font-size: var(--text-xs);
  color: var(--text-faint); line-height: var(--leading-tight);
}
.v2-panel-link { font-size: var(--text-sm); color: var(--accent); }
/* DESIGN-07.1 — pied de panneau : un lien contextuel, pas une carte de plus. */
.v2-panel-foot { margin-top: var(--space-3); }

/* ─── Boutons ───────────────────────────────────────────────────────────────*/
.v2-btn-ghost, .v2-btn-mini {
  background: var(--bg-surface); border: 1px solid var(--border-default);
  border-radius: var(--radius-sm); color: var(--text-secondary);
  font-family: var(--font-ui); cursor: pointer;
}
.v2-btn-ghost { padding: 5px var(--space-3); font-size: var(--text-sm); }
.v2-btn-mini { padding: 3px var(--space-2); font-size: var(--text-xs); }
.v2-btn-ghost:hover:not([disabled]), .v2-btn-mini:hover:not([disabled]) {
  border-color: var(--border-strong); color: var(--text-primary);
}
.v2-btn-ghost[disabled], .v2-btn-mini[disabled] { opacity: .5; cursor: default; }

/* ─── Score ─────────────────────────────────────────────────────────────────
   L'explicabilité vient du backend : quatre composantes, leurs maxima, une
   confiance et une version de règles. Rien n'est inventé ici. */
.v2-score-head { display: flex; align-items: baseline; gap: var(--space-3); }
.v2-score-total {
  font-size: var(--text-data); font-weight: 600; line-height: 1;
  letter-spacing: var(--tracking-tight); color: var(--text-primary);
}
.v2-score-out { font-size: var(--text-md); color: var(--text-faint); }
.v2-score-comps { margin-top: var(--space-4); display: flex; flex-direction: column; gap: var(--space-2); }
.v2-score-row { display: grid; grid-template-columns: minmax(90px, 1fr) 2fr auto; align-items: center; gap: var(--space-3); }
.v2-score-label { font-size: var(--text-sm); color: var(--text-secondary); }
.v2-score-track { height: 6px; background: var(--bg-surface-sunken); border-radius: 3px; overflow: hidden; }
.v2-score-track i { display: block; height: 100%; background: var(--accent); }
.v2-score-num { font-size: var(--text-sm); color: var(--text-primary); white-space: nowrap; }
.v2-score-max { color: var(--text-faint); }
.v2-score-foot { margin-top: var(--space-3); font-size: var(--text-2xs); color: var(--text-faint); }
.v2-score-recos { margin: var(--space-3) 0 0; padding-left: var(--space-4); }
.v2-score-reco { font-size: var(--text-sm); color: var(--text-muted); margin-bottom: 4px; }

/* ─── Intelligence ──────────────────────────────────────────────────────────*/
.v2-nba { border-left: 2px solid var(--accent); padding-left: var(--space-3); }
.v2-nba.is-fresh { margin-top: var(--space-4); border-left-color: var(--success); }
.v2-nba-tags { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }
.v2-nba-title { font-size: var(--text-md); font-weight: 600; margin: var(--space-2) 0 var(--space-1); color: var(--text-primary); }
.v2-nba-body { font-size: var(--text-sm); color: var(--text-secondary); white-space: pre-wrap; }
.v2-ai-summary { margin-top: var(--space-4); font-size: var(--text-sm); color: var(--text-secondary); }
.v2-chips { margin-top: var(--space-3); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.v2-chips-label { font-size: var(--text-2xs); text-transform: uppercase; letter-spacing: var(--tracking-wide); color: var(--text-faint); }
.v2-chip {
  font-size: var(--text-xs); border: 1px solid var(--border-default);
  border-radius: var(--radius-xs); padding: 1px 6px; color: var(--text-secondary);
}

/* ─── Rendez-vous, Voice, société ───────────────────────────────────────────*/
.v2-appt-list, .v2-warn-list, .v2-cand-list { list-style: none; margin: 0; padding: 0; }
.v2-appt, .v2-cand {
  display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap;
  padding: var(--space-2) 0; border-bottom: 1px solid var(--border-subtle);
}
.v2-appt:last-child, .v2-cand:last-child { border-bottom: none; }
.v2-appt-when { font-size: var(--text-sm); color: var(--text-primary); }
.v2-appt-type { font-size: var(--text-sm); color: var(--text-muted); }
.v2-appt-actions { margin-left: auto; display: flex; gap: 4px; flex-wrap: wrap; }
.v2-warn { font-size: var(--text-sm); color: var(--text-secondary); padding: 4px 0; }
.v2-voice-state { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.v2-voice-actions, .v2-company-actions {
  margin-top: var(--space-4); display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap;
}
.v2-company-search { display: flex; gap: var(--space-2); margin-top: var(--space-3); }
.v2-cand span { font-size: var(--text-sm); color: var(--text-primary); }
.v2-cand button { margin-left: auto; }

/* ─── Chronologie ───────────────────────────────────────────────────────────
   Seuls des faits horodatés y figurent. Le filet vertical porte la
   chronologie ; il ne décore rien. */
.v2-timeline { list-style: none; margin: 0; padding: 0 0 0 var(--space-4); position: relative; }
.v2-timeline::before {
  content: ''; position: absolute; left: 3px; top: 6px; bottom: 6px;
  width: 1px; background: var(--border-default);
}
.v2-tl-item {
  position: relative; display: flex; align-items: baseline; gap: var(--space-3);
  flex-wrap: wrap; padding: var(--space-2) 0;
}
.v2-tl-dot {
  position: absolute; left: calc(var(--space-4) * -1); top: 12px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--bg-surface); border: 1px solid var(--border-strong);
}
.v2-tl-when { font-size: var(--text-xs); color: var(--text-faint); min-width: 15ch; }
.v2-tl-label { font-size: var(--text-sm); color: var(--text-primary); }
.v2-tl-cat {
  font-size: var(--text-2xs); color: var(--text-faint);
  border: 1px solid var(--border-default); border-radius: var(--radius-xs); padding: 0 4px;
}

/* ─── États et squelettes ───────────────────────────────────────────────────*/
.v2-inline-state { padding: var(--space-4) 0; }
.v2-inline-state.is-reasoned { border-left: 2px solid var(--border-strong); padding-left: var(--space-3); }
.v2-inline-state.is-error { border-left: 2px solid var(--warning); padding-left: var(--space-3); }
.v2-entity.is-skeleton { border-bottom-color: var(--border-subtle); }
.v2-skel-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-5); }
@media (max-width: 1100px) { .v2-skel-grid { grid-template-columns: 1fr; } }

@media (max-width: 700px) {
  .v2-entity { flex-direction: column; }
  .v2-entity-actions { width: 100%; }
  .v2-tabs { overflow-x: auto; }
  .v2-tl-when { min-width: 0; width: 100%; }
}
