/* ═══════════════════════════════════════════════════════════════
   APHP — Analyse DSF   |   Design System
   ══════════════════════════════════════════════════════════════ */

:root {
  --blue-900: #001f5c;
  --blue-800: #003DA6;
  --blue-700: #0055c8;
  --blue-600: #1a6fe0;
  --blue-100: #dbeafe;
  --blue-50:  #eff6ff;

  /* ── Couleurs de mode (valeurs par défaut — écrasées par loadModeColors() dans app.js) ── */
  --sim-primary: #15803d;  /* green-700 — AA : blanc 5.02:1 (était #16a34a → 3.30:1) */
  --sim-bg:      #dcfce7;
  --sim-text:    #14532d;
  --sim-border:  #86efac;

  --real-primary: #dc2626;
  --real-bg:      #fee2e2;
  --real-text:    #7f1d1d;
  --real-border:  #fecaca;

  /* Variables actives (mode Réel par défaut) */
  --mode-primary: var(--real-primary);
  --mode-bg:      var(--real-bg);
  --mode-text:    var(--real-text);
  --mode-border:  var(--real-border);

  --orange:  #e67e22;
  --green:   #15803d;  /* green-700 — AA : blanc/sur blanc 5.02:1 (était #27ae60 → 2.89:1) */
  --purple:  #8e44ad;
  --red:     #e74c3c;
  --grey-50: #f8fafc;
  --grey-100:#f1f5f9;
  --grey-200:#e2e8f0;
  --grey-300:#cbd5e1;
  --grey-400:#94a3b8;
  --grey-600:#475569;
  --grey-700:#334155;
  --grey-900:#0f172a;

  --sidebar-w: 280px;
  --header-h:  60px;
  --exec-banner-h: 44px;   /* hauteur du bandeau Simulation/Réel (au-dessus du header) */
  --radius:    8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
  --shadow:    0 4px 12px rgba(0,0,0,.1);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.15);
  --transition: .2s ease;
}

/* ── Accessibilité (RGAA) ── */
.skip-link {
  position: absolute;
  left: 8px;
  top: -48px;
  z-index: 10000;
  padding: 10px 16px;
  background: var(--blue-800);
  color: #fff;
  font-weight: 600;
  border-radius: 0 0 8px 8px;
  text-decoration: none;
  transition: top .15s ease;
}
.skip-link:focus { top: 0; }

/* Indicateur de focus visible au clavier (n'affecte pas le clic souris) */
*:focus-visible {
  outline: 2px solid var(--blue-700) !important;
  outline-offset: 2px !important;
  border-radius: 3px;
}

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Mode Simulation : bascule des variables actives ── */
body[data-exec-mode="simulation"] {
  --mode-primary: var(--sim-primary);
  --mode-bg:      var(--sim-bg);
  --mode-text:    var(--sim-text);
  --mode-border:  var(--sim-border);
}

/* Stripe de 4 px en haut de la page pour indiquer le mode courant */
#modeStripe {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: var(--mode-primary);
  z-index: 9999;
  pointer-events: none;
  transition: background 0.3s ease;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: 'Segoe UI', system-ui, sans-serif; font-size: 14px; color: var(--grey-900); background: var(--grey-100); }
button { cursor: pointer; font-family: inherit; font-size: 14px; }
input, select, textarea { font-family: inherit; font-size: 14px; }
.hidden { display: none !important; }

/* ── Header ── */
.header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--header-h);
  background: var(--blue-800);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.header-brand { display: flex; align-items: center; gap: 14px; }
