  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

  /* ── Ecran de login ── */
  #login-screen {
    position:fixed; inset:0; z-index:100000;
    background:linear-gradient(135deg, #1a5c8a 0%, #2a7ab5 40%, #5bc4c0 100%);
    display:flex; align-items:center; justify-content:center;
    font-family:'DM Sans', sans-serif;
  }
  .login-card {
    background:white; border-radius:24px; padding:40px 36px;
    width:380px; max-width:90vw;
    box-shadow:0 20px 60px rgba(0,0,0,0.25);
    text-align:center;
  }
  .login-logo-wrap { margin-bottom:28px; }
  .login-input {
    display:block; width:100%; padding:12px 16px; margin-bottom:12px;
    border:1.5px solid #d0e0ea; border-radius:12px;
    font-size:0.88rem; font-family:'DM Sans',sans-serif;
    color:var(--text); background:#fafbfd; outline:none;
    transition:border-color 0.2s, box-shadow 0.2s;
  }
  .login-input:focus {
    border-color:var(--teal);
    box-shadow:0 0 0 3px rgba(91,196,192,0.2);
    background:white;
  }
  .login-input::placeholder { color:#a0b4c0; }
  .login-submit {
    display:block; width:100%; padding:12px; margin-top:8px;
    background:linear-gradient(120deg, #1a5c8a 0%, #5bc4c0 100%);
    color:white; border:none; border-radius:12px;
    font-size:0.92rem; font-weight:700; cursor:pointer;
    font-family:'DM Sans',sans-serif;
    box-shadow:0 4px 16px rgba(26,92,138,0.3);
    transition:transform 0.15s, box-shadow 0.15s;
  }
  .login-submit:hover { transform:translateY(-1px); box-shadow:0 6px 20px rgba(26,92,138,0.4); }
  .login-submit:active { transform:translateY(0); }

  :root {
    --bg: #eef4f8;
    --surface: #ffffff;
    --border: #d0e0ea;
    --accent: #1a5c8a;
    --teal: #5bc4c0;
    --accent-light: #e6f2fa;
    --teal-light: #e6f7f7;
    --text: #1c2a35;
    --muted: #7a96a8;
    --success: #2d7a4f;
    --danger: #c0392b;
    --section-bg: #f4f8fb;
    --grad: linear-gradient(120deg, #1a5c8a 0%, #5bc4c0 100%);
  }

  /* ── Dark Mode ── */
  html[data-theme="dark"] {
    --bg: #1a1f2e;
    --surface: #242938;
    --border: #3a4055;
    --accent: #5bc4c0;
    --teal: #5bc4c0;
    --accent-light: #2a3545;
    --teal-light: #1e3035;
    --text: #e0e6ed;
    --muted: #8899aa;
    --success: #4caf50;
    --danger: #ef5350;
    --section-bg: #2a3040;
    --grad: linear-gradient(120deg, #2a7ab5 0%, #5bc4c0 100%);
  }

  html[data-theme="dark"] header {
    background: var(--surface);
    border-color: var(--border);
    box-shadow: 0 4px 24px rgba(0,0,0,0.25);
  }

  html[data-theme="dark"] input[type="text"],
  html[data-theme="dark"] input[type="date"],
  html[data-theme="dark"] input[type="number"],
  html[data-theme="dark"] input[type="email"],
  html[data-theme="dark"] textarea,
  html[data-theme="dark"] select {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border);
  }

  html[data-theme="dark"] .login-card {
    background: var(--surface);
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  }
  html[data-theme="dark"] .login-input {
    background: var(--section-bg);
    border-color: var(--border);
    color: var(--text);
  }
  html[data-theme="dark"] .login-input:focus { background: var(--surface); }

  html[data-theme="dark"] .dent-btn {
    background: var(--surface);
    color: var(--muted);
  }

  html[data-theme="dark"] .teinte-chip {
    background: var(--surface);
    color: var(--text);
  }

  html[data-theme="dark"] .btn-secondary {
    background: var(--surface);
    color: var(--text);
  }

  html[data-theme="dark"] .btn-header-secondary {
    background: var(--surface);
    color: var(--accent);
  }

  html[data-theme="dark"] .btn-header-outline {
    background: var(--surface);
    color: var(--accent);
  }

  html[data-theme="dark"] .btn-pdf {
    background: var(--surface);
    color: var(--accent);
  }

  html[data-theme="dark"] .scan-panel {
    background: var(--surface);
  }
  html[data-theme="dark"] .scan-panel-warning {
    background: #2e2a1e;
    border-color: #5a4a20;
  }
  html[data-theme="dark"] .scan-panel-accent {
    background: var(--surface);
  }

  html[data-theme="dark"] .checkbox-label:has(input:checked) {
    background: #3a3520;
    color: #e6b800;
    border-color: #7a6a20;
  }

  html[data-theme="dark"] .gc-list-item.selected {
    background: #1e3040;
    color: var(--accent);
    border-color: #2a5070;
  }
  html[data-theme="dark"] .gc-list-item:not(.selected) { color: var(--text); }

  html[data-theme="dark"] .grille-list-item.selected {
    background: #1e3040;
    color: var(--accent);
    border-color: #2a5070;
  }
  html[data-theme="dark"] .grille-list-item:not(.selected) { color: var(--text); }
  html[data-theme="dark"] .grille-list-item-sub { color: var(--muted); }

  html[data-theme="dark"] .suggest-item { border-bottom-color: var(--border); }
  html[data-theme="dark"] .suggest-item:hover { background: var(--section-bg); }

  html[data-theme="dark"] .tarif-cab-btn:not(.selected) {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text);
  }

  html[data-theme="dark"] .pa-item { color: var(--text); }
  html[data-theme="dark"] .pa-item:hover { background: #2e2848; border-color: #6a5aaa; }
  html[data-theme="dark"] .pa-item.has-aliases { background: #2e2540; border-color: #7a5aaa; }

  html[data-theme="dark"] .dlb-case-row { background: var(--surface); }
  html[data-theme="dark"] .dlb-case-row.selected { background: #1e3035; border-color: #00838f; }
  html[data-theme="dark"] .dlb-case-patient { color: var(--text); }
  html[data-theme="dark"] .dlb-case-date { color: var(--muted); }
  html[data-theme="dark"] .dlb-case-comment { color: var(--muted); }
  html[data-theme="dark"] .dlb-table thead th { background: var(--section-bg); color: var(--muted); }
  html[data-theme="dark"] .dlb-table-row { background: var(--surface); }
  html[data-theme="dark"] .dlb-table-row:nth-child(odd) { background: var(--section-bg); }
  html[data-theme="dark"] .dlb-table-row:hover { background: #2a3550 !important; }
  html[data-theme="dark"] .dlb-table-row.selected { background: #1e3035; }
  html[data-theme="dark"] .dlb-table-row td { border-bottom-color: var(--border); color: var(--text); }
  html[data-theme="dark"] .dlb-td-date { color: var(--muted); }
  html[data-theme="dark"] .dlb-td-name { color: var(--text); }
  html[data-theme="dark"] .dlb-td-cabinet { color: var(--muted); }
  html[data-theme="dark"] .dlb-td-caseid { color: #6a7a8a; }
  html[data-theme="dark"] .dlb-detail-field { background: var(--section-bg); }
  html[data-theme="dark"] .dlb-detail-field span { color: var(--text); }
  html[data-theme="dark"] .dlb-detail-comment { background: #2e2a1e; border-color: #5a4a20; }
  html[data-theme="dark"] .dlb-detail-comment div { color: var(--text); }
  html[data-theme="dark"] .dlb-file-list { border-color: var(--border); }
  html[data-theme="dark"] .dlb-file-item { border-bottom-color: var(--border); }
  html[data-theme="dark"] .dlb-file-item span:first-child { color: var(--text); }

  html[data-theme="dark"] .imp-fournisseur-card {
    background: var(--surface);
    border-color: var(--border);
  }
  html[data-theme="dark"] .imp-fournisseur-logo { background: var(--section-bg); border-color: var(--border); }
  html[data-theme="dark"] .imp-fournisseur-actions button { background: var(--surface); border-color: var(--border); color: var(--muted); }
  html[data-theme="dark"] #imp-order-table td { border-bottom-color: var(--border); }
  html[data-theme="dark"] #imp-order-table tr.cab-alt { background: var(--section-bg); }
  html[data-theme="dark"] #imp-order-table tr:hover { background: #1e3040; }

  html[data-theme="dark"] .imp-drop-zone { background: var(--section-bg); }

  html[data-theme="dark"] #global-drop-overlay-inner {
    background: var(--surface);
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  }

  html[data-theme="dark"] #acte-detail-popup {
    background: var(--surface);
    border-color: var(--border);
    box-shadow: 0 8px 28px rgba(0,0,0,0.5);
  }
  html[data-theme="dark"] #acte-detail-popup input[type=text] { border-color: var(--border); }
  html[data-theme="dark"] .acte-popup-jaw button { background: var(--surface); border-color: var(--border); color: var(--accent); }
  html[data-theme="dark"] .acte-popup-jaw button.active { background: var(--accent); color: #1a1f2e; }

  html[data-theme="dark"] .us-modal { background: var(--surface); box-shadow: 0 8px 32px rgba(0,0,0,0.5); }
  html[data-theme="dark"] .us-group { background: var(--section-bg); border-color: var(--border); }

  html[data-theme="dark"] .filter-tag { background: #1e3040; color: #6ab4e8; }
  html[data-theme="dark"] .filter-tag-close { color: #6ab4e8; }

  html[data-theme="dark"] .gc-action-btn { background: var(--surface); color: var(--text); }
  html[data-theme="dark"] .gc-del-btn { background: #3a1a1a; border-color: #6a3030; }

  html[data-theme="dark"] .actions {
    background: linear-gradient(90deg, var(--teal-light), var(--accent-light));
    border-top-color: var(--border);
  }

  /* ═══════════════════════════════════════════════════════════════
     DARK MODE — MODALES (overrides globaux pour inline styles)
     ═══════════════════════════════════════════════════════════════ */

  /* --- Scope : toutes les modales --- */
  .dm-modal { /* alias selector below */ }
  html[data-theme="dark"] #modal-parametres > div,
  html[data-theme="dark"] #modal-tarifs > div,
  html[data-theme="dark"] #modal-implants > div,
  html[data-theme="dark"] #modal-digilab > div,
  html[data-theme="dark"] #modal-aliases-cabinet > div,
  html[data-theme="dark"] #popup-unit-solid .us-modal,
  html[data-theme="dark"] #popup-ajout-client > div {
    background: var(--surface) !important;
    box-shadow: 0 8px 40px rgba(0,0,0,0.5) !important;
    color: var(--text) !important;
  }

  /* Headers des modales (premier enfant div = barre supérieure) */
  html[data-theme="dark"] #modal-parametres > div > div:first-child,
  html[data-theme="dark"] #modal-tarifs > div > div:first-child,
  html[data-theme="dark"] #modal-implants > div > div:first-child,
  html[data-theme="dark"] #modal-digilab > div > div:first-child {
    background: var(--section-bg) !important;
    border-bottom-color: var(--border) !important;
  }

  /* Titres colorés dans les headers */
  html[data-theme="dark"] #modal-parametres span[style*="color:#4a148c"] { color: #ce93d8 !important; }
  html[data-theme="dark"] #modal-tarifs span[style*="color:#1a5c8a"] { color: var(--accent) !important; }
  html[data-theme="dark"] #modal-implants span[style*="color:#0277bd"] { color: #4fc3f7 !important; }
  html[data-theme="dark"] #modal-digilab span[style*="color:#00838f"] { color: #4dd0e1 !important; }

  /* Conteneurs d'onglets (pill groups) */
  html[data-theme="dark"] #modal-parametres div[style*="background:rgba(255"],
  html[data-theme="dark"] #modal-tarifs div[style*="background:#e8eff5"] {
    background: rgba(255,255,255,0.08) !important;
  }

  /* Boutons fermer ✕ */
  html[data-theme="dark"] #modal-parametres button[style*="color:#999"],
  html[data-theme="dark"] #modal-tarifs button[style*="color:#999"],
  html[data-theme="dark"] #modal-implants button[style*="color:#999"],
  html[data-theme="dark"] #modal-digilab button[style*="color:#999"],
  html[data-theme="dark"] #modal-aliases-cabinet button[style*="color:#888"] {
    color: var(--muted) !important;
  }

  /* --- Override global : tout fond blanc/clair inline dans les modales --- */
  html[data-theme="dark"] #modal-parametres div[style*="background:white"],
  html[data-theme="dark"] #modal-parametres div[style*="background:#fafafa"],
  html[data-theme="dark"] #modal-parametres div[style*="background:#fafbfd"],
  html[data-theme="dark"] #modal-tarifs div[style*="background:white"],
  html[data-theme="dark"] #modal-tarifs div[style*="background:#fafafa"],
  html[data-theme="dark"] #modal-tarifs div[style*="background:#fafcfe"],
  html[data-theme="dark"] #modal-tarifs div[style*="background:#fafbfd"],
  html[data-theme="dark"] #modal-tarifs div[style*="background:#f0f4f8"],
  html[data-theme="dark"] #modal-implants div[style*="background:white"],
  html[data-theme="dark"] #modal-implants div[style*="background:#fafbfd"],
  html[data-theme="dark"] #modal-digilab div[style*="background:white"],
  html[data-theme="dark"] #modal-digilab div[style*="background:#f8fafb"],
  html[data-theme="dark"] #modal-digilab div[style*="background:#f8fbff"] {
    background: var(--section-bg) !important;
  }

  /* Borders internes (séparateurs, sidebars) */
  html[data-theme="dark"] #modal-tarifs div[style*="border-right:1px solid #e8e8e8"],
  html[data-theme="dark"] #modal-tarifs div[style*="border-bottom:1px solid #e0e8f0"],
  html[data-theme="dark"] #modal-tarifs div[style*="border-bottom:1px solid #e8e8e8"],
  html[data-theme="dark"] #modal-parametres div[style*="border-bottom:1px solid #ede7f6"] {
    border-color: var(--border) !important;
  }

  /* --- Inputs & selects dans toutes les modales --- */
  html[data-theme="dark"] #modal-parametres input,
  html[data-theme="dark"] #modal-parametres select,
  html[data-theme="dark"] #modal-parametres textarea,
  html[data-theme="dark"] #modal-tarifs input,
  html[data-theme="dark"] #modal-tarifs select,
  html[data-theme="dark"] #modal-tarifs textarea,
  html[data-theme="dark"] #modal-implants input,
  html[data-theme="dark"] #modal-implants select,
  html[data-theme="dark"] #modal-digilab input,
  html[data-theme="dark"] #modal-digilab select,
  html[data-theme="dark"] #modal-aliases-cabinet input,
  html[data-theme="dark"] #popup-ajout-client input,
  html[data-theme="dark"] #popup-ajout-client select,
  html[data-theme="dark"] #popup-ajout-client textarea {
    background: var(--surface) !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
  }
  html[data-theme="dark"] #modal-parametres input::placeholder,
  html[data-theme="dark"] #modal-tarifs input::placeholder,
  html[data-theme="dark"] #modal-digilab input::placeholder {
    color: var(--muted) !important;
  }

  /* --- Boutons inline (fond blanc) dans les modales --- */
  html[data-theme="dark"] #modal-parametres button[style*="background:white"],
  html[data-theme="dark"] #modal-tarifs button[style*="background:white"],
  html[data-theme="dark"] #modal-implants button[style*="background:white"],
  html[data-theme="dark"] #popup-ajout-client button[style*="background:white"] {
    background: var(--surface) !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
  }

  /* --- Textes gris inline (#666, #555, #888, #999, #333, #aaa) --- */
  html[data-theme="dark"] #modal-tarifs span[style*="color:#aaa"],
  html[data-theme="dark"] #modal-tarifs span[style*="color:#888"],
  html[data-theme="dark"] #modal-tarifs div[style*="color:#666"],
  html[data-theme="dark"] #modal-parametres div[style*="color:#666"],
  html[data-theme="dark"] #modal-parametres div[style*="color:#888"],
  html[data-theme="dark"] #modal-digilab span[style*="color:#666"] {
    color: var(--muted) !important;
  }

  /* --- Modale Paramètres — spécifiques --- */

  /* Lignes mapping/labels (alternance) */
  html[data-theme="dark"] #pm-mapping-tbody tr,
  html[data-theme="dark"] #pm-labels-tbody tr {
    background: var(--surface) !important;
    border-bottom-color: var(--border) !important;
  }
  html[data-theme="dark"] #pm-mapping-tbody tr:nth-child(odd),
  html[data-theme="dark"] #pm-labels-tbody tr:nth-child(odd) {
    background: var(--section-bg) !important;
  }
  html[data-theme="dark"] #pm-mapping-tbody td,
  html[data-theme="dark"] #pm-labels-tbody td {
    color: var(--text) !important;
  }

  /* Prefs sections */
  html[data-theme="dark"] #pm-prefs-content div[style*="background:#f8f4ff"],
  html[data-theme="dark"] #pm-prefs-content div[style*="background:#f5f5f5"] {
    background: var(--section-bg) !important;
    border-color: var(--border) !important;
  }
  html[data-theme="dark"] #pm-prefs-content h3 { color: #ce93d8 !important; }
  html[data-theme="dark"] #pm-prefs-content div[style*="color:#6a1b9a"] { color: #ce93d8 !important; }
  html[data-theme="dark"] #pm-prefs-content label { color: var(--text) !important; }
  html[data-theme="dark"] #pm-prefs-content label[style*="color:#888"],
  html[data-theme="dark"] #pm-prefs-content div[style*="color:#888"] { color: var(--muted) !important; }

  /* --- Modale Gestion Clients — spécifiques --- */

  /* --- Modale Gestion Clients --- */

  /* Sidebar cabinets */
  html[data-theme="dark"] #modal-tarifs div[style*="background:#fafcfe"] {
    background: var(--section-bg) !important;
    border-right-color: var(--border) !important;
  }

  /* Groupes cabinets dans sidebar */
  html[data-theme="dark"] #gc-cabinet-list div[style*="background:#e8f0fe"] {
    background: #1e2a40 !important;
  }
  html[data-theme="dark"] #gc-cabinet-list span[style*="color:#1a5c8a"] {
    color: var(--accent) !important;
  }
  html[data-theme="dark"] #gc-cabinet-list span[style*="background:#c8daf8"] {
    background: #2a3a55 !important;
    color: #8ab4e8 !important;
  }
  html[data-theme="dark"] #gc-cabinet-list div[style*="border-left:2px solid #c8daf8"] {
    border-left-color: var(--border) !important;
  }
  html[data-theme="dark"] #gc-cabinet-list div[style*="color:#aaa"] {
    color: var(--muted) !important;
  }

  /* Boutons filtre statut sidebar */
  html[data-theme="dark"] #gc-filtre-actif,
  html[data-theme="dark"] #gc-filtre-inactif,
  html[data-theme="dark"] button[onclick="gcOuvrirGroupes()"] {
    border-color: var(--border) !important;
  }

  /* Zone liaison tarifs */
  html[data-theme="dark"] #gc-liaison-zone {
    background: #2e2a1e !important;
    border-color: #5a4a20 !important;
  }

  /* Fiche client : sections inline claires → dark */
  html[data-theme="dark"] #gc-panel-contacts div[style*="background:#f8fafc"],
  html[data-theme="dark"] #gc-panel-contacts div[style*="background:#f0f4f8"],
  html[data-theme="dark"] #gc-panel-contacts div[style*="background:#fafcfe"] {
    background: var(--section-bg) !important;
    border-color: var(--border) !important;
  }
  /* Sections jaunes (notes, alertes) */
  html[data-theme="dark"] #gc-panel-contacts div[style*="background:#fff8e1"],
  html[data-theme="dark"] #gc-panel-contacts div[style*="background:#fffde7"],
  html[data-theme="dark"] #gc-panel-contacts div[style*="background:#fff3e0"] {
    background: #2e2a1e !important;
    border-color: #5a4a20 !important;
  }
  /* Section verte (tarif lié) */
  html[data-theme="dark"] #gc-panel-contacts div[style*="background:#f0fff4"] {
    background: #1e2e25 !important;
    border-color: #2a5040 !important;
  }
  /* Textes dans la fiche */
  html[data-theme="dark"] #gc-panel-contacts span[style*="color:#333"],
  html[data-theme="dark"] #gc-panel-contacts div[style*="color:#333"],
  html[data-theme="dark"] #gc-panel-contacts td[style*="color:#333"] {
    color: var(--text) !important;
  }
  html[data-theme="dark"] #gc-panel-contacts span[style*="color:#555"],
  html[data-theme="dark"] #gc-panel-contacts span[style*="color:#888"],
  html[data-theme="dark"] #gc-panel-contacts div[style*="color:#888"],
  html[data-theme="dark"] #gc-panel-contacts div[style*="color:#666"],
  html[data-theme="dark"] #gc-panel-contacts label[style*="color:#888"] {
    color: var(--muted) !important;
  }
  html[data-theme="dark"] #gc-panel-contacts textarea {
    background: var(--surface) !important;
    color: var(--text) !important;
  }
  /* Boutons action fiche client */
  html[data-theme="dark"] #gc-panel-contacts button[style*="background:#fff3e0"],
  html[data-theme="dark"] #gc-panel-contacts button[style*="background:#ffebee"] {
    background: var(--section-bg) !important;
    border-color: var(--border) !important;
  }

  /* --- Onglet Tarifs --- */

  /* Barre outils tarifs */
  html[data-theme="dark"] #gc-tarif-toolbar {
    background: var(--section-bg) !important;
    border-bottom-color: var(--border) !important;
  }

  /* Tableau tarifs — lignes */
  html[data-theme="dark"] #tarif-tbody tr {
    background: var(--surface) !important;
    border-bottom-color: var(--border) !important;
  }
  html[data-theme="dark"] #tarif-tbody tr:nth-child(odd) {
    background: var(--section-bg) !important;
  }
  html[data-theme="dark"] #tarif-tbody td {
    color: var(--text) !important;
    border-right-color: var(--border) !important;
  }
  /* Labels acte (sticky column) */
  html[data-theme="dark"] #tarif-tbody td[style*="color:#1a5c8a"] {
    color: var(--accent) !important;
    background: var(--surface) !important;
    border-right-color: var(--border) !important;
  }
  /* Code acte */
  html[data-theme="dark"] #tarif-tbody td[style*="color:#888"] {
    color: var(--muted) !important;
  }
  /* Inputs prix */
  html[data-theme="dark"] #tarif-tbody input {
    background: var(--surface) !important;
    border-color: var(--border) !important;
    color: var(--accent) !important;
  }
  /* Inputs prix modifiés (orange) */
  html[data-theme="dark"] #tarif-tbody input[style*="background:#fff8e1"] {
    background: #2e2a1e !important;
    border-color: #5a4a20 !important;
    color: #ffb74d !important;
  }
  /* Inputs prix vides */
  html[data-theme="dark"] #tarif-tbody input[style*="background:#f5f5f5"] {
    background: var(--section-bg) !important;
    color: var(--muted) !important;
  }

  /* Séparateurs groupes tarifs */
  html[data-theme="dark"] #tarif-tbody td[style*="background:#e8f4fb"] {
    background: #1e2a40 !important;
    color: var(--accent) !important;
    border-bottom-color: var(--border) !important;
  }
  html[data-theme="dark"] #tarif-tbody td[style*="background:#f0f0f0"] {
    background: var(--section-bg) !important;
    color: var(--muted) !important;
  }

  /* --- Digilab — cas et détails --- */

  /* Contenu Digilab */
  html[data-theme="dark"] #modal-digilab div[style*="background:#f8fafb"],
  html[data-theme="dark"] #modal-digilab div[style*="background:#f8fbff"] {
    background: var(--section-bg) !important;
  }
  html[data-theme="dark"] #modal-digilab div[style*="background:#fffde7"] {
    background: #2e2a1e !important;
    border-color: #5a4a20 !important;
  }
  /* Textes inline digilab */
  html[data-theme="dark"] #modal-digilab span[style*="color:#555"],
  html[data-theme="dark"] #modal-digilab span[style*="color:#999"],
  html[data-theme="dark"] #modal-digilab span[style*="color:#888"],
  html[data-theme="dark"] #modal-digilab div[style*="color:#333"] {
    color: var(--muted) !important;
  }

  /* Boutons Digilab header */
  html[data-theme="dark"] #modal-digilab button[onclick="dlbRefresh()"] {
    background: var(--teal-light) !important;
    border-color: var(--border) !important;
    color: var(--accent) !important;
  }

  /* --- Popups dynamiques (groupes, ajout client, etc.) --- */
  html[data-theme="dark"] #popup-gc-groupes > div,
  html[data-theme="dark"] #popup-ajout-client > div {
    background: var(--surface) !important;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5) !important;
    color: var(--text) !important;
  }
  html[data-theme="dark"] #popup-gc-groupes div[style*="background:#f8fbff"],
  html[data-theme="dark"] #popup-gc-groupes div[style*="background:white"] {
    background: var(--section-bg) !important;
  }

  /* Bouton Gestion clients (sous le formulaire principal) */
  html[data-theme="dark"] button[onclick="ouvrirModalTarifs()"] {
    background: var(--section-bg) !important;
    color: #ff8a65 !important;
  }

  /* --- Fiche client (#contacts-editor) contenu dynamique --- */

  /* Bloc coordonnées */
  html[data-theme="dark"] #contacts-editor div[style*="background:#f8fafc"] {
    background: var(--section-bg) !important;
    border-color: var(--border) !important;
  }
  /* Textes coordonnées (#444) */
  html[data-theme="dark"] #contacts-editor div[style*="color:#444"],
  html[data-theme="dark"] #contacts-editor span[style*="color:#444"] {
    color: var(--text) !important;
  }
  /* Liens */
  html[data-theme="dark"] #contacts-editor a[style*="color:#1a5c8a"] {
    color: var(--accent) !important;
  }
  /* Boutons Copier */
  html[data-theme="dark"] #contacts-editor button[style*="color:#666"] {
    color: var(--muted) !important;
    border-color: var(--border) !important;
  }

  /* Grille tarifaire (vert ou jaune) */
  html[data-theme="dark"] #contacts-editor div[style*="background:#f0fff4"] {
    background: #1e2e25 !important;
    border-color: #2a5040 !important;
  }
  html[data-theme="dark"] #contacts-editor div[style*="background:#fff8e1"],
  html[data-theme="dark"] #contacts-editor div[style*="background:#fffde7"] {
    background: #2e2a1e !important;
    border-color: #5a4a20 !important;
  }
  html[data-theme="dark"] #contacts-editor div[style*="background:#fff3e0"] {
    background: #2e2518 !important;
    border-color: #5a4020 !important;
  }

  /* Notes internes */
  html[data-theme="dark"] #contacts-editor textarea {
    background: var(--surface) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
  }

  /* Section prescriptions */
  html[data-theme="dark"] #contacts-editor div[style*="border:1px solid #e8eef4"] {
    border-color: var(--border) !important;
  }
  html[data-theme="dark"] #contacts-editor div[style*="background:#f0f4f8"] {
    background: var(--section-bg) !important;
    border-color: var(--border) !important;
  }
  /* Lignes prescriptions */
  html[data-theme="dark"] #contacts-editor div[style*="border-bottom:1px solid #f0f4f8"] {
    border-bottom-color: var(--border) !important;
  }
  html[data-theme="dark"] #contacts-editor span[style*="color:#333"] {
    color: var(--text) !important;
  }
  html[data-theme="dark"] #contacts-editor span[style*="color:#888"],
  html[data-theme="dark"] #contacts-editor span[style*="color:#aaa"],
  html[data-theme="dark"] #contacts-editor span[style*="color:#999"],
  html[data-theme="dark"] #contacts-editor div[style*="color:#aaa"],
  html[data-theme="dark"] #contacts-editor div[style*="color:#888"],
  html[data-theme="dark"] #contacts-editor div[style*="color:#666"] {
    color: var(--muted) !important;
  }

  /* Section praticiens */
  html[data-theme="dark"] #contacts-editor div[style*="background:#e8f4fb"] {
    background: #1e2a40 !important;
  }
  /* Zone ajout praticien */
  html[data-theme="dark"] #contacts-editor div[style*="background:#fafcfe"] {
    background: var(--section-bg) !important;
    border-top-color: var(--border) !important;
  }
  /* Lignes praticiens */
  html[data-theme="dark"] #contacts-liste > div {
    background: var(--section-bg) !important;
    border-color: var(--border) !important;
    color: var(--text);
  }
  html[data-theme="dark"] #contacts-liste span[style*="background:#ede7f6"] {
    background: #2e2540 !important;
    color: #ce93d8 !important;
  }
  html[data-theme="dark"] #contacts-liste div[style*="border-top:1px dashed"] {
    border-top-color: var(--border) !important;
  }
  /* Boutons modifier/supprimer fiche */
  html[data-theme="dark"] #contacts-editor button[style*="background:#fff3e0"] {
    background: var(--section-bg) !important;
    border-color: var(--border) !important;
  }
  html[data-theme="dark"] #contacts-editor button[style*="background:#ffebee"] {
    background: #3a1a1a !important;
    border-color: #6a3030 !important;
  }
  /* Titre cabinet */
  html[data-theme="dark"] #contacts-editor h3[style*="color:#1a5c8a"] {
    color: var(--accent) !important;
  }
  /* Notes header */
  html[data-theme="dark"] #contacts-editor span[style*="color:#1a5c8a"] {
    color: var(--accent) !important;
  }
  /* Aucune prescription (dashed) */
  html[data-theme="dark"] #contacts-editor div[style*="border:1px dashed"] {
    border-color: var(--border) !important;
    color: var(--muted) !important;
  }
  /* Badge COG */
  html[data-theme="dark"] #contacts-editor span[style*="background:#e8f5e9"] {
    background: #1e2e25 !important;
  }
  /* Statut select */
  html[data-theme="dark"] #contacts-editor select {
    background: var(--surface) !important;
  }

  /* Alias cabinet */
  html[data-theme="dark"] #modal-aliases-cabinet h3 { color: var(--text) !important; }

  body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    padding: 24px 16px 60px;
  }

  header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 960px;
    margin: 0 auto 32px;
    padding: 18px 24px;
    background: var(--surface);
    border-radius: 20px;
    box-shadow: 0 4px 24px rgba(26,92,138,0.10);
    border: 1px solid rgba(91,196,192,0.18);
  }

  .logo {
    display: flex;
    align-items: center;
    gap: 18px;
    text-decoration: none;
  }
  .logo-img-wrap {
    position: relative;
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(26,92,138,0.06), rgba(91,196,192,0.10));
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 14px rgba(91,196,192,0.22);
    flex-shrink: 0;
    overflow: hidden;
  }
  .logo-img {
    width: auto;
    height: 74px;
    object-fit: contain;
  }
  .logo-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
  }
  .logo-labo {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: var(--muted);
    line-height: 1;
  }
  .logo-ilovesmile {
    font-family: 'Dancing Script', cursive;
    font-size: 2.6rem;
    font-weight: 700;
    background: linear-gradient(120deg, #1a5c8a 0%, #5bc4c0 60%, #4ab0ac 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.05;
    letter-spacing: 0px;
    margin-top: 2px;
  }
  .logo-tagline {
    font-size: 0.58rem;
    color: var(--muted);
    letter-spacing: 1.8px;
    text-transform: uppercase;
    font-weight: 500;
    margin-top: 2px;
  }
  .badge {
    font-family: 'DM Mono', monospace;
    font-size: 0.72rem;
    background: linear-gradient(135deg, #1a5c8a, #5bc4c0);
    color: white;
    padding: 7px 16px;
    border-radius: 20px;
    letter-spacing: 0.5px;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(26,92,138,0.18);
  }

  .card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    max-width: 720px;
    margin: 0 auto;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(26,92,138,0.08);
  }

  /* SPLIT LAYOUT */
  .split-wrapper {
    display: grid;
    grid-template-columns: minmax(0, 720px) minmax(560px, 1fr);
    gap: 12px;
    max-width: 1500px;
    margin: 0 auto;
    align-items: start;
  }

  .split-wrapper .card {
    max-width: 100%;
    margin: 0;
  }

  .preview-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0,0,0,0.06);
    position: sticky;
    top: 20px;
    display: none;
  }

  .preview-panel.visible { display: block; }

  .preview-panel-header {
    background: #2d2d2d;
    color: white;
    padding: 14px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.82rem;
    font-weight: 500;
  }

  .preview-panel-body {
    padding: 0;
    min-height: 600px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1a1a1a;
    position: relative;
  }

  .preview-panel-body img {
    width: 100%;
    max-height: 90vh;
    object-fit: contain;
    display: block;
  }

  .preview-panel-body iframe {
    width: 100%;
    height: 90vh;
    border: none;
    background: var(--surface);
  }

  .preview-panel-body .pdf-embed {
    width: 100%;
    height: 90vh;
    border: none;
  }

  .preview-panel-empty {
    color: #666;
    font-size: 0.85rem;
    text-align: center;
    padding: 40px 20px;
  }

  .preview-zoom {
    position: absolute;
    bottom: 12px;
    right: 12px;
    display: flex;
    gap: 6px;
  }

  .preview-zoom button {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    border-radius: 6px;
    width: 30px;
    height: 30px;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .preview-zoom button:hover { background: rgba(255,255,255,0.25); }

  @media (max-width: 1000px) {
    .split-wrapper { grid-template-columns: 1fr; }
    .preview-panel { position: static; }
  }

  .card-header {
    background: var(--grad);
    color: white;
    padding: 7px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
  }

  .card-header h1 { font-size: 0.8rem; font-weight: 600; letter-spacing: 0.8px; text-transform: uppercase; }

  .n-commande {
    font-family: 'DM Mono', monospace;
    font-size: 1.1rem;
    font-weight: 500;
    opacity: 0.9;
  }

  .form-body { padding: 6px 10px; display: flex; flex-direction: column; gap: 6px; }

  .top-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }

  .section {
    background: var(--section-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 6px 10px;
  }

  .section-title {
    font-size: 0.58rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--accent);
    margin-bottom: 3px;
    padding-bottom: 2px;
    border-bottom: 1px solid var(--border);
  }

  label { font-size: 0.7rem; color: var(--muted); display: block; margin-bottom: 1px; margin-top: 3px; }
  label:first-of-type { margin-top: 0; }

  input[type="text"], input[type="date"], input[type="number"], textarea, select {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 4px 7px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.76rem;
    background: var(--surface);
    color: var(--text);
    outline: none;
    transition: border-color 0.15s;
  }

  input:focus, textarea:focus, select:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(91,196,192,0.15); }

  .sexe-row { display: flex; gap: 10px; margin-top: 0px; align-items: center; }
  .radio-label { display: inline-flex; align-items: center; gap: 5px; font-size: 0.74rem; color: var(--text); cursor: pointer; line-height: 1; }
  .radio-label input[type="radio"] { accent-color: var(--accent); width: 12px; height: 12px; flex-shrink: 0; margin: 0; }

  .checkbox-label { display: flex; align-items: center; gap: 5px; font-size: 0.74rem; color: var(--text); cursor: pointer; margin: 2px 0; line-height: 1.2; padding: 1px 4px; border-radius: 4px; transition: background 0.15s, font-weight 0.15s; }
  .checkbox-label:has(input:checked) { background: #fff8e1; font-weight: 600; color: #b8860b; border: 1px solid #e6a700; }
  /* Alias produits — items cliquables dans la modal */
  .pa-item { font-size:0.74rem; color:var(--text); cursor:pointer; padding:3px 8px; margin:2px 0; border-radius:6px; border:1px solid transparent; transition:all 0.15s; position:relative; font-weight:500; }
  .pa-item:hover { background:#ede7f6; border-color:#b39ddb; }
  .pa-item.pa-sub { font-size:0.68rem; color:#666; margin-left:2px; font-weight:400; }
  .pa-item .pa-count { font-size:0.6rem; background:#7c4dff; color:white; border-radius:8px; padding:0 5px; margin-left:4px; display:none; font-weight:700; }
  .pa-item.has-aliases { background:#f3e8ff; border-color:#ce93d8; }
  .pa-item.has-aliases .pa-count { display:inline; }
  .pa-item.pa-active { background:#7c4dff; color:white !important; border-color:#7c4dff; }
  .pa-item.pa-active .pa-count { background:var(--surface); color:#7c4dff; }
  .pa-item.pa-active.pa-sub { color:white !important; }
  .checkbox-label input[type="checkbox"] { accent-color: #e6a700; width: 12px; height: 12px; flex-shrink: 0; margin: 0; vertical-align: middle; }
  .qty-input { display:none; width: 36px !important; min-width: 36px !important; max-width: 36px !important; height: 18px !important; border: 1px solid var(--border); border-radius: 3px; font-size: 0.65rem; text-align: left; padding-left: 4px !important; padding-right: 0 !important; padding-top: 0 !important; padding-bottom: 0 !important; font-family: 'DM Sans',sans-serif; color: var(--accent); font-weight: 700; margin-left: 3px; box-sizing: border-box; flex: 0 0 36px; }
  .qty-input:focus { outline: none; border-color: var(--accent); }

  .date-row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
  .nbr-row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 3px; }
  input[type="number"] { -moz-appearance: textfield; }

  .main-row { display: grid; grid-template-columns: 1.6fr 1fr; gap: 10px; }

  .section-sub-title {
    font-size: 0.62rem;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 6px 0 3px;
  }

  .checkbox-group { display: flex; flex-direction: column; }
  .checkbox-sub { margin-left: 14px; }

  .inline-input {
    display: flex;
    align-items: center;
    gap: 5px;
    margin: 2px 0;
    font-size: 0.72rem;
  }

  .inline-input input[type="text"] {
    width: auto;
    flex: 1;
    padding: 2px 5px;
    font-size: 0.72rem;
  }

  .inline-input input[type="checkbox"] { accent-color: var(--accent); width: 12px; height: 12px; }

  .dents-grid { display: flex; flex-direction: column; gap: 2px; margin-top: 2px; }
  .dents-row { display: flex; justify-content: center; gap: 2px; }
  .dents-divider { width: 2px; background: var(--border); margin: 0 3px; border-radius: 2px; }

  .dent-btn {
    width: 24px; height: 24px;
    border: 1.5px solid var(--border);
    border-radius: 4px;
    background: var(--surface);
    font-size: 0.52rem;
    font-family: 'DM Mono', monospace;
    cursor: pointer;
    color: var(--muted);
    transition: all 0.12s;
    display: flex; align-items: center; justify-content: center;
    font-weight: 500;
  }

  .dent-btn:hover { border-color: var(--teal); color: var(--accent); background: var(--teal-light); }
  .dent-btn.selected { background: var(--grad); color: white; border-color: var(--accent); }

  .dents-labels { display: flex; justify-content: center; gap: 2px; font-size: 0.52rem; color: var(--muted); font-family: 'DM Mono', monospace; }

  .bottom-row { display: grid; grid-template-columns: 180px 1fr; gap: 8px; }

  /* ── Utilitaires pour remplacer les styles inline répétitifs ── */
  .flex-center { display: flex; align-items: center; }
  .flex-between { display: flex; justify-content: space-between; align-items: center; }
  .flex-col { display: flex; flex-direction: column; }
  .gap-4 { gap: 4px; }
  .gap-6 { gap: 6px; }
  .gap-8 { gap: 8px; }
  .gap-12 { gap: 12px; }
  .gap-16 { gap: 16px; }
  .mt-2 { margin-top: 2px; }
  .mt-3 { margin-top: 3px; }
  .mt-4 { margin-top: 4px; }
  .mt-5 { margin-top: 5px; }
  .mt-6 { margin-top: 6px; }
  .ml-14 { margin-left: 14px; }
  .w-100 { width: 100%; }
  .nowrap { white-space: nowrap; }
  .text-muted { color: var(--muted); }
  .text-accent { color: var(--accent); }
  .text-danger { color: var(--danger); }
  .text-xs { font-size: 0.68rem; }
  .text-sm { font-size: 0.72rem; }
  .fw-bold { font-weight: 600; }
  .fw-bolder { font-weight: 700; }

  /* Header buttons */
  .btn-header-primary {
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer; background: var(--grad); color: white;
    padding: 0 18px; height: 36px; border: none;
    border-radius: 12px; font-size: 0.78rem; font-weight: 600;
    box-shadow: 0 2px 10px rgba(26,92,138,0.2); white-space: nowrap;
    font-family: 'DM Sans', sans-serif;
  }
  .btn-header-secondary {
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer; background: var(--surface); color: var(--accent);
    border: 1.5px solid var(--teal); padding: 0 18px; height: 36px;
    border-radius: 12px; font-size: 0.78rem; font-weight: 600;
    box-shadow: 0 2px 8px rgba(91,196,192,0.12); white-space: nowrap;
    font-family: 'DM Sans', sans-serif;
  }
  .btn-header-outline {
    display: inline-flex; align-items: center; cursor: pointer;
    background: var(--surface); color: var(--accent); border: 1.5px solid var(--accent);
    padding: 0 18px; height: 36px; border-radius: 12px;
    font-size: 0.78rem; font-weight: 600;
    box-shadow: 0 2px 8px rgba(26,92,138,0.10); white-space: nowrap; gap: 6px;
    font-family: 'DM Sans', sans-serif;
  }

  /* Panels scan */
  .scan-panel {
    background: var(--surface); border: 1px solid var(--border);
    border-left: 3px solid var(--teal); border-radius: 10px;
    padding: 10px 16px;
  }
  .scan-panel-warning {
    background: var(--surface); border: 1px solid #ffe082;
    border-left: 3px solid #f59e0b; border-radius: 10px;
    padding: 12px 16px; margin-top: 8px;
  }
  .scan-panel-accent {
    background: var(--surface); border: 1px solid var(--border);
    border-left: 3px solid var(--accent); border-radius: 10px;
    padding: 14px 16px; margin-top: 8px;
  }

  /* Dossier tags */
  .folder-tag {
    display: inline-flex; align-items: center; gap: 5px;
    border-radius: 20px; padding: 3px 10px;
    font-size: 0.75rem; font-weight: 600;
  }
  .folder-tag-handle {
    background: var(--accent-light); border: 1px solid var(--border); color: var(--accent);
  }
  .folder-tag-entry {
    background: #f0faf9; border: 1px solid var(--teal); color: var(--teal);
  }
  .folder-tag-remove {
    cursor: pointer; color: var(--muted); font-size: 0.85rem; font-weight: 400;
  }

  /* Inline séparateur */
  .inline-sep { height: 1px; background: var(--border); margin: 6px 0; }

  /* GC cabinet list item */
  .gc-list-item {
    padding: 7px 9px; border-radius: 7px; cursor: pointer;
    font-size: 0.78rem; display: flex; justify-content: space-between;
    align-items: center; gap: 4px; margin-bottom: 1px;
    border: 1px solid transparent;
  }
  .gc-list-item.selected {
    background: #e3f2fd; color: #1a5c8a; border-color: #90caf9;
  }
  .gc-list-item:not(.selected) { background: transparent; color: var(--text); }
  .gc-list-item-name {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1;
  }
  .gc-list-item.selected .gc-list-item-name { font-weight: 600; }
  .gc-list-item-badges { display: flex; gap: 2px; flex-shrink: 0; }
  .gc-badge-contacts {
    font-size: 0.62rem; background: #e3f2fd; color: #1565c0;
    border-radius: 3px; padding: 1px 4px;
  }
  .gc-badge-tarif {
    font-size: 0.62rem; background: #e8f5e9; color: #2e7d32;
    border-radius: 3px; padding: 1px 4px;
  }

  /* Grille list item */
  .grille-list-item {
    padding: 7px 9px; border-radius: 7px; cursor: pointer; margin-bottom: 1px;
    border: 1px solid transparent;
  }
  .grille-list-item.selected {
    background: #e3f2fd; color: #1a5c8a; border-color: #90caf9;
  }
  .grille-list-item:not(.selected) { background: transparent; color: var(--text); }
  .grille-list-item-title { font-size: 0.78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .grille-list-item.selected .grille-list-item-title { font-weight: 600; }
  .grille-list-item-sub { font-size: 0.66rem; color: var(--muted); margin-top: 1px; }

  /* Filter tags */
  .filter-tag {
    background: #e3f2fd; color: #1565c0; border-radius: 20px;
    padding: 2px 10px; font-size: 0.73rem; font-weight: 600;
    display: flex; align-items: center; gap: 4px;
  }
  .filter-tag-close {
    background: none; border: none; cursor: pointer;
    color: #1565c0; font-size: 0.8rem; padding: 0; line-height: 1;
  }

  /* Autocomplete suggestion item */
  .suggest-item {
    padding: 7px 12px; cursor: pointer; font-size: 0.8rem;
    border-bottom: 1px solid #f0f0f0;
  }
  .suggest-item:hover { background: #f0f7ff; }

  /* Code labo badge in list */
  .code-labo-badge {
    font-size: 0.78rem; background: #1a5c8a; color: #ffffff;
    padding: 2px 10px; border-radius: 10px; font-weight: 700;
    letter-spacing: 0.5px; -webkit-text-fill-color: #ffffff;
  }

  /* Tarif cabinet toggle button */
  .tarif-cab-btn {
    padding: 3px 10px; border-radius: 20px; font-size: 0.72rem;
    cursor: pointer; font-weight: 600; white-space: nowrap; border: 1.5px solid;
  }
  .tarif-cab-btn.selected {
    border-color: #1a5c8a;
    background: linear-gradient(120deg,#1a5c8a,#5bc4c0);
    color: white;
  }
  .tarif-cab-btn:not(.selected) {
    border-color: #d0e0ea; background: var(--surface); color: var(--text);
  }

  /* Fournisseur badge dans la liste */
  .fournisseur-badge {
    background: #e8f4fd; color: #1a5c8a; border-radius: 4px;
    padding: 1px 5px; font-size: 0.65rem; font-weight: 600;
  }

  /* Bouton-lien GC */
  .gc-action-btn {
    background: none; border: 1px solid var(--border); border-radius: 5px;
    padding: 1px 7px; font-size: 0.68rem; cursor: pointer;
  }
  .gc-del-btn {
    background: #ffebee; border: 1px solid #ef9a9a; border-radius: 5px;
    padding: 2px 8px; font-size: 0.68rem; color: #c62828; cursor: pointer;
  }
  .gc-lier-btn {
    background: linear-gradient(120deg,#1a5c8a,#5bc4c0); color: white;
    border: none; border-radius: 8px; padding: 6px 14px;
    font-size: 0.78rem; font-weight: 600; cursor: pointer;
  }

  .teinte-options { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 3px; }
  .teinte-chip {
    border: 1.5px solid var(--border);
    border-radius: 5px;
    padding: 2px 6px;
    font-size: 0.66rem;
    cursor: pointer;
    background: var(--surface);
    transition: all 0.12s;
    font-family: 'DM Mono', monospace;
  }
  .teinte-chip:hover { border-color: var(--teal); color: var(--accent); }
  .teinte-chip.selected { background: var(--grad); color: white; border-color: var(--accent); }

  textarea { resize: vertical; min-height: 60px; line-height: 1.4; }

  .actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 8px 14px;
    border-top: 1px solid var(--border);
    background: linear-gradient(90deg, var(--teal-light), var(--accent-light));
  }

  .btn {
    padding: 6px 16px;
    border-radius: 8px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.15s;
  }

  .btn-secondary {
    background: var(--surface);
    border: 1.5px solid var(--border);
    color: var(--text);
  }

  .btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

  .btn-primary {
    background: var(--grad);
    color: white;
  }

  .btn-primary:hover { background: linear-gradient(120deg, #154d75 0%, #4ab0ac 100%); }

  .btn-success {
    background: var(--success);
    color: white;
  }

  .btn-success:hover { background: #235f3d; }

  /* NOTIFICATIONS */
  .toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--success);
    color: white;
    padding: 14px 22px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s;
    pointer-events: none;
    z-index: 100;
  }

  .toast.show { opacity: 1; transform: translateY(0); }

  @keyframes slideInRight {
    from { opacity: 0; transform: translateX(30px); }
    to   { opacity: 1; transform: translateX(0); }
  }

  /* LISTE DES PRESCRIPTIONS */
  .list-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    max-width: 960px;
    margin: 24px auto 0;
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(26,92,138,0.09);
  }

  .list-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .list-header h2 { font-size: 0.9rem; font-weight: 600; }

  .prescriptions-list { padding: 16px; display: flex; flex-direction: column; gap: 10px; max-height: 70vh; overflow-y: auto; }

  .prescription-item {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--section-bg);
    cursor: pointer;
    transition: all 0.12s;
  }

  .prescription-item:hover { border-color: var(--teal); box-shadow: 0 2px 12px rgba(91,196,192,0.15); }

  .pi-left { display: flex; flex-direction: column; gap: 4px; }
  .pi-num { font-family: 'DM Mono', monospace; font-size: 0.8rem; background: var(--grad); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; font-weight: 600; }
  .pi-patient { font-size: 0.9rem; font-weight: 500; }
  .pi-type { font-size: 0.78rem; color: var(--muted); }

  .pi-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
  .pi-date { font-size: 0.78rem; color: var(--muted); }

  .status-badge {
    font-size: 0.68rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }

  .status-attente    { background: #fff3cd; color: #92650a; }
  .status-verifie    { background: #d4edda; color: #155724; }
  .status-importe    { background: #dce8f5; color: #2c5f8a; }

  .empty-state {
    text-align: center;
    padding: 32px;
    color: var(--muted);
    font-size: 0.85rem;
  }

  .btn-pdf {
    background: var(--surface);
    border: 1.5px solid var(--border);
    color: var(--accent);
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    transition: all 0.12s;
    white-space: nowrap;
  }
  .btn-pdf:hover { background: var(--accent); color: white; border-color: var(--accent); }
  .pi-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }

  @media (max-width: 680px) {
    .top-row { grid-template-columns: 1fr; }
    .main-row { grid-template-columns: 1fr; }
    .bottom-row { grid-template-columns: 1fr; }
  }

  /* Drag & drop dossiers */
  #folder-drop-zone.drop-hover {
    background: var(--teal-light);
    border-color: var(--accent);
    color: var(--accent);
    transform: scale(1.01);
  }
  /* Drop overlay global (quand on glisse sur toute la page) */
  #global-drop-overlay {
    display: none;
    position: fixed; inset: 0; z-index: 9999;
    background: rgba(26,92,138,0.08);
    border: 3px dashed var(--teal);
    pointer-events: none;
  }
  #global-drop-overlay.active { display: flex; align-items: center; justify-content: center; }
  #global-drop-overlay-inner {
    background: var(--surface);
    border-radius: 16px;
    padding: 32px 48px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(26,92,138,0.18);
    pointer-events: none;
  }

  /* Bulle précision dent/mâchoire */
  .acte-detail-badge {
    display:inline-flex; align-items:center; font-size:0.62rem; font-weight:700;
    background:#d1fae5; color:#065f46; border-radius:8px; padding:1px 6px;
    margin-left:3px; cursor:pointer; vertical-align:middle; gap:3px;
  }
  .acte-detail-badge:hover { background:#a7f3d0; }
  #acte-detail-popup {
    position:fixed; z-index:2000; background:var(--surface); border-radius:12px;
    box-shadow:0 8px 28px rgba(0,0,0,0.22); padding:12px 14px; min-width:200px;
    border:1px solid #d0e0ea;
  }
  #acte-detail-popup input[type=text] {
    width:100%; box-sizing:border-box; padding:5px 8px; font-size:0.8rem;
    border:1px solid #c8daf8; border-radius:7px; margin-bottom:8px;
    font-family:'DM Sans',sans-serif;
  }
  .acte-popup-jaw { display:flex; gap:6px; margin-bottom:8px; }
  .acte-popup-jaw button {
    flex:1; padding:4px; border-radius:7px; border:1px solid #c8daf8;
    background:var(--surface); cursor:pointer; font-size:0.75rem; font-weight:600; color:#1a5c8a;
  }
  .acte-popup-jaw button.active { background:#1a5c8a; color:white; border-color:#1a5c8a; }
  .acte-popup-actions { display:flex; gap:6px; }
  .acte-popup-actions button { flex:1; padding:4px 8px; border-radius:7px; border:none; cursor:pointer; font-size:0.72rem; font-weight:600; }
  .acte-popup-ok { background:#1a5c8a; color:white; }
  .acte-popup-clear { background:#fce4ec; color:#c62828; }

  /* Unitaire / Solidaire modal */
  #popup-unit-solid { position:fixed;top:0;left:0;width:100%;height:100%;background:rgba(0,0,0,0.45);z-index:2100;display:flex;justify-content:center;align-items:center; }
  #popup-unit-solid .us-modal { background:var(--surface);border-radius:14px;padding:20px;width:95%;max-width:520px;max-height:90vh;overflow-y:auto;box-shadow:0 8px 32px rgba(0,0,0,0.25); }
  .us-group { border:1px solid #e0eaf5;border-radius:10px;padding:10px 12px;margin-bottom:10px;background:#f8fbff; }
  .us-group-head { display:flex;align-items:center;gap:8px;margin-bottom:8px; }
  .us-group-type { font-size:0.68rem;font-weight:700;padding:2px 8px;border-radius:10px; }
  .us-type-unit { background:#dbeafe;color:#1e40af; }
  .us-type-solid { background:#dcfce7;color:#166534; }
  .us-acte-badge { display:inline-flex;align-items:center;gap:4px;background:#e0f2fe;color:#0369a1;font-size:0.68rem;padding:2px 8px;border-radius:10px;margin:2px; }
  .us-acte-badge .us-rm { cursor:pointer;color:#c62828;font-weight:bold;margin-left:2px; }
  .us-dents-display { font-size:0.72rem;font-weight:700;color:#1a5c8a;margin-top:4px; }

  /* Lasso sélection dents */
  #us-dents-zone { position:relative; }
  #us-lasso-rect {
    position:fixed; border:2px dashed #1a5c8a; background:rgba(26,92,138,0.08);
    border-radius:3px; pointer-events:none; z-index:9999; display:none;
  }

  /* ═══════ IMPLANTS PAGE ═══════ */
  .imp-drop-zone {
    border:2px dashed var(--border); border-radius:12px; padding:32px 20px;
    text-align:center; cursor:pointer; transition:all 0.2s;
    background:#fafbfd; color:var(--muted); font-size:0.82rem;
  }
  .imp-drop-zone:hover, .imp-drop-zone.drag-over {
    border-color:var(--teal); background:var(--teal-light); color:var(--accent);
  }
  .imp-tab-btn {
    background:transparent; border:none; padding:8px 18px; font-size:0.82rem;
    font-weight:600; color:#888; cursor:pointer; border-bottom:2px solid transparent;
    transition:all 0.15s;
  }
  .imp-tab-btn.active { color:var(--accent); border-bottom-color:var(--accent); }
  .imp-tab-btn:hover { color:var(--accent); }
  #imp-order-table {
    width:100%; border-collapse:collapse; font-size:0.75rem;
  }
  #imp-order-table th {
    background:linear-gradient(120deg,#1a5c8a,#5bc4c0); color:white;
    padding:6px 8px; text-align:left; font-size:0.7rem; font-weight:600;
    letter-spacing:0.3px; white-space:nowrap;
  }
  #imp-order-table td {
    padding:5px 8px; border-bottom:1px solid #e8eef2; vertical-align:top;
    word-break:break-word; line-height:1.35;
  }
  #imp-order-table tr.cab-alt { background:#f4f8fb; }
  #imp-order-table tr:hover { background:#edf5fa; }
  .imp-stats { display:flex; gap:16px; flex-wrap:wrap; margin:10px 0; }
  .imp-stat-chip {
    font-size:0.72rem; padding:4px 12px; border-radius:20px;
    font-weight:600; letter-spacing:0.2px;
  }
  /* ── Cartes fournisseurs implants (redesign) ── */
  .imp-fournisseur-card {
    background:var(--surface); border:1px solid var(--border); border-radius:14px;
    padding:18px 16px; display:flex; gap:14px; align-items:flex-start;
    box-shadow:0 2px 8px rgba(0,0,0,0.04); transition:all 0.2s;
    position:relative;
  }
  .imp-fournisseur-card:hover { box-shadow:0 6px 20px rgba(26,92,138,0.12); border-color:var(--teal); }
  .imp-fournisseur-card.archived { opacity:0.45; }
  .imp-fournisseur-logo {
    width:72px; height:72px; border-radius:14px; object-fit:contain;
    background:linear-gradient(135deg,#f8f9fa,#e3f2fd); border:1px solid #e0e8ee; flex-shrink:0;
  }
  .imp-fournisseur-body { flex:1; min-width:0; display:flex; gap:10px; }
  .imp-fournisseur-info { flex:1; min-width:0; }
  .imp-fournisseur-name { font-weight:800; font-size:0.92rem; color:var(--text); letter-spacing:-0.01em; }
  .imp-fournisseur-meta { display:flex; flex-wrap:wrap; gap:6px; margin-top:6px; }
  .imp-fournisseur-tag {
    font-size:0.62rem; font-weight:600; padding:2px 8px; border-radius:20px;
    display:inline-flex; align-items:center; gap:3px; white-space:nowrap;
  }
  .imp-fournisseur-tag.email { background:#f3e5f5; color:#7b1fa2; }
  .imp-fournisseur-tag.stock { background:#e8f5e9; color:#2e7d32; }
  .imp-fournisseur-tag.stock.empty { background:#fff3e0; color:#e65100; }
  .imp-fournisseur-tag.site { background:#e3f2fd; color:#0277bd; cursor:pointer; }
  .imp-fournisseur-tag.site:hover { background:#bbdefb; }
  .imp-fournisseur-notes {
    font-size:0.82rem; font-weight:700; color:var(--text); margin-top:8px;
    line-height:1.35; word-break:break-word;
  }
  .imp-fournisseur-actions {
    display:flex; flex-direction:column; gap:5px; flex-shrink:0;
  }
  .imp-fournisseur-actions button {
    background:var(--surface); border:1px solid #e0e0e0; border-radius:8px;
    width:34px; height:34px; display:flex; align-items:center; justify-content:center;
    font-size:0.82rem; cursor:pointer; color:#666; transition:all 0.15s;
  }
  .imp-fournisseur-actions button:hover { background:var(--accent-light); color:var(--accent); border-color:var(--accent); transform:scale(1.08); }
  .imp-fournisseur-actions button.danger:hover { background:#ffebee; color:#c62828; border-color:#ef9a9a; }

  /* ══ DIGILAB MODULE ══ */
  .dlb-case-row {
    display:flex; align-items:center; justify-content:space-between; gap:10px;
    padding:10px 12px; margin-bottom:6px; border-radius:12px; cursor:pointer;
    border:1px solid transparent; transition:all 0.15s; background:var(--surface);
  }
  .dlb-case-row:hover { border-color:var(--teal); box-shadow:0 2px 10px rgba(91,196,192,0.12); }
  .dlb-case-row.selected { border-color:#00838f; background:#e0f7fa; box-shadow:0 2px 12px rgba(0,131,143,0.15); }

  .dlb-case-main { flex:1; min-width:0; }
  .dlb-case-patient { font-weight:600; font-size:0.82rem; color:var(--text); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  .dlb-case-meta { display:flex; align-items:center; gap:6px; margin-top:4px; flex-wrap:wrap; }
  .dlb-case-date { font-size:0.68rem; color:var(--muted); }
  .dlb-case-comment { font-size:0.7rem; color:var(--muted); margin-top:3px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; font-style:italic; }

  .dlb-badge {
    font-size:0.64rem; font-weight:600; padding:2px 8px; border-radius:10px;
    white-space:nowrap; letter-spacing:0.2px;
  }
  .dlb-service-medit { background:#e8eaf6; color:#1a237e; }
  .dlb-service-threeshape { background:#ffebee; color:#c62828; }
  .dlb-service-dscore { background:#eceff1; color:#546e7a; }
  .dlb-service-shining { background:#e0f7fa; color:#0097a7; }
  .dlb-service-itero { background:#e8f5e9; color:#2e7d32; }
  .dlb-service-other { background:#f5f5f5; color:#777; }

  .dlb-status-nouveau { background:#fff8e1; color:#f57f17; }
  .dlb-status-en_cours { background:#e3f2fd; color:#1565c0; }
  .dlb-status-traite { background:#e8f5e9; color:#2e7d32; }
  .dlb-status-envoye { background:#f3e5f5; color:#7b1fa2; }
  .status-envoye { background:#f3e5f5; color:#7b1fa2; border-radius:6px; padding:2px 8px; font-size:0.72rem; font-weight:600; }

  /* ── Tableau Digilab style I Love Smile ── */
  .dlb-table {
    width:100%; border-collapse:separate; border-spacing:0;
    font-size:0.78rem; font-family:'DM Sans',sans-serif;
  }
  .dlb-table thead th {
    text-align:left; padding:8px 12px; font-size:0.68rem; font-weight:700;
    color:var(--muted); text-transform:uppercase; letter-spacing:0.8px;
    border-bottom:2px solid var(--border); background:#fafbfd; position:sticky; top:0; z-index:1;
  }
  .dlb-table-row {
    cursor:pointer; transition:all 0.12s;
  }
  .dlb-table-row:hover { background:#f0fafa; }
  .dlb-table-row.selected { background:#e0f7fa; }
  .dlb-table-row td { padding:10px 12px; border-bottom:1px solid #f0f0f0; vertical-align:middle; }
  .dlb-td-date { white-space:nowrap; color:var(--muted); font-size:0.74rem; }
  .dlb-td-patient { max-width:200px; }
  .dlb-td-name { font-weight:600; color:var(--text); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  .dlb-td-cabinet { color:var(--muted); font-size:0.74rem; max-width:200px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  .dlb-td-caseid { color:var(--muted); font-size:0.68rem; font-family:'DM Mono',monospace; max-width:none; white-space:nowrap; }
  .dlb-td-actions { white-space:nowrap; }

  .dlb-btn {
    border:none; border-radius:8px; padding:5px 8px; font-size:0.78rem;
    font-weight:600; cursor:pointer; transition:all 0.15s; font-family:'DM Sans',sans-serif;
  }
  .dlb-btn-dl { background:#e0f7fa; color:#00838f; }
  .dlb-btn-dl:hover { background:#b2ebf2; }
  .dlb-btn-scan { background:#f3e5f5; color:#7b1fa2; }
  .dlb-btn-scan:hover { background:#e1bee7; }
  .dlb-btn-view { background:#e8f5e9; color:#2e7d32; text-decoration:none; display:inline-flex; align-items:center; justify-content:center; }
  .dlb-btn-view:hover { background:#c8e6c9; }
  .dlb-btn-del { background:#ffebee; color:#c62828; font-size:0.75rem; }
  .dlb-btn-del:hover { background:#ffcdd2; }
  .dlb-btn-primary { background:var(--accent); color:white; }
  .dlb-btn-primary:hover { background:#155a7a; transform:translateY(-1px); }
  .dlb-btn-accent { background:linear-gradient(120deg,#1a5c8a,#5bc4c0); color:white; }
  .dlb-btn-accent:hover { transform:translateY(-1px); box-shadow:0 4px 12px rgba(26,92,138,0.3); }

  .dlb-detail-header { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:16px; padding-bottom:12px; border-bottom:1px solid #eee; }
  .dlb-detail-grid { display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-bottom:16px; }
  .dlb-detail-field { background:#f8fafb; border-radius:8px; padding:8px 12px; }
  .dlb-detail-field label { display:block; font-size:0.66rem; color:#999; font-weight:600; text-transform:uppercase; letter-spacing:0.5px; margin-bottom:2px; }
  .dlb-detail-field span { font-size:0.82rem; color:var(--text); font-weight:500; }
  .dlb-detail-comment { background:#fffde7; border:1px solid #fff9c4; border-radius:10px; padding:12px; margin-bottom:16px; }
  .dlb-detail-comment label { display:block; font-size:0.66rem; color:#f57f17; font-weight:700; text-transform:uppercase; letter-spacing:0.5px; margin-bottom:6px; }
  .dlb-detail-comment div { font-size:0.82rem; color:var(--text); line-height:1.5; white-space:pre-wrap; }
  .dlb-detail-actions { display:flex; gap:8px; margin-top:16px; flex-wrap:wrap; }

  .dlb-file-list { margin-top:8px; border:1px solid #eee; border-radius:10px; overflow:hidden; }
  .dlb-file-item { display:flex; align-items:center; justify-content:space-between; padding:7px 12px; border-bottom:1px solid #f5f5f5; font-size:0.76rem; }
  .dlb-file-item:last-child { border-bottom:none; }
  .dlb-file-item span:first-child { font-weight:500; color:var(--text); }
