
:root {
  /* ═══ Palette Flex Énergie v6.8b — Teal & Cyan ═══ */

  --bg-from:    #e8f5e9;
  --bg-to:      #fafff5;
  --surface:    #ffffff;
  --surface2:   #f1f8e9;
  --border:     #a5d6a7;
  --border2:    #66bb6a;
  --text:       #263238;
  --text2:      #37474f;
  --text3:      #78909c;
  /* ── Teal/Cyan primaire ── */
  --teal:       #00897b;
  --teal-dark:  #00695c;
  --teal-mid:   #00897b;
  --teal-light: #80deea;
  --cyan:       #26c6da;
  --cyan-dark:  #0097a7;
  /* ── Vert secondaire ── */
  --green:      #2e7d32;
  --green-btn:  #2e7d32;
  --green-dark: #1b5e20;
  --green-light: #c8e6c9;
  --green-mid:  #388e3c;
  /* ── Accent doré ── */
  --gold:       #f9a825;
  --gold-dark:  #f57f17;
  --gold-light: #fff8e1;
  --amber:      #f9a825;
  --amber-light: #fff8e1;
  /* ── Actions ── */
  --red-btn:    #c62828;
  --orange-btn: #f9a825;
  --red:        #c62828;
  --red-light:  #ffebee;
  /* ── Legacy ── */
  --blue:       #00897b;
  --blue-light: #80deea;
  --primary:    #00897b;
  --card:       #ffffff;
  --sidebar-bg: #1a3a4a;
  --bg:         #f5f9f5;
  --bg2:        #eef4ee;
  --bg3:        #e6ede6;
  --text1:      #1a2a2f;
  --radius:    16px;
  --radius-sm: 8px;
  --shadow:    0 2px 12px rgba(0,0,0,.06);
  --shadow-md: 0 4px 20px rgba(0,0,0,.10);
}

/* ═══════════════════════════════════════════════════
   MODE NUIT — Dark Theme v6.6c (refonte complète)
   Inspiré des standards : GitHub Dark, Linear, Notion
   Contraste WCAG AA garanti sur tous les éléments
   ═══════════════════════════════════════════════════ */
