/* ═══════════════════════════════════════════════════════════════════════
   Fiche prospect (slide-over) — panneau latéral 440px, timeline relances.
   Direction « Linear futuriste » (handoff 02-linear-dark).
   S'appuie sur les tokens (css/index.css) + primitives (components.css).
   ═══════════════════════════════════════════════════════════════════════ */

.sheet-layer { position: fixed; inset: 0; z-index: 9990; }

/* ─── Overlay assombrissant ─── */
.sheet-overlay {
  position: absolute; inset: 0;
  background: rgba(1, 4, 9, 0.5);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  opacity: 0; pointer-events: none;
  transition: opacity var(--t-base) var(--ease);
}
.sheet-overlay.open { opacity: 1; pointer-events: auto; }

/* ─── Panneau latéral 440px (translateX) ─── */
.sheet {
  position: absolute; top: 0; right: 0;
  height: 100%; width: 440px; max-width: 100vw;
  display: flex; flex-direction: column;
  background: var(--glass-el);
  backdrop-filter: blur(18px) saturate(1.1); -webkit-backdrop-filter: blur(18px) saturate(1.1);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  transform: translateX(100%);
  transition: transform var(--t-base) var(--ease);
}
.sheet.open { transform: none; }
/* Liseré-énergie dégradé sur le bord gauche du panneau */
.sheet::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 1px;
  background: var(--grad); opacity: 0.5; pointer-events: none;
}

/* ─── En-tête : avatar + identité + fermer ─── */
.sheet-h {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 18px 18px 20px;
  border-bottom: 1px solid var(--border);
  flex: none;
}
.sheet-av {
  width: 40px; height: 40px; flex: none;
  border-radius: 10px;
  background: var(--grad);
  color: #fff; font-weight: 600; font-size: 15px;
  display: grid; place-items: center;
  box-shadow: 0 2px 12px color-mix(in srgb, var(--accent) 40%, transparent);
}
.sheet-id { flex: 1; min-width: 0; }
.sheet-name {
  font-size: 16px; font-weight: 600; letter-spacing: -0.02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sheet-role {
  font-size: 13px; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ─── Corps scrollable ─── */
.sheet-body {
  flex: 1; overflow-y: auto;
  padding: 18px 20px;
  display: flex; flex-direction: column; gap: 18px;
}

.sheet-tags { display: flex; flex-wrap: wrap; gap: 8px; }

/* ─── Bandeau valeur : 2 tuiles ─── */
.sheet-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sheet-stat {
  padding: 11px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--bg) 60%, transparent);
}
.sheet-stat .sl { font-size: 11px; font-weight: 500; color: var(--text-dim); }
.sheet-stat .sv {
  margin-top: 4px;
  font-family: var(--font-mono); font-size: 18px; font-weight: 600;
  letter-spacing: -0.02em; color: var(--text);
}
.sheet-stat .sv.stale { color: var(--warning); }

/* ─── Sections ─── */
.sheet-sect h4 {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-dim); margin-bottom: 10px;
}

/* ─── Automatisation ─── */
/* Prochaine action : relie l'état d'automatisation à un geste concret (UX-P1-3). */
.next-action {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 11px; margin-bottom: 12px;
  border-radius: var(--radius-sm);
  font-size: 12.5px; line-height: 1.45;
  border: 1px solid color-mix(in srgb, var(--accent) 26%, transparent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}
.next-action .na-ic { width: 15px; height: 15px; flex: none; color: var(--accent); }
.next-action .na-tx { flex: 1 1 auto; min-width: 0; color: var(--text); }
.next-action .na-cta { flex: none; }
.next-action.na-warn {
  border-color: color-mix(in srgb, var(--warning) 34%, transparent);
  background: var(--warning-soft);
}
.next-action.na-warn .na-ic { color: var(--warning); }
.next-action.na-done {
  border-color: color-mix(in srgb, var(--success) 28%, transparent);
  background: var(--success-soft);
}
.next-action.na-done .na-ic { color: var(--success); }

.auto-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; }
.auto-badge { gap: 7px; }
.auto-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.auto-badge.auto-on  { color: var(--success); background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 30%, transparent); }
.auto-badge.auto-on .auto-dot  { background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.auto-badge.auto-off { color: var(--warning); background: var(--warning-soft); border-color: color-mix(in srgb, var(--warning) 30%, transparent); }
.auto-badge.auto-off .auto-dot { background: var(--warning); box-shadow: 0 0 0 3px var(--warning-soft); }
.auto-note { font-size: 12.5px; color: var(--text-muted); }
.auto-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.ok-tick { color: var(--success); margin-left: 4px; display: inline-flex; align-items: center; vertical-align: middle; }

/* ─── Formulaire de coordonnées (édition + création) ─── */
.sheet-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 12px; }
.sheet-form .ff.full { grid-column: 1 / -1; }
.sheet-form .field-label { margin-bottom: 5px; }
.sheet-form .input, .sheet-form .select { height: 34px; }