.header-logo { display: flex; align-items: center; }
.header-title-main { color: #fff; font-size: 16px; font-weight: 600; display: block; line-height: 1.2; }
.header-title-societe {
  display: inline-block;
  margin-left: 10px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
  color: #fff;
  background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 999px;
  vertical-align: middle;
  white-space: nowrap;
}
.header-title-societe:empty { display: none; }
.header-title-sub  { color: rgba(255,255,255,.65); font-size: 11px; display: block; }
.header-logo { border-radius: 8px; transition: opacity var(--transition), transform var(--transition); }
.header-logo:hover { opacity: .85; transform: scale(1.05); }
.header-status { display: flex; align-items: center; gap: 8px; color: rgba(255,255,255,.85); font-size: 12px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--grey-400); transition: background var(--transition); flex-shrink: 0; }
.status-dot.ok    { background: #4ade80; }
.status-dot.error { background: #f87171; }
.status-dot.mock  { background: #fbbf24; }
.provider-select {
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 6px;
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 8px;
  cursor: pointer;
  outline: none;
  transition: background var(--transition), border-color var(--transition);
  max-width: 160px;
}
.provider-select:hover:not(:disabled)  { background: rgba(255,255,255,.2); border-color: rgba(255,255,255,.4); }
.provider-select:focus                  { border-color: rgba(255,255,255,.6); }
.provider-select:disabled               { opacity: .55; cursor: default; }
.provider-select option                 { background: #1a3a6e; color: #fff; }
.status-diag-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,.7);
  font-size: 14px;
  padding: 2px 4px;
  cursor: pointer;
  border-radius: 4px;
  transition: color var(--transition), background var(--transition);
  line-height: 1;
}
.status-diag-btn:hover { color: #fff; background: rgba(255,255,255,.15); }

/* ── Layout ── */
.layout {
  display: flex;
  height: 100vh;
  padding-top: var(--header-h);
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  min-width: 200px;
  max-width: 600px;
  flex-shrink: 0;
  background: #1a2b4e;
  color: #c8d8f0;
  display: flex; flex-direction: column;
  overflow: hidden;
  border-right: none; /* bordure portée par la poignée */
}

/* Poignée de redimensionnement de la sidebar */
.sidebar-resize-handle {
  width: 5px;
  flex-shrink: 0;
  cursor: col-resize;
  background: rgba(255,255,255,.06);
  transition: background .15s;
  position: relative;
}
.sidebar-resize-handle::after {
  content: '';
  position: absolute;
  inset: 0;
  width: 1px;
  margin: 0 auto;
  background: rgba(255,255,255,.12);
  transition: width .15s, background .15s;
}
.sidebar-resize-handle:hover::after,
.sidebar-resize-handle.dragging::after {
  width: 3px;
  background: #3b82f6;
}
nav.tree { flex: 1; overflow-y: auto; min-height: 0; }
nav.tree::-webkit-scrollbar { width: 4px; }
nav.tree::-webkit-scrollbar-track { background: transparent; }
nav.tree::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 2px; }

.sidebar-header {
  padding: 16px 16px 12px;
  font-size: 11px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: rgba(200,216,240,.5);
  display: flex; align-items: center; gap: 8px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.tree-loading { padding: 20px 16px; color: rgba(200,216,240,.4); font-size: 12px; }
.folder-has-children-msg {
  padding: 32px 20px; text-align: center;
  color: var(--mid); font-size: 14px; line-height: 1.7;
  border: 2px dashed var(--grey-200); border-radius: 8px;
  margin-top: 12px;
}
.tree-auth-required {
  padding: 20px 16px; font-size: 12px; line-height: 1.6;
  color: rgba(200,216,240,.6); text-align: center;
}

/* Tree nodes */
.tree-chantier   { border-bottom: 1px solid rgba(255,255,255,.05); }
.tree-node       { display: flex; align-items: center; gap: 8px; padding: 9px 16px; cursor: pointer; transition: background var(--transition); user-select: none; }
.tree-node:hover { background: rgba(255,255,255,.07); }
.tree-node.active { background: var(--blue-800) !important; color: #fff; }
.tree-node .chevron { font-size: 10px; transition: transform var(--transition); color: rgba(255,255,255,.35); min-width: 10px; }
.tree-node.open .chevron { transform: rotate(90deg); }
.tree-node .icon { font-size: 14px; min-width: 18px; }

.tree-level-0 { font-weight: 700; font-size: 13px; color: #dce9ff; padding-left: 12px; }
.tree-level-1 { font-weight: 600; font-size: 12.5px; color: #c4d8f4; padding-left: 24px; }
.tree-level-2 { font-size: 12px; color: #afc4e8; padding-left: 38px; }
.tree-level-3 { font-size: 12px; color: #8aaad4; padding-left: 54px; }
.tree-level-3:hover { background: rgba(255,255,255,.05); color: #c8d8f0; }
.tree-level-3.active { background: var(--blue-700) !important; color: #fff; }

.tree-children { overflow: hidden; max-height: 0; transition: max-height .25s ease; }
.tree-children.open { max-height: 4000px; }

/* ── Main ── */
/* position: relative → fait de .main un bloc conteneur : les descendants en
   position:absolute (ex. <caption class="sr-only"> des tableaux a11y) sont
   clippés par son overflow au lieu d'échapper vers le html et de gonfler
   documentElement.scrollHeight (scroll fantôme = bas de page non fixe). */
.main { flex: 1; overflow-y: auto; padding: 28px; position: relative; }

/* ── Manuel d'utilisation ─────────────────────────────────────── */
.welcome {
  max-width: 900px;
  margin: 0 auto;
  padding-bottom: 48px;
}

/* Hero */
.manual-hero {
  background: linear-gradient(135deg, var(--blue-900) 0%, var(--blue-700) 100%);
  border-radius: var(--radius-lg);
  padding: 36px 40px;
  color: white;
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
}
.manual-hero::after {
  content: '';
  position: absolute; top: -40px; right: -40px;
  width: 200px; height: 200px;
  background: rgba(255,255,255,.05);
  border-radius: 50%;
}
.manual-hero-top { display: flex; align-items: center; gap: 18px; margin-bottom: 20px; }
.manual-hero-icon { font-size: 48px; flex-shrink: 0; }
.manual-hero h1 { font-size: 22px; font-weight: 700; line-height: 1.3; }
.manual-hero-sub { font-size: 13px; opacity: .8; margin-top: 4px; }
.manual-steps {
  display: flex; gap: 10px; flex-wrap: wrap;
}
.manual-step {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 12px; font-weight: 500;
}
.manual-step-num {
  width: 20px; height: 20px; border-radius: 50%;
  background: rgba(255,255,255,.25);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; flex-shrink: 0;
}

/* Sections */
.manual-section {
  background: white;
  border: 1px solid var(--grey-200);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.manual-section-header {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px;
  background: var(--grey-50);
  border-bottom: 1px solid var(--grey-200);
  cursor: pointer;
  user-select: none;
  transition: background var(--transition);
}
.manual-section-header:hover { background: var(--grey-100); }
.manual-section-icon { font-size: 20px; flex-shrink: 0; }
.manual-section-title { flex: 1; font-size: 14px; font-weight: 700; color: var(--grey-900); }
.manual-section-chevron {
  font-size: 11px; color: #64748b;
  transition: transform .2s; flex-shrink: 0;
}
.manual-section.open .manual-section-chevron { transform: rotate(90deg); }
.manual-section-body {
  padding: 20px;
  display: none;
  font-size: 13px; line-height: 1.7; color: var(--grey-700);
}
.manual-section.open .manual-section-body { display: block; }

/* Contenu interne */
.manual-p { margin-bottom: 12px; }
.manual-p:last-child { margin-bottom: 0; }
.manual-sub-title { font-size: 0.95rem; font-weight: 700; color: var(--primary); margin: 18px 0 6px; }

.manual-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin: 14px 0;
}
.manual-card {
  background: var(--grey-50);
  border: 1px solid var(--grey-200);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.manual-card-icon { font-size: 24px; margin-bottom: 8px; }
.manual-card-title { font-size: 13px; font-weight: 700; color: var(--grey-900); margin-bottom: 4px; }
.manual-card-desc { font-size: 12px; color: var(--grey-600); line-height: 1.5; }

.manual-table {
  width: 100%; border-collapse: collapse;
  margin: 14px 0; font-size: 12.5px;
}
.manual-table th {
  background: var(--blue-800); color: white;
  padding: 9px 12px; text-align: left; font-weight: 600;
}
.manual-table td { padding: 8px 12px; border-bottom: 1px solid var(--grey-200); vertical-align: middle; }
.manual-table tr:last-child td { border-bottom: none; }
.manual-table tr:hover td { background: var(--grey-50); }
.manual-table .center { text-align: center; }

.manual-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 600;
}
.badge-admin  { background: #fff3cd; color: #856404; }
.badge-editor { background: #e2f0fb; color: #1a6aa1; }
.badge-reader { background: #e8f5e9; color: #2e7d32; }

.manual-filepath {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--grey-900); color: #a5f3fc;
  padding: 2px 10px; border-radius: 4px;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 12px;
}
.manual-filepath-block {
  background: var(--grey-900); color: #a5f3fc;
  padding: 12px 16px; border-radius: var(--radius);
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 12px; line-height: 1.8;
  margin: 10px 0;
}
.manual-filepath-block span { color: #64748b; }

.manual-tip {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--blue-50); border: 1px solid var(--blue-100);
  border-left: 4px solid var(--blue-700);
  border-radius: var(--radius); padding: 12px 14px;
  font-size: 12.5px; color: var(--grey-700);
  margin: 12px 0;
}
.manual-tip-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }

.manual-warn {
  display: flex; gap: 10px; align-items: flex-start;
  background: #fff7ed; border: 1px solid #fed7aa;
  border-left: 4px solid var(--orange);
  border-radius: var(--radius); padding: 12px 14px;
  font-size: 12.5px; color: #92400e;
  margin: 12px 0;
}

.manual-security-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid var(--grey-100);
}
.manual-security-item:last-child { border-bottom: none; }
.manual-security-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--green); flex-shrink: 0; margin-top: 6px;
}
.manual-security-label { font-weight: 600; color: var(--grey-900); font-size: 13px; }
.manual-security-desc { font-size: 12px; color: var(--grey-600); margin-top: 2px; }

.manual-check { color: var(--green); font-weight: 700; }
.manual-cross  { color: var(--red);  font-weight: 700; }
.manual-partial { color: var(--orange); font-weight: 700; }

.manual-download-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px;
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.35);
  border-radius: var(--radius);
  color: white; font-size: 13px; font-weight: 600;
  cursor: pointer; flex-shrink: 0;
  transition: background var(--transition);
}
.manual-download-btn:hover { background: rgba(255,255,255,.25); }

.manual-tag {
  display: inline-block; padding: 1px 8px;
  background: var(--grey-100); color: var(--grey-700);
  border-radius: 4px; font-size: 11px; font-weight: 600;
  border: 1px solid var(--grey-200);
}

/* Responsive manual */
@media (max-width: 768px) {
  .manual-hero { padding: 24px 18px; margin-bottom: 16px; }
  .manual-hero h1 { font-size: 17px; }
  .manual-hero-icon { font-size: 36px; }
  .manual-steps { gap: 8px; }
  .manual-step { font-size: 11px; padding: 5px 10px; }
  .manual-section-body { padding: 14px; }
  .manual-grid { grid-template-columns: 1fr; }
  .manual-table { font-size: 11.5px; }
  .manual-table th, .manual-table td { padding: 7px 8px; }
  .manual-filepath-block { font-size: 11px; padding: 10px 12px; }
}

/* ── Impression PDF du manuel ─────────────────────────────── */
@media print {
  /* Masquer tout sauf le manuel */
  .header, .sidebar, .sidebar-overlay, .sidebar-resize-handle,
  #folderView, #docView, .loading-overlay, .toast,
  .modal-overlay, #hamburger { display: none !important; }

  /* Réinitialiser le layout */
  body  { background: white; }
  .layout { display: block; padding-top: 0; }
  .main   { overflow: visible; padding: 0; }
  .welcome { max-width: none; padding: 0; margin: 0; }

  /* Forcer l'ouverture de toutes les sections */
  .manual-section-body    { display: block !important; }
  .manual-section-chevron { display: none !important; }
  .manual-section-header  { cursor: default; pointer-events: none; background: #f1f5f9 !important; }

  /* Saut de page avant chaque section */
  .manual-section { break-inside: avoid; page-break-inside: avoid; margin-bottom: 18px; border: 1px solid #cbd5e1 !important; box-shadow: none !important; }

  /* Masquer le bouton téléchargement lui-même */
  .manual-download-btn { display: none !important; }

  /* En-tête de page imprimée */
  .manual-hero {
    background: #001f5c !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    border-radius: 0 !important;
    margin-bottom: 14px;
  }
  .manual-table th {
    background: #003DA6 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .manual-security-dot { background: #27ae60 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .manual-tip  { background: #eff6ff !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .manual-warn { background: #fff7ed !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }

  /* Mise en page — marges zéro pour supprimer l'en-tête/pied de page navigateur */
  @page {
    margin: 12mm 15mm;
    size: A4;
    /* Suppression des numéros de page navigateur (Chrome/Edge/Firefox supportés) */
    @top-center   { content: none; }
    @bottom-center { content: none; }
    @top-left     { content: none; }
    @top-right    { content: none; }
    @bottom-left  { content: none; }
    @bottom-right { content: none; }
  }
}

/* ── Welcome steps (kept for compatibility) ── */
.welcome-steps { text-align: left; display: flex; flex-direction: column; gap: 12px; }
.step { display: flex; align-items: flex-start; gap: 12px; }
.step-num {
  min-width: 26px; height: 26px; border-radius: 50%;
  background: var(--blue-800); color: white;
  font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* ── Breadcrumb ── */
.breadcrumb {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
  font-size: 12px; color: var(--grey-600); margin-bottom: 20px;
}
.breadcrumb-item { color: var(--blue-800); cursor: pointer; }
.breadcrumb-item:hover { text-decoration: underline; }
.breadcrumb-sep { color: var(--grey-300); }
.breadcrumb-current { color: var(--grey-700); font-weight: 500; }

/* ── Folder view ── */
.folder-view { max-width: 860px; }
.folder-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.folder-header h1, .folder-header h2 { font-size: 20px; font-weight: 600; }

.drop-zone {
  border: 2px dashed var(--grey-300);
  border-radius: var(--radius-lg);
  padding: 32px;
  text-align: center;
  margin-bottom: 24px;
  transition: all var(--transition);
  background: white;
}
.drop-zone.dragover { border-color: var(--blue-700); background: var(--blue-50); }
.drop-zone-icon { font-size: 36px; margin-bottom: 10px; }
.drop-zone p { color: var(--grey-600); margin-bottom: 4px; }
.drop-hint { font-size: 12px; color: #64748b !important; }

/* Document list */
.doc-list { display: flex; flex-direction: column; gap: 10px; }
.doc-list-empty { text-align: center; color: #64748b; padding: 32px; }
.doc-card {
  background: white;
  border: 1px solid var(--grey-200);
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex; align-items: center; gap: 14px;
  cursor: pointer; transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}
.doc-card:hover { border-color: var(--blue-600); box-shadow: 0 0 0 2px var(--blue-100); transform: translateY(-1px); }
.doc-card-icon { font-size: 28px; min-width: 36px; text-align: center; }
.doc-card-info { flex: 1; min-width: 0; }
.doc-card-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-card-meta { font-size: 11px; color: var(--grey-500); margin-top: 3px; }
.doc-card-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 99px; font-size: 10px; font-weight: 600;
}
.badge-done         { background: #dcfce7; color: #166534; }
/* Présent au référentiel partagé (importé via agent / React), pas dans documents.json */
.badge-ref          { background: #ecfeff; color: #0e7490; outline: 1.5px solid #67e8f9; }
.badge-none         { background: var(--grey-100); color: var(--grey-500); }
.badge-error        { background: #fee2e2; color: #991b1b; }
.badge-val-valide   { background: #dcfce7; color: #15803d; outline: 1.5px solid #86efac; }
.badge-val-modifie  { background: #fff7ed; color: #c2410c; outline: 1.5px solid #fdba74; }
.badge-dsf-general  { background: #eff6ff; color: #1d4ed8; }
.doc-card-actions { display: flex; gap: 6px; }

/* ── Document detail ── */
.doc-view { max-width: 960px; }
.doc-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 24px; gap: 16px; }
.doc-header-left { display: flex; gap: 14px; align-items: flex-start; }
.doc-header-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.doc-icon { font-size: 40px; line-height: 1; }
.doc-header h1, .doc-header h2 { font-size: 18px; font-weight: 600; word-break: break-word; }
.doc-header p  { font-size: 12px; color: var(--grey-500); margin-top: 4px; }

/* ── DSF mode selector ── */
.dsf-mode-bar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 8px 12px;
  background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 6px;
  font-size: 12px;
}
.dsf-mode-label { font-weight: 700; color: #475569; white-space: nowrap; }
.dsf-mode-radio { display: flex; align-items: center; gap: 5px; cursor: pointer; color: #334155; font-weight: 500; }
.dsf-mode-radio input { cursor: pointer; accent-color: #1e40af; }
.dsf-analyze-status { font-size: 11px; color: #15803d; font-style: italic; }
.dsf-analyze-status.error { color: #dc2626; }

/* ── Extraction panel ── */
.extraction-panel {
  background: white;
  border: 1px solid var(--grey-200);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}
.extraction-title { font-size: 13px; font-weight: 600; color: var(--grey-700); margin-bottom: 16px; text-transform: uppercase; letter-spacing: .05em; }
.extraction-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.ext-btn {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 16px 20px;
  background: var(--grey-50); border: 2px solid var(--grey-200);
  border-radius: var(--radius);
  min-width: 120px; transition: all var(--transition);
  position: relative;
}
.ext-btn:hover        { border-color: var(--blue-700); background: var(--blue-50); transform: translateY(-2px); box-shadow: var(--shadow); }
.ext-btn:disabled     { opacity: .5; cursor: not-allowed; transform: none; pointer-events: none; }
.ext-btn[data-type="resume"]:hover       { border-color: var(--blue-700); }
.ext-btn[data-type="incoherences"]:hover { border-color: var(--orange); }
.ext-btn[data-type="exigences"]:hover    { border-color: var(--green); }
.ext-btn[data-type="tests"]:hover        { border-color: var(--purple); }
.ext-btn[data-type="genr"]:hover         { border-color: #0891b2; background: #ecfeff; }
.ext-icon  { font-size: 26px; }
.ext-label { font-size: 12px; font-weight: 600; color: var(--grey-700); }
.ext-badge {
  position: absolute; top: 8px; right: 8px;
  width: 10px; height: 10px; border-radius: 50%;
  display: none;
}
.ext-badge.done  { display: block; background: var(--green); }
.ext-badge.error { display: block; background: var(--red); }

/* ── Carte « Détection auto » — même gabarit que les boutons d'extraction,
      mais avec un badge texte (type détecté : FSD/BRD/…) et des états couleur. */
.ext-btn-detect { cursor: pointer; }
.ext-btn-detect:hover { border-color: #0891b2; background: #ecfeff; }
.ext-btn-detect .ext-icon { animation: none; }
.ext-btn-detect.ext-detect-loading .ext-icon { animation: ext-detect-spin 1s linear infinite; }
@keyframes ext-detect-spin { to { transform: rotate(360deg); } }
/* Le badge de la carte détection affiche du texte (≠ point 10px des autres) */
#badge-detect {
  display: block; position: absolute; top: 6px; right: 6px;
  width: auto; height: auto; border-radius: 9px;
  padding: 1px 7px; font-size: 9px; font-weight: 700; line-height: 1.4;
  color: #fff; background: var(--grey-400); letter-spacing: .3px;
  max-width: 70px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ext-btn-detect.ext-detect-loading #badge-detect { background: var(--grey-400); }
.ext-btn-detect.ext-detect-ok    { border-color: var(--green); }
.ext-btn-detect.ext-detect-ok    #badge-detect { background: var(--green); }
.ext-btn-detect.ext-detect-warn  { border-color: var(--orange); background: #fff7ed; }
.ext-btn-detect.ext-detect-warn  #badge-detect { background: var(--orange); }
.ext-btn-detect.ext-detect-error { border-color: var(--red); }
.ext-btn-detect.ext-detect-error #badge-detect { background: var(--red); }

.ext-note { font-size: 11px; color: #64748b; margin-top: 14px; }
.genr-textarea { resize: vertical; min-height: 120px; }
.genr-eden-note {
  display: flex; gap: 8px; align-items: flex-start;
  padding: 10px 12px; margin-top: 12px;
  background: #fef3c7; border: 1px solid #fcd34d; border-radius: var(--radius);
  font-size: 12px; color: #78350f;
}

/* ── Results panel ── */
.results-panel {
  background: white;
  border: 1px solid var(--grey-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.results-tabs {
  display: flex;
  border-bottom: 1px solid var(--grey-200);
  background: var(--grey-50);
  overflow-x: auto;
}
.tab-btn {
  padding: 12px 18px; border: none; background: none;
  font-size: 13px; font-weight: 500; color: var(--grey-600);
  border-bottom: 3px solid transparent;
  white-space: nowrap; transition: all var(--transition);
}
.tab-btn:hover  { color: var(--blue-800); background: var(--grey-100); }
.tab-btn.active { color: var(--blue-800); border-bottom-color: var(--blue-800); background: white; font-weight: 600; }

.results-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--grey-100);
  background: var(--grey-50);
  font-size: 11px;
}
.results-date { color: var(--grey-500); }
.results-actions-bar { display: flex; gap: 8px; align-items: center; }

/* ── Menu déroulant Export ─────────────────────────────────────────── */
.export-dropdown { position: relative; }
.export-dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 200;
  background: #fff; border: 1px solid var(--grey-200); border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0,0,0,.12);
  min-width: 200px; padding: 6px 0; white-space: nowrap;
}
.export-menu-item {
  display: block; width: 100%; text-align: left;
  padding: 8px 16px; border: none; background: none;
  font-size: 13px; color: var(--grey-700); cursor: pointer;
}
.export-menu-item:hover { background: var(--grey-50); color: var(--blue-800); }
.export-menu-sep { border-top: 1px solid var(--grey-200); margin: 4px 0; }
.export-menu-label {
  padding: 4px 16px 2px;
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  color: #64748b; letter-spacing: .05em;
}

/* Pas de hauteur max ni d'overflow interne : le contenu coule dans le
   défilement unique de .main. Un max-height + overflow-y créait un ascenseur
   imbriqué (scroll dans le scroll) → navigation piégée / « page qui se divise ». */
.results-content {
  padding: 24px;
  min-height: 200px;
  font-size: 13.5px;
  line-height: 1.75;
}
.results-content::-webkit-scrollbar { width: 6px; }
.results-content::-webkit-scrollbar-track { background: transparent; }
.results-content::-webkit-scrollbar-thumb { background: var(--grey-200); border-radius: 3px; }

.no-result { text-align: center; color: #64748b; padding: 40px 20px; }
.no-result p { margin-bottom: 8px; }

/* Zone d'édition manuelle des exigences */
.exigences-edit-area {
  width: 100%;
  min-height: 420px;
  padding: 16px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 12.5px;
  line-height: 1.7;
  border: 2px solid #0369a1;
  border-radius: 6px;
  resize: vertical;
  box-sizing: border-box;
  color: #1e293b;
  background: #f8faff;
  outline: none;
  transition: border-color .15s, background .15s;
}
.exigences-edit-area:focus {
  border-color: #003DA6;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(0,61,166,.08);
}

/* Markdown output styling */
.md-output h1 { font-size: 18px; font-weight: 700; margin: 20px 0 12px; color: var(--blue-900); border-bottom: 2px solid var(--blue-100); padding-bottom: 6px; }
.md-output h2 { font-size: 16px; font-weight: 700; margin: 18px 0 10px; color: var(--blue-800); }
.md-output h3 { font-size: 14px; font-weight: 600; margin: 14px 0 8px; color: var(--grey-800); }
.md-output p  { margin-bottom: 10px; }
.md-output ul, .md-output ol { padding-left: 20px; margin-bottom: 10px; }
.md-output li { margin-bottom: 4px; }
.md-output strong { font-weight: 700; color: var(--grey-900); }
.md-output em { font-style: italic; color: var(--grey-700); }
.md-output code {
  background: var(--grey-100); padding: 1px 6px; border-radius: 4px;
  font-family: 'Consolas', 'Courier New', monospace; font-size: 12.5px;
  color: #c0392b;
}
.md-output pre { background: var(--grey-900); color: #e2e8f0; padding: 16px; border-radius: var(--radius); overflow-x: auto; margin-bottom: 12px; }
.md-output pre code { background: none; color: inherit; padding: 0; font-size: 12px; }
.md-output table { width: 100%; border-collapse: collapse; margin-bottom: 14px; font-size: 12.5px; }
.md-output th { background: var(--blue-800); color: white; padding: 8px 12px; text-align: left; font-weight: 600; }
.md-output td { padding: 7px 12px; border-bottom: 1px solid var(--grey-200); }
.md-output tr:hover td { background: var(--grey-50); }
.md-output blockquote { border-left: 4px solid var(--blue-300, #93c5fd); background: var(--blue-50); padding: 10px 16px; margin: 10px 0; border-radius: 0 6px 6px 0; color: var(--grey-700); }
.md-output hr { border: none; border-top: 1px solid var(--grey-200); margin: 16px 0; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius);
  font-weight: 500; border: none; transition: all var(--transition);
}
.btn-primary  { background: var(--blue-800); color: white; }
.btn-primary:hover  { background: var(--blue-700); }
.btn-ghost    { background: transparent; border: 1px solid var(--grey-300); color: var(--grey-700); }
.btn-ghost:hover    { background: var(--grey-100); }
.btn-danger   { background: var(--red); color: white; }
.btn-danger:hover   { background: #c0392b; }
.btn-sm       { padding: 5px 12px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Modals ── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal, .modal-box {
  background: white; border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%; max-width: 500px;
  animation: modalIn .2s ease;
  max-height: 90vh; display: flex; flex-direction: column;
}
.modal-sm { max-width: 380px; }
@keyframes modalIn { from { opacity: 0; transform: translateY(-16px) scale(.97); } to { opacity: 1; transform: none; } }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--grey-200); flex-shrink: 0; }
.modal-header h2, .modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 18px; color: #64748b; line-height: 1; }
.modal-close:hover { color: var(--grey-700); }
.modal-body   { padding: 20px; overflow-y: auto; flex: 1; min-height: 0; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 20px; border-top: 1px solid var(--grey-200); flex-shrink: 0; }

/* Format de sortie configurable — composants pc- */
.pc-section { border: 1px solid #e2e8f0; border-radius: 8px; margin-bottom: 12px; overflow: hidden; }
.pc-section-title { font-size: 13px; font-weight: 700; color: #1e293b; padding: 10px 14px; background: #f8fafc; cursor: pointer; list-style: none; user-select: none; }
.pc-section-title::-webkit-details-marker { display: none; }
.pc-section-title::before { content: '▸ '; font-size: 11px; color: #64748b; }
details.pc-section[open] > .pc-section-title::before { content: '▾ '; }
details.pc-section > *:not(summary) { padding: 14px; }
.pc-field   { margin-bottom: 1.25rem; }
.pc-field:last-child { margin-bottom: 0; }
.pc-label   { display: block; font-size: 13px; font-weight: 600; color: #475569; margin-bottom: 6px; }
.pc-textarea { width: 100%; min-height: 80px; padding: 8px 10px; font-size: 13px; border: 1px solid #e2e8f0; border-radius: 6px; resize: vertical; font-family: inherit; box-sizing: border-box; }
.pc-input   { width: 100%; padding: 7px 10px; font-size: 13px; border: 1px solid #e2e8f0; border-radius: 6px; font-family: inherit; box-sizing: border-box; }
.pc-code    { font-family: monospace; }
.pc-tags    { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.pc-tag-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.pc-tag     { display: inline-flex; align-items: center; gap: 6px; background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 6px; padding: 4px 10px; font-size: 13px; }
.pc-tag-row { display: flex; align-items: flex-start; gap: 8px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 6px; padding: 6px 10px; font-size: 13px; }
.pc-tag-idx  { min-width: 22px; font-weight: 700; color: #64748b; flex-shrink: 0; }
.pc-tag-text { flex: 1; line-height: 1.5; }
.pc-tag-card { display: flex; flex-direction: column; gap: 4px; background: #fefce8; border: 1px solid #fde68a; border-radius: 8px; padding: 10px 12px; font-size: 13px; }
.pc-tag-card-header { display: flex; justify-content: space-between; align-items: center; }
.pc-tag-del { cursor: pointer; color: #64748b; font-size: 13px; line-height: 1; pointer-events: auto; flex-shrink: 0; }
.pc-tag-del:hover { color: #e74c3c; }
.pc-add-row { display: flex; gap: 6px; align-items: center; margin-top: 4px; }
.pc-add-card { align-items: flex-start; }
.pc-add-input { flex: 1; padding: 6px 10px; font-size: 13px; border: 1px solid #e2e8f0; border-radius: 6px; }
.pc-add-btn { padding: 6px 14px; font-size: 18px; font-weight: 700; background: #003DA6; color: #fff; border: none; border-radius: 6px; cursor: pointer; line-height: 1; flex-shrink: 0; }
.pc-add-btn:hover { background: #1e3a8a; }

/* Preset « DSF Fonctionnel (non-SAP) » dans le modal Format de sortie */
.pc-preset-box { margin-top: 12px; padding: 12px; border: 1px dashed #f59e0b; border-radius: 8px; background: #fffbeb; }
.pc-preset-btn { font-size: 14px; padding: 8px 14px; background: #b45309; }
.pc-preset-btn:hover { background: #92400e; }

/* Upload modal */
.upload-drop {
  border: 2px dashed var(--grey-300); border-radius: var(--radius);
  padding: 32px; text-align: center; transition: all var(--transition);
}
.upload-drop.dragover { border-color: var(--blue-700); background: var(--blue-50); }
.upload-drop-icon { font-size: 40px; margin-bottom: 12px; }
.upload-drop p { color: var(--grey-600); margin-bottom: 8px; }
.file-preview {
  display: flex; align-items: center; gap: 12px;
  background: var(--grey-50); border-radius: var(--radius);
  padding: 12px; margin-top: 12px; border: 1px solid var(--grey-200);
}
.file-preview-icon { font-size: 26px; }
.file-preview div  { flex: 1; min-width: 0; }
.file-preview strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-preview span   { font-size: 11px; color: var(--grey-500); }

/* ── Loading overlay ── */
.loading-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
}
.loading-card {
  background: white; border-radius: var(--radius-lg); padding: 36px 48px;
  text-align: center; box-shadow: var(--shadow-lg); min-width: 280px;
}
.spinner {
  width: 44px; height: 44px;
  border: 4px solid var(--grey-200);
  border-top-color: var(--blue-800);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 18px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-card p      { font-weight: 600; font-size: 15px; color: var(--grey-900); margin-bottom: 6px; }
.loading-sub         { font-size: 12px; color: var(--grey-500); font-weight: 400 !important; }

/* ── Prompt source (société custom vs disque standard) ── */
.loading-prompt-source {
  display: flex; align-items: flex-start; gap: 8px;
  text-align: left;
  margin: 10px 0 4px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px; font-weight: 500; line-height: 1.4;
  background: #f1f5f9; color: #475569;
  border: 1px solid #e2e8f0;
}
.loading-prompt-source.is-societe {
  background: #eef2ff; color: #3730a3; border-color: #c7d2fe;
}
.loading-prompt-source .lps-icon { flex-shrink: 0; font-size: 14px; line-height: 1.4; }
.loading-prompt-source .lps-title { font-weight: 700; }
.loading-prompt-source .lps-sub   { display: block; font-weight: 400; opacity: .8; margin-top: 1px; }

/* ── Stepper de progression extraction ── */
.loading-steps-container {
  text-align: left;
  margin: 14px 0 6px;
  min-width: 300px;
}
.loading-steps-list { display: flex; flex-direction: column; gap: 2px; }
.loading-step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 5px 0;
  transition: opacity .2s;
}
.loading-step.step-done    { opacity: .55; }
.loading-step.step-active  { opacity: 1; }
.loading-step.step-pending { opacity: .3; }
.loading-step-num {
  flex-shrink: 0;
  width: 22px; height: 22px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; margin-top: 1px;
}
.step-done   .loading-step-num { background: #22c55e; color: #fff; }
.step-active .loading-step-num { background: #1d4ed8; color: #fff; }
.step-pending .loading-step-num { background: #e2e8f0; color: #64748b; }
.loading-step-body { flex: 1; min-width: 0; }
.loading-step-label  { font-size: 13px; font-weight: 600; color: #1e293b; }
.step-done    .loading-step-label { color: #64748b; font-weight: 500; }
.step-pending .loading-step-label { color: #64748b; font-weight: 400; }
.loading-step-detail {
  font-size: 11px; color: #64748b;
  margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.loading-step-spin {
  flex-shrink: 0; width: 14px; height: 14px; margin-top: 4px;
  border: 2px solid #bfdbfe; border-top-color: #1d4ed8;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
.loading-progress-track {
  display: flex; align-items: center; gap: 8px;
  margin-top: 10px;
}
.loading-progress-bar {
  flex: 1; height: 5px;
  background: #e2e8f0; border-radius: 99px; overflow: hidden;
}
.loading-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #1d4ed8, #3b82f6);
  border-radius: 99px;
  transition: width .6s ease;
}
.loading-progress-pct {
  font-size: 11px; font-weight: 600; color: #64748b; white-space: nowrap;
}

/* ── Toast ── */
.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 400;
  background: var(--grey-900); color: white;
  padding: 12px 18px; border-radius: var(--radius);
  font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toastIn .25s ease;
  max-width: 340px;
}
.toast.success { background: var(--green); }
.toast.error   { background: var(--red); }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ── Misc ── */
.text-warning { color: var(--orange); font-size: 12px; margin-top: 8px; }

/* ── Historique des modifications ── */
.history-filters {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 12px 16px; border-bottom: 1px solid var(--grey-200);
  background: var(--grey-50);
}
.history-filter-btn {
  padding: 4px 12px; font-size: 12px; border-radius: 20px;
  border: 1px solid var(--grey-300); background: white; color: var(--mid);
  transition: all .15s;
}
.history-filter-btn.active { background: var(--blue); color: white; border-color: var(--blue); }
.history-filter-btn:hover:not(.active) { background: var(--grey-100); }
.history-list {
  max-height: 460px; overflow-y: auto; padding: 8px 16px;
}
.history-empty {
  text-align: center; padding: 30px; color: #aaa; font-size: 13px;
}
.history-entry {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 10px 0; border-bottom: 1px solid var(--grey-100);
}
.history-entry:last-child { border-bottom: none; }
.history-entry-icon { font-size: 20px; flex-shrink: 0; padding-top: 2px; }
.history-entry-body { flex: 1; min-width: 0; }
.history-entry-action { font-size: 13px; font-weight: 600; color: var(--dark); }
.history-entry-detail {
  font-size: 12px; color: var(--mid); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.history-entry-meta {
  display: flex; gap: 12px; margin-top: 4px; font-size: 11px; color: #aaa;
}
.history-entry-user { font-weight: 500; }

/* ── Gestion utilisateurs ── */
/* ── Modale utilisateurs — layout étendu ─────────────────────── */
.modal-users { max-width: 720px; width: 95vw; display: flex; flex-direction: column; max-height: 88vh; }
.modal-users .modal-body { flex: 1; overflow: hidden; display: flex; flex-direction: column; }

/* Toolbar recherche + filtres */
.um-toolbar {
  display: flex; gap: 8px; align-items: center;
  padding: 0 0 10px 0; flex-wrap: wrap;
}
.um-search-wrap {
  position: relative; flex: 1; min-width: 180px;
}
.um-search-icon { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); font-size: 13px; pointer-events: none; }
.um-search-input {
  width: 100%; padding: 6px 28px 6px 30px; font-size: 13px;
  border: 1px solid var(--grey-300); border-radius: 6px;
  outline: none; background: var(--grey-50);
  box-sizing: border-box;
}
.um-search-input:focus { border-color: var(--primary); background: #fff; }
.um-search-clear {
  position: absolute; right: 7px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; font-size: 11px;
  color: #999; padding: 2px 4px; border-radius: 4px;
}
.um-search-clear:hover { color: #333; background: var(--grey-200); }
.um-filter-select {
  padding: 6px 8px; font-size: 12px; border: 1px solid var(--grey-300);
  border-radius: 6px; background: var(--grey-50); cursor: pointer;
  flex-shrink: 0;
}
.um-filter-select:focus { border-color: var(--primary); outline: none; }

/* Barre meta (compteur + tri) */
.um-meta-bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 4px 0 8px 0; border-bottom: 1px solid var(--grey-200);
  margin-bottom: 8px; flex-shrink: 0;
}
.um-count { font-size: 12px; color: var(--text-muted); }
.um-sort-wrap { display: flex; align-items: center; gap: 6px; }
.um-sort-label { font-size: 12px; color: var(--text-muted); }
.um-sort-select { padding: 3px 6px; font-size: 12px; border: 1px solid var(--grey-300); border-radius: 5px; background: var(--grey-50); cursor: pointer; }

/* Liste scrollable */
.um-list { flex: 1; overflow-y: auto; padding-right: 2px; min-height: 80px; }
.um-list::-webkit-scrollbar { width: 5px; }
.um-list::-webkit-scrollbar-thumb { background: var(--grey-300); border-radius: 3px; }

/* Pagination */
.um-pagination {
  display: flex; justify-content: center; align-items: center;
  gap: 4px; padding: 10px 0 4px;
  flex-shrink: 0;
}
.um-page-btn {
  min-width: 30px; height: 28px; padding: 0 8px;
  border: 1px solid var(--grey-300); background: #fff;
  border-radius: 5px; cursor: pointer; font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, border-color .15s;
}
.um-page-btn:hover:not(:disabled) { background: var(--grey-100); border-color: var(--primary); }
.um-page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 600; }
.um-page-btn:disabled { opacity: .4; cursor: default; }
.um-page-ellipsis { font-size: 12px; color: var(--text-muted); padding: 0 4px; }

/* Lignes utilisateurs */
.user-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 6px;
  border: 1px solid var(--grey-200); margin-bottom: 6px;
  transition: background .1s;
}
.user-row:hover { background: var(--grey-50); }
.user-row-icon { font-size: 18px; flex-shrink: 0; }
.user-row-info { flex: 1; min-width: 0; }
.user-row-email { display: block; font-size: 13px; font-weight: 500; color: var(--dark); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-row-role  { display: inline-block; font-size: 10px; padding: 1px 7px; border-radius: 10px; margin-top: 2px; }
.role-super  { background: #f3e8ff; color: #7c3aed; font-weight: 600; }
.role-admin  { background: #fff3cd; color: #856404; }
.role-editor { background: #e2f0fb; color: #1a6aa1; }
.role-reader { background: #e8f5e9; color: #2e7d32; }
.user-row-self    { font-size: 11px; color: #aaa; flex-shrink: 0; }
.user-row-primary { font-size: 16px; flex-shrink: 0; opacity: .6; }
.user-row-actions { display: flex; gap: 6px; flex-shrink: 0; align-items: center; flex-wrap: wrap; }
.user-row-valideur { display: inline-block; font-size: 10px; padding: 1px 7px; border-radius: 10px; margin-top: 2px; margin-left: 4px; font-weight: 500; }
.valideur-on  { background: #dcfce7; color: #166534; }
.valideur-off { background: #f1f5f9; color: #64748b; }
.user-row-name { display: block; font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.um-empty { text-align: center; padding: 24px 0; color: var(--text-muted); font-size: 13px; }
.ent-tab { background: none; border: none; padding: 10px 18px; font-size: 13px; font-weight: 600; color: #64748b; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: color .15s, border-color .15s; }
.ent-tab:hover { color: #003DA6; }
.ent-tab-active { color: #003DA6; border-bottom-color: #003DA6; }
.ent-item { display: flex; align-items: center; justify-content: space-between; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 10px 14px; font-size: 13px; gap: 10px; }
.ent-item-name { font-weight: 600; color: #1e293b; }
.ent-item-meta { font-size: 12px; color: #64748b; margin-top: 2px; }
.ent-item-actions { display: flex; gap: 6px; flex-shrink: 0; }
.ent-btn-edit { background: #eff6ff; color: #003DA6; border: 1px solid #bfdbfe; border-radius: 5px; padding: 4px 10px; cursor: pointer; font-size: 12px; font-weight: 600; }
.ent-btn-del  { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; border-radius: 5px; padding: 4px 10px; cursor: pointer; font-size: 12px; font-weight: 600; }
.ent-empty { text-align: center; padding: 28px 0; color: #64748b; font-size: 13px; }
.sidebar-user-role-badge {
  font-size: 10px; padding: 2px 8px; border-radius: 10px;
  margin-bottom: 5px; display: inline-block;
}
.role-badge-super  { background: rgba(139,92,246,.2); color: #c4b5fd; font-weight: 600; }
.role-badge-admin  { background: rgba(255,200,80,.2); color: #ffd580; }
.role-badge-editor { background: rgba(100,180,255,.2); color: #90caf9; }
.role-badge-reader { background: rgba(100,220,120,.2); color: #a5d6a7; }
.edit-role-email { font-weight: 600; font-size: 13px; margin-bottom: 12px; color: var(--dark); }

/* ── Diagnostic EDEN AI ── */
.diag-box {
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 14px;
  font-size: 13px;
  line-height: 1.6;
}
.diag-box.success { background: #dcfce7; border: 1px solid #86efac; color: #14532d; }
.diag-box.error   { background: #fee2e2; border: 1px solid #fca5a5; color: #7f1d1d; }
.diag-box.mock    { background: #fef9c3; border: 1px solid #fde047; color: #713f12; }
.diag-box-title   { font-weight: 700; font-size: 14px; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.diag-box pre     { background: rgba(0,0,0,.07); border-radius: 4px; padding: 10px; font-size: 11.5px; margin-top: 10px; white-space: pre-wrap; word-break: break-word; }
.diag-config      { font-size: 12px; color: var(--grey-600); margin-top: 14px; }
.diag-config code { background: var(--grey-100); padding: 1px 5px; border-radius: 3px; font-family: monospace; }

/* Extraction error panel */
.ext-error-panel {
  background: #fff5f5; border: 1px solid #fca5a5; border-radius: var(--radius);
  padding: 16px 18px; margin-top: 16px;
}
.ext-error-title { font-weight: 700; color: #991b1b; margin-bottom: 8px; }
.ext-error-body  { font-size: 13px; color: #7f1d1d; white-space: pre-wrap; line-height: 1.6; }

/* ── Tree node controls (mode édition) ── */
.tree-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-index { color: rgba(255,255,255,.38); font-size: .85em; font-variant-numeric: tabular-nums; }

.tree-node-controls {
  display: none;
  align-items: center;
  gap: 1px;
  flex-shrink: 0;
  margin-left: 4px;
}
.sidebar.tree-editable .tree-node:hover .tree-node-controls { display: flex; }

.tree-btn {
  display: flex; align-items: center; justify-content: center;
  width: 20px; height: 20px;
  border: none; background: transparent; border-radius: 3px;
  color: rgba(255,255,255,.45); font-size: 11px; padding: 0;
  transition: background .15s, color .15s;
  line-height: 1;
}
.tree-btn:hover            { background: rgba(255,255,255,.15); color: #fff; }
.tree-btn-add              { font-size: 15px; font-weight: 700; }
.tree-btn-sort             { font-size: 13px; }
.tree-btn-sort:hover       { background: rgba(99,179,237,.35); color: #fff; }
.tree-btn-delete:hover     { background: rgba(231,76,60,.45); color: #fff; }

/* ── Badge "vide" — nœud navigable sans document ── */
.tree-empty-badge {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  background: rgba(251,146,60,.15);
  color: rgba(251,146,60,.7);
  border: 1px solid rgba(251,146,60,.22);
  border-radius: 3px;
  padding: 1px 5px;
  flex-shrink: 0;
  white-space: nowrap;
  line-height: 1.6;
}

/* Badge compteur de documents (récursif) — indique qu'un dossier ou ses sous-dossiers contiennent des DSF */
.tree-count-badge {
  font-size: 9px;
  font-weight: 700;
  background: rgba(59,130,246,.18);
  color: rgba(147,197,253,.95);
  border: 1px solid rgba(59,130,246,.3);
  border-radius: 9px;
  padding: 1px 6px;
  flex-shrink: 0;
  white-space: nowrap;
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
}
.tree-node-empty .tree-label { opacity: .65; }
.tree-node-empty:hover .tree-label { opacity: 1; }

/* ── Sidebar auth footer ── */
.sidebar-auth {
  padding: 10px 14px;
  border-top: 1px solid rgba(255,255,255,.1);
  flex-shrink: 0;
  display: flex; flex-direction: column; gap: 6px;
}
.sidebar-login-btn {
  width: 100%; padding: 8px 12px;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.15);
  border-radius: 6px; color: #c8d8f0; font-size: 12px; text-align: center;
  transition: background .15s;
}
.sidebar-login-btn:hover { background: rgba(255,255,255,.15); }

.sidebar-user-header {
  display: flex; align-items: center; gap: 8px;
}
.sidebar-user-info {
  flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px;
}
.sidebar-user-email {
  font-size: 11px; color: rgba(200,216,240,.80);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sidebar-user-menu {
  display: flex; flex-direction: column; margin-top: 8px;
}
.sidebar-menu-item {
  display: block; width: 100%; text-align: left;
  padding: 6px 8px; font-size: 12px;
  color: #c8d8f0; background: none; border: none; border-radius: 4px;
  cursor: pointer; transition: background .15s;
}
.sidebar-menu-item:hover { background: rgba(255,255,255,.10); }
.sidebar-menu-sep {
  height: 1px; background: rgba(255,255,255,.10); margin: 4px 0;
}
.sidebar-menu-admin { color: #ffd580; }
.sidebar-menu-admin:hover { background: rgba(255,200,80,.12); }
.sidebar-menu-danger { color: rgba(255,130,120,.85); }
.sidebar-menu-danger:hover { background: rgba(231,76,60,.20); }
#sidebarNewProject {
  padding: 8px 14px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
#sidebarNewProject:empty { display: none; }
.sidebar-new-project-btn {
  width: 100%; padding: 6px 10px; text-align: left;
  background: rgba(255,255,255,.07); border: 1px dashed rgba(255,255,255,.2);
  border-radius: 5px; color: rgba(200,216,240,.7); font-size: 11px;
  transition: background .15s, color .15s;
}
.sidebar-new-project-btn:hover { background: rgba(255,255,255,.13); color: #c8d8f0; }

/* ── Formulaires modaux ── */
.form-group   { margin-bottom: 14px; }
.form-label   { display: block; font-size: 12px; font-weight: 600; color: var(--grey-700); margin-bottom: 5px; }
.form-input   {
  width: 100%; padding: 9px 12px;
  border: 1.5px solid var(--grey-300); border-radius: var(--radius);
  font-size: 14px; outline: none; transition: border-color .15s;
}
.form-input:focus  { border-color: var(--blue-700); }
.form-context { font-size: 12px; color: var(--grey-500); margin-bottom: 12px; }
.login-error  {
  background: #fee2e2; border: 1px solid #fca5a5; border-radius: var(--radius);
  padding: 8px 12px; font-size: 12px; color: #991b1b; margin-top: 4px;
}

/* ══════════════════════════════════════════════════════════════
   FEATURES MODAL — Gestion des fonctionnalités
   ══════════════════════════════════════════════════════════════ */

.feat-group-title {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: #475569;
  padding: 10px 0 6px; margin-top: 8px;
  border-bottom: 1px solid #e2e8f0; margin-bottom: 4px;
}
.feat-group-hint { font-weight: 400; text-transform: none; color: #64748b; font-size: 11px; }

.feat-item {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 8px; border-radius: 8px;
  transition: background .15s;
}
.feat-item:hover { background: #f8fafc; }

.feat-item-locked { opacity: .85; }
.feat-item-disabled .feat-info { opacity: .5; }
.feat-item-coming-soon { opacity: .7; }

.feat-lock-icon { font-size: 18px; min-width: 24px; text-align: center; }
.feat-lock-btn { background: none; border: none; cursor: pointer; font-size: 20px; min-width: 28px; padding: 2px 4px; border-radius: 6px; transition: transform .15s, background .15s; line-height: 1; }
.feat-lock-btn:hover { background: #f1f5f9; transform: scale(1.1); }
.feat-lock-btn-locked { color: #3b82f6; }
.feat-lock-btn-unlocked { color: #64748b; }
.feat-status-on {
  font-size: 11px; font-weight: 600; color: #15803d;
  background: #dcfce7; border-radius: 20px; padding: 2px 10px; white-space: nowrap;
}

/* Toggle switch */
.feat-toggle { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; }
.feat-toggle input { opacity: 0; width: 0; height: 0; }
.feat-toggle-slider {
  position: absolute; inset: 0; background: #cbd5e1; border-radius: 22px;
  cursor: pointer; transition: background .2s;
}
.feat-toggle-slider::before {
  content: ''; position: absolute;
  width: 16px; height: 16px; left: 3px; bottom: 3px;
  background: #fff; border-radius: 50%; transition: transform .2s;
}
.feat-toggle input:checked + .feat-toggle-slider { background: #3b82f6; }
.feat-toggle input:checked + .feat-toggle-slider::before { transform: translateX(18px); }
.feat-toggle input:disabled + .feat-toggle-slider { background: #e2e8f0; cursor: not-allowed; }
.feat-toggle-readonly { cursor: default; }

.feat-info { flex: 1; min-width: 0; }
.feat-label { font-size: 14px; font-weight: 600; color: #1e293b; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.feat-desc  { font-size: 12px; color: #64748b; margin-top: 2px; line-height: 1.45; }

/* Badges */
.feat-badge {
  font-size: 10px; font-weight: 700; border-radius: 20px;
  padding: 1px 8px; letter-spacing: .03em; white-space: nowrap;
}
.feat-badge-std          { background: #dbeafe; color: #1d4ed8; }
.feat-badge-opt          { background: #f0fdf4; color: #15803d; }
.feat-badge-coming-soon  { background: #fef9c3; color: #854d0e; }

/* Release selector (JIRA) */
.feat-release-row {
  display: flex; align-items: center; gap: 8px;
  margin-top: 6px; flex-wrap: wrap;
}
.feat-release-label { font-size: 11px; color: #64748b; white-space: nowrap; }
.feat-release-select {
  font-size: 12px; border: 1px solid #e2e8f0; border-radius: 6px;
  padding: 3px 8px; background: #fff; color: #374151; cursor: pointer;
}
.feat-release-select:disabled { background: #f8fafc; color: #64748b; cursor: not-allowed; }

/* Version banner */
.feat-version-banner {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: linear-gradient(135deg, #eff6ff 0%, #f0fdf4 100%);
  border: 1px solid #bfdbfe; border-radius: 10px;
  padding: 8px 14px; margin-bottom: 12px;
}
.feat-version-text { font-size: 13px; font-weight: 700; color: #1e40af; }
.feat-version-badge {
  font-size: 11px; font-weight: 700; background: #1e40af; color: #fff;
  border-radius: 20px; padding: 2px 10px; letter-spacing: .04em;
}
.feat-version-edit-btn {
  background: none; border: none; cursor: pointer; font-size: 14px;
  padding: 2px 6px; border-radius: 6px; color: #64748b; transition: background .15s;
}
.feat-version-edit-btn:hover { background: #dbeafe; color: #1d4ed8; }
.feat-version-edit-row { display: inline-flex; align-items: center; gap: 6px; margin-left: 4px; }
.feat-version-edit-row.hidden { display: none; }
.feat-version-input {
  width: 80px; font-size: 12px; border: 1px solid #93c5fd; border-radius: 6px;
  padding: 3px 8px; outline: none;
}
.feat-version-cancel-btn {
  background: none; border: none; cursor: pointer; font-size: 14px;
  color: #64748b; padding: 2px 6px; border-radius: 6px;
}
.feat-version-cancel-btn:hover { background: #fee2e2; color: #dc2626; }

/* Custom feature badge & meta */
.feat-badge-custom { background: #f3e8ff; color: #7c3aed; }
.feat-custom-meta  { font-size: 10px; color: #64748b; margin-top: 2px; font-style: italic; }

/* Delete button on custom features */
.feat-delete-btn {
  background: none; border: none; cursor: pointer; font-size: 16px;
  padding: 4px 6px; border-radius: 6px; color: #64748b; transition: background .15s, color .15s;
  flex-shrink: 0;
}
.feat-delete-btn:hover { background: #fee2e2; color: #dc2626; }

/* Admin section */
.feat-admin-section {
  margin-top: 18px; padding-top: 14px;
  border-top: 2px dashed #e2e8f0;
}
.feat-admin-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: #64748b; margin-bottom: 10px;
}

/* Collapsible management sections */
.feat-mgmt-details {
  border: 1px solid #e2e8f0; border-radius: 8px;
  margin-bottom: 8px; overflow: hidden;
}
.feat-mgmt-summary {
  font-size: 13px; font-weight: 600; color: #374151;
  padding: 10px 14px; cursor: pointer; list-style: none;
  background: #f8fafc; user-select: none;
  display: flex; align-items: center; gap: 8px;
}
.feat-mgmt-summary::-webkit-details-marker { display: none; }
.feat-mgmt-summary::before {
  content: '▶'; font-size: 9px; color: #64748b;
  transition: transform .2s; flex-shrink: 0;
}
.feat-mgmt-details[open] > .feat-mgmt-summary::before { transform: rotate(90deg); }
.feat-mgmt-details[open] > .feat-mgmt-summary { border-bottom: 1px solid #e2e8f0; }
.feat-mgmt-body { padding: 12px 14px; background: #fff; }

/* Releases list */
.feat-rel-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 5px 8px; border-radius: 6px; margin-bottom: 4px;
  background: #f8fafc; border: 1px solid #e2e8f0;
}
.feat-rel-label { font-size: 12px; color: #374151; }
.feat-rel-del-btn {
  background: none; border: none; cursor: pointer; font-size: 14px; font-weight: 700;
  color: #64748b; padding: 0 4px; border-radius: 4px; line-height: 1;
  transition: background .15s, color .15s;
}
.feat-rel-del-btn:hover { background: #fee2e2; color: #dc2626; }
.feat-rel-add-row { display: flex; gap: 8px; margin-top: 8px; align-items: center; }
.feat-rel-input {
  flex: 1; font-size: 12px; border: 1px solid #e2e8f0; border-radius: 6px;
  padding: 5px 10px; outline: none;
}
.feat-rel-input:focus { border-color: #93c5fd; }

/* Shared small action buttons */
.feat-mgmt-btn-add {
  font-size: 12px; font-weight: 600; background: #eff6ff; color: #1d4ed8;
  border: 1px solid #bfdbfe; border-radius: 6px; padding: 5px 12px; cursor: pointer;
  white-space: nowrap; transition: background .15s;
}
.feat-mgmt-btn-add:hover { background: #dbeafe; }
.feat-mgmt-btn-save {
  font-size: 12px; font-weight: 600; background: #1d4ed8; color: #fff;
  border: none; border-radius: 6px; padding: 6px 14px; cursor: pointer;
  margin-top: 10px; transition: background .15s;
}
.feat-mgmt-btn-save:hover { background: #1e40af; }

/* Create feature form */
.feat-create-grid {
  display: grid; grid-template-columns: 90px 1fr;
  gap: 8px 12px; align-items: center;
}
.feat-create-label { font-size: 12px; color: #64748b; font-weight: 500; }
.feat-create-icon-input {
  width: 60px; font-size: 16px; text-align: center;
  border: 1px solid #e2e8f0; border-radius: 6px; padding: 4px;
}
.feat-create-text-input {
  font-size: 12px; border: 1px solid #e2e8f0; border-radius: 6px;
  padding: 6px 10px; width: 100%; outline: none; box-sizing: border-box;
}
.feat-create-text-input:focus { border-color: #93c5fd; }
.feat-create-select {
  font-size: 12px; border: 1px solid #e2e8f0; border-radius: 6px;
  padding: 5px 8px; background: #fff; color: #374151;
}

/* ── Format standard — bannière de statut (prompt config modal) ── */
.pc-std-banner {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  border-radius: 8px; padding: 8px 14px; margin-bottom: 12px;
  font-size: 12.5px; line-height: 1.5;
}
.pc-std-banner-none {
  background: #f8fafc; border: 1px solid #e2e8f0; color: #64748b;
}
.pc-std-banner-match {
  background: #f0fdf4; border: 1px solid #86efac; color: #15803d;
}
.pc-std-banner-diff {
  background: #fffbeb; border: 1px solid #fcd34d; color: #92400e;
}
.pc-std-load-btn {
  font-size: 12px; font-weight: 600;
  background: #fffbeb; border: 1px solid #fbbf24; color: #b45309;
  border-radius: 6px; padding: 4px 12px; cursor: pointer; white-space: nowrap;
  transition: background .15s;
}
.pc-std-load-btn:hover { background: #fef3c7; }

/* ── Standard checkbox (pied du modal prompt config) ── */
.pc-std-checkbox-wrap {
  display: flex; align-items: center; gap: 7px;
  font-size: 12.5px; color: #64748b; cursor: pointer; user-select: none;
  padding: 4px 6px; border-radius: 6px; transition: background .15s;
}
.pc-std-checkbox-wrap:hover { background: #f1f5f9; }
.pc-std-checkbox-wrap input[type="checkbox"] { width: 14px; height: 14px; cursor: pointer; accent-color: #1d4ed8; }

/* ── Groupes d'exigences (prompt config) ── */
.pc-groups-category { margin-bottom: 18px; }
.pc-groups-category-title { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: #1e293b; margin-bottom: 6px; padding: 4px 0; border-bottom: 1px solid #e2e8f0; }
.pc-groups-cat-code { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; border-radius: 4px; padding: 1px 6px; font-size: 11px; font-family: monospace; }
.pc-groups-table { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-bottom: 2px; }
.pc-groups-table th { background: #f8fafc; color: #64748b; font-weight: 600; text-align: left; padding: 5px 8px; border-bottom: 1px solid #e2e8f0; white-space: nowrap; }
.pc-groups-table td { padding: 4px 8px; border-bottom: 1px solid #f1f5f9; vertical-align: top; }
.pc-groups-table tr:last-child td { border-bottom: none; }
.pc-groups-table tr:hover td { background: #f8fafc; }
.pc-groups-table td:first-child { white-space: nowrap; }
.pc-groups-table td:last-child { width: 24px; text-align: center; }

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE — Mobile first
   ══════════════════════════════════════════════════════════════ */

/* ── Hamburger (caché sur desktop) ── */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 38px; height: 38px;
  padding: 7px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--transition);
}
.hamburger:hover { background: rgba(255,255,255,.2); }
.hamburger span {
  display: block;
  width: 18px; height: 2px;
  background: white;
  border-radius: 2px;
  transition: all .25s;
}
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Overlay sidebar (mobile) ── */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  top: var(--header-h);
  z-index: 89;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(2px);
}
.sidebar-overlay.visible { display: block; }

/* ── Tablet (≤ 1024px) ── */
@media (max-width: 1024px) {
  :root { --sidebar-w: 240px; }
  .main { padding: 20px; }
  .folder-view, .doc-view { max-width: 100%; }
}

/* ── Mobile (≤ 768px) ── */
@media (max-width: 768px) {

  /* Header */
  .hamburger { display: flex; }
  .header { padding: 0 12px; gap: 8px; }
  .header-title-sub { display: none; }
  .header-brand { gap: 8px; }
  #statusLabel, #statusRefreshBtn { display: none; }

  /* Poignée de redimensionnement — cachée sur mobile */
  .sidebar-resize-handle { display: none; }

  /* Sidebar → tiroir glissant */
  .sidebar {
    position: fixed;
    top: var(--header-h); left: 0; bottom: 0;
    z-index: 90;
    width: 280px !important; min-width: 280px !important;
    transform: translateX(-100%);
    transition: transform .28s ease;
    box-shadow: 4px 0 24px rgba(0,0,0,.35);
  }
  .sidebar.open { transform: translateX(0); }

  /* Main : pleine largeur */
  .main { padding: 14px 12px; width: 100%; }

  /* Welcome */
  .welcome { margin: 16px auto; padding: 24px 18px; }

  /* Folder/Doc views */
  .folder-view, .doc-view { max-width: 100%; }

  /* Folder header : empilé */
  .folder-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 14px;
  }
  .folder-header h1, .folder-header h2 { font-size: 17px; }
  .folder-header .btn { width: 100%; justify-content: center; }

  /* Drop zone : compact */
  .drop-zone { padding: 20px 16px; }
  .drop-zone-icon { font-size: 28px; margin-bottom: 6px; }

  /* Doc card */
  .doc-card { padding: 11px 12px; gap: 10px; }
  .doc-card-icon { font-size: 24px; min-width: 28px; }
  .doc-card-actions .btn { padding: 4px 8px; font-size: 11px; }

  /* Doc header : empilé */
  .doc-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 16px;
  }
  .doc-header .btn { width: 100%; justify-content: center; }
  .doc-icon { font-size: 32px; }
  .doc-header h1, .doc-header h2 { font-size: 15px; }

  /* Extraction panel */
  .extraction-panel { padding: 14px 14px; }
  .extraction-actions { gap: 8px; }
  .ext-btn {
    flex: 1 1 calc(50% - 4px);
    min-width: calc(50% - 4px);
    padding: 12px 8px;
  }
  .ext-icon  { font-size: 22px; }
  .ext-label { font-size: 11px; }

  /* Onglets résultats */
  .tab-btn { padding: 10px 12px; font-size: 12px; }

  /* Barre résultats : empilée */
  .results-toolbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 12px;
  }
  .results-actions-bar { width: 100%; justify-content: flex-end; }
  .results-content { padding: 16px 12px; max-height: none; }

  /* Modals */
  .modal-overlay { padding: 12px; align-items: flex-end; }
  .modal { border-radius: var(--radius-lg) var(--radius-lg) 0 0; max-height: 92vh; }
  .modal-body   { padding: 14px 16px; }
  .modal-footer { padding: 12px 16px; flex-wrap: wrap; gap: 8px; }
  .modal-footer .btn { flex: 1; justify-content: center; min-width: 80px; }

  /* History */
  .history-filters { gap: 5px; padding: 10px 12px; }
  .history-filter-btn { padding: 4px 10px; font-size: 11px; }
  .history-list { max-height: 55vh; }

  /* Toast */
  .toast { bottom: 12px; right: 10px; left: 10px; max-width: none; text-align: center; }

  /* Export dropdown : s'ouvre à gauche sur mobile */
  .export-dropdown-menu { right: auto; left: 0; }

  /* Tables markdown : scroll horizontal */
  .md-output table { display: block; overflow-x: auto; }

  /* Gestion utilisateurs */
  .modal-users { max-width: 100vw; }
  .um-toolbar { flex-direction: column; align-items: stretch; }
  .um-search-wrap { min-width: unset; }
  .user-row { flex-wrap: wrap; gap: 8px; }
  .user-row-actions { width: 100%; justify-content: flex-end; }
}

/* ── Très petits écrans (≤ 420px) ── */
@media (max-width: 420px) {
  .header-title-main { font-size: 13px; }
  .ext-btn { padding: 10px 6px; }
  .ext-icon { font-size: 20px; }
  .tab-btn { padding: 8px 9px; font-size: 11px; }
  .results-actions-bar { flex-wrap: wrap; gap: 6px; }
  .results-actions-bar .btn { flex: 1; justify-content: center; }

  /* Dashboard coûts — mobile */
  #costsDashboardScreen { padding: 16px 14px 40px; }
  #costsChartsRow { grid-template-columns: 1fr !important; }
  #costsKpiRow { grid-template-columns: repeat(2, 1fr); }
  #costsDashboardScreen > div:first-child { flex-wrap: wrap; gap: 8px; }
  #costsDashboardScreen > div:first-child > div { flex-wrap: wrap; gap: 6px; }
  #costsLogTable th:nth-child(2),
  #costsLogTable td:nth-child(2),
  #costsLogTable th:nth-child(4),
  #costsLogTable td:nth-child(4) { display: none; }
}

/* ═══════════════════════════════════════════════════════════════
   Splash Login
   ══════════════════════════════════════════════════════════════ */

.login-splash {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  background: #fff;
  transition: opacity .4s ease;
}
.login-splash.splash-hiding {
  opacity: 0;
  pointer-events: none;
}
.login-splash.hidden { display: none !important; }

/* ── Panneau gauche (visuellement à droite après swap DOM) ── */
.splash-left {
  width: 60%;
  background: linear-gradient(145deg, #001f5c 0%, #003DA6 45%, #1a6fe0 100%);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.splash-left-inner {
  position: relative;
  z-index: 2;
  padding: 48px 52px;
  width: 100%;
}
.splash-bg-circle {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,.05);
  pointer-events: none;
}
.splash-bg-circle-1 { width: 520px; height: 520px; top: -180px; right: -180px; }
.splash-bg-circle-2 { width: 360px; height: 360px; bottom: -130px; left: -100px; }
.splash-bg-circle-3 { width: 200px; height: 200px; top: 50%; right: 60px; transform: translateY(-50%); background: rgba(255,255,255,.03); }

.splash-brand { display: flex; align-items: center; gap: 16px; margin-bottom: 36px; }
.splash-brand-title {
  color: #fff;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -.3px;
  line-height: 1.1;
}
.splash-brand-sub { color: rgba(255,255,255,.65); font-size: 13px; margin-top: 3px; }

.splash-tagline {
  color: rgba(255,255,255,.85);
  font-size: 17px;
  font-weight: 300;
  line-height: 1.5;
  margin-bottom: 4px;
  letter-spacing: -.1px;
}

.splash-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-bottom: 20px;
}
.splash-features li {
  color: rgba(255,255,255,.82);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.splash-features li::before {
  content: '';
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #60a5fa;
  flex-shrink: 0;
}

.splash-version {
  color: rgba(255,255,255,.35);
  font-size: 12px;
}

/* ── Panneau droit (visuellement à gauche après swap DOM) ── */
.splash-right {
  width: 40%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 32px;
  background: #fff;
}
.splash-form-wrapper { width: 100%; max-width: 380px; }

.splash-mobile-logo { display: none; margin-bottom: 24px; }

.splash-form-title {
  font-size: 26px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 6px;
}
.splash-form-sub {
  font-size: 14px;
  color: #64748b;
  margin-bottom: 28px;
}

.splash-btn-sso {
  width: 100%;
  padding: 12px 16px;
  background: #fff;
  color: #374151;
  border: 1.5px solid #d1d5db;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  transition: border-color .2s, background .2s, color .2s;
  margin-bottom: 20px;
}
.splash-btn-sso:hover {
  border-color: #003DA6;
  background: #eff6ff;
  color: #003DA6;
}

.splash-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #9ca3af;
  font-size: 13px;
  margin-bottom: 20px;
}
.splash-divider::before, .splash-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e5e7eb;
}

.splash-field { margin-bottom: 16px; }
.splash-field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #374151;
  margin-bottom: 6px;
}
.splash-input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid #d1d5db;
  border-radius: 9px;
  font-size: 14px;
  color: #0f172a;
  background: #fff;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.splash-input:focus {
  border-color: #003DA6;
  box-shadow: 0 0 0 3px rgba(0,61,166,.1);
}

.splash-error {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 14px;
}

.splash-btn-primary {
  width: 100%;
  padding: 13px;
  background: #003DA6;
  color: #fff;
  border: none;
  border-radius: 9px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s, transform .1s;
  margin-bottom: 0;
}
.splash-btn-primary:hover:not(:disabled) { background: #0055c8; }
.splash-btn-primary:active { transform: scale(.98); }
.splash-btn-primary:disabled { opacity: .65; cursor: not-allowed; }

.splash-footer {
  margin-top: 28px;
  font-size: 11.5px;
  color: #9ca3af;
  text-align: center;
  line-height: 1.5;
}

/* ── Illustration écosystème solaire — fond absolu ── */
.splash-ecosystem {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.eco-svg {
  width: 100%;
  height: 100%;
  opacity: 0.48;
  display: block;
}
/* Gradient de lisibilité entre SVG et texte */
.splash-left::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(145deg,
    rgba(0,20,70,0.52) 0%,
    rgba(0,45,140,0.28) 50%,
    rgba(0,60,180,0.18) 100%);
  pointer-events: none;
}

/* Lignes de connexion */
.eco-line {
  stroke: rgba(96,165,250,0.35);
  stroke-width: 1;
  stroke-dasharray: 4 4;
  animation: eco-dash 3s linear infinite;
}
@keyframes eco-dash {
  to { stroke-dashoffset: -24; }
}

/* Nœuds satellites — apparition progressive */
.eco-node {
  animation: eco-nodein .6s ease-out both;
}
@keyframes eco-nodein {
  from { opacity: 0; transform: scale(.5); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes eco-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: .7; transform: scale(1.06); }
}

/* ── Hub central (transform-origin mis à jour pour 400×400) ── */
.eco-hub-ring {
  animation: eco-pulse 3s ease-in-out infinite;
  transform-origin: 200px 200px;
}

/* ── Tablette ── */
@media (max-width: 1100px) {
  .splash-left  { width: 58%; }
  .splash-right { width: 42%; }
}

/* ── Mobile ── */
@media (max-width: 820px) {
  .login-splash { flex-direction: column; }
  /* Sur mobile : form en haut (order:1), écosystème en bas (order:2) */
  .splash-right { width: 100%; flex: 1; padding: 32px 24px; order: 1; }
  .splash-left  { width: 100%; min-height: 180px; align-items: flex-start; order: 2; }
  .splash-left-inner { padding: 28px 24px 24px; }
  .splash-tagline { font-size: 15px; margin-bottom: 0; }
  .splash-features, .splash-version, .splash-ecosystem { display: none; }
  .splash-brand-title { font-size: 20px; }
  .splash-bg-circle-1 { width: 300px; height: 300px; top: -100px; right: -100px; }
  .splash-bg-circle-2 { display: none; }
  .splash-mobile-logo { display: block; }
  .splash-brand { display: none; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   VISIONNEUSE PDF — Modal split-screen
   ═══════════════════════════════════════════════════════════════════════════ */

.btn-verify {
  background: #f0f9ff;
  color: #0369a1;
  border: 1px solid #7dd3fc;
  font-weight: 600;
}
.btn-verify:hover { background: #e0f2fe; border-color: #38bdf8; }

/* ── Modal sélection mode DSF ─────────────────────────────────────────────── */
.dsf-choice-dialog {
  background: #fff;
  border-radius: 16px;
  padding: 40px 36px 36px;
  max-width: 660px;
  width: 92%;
  box-shadow: 0 24px 64px rgba(0,0,0,.28);
  animation: fadeInUp .22s ease;
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0);    }
}
.dsf-choice-header { text-align: center; margin-bottom: 28px; }
.dsf-choice-icon   { font-size: 44px; margin-bottom: 10px; }
.dsf-choice-title  {
  font-size: 1.35rem; font-weight: 700; color: #1e3a8a;
  margin: 0 0 8px;
}
.dsf-choice-subtitle {
  color: #475569; font-size: .92rem; line-height: 1.55; margin: 0 0 10px;
}
.dsf-choice-warning {
  display: inline-block;
  background: #fff7ed; color: #9a3412;
  border: 1px solid #fed7aa;
  border-radius: 6px; padding: 5px 12px;
  font-size: .82rem; margin: 0;
}
.dsf-choice-cards {
  display: flex; gap: 18px;
}
.dsf-choice-card {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 28px 18px;
  border: 2px solid #e2e8f0; border-radius: 12px;
  background: #f8fafc;
  cursor: pointer; text-align: center;
  transition: border-color .18s, background .18s, transform .18s, box-shadow .18s;
  font-family: inherit;
}
.dsf-choice-card:hover {
  border-color: #3b82f6; background: #eff6ff;
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(59,130,246,.18);
}
.dsf-choice-card:active { transform: translateY(0); }
.dsf-choice-card-icon  { font-size: 38px; }
.dsf-choice-card-title {
  font-size: 1.05rem; font-weight: 700; color: #1e3a8a;
}
.dsf-choice-card-desc  { font-size: .82rem; color: #64748b; line-height: 1.5; }

/* ── Détection auto (concept SAM côté SPA) ── */
.dsf-detect-banner {
  margin-top: 14px;
  padding: 9px 14px;
  border-radius: 8px;
  font-size: .82rem; line-height: 1.45;
  background: #f1f5f9; color: #475569;
  border: 1px solid #e2e8f0;
  text-align: left;
}
.dsf-detect-banner.dsf-detect-loading {
  background: #eff6ff; color: #1e40af; border-color: #bfdbfe;
}
.dsf-detect-banner.dsf-detect-ok {
  background: #ecfdf5; color: #065f46; border-color: #a7f3d0;
}
.dsf-detect-banner.dsf-detect-warn {
  background: #fffbeb; color: #92400e; border-color: #fde68a;
}
.dsf-detect-indices { color: #64748b; font-size: .78rem; }
.dsf-detect-hint    { color: #64748b; font-size: .78rem; font-style: italic; }
.dsf-detect-retry {
  margin-left: 6px; padding: 2px 10px;
  font-size: .76rem; font-weight: 600;
  color: #1e40af; background: #fff;
  border: 1px solid #bfdbfe; border-radius: 6px;
  cursor: pointer;
}
.dsf-detect-retry:hover { background: #eff6ff; }
/* Carte recommandée par la détection auto */
.dsf-choice-card.dsf-card-recommended {
  border-color: #10b981;
  background: #ecfdf5;
  box-shadow: 0 0 0 3px rgba(16,185,129,.15);
  position: relative;
}
.dsf-choice-card.dsf-card-recommended::after {
  content: '✓ Recommandé';
  position: absolute; top: 8px; right: 8px;
  background: #10b981; color: #fff;
  font-size: .68rem; font-weight: 700;
  padding: 2px 8px; border-radius: 10px;
}

.pdf-viewer-container {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  background: #f8fafc;
}
.pdf-viewer-container.hidden { display: none !important; }

.pdf-viewer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  background: #1e3a8a;
  color: #fff;
  flex-shrink: 0;
  gap: 12px;
}

.pdf-viewer-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 15px;
  overflow: hidden;
}

.pdf-viewer-docname {
  font-size: 13px;
  font-weight: 400;
  opacity: 0.75;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 400px;
}

.pdf-viewer-close {
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}
.pdf-viewer-close:hover { background: rgba(255,255,255,0.3); }

.pdf-split-view {
  display: flex;
  flex: 1;
  overflow: hidden;
  gap: 0;
}

/* Panneau PDF */
.pdf-panel {
  display: flex;
  flex-direction: column;
  flex: 0 0 55%;
  min-width: 200px;
  overflow: hidden;
  border-right: none;
}

.pdf-panel-header, .req-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: #f1f5f9;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.pdf-panel-label {
  font-size: 12px;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pdf-open-link {
  font-size: 12px;
  color: #0369a1;
  text-decoration: none;
  font-weight: 600;
  padding: 3px 8px;
  border: 1px solid #7dd3fc;
  border-radius: 4px;
  background: #f0f9ff;
  transition: background 0.15s;
}
.pdf-open-link:hover { background: #e0f2fe; }

.pdf-panel-body {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.pdf-frame {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  background: #525659;
}

.pdf-unavail {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #f8fafc;
  text-align: center;
  padding: 24px;
}
.pdf-unavail-icon { font-size: 48px; }
.pdf-unavail p { color: #64748b; margin: 0; font-size: 14px; }
.pdf-unavail-hint { font-size: 12px !important; color: #64748b !important; }

/* Panneau exigences liées (mode vérification TCs) */
.req-linked-panel {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.req-linked-stats {
  display: flex;
  gap: 14px;
  padding: 8px 12px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 1;
}
.req-linked-stat-covered   { color: #15803d; }
.req-linked-stat-uncovered { color: #b45309; }
.req-linked-items { padding: 8px; display: flex; flex-direction: column; gap: 5px; }
.req-linked-card {
  border: 1px solid #e2e8f0;
  border-left: 3px solid #e2e8f0;
  border-radius: 6px;
  padding: 7px 10px;
  cursor: pointer;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.req-linked-card:hover { background: #f0f9ff; border-color: #93c5fd; }
.req-linked-ok   { border-left-color: #22c55e; }
.req-linked-warn { border-left-color: #f59e0b; }
.req-linked-active {
  border-color: #1d4ed8 !important;
  background: #eff6ff !important;
  box-shadow: 0 0 0 2px rgba(29,78,216,.2) !important;
}
.req-linked-code {
  font-family: monospace;
  font-size: 11px;
  font-weight: 700;
  color: #334155;
  display: flex;
  align-items: center;
  gap: 5px;
}
.req-linked-desc {
  font-size: 11px;
  color: #64748b;
  margin-top: 3px;
  line-height: 1.4;
}
.req-linked-hint {
  font-size: 11px;
  color: #64748b;
  text-align: center;
  padding: 6px 10px 2px;
  font-style: italic;
}

/* Panneau vide avec bouton Générer TC */
.req-empty-gen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 40px 24px;
  text-align: center;
  height: 100%;
}
.req-empty-gen-msg { font-size: 13px; color: #64748b; }
.req-empty-gen-ok  { font-size: 13px; color: #15803d; font-weight: 600; }
.req-gen-tc-btn {
  background: #1d4ed8;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.55rem 1.2rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s;
}
.req-gen-tc-btn:hover:not(:disabled) { background: #1e40af; }
.req-gen-tc-btn:disabled { opacity: .6; cursor: not-allowed; }

/* Explication « pourquoi aucun cas de test auto » (au-dessus du bouton Générer) */
.req-uncov-explain {
  text-align: left;
  max-width: 560px;
  width: 100%;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-left: 3px solid #d97706;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 12.5px;
  line-height: 1.5;
  color: #475569;
}
.req-uncov-explain-title {
  font-weight: 700;
  font-size: 13px;
  color: #92400e;
  margin-bottom: 6px;
}
.req-uncov-explain p { margin: 6px 0 0; }
.req-uncov-explain code {
  background: #fef3c7;
  color: #78350f;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 11.5px;
  word-break: break-all;
}
.req-uncov-fmt { color: #475569; }
.req-uncov-cta { color: #1e3a5f; }

/* Séparateur redimensionnable */
.pdf-resizer {
  flex: 0 0 5px;
  background: #e2e8f0;
  cursor: col-resize;
  position: relative;
  transition: background 0.15s;
  z-index: 10;
}
.pdf-resizer:hover, .pdf-resizer.dragging { background: #3b82f6; }
.pdf-resizer::after {
  content: '';
  position: absolute;
  inset: 0 -4px;
}

/* Panneau exigences */
.req-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 200px;
  overflow: hidden;
  background: #fff;
}

.req-count-badge {
  display: inline-block;
  background: #3b82f6;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  margin-left: 6px;
  vertical-align: middle;
}

.req-search-bar {
  position: relative;
  padding: 10px 12px;
  border-bottom: 1px solid #f1f5f9;
  flex-shrink: 0;
}

.req-search-input {
  width: 100%;
  padding: 7px 32px 7px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 13px;
  outline: none;
  box-sizing: border-box;
  background: #f8fafc;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.req-search-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
  background: #fff;
}

.req-search-icon {
  position: absolute;
  right: 22px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  pointer-events: none;
  opacity: 0.4;
}

.req-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.req-card {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 12px;
  background: #fafbfc;
  transition: border-color 0.15s, box-shadow 0.15s;
  cursor: default;
}
.req-card:hover {
  border-color: #93c5fd;
  box-shadow: 0 2px 8px rgba(59,130,246,0.08);
  background: #f0f9ff;
}
.req-card-clickable { cursor: pointer; }
.req-card-clickable:hover { border-color: #3b82f6; }
.req-card-active {
  border-color: #1d4ed8 !important;
  background: #eff6ff !important;
  box-shadow: 0 0 0 2px rgba(29,78,216,0.2) !important;
}

.req-page-chip {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 700;
  color: #1d4ed8;
  background: #dbeafe;
  border: 1px solid #93c5fd;
  padding: 1px 6px;
  border-radius: 10px;
  white-space: nowrap;
}

.req-card-header {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 4px;
}

.req-card-code {
  font-family: monospace;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: #1e3a8a;
  padding: 2px 7px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}

.req-card-title {
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
  line-height: 1.3;
}

.req-card-desc {
  font-size: 12px;
  color: #475569;
  line-height: 1.5;
  margin-top: 4px;
}
.req-card-desc[contenteditable="true"] {
  border-radius: 4px;
  padding: 4px 6px;
  margin: 4px -6px 0;
  outline: none;
  cursor: text;
  transition: background .15s, box-shadow .15s;
}
.req-card-desc[contenteditable="true"]:hover { background: #f1f5f9; }
.req-card-desc[contenteditable="true"]:focus {
  background: #fff;
  box-shadow: 0 0 0 2px #3b82f6;
}
.req-card-modified {
  background: #fef9c3 !important;
  box-shadow: 0 0 0 1px #fde047 !important;
}

.req-priority-chip, .req-type-chip {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 10px;
  white-space: nowrap;
  font-weight: 500;
  margin-left: 4px;
  flex-shrink: 0;
}
.req-priority-chip { background: #fef3c7; color: #92400e; }
.req-type-chip      { background: #f0fdf4; color: #166534; }

/* Chip de sévérité (exigences) — couleur par niveau */
.req-severity-chip {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 10px;
  white-space: nowrap;
  font-weight: 600;
  margin-left: 4px;
  flex-shrink: 0;
  background: #fee2e2;
  color: #991b1b;
}
.req-severity-chip[data-sev="Critique"] { background: #ffedd5; color: #9a3412; }
.req-severity-chip[data-sev="Majeur"]   { background: #fef3c7; color: #92400e; }
.req-severity-chip[data-sev="Mineur"]   { background: #f1f5f9; color: #475569; }

/* Sélecteurs éditables type / priorité dans les TCs */
.req-type-select,
.req-prio-select {
  font-size: 10px;
  font-weight: 500;
  padding: 1px 4px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  margin-left: 4px;
  flex-shrink: 0;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5' viewBox='0 0 8 5'%3E%3Cpath d='M0 0l4 5 4-5z' fill='%23666'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 4px center;
  padding-right: 14px;
}
.req-type-select { background-color: #f0fdf4; color: #166534; }
.req-prio-select { background-color: #fef3c7; color: #92400e; }
.req-type-select:hover,
.req-prio-select:hover { border-color: #cbd5e1; }
.req-select-modified {
  border-color: #f59e0b !important;
  box-shadow: 0 0 0 1px #fde047;
}

.req-delete-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  padding: 2px 4px;
  border-radius: 4px;
  margin-left: auto;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity .15s, background .15s;
  line-height: 1;
}
.req-card:hover .req-delete-btn { opacity: 1; }
.req-delete-btn:hover { background: #fee2e2; }

.req-card-deleted {
  opacity: 0.45;
  border-color: #fca5a5 !important;
  background: #fff5f5 !important;
}
.req-card-deleted .req-card-desc { text-decoration: line-through; }
.req-card-deleted .req-delete-btn { opacity: 1; }

.req-card-ref {
  font-size: 11px;
  color: #64748b;
  margin-top: 4px;
  font-style: italic;
}
/* Référence DSF cliquable (page détectée) */
.req-card-ref-link {
  color: #1d4ed8;
  font-style: normal;
  font-weight: 500;
}

.req-highlight {
  background: #fde68a;
  border-radius: 2px;
  padding: 0 1px;
}

/* ── Barre de filtres ── */
.req-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px 12px;
  border-bottom: 1px solid #f1f5f9;
  background: #fff;
}
.req-filter-chip {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #475569;
  font-size: 11px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 12px;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  white-space: nowrap;
}
.req-filter-chip:hover  { background: #e2e8f0; border-color: #cbd5e1; }
.req-filter-chip.active {
  background: #1e3a8a;
  border-color: #1e3a8a;
  color: #fff;
}

/* Lignes de filtres multi-dimensions (exigences : catégorie / priorité / sévérité) */
.req-filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  width: 100%;
}
.req-filter-row + .req-filter-row { margin-top: 5px; }
.req-filter-row-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #94a3b8;
  margin-right: 2px;
}

/* ── En-têtes de groupe dans la liste ── */
.req-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 12px 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #64748b;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  border-bottom: 1px solid #e2e8f0;
  margin-top: 4px;
  position: sticky;
  top: 0;
  z-index: 1;
}
.req-group-header:first-child { margin-top: 0; border-top: none; }
.req-group-count {
  background: #e2e8f0;
  color: #475569;
  border-radius: 10px;
  padding: 1px 7px;
  font-size: 10px;
  font-weight: 600;
}

/* ── Module breadcrumb (visible quand filtre actif) ── */
.req-card-module {
  font-size: 10px;
  color: #64748b;
  margin-top: 2px;
  font-style: italic;
}

.req-empty {
  text-align: center;
  color: #64748b;
  font-size: 13px;
  padding: 32px 0;
}

@media (max-width: 768px) {
  .pdf-split-view { flex-direction: column; }
  .pdf-panel { flex: 0 0 50%; border-right: none; border-bottom: 1px solid #e2e8f0; }
  .pdf-resizer { flex: 0 0 5px; cursor: row-resize; }
  .pdf-viewer-docname { display: none; }
}

/* ══════════════════════════════════════════════════════════════
   WORKFLOW DE VALIDATION SÉQUENTIEL
   ══════════════════════════════════════════════════════════════ */

/* Cloche notifications */
.notif-bell {
  position: relative;
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: background 0.15s;
  line-height: 1;
}
.notif-bell:hover { background: rgba(0,61,166,0.08); }
.notif-badge {
  position: absolute;
  top: 0; right: 0;
  background: #ef4444;
  color: #fff;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  min-width: 16px;
  text-align: center;
  line-height: 14px;
}

/* Panneau notifications */
.notif-panel {
  position: fixed;
  top: 60px; right: 12px;
  width: 340px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,.14);
  z-index: 9000;
  overflow: hidden;
}
.notif-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  font-weight: 700;
  font-size: 13px;
  color: #1e293b;
  border-bottom: 1px solid #f1f5f9;
  background: #f8fafc;
}
.notif-list { max-height: 360px; overflow-y: auto; }
.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  cursor: pointer;
  transition: background 0.12s;
  border-bottom: 1px solid #f1f5f9;
}
.notif-item:hover { background: #f0f9ff; }
.notif-icon { font-size: 18px; flex-shrink: 0; }
.notif-body { flex: 1; min-width: 0; }
.notif-msg  { font-size: 12px; color: #1e293b; line-height: 1.45; word-break: break-word; }
.notif-time { font-size: 10px; color: #64748b; margin-top: 3px; }
.notif-empty { text-align: center; color: #64748b; font-size: 12px; padding: 20px; }

/* Badge workflow sur boutons d'extraction */
.wf-badge {
  display: inline-block;
  font-size: 11px;
  margin-left: 2px;
  vertical-align: middle;
}
.wf-valide  { color: #15803d; }
.wf-pending { color: #b45309; }
.wf-refuse  { color: #dc2626; }
.wf-extrait { color: #2563eb; }
.wf-none    { color: #64748b; }
.wf-desactive { color: #94a3b8; }

/* Extraction désactivée pour la société : bouton/onglet grisé (mais visible). */
.ext-btn.ext-disabled { opacity: .4; cursor: not-allowed; filter: grayscale(1); }
.tab-btn.tab-disabled { opacity: .45; cursor: not-allowed; }

/* Bouton "Demander validation" */
.btn-demande-val {
  background: #fff;
  color: #a16207;
  border: 1.5px solid #a16207;
  font-weight: 600;
}
.btn-demande-val:hover:not(:disabled) {
  background: #fefce8;
  border-color: #a16207;
  color: #a16207;
}
.btn-demande-val:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Badge profil valideur dans la sidebar */
.sidebar-valideur-badge {
  display: inline-block;
  background: #dcfce7;
  color: #15803d;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  margin-top: 2px;
}

/* Module Validation — onglets modale */
.val-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.val-tab-active { color: #a16207; border-bottom-color: #a16207; }

/* Cartes de demandes */
.val-request-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px 16px;
  background: #fff;
}
.val-req-info { flex: 1; min-width: 0; }
.val-req-doc  { font-weight: 700; font-size: 13px; color: #1e293b; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.val-req-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.val-req-type { background: #eff6ff; color: #1d4ed8; border-radius: 6px; padding: 2px 8px; font-size: 11px; font-weight: 600; }
.val-req-date { font-size: 11px; color: #64748b; }
.val-req-motif { margin-top: 6px; font-size: 12px; color: #dc2626; background: #fef2f2; border-radius: 6px; padding: 4px 8px; }
.val-req-actions { display: flex; gap: 8px; flex-shrink: 0; }
.val-status-pending  { background: #fff7ed; color: #b45309; border-radius: 6px; padding: 2px 8px; font-size: 11px; font-weight: 600; }
.val-status-approved { background: #dcfce7; color: #15803d; border-radius: 6px; padding: 2px 8px; font-size: 11px; font-weight: 600; }
.val-status-rejected { background: #fef2f2; color: #dc2626; border-radius: 6px; padding: 2px 8px; font-size: 11px; font-weight: 600; }

/* ═══════════════════════════════════════════════════════════════
   LANDING PAGE — HUMAIN AUGMENTÉ  (da-* prefix)
   ══════════════════════════════════════════════════════════════ */

/* Override welcome wrapper */
#welcomeScreen { max-width: none !important; padding: 0 !important; }

.da-landing {
  background: #fdf9f5;
  color: #1e1b2e;
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  margin: -28px;
  overflow: hidden;
}

/* ── HERO ───────────────────────────────────────────────────── */
.da-hero {
  display: flex;
  align-items: center;
  gap: 48px;
  padding: 72px 64px 60px;
  background: linear-gradient(155deg, #fef8ee 0%, #fdf9f5 55%, #f5f0f8 100%);
  border-bottom: 1px solid #e8e1d6;
}
.da-hero-left  { flex: 1; min-width: 0; animation: da-fadeInUp .7s ease both; }
.da-hero-right { flex: 0 0 380px; animation: da-fadeInUp .9s ease both; }
.da-hero-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #4f46e5;
  margin-bottom: 20px;
}
.da-hero-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 3rem;
  font-weight: 700;
  line-height: 1.15;
  color: #111827;
  margin: 0 0 20px;
}
.da-em {
  font-style: italic;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.da-hero-sub {
  font-size: 16px;
  line-height: 1.65;
  color: #4b5563;
  max-width: 500px;
  margin: 0 0 36px;
}
.da-hero-svg { width: 100%; height: auto; display: block; }

/* Timeline */
.da-timeline {
  display: flex;
  align-items: center;
  gap: 0;
  flex-wrap: wrap;
  gap: 4px 0;
}
.da-tl-item { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.da-tl-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: #4f46e5;
  box-shadow: 0 0 10px rgba(79,70,229,.5);
}
.da-tl-connector { flex: 1; min-width: 28px; height: 2px; }
.da-tl-label { font-size: 11px; color: #6b7280; white-space: nowrap; font-family: 'JetBrains Mono', monospace; }

/* ── SECTION HEADER ─────────────────────────────────────────── */
.da-section-header { text-align: center; margin-bottom: 48px; animation: da-fadeInUp .6s ease both; }
.da-section-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #4f46e5;
  margin: 0 0 12px;
}
.da-section-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 2.1rem;
  font-weight: 700;
  color: #111827;
  margin: 0 0 14px;
}
.da-section-sub { font-size: 15px; color: #6b7280; max-width: 580px; margin: 0 auto; line-height: 1.6; }

/* ── AGENTS ─────────────────────────────────────────────────── */
.da-agents {
  padding: 72px 64px;
  background: #f5efe7;
  border-bottom: 1px solid #e8e1d6;
}
.da-agents-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.da-agent-card {
  background: #ffffff;
  border: 1px solid #e5dfd4;
  border-radius: 16px;
  padding: 28px 24px 24px;
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
  animation: da-fadeInUp .7s ease both;
  box-shadow: 0 2px 10px rgba(80,60,30,.06);
}
.da-agent-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 16px 48px var(--da-accent-glow, rgba(79,70,229,.12));
  border-color: var(--da-accent, #4f46e5);
}
.da-agent-portrait { width: 100px; height: 110px; margin: 0 auto 18px; display: block; }
.da-agent-portrait svg { width: 100%; height: 100%; }
.da-agent-name {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--da-accent, #4f46e5);
  text-align: center;
  margin-bottom: 4px;
}
.da-agent-role { font-size: 12px; color: #6b7280; text-align: center; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 14px; font-family: 'JetBrains Mono', monospace; }
.da-agent-desc { font-size: 13.5px; color: #4b5563; line-height: 1.6; margin-bottom: 18px; text-align: center; }
.da-agent-skills { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.da-agent-skills li { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #374151; }
.da-skill-dot {
  flex-shrink: 0;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--da-accent, #4f46e5);
  box-shadow: 0 0 6px var(--da-accent, #4f46e5);
}

/* ── COMPARISON TABLE ───────────────────────────────────────── */
.da-compare {
  padding: 72px 64px;
  background: #fdf9f5;
  border-bottom: 1px solid #e8e1d6;
}
.da-compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.da-compare-table th,
.da-compare-table td {
  padding: 13px 16px;
  text-align: left;
  border-bottom: 1px solid #ece6dd;
  color: #4b5563;
}
.da-compare-table thead th { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; padding-bottom: 14px; font-family: 'JetBrains Mono', monospace; }
.da-compare-table tbody tr:hover td { background: rgba(79,70,229,.03); }
/* Le 1er en-tête de ligne (scope="row") garde l'apparence d'une cellule normale */
.da-compare-table td:first-child,
.da-compare-table tbody th { color: #111827; font-weight: 500; font-size: 13.5px; }
.da-col-manual { color: #dc2626 !important; }
.da-col-MEL    { color: #7c3aed !important; }
.da-col-sam    { color: #0e7490 !important; }
.da-col-bert   { color: #b45309 !important; }
.da-win {
  font-weight: 600;
  position: relative;
}

/* ── FOOTER ─────────────────────────────────────────────────── */
.da-footer-cta {
  padding: 60px 64px;
  text-align: center;
  background: #f5efe7;
}
.da-footer-inner { max-width: 760px; margin: 0 auto; }
.da-footer-tech { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-bottom: 32px; }
.da-tech-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid var(--tc, #4f46e5);
  color: var(--tc, #4f46e5);
  background: rgba(255,255,255,.75);
  letter-spacing: .06em;
}
.da-footer-quote {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 15px;
  font-style: italic;
  color: #4b5563;
  border-left: 3px solid #b45309;
  text-align: left;
  padding: 12px 20px;
  margin: 0 0 24px;
  line-height: 1.65;
  background: rgba(180,83,9,.04);
  border-radius: 0 6px 6px 0;
}
.da-footer-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: #9ca3af;
  letter-spacing: .08em;
}

/* ── ANIMATIONS ─────────────────────────────────────────────── */
@keyframes da-fadeInUp {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes da-pulse {
  0%, 100% { opacity: .4; transform: scale(1); }
  50%       { opacity: 1; transform: scale(1.25); }
}

/* ── RESPONSIVE ─────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .da-hero { flex-direction: column; padding: 52px 40px 48px; gap: 36px; }
  .da-hero-right { flex: none; width: 100%; max-width: 340px; margin: 0 auto; }
  .da-agents-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .da-landing { margin: -20px; }
  .da-hero { padding: 40px 24px; }
  .da-hero-title { font-size: 2.1rem; }
  .da-agents { padding: 48px 24px; }
  .da-agents-grid { grid-template-columns: 1fr; }
  .da-compare { padding: 48px 24px; }
  .da-footer-cta { padding: 48px 24px; }
}

/* ══════════════════════════════════════════════════════════════
   SCORE DE CONFIANCE
   ══════════════════════════════════════════════════════════════ */

/* Couleurs sémantiques — WCAG AA (ratio ≥ 4.5:1 sur blanc) */
:root {
  --conf-high-bg:     #f0fdf4;
  --conf-high-border: #bbf7d0;
  --conf-high-color:  #15803d;  /* ratio 5.1:1 */
  --conf-high-track:  #dcfce7;

  --conf-med-bg:      #fffbeb;
  --conf-med-border:  #fde68a;
  --conf-med-color:   #b45309;  /* ratio 4.8:1 */
  --conf-med-track:   #fef3c7;

  --conf-low-bg:      #fef2f2;
  --conf-low-border:  #fecaca;
  --conf-low-color:   #b91c1c;  /* ratio 5.2:1 */
  --conf-low-track:   #fee2e2;
}

/* ── Bandeau principal ── */
#confidenceBanner {
  border-bottom: 1px solid var(--grey-200);
  font-size: 13px;
}

.conf-badge-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  border-left: 4px solid transparent;
  flex-wrap: wrap;
}
.conf-badge-bar.level-high   { background: var(--conf-high-bg); border-color: var(--conf-high-color); }
.conf-badge-bar.level-medium { background: var(--conf-med-bg);  border-color: var(--conf-med-color);  }
.conf-badge-bar.level-low    { background: var(--conf-low-bg);  border-color: var(--conf-low-color);  }

.conf-icon {
  font-size: 15px;
  flex-shrink: 0;
}

.conf-label {
  font-weight: 600;
  white-space: nowrap;
}
.level-high   .conf-label { color: var(--conf-high-color); }
.level-medium .conf-label { color: var(--conf-med-color);  }
.level-low    .conf-label { color: var(--conf-low-color);  }

.conf-sep { color: #64748b; }

.conf-provider {
  color: var(--grey-600);
  font-size: 12px;
}

/* Bouton Voir le détail */
.conf-detail-btn {
  background: transparent;
  border: 1px solid currentColor;
  border-radius: 5px;
  padding: 2px 9px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  margin-left: auto;
  white-space: nowrap;
}
.level-high   .conf-detail-btn { color: var(--conf-high-color); }
.level-medium .conf-detail-btn { color: var(--conf-med-color);  }
.level-low    .conf-detail-btn { color: var(--conf-low-color);  }
.conf-detail-btn:hover { background: rgba(0,0,0,.06); }

/* ── Tooltip (survol du badge) ── */
.conf-tooltip-wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: default;
}

.conf-tooltip {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 300;
  background: #1e293b;
  color: #f1f5f9;
  border-radius: 8px;
  padding: 12px 14px;
  min-width: 240px;
  box-shadow: var(--shadow-lg);
  pointer-events: none;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity .18s ease, transform .18s ease;
  font-size: 12px;
  line-height: 1.4;
}
.conf-tooltip-wrap:hover .conf-tooltip,
.conf-tooltip-wrap:focus-within .conf-tooltip {
  opacity: 1;
  transform: translateY(0);
}

.conf-tooltip-title {
  font-weight: 600;
  margin-bottom: 8px;
  color: #e2e8f0;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.conf-tooltip-row {
  display: grid;
  grid-template-columns: 120px 1fr 32px;
  align-items: center;
  gap: 6px;
  margin-bottom: 5px;
}
.conf-tooltip-row:last-child { margin-bottom: 0; }

.conf-tooltip-name {
  font-size: 11px;
  color: #64748b;
  white-space: nowrap;
}

.conf-tooltip-track {
  background: #334155;
  border-radius: 3px;
  height: 6px;
  overflow: hidden;
}
.conf-tooltip-fill {
  height: 100%;
  border-radius: 3px;
  transition: width .4s ease;
}
.conf-tooltip-fill.level-high   { background: #4ade80; }
.conf-tooltip-fill.level-medium { background: #fbbf24; }
.conf-tooltip-fill.level-low    { background: #f87171; }

.conf-tooltip-pct {
  font-size: 11px;
  font-weight: 600;
  color: #e2e8f0;
  text-align: right;
}

/* ── Bannière d'action (score < 85 %) ── */
.conf-action-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  font-size: 12px;
  flex-wrap: wrap;
}
.conf-action-bar.level-medium {
  background: var(--conf-med-track);
  border-bottom: 1px solid var(--conf-med-border);
  color: var(--conf-med-color);
}
.conf-action-bar.level-low {
  background: var(--conf-low-track);
  border-bottom: 1px solid var(--conf-low-border);
  color: var(--conf-low-color);
}

.conf-action-text {
  flex: 1;
  font-weight: 500;
}

.conf-action-btn {
  border: none;
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity var(--transition);
  white-space: nowrap;
}
.conf-action-btn:hover { opacity: .85; }

.conf-action-btn.primary {
  background: var(--blue-800);
  color: #fff;
}
.conf-action-btn.secondary {
  background: transparent;
  border: 1px solid currentColor;
}

/* ── Barres de facteurs dans la modale ── */
.conf-factor-bar-row {
  display: grid;
  grid-template-columns: 140px 1fr 38px;
  align-items: center;
  gap: 8px;
}
.conf-factor-bar-label {
  font-size: 12px;
  color: var(--grey-700);
}
.conf-factor-bar-track {
  background: var(--grey-200);
  border-radius: 4px;
  height: 8px;
  overflow: hidden;
}
.conf-factor-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width .5s ease;
}
.conf-factor-bar-fill.level-high   { background: #16a34a; }
.conf-factor-bar-fill.level-medium { background: #d97706; }
.conf-factor-bar-fill.level-low    { background: #dc2626; }
.conf-factor-bar-pct {
  font-size: 12px;
  font-weight: 600;
  color: var(--grey-700);
  text-align: right;
}

/* ════════════════════════════════════════════════════════════════
   BANDEAU DE DIAGNOSTIC TECHNIQUE (MAX_CHARS / MAX_TOKENS)
   ════════════════════════════════════════════════════════════════ */
#diagnosticBanner {
  border-bottom: 1px solid var(--grey-200);
  font-size: 12px;
  background: #f8fafc;
}

.diag-bar {
  display: flex;
  align-items: stretch;
  padding: 8px 16px;
  flex-wrap: wrap;
  gap: 8px;
}

.diag-block {
  flex: 1;
  min-width: 240px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.diag-block-header {
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--grey-600);
}

.diag-block-icon { font-size: 13px; }

.diag-muted {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: #64748b;
  font-size: 10px;
}

.diag-metrics {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.diag-metric {
  color: var(--grey-700);
}

.diag-status-ok {
  color: #15803d;
  font-weight: 500;
}
.diag-status-warn {
  color: #b45309;
  font-weight: 600;
}
.diag-status-info {
  color: var(--grey-500);
  font-style: italic;
}

.diag-rec {
  font-size: 11px;
  color: #92400e;
  background: #fef3c7;
  border: 1px solid #fde68a;
  border-radius: 4px;
  padding: 4px 8px;
  margin-top: 3px;
}
.diag-rec-info {
  color: #1e40af;
  background: #eff6ff;
  border-color: #bfdbfe;
}

/* ── Tooltip de paramètre (MAX_CHARS / MAX_TOKENS) ── */
.diag-param-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  cursor: help;
}
.diag-param-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #94a3b8;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  font-style: normal;
  line-height: 1;
  flex-shrink: 0;
  vertical-align: middle;
}
.diag-param-tooltip {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 400;
  background: #1e293b;
  color: #f1f5f9;
  border-radius: 8px;
  padding: 14px 16px;
  width: 370px;
  box-shadow: 0 4px 24px rgba(0,0,0,.45);
  pointer-events: none;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity .18s ease, transform .18s ease;
  font-size: 11.5px;
  line-height: 1.5;
  white-space: normal;
}
.diag-param-wrap:hover .diag-param-tooltip {
  opacity: 1;
  transform: translateY(0);
}
.diag-param-tooltip-title {
  font-weight: 700;
  font-size: 12px;
  color: #e2e8f0;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid #334155;
}
.diag-param-tooltip-body {
  color: #cbd5e1;
  margin-bottom: 8px;
  font-size: 11px;
}
.diag-param-tooltip-warn {
  background: #451a03;
  border: 1px solid #78350f;
  border-radius: 4px;
  padding: 5px 8px;
  color: #fcd34d;
  font-size: 10.5px;
  margin-bottom: 8px;
}
.diag-param-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10.5px;
}
.diag-param-table th {
  text-align: left;
  color: #64748b;
  font-weight: 600;
  padding: 3px 6px;
  border-bottom: 1px solid #334155;
}
.diag-param-table td {
  padding: 3px 6px;
  color: #e2e8f0;
  border-bottom: 1px solid #263245;
}
/* En-têtes de ligne (scope="row") dans le corps : même apparence que les
   cellules de données pour ne pas régresser le contraste sur fond sombre. */
.diag-param-table tbody th {
  color: #e2e8f0;
  border-bottom: 1px solid #263245;
}
.diag-param-table tr:last-child td,
.diag-param-table tbody tr:last-child th { border-bottom: none; }

/* Variante alignée à droite — pour les tooltips côté droit du bandeau */
.diag-param-tooltip--right {
  right: 0;
  left: auto;
}

.diag-sep-v {
  width: 1px;
  background: var(--grey-200);
  align-self: stretch;
  margin: 0 8px;
  flex-shrink: 0;
}

/* ───────────────────────────────────────────────────────────────
   Administration — Boutons harmonisés
   ─────────────────────────────────────────────────────────────── */

.admin-btn {
  align-self: flex-start;
  background: var(--blue-800);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 18px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: background var(--transition), transform var(--transition);
}

.admin-btn:hover {
  background: var(--blue-700);
  transform: translateY(-1px);
}

.admin-btn:active {
  transform: translateY(0);
}

.admin-btn--secondary {
  background: #7c3aed;
}

.admin-btn--secondary:hover {
  background: #6d28d9;
}

.admin-btn--success {
  background: #15803d;
}

.admin-btn--success:hover {
  background: #166534;
}

.admin-btn--danger {
  background: #dc2626;
}

.admin-btn--danger:hover {
  background: #991b1b;
}

/* ═══════════════════════════════════════════════════════════════
   BANDE MODE EXÉCUTION (Simulation/Réel)
   ═══════════════════════════════════════════════════════════════ */

.execution-mode-banner {
  /* Bandeau fixé tout en haut, AU-DESSUS de la bande bleue (header).
     Style aligné sur le bandeau React (ModeBanner.jsx) : la couleur configurée
     du mode (Simulation/Réel) remplit toute la longueur, message à gauche +
     bouton de bascule à droite. */
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 101;                 /* au-dessus du header (z-index 100), sous le modeStripe (9999) */
  box-sizing: border-box;
  height: var(--exec-banner-h);
  background: linear-gradient(90deg, var(--mode-bg) 0%, color-mix(in srgb, var(--mode-bg) 70%, var(--mode-primary) 30%) 100%);
  border-bottom: 2px solid var(--mode-primary);
  color: var(--mode-text);
  transition: background var(--transition), border-color var(--transition), color var(--transition);
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 13px;
  font-weight: 600;
}

.execution-mode-banner.hidden {
  display: none;
}

/* Quand le bandeau est visible (non-reader) : décaler le header + le contenu vers le bas */
body.exec-banner-on .header { top: var(--exec-banner-h); }
body.exec-banner-on .layout { padding-top: calc(var(--header-h) + var(--exec-banner-h)); }
body.exec-banner-on .sidebar-overlay { top: calc(var(--header-h) + var(--exec-banner-h)); }
@media (max-width: 768px) {
  body.exec-banner-on .sidebar { top: calc(var(--header-h) + var(--exec-banner-h)); }
}

.execution-mode-icon {
  font-size: 18px;
  flex-shrink: 0;
  line-height: 1;
}

.execution-mode-message {
  flex: 1;
  min-width: 0;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.execution-mode-message strong { font-weight: 700; }

/* Bouton de bascule — style aligné sur ModeBanner.jsx :
   - Réel       → bouton plein (couleur primaire, texte blanc)
   - Simulation → bouton blanc bordé de la couleur du mode */
.execution-mode-toggle {
  flex-shrink: 0;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  background: var(--mode-primary);
  color: #fff;
  border: 1px solid var(--mode-primary);
  transition: opacity var(--transition);
}

.execution-mode-toggle:hover { opacity: 0.85; }

body[data-exec-mode="simulation"] .execution-mode-toggle {
  background: #fff;
  color: var(--mode-text);
  border: 1px solid var(--mode-text);
}
