*,*::before,*::after{margin:0;padding:0;box-sizing:border-box;-webkit-tap-highlight-color:transparent}
/* ═══ TOOLTIP ═══ — géré par JS (position:fixed) pour éviter le
   clipping par overflow:hidden sur .main. Le CSS ci-dessous style
   l'élément #_tip créé dynamiquement par _tipInit(). */
#_tip{
  position:fixed;pointer-events:none;z-index:100000;
  background:#1e293b;color:#fff;font-size:11px;font-weight:500;
  padding:6px 11px;border-radius:6px;white-space:normal;max-width:320px;
  font-family:'DM Sans',sans-serif;line-height:1.4;letter-spacing:0;
  box-shadow:0 4px 14px rgba(0,0,0,.3);
  opacity:0;transition:opacity .06s;
}
#_tip.show{opacity:1}

/* Material Symbols base */
.material-symbols-outlined{font-family:'Material Symbols Outlined';font-weight:normal;font-style:normal;font-size:18px;line-height:1;letter-spacing:normal;text-transform:none;display:inline-block;white-space:nowrap;word-wrap:normal;direction:ltr;-webkit-font-smoothing:antialiased;font-variation-settings:'FILL' 0,'wght' 300,'GRAD' 0,'opsz' 24;vertical-align:middle;font-feature-settings:'liga';-webkit-font-feature-settings:'liga';font-rendering-override:'liga'}
.nav-icon .material-symbols-outlined,.spb-icon .material-symbols-outlined{font-size:20px}
.mob-nav-icon .material-symbols-outlined{font-size:22px}
.mmm-icon .material-symbols-outlined{font-size:20px}
.esb .em .material-symbols-outlined{font-size:32px}
.bloc-ico .material-symbols-outlined{font-size:18px}
:root{
  --primary:#147B83;--primary2:#1A9BA6;--primary-f:#E6F4F5;
  --accent:#0C2340;--accent2:#163D64;
  --sidebar:#0C2340;--sidebar-text:#fff;
  --rose:#D4505A;--rose-f:#FDE8EA;--rose-t:#991B1B;
  --amber:#D4930A;--amber-f:#FFF7E0;--amber-t:#92400E;
  --green:#1D8A5E;--green-f:#E3F6ED;--green-t:#14532D;
  --info-f:#EFF6FF;--info-t:#1E40AF;
  --surface-muted:#F3F4F6;
  --border:#DDE4EA;--bg:#F5F7FA;--white:#fff;
  --text:#162638;--muted:#6B8299;
  --r:14px;--rsm:9px;
  --sh:0 4px 24px rgba(12,35,64,.08);--shs:0 2px 10px rgba(12,35,64,.05);
  --sidebar-w:230px;
  --mob-nav-h:64px;
  --mob-safe-b:env(safe-area-inset-bottom, 0px);
  --mob-ease:cubic-bezier(0.4, 0, 0.2, 1);
  --mob-spring:cubic-bezier(0.34, 1.56, 0.64, 1);
  --body-bg:linear-gradient(180deg,#F5F7FA 0%,#EEF1F5 100%);
  --side-card-bg:linear-gradient(135deg,#f6eef1 0%,#ffffff 100%);
  --side-card-border:#d4c3cc;
}

/* ═══ DARK MODE ═══ Override des variables couleurs uniquement.
   Activé via <html class="theme-dark"> (toggle dans la topbar).
   Tous les composants restent inchangés — ils utilisent var(--xxx). */
html.theme-dark{
  --bg:#0F1620;
  --white:#1A2332;
  --text:#E6EDF3;
  --muted:#8AA0B5;
  --border:#2A3441;
  --primary-f:rgba(20,123,131,0.18);
  --rose-f:rgba(212,80,90,0.18);
  --amber-f:rgba(212,147,10,0.18);
  --green-f:rgba(29,138,94,0.18);
  --rose-t:#FCA5A5;
  --amber-t:#FCD34D;
  --green-t:#86EFAC;
  --info-f:rgba(99,102,241,0.18);
  --info-t:#93C5FD;
  --surface-muted:#212B3B;
  --sh:0 4px 24px rgba(0,0,0,.4);
  --shs:0 2px 10px rgba(0,0,0,.3);
  --body-bg:linear-gradient(180deg,#0F1620 0%,#0A0F18 100%);
  --side-card-bg:linear-gradient(135deg,#3a2e32 0%,#1f1a1c 100%);
  --side-card-border:#5a4a52;
}
html.theme-dark body{color-scheme:dark}
html.theme-dark .card,
html.theme-dark .modal{background:var(--white)}
html.theme-dark input.fi,
html.theme-dark select.fi,
html.theme-dark textarea.fi{background:#212B3B;color:var(--text);border-color:var(--border)}
html.theme-dark table thead{background:#212B3B}
html.theme-dark .pill.p-na{background:rgba(255,255,255,0.1);color:var(--muted)}

/* ── Dark: Tables — hardcoded #FAFCFE / #f8fafc ── */
html.theme-dark th{background:#212B3B}
html.theme-dark tr:hover td{background:rgba(255,255,255,0.04)!important}
html.theme-dark .bloc-hd:hover{background:rgba(255,255,255,0.04)}

/* ── Dark: Stat cards — gradient endpoint #FAFCFE ── */
html.theme-dark .stat-card{background:var(--white)}

/* ── Dark: Inputs — select.fi dropdown chevron needs light stroke in dark ── */
/* IMPORTANT : le shorthand background:#212B3B (ligne 82) reset background-image
   ET background-repeat. Il faut re-déclarer repeat+position+size ici, sinon
   la flèche se tile en repeat sur toute la largeur du select. */
html.theme-dark select.fi{
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='none' viewBox='0 0 24 24'%3E%3Cpath stroke='%238AA0B5' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat:no-repeat;background-position:right 10px center;background-size:18px;
}

/* ── Dark: Visit icon variants with hardcoded backgrounds ── */
html.theme-dark .vi-b{background:rgba(99,102,241,0.18)}
html.theme-dark .vi-x{background:rgba(255,255,255,0.08)}

/* ── Dark: Pill .p-na (duplicate guard) + code-chip.used ── */
html.theme-dark .code-chip.used{background:rgba(255,255,255,0.08);color:var(--muted)}

/* ── Dark: Opt-picker card active gradient & label ── */
html.theme-dark .opt-card.opt-active{background:var(--primary-f)}
html.theme-dark .opt-card .opt-card-label{color:var(--text)}
html.theme-dark .opt-card .opt-card-visual.opt-empty{background:var(--surface-muted)}
html.theme-dark .opt-card .opt-card-visual{background:var(--surface-muted)}

/* ── Dark: Emoji scale active states — hardcoded light bgs ── */
html.theme-dark .esb[data-level="1"].on{background:rgba(212,80,90,0.18)}
html.theme-dark .esb[data-level="2"].on{background:rgba(232,139,77,0.18)}
html.theme-dark .esb[data-level="3"].on{background:rgba(212,147,10,0.18)}
html.theme-dark .esb[data-level="4"].on{background:rgba(92,184,138,0.18)}
html.theme-dark .esb[data-level="5"].on{background:rgba(29,138,94,0.18)}

/* ── Dark: Mobile topbar glassmorphism ── */
html.theme-dark .topbar{background:var(--white)}
@media(max-width:768px){
  html.theme-dark .topbar{background:rgba(26,35,50,.88);backdrop-filter:blur(16px) saturate(160%);-webkit-backdrop-filter:blur(16px) saturate(160%);border-bottom-color:rgba(42,52,65,.5)}
}

/* ── Dark: Mobile bottom nav glassmorphism ── */
@media(max-width:768px){
  html.theme-dark .mobile-bottom-nav{background:rgba(26,35,50,.92);border-top-color:rgba(42,52,65,.6)}
}

/* ── Dark: Sticky action bar ── */
html.theme-dark .sticky-action-bar{background:rgba(26,35,50,.95);border-top-color:var(--border)}

/* ── Dark: Spotlight overlay ── */
html.theme-dark .spotlight-overlay{background:rgba(0,0,0,.55)}

/* ── Dark: Skeleton shimmer mid-stop ── */
html.theme-dark .skeleton{background:linear-gradient(90deg,var(--border) 25%,#2A3441 50%,var(--border) 75%);background-size:200% 100%;animation:shimmer 1.5s infinite}

/* ── Dark: Scrollbar ── */
html.theme-dark ::-webkit-scrollbar-thumb{background:rgba(138,160,181,.25)}
html.theme-dark ::-webkit-scrollbar-thumb:hover{background:rgba(138,160,181,.4)}

/* ── Dark: Modal overlay ── */
html.theme-dark .modal-overlay{background:rgba(0,0,0,.65)}

/* ── Dark: Study card gradient headers — text always white so OK,
   but inline gradient from app.js on .opt-card.opt-active needs fix ── */

/* ── Dark: Node-sync-widget & dash-filter-bar — #EEF6FA hardcoded ── */
html.theme-dark #node-sync-widget{background:var(--primary-f)!important}
html.theme-dark #dash-filter-bar{background:var(--primary-f)!important}
html.theme-dark #dash-filter-bar select.fi{background:#212B3B!important;color:var(--text)}
html.theme-dark #dash-filter-bar .btn[style*="background:white"]{background:var(--surface-muted)!important;color:var(--muted)}

/* ── Dark: Focus ring glow — lighter on dark ── */
html.theme-dark .fi:focus{box-shadow:0 0 0 3px rgba(26,155,166,.2)}

/* ── Dark: Dashboard frosted glass dim ── */
html.theme-dark #dashboard-view .stat-card:hover,
html.theme-dark #dashboard-view .card:hover:not(#dash-period-bar):not(#dash-filter-bar){box-shadow:0 24px 60px rgba(0,0,0,.5)}

/* ── Dark: Test banner (#fef3c7) — handled via app.js inline, override ── */
html.theme-dark [style*="background:#fef3c7"]{background:var(--amber-f)!important;border-color:rgba(212,147,10,0.4)!important}
html.theme-dark [style*="background:#FFF3E0"]{background:var(--amber-f)!important}

/* ── Dark: Monospace code blocks (#f9fafb) in app.js ── */
html.theme-dark [style*="background:#f9fafb"]{background:var(--surface-muted)!important}

/* ── Dark: Medical schema buttons (side/approach/plane) — inline #f0f9ff gradient ── */
html.theme-dark [style*="linear-gradient(135deg,#f0f9ff"]{background:var(--primary-f)!important}
html.theme-dark [style*="#f8fafc"]{color:var(--text)}
html.theme-dark [style*="#f1f5f9"]{color:var(--text)}

/* ── Dark: Study select dropdown topbar ── */
/* IMPORTANT : background (shorthand) reset background-repeat/position/size.
   Il faut tout re-déclarer sinon le chevron se tile. */
html.theme-dark .tb-study-select select{background-color:var(--surface-muted);color:var(--text);border-color:var(--border);
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' viewBox='0 0 24 24'%3E%3Cpath stroke='%238AA0B5' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat:no-repeat;background-position:right 6px center;background-size:14px;
}

body{font-family:'Inter','DM Sans',-apple-system,BlinkMacSystemFont,sans-serif;background:var(--body-bg) fixed;color:var(--text);display:flex;height:100vh;height:100dvh;overflow:hidden}

/* ═══ SIDEBAR ═══ */
.sidebar{
  width:var(--sidebar-w);background:var(--sidebar);
  display:flex;flex-direction:column;
  height:100vh;position:sticky;top:0;
  flex-shrink:0;z-index:200;transition:transform .3s;
  overflow-y:auto;
}
.sidebar-logo{padding:20px 18px 14px;border-bottom:1px solid rgba(255,255,255,.1)}
.sidebar-study-name{font-family:'Instrument Serif',serif;font-size:22px;color:#fff;letter-spacing:-.3px}
.sidebar-study-name span{color:var(--primary2)}
.sidebar-subtitle{font-size:11px;color:rgba(255,255,255,.45);margin-top:2px}
.sidebar-profile-badge{margin:10px 12px 0;background:rgba(255,255,255,.1);border-radius:10px;padding:10px 12px;display:flex;align-items:center;gap:10px;cursor:pointer;transition:background .15s}
.sidebar-profile-badge:hover{background:rgba(255,255,255,.15)}
.spb-icon{font-size:20px;flex-shrink:0;display:flex;align-items:center;justify-content:center;width:24px;height:24px;color:rgba(255,255,255,.8)}
.spb-icon svg{width:20px;height:20px}
.spb-info{flex:1}
.spb-name{font-size:13px;font-weight:600;color:#fff}
.spb-role{font-size:11px;color:rgba(255,255,255,.5)}
.spb-change{font-size:11px;color:rgba(255,255,255,.4)}
.sidebar-nav{flex:1;padding:12px 0;overflow-y:auto}
.nav-group-label{font-size:10px;font-weight:700;color:rgba(255,255,255,.3);text-transform:uppercase;letter-spacing:1.2px;padding:14px 18px 6px}
.nav-item{
  display:flex;align-items:center;gap:10px;
  padding:10px 18px;cursor:pointer;transition:all .15s;
  font-size:14px;font-weight:500;color:rgba(255,255,255,.65);
  border-left:3px solid transparent;
}
.nav-item:hover{background:rgba(255,255,255,.08);color:#fff}
.nav-item.active{background:rgba(255,255,255,.12);color:#fff;border-left-color:var(--primary2)}
.nav-icon{font-size:17px;width:22px;text-align:center;flex-shrink:0;display:inline-flex;align-items:center;justify-content:center}
.nav-icon svg{width:18px;height:18px;flex-shrink:0}
.sidebar-bottom{padding:12px;border-top:1px solid rgba(255,255,255,.1)}
.admin-btn{
  display:flex;align-items:center;gap:8px;padding:8px 12px;
  border-radius:var(--rsm);cursor:pointer;transition:all .15s;
  font-size:12px;color:rgba(255,255,255,.35);font-weight:500;
}
.admin-btn:hover{background:rgba(255,255,255,.08);color:rgba(255,255,255,.6)}
.admin-btn.admin-active{color:rgba(255,200,100,.8);background:rgba(255,200,100,.1)}
.study-switch-btn{
  display:flex;align-items:center;gap:8px;padding:8px 12px;
  border-radius:var(--rsm);cursor:pointer;transition:all .15s;
  font-size:12px;color:rgba(255,255,255,.45);font-weight:500;margin-bottom:4px;
}
.study-switch-btn svg,.admin-btn svg{width:16px;height:16px;flex-shrink:0}
.study-switch-btn:hover{background:rgba(255,255,255,.08);color:rgba(255,255,255,.7)}

/* ═══ MAIN ═══ */
.main{flex:1;display:flex;flex-direction:column;height:100vh;overflow-x:hidden;overflow-y:auto}
.topbar{
  height:56px;background:var(--white);border-bottom:1px solid var(--border);
  display:flex;align-items:center;padding:0 24px;
  position:sticky;top:0;z-index:100;gap:12px;flex-shrink:0;
  position:relative;position:sticky;
}
.tb-hamburger{display:none;font-size:20px;cursor:pointer;background:none;border:none;padding:6px}
.tb-back{
  display:flex;align-items:center;gap:6px;font-size:14px;font-weight:600;
  color:var(--muted);cursor:pointer;background:none;border:none;padding:0;
  transition:color .15s;
}
.tb-back:hover{color:var(--text)}
.tb-title{font-size:16px;font-weight:700;color:var(--text);flex:1}
.tb-sub{font-size:12px;color:var(--muted);margin-top:1px}
.lang-select{
  display:flex;align-items:center;
  background:var(--bg);border:1.5px solid var(--border);border-radius:20px;padding:3px;
  position:relative;flex-shrink:0;
}
.lang-btn{
  padding:5px 12px;border-radius:17px;font-size:12px;font-weight:600;
  cursor:pointer;border:none;background:transparent;color:var(--muted);transition:all .2s;
  position:relative;z-index:1;
}
.lang-btn.active{color:var(--green);font-weight:700}
.lang-slider{
  position:absolute;top:3px;height:calc(100% - 6px);
  background:var(--green-f);border-radius:17px;
  transition:left .25s cubic-bezier(.4,0,.2,1),width .25s cubic-bezier(.4,0,.2,1);
  z-index:0;
}
.content{flex:1;padding:28px 32px;max-width:1100px;width:100%;margin:0 auto}

/* ═══ OVERLAY (mobile) ═══ */
.sidebar-overlay{display:none;position:fixed;inset:0;background:rgba(0,0,0,.5);z-index:150}

/* ═══ CARDS ═══ */
.card{background:var(--white);border-radius:var(--r);padding:20px;box-shadow:var(--shs);border:1px solid var(--border)}
.card-title{font-size:15px;font-weight:700;color:var(--text);margin-bottom:14px;display:flex;align-items:center;gap:8px}
.grid2{display:grid;grid-template-columns:1fr 1fr;gap:16px}
.grid3{display:grid;grid-template-columns:1fr 1fr 1fr;gap:14px}
.grid4{display:grid;grid-template-columns:1fr 1fr 1fr 1fr;gap:14px}

/* ═══ STAT CARDS ═══ */
.stat-card{background:linear-gradient(135deg, var(--white) 0%, #FAFCFE 100%);border-radius:var(--r);padding:18px;box-shadow:var(--shs);border:1px solid var(--border)}
.stat-val{font-size:34px;font-weight:800;color:var(--accent);line-height:1;font-family:'Instrument Serif',serif;letter-spacing:-0.5px}
.stat-lbl{font-size:12px;color:var(--muted);font-weight:500;margin-top:4px}
.stat-trend{font-size:11px;font-weight:600;margin-top:4px}
.trend-up{color:var(--green)}
.trend-warn{color:var(--amber)}

/* ═══ TABLE ═══ */
.table-wrap{overflow-x:auto;border-radius:var(--r);border:1px solid var(--border)}
table{width:100%;border-collapse:collapse;background:var(--white)}
th{padding:11px 14px;text-align:left;font-size:11px;font-weight:700;color:var(--muted);text-transform:uppercase;letter-spacing:.8px;border-bottom:1px solid var(--border);background:#FAFCFE;white-space:nowrap}
td{padding:12px 14px;font-size:13px;color:var(--text);border-bottom:1px solid var(--border);vertical-align:middle}
tr:last-child td{border-bottom:none}
tr:hover td{background:#FAFCFE}
.td-code{font-weight:700;color:var(--primary);font-family:monospace;font-size:14px}
.td-actions{display:flex;gap:6px;align-items:center;flex-wrap:wrap}
.btn-xs{padding:4px 10px;border-radius:6px;font-size:11px;font-weight:600;cursor:pointer;border:1.5px solid var(--border);background:var(--white);color:var(--text);transition:all .15s}
.btn-xs:hover{border-color:var(--primary);color:var(--primary)}
.btn-xs.danger:hover{border-color:var(--rose);color:var(--rose)}

/* ═══ PILLS ═══ */
.pill{font-size:11px;font-weight:700;padding:3px 9px;border-radius:20px;white-space:nowrap;display:inline-block}
.p-done{background:var(--green-f);color:var(--green)}
.p-todo{background:var(--primary-f);color:var(--primary)}
.p-prog{background:var(--amber-f);color:var(--amber)}
.p-late{background:var(--rose-f);color:var(--rose)}
.p-na{background:#F0F0F0;color:#999}
.p-sev-m{background:var(--amber-f);color:var(--amber)}
.p-sev-s{background:var(--rose-f);color:var(--rose)}
.p-sev-l{background:var(--green-f);color:var(--green)}

/* ═══ BUTTONS ═══ */
.btn{padding:10px 18px;border-radius:var(--rsm);font-size:14px;font-family:'DM Sans',sans-serif;font-weight:600;cursor:pointer;border:none;transition:all .15s;display:inline-flex;align-items:center;gap:6px}
.btn-primary{background:var(--primary);color:#fff}
.btn-primary:hover{background:var(--primary2)}
.btn-secondary{background:transparent;color:var(--muted);border:2px solid var(--border)}
.btn-secondary:hover{border-color:var(--primary);color:var(--primary)}
.btn-danger{background:transparent;color:var(--rose);border:2px solid var(--rose-f)}
.btn-danger:hover{background:var(--rose-f)}
.btn-sm{padding:7px 13px;font-size:13px}
.btn-full{width:100%;justify-content:center}

/* ═══ FORMS ═══ */
.fg{margin-bottom:20px}
.fg:last-child{margin-bottom:0}
.fl{font-size:13px;font-weight:600;color:var(--text);display:block;margin-bottom:6px;line-height:1.4}
.req{color:var(--rose)}
.fi{width:100%;padding:10px 14px;border:2px solid var(--border);border-radius:var(--rsm);font-size:14px;font-family:'DM Sans',sans-serif;color:var(--text);outline:none;transition:border .15s;background:var(--white)}
.fi:focus{border-color:var(--primary)}
.fi[disabled]{opacity:.6;background:var(--bg)}
/* Anti-zoom iOS sur focus input. Safari iOS zoom AUTO si font-size CSS
   computed < 16px (Apple a retiré le respect de maximum-scale=1 depuis
   iOS 10 pour des raisons d'accessibilité). En mobile (<768px), on
   force 16px sur tous les inputs pour empêcher le zoom au focus password. */
@media(max-width:768px){
  .fi{font-size:16px}
}
/* Garde forte spécifique aux inputs password : iOS zoom même si la règle
   .fi normale est à 14px. Sur tous devices, password = 16px (pas de
   zoom-out après focus du field, particulièrement sur le login étude
   patient avec patient-verify-input). */
input[type="password"]{font-size:16px !important}
select.fi{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='none' viewBox='0 0 24 24'%3E%3Cpath stroke='%237A8FA0' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m6 9 6 6 6-6'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 10px center;background-size:18px;padding-right:36px;appearance:none}
textarea.fi{resize:vertical;min-height:80px}

/* ═══ Form validation — required field errors ═══ */
.field-error>.fi,.field-error input.fi,.field-error select.fi,.field-error textarea.fi,.field-error input.opt-picker-input,.fi.field-error{
  border-color:var(--rose)!important;background:var(--rose-f)!important;
}
.field-error>.fl,.field-error .fl{color:var(--rose)}
.field-error-msg{color:var(--rose);font-size:11px;margin-top:4px;font-weight:600;line-height:1.3;animation:fieldErrFadeIn .2s ease}
@keyframes fieldErrFadeIn{from{opacity:0;transform:translateY(-2px)}to{opacity:1;transform:translateY(0)}}
.form-validation-banner{background:var(--rose-f);color:var(--rose-t);border:1px solid var(--rose);border-radius:var(--rsm);padding:10px 14px;margin-bottom:16px;font-size:13px;font-weight:600;display:flex;align-items:center;gap:8px}

/* ═══ SCALE — color-coded SVG faces ═══ */
.esc-wrap{position:relative;margin-top:4px;margin-bottom:8px}
.esc-gradient{height:4px;border-radius:2px;background:linear-gradient(90deg,#D4505A 0%,#E88B4D 25%,#D4930A 50%,#5CB88A 75%,#1D8A5E 100%);margin:0 8px 8px;opacity:.25}
.esc-wrap:has(.esc[data-reversed="true"]) > .esc-gradient{background:linear-gradient(90deg,#1D8A5E 0%,#5CB88A 25%,#D4930A 50%,#E88B4D 75%,#D4505A 100%)}
.esc{display:flex;gap:6px}
.esb{flex:1;padding:10px 4px 8px;border-radius:12px;border:2px solid transparent;background:var(--bg);cursor:pointer;transition:all .2s ease;display:flex;flex-direction:column;align-items:center;gap:4px;min-height:68px;position:relative}
.esb .em{line-height:1;color:var(--muted);transition:transform .2s,color .2s}
.esb .em svg{width:32px;height:32px}
.esb .lb{font-size:12px;font-weight:700;color:var(--muted);text-align:center;line-height:1.2;letter-spacing:.2px;transition:color .2s}
/* Hover */
.esb:hover:not(.on){background:var(--white);border-color:var(--border);transform:translateY(-2px)}
.esb:hover:not(.on) .em{transform:scale(1.1)}
/* Color-coded active states */
.esb[data-level="1"].on{border-color:#D4505A;background:#FDE8EA;box-shadow:0 3px 12px rgba(212,80,90,.2)}
.esb[data-level="1"].on .em,.esb[data-level="1"].on .lb{color:#D4505A}
.esb[data-level="2"].on{border-color:#E88B4D;background:#FDF0E6;box-shadow:0 3px 12px rgba(232,139,77,.2)}
.esb[data-level="2"].on .em,.esb[data-level="2"].on .lb{color:#E88B4D}
.esb[data-level="3"].on{border-color:#D4930A;background:#FFF7E0;box-shadow:0 3px 12px rgba(212,147,10,.2)}
.esb[data-level="3"].on .em,.esb[data-level="3"].on .lb{color:#D4930A}
.esb[data-level="4"].on{border-color:#5CB88A;background:#E8F7EF;box-shadow:0 3px 12px rgba(92,184,138,.2)}
.esb[data-level="4"].on .em,.esb[data-level="4"].on .lb{color:#5CB88A}
.esb[data-level="5"].on{border-color:#1D8A5E;background:#E3F6ED;box-shadow:0 3px 12px rgba(29,138,94,.2)}
.esb[data-level="5"].on .em,.esb[data-level="5"].on .lb{color:#1D8A5E}
.esb.on .em{transform:scale(1.15)}
/* Fallback */
.esb.on{border-color:var(--primary);background:var(--primary-f)}
.esb.on .lb{color:var(--primary)}

/* Baker row */
.baker-row{display:flex;gap:6px}
.baker-btn{flex:1;padding:10px 6px;border-radius:10px;border:2px solid var(--border);background:var(--white);font-size:14px;font-weight:700;cursor:pointer;transition:all .18s;color:var(--muted);text-align:center}
.baker-btn.on{border-color:var(--primary);background:var(--primary-f);color:var(--primary)}

/* Y/N */
.yn-row{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.yn-btn{padding:11px;border-radius:var(--rsm);border:2px solid var(--border);background:var(--white);font-size:14px;font-weight:600;color:var(--muted);cursor:pointer;transition:all .15s;text-align:center}
.yn-btn.y.on{background:var(--green-f);border-color:var(--green);color:var(--green)}
.yn-btn.n.on{background:var(--rose-f);border-color:var(--rose);color:var(--rose)}

/* ═══ BLOC (collapsible) ═══ */
.bloc{background:var(--white);border-radius:var(--r);margin-bottom:12px;overflow:hidden;box-shadow:var(--shs);border:1px solid var(--border)}
.bloc-hd{padding:14px 16px;display:flex;align-items:center;gap:10px;cursor:pointer;transition:background .15s;user-select:none}
.bloc-hd:hover{background:#FAFCFE}
.bloc-ico{width:36px;height:36px;border-radius:10px;background:var(--primary-f);display:flex;align-items:center;justify-content:center;font-size:17px;flex-shrink:0}
.bloc-title{font-size:14px;font-weight:600;color:var(--text);flex:1}
.bloc-chev{color:var(--muted);font-size:15px;transition:transform .2s;flex-shrink:0}
.bloc-chev.open{transform:rotate(90deg)}
.prog-bar{height:3px;background:var(--border)}
.prog-fill{height:100%;background:var(--primary);border-radius:1.5px;transition:width .3s}
.bloc-body{padding:20px 24px;border-top:1px solid var(--border);display:none}
.bloc-body.open{display:block}

/* ═══ HERO HEADER ═══ */
.screen-hero{background:linear-gradient(135deg,var(--accent),var(--accent2));padding:24px;color:#fff;border-radius:var(--r);margin-bottom:20px}
.screen-hero.patient{background:linear-gradient(135deg,var(--primary),var(--primary2))}
.sh-label{font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:1px;opacity:.6;margin-bottom:4px}
.sh-title{font-size:22px;font-weight:700;margin-bottom:10px}
.sh-badge{display:inline-flex;align-items:center;gap:6px;background:rgba(255,255,255,.18);padding:5px 12px;border-radius:20px;font-size:13px;font-weight:600}

/* ═══ VISIT CARDS ═══ */
.visit-card{background:var(--white);border-radius:var(--r);padding:14px 16px;cursor:pointer;border:2px solid var(--border);transition:all .2s;box-shadow:var(--shs);display:flex;align-items:center;gap:12px;margin-bottom:8px}
.visit-card:hover{border-color:var(--primary);box-shadow:var(--sh)}
.visit-card.disabled{opacity:.55;cursor:default}
.visit-card.disabled:hover{border-color:var(--border);box-shadow:var(--shs)}
.vi{width:40px;height:40px;border-radius:11px;display:flex;align-items:center;justify-content:center;font-size:18px;flex-shrink:0}
.vi-t{background:var(--primary-f)}
.vi-b{background:#E3F2FD}
.vi-g{background:var(--green-f)}
.vi-a{background:var(--amber-f)}
.vi-r{background:var(--rose-f)}
.vi-x{background:#F0F0F0}
.v-info{flex:1}
.v-name{font-size:14px;font-weight:600;color:var(--text);margin-bottom:3px}
.v-win{font-size:12px;color:var(--muted);line-height:1.4}
.v-date{display:block;font-size:11px;color:var(--primary);font-weight:600;margin-top:2px}
.v-date.locked{color:var(--muted);font-weight:500}
.v-date.open{color:var(--green)}
.v-date.late{color:var(--rose)}
.chev{color:var(--border);font-size:16px}

/* ═══ PROGRESS BAR ═══ */
.comp-bar{background:var(--white);border-radius:var(--r);padding:14px 16px;box-shadow:var(--shs);border:1px solid var(--border);margin-bottom:14px}
.comp-row{display:flex;justify-content:space-between;font-size:13px;margin-bottom:7px}
.comp-row span:first-child{font-weight:600}
.comp-row span:last-child{font-weight:700;color:var(--primary)}
.comp-track{height:7px;background:var(--border);border-radius:4px;overflow:hidden}
.comp-fill{height:100%;background:linear-gradient(90deg,var(--primary),var(--primary2));border-radius:4px}

/* ═══ PAGE HEADER ═══ */
.page-header{margin-bottom:24px}
.page-header h1{font-size:22px;font-weight:700;color:var(--text);margin-bottom:4px}
.page-header p{font-size:14px;color:var(--muted)}
.page-actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin-top:12px}

/* ═══ FORM BUILDER ═══ */
.fb-layout{display:flex;gap:20px;align-items:flex-start}
.fb-palette{width:200px;flex-shrink:0}
.fb-canvas{flex:1;min-height:400px}
.fb-props{width:220px;flex-shrink:0}
.palette-item{
  padding:10px 12px;background:var(--white);border:2px solid var(--border);border-radius:var(--rsm);
  margin-bottom:8px;cursor:grab;font-size:13px;font-weight:500;color:var(--text);
  display:flex;align-items:center;gap:8px;transition:all .15s;
}
.palette-item:hover{border-color:var(--primary);background:var(--primary-f)}
.palette-item:active{cursor:grabbing}
.palette-item.dragging{opacity:.4}
.canvas-drop-zone{
  min-height:350px;border:2px dashed var(--border);border-radius:var(--r);
  padding:16px;background:var(--bg);
}
.canvas-drop-zone.drag-over{border-color:var(--primary);background:var(--primary-f)}
.canvas-module{
  background:var(--white);border:2px solid var(--border);border-radius:var(--rsm);
  padding:14px;margin-bottom:10px;display:flex;gap:10px;align-items:flex-start;
  transition:border-color .15s;cursor:move;
}
.canvas-module:hover{border-color:var(--primary2)}
.canvas-module.drag-over-top{border-top:3px solid var(--primary)}
.canvas-module.drag-over-bot{border-bottom:3px solid var(--primary)}
.cm-drag-handle{color:var(--border);cursor:grab;font-size:16px;flex-shrink:0;padding-top:2px;user-select:none}
.cm-body{flex:1}
.cm-type{font-size:10px;font-weight:700;color:var(--muted);text-transform:uppercase;letter-spacing:.8px;margin-bottom:4px}
.cm-label-edit{width:100%;border:1.5px solid var(--border);border-radius:6px;padding:6px 10px;font-size:13px;font-family:'DM Sans',sans-serif;outline:none}
.cm-label-edit:focus{border-color:var(--primary)}
.cm-actions{display:flex;flex-direction:column;gap:4px;flex-shrink:0}
.cm-action-btn{width:26px;height:26px;border-radius:6px;border:1.5px solid var(--border);background:var(--white);display:flex;align-items:center;justify-content:center;font-size:13px;cursor:pointer;transition:all .15s}
.cm-action-btn:hover{border-color:var(--rose);color:var(--rose)}
.canvas-empty{text-align:center;padding:50px 20px;color:var(--muted);font-size:14px}
.canvas-empty .ce-icon{font-size:40px;margin-bottom:10px;opacity:.4}

/* ═══ PROFILE CARDS (home screen) ═══ */
.profile-card{
  background:var(--white);border-radius:var(--r);padding:20px;cursor:pointer;
  border:2px solid var(--border);text-align:center;transition:all .2s;
  box-shadow:var(--shs);
}
.profile-card:hover{border-color:var(--primary);box-shadow:var(--sh)}
.profile-card:active{transform:scale(.97)}
.pc-icon{font-size:34px;margin-bottom:10px}
.pc-name{font-size:16px;font-weight:700;color:var(--text);margin-bottom:5px}
.pc-desc{font-size:12px;color:var(--muted);line-height:1.4}
.pc-badge{margin-top:10px;display:inline-block;font-size:11px;font-weight:700;padding:4px 10px;border-radius:14px}

/* ═══ STUDY CARDS ═══ */
.study-card{background:var(--white);border-radius:var(--r);overflow:hidden;box-shadow:var(--sh);border:2px solid var(--border);transition:all .2s;cursor:pointer}
.study-card:hover{border-color:var(--primary);transform:translateY(-2px);box-shadow:0 8px 30px rgba(15,43,70,.13)}
.study-card-header{padding:20px;color:#fff}
.sc-study-name{font-family:'Instrument Serif',serif;font-size:22px;margin-bottom:4px}
.sc-study-sub{font-size:12px;opacity:.7}
.study-card-body{padding:16px}
.sc-meta{font-size:12px;color:var(--muted);display:flex;align-items:center;gap:6px;margin-bottom:8px}
.sc-langs{display:flex;gap:4px;margin-top:10px}
.sc-lang-tag{padding:3px 8px;border-radius:12px;font-size:11px;font-weight:600;background:var(--primary-f);color:var(--primary)}

/* ═══ DOCTORS TABLE ═══ */
.doc-card{background:var(--white);border-radius:var(--r);padding:16px;border:1px solid var(--border);display:flex;align-items:center;gap:14px;margin-bottom:10px;transition:all .15s}
.doc-card:hover{border-color:var(--primary);box-shadow:var(--shs)}
.doc-avatar{width:44px;height:44px;border-radius:50%;background:var(--accent);display:flex;align-items:center;justify-content:center;color:#fff;font-size:15px;font-weight:700;flex-shrink:0}
.doc-info{flex:1}
.doc-name{font-size:15px;font-weight:600;color:var(--text)}
.doc-meta{font-size:12px;color:var(--muted);margin-top:2px}
.doc-actions{display:flex;gap:6px}

/* ═══ ALERT ═══ */
.alert{border-radius:var(--r);padding:14px 16px;margin-bottom:16px;display:flex;align-items:flex-start;gap:12px;font-size:13px}
.alert-warn{background:var(--amber-f);border:1px solid rgba(196,132,10,.2);color:var(--amber)}
.alert-danger{background:var(--rose-f);border:1px solid rgba(192,102,106,.2);color:var(--rose)}
.alert-info{background:var(--primary-f);border:1px solid rgba(26,107,114,.15);color:var(--primary)}
.alert-success{background:var(--green-f);border:1px solid rgba(45,122,90,.15);color:var(--green)}

/* ═══ MODAL ═══ */
.modal-overlay{display:none;position:fixed;inset:0;background:rgba(0,0,0,.55);z-index:500;align-items:center;justify-content:center;padding:20px}
.modal-overlay.open{display:flex}
.modal{background:var(--white);border-radius:var(--r);padding:28px;width:100%;max-width:440px;box-shadow:0 20px 60px rgba(0,0,0,.3)}
.modal-title{font-size:18px;font-weight:700;color:var(--text);margin-bottom:6px}
.modal-sub{font-size:13px;color:var(--muted);margin-bottom:20px}
.modal-actions{display:flex;gap:8px;margin-top:20px;justify-content:flex-end}

/* ═══ CODE GENERATOR ═══ */
.code-gen-result{background:var(--bg);border-radius:var(--r);padding:16px;margin-top:14px}
.code-chip{display:inline-block;background:var(--primary-f);color:var(--primary);font-weight:700;font-size:13px;padding:5px 11px;border-radius:8px;margin:3px;font-family:monospace;letter-spacing:1px}
.code-chip.used{background:#F0F0F0;color:#aaa;text-decoration:line-through}

/* ═══ UNLOCK PANEL ═══ */
.unlock-card{background:var(--rose-f);border:2px solid rgba(192,102,106,.3);border-radius:var(--r);padding:20px}
.unlock-icon{font-size:36px;text-align:center;margin-bottom:12px}
.unlock-title{font-size:16px;font-weight:700;color:var(--rose);text-align:center;margin-bottom:6px}
.unlock-sub{font-size:13px;color:var(--rose);opacity:.8;text-align:center;margin-bottom:16px;line-height:1.5}

/* ═══ AE ROWS ═══ */
.ae-row{display:flex;align-items:flex-start;gap:12px;padding:14px 0;border-bottom:1px solid var(--border)}
.ae-row:last-child{border-bottom:none}
.ae-dot{width:10px;height:10px;border-radius:50%;margin-top:4px;flex-shrink:0}
.ae-body{flex:1}
.ae-name{font-size:14px;font-weight:600;color:var(--text)}
.ae-meta{font-size:12px;color:var(--muted);margin-top:3px}
.ae-detail{font-size:12px;color:var(--text);margin-top:5px;padding:8px 10px;background:var(--bg);border-radius:8px;line-height:1.5}
.ae-actions{display:flex;flex-direction:column;gap:4px;align-items:flex-end;flex-shrink:0}

/* ═══ PHOTO AREA ═══ */
.photo-area{border:2px dashed var(--border);border-radius:var(--rsm);padding:20px;text-align:center;cursor:pointer;transition:all .15s}
.photo-area:hover{border-color:var(--primary);background:var(--primary-f)}
.photo-area-dragover{border-color:var(--primary)!important;background:var(--primary-f)!important;box-shadow:0 0 0 4px rgba(47,122,207,.15) inset;transform:scale(1.01)}
.photo-grid{display:grid;grid-template-columns:1fr 1fr 1fr;gap:6px;margin-bottom:10px}
.photo-th{aspect-ratio:1;background:var(--border);border-radius:8px;display:flex;align-items:center;justify-content:center;font-size:22px}

/* ═══ PATIENT LIST ═══ */
.patient-item{background:var(--white);border:1.5px solid var(--border);border-radius:var(--rsm);padding:14px 16px;margin-bottom:8px;display:flex;align-items:center;gap:12px;cursor:pointer;transition:all .15s}
.patient-item:hover{border-color:var(--primary);box-shadow:var(--shs)}
.patient-code{font-family:monospace;font-size:16px;font-weight:700;color:var(--primary);flex-shrink:0}
.patient-info{flex:1}
.patient-name{font-size:14px;font-weight:600;color:var(--text)}
.patient-sub{font-size:12px;color:var(--muted);margin-top:2px}
.patient-visits{display:flex;gap:4px;flex-shrink:0;align-items:center}
.pv-dot{width:8px;height:8px;border-radius:50%}

/* ═══ TAB BAR ═══ */
.tab-bar{display:flex;border-bottom:2px solid var(--border);margin-bottom:20px}
.tab-btn{padding:10px 16px;font-size:14px;font-weight:600;color:var(--muted);cursor:pointer;border:none;background:none;border-bottom:2.5px solid transparent;margin-bottom:-2px;transition:all .15s}
.tab-btn.active{color:var(--primary);border-bottom-color:var(--primary)}
.tab-pane{display:none}
.tab-pane.active{display:block}

/* ═══ DONE BANNER ═══ */
.done-banner{background:var(--green-f);border-radius:var(--r);padding:12px 16px;display:flex;align-items:center;gap:10px;margin-bottom:14px}
.done-banner span:last-child{font-size:13px;font-weight:600;color:var(--green)}

/* ═══ EXIT SCREEN ═══ */
.exit-section{background:var(--white);border-radius:var(--r);padding:24px;border:1px solid var(--border);box-shadow:var(--shs)}
.exit-warn{background:var(--rose-f);border-radius:var(--r);padding:16px;text-align:center;margin-bottom:20px}
.exit-warn h3{color:var(--rose);font-size:16px;margin-bottom:6px}
.exit-warn p{font-size:13px;color:var(--rose);opacity:.8}

/* ═══ GLOBAL TOUCH ═══ */
button,a,.visit-card,.patient-item,.bloc-hd,.esb,.baker-btn,.yn-btn,.photo-area,.study-card,.nav-item,.tab-btn{
  -webkit-tap-highlight-color:transparent;touch-action:manipulation;
}

/* ═══ LEAFLET MAP Z-INDEX FIX ═══ */
#centers-map{position:relative;z-index:1}
#centers-map .leaflet-pane{z-index:1}
#centers-map .leaflet-top,#centers-map .leaflet-bottom{z-index:2}

/* ═══ RESPONSIVE ═══ */
@media(max-width:900px){
  .grid4{grid-template-columns:1fr 1fr}
  .grid3{grid-template-columns:1fr 1fr}
  .fb-layout{flex-direction:column}
  .fb-palette,.fb-props{width:100%}
  .stat-val{font-size:26px}
  .stat-card{padding:14px}
}

/* ═══ MOBILE (≤ 768px) ═══ */
@media(max-width:768px){

  /* ── Anti scroll horizontal global ── */
  html,body{overflow-x:hidden;max-width:100vw}

  /* ── Layout ── */
  .sidebar{position:fixed;top:0;left:0;height:100vh;height:100dvh;transform:translateX(-100%);transition:transform .3s var(--mob-ease);overflow-y:auto;z-index:400}
  .sidebar.open{transform:translateX(0)}
  .sidebar-overlay{transition:opacity .3s}
  .sidebar-overlay.open{display:block}
  .main{width:100%;height:100vh;height:100dvh;padding-bottom:calc(var(--mob-nav-h) + var(--mob-safe-b))}
  .content{padding:20px 16px 24px;animation:slideUp .25s var(--mob-ease)}
  .tb-hamburger{display:flex;align-items:center;justify-content:center;width:44px;height:44px;font-size:22px;border-radius:10px}
  .tb-hamburger:active{background:var(--bg)}
  .grid2{grid-template-columns:1fr}
  .grid3{grid-template-columns:1fr}
  .grid4{grid-template-columns:1fr 1fr}
  .fb-layout{flex-direction:column}
  .fb-palette,.fb-props,.fb-canvas{width:100%}
  .fb-props{display:none}
  .fb-props-modal{display:block!important;position:fixed;bottom:0;left:0;right:0;z-index:510;
    background:var(--white);border-radius:20px 20px 0 0;padding:20px 16px calc(20px + var(--mob-safe-b));
    max-height:70vh;overflow-y:auto;box-shadow:0 -4px 30px rgba(15,43,70,.15);
    animation:bottomSheetUp .3s var(--mob-ease)}
  .fb-props-modal::before{content:'';display:block;width:36px;height:4px;border-radius:2px;
    background:var(--border);margin:0 auto 16px}

  /* ── Topbar — glassmorphism ── */
  .topbar{
    padding:0 14px;height:54px;position:sticky;top:0;z-index:100;
    background:rgba(255,255,255,.88);
    backdrop-filter:blur(16px) saturate(160%);-webkit-backdrop-filter:blur(16px) saturate(160%);
    border-bottom:1px solid rgba(220,230,236,.5);
  }
  .tb-title{font-size:17px;font-weight:800;letter-spacing:-.2px}
  .tb-back{font-size:14px;min-height:44px;padding:0 8px;border-radius:8px}
  .tb-back:active{background:var(--bg)}
  .lang-select{padding:4px 6px;border-radius:16px}
  .lang-btn{padding:5px 8px;font-size:11px;min-height:32px;min-width:32px;border-radius:12px}

  /* ── Buttons — touch-friendly ── */
  .btn{padding:14px 20px;font-size:15px;min-height:50px;border-radius:12px}
  .btn:active{transform:scale(.96);opacity:.85}
  .btn-full{padding:16px 20px;font-size:16px;min-height:54px;border-radius:14px;font-weight:700}
  .btn-sm{padding:12px 16px;font-size:14px;min-height:46px}
  .btn-xs{padding:8px 14px;font-size:12px;min-height:40px;border-radius:8px}
  .btn-xs:active{transform:scale(.95)}

  /* ── Forms — 16px prevents iOS zoom ── */
  .fi{padding:14px 16px;font-size:16px;min-height:50px;border-radius:12px;border-width:1.5px}
  .fi:focus{border-color:var(--primary);box-shadow:0 0 0 4px rgba(26,107,114,.1)}
  select.fi{padding-right:40px}
  textarea.fi{min-height:100px}
  .fl{font-size:14px;font-weight:700;margin-bottom:8px}
  .fg{margin-bottom:20px}

  /* ── Emoji scale ── */
  .esc{gap:5px}
  .esb{padding:12px 4px 8px;border-radius:14px;min-height:72px;border-width:2px}
  .esb:active{transform:scale(.93);transition-duration:.05s}
  .esb .em svg{width:34px;height:34px}
  .esb .lb{font-size:10px;margin-top:2px}

  /* ── Baker / Yes-No ── */
  .baker-btn{padding:14px 10px;font-size:17px;min-height:52px;border-radius:12px}
  .baker-btn:active{transform:scale(.95);transition-duration:.05s}
  .yn-btn{padding:15px;font-size:16px;min-height:52px;border-radius:12px}
  .yn-btn:active{transform:scale(.95);transition-duration:.05s}

  /* ── Visit cards — primary touch target ── */
  .visit-card{padding:18px 16px;gap:14px;border-radius:16px;min-height:72px;border-width:1.5px}
  .visit-card:active:not(.disabled){transform:scale(.98);transition-duration:.05s}
  .visit-card:hover:not(.disabled){transform:none;border-color:var(--border)}
  .vi{width:50px;height:50px;font-size:22px;border-radius:14px}
  .v-name{font-size:16px;font-weight:700;margin-bottom:3px}
  .v-win{font-size:12px}
  .chev{font-size:18px;color:var(--muted);transition:transform .2s}

  /* ── Blocs (questionnaire sections) ── */
  .bloc{border-radius:16px;margin-bottom:16px;border-width:1px}
  .bloc-hd{padding:18px 16px;gap:14px;min-height:64px}
  .bloc-hd:active{background:var(--bg);transition-duration:.05s}
  .bloc-ico{width:46px;height:46px;font-size:20px;border-radius:13px}
  .bloc-title{font-size:15px;font-weight:700}
  .bloc-body{padding:20px 16px}

  /* ── Form fields inside blocs — more breathing room ── */
  .bloc-body .fg{margin-bottom:52px}
  .bloc-body .fl{font-size:15px;margin-bottom:10px;line-height:1.5}
  .bloc-body .esc{gap:6px;margin-bottom:6px}
  .bloc-body .esb{padding:14px 4px 10px;min-height:78px}
  .bloc-body .esb .em svg{width:38px;height:38px}
  .bloc-body .esb .lb{font-size:13px}
  .bloc-body .yn-row{gap:10px}
  .bloc-body .yn-btn{padding:16px;font-size:17px;min-height:56px}
  .bloc-body .baker-row{gap:8px}
  .bloc-body .baker-btn{padding:16px 10px;font-size:18px;min-height:56px}
  .bloc-body .fi{font-size:16px;min-height:52px}
  .bloc-body textarea.fi{min-height:110px}

  /* ── Cards ── */
  .card{padding:18px;border-radius:16px;margin-bottom:14px;border-width:1px}
  .card:hover{box-shadow:var(--shs);transform:none}
  .card-title{font-size:16px;margin-bottom:14px}

  /* ── Stat cards — horizontal scroll ── */
  .stat-card{padding:14px;border-radius:14px}
  .stat-card:hover{transform:none}
  .stat-val{font-size:24px}
  .stat-lbl{font-size:11px;letter-spacing:.3px}

  /* ── Hero — prevent overflow ── */
  .screen-hero{padding:18px 16px;border-radius:16px;margin-bottom:16px;overflow:hidden;word-break:break-word}
  .sh-label{font-size:10px;letter-spacing:1.5px}
  .sh-title{font-size:18px;margin-bottom:6px;line-height:1.3;overflow-wrap:break-word}
  .sh-badge{font-size:12px;padding:5px 12px;border-radius:18px;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

  /* ── Page header ── */
  .page-header{margin-bottom:20px}
  .page-header h1{font-size:21px;font-weight:800;letter-spacing:-.3px}
  .page-header p{font-size:13px}
  .page-actions{flex-direction:column;gap:10px}
  .page-actions .btn{width:100%;justify-content:center}
  .page-actions .fi{width:100%!important}

  /* ── Patient list ── */
  .patient-item{padding:16px;border-radius:14px;gap:14px;min-height:64px}
  .patient-item:hover{transform:none}
  .patient-item:active{transform:scale(.98);transition-duration:.05s}
  .patient-code{font-size:16px}
  .patient-name{font-size:15px}
  .patient-sub{font-size:12px}

  /* ── Progress ── */
  .comp-bar{padding:16px 18px;border-radius:14px}
  .comp-row{font-size:14px;margin-bottom:8px}
  .comp-track{height:6px;border-radius:3px}

  /* ── Tabs — scrollable ── */
  .tab-bar{overflow-x:auto;-webkit-overflow-scrolling:touch;flex-wrap:nowrap;gap:0;margin-bottom:18px;border-bottom-width:1.5px}
  .tab-btn{white-space:nowrap;flex:0 0 auto;padding:13px 16px;font-size:13px;min-height:46px}

  /* ── Pills ── */
  .pill{font-size:11px;padding:4px 10px;font-weight:800}

  /* ── Done banner ── */
  .done-banner{padding:14px 16px;border-radius:14px}

  /* ── Photo area ── */
  .photo-area{padding:24px 16px;border-radius:14px}
  .photo-grid{grid-template-columns:1fr 1fr;gap:8px}

  /* ── Alerts ── */
  .alert{font-size:13px;padding:14px 16px;border-radius:14px}

  /* ── AE rows ── */
  .ae-row{padding:16px 0;gap:12px}
  .ae-name{font-size:15px}
  .ae-meta{font-size:12px}

  /* ── Study cards ── */
  .study-card{border-radius:16px}
  .study-card:active{transform:scale(.98);transition-duration:.05s}
  .study-card-header{padding:20px 18px}
  .sc-study-name{font-size:22px}
  .study-card-body{padding:16px}

  /* ── Profile cards — horizontal layout ── */
  .profile-card{
    padding:20px;border-radius:16px;min-height:auto;
    display:flex;align-items:center;gap:16px;text-align:left;
    border-left:4px solid var(--primary);
  }
  .profile-card:active{transform:scale(.97);transition-duration:.05s}
  .pc-icon{font-size:34px;margin-bottom:0;flex-shrink:0}
  .pc-name{font-size:17px;margin-bottom:3px}
  .pc-desc{font-size:12px}
  .pc-badge{margin-top:6px;font-size:11px}

  /* ── Doctor cards — vertical layout on mobile ── */
  .doc-card{padding:14px;border-radius:14px;flex-direction:column;align-items:stretch;gap:10px}
  .doc-card:hover{transform:none}
  .doc-card:active{transform:scale(.98);transition-duration:.05s}
  .doc-avatar{width:40px;height:40px;font-size:13px;position:absolute}
  .doc-card{position:relative;padding-left:62px}
  .doc-avatar{top:14px;left:14px}
  .doc-info{min-width:0}
  .doc-name{font-size:14px;font-weight:700}
  .doc-meta{font-size:11px;line-height:1.5;word-break:break-word}
  .doc-actions{flex-wrap:wrap;gap:6px;margin-top:4px}

  /* ── Exit screen ── */
  .exit-section{padding:20px;border-radius:16px}
  .exit-warn{padding:18px;border-radius:14px}

  /* ── Unlock ── */
  .unlock-icon{font-size:42px}
  .unlock-title{font-size:18px}

  /* ── Modal → Bottom sheet ── */
  .modal-overlay{
    background:rgba(15,43,70,.25);
    backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px);
    align-items:flex-end;padding:0;
  }
  .modal{
    max-width:100%;border-radius:20px 20px 0 0;
    padding:12px 20px calc(20px + var(--mob-safe-b));
    max-height:88vh;overflow-y:auto;
    animation:bottomSheetUp .3s var(--mob-ease);
  }
  .modal::before{
    content:'';display:block;width:36px;height:4px;border-radius:2px;
    background:var(--border);margin:4px auto 16px;flex-shrink:0;
  }
  .modal-title{font-size:18px}
  .modal-sub{font-size:13px}
  .modal-actions{flex-direction:column;gap:10px;margin-top:24px}
  .modal-actions .btn{width:100%;justify-content:center;min-height:50px}

  /* ── Code chips ── */
  .code-chip{font-size:13px;padding:7px 12px}

  /* ── Tables ── */
  .table-wrap{margin:0 -16px;border-radius:0;border-left:none;border-right:none}
  .table-wrap table{min-width:max-content}
  .table-wrap td{font-size:12px}
  .table-wrap td.td-actions{max-width:none;overflow:visible}

  /* ── Sidebar nav ── */
  .sidebar-nav{overflow-y:auto;-webkit-overflow-scrolling:touch}

  /* ── Form builder ── */
  .canvas-drop-zone{min-height:200px;padding:12px;border-radius:14px}
  .canvas-module{padding:12px;gap:8px;border-radius:10px}

  /* ── Touch feedback on all interactives ── */
  .visit-card:active:not(.disabled),
  .patient-item:active,
  .bloc-hd:active,
  .study-card:active,
  .doc-card:active,
  .profile-card:active{
    transition-duration:.05s;
    background:var(--bg);
  }

  /* ── Staggered children animation ── */
  .content .visit-card:nth-child(1){animation-delay:.03s}
  .content .visit-card:nth-child(2){animation-delay:.06s}
  .content .visit-card:nth-child(3){animation-delay:.09s}
  .content .visit-card:nth-child(4){animation-delay:.12s}
  .content .visit-card:nth-child(5){animation-delay:.15s}
  .content .bloc:nth-child(1){animation-delay:.03s}
  .content .bloc:nth-child(2){animation-delay:.06s}
  .content .bloc:nth-child(3){animation-delay:.09s}
  .content .stat-card{animation:slideUp .3s var(--mob-ease) both}
}

/* ═══ EXTRA SMALL (≤ 480px) ═══ */
@media(max-width:480px){
  .content{padding:16px 12px 20px}
  .grid4{grid-template-columns:1fr}
  .grid2{grid-template-columns:1fr}

  .esc{flex-wrap:wrap;gap:6px}
  .esb{min-width:calc(50% - 4px);flex:1 0 calc(50% - 4px)}
  .baker-row{flex-wrap:wrap;gap:6px}
  .baker-btn{min-width:calc(50% - 4px);flex:1 0 calc(50% - 4px)}

  .screen-hero{padding:18px 14px;border-radius:14px}
  .sh-title{font-size:18px}
  .visit-card{padding:14px;min-height:66px}
  .vi{width:44px;height:44px}
  .btn-sm{width:100%;justify-content:center}
  .stat-val{font-size:22px}

  .table-wrap td{font-size:11px;padding:8px 10px}
  .table-wrap th{font-size:10px;padding:8px 10px}

  .topbar{height:48px;padding:0 10px}
  .tb-title{font-size:15px}
  .lang-btn{padding:3px 6px;font-size:10px}

  .modal{padding:12px 16px calc(16px + var(--mob-safe-b))}
}

/* ═══ MOBILE SELECT OPTIONS ═══ */
.mob-sel-opt{
  display:flex;align-items:center;gap:14px;padding:16px 18px;
  border-radius:14px;border:1.5px solid var(--border);background:var(--white);
  cursor:pointer;transition:all .15s;font-size:17px;font-weight:500;color:var(--text);
  -webkit-tap-highlight-color:transparent;min-height:56px;
}
.mob-sel-opt:active{transform:scale(.97);transition-duration:.05s}
.mob-sel-opt.selected{border-color:var(--primary);background:var(--primary-f);color:var(--primary);font-weight:700}
.mob-sel-opt .mob-sel-check{
  width:28px;height:28px;border-radius:50%;border:2px solid var(--border);
  display:flex;align-items:center;justify-content:center;flex-shrink:0;
  font-size:14px;color:transparent;transition:all .15s;
}
.mob-sel-opt.selected .mob-sel-check{border-color:var(--primary);background:var(--primary);color:#fff}

/* ═══ TOAST ═══ */
/* WYSIWYG editor */
[contenteditable]:focus{outline:none}
[contenteditable] h2{font-size:18px;margin:0 0 8px}
[contenteditable] p{margin:0 0 8px}
[contenteditable] ul,[contenteditable] ol{margin:0 0 8px;padding-left:20px}
[contenteditable] a{color:var(--primary);text-decoration:underline}

#toast{
  position:fixed;top:20px;left:50%;transform:translateX(-50%) translateY(-20px);
  background:var(--accent);color:#fff;padding:14px 24px;border-radius:14px;
  font-size:14px;font-weight:600;opacity:0;transition:all .35s var(--mob-ease);
  pointer-events:none;z-index:999;box-shadow:0 8px 30px rgba(15,43,70,.2);
  max-width:90vw;text-align:center;line-height:1.4;
}
#toast.show{opacity:1;transform:translateX(-50%) translateY(0);pointer-events:auto}
#toast.error{background:#991b1b}
#toast.warn{background:#92400e}
@media(max-width:768px){
  #toast{top:auto;bottom:calc(var(--mob-nav-h) + var(--mob-safe-b) + 12px);
    left:16px;right:16px;transform:translateX(0) translateY(20px);
    padding:14px 20px;font-size:14px;
    background:rgba(15,43,70,.94);
    backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);
  }
  #toast.show{transform:translateX(0) translateY(0);pointer-events:auto}
  #toast.error{background:rgba(153,27,27,.94)}
  #toast.warn{background:rgba(146,64,14,.94)}
}

/* ═══ TRANSITIONS & ANIMATIONS ═══ */

/* Keyframes */
@keyframes fadeIn { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:translateY(0)} }
@keyframes slideUp { from{opacity:0;transform:translateY(24px)} to{opacity:1;transform:translateY(0)} }
@keyframes slideInRight { from{opacity:0;transform:translateX(30px)} to{opacity:1;transform:translateX(0)} }
@keyframes slideInLeft { from{opacity:0;transform:translateX(-30px)} to{opacity:1;transform:translateX(0)} }
@keyframes scaleIn { from{opacity:0;transform:scale(.95)} to{opacity:1;transform:scale(1)} }
@keyframes swipeHint { 0%,100%{transform:translateX(0)} 30%{transform:translateX(-18px)} 60%{transform:translateX(14px)} }
@keyframes shimmer { 0%{background-position:-200% 0} 100%{background-position:200% 0} }
@keyframes spin { from{transform:rotate(0deg)} to{transform:rotate(360deg)} }
@keyframes pulseRing { 0%{box-shadow:0 0 0 0 rgba(26,107,114,.3)} 70%{box-shadow:0 0 0 8px rgba(26,107,114,0)} 100%{box-shadow:0 0 0 0 rgba(26,107,114,0)} }
@keyframes bottomSheetUp { from{transform:translateY(100%)} to{transform:translateY(0)} }
/* Stage timeline : halo pulsant pour indiquer l'étape active */
@keyframes dsStagePulse { 0%{box-shadow:0 0 0 0 color-mix(in srgb, var(--brand-teal-500) 40%, transparent)} 70%{box-shadow:0 0 0 10px color-mix(in srgb, var(--brand-teal-500) 0%, transparent)} 100%{box-shadow:0 0 0 0 color-mix(in srgb, var(--brand-teal-500) 0%, transparent)} }
@keyframes dsStagePulseDanger { 0%{box-shadow:0 0 0 0 color-mix(in srgb, var(--danger-500) 45%, transparent)} 70%{box-shadow:0 0 0 10px color-mix(in srgb, var(--danger-500) 0%, transparent)} 100%{box-shadow:0 0 0 0 color-mix(in srgb, var(--danger-500) 0%, transparent)} }
.ds-stage-pulse { animation: dsStagePulse 1.8s ease-out infinite; }
.ds-stage-pulse-danger { animation: dsStagePulseDanger 1.6s ease-out infinite; }
/* Intro "attention" : halo XXL + fort scale pour attirer l'œil 3s */
@keyframes dsStagePulseAttn {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--brand-teal-500) 90%, transparent), 0 0 0 0 color-mix(in srgb, var(--brand-teal-500) 40%, transparent); transform: scale(1); }
  40%  { box-shadow: 0 0 0 34px color-mix(in srgb, var(--brand-teal-500) 0%, transparent), 0 0 20px 10px color-mix(in srgb, var(--brand-teal-500) 30%, transparent); transform: scale(1.45); }
  100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--brand-teal-500) 0%, transparent), 0 0 0 0 color-mix(in srgb, var(--brand-teal-500) 0%, transparent); transform: scale(1); }
}
@keyframes dsStagePulseAttnDanger {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--danger-500) 90%, transparent), 0 0 0 0 color-mix(in srgb, var(--danger-500) 50%, transparent); transform: scale(1); }
  40%  { box-shadow: 0 0 0 34px color-mix(in srgb, var(--danger-500) 0%, transparent), 0 0 22px 12px color-mix(in srgb, var(--danger-500) 35%, transparent); transform: scale(1.5); }
  100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--danger-500) 0%, transparent), 0 0 0 0 color-mix(in srgb, var(--danger-500) 0%, transparent); transform: scale(1); }
}
/* Combo : 3s "attention" (3 itérations fortes) puis pulse subtle infini */
.ds-stage-pulse-attn { animation: dsStagePulseAttn 1s ease-out 3, dsStagePulse 1.8s ease-out 3s infinite; transform-origin: center; }
.ds-stage-pulse-attn.ds-stage-pulse-danger { animation: dsStagePulseAttnDanger 1s ease-out 3, dsStagePulseDanger 1.6s ease-out 3s infinite; transform-origin: center; }

/* Page transitions */
.content{animation:fadeIn .2s ease-out}
.content.page-forward{animation:slideInRight .25s var(--mob-ease)}
.content.page-back{animation:slideInLeft .25s var(--mob-ease)}

/* Desktop hover effects */
.card{transition:box-shadow .3s,transform .3s,filter .3s,opacity .3s;position:relative;z-index:1}
.card:hover{box-shadow:0 6px 24px rgba(12,35,64,.12)}
.visit-card{transition:all .2s ease}
.visit-card:hover:not(.disabled){transform:translateX(4px);border-color:var(--primary)}
.btn{transition:all .15s ease}
.btn:active{transform:scale(.97)}
.nav-item{transition:all .15s ease}
.pill{transition:all .2s}
.stat-card{transition:all .3s ease;position:relative;z-index:1}
.stat-card:hover{box-shadow:0 6px 24px rgba(12,35,64,.12)}
.bloc-body{transition:max-height .3s ease,padding .3s ease,opacity .2s;overflow:hidden}
.patient-item{transition:all .15s ease}
.patient-item:hover{transform:translateX(4px)}
.doc-card{transition:all .15s ease}
.doc-card:hover{transform:translateX(3px)}
.canvas-module,.form-in-stage{transition:all .15s ease}
.canvas-module:hover,.form-in-stage:hover{box-shadow:0 2px 8px rgba(0,0,0,.08)}

/* Table responsive */
.table-wrap{overflow-x:auto;-webkit-overflow-scrolling:touch}
.table-wrap table{min-width:max-content}
.table-wrap th{white-space:nowrap}
.table-wrap td{max-width:300px;overflow:hidden;text-overflow:ellipsis}
.table-wrap td.td-actions{max-width:none;overflow:visible;white-space:nowrap}

/* Toast */
#toast{transition:all .3s var(--mob-spring)}
#toast.show{transform:translateY(-10px)}

/* Modal desktop */
.modal-overlay{transition:opacity .2s;opacity:0}
.modal-overlay.open{opacity:1}
.modal{transition:transform .25s cubic-bezier(.68,-.2,.265,1.2);transform:scale(.9) translateY(20px)}
.modal-overlay.open .modal{transform:scale(1) translateY(0)}

/* Scrolling & focus */
html{scroll-behavior:smooth}
.fi:focus{box-shadow:0 0 0 3px rgba(26,107,114,.15)}
.btn:focus-visible{box-shadow:0 0 0 3px rgba(26,107,114,.3);outline:none}

/* Skeleton loading */
.skeleton{background:linear-gradient(90deg,var(--border) 25%,#e8eef3 50%,var(--border) 75%);background-size:200% 100%;animation:shimmer 1.5s infinite;border-radius:var(--rsm)}
.skeleton-card{height:80px;margin-bottom:12px;border-radius:var(--r)}
.skeleton-text{height:14px;margin-bottom:8px;width:60%;border-radius:4px}
.skeleton-text.full{width:100%}

/* ═══ MOBILE BOTTOM NAV ═══ */
.mobile-bottom-nav{
  display:none;position:fixed;bottom:0;left:0;right:0;z-index:300;
  height:calc(var(--mob-nav-h) + var(--mob-safe-b));
  padding-bottom:var(--mob-safe-b);
  background:rgba(255,255,255,.92);
  backdrop-filter:blur(20px) saturate(180%);-webkit-backdrop-filter:blur(20px) saturate(180%);
  border-top:1px solid rgba(220,230,236,.6);
  box-shadow:0 -2px 16px rgba(15,43,70,.06);
}
.mobile-bottom-nav.visible{display:flex;justify-content:space-around;align-items:stretch}
.mob-nav-item{
  display:flex;flex-direction:column;align-items:center;justify-content:center;
  flex:1;gap:3px;padding:8px 4px;cursor:pointer;
  color:var(--muted);font-size:10px;font-weight:600;
  transition:color .15s,transform .15s;position:relative;
  -webkit-tap-highlight-color:transparent;
}
.mob-nav-item:active{transform:scale(.9)}
.mob-nav-item.active{color:var(--primary)}
.mob-nav-item.active::after{
  content:'';position:absolute;top:4px;left:50%;transform:translateX(-50%);
  width:5px;height:5px;border-radius:50%;background:var(--primary);
  animation:scaleIn .2s var(--mob-spring);
}
.mob-nav-icon{font-size:22px;line-height:1;transition:transform .2s var(--mob-spring);display:flex;align-items:center;justify-content:center;height:24px}
.mob-nav-icon svg{width:22px;height:22px}
.mob-nav-item.active .mob-nav-icon{transform:scale(1.15)}
.mob-nav-label{letter-spacing:.3px;white-space:nowrap}

/* ═══ UI POLISH — Animations & Micro-interactions ═══ */

/* Scroll-triggered animations — elements start hidden, appear on scroll */
.scroll-reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.scroll-reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Recruitment curve animation */
.recruit-line {
  stroke-dasharray: var(--line-len, 2000);
  stroke-dashoffset: var(--line-len, 2000);
  transition: stroke-dashoffset 2s cubic-bezier(0.4, 0, 0.2, 1);
}
.recruit-line.animate {
  stroke-dashoffset: 0;
}
.recruit-area {
  opacity: 0;
  transition: opacity 1s ease 0.8s;
}
.recruit-area.animate {
  opacity: 1;
}
.recruit-dot {
  opacity: 0;
  transform-origin: center;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.recruit-dot.animate {
  opacity: 1;
}

/* Smooth card entrance */
.card, .stat-card, .bloc, .doc-card, .visit-card, .patient-item, .study-card {
  animation: cardFadeIn 0.3s ease-out both;
}
@keyframes cardFadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Staggered children */
.card:nth-child(1) { animation-delay: 0s; }
.card:nth-child(2) { animation-delay: 0.05s; }
.card:nth-child(3) { animation-delay: 0.1s; }
.card:nth-child(4) { animation-delay: 0.15s; }
.card:nth-child(5) { animation-delay: 0.2s; }

/* Smooth number counter effect for stat values */
.stat-val {
  transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Button press effect — more satisfying */
.btn { transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); }
.btn:active { transform: scale(0.95); box-shadow: inset 0 2px 4px rgba(0,0,0,.1); }
.btn-primary { box-shadow: 0 2px 10px rgba(20,123,131,.28); }
.btn-primary:hover { box-shadow: 0 4px 18px rgba(20,123,131,.38); transform: translateY(-1px); }

/* Pill animations */
.pill { transition: all 0.2s ease; }
.p-done { animation: pillPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes pillPop {
  0% { transform: scale(0.8); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* Alert animations */
.alert { animation: alertSlide 0.3s ease-out; }
@keyframes alertSlide {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Done banner celebration */
.done-banner {
  animation: doneBannerIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes doneBannerIn {
  0% { transform: scale(0.9); opacity: 0; }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); opacity: 1; }
}

/* Smooth accordion */
.bloc-body {
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease, padding 0.3s ease;
}

/* Hero gradient animation */
.screen-hero {
  background-size: 200% 200%;
  animation: heroGradient 8s ease infinite;
}
@keyframes heroGradient {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Progress bar animation */
.comp-fill, .prog-fill {
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Modal backdrop blur enhancement */
.modal-overlay {
  transition: opacity 0.25s ease, backdrop-filter 0.3s ease;
}
.modal-overlay.open {
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* Nav item active indicator — animated */
.nav-item.active {
  border-left-color: var(--primary2);
  transition: all 0.2s ease;
  position: relative;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--primary2);
  border-radius: 0 3px 3px 0;
  animation: navIndicator 0.2s ease-out;
}
@keyframes navIndicator {
  from { height: 0; }
  to { height: 60%; }
}

/* Table row hover — subtle highlight */
tr { transition: background 0.15s ease; }
tr:hover td { background: #f8fafc !important; }

/* Input focus glow */
.fi:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,107,114,.12);
  transition: all 0.2s ease;
}

/* Emoji scale button — bounce on select */
.esb.on {
  animation: emojiSelect 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes emojiSelect {
  0% { transform: scale(0.85); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

/* Baker/YN button — smooth select */
.baker-btn.on, .yn-btn.y.on, .yn-btn.n.on {
  animation: btnSelect 0.2s ease-out;
}
@keyframes btnSelect {
  0% { transform: scale(0.95); }
  100% { transform: scale(1); }
}

/* Photo thumbnail hover */
.photo-grid div, [onclick*="openPhotoModal"] {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.photo-grid div:hover, [onclick*="openPhotoModal"]:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
}

/* Scrollbar styling */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(122,143,160,.3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(122,143,160,.5); }

/* Better focus ring for accessibility */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Smooth page content transitions */
.content {
  animation: contentFadeIn 0.25s ease-out;
}
@keyframes contentFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Loading skeleton pulse */
.skeleton {
  background: linear-gradient(90deg, var(--border) 25%, #e8eef3 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite linear;
  border-radius: var(--rsm);
}

/* Sidebar smooth transitions */
.sidebar-nav {
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.15) transparent;
}

/* Nav group toggle arrow */
.nav-group-label span:first-child {
  transition: transform 0.2s ease;
  display: inline-block;
}

/* Badge/pill subtle shadow */
.pill {
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

/* Card subtle border glow on hover */
.card:hover {
  border-color: rgba(26,107,114,.15);
}

/* Visit card — better disabled state */
.visit-card.disabled {
  opacity: 0.5;
  filter: grayscale(20%);
}

/* Mobile bottom nav — frosted glass enhancement */
@media(max-width:768px) {
  .mobile-bottom-nav.visible {
    box-shadow: 0 -4px 20px rgba(15,43,70,.08);
  }

  /* Smoother page transitions on mobile */
  .content.page-forward { animation: slideInRight 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
  .content.page-back { animation: slideInLeft 0.3s cubic-bezier(0.4, 0, 0.2, 1); }

  /* Better touch feedback */
  .visit-card:active:not(.disabled),
  .patient-item:active,
  .doc-card:active,
  .profile-card:active,
  .study-card:active {
    transform: scale(0.97);
    transition: transform 0.05s;
  }
}

/* ═══ FORM SECTION IMPROVEMENTS ═══ */
/* Better bloc separation */
.bloc {
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(15,43,70,.04);
  overflow: hidden;
}
.bloc + .bloc {
  margin-top: 16px;
}
.bloc-hd {
  border-bottom: 1px solid transparent;
}
.bloc-body.open + .bloc-hd,
.bloc-hd:has(+ .bloc-body.open) {
  border-bottom: 1px solid var(--border);
}

/* Remove the progress bar under bloc headers that causes confusion */
.prog-bar {
  display: none;
}

/* Better section titles in forms */
.bloc-title {
  font-size: 15px;
  letter-spacing: -0.2px;
}

/* Form field groups — label close to its content, big gap between questions */
.bloc-body .fg {
  padding-bottom: 28px;
  margin-bottom: 52px;
  border-bottom: 1px solid rgba(220,230,236,.4);
}
.bloc-body .fg:last-child {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
}
.bloc-body .fl {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 6px;
  line-height: 1.4;
}

/* ═══ DASHBOARD ANIMATIONS ═══ */
/* Animated counter */
.stat-val {
  font-variant-numeric: tabular-nums;
}
.stat-val.counting {
  transition: none;
}

/* Animated progress bars */
.comp-fill, .prog-fill {
  transition: width 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Chart animation */
.dashboard-chart {
  animation: chartFadeIn 0.6s ease-out both;
}
@keyframes chartFadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

/* Stat card entrance with counter */
.stat-card {
  animation: statCardIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.stat-card:nth-child(1) { animation-delay: 0.05s; }
.stat-card:nth-child(2) { animation-delay: 0.15s; }
.stat-card:nth-child(3) { animation-delay: 0.25s; }
.stat-card:nth-child(4) { animation-delay: 0.35s; }
@keyframes statCardIn {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Dashboard bar animations */
.dash-bar {
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: inherit;
}
.dash-donut {
  transition: stroke-dasharray 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* SVG pie chart animation */
svg circle {
  transition: stroke-dasharray 1s cubic-bezier(0.4, 0, 0.2, 1), stroke-dashoffset 1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ═══ DASHBOARD HOVER — FROSTED GLASS (dashboard only) ═══ */
#dashboard-view:has(.card:hover) .card:not(:hover):not(#dash-period-bar),
#dashboard-view:has(.card:hover) .stat-card:not(:hover),
#dashboard-view:has(.card:hover) .alert:not(:hover),
#dashboard-view:has(.card:hover) .scroll-reveal:not(:hover),
#dashboard-view:has(.stat-card:hover) .card:not(:hover):not(#dash-period-bar),
#dashboard-view:has(.stat-card:hover) .stat-card:not(:hover),
#dashboard-view:has(.stat-card:hover) .alert:not(:hover),
#dashboard-view:has(.stat-card:hover) .scroll-reveal:not(:hover) {
  filter: blur(2.5px);
  opacity: 0.5;
  transform: scale(0.9);
  transition: all 0.3s ease;
}
#dashboard-view .stat-card:hover { transform: translateY(-10px) scale(1.10); box-shadow: 0 24px 60px rgba(12,35,64,.25); z-index: 10; }
#dashboard-view .card:hover:not(#dash-period-bar):not(#dash-filter-bar) { transform: translateY(-10px) scale(1.10); box-shadow: 0 24px 60px rgba(12,35,64,.25); z-index: 10; }
@media(max-width:768px) {
  #dashboard-view .stat-card:hover, #dashboard-view .card:hover { transform: none; box-shadow: var(--shs); }
  #dashboard-view:has(.card:hover) .card:not(:hover),
  #dashboard-view:has(.card:hover) .stat-card:not(:hover),
  #dashboard-view:has(.card:hover) .alert:not(:hover),
  #dashboard-view:has(.stat-card:hover) .card:not(:hover),
  #dashboard-view:has(.stat-card:hover) .stat-card:not(:hover),
  #dashboard-view:has(.stat-card:hover) .alert:not(:hover) {
    filter: none; opacity: 1; transform: none;
  }
}

/* ═══ STAGE TIMELINE ═══ */
.stage-timeline {
  position: relative;
  padding-left: 40px;
  margin-bottom: 30px;
}

.stl-stage {
  position: relative;
  margin-bottom: 0;
}

.stl-node {
  position: absolute;
  left: -40px;
  top: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #fff;
  z-index: 2;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}

.stl-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px;
  margin-bottom: 0;
  box-shadow: var(--shs);
  transition: all .2s;
}
.stl-card:hover {
  box-shadow: var(--sh);
  border-color: var(--primary);
}

.stl-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.stl-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.stl-forms {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.stl-form {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg);
  border-radius: var(--rsm);
  font-size: 13px;
  transition: background .15s;
}
.stl-form:hover {
  background: var(--primary-f);
}
.stl-form-icon {
  font-size: 16px;
  flex-shrink: 0;
}
.stl-form-name {
  font-weight: 600;
  flex: 1;
}
.stl-form-type {
  font-size: 10px;
}
.stl-form-fields {
  font-size: 11px;
  color: var(--muted);
}

/* Connector between stages */
.stl-connector {
  position: relative;
  padding: 8px 0 8px 40px;
  min-height: 40px;
}

/* Vertical line running through timeline */
.stl-stage::before,
.stl-connector::before {
  content: '';
  position: absolute;
  left: -24px;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--border);
}
.stl-stage:last-child::before {
  display: none;
}

.stl-delay {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--amber-f);
  color: var(--amber);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid rgba(212,147,10,.2);
}

.stl-dependency {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary-f);
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid rgba(20,123,131,.2);
}

@media(max-width:768px) {
  .stage-timeline {
    padding-left: 32px;
  }
  .stl-node {
    left: -32px;
    width: 26px;
    height: 26px;
    font-size: 12px;
  }
  .stl-stage::before,
  .stl-connector::before {
    left: -19px;
  }
  .stl-card {
    padding: 12px;
  }
  .stl-header {
    flex-wrap: wrap;
    gap: 6px;
  }
  .stl-title {
    font-size: 14px;
  }
  .stl-form {
    flex-wrap: wrap;
    padding: 6px 8px;
    font-size: 12px;
  }
  .stl-connector {
    padding-left: 32px;
  }
}

/* ═══ MOBILE RESPONSIVE FIXES ═══ */
@media(max-width:768px) {

  /* Pipeline timeline — stack vertically */
  .stage-timeline {
    padding-left: 28px;
  }
  .stl-card {
    padding: 10px;
  }
  .stl-forms {
    gap: 4px;
  }
  .stl-form {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 8px 10px;
  }
  .stl-form-name {
    font-size: 13px;
  }
  .stl-form-fields {
    font-size: 10px;
  }

  /* Compliance cards — prevent tab overflow */
  .tab-bar {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .tab-bar::-webkit-scrollbar {
    display: none;
  }
  .tab-btn {
    white-space: nowrap;
    flex: 0 0 auto;
  }

  /* Backup page — encryption section, scope selectors */
  #backup-encryption-container {
    overflow-x: hidden;
  }
  #backup-encryption-container > div {
    flex-direction: column !important;
  }
  #backup-encryption-container input.fi {
    min-width: 0 !important;
    width: 100% !important;
  }
  input[name="backup-scope"] + label,
  [name="backup-scope"] {
    font-size: 12px;
  }
  #backup-scope-details {
    max-height: 180px;
    overflow-y: auto;
  }

  /* Dashboard filters bar — wrap on mobile */
  #dash-filter-bar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
  }
  #dash-filter-bar select.fi,
  #dash-filter-bar .fi {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
  }

  /* Modal tabs — scrollable on mobile (study edit with 3 tabs) */
  .modal .tab-bar {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    gap: 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .modal .tab-bar::-webkit-scrollbar {
    display: none;
  }
  .modal .tab-bar .tab-btn {
    white-space: nowrap;
    flex: 0 0 auto;
    padding: 10px 14px;
    font-size: 12px;
  }

  /* Conformité globale — continent regulation cards stack */
  [style*="display:flex"][style*="flex-direction:column"][style*="gap:6px"] > div {
    flex-direction: column !important;
    align-items: stretch !important;
  }
  [style*="display:flex"][style*="flex-direction:column"][style*="gap:6px"] > div > div[style*="min-width:130px"] {
    min-width: auto !important;
  }
  [style*="display:flex"][style*="flex-direction:column"][style*="gap:6px"] > div > div[style*="flex-wrap:wrap"] {
    gap: 4px;
  }

  /* DSR table/cards — readable on mobile */
  .table-wrap {
    margin-left: -16px;
    margin-right: -16px;
    border-radius: 0;
  }
  .table-wrap table {
    min-width: max-content;
  }
  .table-wrap th,
  .table-wrap td {
    font-size: 12px;
    padding: 8px 10px;
  }
}

/* ═══ TOPBAR — BREADCRUMBS ═══ */
.tb-breadcrumb{display:flex;align-items:center;gap:6px;font-size:13px;color:var(--muted);flex-shrink:0}
.tb-breadcrumb a{color:var(--muted);text-decoration:none;font-weight:500;transition:color .15s}
.tb-breadcrumb a:hover{color:var(--primary)}
.tb-breadcrumb .tb-crumb-sep{font-size:11px;color:var(--border)}
.tb-breadcrumb .tb-crumb-current{color:var(--text);font-weight:600}

/* ═══ TOPBAR — SEARCH ICON ═══ */
.tb-search-icon{
  width:34px;height:34px;display:flex;align-items:center;justify-content:center;
  border-radius:50%;cursor:pointer;transition:background .15s;color:var(--muted);flex-shrink:0;
}
.tb-search-icon:hover{background:var(--bg);color:var(--text)}
.tb-search-icon svg{width:18px;height:18px}

/* ═══ TOPBAR — UNLOCK TIMER ═══ */
.tb-unlock-timer{
  display:none;align-items:center;gap:6px;
  background:var(--rose-f);color:var(--rose);
  padding:4px 12px;border-radius:20px;font-size:12px;font-weight:700;
  cursor:pointer;flex-shrink:0;transition:background .15s;
  border:1.5px solid rgba(212,80,90,.2);
}
.tb-unlock-timer:hover{background:var(--rose);color:#fff}
.tb-unlock-timer .material-symbols-outlined{font-size:16px}

/* ═══ TOPBAR — SIDE INDICATOR ═══ */
.tb-side{display:none;align-items:center;flex-shrink:0;margin-right:4px}
.tb-side .side-badge{background:var(--bg)!important;border:1px solid var(--border)!important}
@media(max-width:768px){
  .tb-side .side-badge{padding:2px 8px 2px 4px!important;font-size:11px!important}
  .tb-side .side-badge svg{width:22px!important;height:24px!important}
}

/* ═══ PICKER VISUEL (option picker générique) ═══ */
.opt-picker-grid{display:flex;flex-wrap:wrap;gap:8px;margin-top:4px}
.opt-picker-filter{margin-top:4px;margin-bottom:6px;font-size:13px}
.opt-card{
  padding:10px;background:var(--white);border:2px solid var(--border);
  border-radius:12px;cursor:pointer;transition:transform .15s, box-shadow .15s, border-color .15s, background .15s;
  display:flex;flex-direction:column;align-items:center;gap:6px;position:relative;min-width:100px;
}
.opt-card:hover{transform:translateY(-2px);box-shadow:0 4px 12px rgba(0,0,0,.08)}
.opt-card.opt-active{
  border-color:var(--primary);
  background:linear-gradient(135deg,#f0f9ff 0%,#ffffff 100%);
}
.opt-card .opt-card-label{font-size:12px;font-weight:600;color:#334155;text-align:center;line-height:1.3;max-width:100%}
.opt-card.opt-active .opt-card-label{color:var(--primary)}
.opt-card .opt-card-visual{
  width:80px;height:80px;display:flex;align-items:center;justify-content:center;
  border-radius:8px;overflow:hidden;flex-shrink:0;background:#fafafa;
}
.opt-card .opt-card-visual.opt-empty{background:var(--bg);color:var(--muted);font-size:28px}
.opt-card .opt-card-check{
  position:absolute;top:6px;right:6px;width:18px;height:18px;border-radius:50%;
  background:var(--primary);color:#fff;display:flex;align-items:center;justify-content:center;
  font-size:10px;font-weight:700;
}

/* ═══ TOPBAR — STUDY SELECTOR ═══ */
.tb-study-select{flex-shrink:0}
.tb-study-select select{
  background:var(--bg);border:1.5px solid var(--border);border-radius:8px;
  padding:5px 28px 5px 10px;font-size:12px;font-weight:600;color:var(--text);
  font-family:'DM Sans',sans-serif;cursor:pointer;outline:none;transition:border-color .15s;
  appearance:none;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' viewBox='0 0 24 24'%3E%3Cpath stroke='%237A8FA0' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat:no-repeat;background-position:right 6px center;background-size:14px;
}
.tb-study-select select:focus{border-color:var(--primary)}

/* ═══ STUDY SELECTOR MODAL ═══ */
.study-sel-item{
  display:flex;align-items:center;gap:12px;padding:12px 14px;border-radius:10px;
  cursor:pointer;transition:background .1s;margin-bottom:4px;
}
.study-sel-item:hover{background:var(--bg)}
.study-sel-item.active{background:var(--primary-f);border:1.5px solid rgba(20,123,131,.15)}
.study-sel-icon{width:40px;height:40px;border-radius:10px;display:flex;align-items:center;justify-content:center;color:#fff;flex-shrink:0}
.study-sel-icon .material-symbols-outlined{font-size:20px}
.study-sel-info{flex:1;min-width:0}
.study-sel-name{font-size:14px;font-weight:700;color:var(--text)}
.study-sel-sub{font-size:11px;color:var(--muted);margin-top:2px}

/* ═══ SPOTLIGHT SEARCH OVERLAY ═══ */
.spotlight-overlay{
  display:none;position:fixed;inset:0;z-index:600;
  background:rgba(15,43,70,.4);
  backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px);
  align-items:flex-start;justify-content:center;padding-top:min(20vh,160px);
}
.spotlight-overlay.open{display:flex}
.spotlight-box{
  width:100%;max-width:520px;background:var(--white);border-radius:16px;
  box-shadow:0 20px 60px rgba(15,43,70,.25);overflow:hidden;
  animation:spotlightIn .2s ease-out;
}
@keyframes spotlightIn{from{opacity:0;transform:scale(.95) translateY(-10px)}to{opacity:1;transform:scale(1) translateY(0)}}
.spotlight-input-wrap{
  display:flex;align-items:center;gap:12px;padding:16px 20px;
  border-bottom:1px solid var(--border);
}
.spotlight-input-wrap svg{width:20px;height:20px;color:var(--muted);flex-shrink:0}
.spotlight-input-wrap input{
  flex:1;border:none;background:transparent;outline:none;
  font-size:16px;font-family:'DM Sans',sans-serif;color:var(--text);
}
.spotlight-input-wrap input::placeholder{color:var(--muted)}
.spotlight-input-wrap kbd{
  font-size:11px;font-weight:600;color:var(--muted);background:var(--bg);
  border:1px solid var(--border);border-radius:4px;padding:2px 6px;cursor:pointer;
  font-family:'DM Sans',sans-serif;
}
.spotlight-results{max-height:340px;overflow-y:auto;padding:6px}
.spotlight-results:empty{display:none}
.spotlight-result{
  display:flex;align-items:center;gap:12px;padding:10px 14px;border-radius:10px;
  cursor:pointer;transition:background .1s;font-size:14px;color:var(--text);
}
.spotlight-result:hover,.spotlight-result.active{background:var(--primary-f)}
.spotlight-result .sr-icon{color:var(--muted);flex-shrink:0;width:20px;display:flex;align-items:center;justify-content:center}
.spotlight-result .sr-icon svg{width:18px;height:18px}
.spotlight-result .sr-label{font-weight:500;flex:1}
.spotlight-result .sr-hint{font-size:11px;color:var(--muted);flex-shrink:0;margin-left:8px;max-width:140px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.spotlight-group-label{padding:8px 14px 4px;font-size:10px;font-weight:700;color:var(--muted);text-transform:uppercase;letter-spacing:.8px}
.spotlight-more{padding:4px 14px 8px;font-size:11px;color:var(--primary);font-weight:600;cursor:pointer;transition:color .1s}
.spotlight-more:hover{color:var(--accent)}
.spotlight-hint{padding:10px 14px;font-size:12px;color:var(--muted);text-align:center}

@media(max-width:768px){
  .spotlight-box{max-width:calc(100% - 24px);margin:0 12px}
  .spotlight-input-wrap{padding:14px 16px}
  .spotlight-input-wrap input{font-size:16px}
}

/* ═══ TOPBAR — RIGHT ACTIONS CONTAINER ═══ */
.tb-right-actions{
  display:flex;align-items:center;gap:4px;flex-shrink:0;
}
/* Vertical separators between visible icon groups */
.tb-right-actions>[data-tb-slot].tb-sep{
  border-left:1px solid var(--border);margin-left:4px;padding-left:4px;
}
/* Drag & drop feedback */
.tb-right-actions>[data-tb-slot][draggable="true"]{cursor:grab}
.topbar [data-tb-slot][draggable="true"]{cursor:grab}
.topbar [data-tb-slot].tb-dragging{opacity:.4;cursor:grabbing}
.topbar [data-tb-slot].tb-drag-over{box-shadow:inset 2px 0 0 var(--primary)}

/* ═══ TOPBAR — USER PROFILE ═══ */
.tb-user{display:flex;align-items:center;gap:8px;padding:4px 8px;border-radius:10px;cursor:pointer;transition:background .15s;flex-shrink:0}
.tb-user:hover{background:var(--bg)}
.tb-user-avatar{width:32px;height:32px;border-radius:50%;background:var(--accent);display:flex;align-items:center;justify-content:center;color:#fff;font-size:12px;font-weight:700;flex-shrink:0}
.tb-user-name{font-size:13px;font-weight:600;color:var(--text);white-space:nowrap}

/* ═══ TOPBAR — NOTIFICATIONS ═══ */
.tb-notif{width:34px;height:34px;display:flex;align-items:center;justify-content:center;border-radius:50%;cursor:pointer;transition:background .15s;position:relative;color:var(--muted);flex-shrink:0}
.tb-notif:hover{background:var(--bg)}
.tb-notif svg{width:18px;height:18px}
.tb-notif-badge{position:absolute;top:-4px;right:-4px;min-width:16px;height:16px;padding:0 3px;border-radius:10px;background:var(--rose);border:2px solid var(--white);color:#fff;font-size:10px;font-weight:700;line-height:16px;display:flex;align-items:center;justify-content:center;box-sizing:content-box;text-align:center;pointer-events:none}
.tb-notif-panel{
  position:absolute;top:calc(100% + 4px);right:0;width:340px;
  background:var(--white);border:1px solid var(--border);border-radius:var(--r);
  box-shadow:0 8px 30px rgba(15,43,70,.15);z-index:250;overflow:hidden;
}
.tb-notif-panel-header{padding:14px 16px;font-size:14px;font-weight:700;color:var(--text);border-bottom:1px solid var(--border)}
.tb-notif-panel-body{max-height:350px;overflow-y:auto}
.tb-notif-item{padding:12px 16px;border-bottom:1px solid var(--border);cursor:pointer;transition:background .1s;display:flex;gap:10px;align-items:flex-start}
.tb-notif-item:hover{background:var(--bg)}
.tb-notif-item:last-child{border-bottom:none}
.tb-notif-dot{width:8px;height:8px;border-radius:50%;margin-top:5px;flex-shrink:0}
.tb-notif-content{flex:1}
.tb-notif-title{font-size:13px;font-weight:600;color:var(--text)}
.tb-notif-desc{font-size:12px;color:var(--muted);margin-top:2px}
.tb-notif-time{font-size:10px;color:var(--muted);margin-top:4px}
.tb-notif-empty{padding:30px 16px;text-align:center;color:var(--muted);font-size:13px}

/* ═══ ACTIONS DROPDOWN (patient row) ═══ */
.btn-actions-wrap{position:relative;display:inline-flex}
.btn-actions-menu{
  display:none;position:absolute;top:calc(100% + 4px);right:0;z-index:50;
  background:var(--white);border:1px solid var(--border);border-radius:var(--rsm);
  box-shadow:0 6px 20px rgba(15,43,70,.12);min-width:180px;padding:4px;
}
.btn-actions-menu.open{display:block}
/* Typeform face cards (questionnaire patient) — scale up the Material icon
   inside the circle pour matcher le design hand-off. */
.tf-face-icon .material-symbols-outlined{
  font-size:38px;
  font-variation-settings:"FILL" 0,"wght" 280,"GRAD" 0,"opsz" 40;
}
.tf-face-card:hover{transform:translateY(-2px);box-shadow:0 6px 18px rgba(15,107,112,0.12)}
/* Quand un menu Actions est ouvert dans une .card, on hisse cette card
   au-dessus des sibling cards (qui ont aussi z-index:1) pour que le menu
   débordant en bas ne soit pas masqué par la card du dessous. */
.card:has(.btn-actions-menu.open),
.study-card:has(.btn-actions-menu.open){
  z-index:100;
}
.btn-actions-item{
  display:flex;align-items:center;gap:8px;padding:8px 12px;border-radius:6px;
  cursor:pointer;font-size:12px;font-weight:500;color:var(--text);transition:background .1s;
  white-space:nowrap;
}
.btn-actions-item:hover{background:var(--bg)}
.btn-actions-item .material-symbols-outlined{font-size:16px;color:var(--muted)}
.btn-actions-danger{color:var(--rose)}
.btn-actions-danger:hover{background:var(--rose-f)}
.btn-actions-danger .material-symbols-outlined{color:var(--rose)}

/* ═══ MODAL VISUAL EDIT ═══ */
.mt-editable{outline:2px dashed var(--primary);outline-offset:2px;border-radius:4px;padding:2px 4px;min-width:40px;display:inline-block;cursor:text}
.mt-editable:focus{outline-color:var(--green);background:rgba(29,138,94,.05)}

/* ═══ REFERENCE DATA INLINE EDIT BUTTON ═══ */
.ref-edit-btn{
  display:inline-flex;align-items:center;justify-content:center;
  width:22px;height:22px;border-radius:6px;cursor:pointer;
  color:var(--muted);transition:all .15s;
}
.ref-edit-btn:hover{background:var(--primary-f);color:var(--primary)}
.ref-edit-btn .material-symbols-outlined{font-size:14px}

/* ═══ MODAL PAGE BUILDER ═══ */
.mb-palette-item{
  display:flex;align-items:center;gap:8px;padding:8px 10px;border-radius:8px;
  cursor:grab;font-size:12px;font-weight:500;color:var(--text);
  transition:background .1s;margin-bottom:2px;
}
.mb-palette-item:hover{background:var(--white);box-shadow:var(--shs)}
.mb-palette-item:active{cursor:grabbing}
.mb-canvas-item{
  position:relative;border:2px solid transparent;border-radius:8px;
  padding:4px;margin-bottom:4px;cursor:pointer;transition:border-color .15s;
}
.mb-canvas-item:hover{border-color:var(--border)}
.mb-canvas-item.selected{border-color:var(--primary);background:rgba(20,123,131,.03)}
.mb-item-actions{
  position:absolute;top:2px;right:2px;display:none;gap:2px;
}
.mb-canvas-item:hover .mb-item-actions,.mb-canvas-item.selected .mb-item-actions{display:flex}
.mb-item-drag,.mb-item-del{
  width:22px;height:22px;display:flex;align-items:center;justify-content:center;
  border-radius:4px;cursor:pointer;font-size:14px;transition:background .1s;
}
.mb-item-drag{color:var(--muted);cursor:grab}
.mb-item-drag:hover{background:var(--bg)}
.mb-item-del{color:var(--rose)}
.mb-item-del:hover{background:var(--rose-f)}
.mb-item-drag .material-symbols-outlined,.mb-item-del .material-symbols-outlined{font-size:16px}

/* ═══ ADMIN LANGUAGE CHIPS (global settings) ═══ */
.admin-lang-chip{
  display:flex;align-items:center;gap:6px;padding:8px 14px;border-radius:10px;
  border:2px solid var(--border);background:var(--white);cursor:pointer;
  font-size:13px;font-weight:500;transition:all .15s;
}
.admin-lang-chip:hover{border-color:var(--primary);background:var(--primary-f)}
.admin-lang-chip.selected{border-color:var(--primary);background:var(--primary-f);color:var(--primary);font-weight:700}

/* ═══ TOPBAR — APPLICATION MENU (proto Clinstudy V5) ═══ */
.tb-app-menu{display:inline-flex;align-items:center;flex-shrink:0;position:relative}
.tb-app-trigger{
  display:inline-flex;align-items:center;gap:7px;
  padding:6px 10px 6px 12px;border-radius:10px;
  background:var(--ds-bg-subtle);color:var(--ds-fg);
  border:1px solid var(--ds-border);
  font-family:var(--font-ui);font-size:12.5px;font-weight:500;
  cursor:pointer;transition:all 140ms var(--ease);white-space:nowrap;
}
.tb-app-trigger:hover,
.tb-app-trigger[aria-expanded="true"]{
  background:var(--ds-bg-elevated);border-color:var(--ds-border-strong);
}
.tb-app-trigger.active{background:var(--brand-teal-50);color:var(--brand-teal-700);border-color:var(--brand-teal-200)}
.tb-app-trigger .tb-app-trigger-icon .material-symbols-outlined,
.tb-app-trigger .tb-app-trigger-chevron .material-symbols-outlined{font-size:16px;line-height:1}
.tb-app-trigger .tb-app-trigger-chevron{opacity:.7;transition:transform 140ms var(--ease)}
.tb-app-trigger[aria-expanded="true"] .tb-app-trigger-chevron{transform:rotate(180deg)}
.tb-app-trigger svg{width:16px;height:16px}

.tb-app-dropdown{
  position:absolute;top:calc(100% + 8px);right:0;width:280px;
  background:var(--ds-bg-elevated);border:1px solid var(--ds-border);border-radius:14px;
  box-shadow:var(--sh-xl);z-index:250;overflow-y:auto;max-height:520px;padding:8px;
  animation:ds-fade-up 180ms var(--ease);
}
.tb-app-dropdown-header{
  padding:8px 10px 6px;font-family:var(--font-mono);
  font-size:9.5px;font-weight:700;color:var(--ds-fg-subtle);
  text-transform:uppercase;letter-spacing:.14em;
}
.tb-app-dropdown-group{
  padding:6px 10px 3px;font-family:var(--font-mono);
  font-size:9.5px;font-weight:600;color:var(--ds-fg-subtle);
  text-transform:uppercase;letter-spacing:.1em;
}
.tb-app-dropdown-sep{height:1px;background:var(--ds-border);margin:6px 6px}
.tb-app-dropdown-item{
  display:flex;align-items:center;gap:10px;padding:8px 10px;border-radius:9px;
  cursor:pointer;transition:background 120ms var(--ease);
  font-size:13px;font-weight:400;color:var(--ds-fg);font-family:var(--font-ui);
}
.tb-app-dropdown-item:hover{background:var(--ds-bg-subtle)}
.tb-app-dropdown-item.active{background:var(--brand-teal-50);color:var(--brand-teal-700)}
.tb-app-dropdown-icon{display:flex;align-items:center;justify-content:center;width:18px;flex-shrink:0;color:var(--ds-fg-muted)}
.tb-app-dropdown-item.active .tb-app-dropdown-icon{color:var(--brand-teal-500)}
.tb-app-dropdown-icon svg{width:16px;height:16px}
.tb-app-dropdown-icon .material-symbols-outlined{font-size:16px;line-height:1}

/* ═══ TOPBAR — USER DROPDOWN MENU ═══ */
.tb-user-menu{
  position:absolute;top:calc(100% + 4px);right:12px;width:260px;
  background:var(--white);border:1px solid var(--border);border-radius:var(--r);
  box-shadow:0 8px 30px rgba(15,43,70,.15);z-index:250;overflow:hidden;padding:6px;
}
.tb-user-menu-item{
  display:flex;align-items:center;gap:10px;padding:10px 12px;border-radius:var(--rsm);
  cursor:pointer;transition:background .1s;font-size:13px;font-weight:500;color:var(--text);
}
.tb-user-menu-item:hover{background:var(--bg)}
.tb-user-menu-item svg{width:16px;height:16px;color:var(--muted);flex-shrink:0}
.tb-user-menu-danger{color:var(--rose)}
.tb-user-menu-danger:hover{background:var(--rose-f)}
.tb-user-menu-danger svg{color:var(--rose)}
.tb-user-menu-sep{height:1px;background:var(--border);margin:4px 8px}

/* ═══ TOPBAR — MOBILE RESPONSIVE ═══ */
@media(max-width:768px){
  .tb-user-name{display:none}
  .tb-breadcrumb{display:none!important}
  .tb-app-menu{display:none!important}
  .tb-study-select{display:none!important}
  .tb-notif-panel{position:fixed;top:54px;right:8px;left:8px;width:auto}
  .tb-user-menu{position:fixed;top:54px;right:8px;left:auto;width:240px}
  .tb-user{padding:4px}
  .tb-notif{width:40px;height:40px}
  .topbar{gap:6px}
  .tb-right-actions>[data-tb-slot].tb-sep{border-left:none;margin-left:0;padding-left:0}
  .tb-right-actions>[data-tb-slot][draggable="true"]{cursor:default}
}

/* ═══ VISIT TIMELINE (patient stepper) ═══ */
.visit-timeline{
  padding:12px 8px;margin-bottom:12px;
}
.visit-timeline .tl-step{
  transition:background .15s;border-radius:var(--rsm);
}
.visit-timeline .tl-step:hover{
  background:var(--bg);
}
@media(max-width:480px){
  .visit-timeline{padding:8px 4px}
}

/* ═══ WIZARD QUESTION CARDS (Typeform-style mobile) ═══ */
.wizard-q-card{
  padding:16px;
  min-height:200px;
  display:flex;
  flex-direction:column;
  justify-content:center;
}
.wizard-q-card .fg{
  margin-bottom:0;
}
.wizard-q-card .fl{
  font-size:16px;
  font-weight:700;
  margin-bottom:12px;
  line-height:1.5;
}
.wizard-q-card .fi{
  font-size:16px;
  min-height:50px;
}
.wizard-q-card .esb{
  min-height:80px;
  padding:14px 8px;
}
.wizard-q-card .esb .em{font-size:28px}
.wizard-q-card .esb .lb{font-size:14px}
.wizard-q-card .yn-btn{
  padding:18px;font-size:18px;min-height:60px;
}

/* ═══ WIZARD CARD ANIMATIONS (avec rebond) ═══ */
@keyframes wizard-slide-out-left{
  0%{transform:translateX(0) scale(1);opacity:1}
  100%{transform:translateX(-60px) scale(.95);opacity:0}
}
@keyframes wizard-slide-out-right{
  0%{transform:translateX(0) scale(1);opacity:1}
  100%{transform:translateX(60px) scale(.95);opacity:0}
}
@keyframes wizard-slide-in-right{
  0%{transform:translateX(80px) scale(.9);opacity:0}
  60%{transform:translateX(-6px) scale(1.01);opacity:1}
  80%{transform:translateX(3px) scale(1)}
  100%{transform:translateX(0) scale(1);opacity:1}
}
@keyframes wizard-slide-in-left{
  0%{transform:translateX(-80px) scale(.9);opacity:0}
  60%{transform:translateX(6px) scale(1.01);opacity:1}
  80%{transform:translateX(-3px) scale(1)}
  100%{transform:translateX(0) scale(1);opacity:1}
}

/* ═══ WIZARD : hide-by-default des cartes ═══
   Évite le flash de toutes les cartes pendant les 80ms entre le render et
   l'init du wizard. Seule la première carte est visible par défaut ; le
   wizard prend ensuite le contrôle (style.display inline) pour navigation. */
#wizard-container > [data-form-id]:not(:first-of-type) { display: none; }
/* Cartes masquées par condition (data-cond-hidden) — toujours invisibles,
   peu importe la position. */
#wizard-container > [data-form-id][data-cond-hidden="true"] { display: none !important; }
/* ═══ STICKY ACTION BAR (patient form submit) ═══ */
.sticky-action-bar{
  position:fixed;
  bottom:0;left:0;right:0;
  display:flex;align-items:center;justify-content:center;gap:12px;
  padding:12px 20px;
  background:rgba(255,255,255,.95);
  backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px);
  border-top:1px solid var(--border);
  box-shadow:0 -2px 12px rgba(0,0,0,.06);
  z-index:310;
}
/* Quand la sticky-bar est rendue DANS le panel détail patiente, son
   position:fixed devient panel-relatif (à cause du transform du panel).
   Donc left:0;right:0 du base rule suffit pour spanner toute la largeur
   du panel. On force juste un z-index local élevé pour passer au-dessus
   des cartes wizard. */
#patient-detail-panel .sticky-action-bar{
  z-index:50;
  left:0;
  right:0;
}
@media(min-width:769px){
  .sticky-action-bar{left:var(--sidebar-w,240px)}
}
/* Sur mobile: positionner AU-DESSUS de la bottom nav (56px + safe area) */
@media(max-width:768px){
  .sticky-action-bar{
    bottom:calc(var(--mob-nav-h,56px) + var(--mob-safe-b,0px));
    padding:10px 16px;
  }
  /* Sur visit-stage-* (mobile-bottom-nav cachée) : sticky-action-bar tout en
     bas, sinon le bouton "Suivant" reste flottant à 64-72px du bas avec un
     vide en dessous (la place laissée par la barre cachée). */
  body[data-mobile-nav-hidden] .sticky-action-bar{
    bottom: var(--mob-safe-b, 0px);
  }
}

/* ===== Hovers génériques — remplacement des onmouseover/onmouseout inline =====
   Utilisés par la migration CSP pour retirer les handlers inline.
   Ajouter la classe correspondante sur l'élément. */
.js-hover-bg { transition: background-color .15s ease; }
.js-hover-bg:hover { background: var(--bg); }
.js-hover-lift { transition: transform .15s ease, box-shadow .15s ease; }
.js-hover-lift:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,.08); }
.js-hover-bg-surface { transition: background-color .15s ease; }
.js-hover-bg-surface:hover { background: var(--surface); }
.js-hover-bg-card { transition: background-color .15s ease; }
.js-hover-bg-card:hover { background: var(--card); }
.js-hover-border { transition: border-color .15s ease; }
.js-hover-border:hover { border-color: var(--primary); }
.js-hover-opacity { transition: opacity .15s ease; }
.js-hover-opacity:hover { opacity: 0.8; }
.js-hover-rose { transition: color .15s ease; }
.js-hover-rose:hover { color: var(--rose); }
.js-hover-lift-3 { transition: transform .2s ease, box-shadow .2s ease; }
.js-hover-lift-3:hover { transform: translateY(-3px); box-shadow: 0 6px 20px rgba(0,0,0,.1); }
.js-hover-scale { transition: transform .15s ease; }
.js-hover-scale:hover { transform: scale(1.15); }
.js-hover-bg-primary-f { transition: background-color .15s ease; }
.js-hover-bg-primary-f:hover { background: var(--primary-f); }
.js-hover-bg-darken { transition: background-color .15s ease; }
.js-hover-bg-darken:hover { background: rgba(0,0,0,.2); }
/* Drag-over visuel (pour zones de drop) */
.js-drag-over { outline: 2px dashed var(--primary); background: rgba(59,130,246,.06); }

/* ═══════════════════════════════════════════════════════════════════
   DARK MODE — overrides for new multi-tenant + e-signature elements
   ═══════════════════════════════════════════════════════════════════ */

/* 1. Node banner — hardcoded #FFF3E0 background needs dark override */
html.theme-dark #instance-node-banner {
  background: rgba(212,147,10,0.22) !important;
  color: var(--amber-t) !important;
  border-bottom-color: rgba(212,147,10,0.4) !important;
  box-shadow: 0 1px 3px rgba(0,0,0,.3) !important;
}

/* 2. Hub-clean modal — amber alert inside modal */
html.theme-dark .modal .alert[style*="amber-f"],
html.theme-dark .modal .alert-warning {
  background: var(--amber-f);
  color: var(--amber-t);
  border-color: rgba(212,147,10,0.5);
}

/* 3. Spawn-local modal — info alert with blue background */
html.theme-dark .modal .alert[style*="info-f"] {
  background: var(--info-f);
  color: var(--info-t);
  border-color: rgba(99,102,241,0.4);
}

/* 4. SSO confirmation modal — uses showConfirmModal, inherits .modal dark bg OK */
/* 5. Podium surgeon — gradients need dark adaptation */
html.theme-dark .sd-pod-block {
  opacity: 0.85;
  box-shadow: inset 0 0 20px rgba(0,0,0,.25);
}
html.theme-dark .sd-pod-initials {
  color: var(--text);
}
html.theme-dark .sd-pod-value {
  color: var(--muted);
}

/* 6. Overdue filter chip (esignature) — amber background */
html.theme-dark .alert-warning {
  background: var(--amber-f) !important;
  color: var(--amber-t) !important;
  border-color: rgba(212,147,10,0.4) !important;
}

/* 7. Sidebar "Outils" section — navGroup uses .nav-group-label, already OK
   with rgba text, but ensure correct contrast */
html.theme-dark .nav-group-label {
  color: rgba(255,255,255,0.35);
}

/* 8. New buttons (spawn-local blue, clean offline rose, sync rouge)
   These use var(--info-f), var(--rose-f), var(--primary-f) which are
   already overridden in :root dark. Add explicit override for borders. */
html.theme-dark .btn[style*="info-f"] {
  color: var(--info-t);
}
html.theme-dark .btn[style*="rose-f"] {
  color: var(--rose-t);
}

/* Hub offline alert badge — hardcoded #C0312B needs dark adjustment */
html.theme-dark [style*="background:#C0312B"] {
  background: rgba(220,50,50,0.9) !important;
}

/* Hub-clean threshold input — ensure dark background */
html.theme-dark #hub-clean-threshold {
  background: #212B3B;
  color: var(--text);
  border-color: var(--border);
}

/* Hub-clean list — border container */
html.theme-dark #hub-clean-list {
  border-color: var(--border);
}

/* Local processes table — inline table header with var(--bg) */
html.theme-dark #hub-local-processes-container thead tr {
  background: #212B3B;
}

/* ═══════════════════════════════════════════════════════════════════
   MOBILE RESPONSIVE — fixes for new multi-tenant + e-signature elements
   ═══════════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {

  /* 1. Hub-clean modal — 720px max-width is too wide for mobile.
     On mobile, .modal already gets max-width:100% from the existing
     bottom-sheet override. Reinforce text-align and inner spacing. */
  [id^="modal-hub-clean"] .modal {
    max-width: 100% !important;
    text-align: left;
  }
  [id^="modal-hub-clean"] .modal #hub-clean-list {
    max-height: 220px;
  }
  [id^="modal-hub-clean"] .modal .modal-actions {
    flex-direction: row;
    gap: 8px;
  }

  /* 2. Spawn-local modal — inputs port/name need proper sizing */
  [id^="modal-spawn-local"] .modal {
    max-width: 100% !important;
  }
  [id^="modal-spawn-local"] .fi {
    width: 100%;
    min-width: 0;
  }

  /* 3. Node banner fixed top — body needs correct padding-top.
     JS already sets this dynamically via requestAnimationFrame.
     Ensure banner wraps on very small screens. */
  #instance-node-banner {
    flex-wrap: wrap !important;
    font-size: 11px !important;
    padding: 4px 10px !important;
    gap: 4px !important;
  }
  #instance-node-banner .btn,
  #instance-node-banner button {
    font-size: 10px !important;
    padding: 2px 6px !important;
  }

  /* 4. Local processes table — needs horizontal scroll */
  #hub-local-processes-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  #hub-local-processes-container table {
    min-width: max-content;
  }

  /* 5. Hub nodes table — already has overflow-x:auto inline,
     but reinforce for safety */
  #hub-nodes-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  #hub-nodes-container table {
    min-width: max-content;
  }

  /* 6. Translations search field — ensure full width */
  #translations-search {
    width: 100% !important;
    box-sizing: border-box;
  }

  /* 7. Podium — already has mobile override in surgeon-dashboard.js
     (flex:0 0 90px etc.), but ensure gap is tighter */
  .sd-podium {
    gap: 6px !important;
    padding: 12px 0 6px !important;
  }

  /* 8. Esig overdue chip — ensure text wraps properly */
  .alert-warning[data-action] {
    flex-wrap: wrap;
    gap: 6px;
  }
}

/* ── Dark mode: catch-all for white hover backgrounds ──────────────── */
/* Certains hover states utilisent des couleurs claires hardcodées qui
   rendent le texte invisible en dark mode. Override global. */
html.theme-dark .esb:hover:not(.on){background:var(--white)!important}
html.theme-dark .mb-palette-item:hover{background:var(--white)!important}
html.theme-dark .btn-xs:hover{background:rgba(255,255,255,0.08)}
html.theme-dark .tb-user-menu-item:hover{background:rgba(255,255,255,0.08)}
html.theme-dark .lang-btn:hover{background:rgba(255,255,255,0.08)}
html.theme-dark option{background:var(--white);color:var(--text)}
html.theme-dark select option:hover{background:rgba(255,255,255,0.1)}
html.theme-dark .fi:disabled,html.theme-dark input.fi:disabled{background:#1A2535;color:var(--muted);opacity:.7}
html.theme-dark .js-hover-lift:hover,html.theme-dark .js-hover-lift-3:hover{box-shadow:0 8px 30px rgba(0,0,0,.4)}

/* (tooltip duplicate removed — consolidated at top of file) */

/* ── Dark mode: cards de run/scenario (test-runner + playwright) ── */
html.theme-dark .card[style*="border-left"]{background:var(--white)}
html.theme-dark [style*="background:var(--white)"],
html.theme-dark [style*="background: var(--white)"]{background:var(--white)!important}

/* ── Dark: alert-info fond blanc → sombre ── */
html.theme-dark .alert-info,html.theme-dark .alert.alert-info{background:rgba(30,136,229,0.12)!important;color:var(--text);border-color:rgba(30,136,229,0.3)}
html.theme-dark .alert-warn,html.theme-dark .alert.alert-warn,html.theme-dark .alert-warning{background:rgba(245,158,11,0.12)!important;color:var(--text);border-color:rgba(245,158,11,0.3)}
html.theme-dark .alert-danger,html.theme-dark .alert.alert-danger{background:rgba(220,38,38,0.12)!important;color:var(--text);border-color:rgba(220,38,38,0.3)}

/* ── Dark: filtres et pills fond blanc → sombre ── */
html.theme-dark .fi,html.theme-dark input.fi,html.theme-dark select.fi,html.theme-dark textarea.fi{background:var(--white)!important;color:var(--text)!important;border-color:var(--border)!important}

/* ── Dark: inline white backgrounds from JS (common patterns) ── */
html.theme-dark [style*="background:#fff"],
html.theme-dark [style*="background: #fff"],
html.theme-dark [style*="background:#FFF"],
html.theme-dark [style*="background:white"],
html.theme-dark [style*="background: white"]{background:var(--white)!important}
html.theme-dark [style*="background:#f5f5f5"],
html.theme-dark [style*="background:#F5F5F5"],
html.theme-dark [style*="background:#fafafa"],
html.theme-dark [style*="background:#FAFAFA"],
html.theme-dark [style*="background:#f8fafc"],
html.theme-dark [style*="background:#FAFCFE"],
html.theme-dark [style*="background:#f9fafb"]{background:var(--bg)!important}
html.theme-dark [style*="background:#EEF6FA"],
html.theme-dark [style*="background:#E3F2FD"]{background:rgba(30,136,229,0.1)!important}
html.theme-dark [style*="background:#FFF3E0"],
html.theme-dark [style*="background:#fef3c7"]{background:rgba(245,158,11,0.1)!important}
html.theme-dark [style*="background:#FDE8EA"],
html.theme-dark [style*="background:#fee2e2"]{background:rgba(220,38,38,0.1)!important}
html.theme-dark [style*="background:#E8F5E9"],
html.theme-dark [style*="background:#dcfce7"]{background:rgba(34,197,94,0.1)!important}

/* ── Dark: code/pre blocks ── */
html.theme-dark code,html.theme-dark pre{background:rgba(255,255,255,0.06);color:var(--text)}
html.theme-dark .td-code{color:var(--primary)}

/* ── Dark: grid stat cards ── */
html.theme-dark .stat-card,.stat-card{background:var(--white)}
html.theme-dark .grid4 .stat-card{border:1px solid var(--border)}

/* ============================================================
   DS v2 OVERRIDES (2026-04-18)
   ============================================================
   Bloc final qui surcharge les classes legacy pour que le look
   corresponde au prototype Clinstudy.html. Grâce au cascade CSS
   (dernière déclaration gagne), toute l'app est auto-upgradée
   sans toucher aux render*().
*/

/* Body + main background : n-50 cool du DS, pas le gradient legacy */
body {
  background: var(--ds-bg, var(--n-50)) !important;
  color: var(--ds-fg, var(--n-900));
  font-family: var(--font-ui);
  font-size: var(--text-base);
  line-height: var(--lh-base);
}
.main { background: transparent; }
html.theme-dark body { background: var(--ds-bg) !important; }

/* ─── SIDEBAR au spec prototype (228px, chrome-bg, gold stripe actif) ─── */
.sidebar {
  width: 228px;
  background: var(--chrome-bg);
  border-right: 1px solid var(--chrome-border);
  padding: 0;
  display: flex;
  flex-direction: column;
}
.sidebar-logo {
  padding: 18px 18px 16px;
  border-bottom: 1px solid var(--chrome-border);
  background: transparent;
}
.sidebar-study-name {
  font-family: var(--font-editorial);
  font-weight: 400;
  letter-spacing: -0.01em;
  font-size: 22px;
  color: #fff;
  line-height: 1.1;
}
.sidebar-subtitle {
  color: var(--chrome-fg-muted);
  font-size: 10.5px;
  margin-top: 3px;
  opacity: 0.8;
  font-weight: 400;
}
.sidebar-profile-badge {
  margin: 12px 14px 6px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--chrome-border);
  border-radius: 8px;
  color: var(--chrome-fg);
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: background 120ms;
}
.sidebar-profile-badge:hover { background: rgba(255,255,255,0.08); }
.sidebar-profile-badge .spb-icon {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-teal-500), var(--brand-navy-500));
  color: #fff; font-size: 12px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid rgba(255,255,255,0.12);
  flex-shrink: 0;
}
.sidebar-profile-badge .spb-name { font-size: 12.5px; font-weight: 500; color: var(--chrome-fg); }
.sidebar-profile-badge .spb-role { font-size: 10.5px; color: var(--chrome-fg-muted); margin-top: 1px; }
.sidebar-profile-badge .spb-change { font-size: 10px; color: var(--chrome-fg-muted); opacity: 0.7; }
.sidebar-nav { padding: 4px 12px 10px; }
.nav-section-label, .sidebar-nav-section {
  padding: 14px 12px 4px !important;
  font-size: 10px !important;
  color: var(--chrome-fg-muted) !important;
  opacity: 0.55;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 500 !important;
}
.nav-item {
  position: relative;
  width: 100%;
  padding: 8px 12px !important;
  border-radius: 7px;
  background: transparent;
  color: var(--chrome-fg-muted);
  font-size: 13px;
  font-weight: 400;
  font-family: var(--font-ui);
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background 120ms, color 120ms;
  cursor: pointer;
  border: none;
  text-align: left;
  margin-bottom: 2px;
}
.nav-item:hover:not(.active) {
  background: rgba(255,255,255,0.04);
  color: #fff;
}
.nav-item.active {
  background: var(--chrome-active);
  color: #fff;
  font-weight: 500;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: -12px; top: 8px; bottom: 8px;
  width: 2px;
  background: var(--brand-gold);
  border-radius: 2px;
}
.nav-item .nav-icon .material-symbols-outlined { font-size: 17px; }
.sidebar-bottom {
  padding: 10px 14px;
  border-top: 1px solid var(--chrome-border);
  margin-top: auto;
}
.study-switch-btn, .admin-btn {
  color: var(--chrome-fg-muted);
  font-size: 11.5px;
  padding: 8px 10px;
  border-radius: 6px;
  transition: background 120ms, color 120ms;
  cursor: pointer;
}
.study-switch-btn:hover, .admin-btn:hover {
  background: rgba(255,255,255,0.06);
  color: #fff;
}

/* ─── TOPBAR au spec prototype (60px, blanc, breadcrumb mono + title 16.5px) ─── */
.topbar {
  height: 60px;
  background: var(--ds-bg-elevated, #fff);
  border-bottom: 1px solid var(--ds-border);
  padding: 0 24px;
  gap: 16px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.tb-title {
  font-size: 16.5px;
  font-weight: 600;
  color: var(--ds-fg);
  letter-spacing: -0.01em;
  line-height: 1.2;
  font-family: var(--font-ui);
}
.tb-sub {
  font-size: 12.5px;
  color: var(--ds-fg-muted);
  margin-top: 1px;
}
.tb-breadcrumb {
  font-size: 11px;
  color: var(--ds-fg-muted);
  font-family: var(--font-mono);
  letter-spacing: 0.03em;
  margin-bottom: 2px;
}

/* ─── CARDS au spec prototype ─── */
.card {
  background: var(--ds-bg-elevated);
  border: 1px solid var(--ds-border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-xs);
  padding: 20px;
  transition: box-shadow 200ms var(--ease), transform 200ms var(--ease);
}
.card.lift:hover, .stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--sh-md);
}
.card-title {
  font-family: var(--font-editorial);
  font-weight: 400;
  font-size: var(--text-md);
  color: var(--ds-fg);
  letter-spacing: -0.01em;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ─── STAT CARD au spec prototype ─── */
.stat-card {
  background: var(--ds-bg-elevated);
  border: 1px solid var(--ds-border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-xs);
  padding: 18px 20px;
  transition: transform 200ms var(--ease), box-shadow 200ms var(--ease);
}
.stat-val {
  font-family: var(--font-editorial);
  font-size: 30px;
  font-weight: 400;
  color: var(--ds-fg);
  letter-spacing: -0.025em;
  line-height: 1;
}
.stat-lbl {
  font-size: 11px;
  font-weight: 500;
  color: var(--ds-fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 8px;
}

/* ─── PILLS au spec prototype ─── */
.pill {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: 500;
  padding: 3px 9px;
  border-radius: var(--r-full);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1.4;
  border: 1px solid var(--ds-border);
  background: var(--ds-bg-subtle);
  color: var(--ds-fg-muted);
  white-space: nowrap;
}
.p-done,  .pill.pill-success { background: var(--success-50); color: var(--success-700); border-color: transparent; }
.p-prog,  .pill.pill-warning { background: var(--warning-50); color: var(--warning-700); border-color: transparent; }
.p-late,  .pill.pill-danger  { background: var(--danger-50);  color: var(--danger-700);  border-color: transparent; }
.p-todo,  .pill.pill-brand   { background: var(--brand-teal-50); color: var(--brand-teal-700); border-color: transparent; }
.p-na { background: var(--ds-bg-subtle); color: var(--ds-fg-subtle); border-color: transparent; }

/* ─── BUTTONS au spec prototype ─── */
.btn {
  padding: 8px 14px;
  border-radius: var(--r-md);
  font-family: var(--font-ui);
  font-size: var(--text-base);
  font-weight: 500;
  background: var(--ds-bg-elevated);
  color: var(--ds-fg);
  border: 1px solid var(--ds-border-strong);
  transition: all var(--t-fast) var(--ease);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: var(--ds-bg-subtle); border-color: var(--n-300); }
.btn-primary {
  background: var(--brand-teal-500);
  color: #fff;
  border-color: var(--brand-teal-600);
  box-shadow: var(--sh-sm), var(--sh-inset);
}
.btn-primary:hover { background: var(--brand-teal-600); border-color: var(--brand-teal-700); }
.btn-secondary {
  background: transparent;
  color: var(--ds-fg-muted);
  border-color: var(--ds-border-strong);
}
.btn-secondary:hover { background: var(--ds-bg-subtle); color: var(--ds-fg); border-color: var(--n-300); }
.btn-danger {
  background: var(--danger-500);
  color: #fff;
  border-color: var(--danger-700);
}
.btn-danger:hover { background: var(--danger-700); }
.btn-sm { padding: 6px 10px; font-size: var(--text-sm); border-radius: var(--r-sm); }
.btn-xs { padding: 4px 10px; font-size: 11px; font-weight: 500; border-radius: var(--r-sm); }

/* ─── FORM INPUTS au spec prototype ─── */
.fi, input[type="text"].fi, input[type="email"].fi, input[type="password"].fi, input[type="date"].fi, input[type="number"].fi, textarea.fi, select.fi {
  padding: 9px 12px;
  border-radius: var(--r-sm);
  background: var(--ds-bg-elevated);
  color: var(--ds-fg);
  border: 1px solid var(--ds-border-strong);
  font-size: var(--text-sm);
  font-family: var(--font-ui);
  transition: border-color 150ms var(--ease), box-shadow 150ms var(--ease);
}
.fi:focus {
  outline: none;
  border-color: var(--brand-teal-500);
  box-shadow: 0 0 0 3px var(--brand-teal-100);
}
.fl {
  font-size: 11px;
  font-weight: 500;
  color: var(--ds-fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
  display: block;
}

/* ─── TABLE au spec prototype ─── */
table { background: var(--ds-bg-elevated); }
th {
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  color: var(--ds-fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: var(--ds-bg-subtle);
  border-bottom: 1px solid var(--ds-border);
}
td {
  padding: 12px 14px;
  font-size: 13px;
  color: var(--ds-fg);
  border-bottom: 1px solid var(--ds-border);
}
tr:hover td { background: var(--ds-bg-subtle); }

/* ─── PAGE HEADER au spec prototype ─── */
.page-header h1 {
  font-family: var(--font-editorial);
  font-weight: 400;
  letter-spacing: -0.025em;
  font-size: 36px;
  line-height: 1.05;
  color: var(--ds-fg);
  margin-bottom: 4px;
}
.page-header h1 em {
  font-style: italic;
  font-family: var(--font-editorial);
  color: var(--brand-teal-500);
}
.page-header p {
  color: var(--ds-fg-muted);
  font-size: 14px;
  margin-top: 4px;
}

/* ─── GRIDS gap réduit ─── */
.grid2 { gap: 20px; }
.grid3 { gap: 16px; }
.grid4 { gap: 14px; }

/* ─── TAB BAR ─── */
.tab-bar {
  display: flex; gap: 4px;
  border-bottom: 1px solid var(--ds-border);
  margin-bottom: 20px;
  padding: 0;
}
.tab-btn {
  padding: 10px 14px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--ds-fg-muted);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 120ms;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.tab-btn:hover { color: var(--ds-fg); }
.tab-btn.active {
  color: var(--brand-teal-500);
  border-bottom-color: var(--brand-teal-500);
  font-weight: 500;
}
.tab-count {
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--ds-bg-subtle);
  color: var(--ds-fg-muted);
  font-weight: 500;
}

/* ─── Content container padding plus généreux ─── */
.content { padding: 28px; max-width: 1440px; margin: 0 auto; }

/* ─── Patient flavor : fond ivoire doux sur la zone content ─── */
body[data-flavor="patient"] .content { background: var(--ds-bg); }
body[data-flavor="patient"] .main { background: var(--ds-bg); }

/* ─── Bloc (sections patient/surgeon) ─── */
.bloc-title {
  font-family: var(--font-editorial);
  font-weight: 400;
  font-size: var(--text-lg);
  color: var(--ds-fg);
  letter-spacing: -0.01em;
}

/* ─── Dark mode adjustments pour les overrides ci-dessus ─── */
html.theme-dark body { background: var(--ds-bg) !important; color: var(--ds-fg); }
html.theme-dark .card, html.theme-dark .stat-card { background: var(--ds-bg-elevated); border-color: var(--ds-border); }
html.theme-dark .topbar { background: var(--ds-bg-elevated); border-bottom-color: var(--ds-border); }
html.theme-dark .tb-title { color: var(--ds-fg); }
html.theme-dark .tb-sub { color: var(--ds-fg-muted); }
html.theme-dark th { background: var(--ds-bg-subtle); color: var(--ds-fg-muted); }
html.theme-dark td { color: var(--ds-fg); border-bottom-color: var(--ds-border); }
html.theme-dark .fi { background: var(--ds-bg-elevated); color: var(--ds-fg); border-color: var(--ds-border-strong); }
html.theme-dark .btn { background: var(--ds-bg-elevated); color: var(--ds-fg); border-color: var(--ds-border-strong); }

/* Hide old update toast absolute banner style */
.tb-update-pill { display: none; }

/* ─── Sidebar bottom avec avatar + logout (écrase les anciens boutons) ─── */
.sidebar-profile-badge {
  border-radius: 8px;
  border: 1px solid var(--chrome-border);
  background: rgba(255,255,255,0.04);
}
.sidebar-profile-badge:hover { background: rgba(255,255,255,0.08); }
.sidebar-profile-badge .spb-change {
  font-size: 10px; color: var(--chrome-fg-muted);
  opacity: 0.65;
  transition: opacity 120ms;
}
.sidebar-profile-badge:hover .spb-change { opacity: 1; }
.study-switch-btn, .admin-btn {
  font-family: var(--font-ui);
  font-size: 11.5px;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--chrome-fg-muted);
  padding: 7px 10px;
  border-radius: 6px;
  margin-bottom: 2px;
  transition: all 120ms;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ─── Modales : corps en tokens DS ─── */
.modal-overlay {
  background: rgba(7, 13, 20, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.modal {
  background: var(--ds-bg-elevated) !important;
  border-radius: var(--r-lg);
  border: 1px solid var(--ds-border-strong);
  box-shadow: var(--sh-xl);
  padding: 28px !important;
  font-family: var(--font-ui);
  color: var(--ds-fg);
}
.modal-title {
  font-family: var(--font-editorial);
  font-weight: 400;
  font-size: 24px;
  letter-spacing: -0.015em;
  color: var(--ds-fg);
  margin-bottom: 6px;
}
.modal-sub {
  font-size: 13px;
  color: var(--ds-fg-muted);
  margin-bottom: 20px;
  line-height: 1.5;
}
.modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 22px;
  justify-content: flex-end;
}

/* ─── Cookie consent bar DS ─── */
.cookie-bar,
#cookie-consent,
.cookie-consent,
[data-cookie-consent],
.consent-bar {
  background: var(--chrome-bg) !important;
  color: var(--chrome-fg) !important;
  border-top: 1px solid var(--chrome-border);
  padding: 10px 24px !important;
  font-size: 12px !important;
  font-family: var(--font-ui);
  display: flex;
  align-items: center;
  gap: 14px;
}
.cookie-bar .btn, #cookie-consent .btn, .cookie-consent .btn {
  background: var(--brand-teal-500);
  color: #fff;
  border-color: var(--brand-teal-600);
  padding: 6px 14px;
  font-size: 12px;
  box-shadow: var(--sh-sm);
}
.cookie-bar .btn:hover, #cookie-consent .btn:hover, .cookie-consent .btn:hover {
  background: var(--brand-teal-600);
}

/* ─── Banners impersonate / test / node au spec proto ─── */
.alert, .banner {
  font-family: var(--font-ui);
  border-radius: var(--r-md);
  padding: 10px 14px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  line-height: 1.5;
}
.alert-warn, .alert-warning, .banner-test {
  background: var(--warning-50) !important;
  color: var(--warning-700) !important;
  border: 1px solid #F2D888;
}
.alert-danger, .banner-danger {
  background: var(--danger-50) !important;
  color: var(--danger-700) !important;
  border: 1px solid #F5B8C3;
}
.alert-info, .banner-info {
  background: var(--info-50) !important;
  color: var(--info-700) !important;
  border: 1px solid #B5C9EA;
}
.alert-success, .banner-node {
  background: var(--brand-teal-50) !important;
  color: var(--brand-teal-700) !important;
  border: 1px solid var(--brand-teal-200);
}
.banner-impersonate, .impersonate-banner, [data-impersonate] {
  background: #2B1F08 !important;
  color: #FFD88A !important;
  border: 1px solid #614416;
}

/* ─── Mobile bottom nav au spec DS ─── */
.mobile-bottom-nav {
  background: var(--ds-bg-elevated);
  border-top: 1px solid var(--ds-border);
  box-shadow: 0 -4px 20px rgba(15,24,33,0.05);
  padding: 6px 4px calc(6px + var(--mob-safe-b, 0px));
  font-family: var(--font-ui);
}
.mob-nav-item {
  color: var(--ds-fg-muted);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 8px 4px;
  border-radius: 8px;
  transition: color 120ms, background 120ms;
}
.mob-nav-item.active {
  color: var(--brand-teal-500);
  background: var(--brand-teal-50);
}
.mob-nav-item .material-symbols-outlined { font-size: 20px; }

/* ─── Tiroir collapsible (DS) — pattern réutilisable ───
   Usage :
     <details class="ds-collapse-card">
       <summary class="ds-collapse-summary">
         <span class="ds-collapse-icon">{icon}</span>
         <span class="ds-collapse-title">{title}</span>
         <span class="ds-collapse-count">{count}</span>
         <span class="ds-collapse-chevron">{chevron-svg}</span>
       </summary>
       <div class="ds-collapse-body">{...content...}</div>
     </details>

   Replié par défaut (pas d'attribut `open`). Cliquer sur le summary déplie.
   Native <details> = pas de JS, accessible (aria-expanded auto, clavier, etc).
   ─────────────────────────────────────────────────────── */
.ds-collapse-card {
  background: var(--ds-bg-elevated);
  border: 1px solid var(--ds-border);
  border-radius: var(--r-md, 10px);
  overflow: hidden;
  transition: box-shadow .15s;
}
.ds-collapse-card[open] {
  box-shadow: var(--sh-sm, 0 1px 4px rgba(15,24,33,.06));
}
.ds-collapse-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  cursor: pointer;
  list-style: none;
  user-select: none;
  font-size: 13.5px;
  color: var(--ds-fg);
  font-weight: 500;
}
.ds-collapse-summary::-webkit-details-marker { display: none; }
.ds-collapse-summary:hover { background: var(--ds-bg-subtle, #F8F7F2); }
.ds-collapse-icon {
  display: inline-flex;
  align-items: center;
  color: var(--ds-fg-muted);
  flex-shrink: 0;
}
.ds-collapse-icon .material-symbols-outlined { font-size: 18px; }
.ds-collapse-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ds-collapse-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 11px;
  background: var(--ds-bg-subtle, #F2F0EA);
  color: var(--ds-fg-muted);
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
  flex-shrink: 0;
}
.ds-collapse-chevron {
  display: inline-flex;
  align-items: center;
  color: var(--ds-fg-muted);
  transition: transform .18s ease;
  flex-shrink: 0;
}
.ds-collapse-chevron .material-symbols-outlined { font-size: 20px; }
.ds-collapse-card[open] .ds-collapse-chevron { transform: rotate(180deg); }
.ds-collapse-body {
  padding: 12px 16px 14px;
  border-top: 1px solid var(--ds-border);
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  background: var(--ds-bg-subtle, #FAFAF6);
}

/* ─── Tooltip (#_tip) au spec DS ─── */
#_tip {
  background: var(--n-900);
  color: var(--n-50);
  font-family: var(--font-ui);
  font-size: 11px;
  padding: 6px 11px;
  border-radius: var(--r-sm);
  box-shadow: var(--sh-lg);
}

/* ─── Toast au spec DS ─── */
#toast, .toast {
  background: var(--n-900) !important;
  color: var(--n-50) !important;
  font-family: var(--font-ui) !important;
  border-radius: var(--r-md);
  box-shadow: var(--sh-lg);
  padding: 10px 16px;
  font-size: 13px;
}

/* ─── Scrollbars DS ─── */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--n-200);
  border-radius: var(--r-full);
  border: 2px solid var(--ds-bg);
}
::-webkit-scrollbar-thumb:hover { background: var(--n-300); }

/* ─── Dropdown / Spotlight DS ─── */
.spotlight-box {
  background: var(--ds-bg-elevated);
  border: 1px solid var(--ds-border-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-xl);
}
.spotlight-input-wrap {
  border-bottom: 1px solid var(--ds-border);
  padding: 14px 16px;
}
.spotlight-input-wrap input {
  font-family: var(--font-ui);
  font-size: 15px;
  color: var(--ds-fg);
  background: transparent;
  border: none;
  outline: none;
}

/* ─── Form builder palette / canvas au spec DS ─── */
.fb-palette, .fb-canvas, .fb-props {
  background: var(--ds-bg-elevated);
  border: 1px solid var(--ds-border);
  border-radius: var(--r-lg);
  padding: 16px;
}
.palette-item {
  background: var(--ds-bg-subtle);
  border: 1px solid var(--ds-border);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 500;
  color: var(--ds-fg);
  margin-bottom: 6px;
  transition: all 120ms;
}
.palette-item:hover {
  border-color: var(--brand-teal-500);
  background: var(--brand-teal-50);
}

/* ─── BREAST-Q scale : dé-surcharger les faces en DS (subtle) ─── */
.esb { transition: all 180ms var(--ease); }
.esb .lb { font-family: var(--font-ui); font-weight: 500; }
.esc-wrap { margin-bottom: 16px; }

/* ─── Login layout (DS v2 patient) — base desktop + responsive mobile ─── */
.ds-login-root{
  position:fixed;inset:0;background:var(--ds-bg);
  display:grid;grid-template-columns:1.1fr 1fr;
  min-height:0;overflow:auto;z-index:500;
}
.ds-login-hero{
  padding:80px 72px;display:flex;flex-direction:column;justify-content:center;
  position:relative;overflow:hidden;background:var(--ds-bg);
}
.ds-login-hero-glow{
  position:absolute;right:-120px;top:-80px;width:360px;height:360px;border-radius:50%;
  background:radial-gradient(circle, rgba(15,107,112,0.08), transparent 70%);
  animation:ds-breathe 6s ease-in-out infinite;
}
.ds-login-side{
  display:flex;align-items:center;justify-content:center;
  padding:60px 48px;background:var(--ds-bg-subtle);position:relative;
}
.ds-login-card{
  width:400px;max-width:100%;background:var(--ds-bg-elevated);
  border-radius:18px;border:1px solid var(--ds-border-strong);
  padding:36px;box-shadow:var(--sh-lg);
  display:flex;flex-direction:column;gap:13px;
}
.ds-login-prolink{
  position:absolute;top:22px;right:28px;font-size:11.5px;color:var(--ds-fg-muted);
  display:inline-flex;align-items:center;gap:5px;padding:6px 11px;border-radius:7px;
  border:1px solid var(--ds-border);background:var(--ds-bg-elevated);
  cursor:pointer;transition:all 150ms;
}
@media(max-width:768px){
  .ds-login-root{grid-template-columns:1fr;overflow-x:hidden}
  .ds-login-hero{display:none}
  .ds-login-side{padding:24px 16px;min-height:100dvh;background:var(--ds-bg)}
  .ds-login-card{padding:24px 18px;border-radius:14px;width:100%;max-width:420px}
  .ds-login-prolink{top:14px;right:14px;font-size:11px;padding:5px 9px}
}

/* ─── Login full-screen : masque chrome (sidebar/topbar/cookie/mobile-nav) ─── */
/* On masque AUSSI la sidebar (pas seulement la topbar) — sinon micro-flash
   du fond bleu navy avant que le wrapper login z-index:500 ne se peigne.
   ⚠️ NE PAS toucher à .main : il contient #content où le login est rendu. */
body[data-login-screen="true"] .sidebar,
body[data-login-screen="true"] .topbar,
body[data-login-screen="true"] .mobile-bottom-nav,
body[data-login-screen="true"] .cookie-bar,
body[data-login-screen="true"] #cookie-consent,
body[data-login-screen="true"] .cookie-consent,
body[data-login-screen="true"] #info-banner,
body[data-login-screen="true"] .info-banner {
  display: none !important;
}
/* NOTE : #toast est volontairement gardé visible sur l'écran login (pas
   masqué par data-login-screen). Sans ça, les messages d'erreur d'auth
   (mauvais mdp, rate-limit, lockout) sont silencieux pour l'utilisateur
   — bug confirmé 2026-04-29. Le z-index:999 du #toast (cf. règle de base)
   passe naturellement au-dessus de .ds-login-root (z-index:500). */
/* La .main reste visible (porte #content) mais on retire son margin-left
   habituel (~210px pour la sidebar) pour qu'elle prenne toute la largeur. */
body[data-login-screen="true"] .main { margin-left: 0 !important; }
/* Le contenu login (.ds-login-root) couvre l'écran avec z-index:500 */

/* ─── Patient full-screen layout (proto ViewPatientHome) ─── */
/* Quand le rendu patient_home (renderPatientDashboard) wrap avec
   .patient-fullscreen, on masque sidebar + topbar legacy pour reproduire
   le layout proto avec juste un ProHeader minimaliste.
   ⚠️ .mobile-bottom-nav N'EST PAS masquée ici : elle est nécessaire en
   mobile (parcours patient = barre du bas iPhone-style avec logout). */
body[data-patient-fullscreen="true"] .sidebar,
body[data-patient-fullscreen="true"] .topbar,
body[data-patient-fullscreen="true"] #toast,
body[data-patient-fullscreen="true"] .cookie-bar,
body[data-patient-fullscreen="true"] #cookie-consent,
body[data-patient-fullscreen="true"] .cookie-consent,
body[data-patient-fullscreen="true"] #cookie-banner {
  display: none !important;
}
/* Sur desktop on masque tout de même la barre du bas (le header gère la nav). */
@media(min-width:769px){
  body[data-patient-fullscreen="true"] .mobile-bottom-nav{display:none !important}
}
body[data-patient-fullscreen="true"] .main {
  margin-left: 0 !important;
  background: var(--ds-bg) !important;
}
body[data-patient-fullscreen="true"] .content {
  padding: 0 !important;
  max-width: none !important;
  margin: 0 !important;
}
.patient-fullscreen {
  min-height: 100vh;
  background: var(--ds-bg);
}
.patient-fullscreen .ph-patient {
  font-family: var(--font-ui);
}

/* ─── Patient header — responsive mobile ─── */
@media(max-width:768px){
  /* Masque les éléments accessibles via la barre du bas iPhone */
  .ph-patient .ph-mobile-hide{display:none !important}
  /* Header compact en mobile */
  .ph-patient{padding:10px 14px !important;gap:10px !important}
  .ph-patient .ph-brand-name{font-size:15px !important;max-width:42vw;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  /* Pill user compactée : on garde l'avatar + chevron, on cache nom long et code (visibles dans le menu) */
  .ph-patient .ph-pill{padding:5px 8px !important;gap:5px !important}
  .ph-patient .ph-pill-name,
  .ph-patient .ph-pill-code{display:none !important}
  /* Le wrap pill prend la place restante à droite */
  .ph-patient .ph-pill-wrap{margin-left:auto}
  /* Évite tout débordement horizontal */
  .patient-fullscreen{max-width:100vw;overflow-x:hidden}

  /* Shell <main> : padding compact + place pour la barre du bas iPhone.
     !important nécessaire car le <main> a un padding inline 48px 32px 64px. */
  .pf-shell-main{
    padding:24px 14px calc(var(--mob-nav-h) + var(--mob-safe-b) + 32px) !important;
  }
  /* Utility : masque les sections accessibles via la barre du bas
     (évite la redondance — ex: rightsFooter du dashboard = onglet Compliance). */
  .pf-mobile-hide{display:none !important}

  /* ─── Patient profile (Mes données) ─── */
  .pf-grid{grid-template-columns:1fr !important;gap:14px !important}
  .pf-comm-grid{grid-template-columns:repeat(2,minmax(0,1fr)) !important;gap:8px !important}
  .pf-hero{gap:14px !important;margin-bottom:24px !important}
  .pf-hero-avatar{width:56px !important;height:56px !important;font-size:20px !important;border-radius:12px !important}
  .pf-hero-name{font-size:26px !important;line-height:1.1 !important}
  /* Cartes de profil : padding réduit + force le break des longues valeurs */
  .pf-grid .ds-card-flat{padding:18px 16px !important}
  .pf-grid .ds-card-flat input.fi{max-width:100% !important}

  /* ─── Patient rights (Conformité) ─── */
  .lgpd-hero{gap:14px !important;margin-bottom:24px !important;align-items:center !important}
  .lgpd-hero-icon{width:52px !important;height:52px !important;border-radius:12px !important}
  .lgpd-hero-icon .material-symbols-outlined{font-size:24px !important}
  .lgpd-hero-name{font-size:26px !important;line-height:1.1 !important}
  /* KPIs en grille 2x2 au lieu de 1x4 */
  #lgpd-kpi-grid{grid-template-columns:repeat(2,minmax(0,1fr)) !important;gap:10px !important;margin-bottom:20px !important}
  #lgpd-kpi-grid > div{padding:14px !important;min-height:auto !important;gap:10px !important}
  #lgpd-kpi-grid .ds-editorial{font-size:26px !important}
  /* Tabs : laisser le scroll horizontal natif sans flex:1 qui les écrase */
  .lgpd-tabs{padding:5px !important;gap:2px !important;margin-bottom:18px !important}
  .lgpd-tabs .lgpd-tab-btn{flex:0 0 auto !important;padding:9px 14px !important;font-size:12.5px !important}
  /* "Vos droits" : 1 colonne au lieu de 2 */
  .lgpd-rights-grid{grid-template-columns:1fr !important;gap:18px !important}
  .lgpd-rights-card{padding:18px 16px !important}

  /* ─── Surgeon + Admin mobile : sidebar/burger cachés, barre du bas iPhone
     à la place (cf. renderMobileBottomNav). main étalée 100% sans
     margin-left. Active quand body[data-surgeon-fullscreen='true'] (surgeon)
     OU body[data-admin-fullscreen='true'] (admin). */
  body[data-surgeon-fullscreen="true"] .sidebar,
  body[data-surgeon-fullscreen="true"] .tb-hamburger,
  body[data-surgeon-fullscreen="true"] #cookie-consent,
  body[data-surgeon-fullscreen="true"] .cookie-consent,
  body[data-surgeon-fullscreen="true"] #info-banner,
  body[data-surgeon-fullscreen="true"] .info-banner,
  body[data-admin-fullscreen="true"] .sidebar,
  body[data-admin-fullscreen="true"] .tb-hamburger,
  body[data-admin-fullscreen="true"] #cookie-consent,
  body[data-admin-fullscreen="true"] .cookie-consent,
  body[data-admin-fullscreen="true"] #info-banner,
  body[data-admin-fullscreen="true"] .info-banner {
    display: none !important;
  }
  body[data-surgeon-fullscreen="true"] .main,
  body[data-admin-fullscreen="true"] .main {
    margin-left: 0 !important;
    padding-bottom: calc(var(--mob-nav-h) + var(--mob-safe-b) + 12px) !important;
  }
  /* Topbar surgeon + admin : on garde uniquement back + titre + theme + lang
     + notif. Le reste (breadcrumb, search, study-select, app-menu, clock,
     unlock-timer, side-indicator) est caché — accessible via la barre du
     bas iPhone-style ou les écrans dédiés. */
  body[data-surgeon-fullscreen="true"] .topbar,
  body[data-admin-fullscreen="true"] .topbar{
    padding:8px 12px !important;gap:6px !important;
  }
  body[data-surgeon-fullscreen="true"] #tb-breadcrumb,
  body[data-surgeon-fullscreen="true"] #tb-search-icon,
  body[data-surgeon-fullscreen="true"] #tb-study-select,
  body[data-surgeon-fullscreen="true"] #tb-app-menu,
  body[data-surgeon-fullscreen="true"] #tb-clock,
  body[data-surgeon-fullscreen="true"] #tb-unlock-timer,
  body[data-surgeon-fullscreen="true"] #tb-side-indicator,
  body[data-surgeon-fullscreen="true"] #tb-sub,
  body[data-admin-fullscreen="true"] #tb-breadcrumb,
  body[data-admin-fullscreen="true"] #tb-search-icon,
  body[data-admin-fullscreen="true"] #tb-study-select,
  body[data-admin-fullscreen="true"] #tb-app-menu,
  body[data-admin-fullscreen="true"] #tb-clock,
  body[data-admin-fullscreen="true"] #tb-unlock-timer,
  body[data-admin-fullscreen="true"] #tb-side-indicator,
  body[data-admin-fullscreen="true"] #tb-sub{
    display:none !important;
  }
  body[data-surgeon-fullscreen="true"] #tb-title,
  body[data-admin-fullscreen="true"] #tb-title{
    font-size:16px !important;font-weight:600 !important;
    overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:50vw;
  }
  /* Dashboard surgeon : grids multi-colonnes empilées en 1 colonne mobile.
     Les statistiques sont rendues en 1er dans le HTML, donc l'ordre vertical
     respecte l'ordre déjà voulu (stats → timeline → autres sections). */
  body[data-surgeon-fullscreen="true"] .surg-mobile-stack{
    grid-template-columns:1fr !important;
    gap:12px !important;
  }
  /* Mes patientes : tableau caché en mobile, cards à la place */
  body[data-surgeon-fullscreen="true"] .surg-patients-table-wrap{
    display:none !important;
  }
  body[data-surgeon-fullscreen="true"] .surg-patients-cards{
    display:flex !important;
  }
  /* Agenda + autres écrans surgeon : cards plus compactes en mobile pour
     limiter le padding latéral excessif (13px 22px → 10px 14px). */
  body[data-surgeon-fullscreen="true"] .content > .card,
  body[data-surgeon-fullscreen="true"] .main .card{
    margin-left:0;margin-right:0;
  }
  body[data-surgeon-fullscreen="true"] .content{
    padding:14px 12px !important;
  }
  /* Titres éditoriaux (h1) du surgeon plus petits en mobile (sinon ils
     prennent toute la hauteur de l'écran). */
  body[data-surgeon-fullscreen="true"] .ds-editorial{
    font-size:clamp(22px, 5vw, 28px) !important;
    line-height:1.15 !important;
  }

  /* ─── Panel détail patient (slider) en mobile ─── */
  /* Le panel passe en PLEIN ÉCRAN au lieu du slide 50% desktop. La barre du
     bas iPhone du surgeon est cachée pendant l'ouverture (sinon double nav).
     Le bouton "Toutes les patientes" devient une simple flèche retour ←. */
  body[data-patient-panel-open="true"] #patient-detail-panel{
    width:100vw !important;
    max-width:100vw !important;
    border-left:none !important;
    box-shadow:none !important;
  }
  body[data-patient-panel-open="true"] #patient-detail-backdrop{
    display:none !important;
  }
  body[data-patient-panel-open="true"] #mobile-bottom-nav,
  body[data-patient-panel-open="true"] #v5-dock{
    display:none !important;
  }
  /* Flèche minimize/expand sur le côté : inutile en plein écran mobile */
  body[data-patient-panel-open="true"] #patient-detail-mintab{
    display:none !important;
  }
  /* Header compact : padding réduit + composants internes plus petits */
  body[data-patient-panel-open="true"] .patient-detail-header{
    padding:8px 12px !important;
  }
  body[data-patient-panel-open="true"] .patient-detail-back .pdb-label{
    display:none !important;
  }
  /* Top row (back / impersonate / lock / close) : marge inférieure réduite,
     boutons impersonate + lock cachés (rarement utilisés en mobile, restent
     accessibles via la navigation admin standard). */
  body[data-patient-panel-open="true"] .patient-detail-header > div:nth-child(2){
    margin-bottom:6px !important;gap:6px !important;
  }
  body[data-patient-panel-open="true"] .patient-detail-header > div:nth-child(2) .btn-primary,
  body[data-patient-panel-open="true"] .patient-detail-header > div:nth-child(2) .btn-sm:not(.patient-detail-back):not([data-action="_appClosePatientDetail"]){
    display:none !important;
  }
  /* Avatar 64→36, h1 22→17, meta grid 4→2 cols compact, schéma côté caché
     (visible dans le pill côté + tab dédié). */
  body[data-patient-panel-open="true"] .patient-detail-header > div:last-child > div:first-child{
    width:36px !important;height:36px !important;font-size:13px !important;border-radius:9px !important;
  }
  body[data-patient-panel-open="true"] .patient-detail-header h1{
    font-size:17px !important;
  }
  /* Meta grid mobile : 2 cols, font/gap réduits, et on cache Chirurgien +
     Centre car le chirurgien connait déjà son contexte (sa propre identité +
     son centre). Ne reste que Identité (la patiente) + Inclusion (date). */
  body[data-patient-panel-open="true"] .pdh-meta-grid{
    grid-template-columns:repeat(2, minmax(0, 1fr)) !important;
    gap:5px 10px !important;margin-top:6px !important;
  }
  body[data-patient-panel-open="true"] .pdh-meta-surgeon,
  body[data-patient-panel-open="true"] .pdh-meta-center{
    display:none !important;
  }
  body[data-patient-panel-open="true"] .pdh-meta-item > div:first-child{
    font-size:9px !important;margin-bottom:1px !important;
  }
  body[data-patient-panel-open="true"] .pdh-meta-item > div:last-child{
    font-size:11.5px !important;
  }
  /* Wrapper avatar+meta : gap réduit */
  body[data-patient-panel-open="true"] .patient-detail-header > div:last-child{
    gap:10px !important;
  }
  /* Schéma "côté opéré" mini-card desktop → caché (remplacé par le pill compact) */
  body[data-patient-panel-open="true"] .pdh-side-block{
    display:none !important;
  }
  /* Pill côté opéré : visible UNIQUEMENT sur mobile (l'inverse du sideMiniBlock) */
  body[data-patient-panel-open="true"] .pdh-side-pill{
    display:inline-flex !important;
  }
  /* Vue 360° : 1 colonne au lieu de 1.5fr/1fr (trop étroit en mobile) */
  body[data-patient-panel-open="true"] .pdt-overview-grid{
    grid-template-columns:1fr !important;
    gap:12px !important;
  }
  /* Tabs inline (à l'intérieur du panel) cachés sur mobile : remplacés par
     le dock flottant #patient-tabs-mobile-dock attaché à body (cf. JS
     _renderPatientPanelMobileDock). Le panel a un transform pour son slide-in,
     donc les position:fixed enfants ne s'ancrent pas au viewport → le dock
     DOIT être hors du panel pour être visible et cliquable correctement. */
  body[data-patient-panel-open="true"] .patient-detail-tabs{
    display:none !important;
  }
  /* Dock flottant style dock-v5, attaché à body. Visible sur mobile uniquement
     pendant que le panel patient est ouvert. z-index 1100 = au-dessus du
     panel (1000) et de l'éventuel modal-overlay scanner QR. Composé de
     ds-dock + ds-dock-item (mêmes classes que le menu chirurgien principal). */
  #patient-tabs-mobile-dock{
    position:fixed;left:8px;right:8px;
    bottom:calc(8px + var(--mob-safe-b));
    z-index:1100;
    pointer-events:none;
    display:flex;justify-content:center;
  }
  #patient-tabs-mobile-dock .ds-dock{
    pointer-events:auto;
    width:100%;max-width:100%;
    border-radius:18px;padding:4px 6px;
    /* Scroll horizontal au lieu de compression : 9 onglets ne tiennent pas
       en largeur 360-414px — laisser leur taille naturelle et scroller. */
    overflow-x:auto;-webkit-overflow-scrolling:touch;
    scrollbar-width:none;
    justify-content:flex-start !important;
    gap:2px;
  }
  #patient-tabs-mobile-dock .ds-dock::-webkit-scrollbar{display:none}
  #patient-tabs-mobile-dock .ds-dock-item{
    /* flex:0 0 auto : ne pas shrink, garder la taille naturelle de l'item.
       Scroll horizontal géré par le parent .ds-dock. */
    flex:0 0 auto;padding:8px 14px;min-width:60px;
  }
  #patient-tabs-mobile-dock .ds-dock-item .ds-dock-item-label{font-size:10px}
  body[data-patient-panel-open="true"] .patient-detail-tabs .pdt-tab{
    flex:0 0 auto !important;text-align:center;padding:7px 14px !important;
    border:0 !important;border-radius:18px !important;
    font-size:12px !important;font-weight:500 !important;
    margin:0 !important;line-height:1.2;
    background:transparent !important;color:var(--ds-fg-muted) !important;
    transition:background 140ms, color 140ms;
  }
  body[data-patient-panel-open="true"] .patient-detail-tabs .pdt-tab.active{
    background:var(--brand-teal-500) !important;
    color:#fff !important;
    font-weight:600 !important;
  }
  /* Body scrollable + padding-bottom pour dégager l'espace du dock flottant
     mobile (#patient-tabs-mobile-dock, ~64px de hauteur en bas). */
  body[data-patient-panel-open="true"] #patient-detail-panel > div:last-child{
    padding-bottom:calc(72px + var(--mob-safe-b)) !important;
  }
  /* Top bar : flèche "Toutes les patientes" (.patient-detail-back) cachée sur
     mobile car redondante avec le bouton ✕ Close juste à droite. Le label texte
     était déjà caché (.pdb-label) — on cache aussi l'icône retour. */
  body[data-patient-panel-open="true"] .patient-detail-back{
    display:none !important;
  }
  /* Tab Implants — Procédure opératoire : 3 colonnes (côté/voie/plan) en
     1 colonne sur mobile (380px ne tient pas 3 schémas SVG). */
  body[data-patient-panel-open="true"] .pdt-procedure-visuals{
    grid-template-columns:1fr !important;
  }
  /* Tables responsives — pattern data-table → cards verticales empilées sur
     mobile. Réutilisable : ajouter class="pdt-stack-mobile" sur la <table>
     ET data-label="..." sur chaque <td>. Le thead est caché, chaque td
     devient une ligne "label: value" via ::before(attr(data-label)).
     Utilisé par : Implants posés, Visites, Questionnaires (et autres). */
  body[data-patient-panel-open="true"] .pdt-stack-mobile thead{
    display:none !important;
  }
  body[data-patient-panel-open="true"] .pdt-stack-mobile,
  body[data-patient-panel-open="true"] .pdt-stack-mobile tbody,
  body[data-patient-panel-open="true"] .pdt-stack-mobile tr,
  body[data-patient-panel-open="true"] .pdt-stack-mobile td{
    display:block !important;width:100% !important;table-layout:auto !important;
  }
  body[data-patient-panel-open="true"] .pdt-stack-mobile colgroup,
  body[data-patient-panel-open="true"] .pdt-stack-mobile col{
    display:none !important;
  }
  body[data-patient-panel-open="true"] .pdt-stack-mobile tr{
    border:1px solid var(--ds-border) !important;border-radius:10px !important;
    margin:12px !important;padding:8px 12px !important;
    background:var(--ds-bg-elevated);
  }
  body[data-patient-panel-open="true"] .pdt-stack-mobile td{
    padding:6px 0 !important;text-align:left !important;
    border:none !important;border-bottom:1px solid var(--ds-border) !important;
    display:flex !important;justify-content:space-between !important;align-items:center;
    gap:12px;
    min-width:0;
  }
  body[data-patient-panel-open="true"] .pdt-stack-mobile tr td:last-child{
    border-bottom:none !important;
  }
  body[data-patient-panel-open="true"] .pdt-stack-mobile td::before{
    content:attr(data-label);
    color:var(--ds-fg-muted);font-size:10.5px;
    text-transform:uppercase;letter-spacing:0.06em;font-weight:500;
    flex-shrink:0;
  }
  /* td sans data-label = case "vide" → on cache la ligne (évite "Actions ▶ rien") */
  body[data-patient-panel-open="true"] .pdt-stack-mobile td:not([data-label]):empty{
    display:none !important;
  }
  /* Classe générique pour cacher une colonne donnée sur mobile uniquement.
     Apposable sur <th> ET <td>. Utilisé dans Questionnaires (col Score). */
  body[data-patient-panel-open="true"] .pdt-hide-mobile{
    display:none !important;
  }
  /* Header "Voir étape" mobile : compresser. Le back devient icône-seule, le
     reload + reopen du top sont cachés (déjà disponibles dans le body, en bas
     du recap). Le titre prend l'espace libéré et reste visible. */
  body[data-patient-panel-open="true"] .pd-stage-header{
    padding:10px 14px !important;gap:8px !important;
  }
  body[data-patient-panel-open="true"] .pd-stage-back-label{
    display:none !important;
  }
  body[data-patient-panel-open="true"] .pd-stage-back-btn{
    padding:6px 8px !important;flex-shrink:0;
  }
  body[data-patient-panel-open="true"] .pd-stage-reload-wrap,
  body[data-patient-panel-open="true"] .pd-stage-reopen-wrap{
    display:none !important;
  }
  /* Titre étape : visible, sur 2 lignes max si trop long */
  body[data-patient-panel-open="true"] .pd-stage-title-wrap{
    text-align:left !important;
    overflow:hidden;
  }
  body[data-patient-panel-open="true"] .pd-stage-title{
    font-size:12px !important;
    white-space:normal !important;line-height:1.3;
    display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;
    overflow:hidden;
  }
  /* BREAST-Q : table pivotée non stackable. Force scroll horizontal +
     fade-edge à droite pour signaler le scroll au doigt. */
  body[data-patient-panel-open="true"] .pdt-bq-scroll{
    position:relative;
    /* Fade-out à droite : signale visuellement qu'il y a du contenu hors-écran */
    -webkit-mask-image:linear-gradient(to right, #000 0, #000 calc(100% - 24px), rgba(0,0,0,0.3) 100%);
    mask-image:linear-gradient(to right, #000 0, #000 calc(100% - 24px), rgba(0,0,0,0.3) 100%);
  }
  body[data-patient-panel-open="true"] .pdt-bq-scroll table{
    font-size:12px !important;
  }
  body[data-patient-panel-open="true"] .pdt-bq-scroll th,
  body[data-patient-panel-open="true"] .pdt-bq-scroll td{
    padding:8px 10px !important;
    min-width:auto !important;
  }
  /* Quand le panel patient (z-index:1000) est ouvert, les modales (z-index:500
     par défaut) sont rendues sous le panel et invisibles. Bumper au-dessus du
     panel pour qu'elles s'affichent. Cas typique : scanner QR implant ouvert
     depuis la stage procédure dans le panel. */
  body[data-patient-panel-open="true"] .modal-overlay{
    z-index:1100 !important;
  }

  /* ─── Typeform questionnaire (visit-stage-*) ─── */
  /* Header compact : padding réduit, cache nom de l'étude (logo seul),
     cache l'autosave label texte (icône succès reste via JS), bouton Quitter
     icône-seule. */
  .tf-header{padding:10px 12px !important;gap:8px !important}
  .tf-brand-name{display:none !important}
  .tf-progress{gap:8px !important;max-width:none !important;margin:0 !important}
  .tf-progress-num{min-width:38px !important;font-size:11px !important}
  .tf-autosave{min-width:0 !important;font-size:0 !important}
  .tf-autosave .material-symbols-outlined{font-size:18px !important;color:var(--success-700)}
  .tf-exit-btn{padding:6px 8px !important;min-height:0 !important}
  .tf-exit-label{display:none !important}
  /* Question titre plus petit pour tenir sur écrans étroits */
  .tf-center{padding:24px 16px !important}
  .tf-question-title{font-size:26px !important;line-height:1.2 !important}
  /* Footer compact + safe-area pour iOS Safari (la barre d'adresse cache
     parfois le footer fixe → bouton Suivant invisible). On force position
     sticky bottom + padding-bottom = safe-area-inset-bottom pour que le
     footer reste au-dessus de la home indicator + barre Safari rétractable. */
  .tf-footer{
    padding:12px 14px calc(12px + var(--mob-safe-b, env(safe-area-inset-bottom, 0px))) !important;
    position:sticky !important;bottom:0 !important;z-index:50 !important;
    background:var(--ds-bg) !important;
  }
  .tf-keyboard-hint{display:none !important}
  .tf-prev-btn,.tf-next-btn{padding:12px 16px !important;min-height:0 !important;min-width:0 !important}
  .tf-prev-label{display:none !important}

  /* Scale 3/4/5 : sur mobile, on passe en colonne verticale (carte par ligne)
     avec icon + label en horizontal, comme les boutons yes/no. Ça résout le
     débordement de scale5 (5 × 170px = 938px largeur > 390px viewport). */
  .tf-scale-row{
    grid-template-columns:1fr !important;
    gap:8px !important;
    max-width:520px;margin-left:auto;margin-right:auto;
  }
  .tf-scale-row .tf-face-card{
    aspect-ratio:auto !important;
    flex-direction:row !important;
    align-items:center !important;
    justify-content:flex-start !important;
    gap:14px !important;
    padding:12px 16px !important;
    text-align:left !important;
  }
  .tf-scale-row .tf-face-icon{
    width:44px !important;height:44px !important;padding:8px !important;
    flex-shrink:0;
  }
  .tf-scale-row .tf-face-card .ds-editorial{
    text-align:left !important;
    margin-top:0 !important;
    font-size:14.5px !important;
    flex:1;
  }
}