/* ─── Fiche en mode LECTURE (résumé scannable) ─── */
.sheet-coord-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.sheet-coord-head h4 { margin-bottom: 0; }
.sheet-read { display: flex; flex-direction: column; }
.sheet-read .kv {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  padding: 8px 0; border-bottom: 1px solid var(--border);
}
.sheet-read .kv:last-child { border-bottom: none; }
.sheet-read .kl { font-size: 12.5px; color: var(--text-muted); flex: none; }
.sheet-read .kv-v { font-size: 13px; color: var(--text); text-align: right; min-width: 0; word-break: break-word; }
.sheet-read .kv-v.muted { color: var(--warning); font-style: italic; }
.sheet-notes-read { font-size: 13px; color: var(--text-muted); line-height: 1.6; white-space: pre-wrap; }

/* ─── Liens externes ─── */
.sheet-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.sheet-links a {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 11px;
  border: 1px solid var(--border); border-radius: 999px;
  font-size: 12px; font-weight: 500; color: var(--text-muted);
  background: color-mix(in srgb, var(--bg-surface) 70%, transparent);
  transition: color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.sheet-links a:hover { color: var(--text); border-color: var(--border-hi); background: var(--bg-hover); }
.sheet-links svg { width: 14px; height: 14px; flex: none; }

.sheet-owner {
  display: inline-flex; align-items: center; gap: 7px; margin-top: 12px;
  font-size: 12.5px; color: var(--text-muted);
}
.sheet-owner svg { width: 14px; height: 14px; color: var(--accent); flex: none; }

/* ─── Notes ─── */
.sheet-sect .textarea { min-height: 84px; }

/* ─── Message d'erreur (non technique) ─── */
.sheet-error {
  padding: 10px 12px; border-radius: var(--radius-sm);
  font-size: 13px; color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid color-mix(in srgb, var(--danger) 28%, transparent);
}

/* ─── Timeline relances (connecteur vertical, puces colorées) ─── */
.sheet-timeline { position: relative; gap: 0; }
.sheet-timeline .tl-item {
  position: relative; gap: 12px; padding: 9px 0; border-bottom: none; align-items: flex-start;
}
.sheet-timeline .tl-item:not(:last-child)::before {
  content: ""; position: absolute; left: 4px; top: 20px; bottom: -1px; width: 1px;
  background: var(--border);
}
.sheet-timeline .tl-dot {
  width: 9px; height: 9px; margin-top: 4px; position: relative; z-index: 1;
  box-shadow: 0 0 0 3px var(--bg-surface);
}
.sheet-timeline .tl-dot.sent    { background: var(--success); }
.sheet-timeline .tl-dot.failed  { background: var(--danger); }
.sheet-timeline .tl-dot.pending { background: var(--warning); }
.sheet-timeline .tl-title { font-size: 13px; font-weight: 500; }
.sheet-timeline .tl-fail { color: var(--danger); }

/* ─── Pied du panneau ─── */
.sheet-foot {
  flex: none; display: flex; gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
}
.sheet-primary { flex: 1; }

/* ═══════ Modale de confirmation de suppression ═══════ */
.confirm-modal {
  position: absolute; inset: 0; z-index: 10;
  display: grid; place-items: center; padding: 24px;
}
.confirm-bg {
  position: absolute; inset: 0;
  background: rgba(1, 4, 9, 0.6);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.confirm-box {
  position: relative; width: 100%; max-width: 360px;
  padding: 22px;
  background: var(--glass-el);
  backdrop-filter: blur(18px) saturate(1.1); -webkit-backdrop-filter: blur(18px) saturate(1.1);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: confirm-pop var(--t-base) var(--ease-spring) both;
}
.confirm-box h3 { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.confirm-box p { font-size: 13px; color: var(--text-muted); margin: 0 0 18px; }
.confirm-foot { display: flex; gap: 8px; justify-content: flex-end; }
@keyframes confirm-pop {
  from { opacity: 0; transform: scale(0.95) translateY(-6px); }
  to   { opacity: 1; transform: none; }
}

/* ─── Responsive : pleine largeur < 768px ─── */
@media (max-width: 768px) {
  .sheet { width: 100%; }
  .sheet-stats { grid-template-columns: 1fr; }
}

/* ─── Mouvement réduit ─── */
@media (prefers-reduced-motion: reduce) {
  .sheet, .sheet-overlay, .confirm-box { transition: none !important; animation: none !important; }
}

/* ── Pastille de confiance de l'adresse email + actions (A5, gate délivrabilité) ── */
.email-chip {
  display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px;
  font-size: 11px; font-weight: 600; font-style: normal; vertical-align: middle;
  border: 1px solid transparent;
}
.email-chip.ok   { color: var(--success); background: var(--success-soft);
                   border-color: color-mix(in srgb, var(--success) 30%, transparent); }
.email-chip.warn { color: var(--warning); background: var(--warning-soft);
                   border-color: color-mix(in srgb, var(--warning) 34%, transparent); }
.email-actions { display: flex; gap: 8px; margin: 4px 0 10px; }

/* ── Section Enrichissement repliable (lecture seule) ── */
.enrich-toggle {
  display: flex; align-items: center; gap: 6px; width: 100%;
  background: none; border: none; cursor: pointer; padding: 0;
  font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-dim);
}
.enrich-toggle:hover { color: var(--text); }
.enrich-caret { width: 13px; height: 13px; transition: transform .15s ease; flex: none; }
.enrich-caret.open { transform: rotate(90deg); }
.enrich-body { margin-top: 10px; }
