/* =================================================================
   NEO — MODE SOMBRE (PROPOSED)
   -----------------------------------------------------------------
   La charte neo ne documente aucun mode sombre : les écrans produit
   y sont décrits « blancs et plats ». Cette variante est donc une
   PROPOSITION, dérivée strictement de la palette officielle :
    · #3D67AE devient la couleur d'action du prototype
    · les surfaces sombres sont teintées vers #294674 (navy)
     · la règle des 20 % d'opacité des tags est transposée sur fond
       sombre (aplat de la couleur pleine à ~20 %)
   Activation : attribut data-theme="dark" sur <html>.
   Le mode clair reste le défaut.
   ================================================================= */

html[data-theme="dark"] {
  /* ─── SURFACES ─── */
  --bg: #0B0D17;
  --bg-page: #0B0D17;
  --surface: #14161F;
  --surface-2: #1C1F2B;
  --surface-hover: #1C1F2B;
  --border: #262A38;
  --border-hover: #3A4055;

  /* ─── TEXTE ─── */
  --text-1: #F5F6FA;
  --text-2: #C3C7D4;
  --text-3: #9096A8;
  --text-muted: #9096A8;
  --text-soft: #9096A8;

  /* ─── ACTION — le bleu ne change pas, ses fonds oui ─── */
  --blue-light: #16233D;
  --blue-50: rgba(61,103,174,0.12);
  --blue-a10: rgba(61,103,174,0.16);
  --blue-a20: rgba(61,103,174,0.28);
  --blue-a30: rgba(61,103,174,0.40);
  --primary-bg: #16233D;

  /* ─── FONDS DE TAG — 20 % sur fond sombre ─── */
  --tag-info-bg: rgba(61,103,174,0.20);
  --tag-success-bg: rgba(26,205,25,0.18);
  --tag-error-bg: rgba(255,0,0,0.20);
  --tag-warning-bg: rgba(242,153,26,0.20);
  --tag-purple-bg: rgba(149,133,255,0.20);
  --tag-magenta-bg: rgba(178,34,255,0.20);
  --color-neutral-bg: #262A38;

  /* Les variantes assombries de la charte deviennent illisibles sur fond sombre */
  --tag-info-text: #91B3E8;
  --tag-success-text: #4ADE4A;
  --tag-error-text: #FF6B6B;
  --tag-warning-text: #F2991A;
  --tag-purple-text: #B7ACFF;
  --tag-magenta-text: #DB93FF;
  --tag-neutral-text: #9E9E9E;

  /* ─── OMBRES — portance réduite, on s'appuie sur les bordures ─── */
  --shadow-card: 0 4px 20px rgba(0,0,0,0.45);
  --shadow-modal: 0 24px 60px rgba(0,0,0,0.65);
  --shadow-1: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-2: 0 4px 20px rgba(0,0,0,0.45);
  --shadow-3: 0 8px 30px rgba(0,0,0,0.55);
  --shadow-4: 0 24px 60px rgba(0,0,0,0.65);

  color-scheme: dark;
}

/* ═══════════════════════════════════════════════════════════════════
   Surfaces codées en dur — repassées sur les tokens
   ═══════════════════════════════════════════════════════════════════ */
html[data-theme="dark"] .lang-switch,
html[data-theme="dark"] .ai-cta-btn,
html[data-theme="dark"] .ai-sugg-chip,
html[data-theme="dark"] .ai-action-card,
html[data-theme="dark"] .ai-gen-copy,
html[data-theme="dark"] .pd-file-preview-btn,
html[data-theme="dark"] .pd-file-remove-btn,
html[data-theme="dark"] .np-btn-cancel,
html[data-theme="dark"] .wf-btn-clear,
html[data-theme="dark"] .btn-back,
html[data-theme="dark"] .btn-create-agent,
html[data-theme="dark"] .cadrage-analyze-btn,
html[data-theme="dark"] .ro-target-chip,
html[data-theme="dark"] .c2-assets,
html[data-theme="dark"] .picker-cat-chip,
html[data-theme="dark"] .chip {
  background: var(--surface);
}

html[data-theme="dark"] .as-input:focus { background: var(--surface-2); }

/* Bouton secondaire : le contour noir de la charte devient clair sur fond sombre */
html[data-theme="dark"] .np-btn-cancel,
html[data-theme="dark"] .wf-btn-clear,
html[data-theme="dark"] .btn-back {
  border-color: var(--text-2);
  color: var(--text-1);
}
html[data-theme="dark"] .np-btn-cancel:hover,
html[data-theme="dark"] .btn-back:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--blue-light);
}
html[data-theme="dark"] .chip-fonction { color: var(--text-1); border-color: var(--text-2); }
html[data-theme="dark"] .chip-fonction:hover { background: var(--surface-2); }

/* ═══════════════════════════════════════════════════════════════════
   Trames de fond (canvas workflow, pipeline projet)
   ═══════════════════════════════════════════════════════════════════ */