[data-theme="dark"] {
  --bg-from:    #0f1a1e;
  --bg-to:      #101c20;
  --surface:    #1a2930;
  --surface2:   #1f3340;
  --surface3:   #243b48;
  --border:     #2a4a55;
  --border2:    #3a6070;
  --text:       #e0eaef;
  --text2:      #b0c4cc;
  --text3:      #8aa4b0;
  /* ── Teal/Cyan (lumineux en dark) ── */
  --teal:       #26a69a;
  --teal-dark:  #00897b;
  --teal-mid:   #26a69a;
  --teal-light: #4dd0c0;
  --cyan:       #4dd0e1;
  --cyan-dark:  #00acc1;
  /* ── Vert (plus clair pour contraste) ── */
  --green:      #66bb6a;
  --green-btn:  #43a047;
  --green-dark: #2e7d32;
  --green-light: #1a3a2a;
  --green-mid:  #66bb6a;
  /* ── Accent doré ── */
  --gold:       #fbc02d;
  --gold-dark:  #f9a825;
  --gold-light: #2a2510;
  --amber:      #fbc02d;
  --amber-light: #2a2510;
  /* ── Actions ── */
  --red-btn:    #ef5350;
  --orange-btn: #fbc02d;
  --red:        #ef5350;
  --red-light:  #2a1515;
  /* ── Legacy ── */
  --blue:       #26a69a;
  --blue-light: #4dd0c0;
  --primary:    #26a69a;
  --card:       #1a2930;
  --sidebar-bg: #0e2030;
  --bg:         #121e24;
  --bg2:        #172830;
  --bg3:        #1e3340;
  --text1:      #e0eaef;
  --shadow:     0 2px 12px rgba(0,0,0,.25);
  --shadow-md:  0 4px 20px rgba(0,0,0,.35);
}
[data-theme="dark"] body {
  background: linear-gradient(135deg, #0f1a1e 0%, #0d1f25 30%, #12222a 65%, #101c20 100%) fixed;
}

/* ── Sidebar ── */
[data-theme="dark"] .sidebar {
  background: linear-gradient(180deg, #0a1f2a 0%, #06141c 100%);
}

/* ── Cards, modals, surfaces ── */
[data-theme="dark"] .card,
[data-theme="dark"] .modal-content,
[data-theme="dark"] .suivi-block,
[data-theme="dark"] .compteur-card {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}
[data-theme="dark"] .modal-overlay {
  background: rgba(0,0,0,0.7);
}
[data-theme="dark"] .modal-header {
  border-color: var(--border);
}

/* ── Texte global — forcer lisibilité totale ── */
[data-theme="dark"] {
  color: var(--text);
}
[data-theme="dark"] h1, [data-theme="dark"] h2,
[data-theme="dark"] h3, [data-theme="dark"] h4,
[data-theme="dark"] h5, [data-theme="dark"] h6 {
  color: var(--text) !important;
}
[data-theme="dark"] p,
[data-theme="dark"] span:not([style*="color"]),
[data-theme="dark"] div:not([style*="color"]),
[data-theme="dark"] li,
[data-theme="dark"] td:not([style*="color"]),
[data-theme="dark"] th,
[data-theme="dark"] label,
[data-theme="dark"] legend,
[data-theme="dark"] .form-label,
[data-theme="dark"] .info-label,
[data-theme="dark"] .info-value,
[data-theme="dark"] .card-title,
[data-theme="dark"] .fiche-title,
[data-theme="dark"] .topbar-title,
[data-theme="dark"] .breadcrumb .current,
[data-theme="dark"] .contact-name,
[data-theme="dark"] .contact-role,
[data-theme="dark"] .contact-contact,
[data-theme="dark"] .suivi-label,
[data-theme="dark"] .suivi-finlabel,
[data-theme="dark"] .pipeline-label,
[data-theme="dark"] .etude-label,
[data-theme="dark"] .demande-card-label,
[data-theme="dark"] .suivi-echeance-label,
[data-theme="dark"] .grp-check-label {
  color: var(--text) !important;
}
[data-theme="dark"] .info-label,
[data-theme="dark"] .form-label,
[data-theme="dark"] .suivi-finlabel,
[data-theme="dark"] .etude-label,
[data-theme="dark"] .grp-check-label,
[data-theme="dark"] .topbar-subtitle,
[data-theme="dark"] .contact-role,
[data-theme="dark"] .suivi-echeance-label,
[data-theme="dark"] .demande-card-label,
[data-theme="dark"] .breadcrumb {
  color: var(--text3) !important;
}
[data-theme="dark"] .contact-contact {
  color: var(--text2) !important;
}
[data-theme="dark"] .pipeline-label {
  color: var(--text2) !important;
}

/* ── Inputs & selects ── */
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea,
[data-theme="dark"] .form-input,
[data-theme="dark"] .form-select,
[data-theme="dark"] .suivi-fininput,
[data-theme="dark"] .suivi-textarea {
  background: #152028 !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
}
[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
  color: var(--text3) !important;
}
[data-theme="dark"] input:focus,
[data-theme="dark"] select:focus,
[data-theme="dark"] textarea:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px rgba(38,166,154,0.2);
}
[data-theme="dark"] input[readonly] {
  background: #111c22 !important;
  color: var(--text2) !important;
}

/* ── Tableaux ── */
[data-theme="dark"] table {
  color: var(--text);
}
[data-theme="dark"] .suivi-contrats-table th,
[data-theme="dark"] .contrats-table th,
[data-theme="dark"] table thead th {
  background: #15252e !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}
[data-theme="dark"] .suivi-contrats-table td,
[data-theme="dark"] .contrats-table td,
[data-theme="dark"] table tbody td {
  border-color: var(--border) !important;
  color: var(--text);
}
[data-theme="dark"] .suivi-contrats-table tr:hover td,
[data-theme="dark"] .contrats-table tr:hover td,
[data-theme="dark"] table tbody tr:hover td {
  background: var(--surface2);
}
[data-theme="dark"] .contrats-table tbody tr.actif {
  background: rgba(38,166,154,0.06);
}

/* ── Badges (tous les types) ── */
[data-theme="dark"] .badge-gray    { background: #1f3340; color: #8aa4b0; }
[data-theme="dark"] .badge-orange  { background: #2a1f10; color: #ffb74d; }
[data-theme="dark"] .badge-blue    { background: #0f2535; color: #4fc3f7; }
[data-theme="dark"] .badge-green   { background: #1a3020; color: #81c784; }
[data-theme="dark"] .badge-elec    { background: #1a2e38; color: #4dd0e1; }
[data-theme="dark"] .badge-gaz     { background: #2a1f15; color: #ff8a65; }
[data-theme="dark"] .badge-resilie { background: #2a1515; color: #ef5350; }
[data-theme="dark"] .ct-badge-actif   { background: #1a3020; color: #81c784; }
[data-theme="dark"] .ct-badge-expired { background: #2a1f10; color: #ffb74d; }

/* ── Suivi badges ── */
[data-theme="dark"] .suivi-badge.actif    { background: #1a3020; color: #81c784; }
[data-theme="dark"] .suivi-badge.expire   { background: #2a1515; color: #ef5350; }
[data-theme="dark"] .suivi-badge.alerte   { background: #2a1f10; color: #ffb74d; }
[data-theme="dark"] .suivi-badge.en_cours { background: #0f2535; color: #4fc3f7; }
[data-theme="dark"] .suivi-badge.envoyee  { background: #2a2510; color: #fbc02d; }
[data-theme="dark"] .suivi-badge.recue    { background: #1a3020; color: #81c784; }
[data-theme="dark"] .suivi-badge.validee  { background: #1a3020; color: #a5d6a7; }
[data-theme="dark"] .suivi-badge.refusee  { background: #2a1515; color: #ef5350; }
[data-theme="dark"] .suivi-badge.annulee  { background: #1f2d35; color: #8aa4b0; }
[data-theme="dark"] .suivi-badge.sans     { background: #1f2d35; color: #8aa4b0; }

/* ── Groupe site status ── */
[data-theme="dark"] .grp-site-status.ok   { background: #1a3020; color: #81c784; }
[data-theme="dark"] .grp-site-status.ko   { background: #2a1f10; color: #ffb74d; }

/* ── Étude badges ── */
[data-theme="dark"] .etude-badge.c5  { background: #0f2535; color: #4fc3f7; }
[data-theme="dark"] .etude-badge.c4  { background: #2a1f10; color: #ffb74d; }
[data-theme="dark"] .etude-badge.gaz { background: #1f1530; color: #ce93d8; }
[data-theme="dark"] .etude-rentabilite.positive { color: #81c784; }

/* ── Pipeline stages ── */
[data-theme="dark"] .pipeline-stage {
  background: var(--surface);
  border-color: var(--border);
}
[data-theme="dark"] .pipeline-stage:hover {
  background: var(--surface2);
  border-color: var(--primary);
}

/* ── Suivi checklist ── */
[data-theme="dark"] .suivi-checklist-col-title {
  background: rgba(38,166,154,0.1);
  color: var(--teal-light);
}

/* ── Tabs — fond sombre, texte clair ── */
[data-theme="dark"] .tab {
  background: var(--surface2) !important;
  color: var(--text2) !important;
  border-color: var(--border) !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2) !important;
}
[data-theme="dark"] .tab:hover {
  background: var(--surface3) !important;
  color: var(--text) !important;
}
[data-theme="dark"] .tab.active {
  background: linear-gradient(135deg, var(--teal-dark), var(--teal)) !important;
  color: #fff !important;
  border-color: var(--teal) !important;
  box-shadow: 0 3px 12px rgba(38,166,154,0.3) !important;
}
[data-theme="dark"] .tab-badge,
[data-theme="dark"] .tab:not(.active) .tab-badge {
  background: rgba(38,166,154,0.2) !important;
  color: var(--teal-light) !important;
}
[data-theme="dark"] .tab.active .tab-badge {
  background: rgba(255,255,255,0.25) !important;
  color: #fff !important;
}

/* ── Boutons ── */
[data-theme="dark"] .btn-ghost {
  background: var(--surface2) !important;
  color: var(--text2) !important;
  border-color: var(--border) !important;
}
[data-theme="dark"] .btn-ghost:hover {
  background: var(--surface3) !important;
  color: var(--text) !important;
}
[data-theme="dark"] .btn-secondary {
  background: var(--surface2) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}
[data-theme="dark"] .btn {
  color: var(--text);
}
[data-theme="dark"] .suivi-btn-sm {
  color: var(--text2);
}

/* ── Documents tree ── */
[data-theme="dark"] .tree-body {
  background: var(--surface) !important;
}
[data-theme="dark"] .tree-node > .tree-hdr {
  background: var(--surface) !important;
  color: var(--text) !important;
}
[data-theme="dark"] .tree-node[data-depth="0"] > .tree-hdr {
  background: var(--surface2) !important;
  color: var(--text) !important;
}
[data-theme="dark"] .doc-name {
  color: var(--text) !important;
}

/* ── Search input ── */
[data-theme="dark"] .search-input {
  background: var(--surface) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}
[data-theme="dark"] .search-input:focus {
  background: var(--surface) !important;
  border-color: var(--primary) !important;
}

/* ── Upload zone ── */
[data-theme="dark"] .upload-zone {
  background: var(--surface) !important;
  border-color: var(--border) !important;
  color: var(--text2) !important;
}

/* ── Catch-all : tous les rgba(255,255,255,...) backgrounds ── */
[data-theme="dark"] [style*="background:rgba(255,255,255"],
[data-theme="dark"] [style*="background: rgba(255,255,255"] {
  background: var(--surface2) !important;
}

/* ── KPI / Stats ── */
[data-theme="dark"] .suivi-echeance-item {
  background: var(--surface);
  border-color: var(--border);
}
[data-theme="dark"] .stat-value {
  color: var(--text) !important;
}
[data-theme="dark"] .stat-label {
  color: var(--text3);
}
/* Stats colorées : convertir vers couleurs claires */
[data-theme="dark"] .stat-value[style*="color:#2E7D32"],
[data-theme="dark"] .stat-value[style*="color:#2e7d32"],
[data-theme="dark"] [style*="color:#2E7D32"],
[data-theme="dark"] [style*="color:#2e7d32"] {
  color: #81c784 !important;
}
[data-theme="dark"] [style*="color:#1565C0"],
[data-theme="dark"] [style*="color:#1565c0"] {
  color: #4fc3f7 !important;
}
[data-theme="dark"] [style*="color:#0D1B2A"],
[data-theme="dark"] [style*="color:#0d1b2a"] {
  color: #e0eaef !important;
}
[data-theme="dark"] [style*="color:#222"] {
  color: var(--text) !important;
}
[data-theme="dark"] [style*="color:#1a1a1a"] {
  color: var(--text) !important;
}
[data-theme="dark"] [style*="color:#666"] {
  color: var(--text3) !important;
}
[data-theme="dark"] [style*="color:#555"] {
  color: var(--text2) !important;
}
[data-theme="dark"] [style*="color:#999"] {
  color: var(--text3) !important;
}
[data-theme="dark"] [style*="color:#000000"] {
  color: var(--text) !important;
}
[data-theme="dark"] [style*="color:#006400"] {
  color: #81c784 !important;
}
[data-theme="dark"] [style*="color:#008000"] {
  color: #66bb6a !important;
}
[data-theme="dark"] [style*="color:#0000FF"],
[data-theme="dark"] [style*="color:#0000ff"] {
  color: #4fc3f7 !important;
}
[data-theme="dark"] [style*="color:#1B5E20"],
[data-theme="dark"] [style*="color:#1b5e20"] {
  color: #a5d6a7 !important;
}
[data-theme="dark"] [style*="color:#E65100"],
[data-theme="dark"] [style*="color:#e65100"] {
  color: #ffb74d !important;
}
[data-theme="dark"] [style*="color:#7B1FA2"],
[data-theme="dark"] [style*="color:#7b1fa2"] {
  color: #ce93d8 !important;
}
[data-theme="dark"] [style*="color:#C62828"],
[data-theme="dark"] [style*="color:#c62828"] {
  color: #ef5350 !important;
}
[data-theme="dark"] [style*="color:#B71C1C"],
[data-theme="dark"] [style*="color:#b71c1c"] {
  color: #ef5350 !important;
}

/* ── Backgrounds clairs → sombres ── */
[data-theme="dark"] [style*="background:#f5f5f5"],
[data-theme="dark"] [style*="background: #f5f5f5"] {
  background: var(--surface) !important;
  color: var(--text) !important;
}
[data-theme="dark"] [style*="background:#f8f9fa"],
[data-theme="dark"] [style*="background: #f8f9fa"] {
  background: #111c22 !important;
  color: var(--text2) !important;
}
[data-theme="dark"] [style*="background:white"],
[data-theme="dark"] [style*="background: white"],
[data-theme="dark"] [style*="background:#fff;"],
[data-theme="dark"] [style*="background: #fff;"],
[data-theme="dark"] [style*="background:#ffffff"] {
  background: var(--surface) !important;
  color: var(--text) !important;
}
[data-theme="dark"] [style*="background:#e8f5e9"],
[data-theme="dark"] [style*="background:#E8F5E9"] {
  background: #1a3020 !important;
  color: var(--text) !important;
}
[data-theme="dark"] [style*="background:#e3f2fd"],
[data-theme="dark"] [style*="background:#E3F2FD"] {
  background: #0f2535 !important;
  color: #4fc3f7 !important;
}
[data-theme="dark"] [style*="background:#fff3e0"],
[data-theme="dark"] [style*="background:#FFF3E0"] {
  background: #2a1f10 !important;
  color: #ffb74d !important;
}
[data-theme="dark"] [style*="background:#F3E5F5"] {
  background: #1f1530 !important;
  color: #ce93d8 !important;
}
[data-theme="dark"] [style*="background:#fff5f5"] {
  background: #2a1515 !important;
  color: var(--text) !important;
}
[data-theme="dark"] [style*="background:#fff0f0"] {
  background: #2a1515 !important;
}
[data-theme="dark"] [style*="background:#fff3e6"] {
  background: #2a2510 !important;
  color: var(--text) !important;
}
[data-theme="dark"] [style*="background:#FFF8E1"] {
  background: #2a2510 !important;
  color: #fbc02d !important;
}
[data-theme="dark"] [style*="background:#FFEBEE"] {
  background: #2a1515 !important;
  color: #ef5350 !important;
}
[data-theme="dark"] [style*="background:#F5F5F5"] {
  background: #1f2d35 !important;
  color: #8aa4b0 !important;
}
[data-theme="dark"] [style*="background:#e6f4ea"],
[data-theme="dark"] [style*="background:#E6F4EA"] {
  background: #1a3020 !important;
  color: #81c784 !important;
}
[data-theme="dark"] [style*="background:#e8f4fd"] {
  background: #0f2535 !important;
  color: #4fc3f7 !important;
}
[data-theme="dark"] [style*="background:#fdecea"] {
  background: #2a1515 !important;
  color: #ef5350 !important;
}

/* ── Borders claires → sombres ── */
[data-theme="dark"] [style*="border-color:#ffcccc"],
[data-theme="dark"] [style*="border:1.5px solid #ffcccc"] {
  border-color: #5a2020 !important;
}
[data-theme="dark"] [style*="border-top:1px solid #e0e0e0"],
[data-theme="dark"] [style*="border:1px solid #e0e0e0"],
[data-theme="dark"] [style*="border-color:#e0e0e0"] {
  border-color: var(--border) !important;
}
[data-theme="dark"] [style*="border:1px solid #ddd"],
[data-theme="dark"] [style*="border-top:1px solid #ddd"] {
  border-color: var(--border) !important;
}
[data-theme="dark"] [style*="border:1px solid #f0c68a"] {
  border-color: #5a4520 !important;
}

/* ── Search bar ── */
[data-theme="dark"] .search-bar input,
[data-theme="dark"] .search-input {
  background: #152028 !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
}
[data-theme="dark"] .search-input:focus {
  background: #152028 !important;
}

/* ── Upload zone ── */
[data-theme="dark"] .upload-zone {
  background: #152028;
  border-color: var(--border);
  color: var(--text2);
}

/* ── Toasts ── */
[data-theme="dark"] .toast {
  background: var(--surface2);
  color: var(--text);
  border-color: var(--border);
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

/* ── Documents ── */
[data-theme="dark"] .tree-hdr:hover { background: var(--surface2); }
[data-theme="dark"] .doc-item:hover { background: var(--surface2); }
[data-theme="dark"] .doc-item { color: var(--text); }
[data-theme="dark"] .doc-icon.pdf { background: #2a1515; }
[data-theme="dark"] .doc-icon.xls { background: #1a3020; }
[data-theme="dark"] .doc-icon.img { background: #0f2535; }

/* ── Nav items ── */
[data-theme="dark"] .nav-item.active {
  background: rgba(38,166,154,0.15);
}

/* ── Étude aperçu document ── */
[data-theme="dark"] .etude-apercu-document {
  background: var(--surface) !important;
  color: var(--text) !important;
}
[data-theme="dark"] .etude-apercu-document th {
  background: #15252e !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}
[data-theme="dark"] .etude-apercu-document td {
  color: var(--text) !important;
  border-color: var(--border) !important;
}
[data-theme="dark"] .etude-apercu-document h1,
[data-theme="dark"] .etude-apercu-document h2,
[data-theme="dark"] .etude-apercu-document h3 {
  color: var(--text) !important;
}
[data-theme="dark"] .etude-table .best-cell {
  background: rgba(102,187,106,0.12);
  color: #81c784;
}

/* ── Demande cards ── */
[data-theme="dark"] .demande-card {
  background: var(--surface);
  border-color: var(--border);
}
[data-theme="dark"] .demande-card-label {
  color: var(--text3);
}

/* ── Suivi toggle ── */
[data-theme="dark"] .suivi-mode-toggle input {
  accent-color: var(--primary);
}
[data-theme="dark"] .compta-check {
  accent-color: var(--green);
}

/* ── Radio & checkbox ── */
[data-theme="dark"] input[type="radio"],
[data-theme="dark"] input[type="checkbox"] {
  accent-color: var(--primary) !important;
}

/* ── Scrollbars ── */
[data-theme="dark"] ::-webkit-scrollbar-track { background: #0f1a1e; }
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #2a4a55; }
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: #3a6070; }

/* ── Select options (dropdown) ── */
[data-theme="dark"] option {
  background: var(--surface) !important;
  color: var(--text) !important;
}

/* ── Info items ── */
[data-theme="dark"] .info-value {
  color: var(--text);
}
[data-theme="dark"] .info-label {
  color: var(--text3);
}

/* ── CSPE viewer modal ── */
[data-theme="dark"] #modal-view-cspe .modal-content {
  background: var(--surface);
}
[data-theme="dark"] #cspe-view-body table {
  color: var(--text);
}

/* ── Contrats table active row ── */
[data-theme="dark"] .contrats-table tbody tr.actif {
  background: rgba(38,166,154,0.06);
}

/* ── Suivi écheance ── */
[data-theme="dark"] .suivi-echeance-value {
  color: var(--text);
}
[data-theme="dark"] .suivi-echeance-label {
  color: var(--text3);
}

/* ── Gen doc modal buttons ── */
[data-theme="dark"] .gd-btn {
  color: #fff;
}

/* ── Pipeline bars ── */
[data-theme="dark"] .pipeline-track {
  background: var(--surface);
}

/* ── Dot amber inline ── */
[data-theme="dark"] [style*="background:#f0a500"] {
  background: #f0a500 !important;
}

/* ── Liens ── */
[data-theme="dark"] a {
  color: var(--teal-light);
}
[data-theme="dark"] a:hover {
  color: var(--cyan);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'DM Sans', sans-serif;
  background: linear-gradient(135deg, #e8f5e9 0%, #e0f2f1 30%, #f1f8e9 65%, #fafff5 100%) fixed;
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
}

/* v7.26 — controles natifs plus lisibles (les styles inline restent prioritaires) */
select, input, textarea { font-size: 15px; }
/* v7.43 — checkboxes / radios agrandis + accent marque (lisibilité, confort de clic) */
input[type="checkbox"], input[type="radio"] { width: 17px; height: 17px; accent-color: var(--teal-mid); cursor: pointer; }

/* ── LAYOUT ── */
.app { display: flex; height: 100vh; overflow: hidden; }

/* ── SIDEBAR ── */
.sidebar {
  width: 290px;
  min-width: 290px;
  background: linear-gradient(180deg, #1a3a4a 0%, #0d2b3a 100%);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  padding: 0;
  overflow: hidden;
}

.sidebar-logo {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  box-sizing: border-box;
}

.sidebar-logo .logo-icon {
  width: 40px; height: 40px; flex-shrink: 0;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  overflow: visible;
}
.sidebar-logo .logo-icon img {
  width: 40px; height: auto; object-fit: contain;
}

.sidebar-logo .logo-text {
  display: block;
  font-size: 14px; font-weight: 700; color: #fff;
  letter-spacing: 0.04em; white-space: nowrap;
}

.sidebar-logo .logo-sub {
  display: block;
  font-size: 11px; color: rgba(255,255,255,0.55);
  margin-top: 1px;
}

.sidebar-nav {
  flex: 1;
  padding: 10px 8px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 2px;
  box-sizing: border-box;
  overflow-y: auto;
  overflow-x: hidden;
  align-items: stretch;
}

.nav-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.55);
  padding: 18px 12px 7px;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
  user-select: none;
  transition: color 0.15s;
}
.nav-section:hover { color: rgba(255,255,255,0.92); }
.nav-section .nav-chevron { font-size: 10px; opacity: 0.55; flex-shrink: 0; transition: opacity 0.15s; }
.nav-section:hover .nav-chevron { opacity: 1; }
.nav-collapsed { display: none !important; }

.nav-item {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: 12px 15px;
  width: 100%;
  height: auto;
  min-height: 40px;
  color: rgba(255,255,255,0.72);
  cursor: pointer;
  transition: all 0.15s;
  border-radius: 8px;
  box-sizing: border-box;
  white-space: nowrap;
  overflow: hidden;
  font-size: 15px;
  font-weight: 500;
  position: relative;
}

.nav-item:hover { background: rgba(255,255,255,0.12); color: #fff; }
.nav-item.active { background: rgba(255,255,255,0.16); color: #26c6da; border-left: 3px solid #26c6da; padding-left: 12px; }
.nav-item .icon { width: 19px; height: 19px; flex-shrink: 0; opacity: 0.85; }
.nav-item.active .icon { opacity: 1; color: #26c6da; }

/* ── NAV PARENT (section déroulante) ── */
.nav-parent { position: relative; }
.nav-parent-header {
  display: none;
}
.nav-parent-header:hover { background: rgba(255,255,255,0.15); color: #fff; }
.nav-parent-header .icon { width: 17px; height: 17px; flex-shrink: 0; opacity: 0.85; }
.nav-parent-header .nav-chevron {
  margin-left: auto; font-size: 10px; transition: transform 0.2s; opacity: 0.5;
}
.nav-parent.open .nav-chevron { transform: rotate(90deg); }
.nav-parent .nav-sub { display: block; padding: 0; }
.nav-parent.open .nav-sub { display: block; }
.nav-sub .nav-item { font-size: 14.5px; padding: 11px 15px 11px 24px; height: auto; min-height: 38px; width: 100%; }

.sidebar-footer {
  padding: 10px 10px 14px;
  border-top: 1px solid rgba(255,255,255,0.12);
  width: 100%;
  box-sizing: border-box;
  display: flex;
  justify-content: flex-start;
}

.user-info {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 8px;
  transition: background 0.15s;
  width: 100%;
  min-width: 0;
}
.user-info:hover { background: rgba(255,255,255,0.10); }

.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff; flex-shrink: 0;
}

.user-name {
  display: block;
  font-size: 13px; font-weight: 600; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-role {
  display: block;
  font-size: 11px; color: rgba(255,255,255,0.5);
  white-space: normal; line-height: 1.35; margin-top: 1px;
}

/* ── MAIN ── */
.main { flex: 1; overflow: hidden; display: flex; flex-direction: column; }

/* ── TOPBAR ── */
.topbar {
  background: transparent;
  border-bottom: none;
  padding: 0 28px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.topbar-title { font-size: 15px; font-weight: 600; color: var(--text); }
.topbar-subtitle { font-size: 12px; color: var(--text3); margin-top: 1px; }
.topbar-actions { display: flex; gap: 10px; align-items: center; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 40px;
  border-radius: 30px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  font-family: 'DM Sans', sans-serif;
}

.btn-primary {
  background: linear-gradient(135deg, #26c6da, #2e7d32);
  color: #fff;
}
.btn-primary:hover {
  background: linear-gradient(135deg, #00bcd4, #2e7d32);
  transform: translateY(-2px);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border2);
}
.btn-secondary:hover { background: var(--surface2); }

/* ── Boutons génération documents ── */
.gd-btn {
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  padding:14px 20px; border:none; border-radius:10px; cursor:pointer;
  color:#fff; font-family:'DM Sans',sans-serif; font-size:14px; font-weight:600;
  letter-spacing:.3px; box-shadow:0 2px 8px rgba(0,0,0,.15);
  transition:transform .15s,box-shadow .15s,filter .15s;
}
.gd-btn:hover { transform:translateY(-2px); box-shadow:0 4px 16px rgba(0,0,0,.25); filter:brightness(1.08); }
.gd-btn:active { transform:translateY(0); box-shadow:0 1px 4px rgba(0,0,0,.2); }
/* v7.38 — degrade bleu->vert satine/platine (futuriste) : voile clair en haut + jonction bleu->teal->vert */
.gd-btn.gd-btn--primary { background: linear-gradient(160deg, rgba(255,255,255,.18), rgba(255,255,255,0) 44%), linear-gradient(135deg, #0d47a1 0%, #00796b 55%, #2e7d32 100%); color:#fff; box-shadow:0 2px 10px rgba(13,71,161,.28); }
.gd-btn.gd-btn--neutral { background: linear-gradient(160deg, rgba(255,255,255,.16), rgba(255,255,255,0) 42%), linear-gradient(135deg, #1976d2 0%, #0097a7 55%, #26a69a 100%); color:#fff; box-shadow:0 2px 10px rgba(25,118,210,.22); }
.gd-btn.gd-btn--secondary { background: var(--surface); color: var(--teal); border: 1px solid var(--border2); box-shadow: none; }
.gd-btn.gd-btn--secondary:hover { background: var(--surface2); }

.btn-ghost {
  background: rgba(255,255,255,0.7);
  color: var(--text2);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--surface); }

.btn-danger { background: var(--red-btn); color: #fff; }
.btn-danger:hover { background: #c82020; }

.btn-retour  { background: var(--red-btn);    color: #fff; border-radius: 20px; }
.btn-retour:hover  { background: #c82020; }
.btn-modifier { background: var(--orange-btn); color: #fff; border-radius: 20px; }
.btn-modifier:hover { background: #d88a00; }

.btn-sm { padding: 8px 16px; font-size: 13px; }
.btn-icon { padding: 7px; border-radius: 50%; }
/* v7.45 — boutons outils harmonisés (tableau de bord Admin) : taille identique, icône à gauche, sobre */
.dash-toolbtn { padding: 10px 16px; font-size: 13.5px; border-radius: 10px; font-weight: 600; gap: 8px; }

/* Barre "Ajouter" pleine largeur */
.btn-add-bar {
  display: block;
  width: 100%;
  padding: 14px 40px;
  background: linear-gradient(135deg, #26c6da, #2e7d32);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  border: none;
  border-radius: 30px;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  margin-bottom: 16px;
  transition: all 0.15s;
}
.btn-add-bar:hover {
  background: linear-gradient(135deg, #00bcd4, #2e7d32);
  transform: translateY(-2px);
}

/* ── NEON GLOW — effet lumineux blanc sur éléments cliquables ── */
.btn:hover, .btn-sm:hover, .btn-icon:hover,
.gd-btn:hover,
.suivi-btn-sm:hover,
.btn-add-bar:hover,
.td-company:hover,
a[href]:hover, a[onclick]:hover,
[onclick]:not(.nav-item):not(.tree-hdr):not(.modal-overlay):not(tr):hover,
.tree-hdr:hover {
  box-shadow: 0 0 8px 2px rgba(255,255,255,0.7), 0 0 16px 4px rgba(255,255,255,0.3);
  transition: box-shadow 0.2s ease, background 0.15s, transform 0.15s;
}
.nav-item:hover {
  box-shadow: 0 0 10px 3px rgba(255,255,255,0.5), 0 0 20px 6px rgba(255,255,255,0.2);
}
.nav-item.active {
  box-shadow: 0 0 12px 3px rgba(38,198,218,0.6), 0 0 24px 6px rgba(38,198,218,0.25);
}
.btn-primary:hover {
  box-shadow: 0 0 10px 3px rgba(255,255,255,0.6), 0 0 20px 5px rgba(46,125,50,0.3);
}
.btn-danger:hover, .btn-retour:hover {
  box-shadow: 0 0 10px 3px rgba(255,255,255,0.6), 0 0 20px 5px rgba(211,47,47,0.3);
}
.btn-modifier:hover {
  box-shadow: 0 0 10px 3px rgba(255,255,255,0.6), 0 0 20px 5px rgba(245,127,23,0.3);
}
.pipeline-badge:hover, .suivi-badge:hover {
  box-shadow: 0 0 6px 2px rgba(255,255,255,0.5);
  cursor: default;
}
.td-company { cursor: pointer; border-radius: 4px; transition: box-shadow 0.2s ease; }

/* ── CONTENT ── */
.content { flex: 1; overflow-y: auto; padding: 16px 28px 28px; }

/* ── VIEWS ── */
.view { display: none; }
.view.active { display: block; }

/* ── SEARCH BAR ── */
.search-bar { display: flex; gap: 10px; margin-bottom: 20px; }
.search-input-wrap { flex: 1; position: relative; }
.search-input-wrap svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text3); }
.search-input {
  width: 100%;
  padding: 9px 12px 9px 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-family: 'DM Sans', sans-serif;
  background: rgba(255,255,255,0.8);
  color: var(--text);
  transition: border 0.15s;
  outline: none;
}
.search-input:focus { border-color: var(--teal-mid); background: #fff; }
.search-input::placeholder { color: var(--text3); }

/* ── STATS CARDS ── */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.stat-card {
  background: var(--surface);
  border: none;
  border-radius: var(--radius);
  padding: 18px 22px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.18s, transform 0.18s;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-label { font-size: 12.5px; color: var(--text3); margin-bottom: 8px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-value { font-size: 32px; font-weight: 700; color: var(--text); line-height: 1.05; }
.stat-delta { font-size: 12px; margin-top: 4px; }
.stat-delta.up { color: var(--green); }
.stat-delta.neutral { color: var(--text3); }

/* ── TABLE ── */
.table-wrap {
  background: var(--surface);
  border: none;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.table-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.table-title { font-size: 14px; font-weight: 600; }
.table-count { font-size: 12px; color: var(--text3); background: var(--surface2); padding: 2px 8px; border-radius: 99px; }

table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left;
  padding: 11px 18px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody tr { border-bottom: 1px solid var(--border); cursor: pointer; transition: background 0.12s, box-shadow 0.12s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--surface2); box-shadow: inset 3px 0 0 var(--teal-mid); }
tbody td { padding: 13px 18px; font-size: 14px; color: var(--text); vertical-align: middle; }
.td-company { font-weight: 500; }
.td-siret { font-family: 'DM Mono', monospace; font-size: 12px; color: var(--text2); }
.td-city { color: var(--text2); }

/* ── BADGES ── */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 8px; border-radius: 99px;
  font-size: 11.5px; font-weight: 500; white-space: nowrap;
}
.badge-client   { background: var(--green-light); color: var(--green); }
.badge-prospect { background: var(--amber-light);  color: var(--amber); }
.badge-inactif  { background: var(--surface2);     color: var(--text3); }
.badge-resilie  { background: #fdecea; color: #e53535; }
/* Badge statut cliquable */
.badge-select {
  border: none; cursor: pointer; outline: none;
  appearance: none; -webkit-appearance: none;
  padding: 3px 22px 3px 8px;
  border-radius: 99px; font-size: 11.5px; font-weight: 500;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='currentColor' opacity='.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 6px center;
}
.badge-elec     { background: #e8f4fd; color: #1565c0; }
.badge-gaz      { background: #fff3e0; color: #e65100; }
.badge-ok       { background: var(--green-light); color: var(--green); }
.badge-ko       { background: var(--red-light);   color: var(--red); }
.badge-wait     { background: var(--amber-light);  color: var(--amber); }

/* ── FICHE CLIENT ── */
.fiche-layout { display: grid; grid-template-columns: 260px 1fr; gap: 16px; }
.fiche-sidebar { display: flex; flex-direction: column; gap: 12px; }

/* En-tête fiche client */
.fiche-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  padding: 0 2px;
}
.fiche-title {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
}
.fiche-header-actions { display: flex; gap: 10px; }

.card {
  background: var(--surface);
  border: none;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
.card-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-title { font-size: 13px; font-weight: 600; color: var(--text); }
.card-body { padding: 14px 16px; }

.info-row { display: flex; flex-direction: column; gap: 10px; }
.info-item { display: flex; flex-direction: column; gap: 2px; }
.info-label { font-size: 11px; color: var(--text3); font-weight: 500; text-transform: uppercase; letter-spacing: 0.4px; }
.info-value { font-size: 13.5px; color: var(--text); font-weight: 400; }
.info-value.mono { font-family: 'DM Mono', monospace; font-size: 12.5px; }

/* ── ONGLETS — style "cartes blanches" ── */
.tabs {
  display: flex;
  gap: 8px;
  border-bottom: none;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.tab {
  padding: 11px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text2);
  cursor: pointer;
  border: 2px solid transparent;
  border-radius: var(--radius);
  background: rgba(255,255,255,0.75);
  box-shadow: var(--shadow);
  transition: all 0.15s;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 0;
}

.tab:hover { background: #fff; color: var(--text); }
.tab.active {
  background: linear-gradient(135deg, #2E7D32, #43A047);
  color: #fff;
  border-color: #2E7D32;
  box-shadow: 0 3px 12px rgba(46,125,50,.30);
  font-weight: 700;
}

.tab-badge {
  background: #F9A825;
  color: #0D1B2A;
  width: 22px; height: 22px;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.tab:not(.active) .tab-badge { background: #C8E6C9; color: #1B5E20; opacity: 1; }
.tab.active .tab-badge { background: #F9A825; color: #0D1B2A; }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── COMPTEURS ── */
.compteur-card {
  background: var(--surface);
  border: none;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.compteur-header {
  padding: 12px 16px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.compteur-pdl { font-family: 'DM Mono', monospace; font-size: 13px; font-weight: 500; color: var(--text); }
.compteur-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.compteur-info { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); }

/* ── CONTRATS TABLE ── */
.contrats-table { width: 100%; border-collapse: collapse; }
.contrats-table thead th {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text2); font-weight: 700; padding: 8px 16px;
  background: var(--surface2); border-bottom: 1px solid var(--border); text-align: left;
}
.contrats-table tbody tr { border-bottom: 1px solid var(--border); }
.contrats-table tbody tr:last-child { border-bottom: none; }
.contrats-table tbody tr.actif { background: #f6fcf8; }
.contrats-table tbody td { padding: 10px 16px; font-size: 13px; color: var(--text); }
.contrat-actif-dot { width: 7px; height: 7px; background: var(--green-mid); border-radius: 50%; display: inline-block; margin-right: 6px; }

/* ── NOTES / RAPPELS ── */
.note-item { padding: 12px 0; border-bottom: 1px solid var(--border); display: flex; gap: 12px; }
.note-item:last-child { border-bottom: none; }
.note-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--teal-light); color: var(--teal);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; flex-shrink: 0;
}
.note-body { flex: 1; }
.note-text { font-size: 13.5px; color: var(--text); line-height: 1.5; }
.note-meta { font-size: 11.5px; color: var(--text3); margin-top: 4px; }

/* ── RAPPEL ITEM ── */
.rappel-item { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.rappel-item:last-child { border-bottom: none; }
.rappel-checkbox {
  width: 16px; height: 16px; border-radius: 4px;
  border: 2px solid var(--border2); flex-shrink: 0; margin-top: 2px;
  cursor: pointer; appearance: none; -webkit-appearance: none; transition: all 0.15s;
}
.rappel-checkbox:checked { background: var(--teal-mid); border-color: var(--teal-mid); }
.rappel-body { flex: 1; }
.rappel-title { font-size: 13.5px; font-weight: 500; color: var(--text); }
.rappel-desc { font-size: 12.5px; color: var(--text2); margin-top: 2px; }
.rappel-date { font-size: 12px; color: var(--text3); margin-top: 3px; }
.rappel-date.overdue { color: var(--red); font-weight: 500; }
.rappel-date.today { color: var(--amber); font-weight: 500; }

/* ── SUIVI ACTIVITÉ ── */
/* ══ SUIVI CLIENT — BLOCS ══ */
/* ═══════════════════════════════════════════════════
   SUIVI D'ACTIVITÉ — Redesign v6.6c
   ═══════════════════════════════════════════════════ */
.suivi-block {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 20px 24px; margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.suivi-section-title {
  font-size: 14px; font-weight: 700; color: var(--text);
  margin: 0 0 16px 0; padding-bottom: 10px;
  border-bottom: 2px solid var(--primary);
  display: flex; align-items: center; gap: 10px;
}
.suivi-section-title .suivi-section-icon {
  font-size: 16px;
}

/* ── Checklist items — plus aéré ── */
.suivi-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border-radius: 8px; gap: 10px;
  transition: background 0.12s;
  border-bottom: 1px solid rgba(0,0,0,0.04);
}
.suivi-item:last-child { border-bottom: none; }
.suivi-item:hover { background: var(--surface2); }
.suivi-label { font-size: 13px; color: var(--text2); flex: 1; line-height: 1.4; }
.suivi-status {
  display: flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 600; cursor: pointer;
  flex-shrink: 0; min-width: 65px; justify-content: flex-end;
  padding: 4px 10px; border-radius: 6px;
  transition: background 0.15s;
}
.suivi-status:hover { background: rgba(0,0,0,0.05); }

/* ── Pipeline stages — cards horizontales ── */
.suivi-pipeline {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px;
}
.pipeline-stage {
  display: flex; flex-direction: column;
  align-items: center; padding: 14px 6px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer; transition: all 0.15s;
  text-align: center;
}
.pipeline-stage:hover { background: var(--surface2); border-color: var(--primary); transform: translateY(-1px); box-shadow: 0 2px 6px rgba(0,0,0,0.06); }
.pipeline-label {
  font-size: 10.5px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.3px; color: var(--text3); text-align: center; margin-bottom: 8px;
  line-height: 1.3;
}
.pipeline-badge {
  font-size: 11px; font-weight: 700; padding: 4px 12px;
  border-radius: 20px; text-align: center; min-width: 70px;
  white-space: nowrap;
}
.badge-gray   { background: var(--surface2); color: var(--text3); }
.badge-orange { background: #fff3e0; color: #e65100; }
.badge-blue   { background: #e3f2fd; color: #1565c0; }
.badge-green  { background: #e8f5e9; color: #2e7d32; }

/* ── Checklist grid — 2 colonnes + séparateur visuel ── */
.suivi-checklist-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px;
}
.suivi-checklist-col {
  padding: 0;
}
.suivi-checklist-col-title {
  font-size: 11.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.4px; color: var(--primary); margin-bottom: 8px;
  padding: 6px 12px;
  background: rgba(0,137,123,0.06);
  border-radius: 6px;
}

/* ── Champs texte / financier ── */
.suivi-finbox { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.suivi-finfield { display: flex; flex-direction: column; gap: 5px; }
.suivi-finlabel { font-size: 11px; color: var(--text3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.2px; }
.suivi-fininput {
  border: 1px solid var(--border); border-radius: 8px;
  padding: 9px 12px; font-size: 13px; color: var(--text);
  background: var(--surface); width: 100%; transition: border 0.15s, box-shadow 0.15s;
}
.suivi-fininput:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,137,123,0.12); }
.suivi-commentbox { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.suivi-textarea {
  border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; font-size: 13px; color: var(--text);
  background: var(--surface); width: 100%; min-height: 90px;
  resize: vertical; font-family: inherit; transition: border 0.15s, box-shadow 0.15s;
  line-height: 1.5;
}
.suivi-textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,137,123,0.12); }

/* ── Tableau contrats suivi ── */
.suivi-contrats-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.suivi-contrats-table th {
  background: rgba(0,137,123,0.06); color: var(--text3); font-weight: 600; font-size: 11px;
  padding: 10px 12px; text-align: left; border-bottom: 2px solid var(--border);
  text-transform: uppercase; letter-spacing: 0.3px; white-space: nowrap;
}
.suivi-contrats-table td {
  padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; color: var(--text);
}
.suivi-contrats-table tr:last-child td { border-bottom: none; }
.suivi-contrats-table tr:hover td { background: var(--surface2); }
.ct-badge-actif   { display:inline-block; padding:4px 12px; border-radius:20px; font-size:11px; font-weight:600; background:#e6f4ea; color:#2e7d32; }
.ct-badge-expired { display:inline-block; padding:4px 12px; border-radius:20px; font-size:11px; font-weight:600; background:#fff3e0; color:#e65100; }
.ct-badge-nosign  { display:inline-block; padding:4px 12px; border-radius:20px; font-size:11px; font-weight:600; background:var(--surface2); color:var(--text3); }

/* ── Récap échéances — KPI cards ── */
.suivi-echeance-box {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
  margin-top: 14px;
}
.suivi-echeance-item {
  display: flex; flex-direction: column; gap: 4px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.suivi-echeance-item:last-child { border-right: none; }
.suivi-echeance-label { font-size: 10px; color: var(--text3); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.suivi-echeance-val { font-size: 15px; font-weight: 700; color: var(--text); }
.suivi-echeance-val.alert { color: #e65100; }
.suivi-echeance-sep { display: none; }

/* ── Dots ── */
.dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.dot-green { background: var(--green-mid); }
.dot-amber { background: #f0a500; }
.dot-red   { background: var(--red); }
.dot-gray  { background: var(--border2); }

/* ── Responsive: pipeline 3x2 sur petits écrans ── */
@media (max-width: 900px) {
  .suivi-pipeline { grid-template-columns: repeat(3, 1fr); }
  .suivi-checklist-grid { grid-template-columns: 1fr; gap: 16px; }
  .suivi-echeance-box { grid-template-columns: repeat(2, 1fr); }
}

/* ── DEMANDE GROUPÉE — Checklist de vérification ── */
.grp-site-card { border:1px solid var(--border); border-radius:10px; margin-bottom:10px; overflow:hidden; transition:border-color 0.2s; }
.grp-site-card.validated { border-color:var(--green-mid); }
.grp-site-card.invalid { border-color:var(--red); }
.grp-site-hdr { display:flex; justify-content:space-between; align-items:center; padding:10px 14px; background:var(--bg); cursor:pointer; }
.grp-site-hdr:hover { background:var(--surface2); }
.grp-site-name { font-weight:700; font-size:13px; color:var(--text); }
.grp-site-pdl { font-size:11px; font-family:monospace; color:var(--text3); margin-left:10px; }
.grp-site-status { font-size:11px; font-weight:600; padding:2px 10px; border-radius:10px; }
.grp-site-status.ok { background:#E8F5E9; color:#2E7D32; }
.grp-site-status.ko { background:#FFF3E0; color:#E65100; }
.grp-site-body { padding:10px 14px; display:none; border-top:1px solid var(--border); }
.grp-site-body.open { display:block; }
.grp-check-row { display:flex; align-items:center; gap:10px; padding:5px 0; border-bottom:1px solid var(--border); font-size:12px; }
.grp-check-row:last-child { border-bottom:none; }
.grp-check-label { min-width:130px; color:var(--text3); font-weight:500; }
.grp-check-val { flex:1; color:var(--text); font-weight:500; }
.grp-check-val.missing { color:var(--red); font-style:italic; }
.grp-check-box { width:18px; height:18px; accent-color:var(--teal); cursor:pointer; flex-shrink:0; }
.grp-progress { height:6px; background:var(--border); border-radius:3px; overflow:hidden; margin:10px 0; }
.grp-progress-bar { height:100%; background:var(--teal); border-radius:3px; transition:width 0.3s; }
.grp-fourn-tag { display:inline-flex; align-items:center; gap:4px; background:var(--bg); border:1px solid var(--border); border-radius:16px; padding:3px 10px; font-size:12px; margin:3px; }
.grp-fourn-tag .remove { cursor:pointer; color:var(--red); font-weight:700; margin-left:4px; }

/* ── SUIVI GLOBAL INTERACTIF ── */
.suivi-mini-dots { display:flex; gap:3px; align-items:center; }
.suivi-mini-dot { width:7px; height:7px; border-radius:50%; flex-shrink:0; }
.suivi-mini-dot.green { background:var(--green-mid); }
.suivi-mini-dot.red { background:var(--red); }
.suivi-mini-dot.gray { background:var(--border2); }
.suivi-badge { padding:2px 8px; border-radius:10px; font-size:11px; font-weight:600; white-space:nowrap; }
.suivi-badge.actif { background:#E8F5E9; color:#2E7D32; }
.suivi-badge.expire { background:#FFEBEE; color:#C62828; }
.suivi-badge.alerte { background:#FFF3E0; color:#E65100; }
.suivi-badge.en_cours { background:#E3F2FD; color:#1565C0; }
.suivi-badge.envoyee { background:#FFF8E1; color:#F57F17; }
.suivi-badge.recue { background:#E8F5E9; color:#2E7D32; }
.suivi-badge.validee { background:#E8F5E9; color:#1B5E20; }
.suivi-badge.refusee { background:#FFEBEE; color:#B71C1C; }
.suivi-badge.annulee { background:#F5F5F5; color:#9E9E9E; }
.suivi-badge.sans { background:#F5F5F5; color:#9E9E9E; }

/* v6.7n : Badges statut demandes (nouveau flux) */
.dem-statut-badge { padding:3px 10px; border-radius:10px; font-size:11px; font-weight:600; white-space:nowrap; display:inline-block; }
.dem-statut-en_attente { background:#FFF3E0; color:#E65100; }
.dem-statut-en_traitement { background:#E3F2FD; color:#1565C0; }
.dem-statut-envoyee_fournisseur { background:#FFF8E1; color:#F57F17; }
.dem-statut-offre_recue { background:#E8F5E9; color:#2E7D32; }
.dem-statut-annulee { background:#F5F5F5; color:#9E9E9E; }
/* legacy */
.dem-statut-en_cours { background:#E3F2FD; color:#1565C0; }
.dem-statut-envoyee { background:#FFF8E1; color:#F57F17; }
.dem-statut-recue { background:#E8F5E9; color:#2E7D32; }
.dem-statut-validee { background:#E8F5E9; color:#1B5E20; }
.dem-statut-refusee { background:#FFEBEE; color:#B71C1C; }

/* dates contrat : lecture seule dans suivi global */
.suivi-btn-sm { background:none; border:1px solid var(--border); border-radius:6px; padding:2px 8px; font-size:11px; cursor:pointer; color:var(--text2); transition:all 0.15s; white-space:nowrap; }
.suivi-btn-sm:hover { border-color:var(--teal); color:var(--teal); background:rgba(46,125,50,0.05); }
.suivi-demande-row { font-size:11px; display:flex; align-items:center; gap:6px; }
.demande-card { border:1px solid var(--border); border-radius:8px; padding:10px 14px; margin-bottom:8px; background:var(--bg); }
.demande-card-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:6px; }
.demande-card-type { font-weight:600; font-size:13px; color:var(--text); }
.demande-card-date { font-size:11px; color:var(--text3); }
.demande-card-body { display:grid; grid-template-columns:1fr 1fr; gap:4px 16px; font-size:12px; }
.demande-card-label { color:var(--text3); }
.demande-card-val { color:var(--text); font-weight:500; }

/* ── MODAL ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45);
  z-index: 1000; display: flex; align-items: center; justify-content: center;
  padding: 20px; opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--surface); border-radius: 14px;
  width: 100%; max-width: 760px; max-height: 92vh; overflow-y: auto;
  box-shadow: var(--shadow-md); transform: translateY(12px); transition: transform 0.2s;
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header {
  padding: 22px 30px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; background: var(--surface); z-index: 1;
}
.modal-title { font-size: 18px; font-weight: 700; }
.modal-close {
  width: 32px; height: 32px; border-radius: 50%; border: none;
  background: var(--surface2); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text2); font-size: 18px; transition: background 0.15s;
}
.modal-close:hover { background: var(--border); }
.modal-body { padding: 26px 34px; }
.modal-footer { padding: 18px 30px; border-top: 1px solid var(--border); display: flex; gap: 12px; justify-content: flex-end; }
/* v7.3 (P2) — Footer STICKY : boutons "Annuler"/"Valider" toujours visibles, meme avec beaucoup de contenu. */
.modal-footer { position: sticky; bottom: 0; background: var(--surface); z-index: 2; box-shadow: 0 -3px 10px rgba(0,0,0,.07); }
/* v7.3 — spinner reutilisable (le keyframes "spin" manquait). */
@keyframes spin { to { transform: rotate(360deg); } }
.btn-spinner { display:inline-block; width:13px; height:13px; border:2px solid currentColor; border-top-color:transparent; border-radius:50%; animation:spin .7s linear infinite; vertical-align:middle; margin-right:7px; }
/* v7.3 (P3) — overlay de progression batch (bas droite, sobre). */
#batch-progress-overlay { position: fixed; right: 18px; bottom: 18px; z-index: 100000; width: 320px; max-width: 90vw; background: var(--surface, #fff); border: 1px solid var(--border, #e0e0e0); border-radius: 10px; box-shadow: 0 6px 24px rgba(0,0,0,.18); padding: 12px 14px; font-size: 13px; }
#batch-progress-overlay .bpo-title { font-weight: 700; color: var(--text, #222); margin-bottom: 6px; display:flex; align-items:center; gap:8px; }
#batch-progress-overlay .bpo-bar { height: 7px; background: var(--surface2, #eef1f4); border-radius: 4px; overflow: hidden; margin: 6px 0; }
#batch-progress-overlay .bpo-bar > div { height: 100%; background: linear-gradient(90deg,#1565c0,#42a5f5); transition: width .25s ease; }
#batch-progress-overlay .bpo-step { color: var(--text2, #555); font-size: 12px; min-height: 16px; }
#batch-progress-overlay .bpo-file { color: var(--text3, #888); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── MODAL BACKDROP (alias) ── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45);
  z-index: 1000; display: flex; align-items: center; justify-content: center;
  padding: 20px;
}

/* ── SUIVI GLOBAL — ONGLETS VUE ── */
.suivi-view-tabs {
  display: flex; gap: 0; margin-bottom: 16px; border-bottom: 2px solid var(--border);
}
.suivi-view-tab {
  padding: 10px 20px; font-size: 13px; font-weight: 500; color: var(--text2);
  cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: all 0.15s; user-select: none;
}
.suivi-view-tab:hover { color: var(--text); background: var(--surface2); }
.suivi-view-tab.active {
  color: var(--text); font-weight: 700;
  border-bottom-color: var(--primary);
}

/* ── SUIVI GLOBAL — FILTRE PÉRIODE ── */
.suivi-periode-box {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px 20px; margin-bottom: 14px;
}
.suivi-periode-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px;
}
.suivi-date-badge {
  display: inline-block; padding: 3px 12px; border-radius: 20px; font-size: 12px;
  font-weight: 600; background: var(--surface2); color: var(--text); border: 1px solid var(--border);
}

/* Double range slider */
.suivi-range-container {
  position: relative; width: 100%; height: 36px;
}
.suivi-range-track {
  position: absolute; top: 14px; left: 0; right: 0; height: 6px;
  background: var(--border); border-radius: 3px;
}
.suivi-range-track::after {
  content: ''; position: absolute; top: 0; height: 100%;
  background: #1565C0; border-radius: 3px;
  left: var(--track-left, 0%); width: var(--track-width, 100%);
}
.suivi-range-input {
  position: absolute; top: 4px; width: 100%; height: 26px;
  -webkit-appearance: none; appearance: none;
  background: transparent; pointer-events: none; margin: 0;
}
.suivi-range-input::-webkit-slider-thumb {
  -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; border: 3px solid #1565C0; cursor: pointer;
  pointer-events: auto; box-shadow: 0 1px 4px rgba(0,0,0,0.2);
  position: relative; z-index: 2;
}
.suivi-range-input::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff; border: 3px solid #1565C0; cursor: pointer;
  pointer-events: auto; box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

/* Toggle switch */
.suivi-toggle-wrap {
  display: flex; align-items: center; gap: 8px; cursor: pointer; user-select: none;
}
.suivi-toggle-wrap input { display: none; }
.suivi-toggle-slider {
  width: 38px; height: 20px; border-radius: 20px; background: var(--border);
  position: relative; transition: background 0.2s;
}
.suivi-toggle-slider::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%; background: #fff;
  transition: transform 0.2s; box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}
.suivi-toggle-wrap input:checked + .suivi-toggle-slider { background: #1565C0; }
.suivi-toggle-wrap input:checked + .suivi-toggle-slider::after { transform: translateX(18px); }
.suivi-toggle-label { font-size: 12px; font-weight: 600; color: var(--text2); }

/* Mode toggle (inclure/exclure) */
.suivi-mode-toggle {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  padding: 6px 12px; background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; user-select: none;
}
.suivi-mode-toggle input { accent-color: #1565C0; }

/* ── SUIVI GLOBAL — FILTRES BOUTONS ── */
.suivi-filtres-row {
  display: flex; gap: 20px; align-items: flex-end; flex-wrap: wrap;
  margin-bottom: 12px;
}
.suivi-filtre-group { display: flex; flex-direction: column; gap: 4px; }
.suivi-filtre-group-label {
  font-size: 11px; font-weight: 600; color: var(--text3);
  text-transform: uppercase; letter-spacing: 0.3px;
}
.suivi-btn-group { display: flex; gap: 0; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); }
.suivi-btn-filter {
  padding: 6px 14px; font-size: 12px; font-weight: 500; color: var(--text2);
  background: var(--surface); border: none; border-right: 1px solid var(--border);
  cursor: pointer; transition: all 0.15s; white-space: nowrap;
}
.suivi-btn-filter:last-child { border-right: none; }
.suivi-btn-filter:hover { background: var(--surface2); }
.suivi-btn-filter.active {
  background: #1565C0; color: #fff; font-weight: 600;
}

/* ── COMPTA ACCORDION ── */
.compta-entreprise {
  background: var(--surface); border-radius: 10px; border: 1px solid var(--border);
  overflow: hidden;
}
.compta-entreprise-header {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  cursor: pointer; user-select: none; transition: background 0.15s;
}
.compta-entreprise-header:hover { background: var(--surface2); }
.compta-entreprise-header .chevron {
  transition: transform 0.2s; font-size: 12px; color: var(--text3);
}
.compta-entreprise-header.open .chevron { transform: rotate(90deg); }
.compta-entreprise-header .ent-name {
  font-weight: 600; font-size: 13.5px; color: var(--text); flex: 1;
}
.compta-entreprise-header .ent-badge {
  font-size: 11px; color: var(--text2); background: var(--surface2);
  padding: 2px 10px; border-radius: 20px;
}
.compta-entreprise-body { display: none; border-top: 1px solid var(--border); }
.compta-entreprise-header.open + .compta-entreprise-body { display: block; }
.compta-pdl-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.compta-pdl-table th {
  text-align: left; padding: 8px 12px; font-size: 11px; font-weight: 600;
  color: var(--text3); text-transform: uppercase; letter-spacing: 0.3px;
  background: var(--bg); border-bottom: 1px solid var(--border);
}
.compta-pdl-table td { padding: 8px 12px; border-bottom: 1px solid var(--border-light, var(--border)); }
.compta-pdl-table tr:last-child td { border-bottom: none; }
.compta-pdl-table .col-prestation,
.compta-pdl-table .col-mensuel { text-align: right; font-variant-numeric: tabular-nums; }
.compta-pdl-table th.col-prestation,
.compta-pdl-table th.col-mensuel { text-align: right; }
.compta-ent-footer {
  display: flex; justify-content: flex-end; gap: 24px;
  padding: 10px 16px; background: var(--bg); border-top: 1px solid var(--border);
  font-size: 12px; font-weight: 600;
}
.compta-check { width: 16px; height: 16px; accent-color: #2E7D32; cursor: pointer; }

/* ── COMPTA v2 : meta, facturation, badges ── */
.compta-client-meta {
  display: flex; gap: 16px; padding: 10px 16px; background: var(--bg);
  border-bottom: 1px solid var(--border); flex-wrap: wrap; align-items: center;
}
.compta-client-meta .meta-item {
  display: flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--text2);
}
.compta-client-meta .meta-label { font-weight: 600; text-transform: uppercase; font-size: 10px; letter-spacing: 0.3px; }
.compta-client-meta .meta-value { font-weight: 500; color: var(--text); }
.compta-badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 10px; font-weight: 600; letter-spacing: 0.2px; }
.compta-badge-signe  { background: #e8f5e9; color: #2E7D32; }
.compta-badge-actif  { background: #e3f2fd; color: #1565C0; }
.compta-badge-expire { background: #fff3e0; color: #E65100; }
.compta-badge-absent { background: #fce4ec; color: #c62828; }
.compta-badge-emis   { background: #fff8e1; color: #F57F17; }
.compta-badge-non_emis { background: #efebe9; color: #5D4037; }
.compta-factu-section { padding: 12px 16px; border-top: 1px solid var(--border); }
.compta-factu-section h4 { font-size: 12px; font-weight: 700; margin: 0 0 8px 0; color: var(--text2); text-transform: uppercase; letter-spacing: 0.3px; }
.compta-factu-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.compta-factu-table th {
  text-align: left; padding: 6px 10px; font-size: 10px; font-weight: 600;
  color: var(--text3); text-transform: uppercase; letter-spacing: 0.3px;
  background: var(--surface2); border-bottom: 1px solid var(--border);
}
.compta-factu-table td { padding: 6px 10px; border-bottom: 1px solid var(--border-light, var(--border)); }
.compta-factu-table tr:last-child td { border-bottom: none; }
.compta-action-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 11px;
  cursor: pointer; transition: background 0.15s;
}
.compta-action-btn:hover { background: var(--surface2); }
.compta-action-btn.primary { background: var(--primary, #1565C0); color: #fff; border-color: transparent; }
.compta-action-btn.primary:hover { opacity: 0.9; }
.compta-action-btn.danger { color: #c62828; border-color: #ffcdd2; }
.compta-action-btn.danger:hover { background: #ffebee; }
.compta-solde-positif { color: #2E7D32; font-weight: 600; }
.compta-solde-negatif { color: #c62828; font-weight: 600; }
.compta-solde-zero { color: var(--text3); }
.compta-tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 14px; }
.compta-tab {
  padding: 8px 18px; font-size: 12.5px; font-weight: 600; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -2px; color: var(--text2);
  transition: all 0.15s;
}
.compta-tab:hover { color: var(--text); }
.compta-tab.active { color: var(--primary, #1565C0); border-bottom-color: var(--primary, #1565C0); }
.compta-rib-form { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; padding: 8px 0; }
.compta-rib-form .form-input { font-size: 11.5px; padding: 5px 8px; }

/* ── FORMS ── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block; font-size: 12px; font-weight: 600; color: var(--text2);
  margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.4px;
}
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 11px 14px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 14.5px; min-height: 42px;
  font-family: 'DM Sans', sans-serif; color: var(--text);
  background: var(--surface); outline: none; transition: border 0.15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--teal-mid);
  box-shadow: 0 0 0 3px rgba(26,128,144,0.14);
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-hint { font-size: 11.5px; color: var(--text3); margin-top: 4px; }
.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

/* ── v7.44 : composants « vue liste » réutilisables (pattern transverse) ── */
.list-toolbar {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px 18px; margin-bottom: 16px;
}
.list-toolbar-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.list-search {
  flex: 1; min-width: 260px; padding: 11px 14px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 14.5px; background: var(--surface); color: var(--text); min-height: 42px;
}
.list-search:focus { outline: none; border-color: var(--teal-mid); box-shadow: 0 0 0 3px rgba(26,128,144,0.14); }
.list-select {
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; background: var(--surface); color: var(--text); min-height: 42px; cursor: pointer;
}
.filter-pills { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.filter-pills-label { font-size: 13px; color: var(--text3); font-weight: 600; }
.filter-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 18px; cursor: pointer; user-select: none;
  font-size: 13px; font-weight: 600; border: 1.5px solid var(--border2);
  background: var(--surface); color: var(--text2); transition: all 0.15s;
}
.filter-pill:hover { border-color: var(--teal-mid); color: var(--text); }
.filter-pill.active { background: var(--teal-mid); border-color: var(--teal-mid); color: #fff; }
.empty-state {
  text-align: center; padding: 56px 24px; color: var(--text3);
  background: var(--surface); border-radius: 12px; border: 1.5px dashed var(--border2);
}
.empty-state .es-icon { font-size: 52px; margin-bottom: 12px; opacity: 0.85; line-height: 1; }
.empty-state .es-title { font-size: 17px; font-weight: 700; color: var(--text2); margin-bottom: 6px; }
.empty-state .es-sub { font-size: 14px; color: var(--text3); max-width: 440px; margin: 0 auto; line-height: 1.45; }
.empty-state .es-action { margin-top: 16px; }

/* ── BREADCRUMB ── */
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text3); margin-bottom: 16px; }
.breadcrumb span { cursor: pointer; }
.breadcrumb span:hover { color: var(--teal); }
.breadcrumb .sep { color: var(--border2); }
.breadcrumb .current { color: var(--text); font-weight: 500; cursor: default; }

/* ── EMPTY STATE ── */
.empty { text-align: center; padding: 40px 20px; color: var(--text3); }
.empty-icon { font-size: 32px; margin-bottom: 10px; }
.empty-text { font-size: 14px; margin-bottom: 6px; color: var(--text2); }
.empty-sub  { font-size: 12.5px; color: var(--text3); }

/* ── TOAST ── */
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--text); color: #fff; padding: 10px 16px;
  border-radius: var(--radius-sm); font-size: 13px; box-shadow: var(--shadow-md);
  display: flex; align-items: center; gap: 8px;
  animation: slideIn 0.2s ease; max-width: 320px;
}
.toast.success { background: var(--teal); }
.toast.error   { background: var(--red); }
.toast.warning { background: var(--amber); }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── DOCUMENTS ── */
.doc-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.doc-item:last-child { border-bottom: none; }
.doc-icon { width: 28px; height: 28px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 15px; flex-shrink: 0; }
.doc-icon.pdf { background: #fde8e6; }
.doc-icon.xls { background: #e6f4ea; }
.doc-icon.img { background: #e8f4fd; }
.doc-name { font-size: 12.5px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-meta { font-size: 11px; color: var(--text3); margin-top: 2px; }

/* ── ARBORESCENCE DOCUMENTS ── */
.doc-tree { padding: 0; }
.tree-node { border-bottom: 1px solid var(--border); }
.tree-node:last-child { border-bottom: none; }
.tree-hdr { display: flex; align-items: center; gap: 7px; padding: 9px 12px; cursor: pointer; user-select: none; transition: background 0.12s; }
.tree-hdr:hover { background: var(--surface2); }
.tree-arrow { font-size: 9px; color: var(--text3); width: 10px; flex-shrink: 0; line-height:1; }
.tree-fi   { font-size: 16px; flex-shrink: 0; line-height:1; }
.tree-name { font-size: 13px; font-weight: 500; color: var(--text); flex: 1; }
.tree-name-top { font-size: 13.5px; font-weight: 700; color: var(--teal); }
.tree-badge {
  background: var(--surface2); color: var(--text2);
  font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 10px; flex-shrink: 0;
}
.tree-body { background: rgba(255,255,255,0.4); }
.tree-node[data-depth="0"] > .tree-hdr { padding-left: 12px; background: rgba(255,255,255,0.6); }
.tree-node[data-depth="1"] > .tree-hdr { padding-left: 24px; }
.tree-node[data-depth="2"] > .tree-hdr { padding-left: 38px; }
.tree-node[data-depth="3"] > .tree-hdr { padding-left: 52px; }
.tree-node[data-depth="4"] > .tree-hdr { padding-left: 66px; }
.doc-item[data-depth="1"] { padding-left: 28px; }
.doc-item[data-depth="2"] { padding-left: 44px; }
.doc-item[data-depth="3"] { padding-left: 58px; }
.doc-item[data-depth="4"] { padding-left: 72px; }
.doc-item[data-depth="5"] { padding-left: 86px; }

/* ── UPLOAD ZONE ── */
.upload-zone {
  border: 2px dashed var(--border2); border-radius: var(--radius);
  padding: 32px 20px; text-align: center; cursor: pointer;
  transition: all 0.2s; background: rgba(255,255,255,0.5);
}
.upload-zone:hover, .upload-zone.dragover { border-color: var(--teal-mid); background: var(--teal-light); }
.upload-zone-icon { font-size: 28px; margin-bottom: 8px; }
.upload-zone-text { font-size: 14px; font-weight: 500; color: var(--text2); }
.upload-zone-sub  { font-size: 12px; color: var(--text3); margin-top: 4px; }

/* ── CONTACTS ── */
.contact-card { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.contact-card:last-child { border-bottom: none; }
.contact-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--teal-light); color: var(--teal);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; flex-shrink: 0;
}
.contact-name    { font-size: 13.5px; font-weight: 500; }
.contact-role    { font-size: 12px; color: var(--text3); }
.contact-contact { font-size: 12px; color: var(--text2); margin-top: 2px; }

/* ── ESPACE CLIENT ── */
.espace-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.espace-row:last-child { border-bottom: none; }
.espace-fournisseur { font-weight: 500; font-size: 13.5px; flex: 1; }
.espace-login { font-family: 'DM Mono', monospace; font-size: 12px; color: var(--text2); }

/* ── DASHBOARD CHARTS ── */
.pipeline-bar { display: flex; flex-direction: column; gap: 10px; }
.pipeline-row { display: flex; align-items: center; gap: 12px; }
.pipeline-label { font-size: 12.5px; color: var(--text2); width: 100px; flex-shrink: 0; }
.pipeline-track { flex: 1; height: 8px; background: var(--surface2); border-radius: 4px; overflow: hidden; }
.pipeline-fill { height: 100%; border-radius: 4px; transition: width 0.6s ease; }
.pipeline-value { font-size: 12.5px; font-weight: 600; color: var(--text); width: 60px; text-align: right; flex-shrink: 0; }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text3); }

/* ── THEME TOGGLE ── */
.theme-toggle {
  font-size: 16px; cursor: pointer; transition: all 0.2s;
  padding: 8px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
}
.theme-toggle:hover { background: rgba(255,255,255,0.15); }

/* ── RESPONSIVE ── */
@media (max-width: 1200px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 900px)  { .fiche-layout { grid-template-columns: 1fr; } }

/* ── ÉTUDES (études tarifaires) ── */
.etude-overlay {
  position: fixed; inset: 0; z-index: 10000;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(4px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 20px; overflow-y: auto;
}
.etude-panel {
  background: var(--card); border-radius: 14px; width: 100%; max-width: 1100px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.35); position: relative;
  margin: 10px auto; color: var(--text);
}
.etude-view-tabs {
  display: flex; gap: 0; padding: 0 24px; border-bottom: 1px solid var(--border);
  background: var(--bg2, rgba(0,0,0,0.02));
}
.etude-view-tab {
  padding: 12px 16px; border: none; background: transparent; cursor: pointer;
  color: var(--text2); font-weight: 600; font-size: 13px;
  border-bottom: 2px solid transparent; transition: all 0.2s;
}
.etude-view-tab:hover { color: var(--text); }
.etude-view-tab.active {
  color: var(--primary); border-bottom-color: var(--primary); font-weight: 700;
}
.etude-formula-bar {
  display: flex; align-items: center; gap: 12px; padding: 8px 24px;
  background: var(--bg2, rgba(0,0,0,0.02)); border-bottom: 1px solid var(--border);
  font-size: 11px;
}
.etude-formula-bar-cell-ref {
  font-weight: 700; color: var(--text2); min-width: 40px; font-family: 'DM Mono', monospace;
}
.etude-formula-bar-value {
  flex: 1; padding: 4px 8px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 4px; font-family: 'DM Mono', monospace; color: var(--text1);
}
.etude-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px; border-bottom: 1px solid var(--border);
  background: var(--sidebar-bg); color: #fff; border-radius: 14px 14px 0 0;
}
.etude-header h2 { margin: 0; font-size: 16px; font-weight: 700; }
.etude-close { background: none; border: none; color: #fff; font-size: 22px; cursor: pointer; padding: 4px 8px; border-radius: 6px; }
.etude-close:hover { background: rgba(255,255,255,0.15); }
.etude-body { padding: 20px 24px; overflow-x: auto; color: var(--text); }
.etude-section { margin-bottom: 18px; }
.etude-section-title {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--teal); margin-bottom: 8px; padding-bottom: 4px; border-bottom: 2px solid var(--teal);
}
[data-theme="dark"] .etude-section-title { color: var(--cyan); border-bottom-color: var(--cyan); }
.etude-grid {
  display: grid; gap: 6px 14px; align-items: center;
}
.etude-grid.info { grid-template-columns: 140px 1fr 120px 1fr; }
.etude-label { font-size: 11px; font-weight: 700; color: var(--text); white-space: nowrap; opacity: 0.8; }
.etude-val { font-size: 12px; font-weight: 600; color: var(--text); }
.etude-input {
  background: var(--surface); border: 1px solid var(--border); border-radius: 6px;
  padding: 4px 8px; font-size: 12px; color: #1565c0; font-weight: 600;
  width: 100%; box-sizing: border-box; transition: border 0.15s;
}
[data-theme="dark"] .etude-input { color: #64b5f6; background: #152028; }
.etude-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(0,137,123,0.25); }
.etude-input.readonly { color: var(--text); background: var(--bg2); pointer-events: none; font-weight: 600; }
.etude-table {
  width: 100%; border-collapse: collapse; font-size: 11px; margin-top: 6px;
}
.etude-table th {
  background: var(--sidebar-bg); color: #ffffff; font-size: 10px; font-weight: 700;
  padding: 8px 6px; text-align: center; white-space: nowrap; letter-spacing: 0.03em;
  border: 1px solid rgba(0,0,0,0.2); text-shadow: 0 1px 1px rgba(0,0,0,0.3);
}
.etude-table td {
  padding: 5px 4px; text-align: center; border: 1px solid var(--border); color: var(--text);
}
.etude-table td:first-child { text-align: left; font-weight: 600; min-width: 130px; }
.etude-table tbody tr:hover { background: rgba(0,137,123,0.06); }
.etude-table .editable-cell {
  background: var(--surface); border: 1px solid var(--border); border-radius: 4px;
  padding: 4px 6px; font-size: 11px; color: #1565c0; font-weight: 600;
  width: 70px; text-align: right; box-sizing: border-box; cursor: cell;
}
[data-theme="dark"] .etude-table .editable-cell { color: #64b5f6; background: #152028; }
.etude-table .editable-cell:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(0,137,123,0.2); }
.etude-table .editable-cell.cell-selected { border-color: var(--primary); background: rgba(0,137,123,0.08); }
/* v7.39 — pas de flèches spinner sur les cases d'étude (saisie au clavier uniquement) */
.editable-cell::-webkit-outer-spin-button,
.editable-cell::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.editable-cell[type="number"] { -moz-appearance: textfield; appearance: textfield; }
.etude-table .calc-cell {
  font-weight: 700; color: var(--text); background: rgba(249,168,37,0.12);
  border-radius: 4px; padding: 5px 6px;
}
[data-theme="dark"] .etude-table .calc-cell { background: rgba(251,192,45,0.1); color: var(--text); }
.etude-table .best-cell { background: rgba(46,125,50,0.15); color: #2E7D32; font-weight: 700; }
[data-theme="dark"] .etude-table .best-cell { color: #81c784; background: rgba(102,187,106,0.12); }
.etude-table tr.etude-row-header td { background: var(--bg); font-weight: 700; font-size: 10px; color: var(--text); text-transform: uppercase; }
.etude-apercu-content {
  display: none; padding: 20px; max-height: 60vh; overflow-y: auto;
}
.etude-apercu-content.visible {
  display: block;
}
.etude-apercu-document {
  background: white; padding: 40px; margin: 0 auto; max-width: 900px;
  box-shadow: 0 0 20px rgba(0,0,0,0.1); border-radius: 4px;
  font-family: 'Times New Roman', serif;
}
.etude-apercu-document h1, .etude-apercu-document h2, .etude-apercu-document h3 {
  text-align: center; margin: 20px 0 10px 0; color: #1a1a1a;
}
.etude-apercu-document table { width: 100%; border-collapse: collapse; margin: 15px 0; }
.etude-apercu-document td, .etude-apercu-document th { border: 1px solid #ccc; padding: 8px; text-align: right; }
.etude-apercu-document th { background: #f5f5f5; font-weight: bold; }
.etude-apercu-document td:first-child, .etude-apercu-document th:first-child { text-align: left; }
@media print {
  .etude-panel { max-width: 100%; margin: 0; box-shadow: none; }
  .etude-header, .etude-view-tabs, .etude-formula-bar, .etude-body, .etude-actions-bar { display: none !important; }
  .etude-apercu-content { display: block !important; padding: 0; max-height: none; }
  .etude-apercu-document { box-shadow: none; padding: 20px; }
}
.etude-actions-bar {
  display: flex; gap: 10px; align-items: center; padding: 14px 24px;
  border-top: 1px solid var(--border); background: var(--bg2);
  border-radius: 0 0 14px 14px;
}
.etude-badge {
  display: inline-block; padding: 2px 8px; border-radius: 10px;
  font-size: 10px; font-weight: 600;
}
.etude-badge.c5 { background: #E3F2FD; color: #1565C0; }
.etude-badge.c4 { background: #FFF3E0; color: #E65100; }
.etude-badge.gaz { background: #F3E5F5; color: #7B1FA2; }
.etude-rentabilite { font-size: 14px; font-weight: 700; }
.etude-rentabilite.positive { color: #2E7D32; }
.etude-rentabilite.negative { color: #C62828; }
.etude-add-row {
  background: none; border: 1px dashed var(--border); border-radius: 6px;
  padding: 6px 14px; font-size: 11px; color: var(--text2); cursor: pointer;
  margin-top: 6px; transition: all 0.15s;
}
.etude-add-row:hover { border-color: var(--primary); color: var(--primary); background: rgba(249,168,37,0.05); }