html[data-theme="dark"] .workflow-canvas-wrapper {
  background-image: radial-gradient(circle, #2B3042 1px, transparent 1px);
}
html[data-theme="dark"] .pd-wf-pipeline {
  background: repeating-linear-gradient(90deg, transparent, transparent 19px, #1E2230 19px, #1E2230 20px),
              repeating-linear-gradient(0deg, transparent, transparent 19px, #1E2230 19px, #1E2230 20px);
  background-size: 20px 20px;
}

/* ═══════════════════════════════════════════════════════════════════
   Teintes pastel → aplats sombres
   ═══════════════════════════════════════════════════════════════════ */
html[data-theme="dark"] .mt-cap-icon--strategy { background: var(--tag-info-bg); }
html[data-theme="dark"] .mt-cap-icon--reporting { background: var(--tag-info-bg); }
html[data-theme="dark"] .mt-cap-icon--ideation { background: var(--tag-magenta-bg); }
html[data-theme="dark"] .mt-cap-icon--orchestration { background: var(--tag-purple-bg); }
html[data-theme="dark"] .pil-stat-card--warning { background: var(--tag-warning-bg); }
html[data-theme="dark"] .pd-file-warning { background: var(--tag-warning-bg); border-color: var(--color-warning); }
html[data-theme="dark"] .user-dropdown-item--danger { color: #FF6B6B; }
html[data-theme="dark"] .user-dropdown-item--danger:hover { background: var(--tag-error-bg); color: #FF9A9A; }

/* ═══════════════════════════════════════════════════════════════════
   Divers
   ═══════════════════════════════════════════════════════════════════ */
html[data-theme="dark"] .modal-backdrop,
html[data-theme="dark"] .agent-picker-overlay,
html[data-theme="dark"] .new-project-overlay { background: rgba(0,0,0,0.62); }

html[data-theme="dark"] .ai-msg-bubble code { background: rgba(255,255,255,0.08); }
html[data-theme="dark"] .tooltip-demo { background: var(--surface-2); border: 1px solid var(--border-hover); }

/* Le fond dégradé clair de l'onglet Projets ne tient pas en mode sombre */
html[data-theme="dark"] .view-projects {
  background-image: none;
  background-color: var(--bg);
}
html[data-theme="dark"] .view-catalog { background: var(--surface); }
html[data-theme="dark"] .view-home { background: var(--bg); }

/* Le logo onepoint est fourni en version sombre — on le passe en blanc */
html[data-theme="dark"] .onepoint-logo { filter: brightness(0) invert(1); opacity: 0.7; }
html[data-theme="dark"] .sidebar-onepoint:hover .onepoint-logo { opacity: 1; }

/* Les cartes s'appuient sur la bordure plutôt que sur l'ombre */
html[data-theme="dark"] .agent-card,
html[data-theme="dark"] .project-card,
html[data-theme="dark"] .workflow-template-card,
html[data-theme="dark"] .dash-card,
html[data-theme="dark"] .dash-featured,
html[data-theme="dark"] .conv-card,
html[data-theme="dark"] .alerte-card,
html[data-theme="dark"] .mt-session-card,
html[data-theme="dark"] .pil-stat-card,
html[data-theme="dark"] .mt-stat,
html[data-theme="dark"] .gsa-kcard,
html[data-theme="dark"] .gsa-cc { border-color: var(--border); }

/* ═══════════════════════════════════════════════════════════════════
   BASCULE CLAIR / SOMBRE — pill, même gabarit que le sélecteur de langue
   ═══════════════════════════════════════════════════════════════════ */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 14px;
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text-3);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .03em;
  cursor: pointer;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.theme-toggle:hover {
  color: var(--color-primary);
  border-color: var(--color-primary);
  background: var(--blue-light);
}
.theme-toggle svg { flex-shrink: 0; }
.theme-toggle .theme-toggle-label { line-height: 1; }

/* ═══════════════════════════════════════════════════════════════════
   EXTENSION SPÉCIFIQUE — badges à couleur inline en mode sombre
   Cette app écrit la couleur de catégorie en style inline
   (style="background:${cat.color}12;color:${cat.color}"). Sur fond
   sombre, les catégories navy (#000C79) et noire (#181818) deviennent
   illisibles. On neutralise l'inline (d'où le !important, seul moyen
   de passer devant un style d'attribut) au profit des tokens de tag
   déjà définis plus haut. Le mode clair n'est pas affecté.
   ═══════════════════════════════════════════════════════════════════ */
html[data-theme="dark"] .agent-category-tag,
html[data-theme="dark"] .wf-family-tag,
html[data-theme="dark"] .modal-category-badge,
html[data-theme="dark"] .home-news-tag {
  background: var(--tag-info-bg) !important;
  color: var(--tag-info-text) !important;
}
html[data-theme="dark"] .dash-card-kpi,
html[data-theme="dark"] .dash-card-link,
html[data-theme="dark"] .ai-cta-btn--nav {
  color: var(--tag-info-text) !important;
}

/* Composants de la bibliothèque et du détail projet dont la couleur de texte
   est un noir/une couleur de catégorie codée pour fond clair : on les rend
   lisibles en mode sombre. (Le mode clair reste strictement inchangé.) */
html[data-theme="dark"] .lib-btn-secondary {
  color: var(--text-1);
  border-color: var(--border-hover);
}
html[data-theme="dark"] .lib-btn-secondary:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}
html[data-theme="dark"] .chip-fonction { color: var(--text-1); border-color: var(--border-hover); }
html[data-theme="dark"] .lib-field,
html[data-theme="dark"] .lib-select { border-color: var(--border-hover); }
html[data-theme="dark"] .lib-toggle input:checked + .lib-toggle-track { background: var(--color-primary); }
html[data-theme="dark"] .pd-pipeline-cat { color: var(--text-3) !important; }

/* ─── Thème sombre : lisibilité des bleus de la charte (texte et icônes éclaircis, logo blanc) ─── */
html[data-theme="dark"] { --tag-neutral-bg: #262A38; --tag-neutral-text: #C3C7D4; }
html[data-theme="dark"] .sidebar-item:not(.active) .sidebar-icon { color: var(--text-2); }
html[data-theme="dark"] .sidebar-item.active .sidebar-icon,
html[data-theme="dark"] .sidebar-item.active .sidebar-label,
html[data-theme="dark"] .sidebar-section-label,
html[data-theme="dark"] .home-card-link,
html[data-theme="dark"] .home-badge-new,
html[data-theme="dark"] .lib-cap,
html[data-theme="dark"] .chip-secteur,
html[data-theme="dark"] .btn-create-agent,
html[data-theme="dark"] .lib-reset,
html[data-theme="dark"] .cr-text-button,
html[data-theme="dark"] .amoa-chat-chip,
html[data-theme="dark"] .amoa-chat-head h2 { color: var(--tag-info-text) !important; }
html[data-theme="dark"] .neo-header-wordmark img,
html[data-theme="dark"] .proj-footer-logo { content: url("assets/brand/neo-wordmark.svg"); filter: brightness(0) invert(1); }

:root { --home-c1: #0C419A; --home-c2: #07275C; --home-c3: #00749C; --home-c4: #CA4733; }
html[data-theme="dark"] { --home-c1: var(--tag-info-text); --home-c2: var(--tag-info-text); --home-c3: var(--tag-info-text); --home-c4: var(--tag-error-text); }
html[data-theme="dark"] .aw-back-btn, html[data-theme="dark"] .aw-back-btn span { color: var(--tag-info-text) !important; }
.home-stat-label { color: var(--text-1); }
.agent-card .agent-description { color: var(--text-1); }
/* Espace en français pour l’Assurance Maladie : la langue suit celle du système, sans bascule visible. */
.lang-switch { display: none !important; }

/* Écran Projet : la colonne centrale peut rétrécir (pas de débordement à droite aux petites largeurs ni avec le zoom du navigateur). */
.project-detail-body { grid-template-columns: minmax(0, 1fr) minmax(260px, 340px); }
#project-main, #project-sidebar { min-width: 0; }
.pd-wf-pipeline { overflow-x: auto; }
@media (max-width: 1100px) { .project-detail-body { grid-template-columns: minmax(0, 1fr); } }
.pd-wf-pipeline { overflow-x: visible; }
.pd-pipeline-node { min-width: 86px; flex-shrink: 1; padding: 12px 8px 10px; }
.pd-pipeline-conn { padding: 0 2px; }
.pd-pipeline-arrow { width: 14px; }
.pd-pipeline-name { font-size: 13px; overflow-wrap: anywhere; }
.pd-pipeline-node { min-width: 94px; }
.pd-pipeline-conn { padding: 0; }
.pd-pipeline-arrow { width: 10px; }
.pd-pipeline-name { font-size: 12px; overflow-wrap: normal; word-break: normal; }
/* Fil des étapes : tient sur une ligne aux petites largeurs (noms raccourcis par une ellipse, étape active entière). */
.aw-steps-strip { flex-wrap: nowrap; overflow-x: auto; }
.aw-step { flex-shrink: 1; min-width: 0; padding: 6px 10px; }
.aw-step-active { flex-shrink: 0; }
.aw-step-name { overflow: hidden; text-overflow: ellipsis; }
.aw-step-num { flex-shrink: 0; }
.aw-step { flex-shrink: 0; max-width: 128px; }
.aw-step-active { max-width: 230px; }
.aw-steps-strip .aw-back-btn { flex-shrink: 1; min-width: 60px; max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#project-detail-view { padding: 0 32px 32px; }
:root { --text-3: #596069; --text-muted: #596069; --text-soft: #596069; }
html:not([data-theme="dark"]) .as-upstream-badge, html:not([data-theme="dark"]) .as-upstream-badge *, html:not([data-theme="dark"]) .aw-step-done { color: #0B5A31; }
.gsa-pill.pill-eq { color: var(--text-1); }
/* PRD en thème sombre : la feuille reste blanche (aspect document), son encre devient sombre ; le reste prend les bleus clairs. */
html[data-theme="dark"] #prd-editor .pe-doc { --pe-ink: #212529; --pe-muted: #495057; color: #212529; }
html[data-theme="dark"] #prd-editor .pe-title, html[data-theme="dark"] #prd-editor .pe-chat h2, html[data-theme="dark"] #prd-editor .pe-review summary, html[data-theme="dark"] #prd-editor .pe-chips button, html[data-theme="dark"] #prd-editor button.pe-action { color: var(--tag-info-text); }
html[data-theme="dark"] .aw-step-done, html[data-theme="dark"] .aw-step-incomplete { color: var(--text-1); }
html[data-theme="dark"] .pd-file-add .pd-file-name { color: var(--tag-info-text) !important; }
html[data-theme="dark"] .aw-step-done .aw-step-num { color: #0B0D17; }
html[data-theme="dark"] .amoa-title { color: var(--text-1); }
html[data-theme="dark"] #prd-editor .pe-doc * { color: #212529; }
html[data-theme="dark"] #prd-editor .pe-doc h2 { color: var(--color-navy); }
html[data-theme="dark"] #prd-editor .pe-doc th { color: #fff; }
html[data-theme="dark"] #prd-editor .pe-doc button, html[data-theme="dark"] #prd-editor .pe-doc .gsa-pill { color: var(--text-1); }
html[data-theme="dark"] .project-card-modified, html[data-theme="dark"] .project-card-modified *, html[data-theme="dark"] .project-card-collabs { color: var(--text-2); }
html[data-theme="dark"] .aw-step:not(.aw-step-active) .aw-step-num { background: var(--surface-2); color: var(--text-1); }
.alerte-sev-badge { color: var(--text-1) !important; }
.pil-stat-card--warning .pil-stat-value, .pil-stat-card--warning .pil-stat-label, .alerte-triggered { color: var(--text-1) !important; }
.as-card ol { padding-left: 22px; }
.pd-collab-avatar { margin-left: -3px; font-size: 11px; }
.pd-collab-avatar:first-child { margin-left: 0; }

/* ── Cadre commun des agents : en-tête (icône, nom, état, actions), menus Exporter et « Plus d'options », onglets ───── */
.amoa-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px 18px; }
.amoa-headicon { width: 52px; height: 52px; border-radius: 14px; background: var(--blue-light); color: var(--color-primary); display: grid; place-items: center; flex: none; }
.amoa-headline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.amoa-agentname { margin: 0; font-family: var(--font-heading); font-weight: 700; font-size: 26px; line-height: 1.3; letter-spacing: -0.01em; color: var(--color-navy); }
.amoa-status { padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; }
.amoa-status-warn { background: var(--tag-warning-bg); color: var(--tag-warning-text); }
.amoa-status-ok { background: var(--tag-success-bg); color: color-mix(in srgb, var(--color-success) 72%, black); }
.amoa-head .amoa-title { font-size: 15px; font-weight: 600; line-height: 1.4; color: var(--text-2); padding: 2px 0; margin-top: 2px; }
.amoa-head .amoa-sub { padding: 0; }
.amoa-headactions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.amoa-btn { list-style: none; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--border-hover); background: var(--surface); color: var(--text-1); font: inherit; font-size: 15px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.amoa-btn:hover { background: var(--blue-50); }
.amoa-btn::-webkit-details-marker { display: none; }
.amoa-btn:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.amoa-btn-icon { width: 44px; padding: 0; justify-content: center; }
.amoa-btn-count { min-width: 22px; text-align: center; padding: 1px 7px; border-radius: 999px; font-size: 12px; background: var(--tag-info-bg); color: var(--tag-info-text); }
.amoa-pop { position: relative; }
.amoa-pop[open] > .amoa-btn { background: var(--blue-50); border-color: var(--color-primary); }
.amoa-exp-menu { width: 300px; right: 0; top: calc(100% + 8px); padding: 8px; gap: 0; border-radius: 16px; border: 1px solid var(--border); box-shadow: 0 12px 32px rgba(7, 39, 92, 0.18); }
.amoa-more-menu { width: 260px; }
.amoa-menu-title { margin: 0; padding: 8px 12px 6px; font-size: 13px; font-weight: 700; color: var(--text-2); }
.amoa-menu-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 0; border-radius: 10px; background: transparent; color: var(--text-1); font: inherit; text-align: left; cursor: pointer; }
.amoa-menu-item:hover:not(:disabled) { background: var(--blue-50); }
.amoa-menu-item:focus-visible { outline: 2px solid var(--color-primary); outline-offset: -2px; }
.amoa-menu-item:disabled { cursor: not-allowed; opacity: 0.6; }
.amoa-menu-txt { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.amoa-menu-txt strong { font-size: 15px; font-weight: 700; }
.amoa-menu-txt small { font-size: 13px; color: var(--text-2); }
.amoa-menu-item-small .amoa-menu-txt strong { font-size: 14px; font-weight: 600; }
.amoa-menu-sep { display: block; height: 1px; margin: 6px 4px; background: var(--border); }
.amoa-fmt { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 10px; font-size: 11px; font-weight: 800; letter-spacing: 0.04em; }
.amoa-fmt-docx { background: var(--tag-info-bg); color: var(--tag-info-text); }
.amoa-fmt-xlsx { background: var(--tag-success-bg); color: color-mix(in srgb, var(--color-success) 72%, black); }
.amoa-fmt-pptx { background: var(--tag-warning-bg); color: var(--tag-warning-text); }
.amoa-fmt-pdf { background: var(--tag-error-bg); color: var(--tag-error-text); }
.amoa-tab { font-size: 16px; padding: 12px 18px; }
.amoa-tab-active { border-bottom-width: 3px; }
.aw-results-bar:has(+ .aw-messages .amoa-res) { display: none; }
@media (max-width: 900px) { .amoa-head { grid-template-columns: auto minmax(0, 1fr); } .amoa-headactions { grid-column: 1 / -1; justify-content: flex-start; } }

/* ── Sortie Persona : cartes puis fiche ───────────────────────────────────────────────────── */
.pv-a0 { --pv-a: var(--color-cyan); }
.pv-a1 { --pv-a: var(--color-purple); }
.pv-a2 { --pv-a: var(--color-primary); }
.pv-a3 { --pv-a: var(--color-navy); }
.pv-heading { display: flex; align-items: center; gap: 10px; margin: 4px 0 18px; }
.pv-heading h3 { margin: 0; font-family: var(--font-heading); font-size: 20px; color: var(--color-navy); }
.pv-heading span { min-width: 26px; text-align: center; padding: 2px 9px; border-radius: 999px; font-size: 13px; font-weight: 700; background: var(--tag-info-bg); color: var(--tag-info-text); }
.pv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.pv-card { position: relative; display: flex; flex-direction: column; gap: 16px; min-height: 230px; padding: 24px; border-radius: 24px; border: 2px solid var(--pv-a); background: var(--surface); color: var(--text-1); font: inherit; text-align: left; cursor: pointer; transition: transform 0.15s, box-shadow 0.15s; }
.pv-card:hover { transform: translateY(-3px); box-shadow: 0 12px 28px rgba(7, 39, 92, 0.16); }
.pv-card:focus-visible, .pv-mini:focus-visible, .pv-pick:focus-visible, .pv-btn:focus-visible, .pv-close:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 3px; }
.pv-code { position: absolute; top: 20px; right: 20px; width: 30px; height: 30px; display: grid; place-items: center; background: color-mix(in srgb, var(--pv-a) 22%, var(--surface)); color: var(--color-navy); font-family: var(--font-heading); font-weight: 700; font-size: 13px; }
.pv-card-top { display: flex; align-items: center; gap: 14px; padding-right: 40px; }
.pv-avatar { width: 60px; height: 60px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--surface); color: var(--color-primary); border: 3px solid var(--pv-a); box-shadow: 0 0 0 3px color-mix(in srgb, var(--pv-a) 22%, var(--surface)); font-family: var(--font-heading); font-weight: 700; font-size: 19px; }
.pv-avatar-s { width: 42px; height: 42px; font-size: 14px; border-width: 2px; box-shadow: none; }
.pv-avatar-l { width: 80px; height: 80px; font-size: 25px; border: 0; box-shadow: 0 0 0 5px color-mix(in srgb, var(--pv-a) 55%, var(--color-primary)); }
.pv-card-id { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pv-card-id strong { font-family: var(--font-heading); font-weight: 700; font-size: 19px; line-height: 1.2; color: var(--color-navy); }
.pv-card-id span { font-size: 14px; color: var(--text-2); }
.pv-card-quote { flex: 1; font-size: 15px; line-height: 1.5; font-style: italic; color: var(--text-1); }
.pv-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 12px; border-top: 1px solid var(--border-hover); font-size: 14px; font-weight: 600; color: var(--text-2); }
.pv-chip { padding: 3px 10px; border-radius: 999px; background: var(--tag-info-bg); color: var(--tag-info-text); font-size: 13px; font-weight: 700; }
.pv-focus { display: flex; gap: 24px; align-items: flex-start; flex-wrap: wrap; }
.pv-focus-list { flex: 1 0 220px; max-width: 280px; display: flex; flex-direction: column; gap: 10px; position: sticky; top: 16px; }
.pv-mini { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 18px; border: 2px solid var(--pv-a); background: var(--surface); color: var(--text-1); font: inherit; text-align: left; cursor: pointer; }
.pv-mini .pv-card-id strong { font-size: 15px; }
.pv-mini-on { background: var(--color-navy); }
.pv-mini-on .pv-card-id strong { color: var(--color-white); }
.pv-mini-on .pv-card-id span { color: var(--purple-pale, var(--color-purple-pale)); }
.pv-focus-main { flex: 999 1 460px; min-width: 0; }
.pv-fiche { border-radius: 28px; overflow: hidden; border: 1px solid var(--border-hover); background: var(--surface); box-shadow: 0 12px 32px rgba(7, 39, 92, 0.12); }
.pv-fiche-head { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; padding: 26px 30px; background: var(--color-primary); color: var(--color-white); }
.pv-fiche-head .pv-avatar { color: var(--color-primary); }
.pv-fiche-id { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.pv-kicker { align-self: flex-start; padding: 4px 10px; background: color-mix(in srgb, var(--pv-a) 22%, var(--surface)); color: var(--color-navy); font-size: 12px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; }
.pv-fiche-id h3 { margin: 0; font-family: var(--font-heading); font-weight: 700; font-size: 34px; line-height: 1.05; letter-spacing: -0.02em; text-transform: uppercase; color: var(--color-white); }
.pv-role { font-size: 14px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--purple-pale, var(--color-purple-pale)); }
.pv-fiche-actions { display: flex; align-items: center; gap: 8px; }
.pv-btn { display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--border-hover); background: var(--surface); color: var(--color-primary); font: inherit; font-size: 15px; font-weight: 700; cursor: pointer; }
.pv-btn:hover { background: var(--blue-light); }
.pv-btn-solid { background: var(--color-primary); border-color: var(--color-primary); color: var(--color-white); }
.pv-btn-solid:hover { background: var(--color-navy); }
.pv-close { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.5); background: transparent; color: var(--color-white); cursor: pointer; }
.pv-close:hover { background: rgba(255, 255, 255, 0.16); }
.pv-close svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; }
.pv-fiche-body { display: flex; flex-wrap: wrap; }
.pv-side { flex: 1 1 300px; display: flex; flex-direction: column; }
.pv-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; padding: 22px 26px; background: color-mix(in srgb, var(--pv-a) 28%, var(--surface)); color: var(--color-navy); }
.pv-stats span { display: block; font-size: 12px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; }
.pv-stats strong { display: block; margin-top: 2px; font-family: var(--font-heading); font-weight: 700; font-size: 21px; }
.pv-side-soft { flex: 1; display: flex; flex-direction: column; gap: 12px; padding: 22px 26px; background: color-mix(in srgb, var(--pv-a) 9%, var(--surface)); }
.pv-side h4, .pv-block h4, .pv-apport h4 { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--color-primary); }
.pv-channels { display: flex; flex-wrap: wrap; gap: 6px; }
.pv-channels span { padding: 5px 10px; border: 1px solid var(--color-primary); font-size: 13px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--color-primary); }
.pv-maturity { display: flex; align-items: center; gap: 10px; }
.pv-dots { display: inline-flex; gap: 5px; }
.pv-dots i { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--color-primary); }
.pv-dots i.on { background: var(--color-primary); }
.pv-bars { display: flex; flex-direction: column; gap: 10px; }
.pv-bars > div > span:first-child { display: flex; justify-content: space-between; margin-bottom: 4px; font-size: 13px; letter-spacing: 0.04em; color: var(--color-navy); }
.pv-bar { display: block; height: 6px; background: var(--surface); }
.pv-bar i { display: block; height: 6px; background: var(--color-primary); }
.pv-main { flex: 999 1 420px; min-width: 0; padding: 28px 32px 32px; display: flex; flex-direction: column; gap: 26px; }
.pv-quote { margin: 0; padding-left: 18px; border-left: 4px solid var(--pv-a); }
.pv-quote p { margin: 0; font-size: 21px; line-height: 1.4; color: var(--color-navy); text-wrap: pretty; }
.pv-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 24px; }
.pv-block { border-top: 1px solid var(--border-hover); padding-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.pv-block p { margin: 0; font-size: 15px; line-height: 1.6; }
.pv-list, .pv-links { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.pv-list li, .pv-links li { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; line-height: 1.45; }
.pv-num { width: 22px; height: 22px; flex: none; display: grid; place-items: center; background: color-mix(in srgb, var(--pv-a) 22%, var(--surface)); color: var(--color-navy); font-size: 11px; font-weight: 700; }
.pv-tag { flex: none; padding: 3px 9px; border-radius: 6px; background: var(--color-primary); color: var(--color-white); font-family: var(--font-heading); font-weight: 700; font-size: 12px; }
.pv-links li { padding: 12px 14px; border-radius: 14px; background: var(--bg); align-items: center; }
.pv-note { margin: 0; font-size: 14px; color: var(--text-2); }
.pv-apport { padding: 18px 22px; background: color-mix(in srgb, var(--pv-a) 22%, var(--surface)); display: flex; flex-direction: column; gap: 8px; }
.pv-apport h4 { color: var(--color-navy); }
.pv-apport p { margin: 0; font-size: 16px; line-height: 1.5; font-weight: 500; color: var(--color-navy); }
.pv-edit-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; padding: 12px 16px; border-radius: 16px; background: var(--tag-info-bg); color: var(--tag-info-text); font-size: 14px; font-weight: 600; }
.pv-intro { margin: 0 0 12px; color: var(--text-2); font-size: 15px; }
.pv-orphan { display: flex; align-items: center; justify-content: space-between; gap: 16px 20px; flex-wrap: wrap; padding: 18px 22px; border-radius: 20px; background: var(--surface); border: 1px solid var(--border-hover); }
.pv-orphan-txt { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.pv-orphan-txt strong { font-size: 16px; }
.pv-orphan-txt span { font-size: 13px; color: var(--text-2); }
.pv-orphan-to { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 14px; font-weight: 600; color: var(--text-2); }
.pv-orphan-to > span { margin-right: 4px; }
.pv-pick { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; border: 0; background: var(--surface); color: var(--color-primary); font: inherit; font-weight: 800; font-size: 12px; box-shadow: 0 0 0 2px var(--pv-a); cursor: pointer; }
.pv-pick:hover { background: var(--color-primary); color: var(--color-white); }
@media (max-width: 900px) { .pv-fiche-id h3 { font-size: 26px; } .pv-main { padding: 22px; } }
.pv-edit { margin-top: 18px; padding: 16px 20px; border-radius: 20px; border: 1px solid var(--border-hover); background: var(--surface); }
.pv-edit > summary { display: inline-flex; list-style: none; cursor: pointer; }
.pv-edit > summary::-webkit-details-marker { display: none; }
.pv-edit[open] > summary { margin-bottom: 8px; }
.pv-edit-note { margin: 0 0 12px; font-size: 14px; color: var(--text-2); }
.amoa-head .amoa-title { border-bottom: 1px solid transparent; }
.amoa-head .amoa-title:hover, .amoa-head .amoa-title:focus-visible { border-bottom-color: var(--text-3); }

/* ── Assistant : bulle repliée par défaut, volet flottant à l'ouverture ───────────────────────────── */
.amoa-res.amoa-split > .amoa-chat { position: fixed; top: 0; right: 0; bottom: 0; z-index: 60; width: min(440px, 100%); min-height: 0; max-height: none; border-radius: 24px 0 0 24px; border: 0; box-shadow: -12px 0 40px rgba(7, 39, 92, 0.22); order: 0; }
.amoa-res.amoa-split > .amoa-chat[hidden] { display: none; }
.amoa-res.amoa-split > .amoa-chat .amoa-chat-log { max-height: none; }
.amoa-chat-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 18px 20px; }
.amoa-chat-close { width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--text-2); cursor: pointer; }
.amoa-chat-close:hover { background: var(--blue-50); color: var(--text-1); }
.amoa-chat-close:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 3px; }
.amoa-assistant-btn[aria-expanded="true"] { background: var(--blue-50); border-color: var(--color-primary); }
.amoa-assistant-bar { position: relative; z-index: 3; display: flex; justify-content: flex-end; margin-bottom: 8px; padding: 0 4px; background: transparent; }
.amoa-assistant-bar .amoa-btn { background: var(--surface); }
.amoa-pop:not([open]) > .amoa-exp-menu { display: none; }
.amoa-validate { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; margin-left: 6px; padding: 0 22px; border: 0; border-radius: 999px; background: var(--color-primary); color: var(--color-white); font: inherit; font-size: 15px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.amoa-validate:hover { background: var(--color-navy); }
.amoa-validate:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 3px; }
.aw-messages:has(.amoa-res .amoa-validate) .aw-next-agent:not(.aw-workflow-done) { display: none; }
details.amoa-pop { display: flex; }
details.amoa-pop > summary { display: inline-flex; }
details.amoa-pop { border: 0; padding: 0; margin: 0; background: transparent; box-shadow: none; }
.cr-header-actions .amoa-btn, .as-actions .amoa-btn { min-height: 44px; }
.cr-header-actions { align-items: center; }
.as-actions:has(.amoa-assistant-btn) { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.amoa-res.amoa-frame { display: flex; flex-direction: column; gap: 16px; }
.amoa-body { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.amoa-title-static { margin: 2px 0 0; font-size: 15px; font-weight: 600; line-height: 1.4; color: var(--text-2); }
.amoa-frame:has(.amoa-validate) .cr-progress { display: none; }
.amoa-frame:has(.amoa-validate) .cr-result-grid { grid-template-columns: minmax(0, 1fr); }
/* PRD : la conversation devient le volet de l'assistant du cadre commun */
#prd-editor div.pe-split { grid-template-columns: minmax(0, 1fr); height: auto; min-height: 420px; }
#prd-editor .pe-chat { position: fixed; top: 0; right: 0; bottom: 0; z-index: 60; width: min(440px, 100%); border-radius: 24px 0 0 24px; border: 0; box-shadow: -12px 0 40px rgba(7, 39, 92, 0.22); }
#prd-editor .pe-chat[hidden] { display: none; }
#prd-editor .pe-chat-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 18px 20px; }
#prd-editor .pe-chat-head .amoa-chat-close { order: 2; margin-left: auto; }
#prd-editor .pe-chat-head h2 { order: 1; font-size: 15px; }
#prd-editor .pe-chat-head p { order: 3; flex: 1 0 100%; }
/* PRD : lecture par parties (sommaire à gauche, une partie à la fois) */
#prd-editor section.pe-paper-pane { background: transparent; border: 0; padding: 0; overflow: visible; }
#prd-editor div.pe-paper-tools { max-width: none; margin: 0 0 12px; padding: 0 4px; }
#prd-editor main.pe-doc { max-width: none; margin: 0; background: transparent; border: 0; border-top: 0; box-shadow: none; border-radius: 0; }
#prd-editor .pe-reader { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 40px; align-items: start; padding: 8px 4px 24px; }
#prd-editor .pe-toc2 { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
#prd-editor .pe-toc2-btn { display: flex; align-items: baseline; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 10px; background: transparent; color: var(--text-2); font: inherit; font-size: 15px; font-weight: 500; text-align: left; cursor: pointer; }
#prd-editor .pe-toc2-btn:hover { background: var(--blue-50); }
#prd-editor .pe-toc2-on { background: var(--blue-light); color: var(--color-navy); font-weight: 700; }
#prd-editor .pe-toc2-n { flex: none; width: 16px; font-size: 12px; font-weight: 700; color: var(--text-3); }
#prd-editor .pe-toc2-t { flex: 1; min-width: 0; line-height: 1.3; }
#prd-editor .pe-toc2-flag { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--tag-warning-text); align-self: center; }
#prd-editor .pe-toc2-subs { display: flex; flex-direction: column; margin: 2px 0 6px 26px; padding-left: 10px; border-left: 2px solid var(--border); }
#prd-editor .pe-toc2-subs button { padding: 5px 8px; border: 0; border-radius: 8px; background: transparent; color: var(--text-2); font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
#prd-editor .pe-toc2-subs button:hover { background: var(--blue-50); color: var(--color-navy); }
#prd-editor .pe-article { min-width: 0; max-width: 900px; display: flex; flex-direction: column; gap: 28px; }
#prd-editor .pe-chapter-head { display: flex; flex-direction: column; gap: 4px; }
#prd-editor .pe-chapter-head span { font-size: 13px; font-weight: 600; color: var(--text-2); }
#prd-editor .pe-chapter-head h2 { margin: 0; font-family: var(--font-heading); font-weight: 700; font-size: 26px; letter-spacing: -0.01em; color: var(--color-navy); }
#prd-editor .pe-article .pe-cover { padding: 0 0 8px; border: 0; }
#prd-editor .pe-article .pe-section { padding: 8px 0 0; border: 0; }
#prd-editor .pe-article .pe-section h3 { display: flex; align-items: baseline; gap: 10px; margin: 0 0 14px; font-size: 19px; font-weight: 700; color: var(--color-navy); }
#prd-editor .pe-article .pe-num { font-size: 13px; font-weight: 700; color: var(--text-3); }
#prd-editor .pe-article .pe-content { font-size: 16px; line-height: 1.6; max-width: 860px; }
#prd-editor .pe-article .pe-content table th { background: transparent; color: var(--color-navy); border: 0; border-bottom: 2px solid var(--border-hover); padding: 8px 12px 8px 0; font-size: 14px; }
#prd-editor .pe-article .pe-content table td { border: 0; border-bottom: 1px solid var(--border); padding: 10px 12px 10px 0; font-size: 15px; }
#prd-editor .pe-cite { color: var(--text-3); font-size: 13px; font-weight: 600; white-space: nowrap; }
#prd-editor .pe-pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 16px; border-top: 1px solid var(--border); }
#prd-editor .pe-pager button { padding: 8px 14px; border: 0; border-radius: 999px; background: transparent; color: var(--color-primary); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
#prd-editor .pe-pager button:hover { background: var(--blue-50); }
#prd-editor .pe-review { margin: 0 16px; border: 1px solid var(--border-hover); border-radius: 16px; background: var(--surface); }
@media (max-width: 1000px) { #prd-editor .pe-reader { grid-template-columns: minmax(0, 1fr); } #prd-editor .pe-toc2 { position: static; } }
.amoa-frame[data-amoa-agent="roadmap"] > .amoa-head { padding: 12px 24px 4px; }
#prd-editor button.pe-toc2-btn.pe-toc2-on { background: var(--tag-info-bg); }
/* Historique : volet à droite (même geste que l'assistant) */
dialog.cr-dialog.cr-history-dialog[open] { position: fixed; inset: 0 0 0 auto; margin: 0 0 0 auto; width: min(460px, 100%); height: 100vh; max-height: none; border: 0; border-radius: 24px 0 0 24px; box-shadow: -12px 0 40px rgba(7, 39, 92, 0.22); }
dialog.cr-history-dialog::backdrop { background: rgba(7, 39, 92, 0.32); }
.cr-history-dialog .cr-dialog-form { padding: 28px; }
.cr-history-dialog .cr-dialog-form > header h2 { font-family: var(--font-heading); font-weight: 700; font-size: 22px; color: var(--color-navy); }
.cr-history-row { padding: 14px 12px; border: 0; border-radius: 14px; }
.cr-history-row:hover { background: var(--blue-50); }
.cr-history-info strong { font-size: 16px; }
.cr-history-info > span { font-size: 14px; }
/* PRD : éléments de revue présentés comme des décisions */
#prd-editor .pe-decision { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; margin: 0 0 10px; border: 1px solid var(--border-hover); border-left-width: 4px; border-radius: 14px; background: var(--surface); }
#prd-editor .pe-decision.pe-sev-blocking { border-left-color: var(--color-error); }
#prd-editor .pe-decision.pe-sev-arbitration { border-left-color: var(--color-warning); }
#prd-editor .pe-decision.pe-sev-information { border-left-color: var(--color-primary); }
#prd-editor .pe-sev { align-self: flex-start; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--tag-info-bg); color: var(--tag-info-text); }
#prd-editor .pe-sev-blocking .pe-sev { background: var(--tag-error-bg); color: var(--tag-error-text); }
#prd-editor .pe-sev-arbitration .pe-sev { background: var(--tag-warning-bg); color: var(--tag-warning-text); }
#prd-editor .pe-decision b { font-size: 15px; color: var(--color-navy); }
#prd-editor .pe-decision p { margin: 0; font-size: 14px; color: var(--text-2); }
.cr-history-dialog .cr-history-row { flex-wrap: wrap; gap: 10px 14px; }
.cr-history-dialog .cr-history-info { flex: 1 1 100%; }
.cr-history-dialog .cr-history-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Le bouton de repli reste visible sur le fond sombre Neo. */
html[data-theme="dark"] .neo-rail-toggle { color: var(--text-1); }

/* Le défilement est porté par le fil des étapes, jamais par les commandes démo. */
.aw-steps-strip { overflow: hidden; }
