.protected-movement{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:34px;
  height:34px;
  border-radius:10px;
  background:rgba(15,118,110,.10);
  color:#0f766e;
  cursor:not-allowed;
  user-select:none;
}

.dark .protected-movement{
  background:rgba(45,212,191,.14);
  color:#5eead4;
}
:root{
  --primary:#0f766e;
  --primary-dark:#0b5f59;
  --secondary:#2563eb;
  --accent:#f59e0b;
  --bg:#f3f7fb;
  --bg-soft:#eef6f8;
  --card:#ffffff;
  --card-2:#f8fbfd;
  --text:#14212b;
  --muted:#667085;
  --border:#d8e2e8;
  --danger:#dc2626;
  --warning:#d97706;
  --ok:#059669;
  --sidebar:260px;
  --shadow:0 14px 34px rgba(15,23,42,.10);
  --shadow-soft:0 6px 18px rgba(15,23,42,.06);
}
*{box-sizing:border-box}
body{margin:0;font-family:Inter,Segoe UI,Roboto,Arial,sans-serif;background:var(--bg);color:var(--text)}
button,input,textarea,select{font:inherit}
button{cursor:pointer}
h1,h2,p{margin-top:0}
.hidden{display:none!important}
.muted{color:var(--muted)}
.compact{margin-bottom:0}
.sidebar{
  position:fixed;inset:0 auto 0 0;width:var(--sidebar);background:#0d2f2d;color:#fff;
  padding:18px;display:flex;flex-direction:column;z-index:20
}
.sidebar-brand{display:flex;align-items:center;gap:12px;padding:8px 10px 24px}
.sidebar-brand small{display:block;color:#b8d2cf;margin-top:3px}
.brand-mark{
  width:42px;height:42px;border-radius:13px;display:grid;place-items:center;
  background:#fff;color:var(--primary);font-weight:900
}
.sidebar nav{display:grid;gap:7px}
.nav-btn{
  width:100%;text-align:left;border:0;background:transparent;color:#d7e8e6;
  padding:12px;border-radius:10px
}
.nav-btn:hover,.nav-btn.active{background:rgba(255,255,255,.11);color:#fff}
.app-shell{margin-left:var(--sidebar);min-height:100vh}
.topbar{
  height:82px;background:#fff;border-bottom:1px solid var(--border);
  display:flex;align-items:center;justify-content:space-between;padding:14px 28px;
  position:sticky;top:0;z-index:10
}
.topbar h1{font-size:22px;margin-bottom:4px}
.top-actions{display:flex;align-items:center;gap:10px}
.status-pill{
  padding:7px 10px;border-radius:999px;font-size:13px;background:#e6fffb;color:var(--primary-dark)
}
.content{padding:26px}
.view{display:none}
.view.active{display:block}
.cards{display:grid;grid-template-columns:repeat(4,1fr);gap:16px;margin-bottom:20px}
.stat-card,.panel{
  background:#fff;border:1px solid var(--border);border-radius:16px;
  box-shadow:0 4px 14px rgba(16,24,40,.04)
}
.stat-card{padding:20px}
.stat-card span{color:var(--muted);font-size:14px}
.stat-card strong{display:block;font-size:32px;margin-top:8px}
.panel-head{padding:18px 20px;border-bottom:1px solid var(--border)}
.panel-head h2{margin:0;font-size:17px}
.padded{padding:22px}
.toolbar{display:flex;gap:10px;align-items:center;margin-bottom:14px;flex-wrap:wrap}
.toolbar input{max-width:260px}
.toolbar .btn:last-child{margin-left:auto}
input,textarea,select,.select-field{
  width:100%;padding:12px 13px;border:1px solid var(--border);border-radius:11px;
  background:#fff;color:var(--text);outline:none
}
.select-field{text-align:left}
input:focus,textarea:focus,select:focus,.select-field:focus{
  border-color:var(--primary);box-shadow:0 0 0 3px rgba(15,118,110,.12)
}
.btn{border:0;border-radius:11px;padding:11px 16px;font-weight:700}
.btn.primary{background:var(--primary);color:#fff}
.btn.primary:hover{background:var(--primary-dark)}
.btn.secondary{background:#eef2f3;color:#24323a}
.btn.danger{background:#fee4e2;color:var(--danger)}
.icon-btn{border:0;background:transparent;padding:8px}
.table-wrap{overflow:auto}
table{width:100%;border-collapse:collapse;min-width:820px}
th,td{padding:13px 14px;border-bottom:1px solid var(--border);text-align:left;font-size:14px}
th{background:#f8fafb;color:#52616a;font-size:12px;text-transform:uppercase;letter-spacing:.03em}
.badge{display:inline-flex;padding:5px 9px;border-radius:999px;font-size:12px;font-weight:700}
.badge.urgent{background:#fee4e2;color:var(--danger)}
.badge.necessary{background:#fff4e5;color:var(--warning)}
.badge.satisfactory{background:#dcfae6;color:var(--ok)}
.badge.entry{background:#dcfae6;color:var(--ok)}
.badge.exit{background:#fee4e2;color:var(--danger)}
.row-actions{display:flex;gap:5px}
.row-actions button{border:0;background:#eef2f3;border-radius:8px;padding:7px}
.settings-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:18px}
dialog{
  border:0;border-radius:18px;padding:0;width:min(560px,calc(100% - 28px));
  box-shadow:var(--shadow)
}
dialog::backdrop{background:rgba(3,18,17,.55)}
.dialog-form{padding:22px;display:grid;gap:16px}
.dialog-head{display:flex;align-items:center;justify-content:space-between}
.dialog-head h2{margin:0;font-size:20px}
.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:13px}
.dialog-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:5px}
.choice-list{display:grid;gap:8px;max-height:55vh;overflow:auto}
.choice-list button{
  border:1px solid var(--border);background:#fff;border-radius:10px;
  padding:12px;text-align:left
}
.choice-list button:hover{background:#f0fdfa;border-color:var(--primary)}
.toast-stack{position:fixed;right:18px;bottom:18px;z-index:1000;display:grid;gap:10px;width:min(420px,calc(100vw - 28px));pointer-events:none}
.toast-item{display:grid;grid-template-columns:34px 1fr 28px;align-items:start;gap:10px;padding:13px 12px;border:1px solid var(--border);border-left:5px solid #2563eb;border-radius:14px;background:var(--card);color:var(--text);box-shadow:0 16px 38px rgba(15,23,42,.22);opacity:0;transform:translateY(14px);transition:.2s ease;pointer-events:auto}
.toast-item.show{opacity:1;transform:none}.toast-item.success{border-left-color:#16a34a}.toast-item.error{border-left-color:#dc2626}.toast-item.warning{border-left-color:#d97706}.toast-item.info{border-left-color:#2563eb}
.toast-icon{display:grid;place-items:center;width:30px;height:30px;border-radius:50%;background:var(--bg-soft);font-weight:900}.toast-item.success .toast-icon{color:#15803d;background:#dcfce7}.toast-item.error .toast-icon{color:#b91c1c;background:#fee2e2}.toast-item.warning .toast-icon{color:#92400e;background:#fef3c7}.toast-item.info .toast-icon{color:#1d4ed8;background:#dbeafe}
.toast-content{display:grid;gap:3px;line-height:1.35}.toast-content strong{font-size:.92rem}.toast-content span{font-size:.86rem;color:var(--muted)}.toast-close{border:0;background:transparent;color:var(--muted);font-size:1.3rem;line-height:1;cursor:pointer;padding:0}
@media(max-width:600px){.toast-stack{right:10px;left:10px;bottom:10px;width:auto}}
.popover{
  position:fixed;z-index:50;background:#fff;border:1px solid var(--border);
  border-radius:10px;box-shadow:var(--shadow);padding:6px;min-width:170px
}
.popover button{
  display:block;width:100%;border:0;background:#fff;text-align:left;
  padding:10px;border-radius:7px
}
.popover button:hover{background:#f2f5f6}
.mobile-only{display:none}
.empty-state{text-align:center;color:var(--muted);padding:24px}
@media(max-width:1000px){
  .settings-grid{grid-template-columns:1fr}
}
@media(max-width:900px){
  .cards{grid-template-columns:1fr 1fr}
  .sidebar-backdrop{display:block}
  .sidebar{transform:translateX(-100%);transition:.2s}
  .sidebar.open{transform:none}
  .app-shell{margin-left:0}
  .mobile-only{display:block}
  .topbar{padding:12px 16px}
  .content{padding:16px}
}
@media(max-width:650px){
  .cards{grid-template-columns:1fr 1fr}
  #view-dashboard table{min-width:0}
  #view-dashboard th,#view-dashboard td{padding:11px 10px;font-size:12px}
  #view-dashboard th:nth-child(3),#view-dashboard td:nth-child(3){display:none}
  .topbar{align-items:flex-start;height:auto;min-height:82px}
  .topbar h1{font-size:20px}
  .topbar .muted{font-size:13px;max-width:240px}
  .status-pill{font-size:12px;white-space:nowrap}
  .form-grid{grid-template-columns:1fr}
  .toolbar input{max-width:none;flex:1 1 100%}
  .toolbar .btn:last-child{margin-left:0}
}
@media print{
  .sidebar,.topbar,.toolbar,.row-actions{display:none!important}
  .app-shell{margin:0}
  .content{padding:0}
  .view{display:none!important}
  .view.print-target{display:block!important}
  .panel{border:0;box-shadow:none}
  body{background:#fff}
}


/* Correctifs interface mobile */
.sidebar-backdrop{
  position:fixed;inset:0;background:rgba(3,18,17,.42);z-index:19;
  opacity:0;visibility:hidden;transition:.2s
}
.sidebar-backdrop.show{opacity:1;visibility:visible}

.stat-card{
  position:relative;overflow:hidden;
  border-top:4px solid transparent;
}
.stat-card::after{
  content:"";position:absolute;right:-24px;bottom:-34px;width:105px;height:105px;
  border-radius:50%;opacity:.10;background:currentColor
}
.stat-medicines{border-top-color:#2563eb;color:#1d4ed8}
.stat-low{border-top-color:#dc2626;color:#b91c1c}
.stat-entry{border-top-color:#059669;color:#047857}
.stat-exit{border-top-color:#d97706;color:#b45309}
.stat-card span{color:#667085}
.stat-card strong{color:var(--text)}

#view-dashboard .panel{overflow:hidden}
#view-dashboard table{min-width:100%}
#view-dashboard th,#view-dashboard td{white-space:normal}


/* ===== Thème sombre et finition visuelle ===== */
body{
  background:
    radial-gradient(circle at 10% 0%, rgba(37,99,235,.08), transparent 30%),
    radial-gradient(circle at 90% 10%, rgba(15,118,110,.10), transparent 30%),
    var(--bg);
}
body.dark{
  --bg:#0f1720;
  --bg-soft:#111d27;
  --card:#17232d;
  --card-2:#1b2a35;
  --text:#edf7f6;
  --muted:#a8bac3;
  --border:#2b3f4b;
  --primary:#2dd4bf;
  --primary-dark:#14b8a6;
  --secondary:#60a5fa;
  --accent:#fbbf24;
  --danger:#f87171;
  --warning:#f59e0b;
  --ok:#34d399;
  --shadow:0 18px 40px rgba(0,0,0,.35);
  --shadow-soft:0 8px 22px rgba(0,0,0,.22);
}

body.dark .topbar,
body.dark .panel,
body.dark .stat-card,
body.dark dialog,
body.dark input,
body.dark textarea,
body.dark select,
body.dark .select-field,
body.dark .choice-list button,
body.dark .popover,
body.dark .popover button{
  background:var(--card);
  color:var(--text);
}
body.dark th{background:var(--card-2);color:#c8d7de}
body.dark td{color:var(--text)}
body.dark .btn.secondary{background:#243641;color:#eef7f7}
body.dark .status-pill{background:#183d3a;color:#8bf1e6}
body.dark .toolbar input::placeholder,
body.dark input::placeholder,
body.dark textarea::placeholder{color:#7f96a1}
body.dark .sidebar{background:linear-gradient(180deg,#0a2423,#0d312f)}
body.dark .nav-btn.active{background:rgba(45,212,191,.16)}
body.dark .toast-item{background:#081014}
body.dark .popover button:hover,
body.dark .choice-list button:hover{background:#21333d}

.theme-btn{
  width:42px;height:42px;border-radius:13px;border:1px solid var(--border);
  background:var(--card);display:grid;place-items:center;font-size:19px;
  box-shadow:var(--shadow-soft);transition:.2s
}
.theme-btn:hover{transform:translateY(-1px)}

.sidebar{
  background:
    linear-gradient(180deg,rgba(255,255,255,.03),transparent 35%),
    linear-gradient(180deg,#0d3b38,#0a2f2d);
  box-shadow:12px 0 32px rgba(4,47,46,.12)
}
.sidebar-brand{border-bottom:1px solid rgba(255,255,255,.08);margin-bottom:14px}
.brand-mark{
  background:linear-gradient(135deg,#ffffff,#dffcf8);
  box-shadow:0 8px 20px rgba(0,0,0,.18)
}
.nav-btn{transition:.2s}
.nav-btn:hover{transform:translateX(3px)}

.topbar{
  background:rgba(255,255,255,.92);
  backdrop-filter:blur(16px);
  box-shadow:0 3px 16px rgba(15,23,42,.04)
}
body.dark .topbar{background:rgba(23,35,45,.92)}

.stat-card{
  box-shadow:var(--shadow-soft);
  transition:transform .2s, box-shadow .2s;
  background:linear-gradient(145deg,var(--card),var(--card-2))
}
.stat-card:hover{transform:translateY(-3px);box-shadow:var(--shadow)}
.stat-card span{font-weight:700}
.stat-card strong{letter-spacing:-.03em}
.stat-medicines{background:linear-gradient(145deg,#eff6ff,#ffffff)}
.stat-low{background:linear-gradient(145deg,#fff1f2,#ffffff)}
.stat-entry{background:linear-gradient(145deg,#ecfdf5,#ffffff)}
.stat-exit{background:linear-gradient(145deg,#fff7ed,#ffffff)}
body.dark .stat-medicines{background:linear-gradient(145deg,#172d43,#17232d)}
body.dark .stat-low{background:linear-gradient(145deg,#3b2026,#17232d)}
body.dark .stat-entry{background:linear-gradient(145deg,#16342d,#17232d)}
body.dark .stat-exit{background:linear-gradient(145deg,#3b2d1b,#17232d)}

.panel{
  box-shadow:var(--shadow-soft);
  background:linear-gradient(180deg,var(--card),var(--card-2))
}
.btn{transition:.2s}
.btn:hover{transform:translateY(-1px)}
.btn.primary{
  background:linear-gradient(135deg,var(--primary),var(--primary-dark));
  box-shadow:0 8px 18px rgba(15,118,110,.22)
}
.btn.danger{border:1px solid rgba(220,38,38,.12)}
dialog{background:var(--card);color:var(--text)}
.dialog-head h2{font-weight:800}
.choice-list button{box-shadow:0 2px 8px rgba(15,23,42,.03)}

@media(max-width:650px){
  .top-actions{gap:7px}
  .theme-btn{width:38px;height:38px}
  .status-pill{padding:7px 9px}
}


/* ===== Correctifs v1.3 ===== */
.icon-btn,
.mobile-only{
  color:var(--text);
}
body.dark .icon-btn,
body.dark .mobile-only{
  color:#f8fafc;
}
body.dark #menuBtn{
  background:#20313b;
  border:1px solid #334955;
  border-radius:11px;
}

/* Couleurs des choix d’alerte */
.choice-list button.choice-urgent{
  background:#fff1f2;
  border-color:#fecdd3;
  color:#b91c1c;
  font-weight:800;
}
.choice-list button.choice-necessary{
  background:#fff7ed;
  border-color:#fed7aa;
  color:#b45309;
  font-weight:800;
}
.choice-list button.choice-satisfactory{
  background:#ecfdf5;
  border-color:#a7f3d0;
  color:#047857;
  font-weight:800;
}
.choice-list button.choice-all{
  background:#eff6ff;
  border-color:#bfdbfe;
  color:#1d4ed8;
  font-weight:800;
}

body.dark .choice-list button.choice-urgent{
  background:#3a2028;
  border-color:#7f1d1d;
  color:#fca5a5;
}
body.dark .choice-list button.choice-necessary{
  background:#3a2b1d;
  border-color:#92400e;
  color:#fbbf24;
}
body.dark .choice-list button.choice-satisfactory{
  background:#17352e;
  border-color:#065f46;
  color:#6ee7b7;
}
body.dark .choice-list button.choice-all{
  background:#1d2f46;
  border-color:#1d4ed8;
  color:#93c5fd;
}


/* ===== CS STOCK v2.0 : en-tête et navigation mobile ===== */
.topbar{
  min-height:88px;
  height:auto;
  padding:14px 22px;
  gap:18px;
}
.topbar-main{
  display:flex;
  align-items:center;
  gap:16px;
  min-width:0;
  flex:1;
}
.page-heading{
  min-width:0;
}
.page-heading h1{
  margin:0 0 5px;
  line-height:1.15;
  letter-spacing:-.02em;
}
.page-heading p{
  line-height:1.4;
}
.menu-trigger{
  flex:0 0 auto;
  width:46px;
  height:46px;
  padding:0;
  border:1px solid var(--border);
  border-radius:14px;
  background:var(--card);
  color:var(--text);
  align-items:center;
  justify-content:center;
  box-shadow:var(--shadow-soft);
  transition:transform .18s ease, background .18s ease, border-color .18s ease;
}
.menu-trigger:hover,
.menu-trigger:active{
  transform:scale(.97);
  background:var(--card-2);
  border-color:var(--primary);
}
.menu-trigger svg{
  width:25px;
  height:25px;
  fill:none;
  stroke:currentColor;
  stroke-width:2;
  stroke-linecap:round;
}
body.dark .menu-trigger{
  background:#1e303b;
  color:#f8fafc;
  border-color:#37505e;
}
body.dark .menu-trigger:hover,
body.dark .menu-trigger:active{
  background:#263c48;
  border-color:var(--primary);
}
.nav-btn{
  display:flex;
  align-items:center;
  gap:13px;
  font-size:16px;
}
.nav-icon{
  width:28px;
  height:28px;
  flex:0 0 28px;
  display:grid;
  place-items:center;
  border-radius:9px;
  background:rgba(255,255,255,.08);
  font-size:18px;
  font-weight:800;
}
.nav-btn.active .nav-icon{
  background:rgba(45,212,191,.18);
  color:#6ee7d8;
}
@media(max-width:900px){
  .mobile-only{display:flex}
  .topbar{
    padding:14px 16px;
  }
}
@media(max-width:650px){
  .topbar{
    align-items:center;
    min-height:96px;
    padding:14px 14px;
  }
  .topbar-main{
    gap:14px;
  }
  .menu-trigger{
    width:48px;
    height:48px;
    border-radius:15px;
  }
  .page-heading h1{
    font-size:21px;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
    max-width:210px;
  }
  .page-heading p{
    max-width:230px;
    font-size:13px;
  }
  .top-actions{
    flex:0 0 auto;
  }
  .status-pill{
    display:none;
  }
}


/* ===== Logo CS STOCK v2.1 ===== */
.cs-logo{
  position:relative;
  overflow:hidden;
  isolation:isolate;
  background:
    radial-gradient(circle at 25% 20%, rgba(255,255,255,.95), rgba(223,252,248,.92) 58%, rgba(190,242,235,.9));
  border:1px solid rgba(255,255,255,.75);
}
.cs-logo::after{
  content:"";
  position:absolute;
  inset:auto -13px -17px auto;
  width:44px;
  height:44px;
  border-radius:13px;
  background:linear-gradient(145deg,#0f766e,#14b8a6);
  transform:rotate(28deg);
  z-index:-1;
  opacity:.96;
}
.cs-logo-text{
  position:relative;
  z-index:2;
  color:#0f766e;
  font-weight:950;
  letter-spacing:-.08em;
  font-size:20px;
  transform:translate(-1px,-1px);
}
.cs-logo-cross{
  position:absolute;
  top:2px;
  right:5px;
  z-index:3;
  color:#0f9f8f;
  font-size:15px;
  font-weight:950;
  line-height:1;
}
.cs-logo-box{
  position:absolute;
  right:5px;
  bottom:1px;
  z-index:3;
  color:#ffffff;
  font-size:11px;
  transform:rotate(45deg);
  text-shadow:0 1px 2px rgba(0,0,0,.15);
}
body.dark .cs-logo{
  background:linear-gradient(145deg,#f7fffe,#d8faf5);
  border-color:rgba(255,255,255,.45);
}

/* Le fond cliquable du dialogue garde un repère clair */
#choiceDialog::backdrop{
  background:rgba(3,18,17,.68);
  backdrop-filter:blur(2px);
}


/* ===== Recherche dans les listes v2.2 ===== */
.choice-search-wrap{
  position:relative;
}
.choice-search-wrap input{
  padding-left:43px;
  background:var(--card-2);
  border:1px solid var(--border);
  font-weight:650;
}
.choice-search-icon{
  position:absolute;
  left:15px;
  top:50%;
  transform:translateY(-50%);
  color:var(--muted);
  font-size:23px;
  z-index:2;
  pointer-events:none;
}
.choice-empty{
  padding:18px;
  text-align:center;
  border:1px dashed var(--border);
  border-radius:11px;
  color:var(--muted);
  background:var(--card-2);
}
body.dark .choice-search-wrap input{
  background:#13232d;
  color:var(--text);
  border-color:#334955;
}


.brand-logo-img{
  width:54px;
  height:54px;
  border-radius:16px;
  object-fit:cover;
  margin-right:12px;
  box-shadow:0 6px 16px rgba(0,0,0,.18);
}
.sidebar-brand{
  display:flex;
  align-items:center;
}


/* v2.5 sidebar brand cleanup */
.sidebar-brand{
 display:flex;
 align-items:center;
 gap:14px;
}
.brand-logo-img{
 width:64px;
 height:64px;
 border-radius:18px;
 margin-right:0!important;
 flex-shrink:0;
}
.sidebar-brand .brand-copy{
 display:flex;
 flex-direction:column;
}


/* ===== Correctifs commandes et confirmation v2.7 ===== */
#view-orders table{min-width:100%;}
#view-orders th:last-child,#view-orders td:last-child{text-align:center;}
.success-dialog{width:min(390px,calc(100% - 34px));background:transparent;box-shadow:none;}
.success-dialog::backdrop{background:rgba(3,18,17,.68);backdrop-filter:blur(2px);}
.success-box{background:var(--card);color:var(--text);border:1px solid var(--border);border-radius:22px;padding:28px 24px;text-align:center;box-shadow:var(--shadow);}
.success-icon{width:68px;height:68px;margin:0 auto 16px;border-radius:50%;display:grid;place-items:center;background:linear-gradient(135deg,#10b981,#14b8a6);color:white;font-size:38px;font-weight:900;box-shadow:0 12px 25px rgba(16,185,129,.25);}
.success-box h2{margin-bottom:8px;}
.success-box p{color:var(--muted);margin-bottom:22px;}
.success-box .btn{min-width:120px;}
body.dark .success-box{background:var(--card);}


/* ===== Alertes reposantes en mode sombre — v2.8 ===== */
body.dark .badge{
  box-shadow:none;
  border:1px solid transparent;
  letter-spacing:.01em;
}

body.dark .badge.satisfactory{
  background:#173229;
  color:#9bd9ba;
  border-color:#285643;
}

body.dark .badge.necessary{
  background:#33291d;
  color:#e6c27a;
  border-color:#5b472b;
}

body.dark .badge.urgent{
  background:#342126;
  color:#e3a4ad;
  border-color:#5e353d;
}

/* Même logique pour les mouvements, avec contraste modéré */
body.dark .badge.entry{
  background:#173229;
  color:#9bd9ba;
  border-color:#285643;
}

body.dark .badge.exit{
  background:#342126;
  color:#e3a4ad;
  border-color:#5e353d;
}

/* Filtres d’alertes harmonisés avec les badges */
body.dark .choice-list button.choice-satisfactory{
  background:#173229;
  color:#9bd9ba;
  border-color:#285643;
}

body.dark .choice-list button.choice-necessary{
  background:#33291d;
  color:#e6c27a;
  border-color:#5b472b;
}

body.dark .choice-list button.choice-urgent{
  background:#342126;
  color:#e3a4ad;
  border-color:#5e353d;
}

body.dark .choice-list button.choice-all{
  background:#1b2a3a;
  color:#a9c4e6;
  border-color:#344b66;
}


/* ===== Pop-up universel v3.0 ===== */
.alert-dialog{
  border:0;
  padding:0;
  width:min(92vw,560px);
  max-width:560px;
  border-radius:28px;
  overflow:hidden;
  background:transparent;
  box-shadow:none;
}
.alert-dialog::backdrop{
  background:rgba(2,18,17,.72);
  backdrop-filter:blur(7px);
}
.alert-card{
  background:var(--card);
  color:var(--text);
  border:1px solid var(--border);
  border-radius:28px;
  padding:38px 32px 34px;
  text-align:center;
  box-shadow:0 24px 70px rgba(0,0,0,.32);
}
.alert-icon{
  width:120px;
  height:120px;
  margin:0 auto 28px;
  border-radius:50%;
  display:grid;
  place-items:center;
  font-size:72px;
  font-weight:900;
  line-height:1;
  color:white;
  box-shadow:0 16px 35px rgba(0,0,0,.18);
}
.alert-icon.success{
  background:linear-gradient(145deg,#22c55e,#14b8a6);
}
.alert-icon.error{
  background:linear-gradient(145deg,#ef4444,#b91c1c);
}
.alert-icon.warning{
  background:linear-gradient(145deg,#f59e0b,#d97706);
}
.alert-icon.info{
  background:linear-gradient(145deg,#3b82f6,#2563eb);
}
.alert-card h2{
  margin:0 0 14px;
  font-size:clamp(28px,6vw,42px);
  letter-spacing:-.03em;
}
.alert-card p{
  margin:0 auto 28px;
  max-width:430px;
  color:var(--muted);
  font-size:clamp(18px,4.5vw,27px);
  line-height:1.45;
}
.alert-ok-btn{
  min-width:210px;
  min-height:74px;
  font-size:24px;
  border-radius:18px;
}
body.dark .alert-card{
  background:#172630;
  border-color:#334955;
}
body.dark .alert-card p{
  color:#b7c7cf;
}
@media(max-width:650px){
  .alert-card{
    padding:34px 24px 28px;
    border-radius:26px;
  }
  .alert-icon{
    width:104px;
    height:104px;
    font-size:62px;
    margin-bottom:24px;
  }
  .alert-ok-btn{
    width:100%;
    min-height:64px;
    font-size:20px;
  }
}


/* ===== Tableau de stock inspiré d'Excel — v3.2 ===== */
#view-medicines table{
  min-width:1220px;
  border-collapse:separate;
  border-spacing:0;
}

#view-medicines th,
#view-medicines td{
  border-right:1px solid rgba(15,23,42,.12);
}

#view-medicines .stock-sheet-header th{
  color:#ffffff;
  text-align:center;
  font-weight:900;
  line-height:1.25;
  white-space:normal;
  vertical-align:middle;
  padding:14px 10px;
}

#view-medicines .stock-sheet-row td{
  text-align:center;
  font-weight:700;
  vertical-align:middle;
}

#view-medicines .col-name{
  min-width:210px;
  text-align:left!important;
  background:#e5e7eb;
  color:#172026;
}

#view-medicines .col-price{
  min-width:130px;
  background:#d9dde2;
  color:#172026;
}

#view-medicines .col-required{
  min-width:125px;
  background:#3498db;
  color:#071826;
}

#view-medicines .col-initial{
  min-width:120px;
  background:#e8edf2;
  color:#172026;
}

#view-medicines .col-entries{
  min-width:135px;
  background:#16c7e8;
  color:#052532;
}

#view-medicines .col-exits{
  min-width:130px;
  background:#f3dc19;
  color:#2c2600;
}

#view-medicines .col-available{
  min-width:145px;
  background:#16a83f;
  color:#ffffff;
}

#view-medicines .col-unit{
  min-width:145px;
  background:#e5e7eb;
  color:#172026;
}

#view-medicines .col-alert{
  min-width:145px;
  background:#20252b;
  color:#ffffff;
}

#view-medicines .col-actions{
  min-width:105px;
  background:#f4f6f8;
}

#view-medicines .stock-sheet-header .col-name,
#view-medicines .stock-sheet-header .col-price,
#view-medicines .stock-sheet-header .col-unit,
#view-medicines .stock-sheet-header .col-initial{
  background:#20252b;
  color:#ffffff;
}

#view-medicines .stock-sheet-header .col-required{background:#2379ba;color:#ffffff}
#view-medicines .stock-sheet-header .col-entries{background:#0798b5;color:#ffffff}
#view-medicines .stock-sheet-header .col-exits{background:#b6a600;color:#ffffff}
#view-medicines .stock-sheet-header .col-available{background:#087a2a;color:#ffffff}
#view-medicines .stock-sheet-header .col-actions{background:#20252b}

#view-medicines .stock-sheet-row:hover td{
  filter:brightness(.97);
}

body.dark #view-medicines .stock-sheet-row .col-name,
body.dark #view-medicines .stock-sheet-row .col-price,
body.dark #view-medicines .stock-sheet-row .col-initial,
body.dark #view-medicines .stock-sheet-row .col-unit{
  background:#293740;
  color:#edf7f6;
}

body.dark #view-medicines .stock-sheet-row .col-required{
  background:#214e6d;
  color:#d9efff;
}

body.dark #view-medicines .stock-sheet-row .col-entries{
  background:#164d5b;
  color:#c8f5ff;
}

body.dark #view-medicines .stock-sheet-row .col-exits{
  background:#514a1c;
  color:#f7e99b;
}

body.dark #view-medicines .stock-sheet-row .col-available{
  background:#174f2b;
  color:#c3efd0;
}

body.dark #view-medicines .stock-sheet-row .col-alert{
  background:#1d2932;
}

body.dark #view-medicines .stock-sheet-row .col-actions{
  background:#22313a;
}

@media(max-width:650px){
  #view-medicines .table-wrap{
    border-radius:16px;
  }
  #view-medicines th,
  #view-medicines td{
    padding:12px 10px;
  }
}


/* ===== Tableau de bord v3.3 ===== */
.stat-urgent{
  border-top-color:#dc2626;
  color:#b91c1c;
  background:linear-gradient(145deg,#fff1f2,#ffffff);
}
.stat-necessary{
  border-top-color:#d97706;
  color:#b45309;
  background:linear-gradient(145deg,#fff7ed,#ffffff);
}
.stat-satisfactory{
  border-top-color:#059669;
  color:#047857;
  background:linear-gradient(145deg,#ecfdf5,#ffffff);
}

body.dark .stat-urgent{
  background:linear-gradient(145deg,#342126,#17232d);
  color:#e3a4ad;
}
body.dark .stat-necessary{
  background:linear-gradient(145deg,#33291d,#17232d);
  color:#e6c27a;
}
body.dark .stat-satisfactory{
  background:linear-gradient(145deg,#173229,#17232d);
  color:#9bd9ba;
}

/* L’unité de comptage est placée juste après le nom. */
#view-medicines .col-unit{
  min-width:145px;
}


/* ===== Gestion des mois et alignement du tableau de bord — v3.4 ===== */
.month-bar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  padding:16px 18px;
  margin-bottom:18px;
  border:1px solid var(--border);
  border-radius:16px;
  background:linear-gradient(145deg,var(--card),var(--card-2));
  box-shadow:var(--shadow-soft);
}
.month-bar-copy{
  display:flex;
  flex-direction:column;
  gap:4px;
}
.month-label{
  color:var(--muted);
  font-size:13px;
  font-weight:700;
  text-transform:uppercase;
  letter-spacing:.04em;
}
#activeMonthLabel{
  font-size:20px;
}
.month-bar-actions{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}

/* Tous les titres réservent la même hauteur : les chiffres restent alignés. */
.cards .stat-card{
  display:flex;
  flex-direction:column;
  min-height:218px;
}
.cards .stat-card span{
  display:flex;
  align-items:flex-start;
  min-height:64px;
  line-height:1.45;
}
.cards .stat-card strong{
  margin-top:10px;
}

body.dark .month-bar{
  background:linear-gradient(145deg,#17232d,#142029);
}

@media(max-width:650px){
  .month-bar{
    align-items:flex-start;
    flex-direction:column;
  }
  .month-bar-actions{
    width:100%;
  }
  .month-bar-actions .btn{
    flex:1 1 auto;
  }
  .cards .stat-card{
    min-height:205px;
  }
  .cards .stat-card span{
    min-height:76px;
  }
}


/* ===== Logique mensuelle et SDU — v3.5 ===== */
.sdu-card{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:18px;
  padding:16px 18px;
  border-radius:14px;
  border:1px solid #7dd3fc;
  background:linear-gradient(145deg,#ecfeff,#eff6ff);
  color:#0c4a6e;
}
.sdu-card span{
  display:block;
  font-weight:900;
  font-size:15px;
}
.sdu-card small{
  display:block;
  margin-top:4px;
  color:#52758a;
}
.sdu-card strong{
  flex:0 0 auto;
  font-size:24px;
  white-space:nowrap;
}
.sdu-card.exit-mode{
  border-color:#fbbf24;
  background:linear-gradient(145deg,#fffbeb,#fff7ed);
  color:#92400e;
}
body.dark .sdu-card{
  border-color:#28566b;
  background:linear-gradient(145deg,#17303a,#172630);
  color:#a7e7f5;
}
body.dark .sdu-card small{
  color:#8eb1bf;
}
body.dark .sdu-card.exit-mode{
  border-color:#6a5024;
  background:linear-gradient(145deg,#33291d,#25251f);
  color:#e6c27a;
}

/* Tous les nombres démarrent exactement au même niveau. */
.cards .stat-card span{
  min-height:76px!important;
}
.cards .stat-card strong{
  margin-top:0!important;
  line-height:1;
}

@media(max-width:650px){
  .sdu-card{
    align-items:flex-start;
    flex-direction:column;
  }
  .sdu-card strong{
    font-size:28px;
  }
}


/* ===== SDU actuel — v3.8 ===== */
.panel-subtitle{
  margin:5px 0 0;
  color:var(--muted);
  font-size:13px;
  font-weight:650;
}


/* ===== CS STOCK CONNECT v4.0 ===== */
.status-pill.online{background:#dcfae6;color:#067647}
.status-pill.offline{background:#fee4e2;color:#b42318}
.sync-btn{white-space:nowrap}
.sync-meta{
  display:flex;
  justify-content:space-between;
  gap:15px;
  padding:10px 0;
  border-bottom:1px solid var(--border);
}
.account-actions{display:flex;gap:10px;flex-wrap:wrap;margin-top:16px}
.auth-page{
  min-height:100vh;
  display:grid;
  place-items:center;
  padding:22px;
  background:linear-gradient(145deg,#e8fffb,#edf4ff);
}
.auth-shell.single{width:min(500px,100%)}
.auth-card{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:24px;
  padding:34px;
  box-shadow:var(--shadow);
}
.auth-brand{display:flex;align-items:center;gap:16px;margin-bottom:28px}
.auth-brand img{width:74px;height:74px;border-radius:20px}
.auth-brand h1{margin:0 0 4px}
.stack{display:grid;gap:17px}
.link-btn{border:0;background:none;color:var(--primary);font-weight:800}
.notice{padding:13px;border-radius:11px;margin-top:18px}
.notice.warning{background:#fff4e5;color:#7a2e0e}
body.dark.auth-page{background:#0f1720}
body.dark .auth-card{background:var(--card)}
@media(max-width:650px){
  .sync-btn{font-size:0;width:42px;height:42px;padding:0}
  .sync-btn::before{content:"↻";font-size:22px}
}

/* ===== Authentification CS STOCK Connect v5.0 ===== */
.auth-tabs{display:grid;grid-template-columns:1fr 1fr;gap:7px;padding:5px;background:#edf3f4;border-radius:13px;margin-bottom:22px}
.auth-tab{border:0;background:transparent;padding:11px;border-radius:10px;font-weight:800;color:var(--muted)}
.auth-tab.active{background:#fff;color:var(--primary);box-shadow:0 4px 12px rgba(15,23,42,.08)}
.password-field{position:relative;display:block;margin-top:7px}
.password-field input{padding-right:50px}
.password-toggle{position:absolute;right:6px;top:50%;transform:translateY(-50%);display:grid;place-items:center;width:40px;height:40px;padding:0;border:1px solid transparent;background:transparent;color:#64748b;border-radius:12px;cursor:pointer;transition:background .18s ease,color .18s ease,border-color .18s ease,box-shadow .18s ease,transform .18s ease}
.password-toggle:hover{background:#edf7f6;color:var(--primary);border-color:#cce7e4}
.password-toggle:active{transform:translateY(-50%) scale(.94)}
.password-toggle:focus-visible{outline:0;border-color:var(--primary);box-shadow:0 0 0 3px rgba(15,118,110,.18)}
.password-toggle.is-visible{background:#e8f5f3;color:var(--primary);border-color:#c6e4e0}
.password-eye-icon{width:21px;height:21px;fill:none;stroke:currentColor;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round;pointer-events:none}
.auth-submit{width:100%;min-height:46px}
.auth-submit:disabled{opacity:.6;cursor:not-allowed}
.auth-section-heading h2{margin-bottom:6px;font-size:21px}
.auth-section-heading p,.auth-help{color:var(--muted);margin:0}
.auth-version{text-align:center;color:var(--muted);font-size:12px;margin:22px 0 0}
body.dark .auth-tabs{background:#101c25}
body.dark .auth-tab.active{background:var(--card-2)}
body.dark .password-toggle{color:#94a3b8}
body.dark .password-toggle:hover,body.dark .password-toggle.is-visible{background:#173a3a;color:#6ee7d8;border-color:#285a58}
body.dark .password-toggle:focus-visible{box-shadow:0 0 0 3px rgba(45,212,191,.2)}
@media(max-width:520px){.auth-card{padding:24px 19px}.auth-brand img{width:64px;height:64px}.auth-brand h1{font-size:24px}}


/* ===== CS STOCK CONNECT v6.0 ===== */
.dashboard-kpis{grid-template-columns:repeat(auto-fit,minmax(170px,1fr))}
.stat-value{border-top:4px solid #2563eb}
.stat-expiry{border-top:4px solid #f59e0b}
.stat-expired{border-top:4px solid #dc2626}
.dashboard-grid{display:grid;grid-template-columns:minmax(0,1.6fr) minmax(280px,.8fr);gap:18px;margin:18px 0}
.chart-panel canvas{display:block;width:100%;max-width:100%}
.activity-list{display:grid;gap:8px}
.activity-item{display:grid;grid-template-columns:38px 1fr auto;align-items:center;gap:10px;padding:10px 0;border-bottom:1px solid var(--border)}
.activity-item:last-child{border-bottom:0}
.activity-item small,.cell-sub{display:block;color:var(--muted);margin-top:3px;font-size:.78rem}
.activity-icon{width:34px;height:34px;border-radius:11px;display:grid;place-items:center;font-weight:900}
.activity-icon.entry{background:#dcfce7;color:#15803d}.activity-icon.exit{background:#ffedd5;color:#c2410c}
.expiry-badge{white-space:nowrap;padding:5px 8px;border-radius:999px;font-size:.75rem;font-weight:800}
.expiry-badge.none{background:#f1f5f9;color:#64748b}.expiry-badge.valid{background:#dcfce7;color:#166534}
.expiry-badge.expiring{background:#fef3c7;color:#92400e}.expiry-badge.expired{background:#fee2e2;color:#991b1b}
.team-layout{display:grid;gap:18px}
.team-actions-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px}
.mini-form{display:grid;gap:12px;padding:16px;border:1px solid var(--border);border-radius:14px}
.workspace-banner{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px;padding:16px;background:linear-gradient(135deg,#042f2e,#0f766e);color:#fff;border-radius:16px}
.workspace-banner div{display:grid;gap:4px}.workspace-banner span{font-size:.75rem;opacity:.75;text-transform:uppercase;letter-spacing:.06em}
.workspace-banner strong{font-size:1.05rem;overflow-wrap:anywhere}.role-select{min-width:150px}
.warning-box{padding:14px;border-radius:12px;background:#fff7ed;color:#9a3412;border:1px solid #fed7aa}
.small{font-size:.83rem}
body.dark .expiry-badge.none{background:#334155;color:#cbd5e1}
body.dark .mini-form{background:#0f172a}
@media(max-width:900px){.dashboard-grid,.team-actions-grid{grid-template-columns:1fr}.workspace-banner{grid-template-columns:1fr}}


/* Correctif v6.0.2 : lisibilité de la colonne Péremption en mode clair */
.stock-table thead th.col-expiry,
table thead th.col-expiry,
.col-expiry {
  color: #1f2937 !important;
}

.stock-table thead th.col-expiry,
table thead th.col-expiry {
  background: #f8fafc !important;
  font-weight: 800;
}

body.dark .stock-table thead th.col-expiry,
body.dark table thead th.col-expiry {
  color: #f8fafc !important;
  background: #1f2937 !important;
}


/* ===== v6.1 : tri et filtres de péremption ===== */
.medicine-toolbar{align-items:center}
.filter-summary{
  margin:-2px 0 12px;
  padding:10px 14px;
  border:1px solid #fbbf24;
  background:#fffbeb;
  color:#92400e;
  border-radius:12px;
  font-size:.9rem;
}
.actionable-card{cursor:pointer;transition:transform .16s ease,box-shadow .16s ease}
.actionable-card:hover,.actionable-card:focus{
  transform:translateY(-2px);
  box-shadow:0 12px 25px rgba(15,23,42,.12);
  outline:none;
}
.actionable-card small{display:block;margin-top:5px;font-size:.72rem;opacity:.72}
.btn.ghost{background:transparent;border:1px dashed var(--border);color:var(--muted)}
body.dark .filter-summary{background:#422006;color:#fde68a;border-color:#92400e}
@media(max-width:1100px){
  .medicine-toolbar{align-items:stretch}
  .medicine-toolbar > *{flex:1 1 190px}
}


/* CS STOCK CONNECT v8.0.7 */
.col-type{min-width:145px}
.product-type-badge{
  display:inline-flex;
  align-items:center;
  border-radius:999px;
  padding:.28rem .62rem;
  font-size:.78rem;
  font-weight:700;
  white-space:nowrap;
}
.product-type-badge.recouvrable{
  background:rgba(37,99,235,.12);
  color:#1d4ed8;
}
.product-type-badge.gratuite_ciblee{
  background:rgba(22,163,74,.13);
  color:#15803d;
}
[data-theme="dark"] .product-type-badge.recouvrable{color:#93c5fd}
[data-theme="dark"] .product-type-badge.gratuite_ciblee{color:#86efac}
.field-hint{display:block;margin-top:.35rem;color:var(--muted);font-size:.78rem}
.table-subline{display:block;margin-top:.2rem;color:var(--muted);font-size:.76rem}
.order-toolbar,.report-toolbar{align-items:center}
.report-toolbar>div:first-child{margin-right:auto}
.report-kpis{margin-bottom:1rem}
.report-print-header{overflow:hidden}

@media print{
  body *{visibility:hidden!important}
  .view.print-target,.view.print-target *{visibility:visible!important}
  .view.print-target{
    position:absolute!important;
    inset:0!important;
    display:block!important;
    width:100%!important;
    padding:0!important;
    background:#fff!important;
    color:#000!important;
  }
  .view.print-target .toolbar button,
  .view.print-target .custom-select-btn{display:none!important}
  .view.print-target .panel{box-shadow:none!important;border:0!important}
  .view.print-target table{width:100%!important}
}
/* ================= CS STOCK CONNECT v8.0.7 ================= */
.col-type{min-width:145px}.col-source{min-width:175px}
.program-badge,.source-badge{display:inline-flex;align-items:center;white-space:nowrap;padding:5px 9px;border-radius:999px;font-size:12px;font-weight:750;border:1px solid transparent}
.program-recouvrable{background:#e0f2fe;color:#075985;border-color:#bae6fd}.program-gratuite_ciblee{background:#dcfce7;color:#166534;border-color:#bbf7d0}.program-cmu{background:#ede9fe;color:#5b21b6}.program-pnls{background:#fee2e2;color:#991b1b}.program-pnlp{background:#fef3c7;color:#92400e}.program-pnsme{background:#fce7f3;color:#9d174d}.program-pnn{background:#ecfccb;color:#3f6212}.program-hors_programme{background:#f1f5f9;color:#334155;border-color:#cbd5e1}
.source-district{background:#dcfce7;color:#166534}.source-officine_privee{background:#dbeafe;color:#1e40af}.source-fournisseur_local{background:#ffedd5;color:#9a3412}.source-achat_direct{background:#f3e8ff;color:#6b21a8;border-color:#e9d5ff}
.source-kpis{margin-top:16px;grid-template-columns:repeat(auto-fit,minmax(175px,1fr))}.source-kpis .stat-card small{display:block;margin-top:6px}.program-value-card strong{font-size:18px}.movement-extra-fields{padding:14px;border:1px solid var(--border-color,#dce3ea);border-radius:14px;background:rgba(15,118,110,.04)}
.table-subline .program-badge,.table-subline .source-badge{margin-top:5px;margin-right:4px}
@media(max-width:900px){.col-source,.col-type{min-width:135px}.source-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}}


/* ===== Correctifs CS STOCK CONNECT v8.0.7 ===== */
/* En-têtes Programme et Source lisibles en mode clair et sombre */
#view-medicines .stock-sheet-header .col-type,
#view-medicines .stock-sheet-header .col-source{
  background:#20252b !important;
  color:#ffffff !important;
}

/* Largeurs améliorées pour éviter les libellés trop serrés */
#view-medicines .col-type{
  min-width:165px;
  width:165px;
}
#view-medicines .col-source{
  min-width:185px;
  width:185px;
}

/* Badges mieux centrés dans les cellules */
#view-medicines td.col-type,
#view-medicines td.col-source{
  text-align:center;
  vertical-align:middle;
}
#view-medicines td.col-type .program-badge,
#view-medicines td.col-source .source-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  vertical-align:middle;
  min-height:28px;
}

@media(max-width:900px){
  #view-medicines .col-type{min-width:150px;width:150px}
  #view-medicines .col-source{min-width:165px;width:165px}
}


/* ===== Synchronisation dynamique v8.0.7 ===== */
.sync-progress-dialog{border:0;padding:0;background:transparent;max-width:min(92vw,420px);width:100%}
.sync-progress-dialog::backdrop{background:rgba(4,16,24,.68);backdrop-filter:blur(3px)}
.sync-progress-card{background:var(--card,#fff);color:var(--text,#17202a);border-radius:22px;padding:28px 24px;text-align:center;box-shadow:0 24px 70px rgba(0,0,0,.28);border:1px solid var(--border,#dfe6ec)}
.sync-progress-icon{width:58px;height:58px;margin:0 auto 12px;border-radius:50%;display:grid;place-items:center;background:rgba(15,118,110,.12);color:#0f766e;font-size:30px;font-weight:800;animation:syncSpin 1.1s linear infinite}
.sync-progress-card h2{margin:0 0 8px;font-size:1.25rem}
.sync-progress-card p{margin:0 0 18px;color:var(--muted,#64748b);min-height:1.4em}
.sync-progress-track{height:14px;width:100%;overflow:hidden;border-radius:999px;background:#e5e7eb;box-shadow:inset 0 1px 3px rgba(0,0,0,.12)}
.sync-progress-bar{height:100%;min-width:1%;border-radius:inherit;background:linear-gradient(90deg,#0f766e,#14b8a6);transition:width .22s ease}
.sync-progress-percent{display:block;margin-top:10px;font-size:1.35rem;color:#0f766e;font-variant-numeric:tabular-nums}
.sync-progress-card small{display:block;margin-top:8px;color:var(--muted,#64748b)}
@keyframes syncSpin{to{transform:rotate(360deg)}}
body.dark .sync-progress-card,[data-theme="dark"] .sync-progress-card{background:#17212b;color:#f8fafc;border-color:#334155}
body.dark .sync-progress-track,[data-theme="dark"] .sync-progress-track{background:#334155}

/* ===== Correctifs v8.0.7 : péremption lisible en mode sombre ===== */
body.dark #view-medicines td.col-expiry,
[data-theme="dark"] #view-medicines td.col-expiry{
  color:#f8fafc !important;
  font-weight:750;
  opacity:1 !important;
}

body:not(.dark) #view-medicines td.col-expiry{
  color:#1f2937 !important;
  font-weight:750;
}

/* Commandes regroupées par programme — v8.0.8 */
.order-program-heading td{
  background:var(--primary-soft, #e8f7f1);
  border-top:2px solid var(--primary, #16966b);
  border-bottom:1px solid var(--primary, #16966b);
  padding:14px 16px;
}
.order-program-heading strong{color:var(--primary-dark, #0d6f4e);letter-spacing:.03em}
.order-program-summary{float:right;font-size:.88rem;font-weight:600;color:var(--text-muted, #607069)}
@media (max-width:700px){.order-program-summary{float:none;display:block;margin-top:5px}}
@media print{
  .order-program-heading td{background:#eee !important;color:#000 !important;border-color:#555 !important;break-after:avoid}
  .order-program-heading strong{color:#000 !important}
}


/* v9.0 — identité du centre et impression */
.sidebar-brand small#sidebarCenterName{display:block;color:var(--primary-light,#99f6e4);font-weight:700;max-width:170px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-top:2px}
.center-settings-card{grid-column:1/-1}
.center-profile-form{display:grid;gap:16px}
.print-identity{display:none;text-align:center;border-bottom:2px solid #111;margin-bottom:18px;padding-bottom:10px}
.print-identity h1,.print-identity h2,.print-identity p{margin:3px 0}
@media print{
  .print-identity{display:block!important}
  .sidebar,.topbar,.month-bar,.toolbar,.sidebar-backdrop{display:none!important}
  .app-shell,.content{margin:0!important;padding:0!important;width:100%!important}
}

/* v9.0.1 — paramètres organisés, identité et logo */
.settings-tabs{display:flex;gap:8px;flex-wrap:wrap;margin:0 0 18px;padding:8px;background:var(--panel,#fff);border:1px solid var(--border,#dbe4ea);border-radius:16px}
.settings-tab{border:0;background:transparent;padding:11px 15px;border-radius:11px;font-weight:750;color:var(--muted,#64748b);cursor:pointer}
.settings-tab.active{background:var(--primary,#0f766e);color:#fff;box-shadow:0 8px 18px rgba(15,118,110,.2)}
.settings-pane{display:none}.settings-pane.active{display:block}
.center-logo-editor{display:flex;align-items:center;gap:18px;padding:16px;border:1px dashed var(--border,#cbd5e1);border-radius:16px;background:rgba(15,118,110,.035)}
.center-logo-preview-wrap{width:96px;height:96px;flex:0 0 96px;border-radius:20px;background:#fff;border:1px solid var(--border,#dbe4ea);display:grid;place-items:center;overflow:hidden}
.center-logo-preview{width:82px;height:82px;object-fit:contain}.logo-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:10px}
.input-with-action{display:flex;border:1px solid var(--border,#dbe4ea);border-radius:12px;overflow:hidden;background:var(--input-bg,#fff)}
.input-with-action input{border:0!important;border-radius:0!important;flex:1}.input-with-action button{border:0;border-left:1px solid var(--border,#dbe4ea);padding:0 14px;background:var(--primary-soft,#e6fffa);color:var(--primary,#0f766e);font-weight:800;cursor:pointer}
.save-center-btn{font-size:1rem;padding:14px 20px;box-shadow:0 10px 24px rgba(15,118,110,.22)}
.sync-state-row{display:flex;align-items:center;gap:10px;padding:12px;border-radius:12px;background:var(--primary-soft,#e6fffa);margin:14px 0}.sync-state-dot{width:12px;height:12px;border-radius:50%;background:#94a3b8;box-shadow:0 0 0 5px rgba(148,163,184,.15)}.sync-state-dot.ok{background:#16a34a;box-shadow:0 0 0 5px rgba(22,163,74,.15)}.sync-state-dot.pending{background:#f59e0b;box-shadow:0 0 0 5px rgba(245,158,11,.15)}.sync-state-dot.offline{background:#ef4444;box-shadow:0 0 0 5px rgba(239,68,68,.15)}
.about-card{display:flex;align-items:center;gap:22px}.about-card img{width:92px;height:92px;object-fit:contain}.print-center-logo{width:72px;height:72px;object-fit:contain;margin:0 auto 6px}
@media(max-width:700px){.settings-tabs{display:grid;grid-template-columns:repeat(2,1fr)}.settings-tab{text-align:left}.center-logo-editor,.about-card{align-items:flex-start}.center-logo-editor{flex-direction:column}}

/* v9.0.2 — sélection hiérarchique région, district et établissement */
.center-profile-form select{width:100%;min-height:46px;border:1px solid var(--border);border-radius:12px;padding:0 12px;background:var(--surface);color:var(--text);font:inherit}
.center-profile-form select:disabled{opacity:.65;cursor:not-allowed}
.center-profile-form .conditional-field{margin-top:8px}

/* v9.0.4 — recherche rapide dans les listes sanitaires */
.selector-search{margin-bottom:8px;width:100%;}
.selector-search:disabled{opacity:.55;cursor:not-allowed;}

/* v9.0.4 — listes déroulantes avec recherche intégrée */
.searchable-select{position:relative;width:100%;margin-top:6px}
.searchable-select-native{position:absolute!important;width:1px!important;height:1px!important;opacity:0!important;pointer-events:none!important}
.searchable-select-trigger{
  width:100%;min-height:46px;padding:11px 13px;border:1px solid var(--border);border-radius:11px;
  background:#fff;color:var(--text);display:flex;align-items:center;justify-content:space-between;gap:12px;text-align:left
}
.searchable-select-trigger:focus,.searchable-select.open .searchable-select-trigger{
  outline:none;border-color:var(--primary);box-shadow:0 0 0 3px rgba(15,118,110,.12)
}
.searchable-select-arrow{font-size:18px;line-height:1;color:var(--muted);transition:transform .16s ease}
.searchable-select.open .searchable-select-arrow{transform:rotate(180deg)}
.searchable-select.disabled .searchable-select-trigger{background:#f5f7f8;color:#98a2b3;cursor:not-allowed}
.searchable-select-menu{
  position:absolute;z-index:120;top:calc(100% + 6px);left:0;right:0;background:#fff;border:1px solid var(--border);
  border-radius:12px;box-shadow:0 16px 34px rgba(15,23,42,.16);overflow:hidden
}
.searchable-select-search-wrap{display:flex;align-items:center;gap:8px;padding:10px;border-bottom:1px solid var(--border);background:#f8fbfd}
.searchable-select-search{margin:0!important;padding:10px 11px!important;border-radius:9px!important;background:#fff!important}
.searchable-select-options{max-height:250px;overflow:auto;overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;touch-action:pan-y;padding:6px}
.searchable-select-option{width:100%;border:0;background:#fff;color:var(--text);padding:10px 11px;border-radius:8px;text-align:left}
.searchable-select-option:hover,.searchable-select-option:focus{background:#ecfdf5;outline:none}
.searchable-select-option.selected{background:#dff7f2;color:var(--primary-dark);font-weight:700}
.searchable-select-empty{padding:18px 12px;text-align:center;color:var(--muted)}
@media(max-width:700px){.searchable-select-menu{position:fixed;left:12px;right:12px;top:18%;max-height:64vh}.searchable-select-options{max-height:50vh}}


/* v9.0.5 — administration multi-centres */
.centers-toolbar{display:flex;gap:12px;align-items:center;margin-bottom:16px}.centers-toolbar input{flex:1;min-width:240px}.status-badge{display:inline-flex;align-items:center;gap:6px;padding:5px 10px;border-radius:999px;font-size:.82rem;font-weight:700}.status-badge.active{background:#dcfce7;color:#166534}.status-badge.inactive{background:#fee2e2;color:#991b1b}.center-actions{display:flex;gap:6px;flex-wrap:wrap}.center-actions .btn{padding:7px 10px;font-size:.82rem}.center-admin-dialog{width:min(760px,calc(100vw - 24px));max-height:92vh;overflow:auto}.form-section-title{margin:18px 0 10px;padding-top:16px;border-top:1px solid var(--border,#dbe5e4);font-weight:800;color:var(--primary,#0f766e)}.form-error{margin:12px 0;padding:10px 12px;border-radius:10px;background:#fee2e2;color:#991b1b;font-weight:600}.span-2{grid-column:1/-1}@media(max-width:680px){.centers-toolbar{align-items:stretch;flex-direction:column}.centers-toolbar input{min-width:0}.span-2{grid-column:auto}.center-admin-dialog{width:calc(100vw - 12px)}}


/* v9.0.7 — repérage uniforme des champs obligatoires */
.required-mark{color:#dc2626;font-weight:800;margin-left:.18rem}
.required-help{margin:.1rem 0 .75rem;color:var(--muted,#64748b);font-size:.84rem}
input:required:invalid:not(:placeholder-shown),select:required:invalid,textarea:required:invalid{border-color:#dc2626}

/* v9.0.7 — administration des centres */
.centers-setup-notice{margin:0 0 16px;padding:14px 16px;border:1px solid #e9b949;background:#fff8e1;border-radius:12px;color:#6b4e00;line-height:1.5}
.centers-setup-notice code{background:rgba(255,255,255,.75);padding:2px 6px;border-radius:5px}
button:disabled{cursor:not-allowed;opacity:.55}

/* v9.0.9 — valeur des commandes */
#view-orders th.order-value-column,
#view-orders td.order-value-column{white-space:nowrap;text-align:right}
#view-orders td.order-line-value{font-weight:800;color:var(--primary-dark,#0d6f4e)}
.order-totals{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;padding:16px;border-top:1px solid var(--border,#dbe4ea);background:var(--panel,#fff)}
.order-totals>div{display:flex;flex-direction:column;gap:5px;padding:13px 15px;border:1px solid var(--border,#dbe4ea);border-radius:13px;background:var(--surface,#f8fafc)}
.order-totals span{font-size:.83rem;color:var(--muted,#64748b);font-weight:700}
.order-totals strong{font-size:1.12rem}
.order-totals .order-value-summary strong{color:var(--primary,#0f766e)}
#view-orders.order-values-hidden .order-value-column,
#view-orders.order-values-hidden .order-value-summary,
#view-orders.order-values-hidden .order-value-inline{display:none!important}
@media(max-width:700px){.order-totals{grid-template-columns:1fr}.order-totals>div{flex-direction:row;align-items:center;justify-content:space-between}}
@media print{
  #view-orders .order-totals{display:grid!important;grid-template-columns:repeat(3,1fr);padding:12px 0;background:#fff!important}
  #view-orders .order-totals>div{border:1px solid #777;background:#fff!important}
}

/* v9.1.0 — licences SaaS */
.license-kpis{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;margin-bottom:16px}.license-details{margin:14px 0}.license-banner{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;padding:16px;border:1px solid var(--border);border-left:5px solid #16a34a;border-radius:14px;background:var(--surface)}.license-banner.pending,.license-banner.expired{border-left-color:#f59e0b}.license-banner.suspended,.license-banner.revoked{border-left-color:#dc2626}.license-banner>div{display:flex;flex-direction:column;gap:5px}.license-banner span{font-size:.8rem;color:var(--muted);font-weight:700}.status-badge.pending,.status-badge.expired{background:#fef3c7;color:#92400e}.status-badge.suspended,.status-badge.revoked{background:#fee2e2;color:#991b1b}#licenseAdminPanel{margin-top:18px}@media(max-width:850px){.license-kpis,.license-banner{grid-template-columns:repeat(2,1fr)}}@media(max-width:560px){.license-kpis,.license-banner{grid-template-columns:1fr}}

/* Référentiel produits v9.2.0 */
.catalog-hero{display:flex;align-items:center;justify-content:space-between;gap:20px;margin-bottom:16px}.catalog-summary{display:grid;grid-template-columns:auto auto;gap:2px 8px;align-items:baseline;background:var(--surface-soft,#f0fdfa);padding:12px 18px;border-radius:14px}.catalog-summary strong{font-size:1.35rem}.catalog-summary span{font-size:.82rem;color:var(--muted,#64748b)}.catalog-toolbar{grid-template-columns:minmax(220px,1fr) 190px 180px auto}.catalog-table td:first-child,.catalog-table th:first-child{width:42px;text-align:center}.catalog-designation{font-weight:700}.catalog-meta{display:block;font-size:.78rem;color:var(--muted,#64748b);margin-top:3px}.catalog-badge{display:inline-flex;padding:5px 9px;border-radius:999px;font-size:.75rem;font-weight:700}.catalog-badge.selected{background:#dcfce7;color:#166534}.catalog-badge.available{background:#f1f5f9;color:#475569}.catalog-row-selected{background:rgba(34,197,94,.04)}@media(max-width:800px){.catalog-hero{align-items:flex-start;flex-direction:column}.catalog-toolbar{display:grid;grid-template-columns:1fr}.catalog-table th:nth-child(3),.catalog-table td:nth-child(3),.catalog-table th:nth-child(5),.catalog-table td:nth-child(5){display:none}}

/* v10.1.0 — Référentiel NPSP */
.catalog-toolbar{
  display:grid;
  grid-template-columns:minmax(240px,1.5fr) minmax(190px,.8fr) minmax(190px,.8fr) minmax(180px,.7fr) auto;
  gap:12px;
  align-items:center;
}
.catalog-toolbar input,
.catalog-toolbar select{
  width:100%;
  min-height:44px;
  padding:0 42px 0 14px;
  border:1px solid var(--border,#dbe4ea);
  border-radius:12px;
  background:var(--surface,#fff);
  color:var(--text,#0f172a);
  font:inherit;
  font-weight:600;
  outline:none;
  box-shadow:0 1px 2px rgba(15,23,42,.03);
}
.catalog-toolbar input{padding-right:14px;font-weight:500}
.catalog-toolbar select{
  appearance:none;
  -webkit-appearance:none;
  background-image:
    linear-gradient(45deg,transparent 50%,#64748b 50%),
    linear-gradient(135deg,#64748b 50%,transparent 50%);
  background-position:calc(100% - 18px) 18px,calc(100% - 13px) 18px;
  background-size:5px 5px,5px 5px;
  background-repeat:no-repeat;
}
.catalog-toolbar input:focus,
.catalog-toolbar select:focus{
  border-color:var(--primary,#0f766e);
  box-shadow:0 0 0 3px rgba(15,118,110,.12);
}
.catalog-code{
  display:inline-flex;
  padding:5px 8px;
  border-radius:8px;
  background:#ecfeff;
  color:#155e75;
  font-size:.78rem;
  font-weight:800;
  letter-spacing:.02em;
  white-space:nowrap;
}
.catalog-auth{
  display:inline-flex;
  min-width:42px;
  justify-content:center;
  padding:5px 8px;
  border-radius:999px;
  background:#f1f5f9;
  color:#475569;
  font-size:.76rem;
  font-weight:800;
}
.catalog-table{min-width:1280px}
.catalog-table td{vertical-align:middle}
.catalog-table td:nth-child(3){min-width:360px}
@media(max-width:1100px){
  .catalog-toolbar{grid-template-columns:1fr 1fr}
  .catalog-toolbar .btn{grid-column:1/-1}
}
@media(max-width:700px){
  .catalog-toolbar{grid-template-columns:1fr}
  .catalog-toolbar .btn{grid-column:auto}
}

/* =========================================================
   CS STOCK CONNECT v11.0.0
   ========================================================= */
.sidebar{overflow:hidden}
.sidebar nav{overflow-y:auto;overscroll-behavior:contain;padding-right:4px;margin-right:-4px;scrollbar-width:thin;scrollbar-color:rgba(255,255,255,.25) transparent}
.sidebar nav::-webkit-scrollbar{width:5px}.sidebar nav::-webkit-scrollbar-thumb{background:rgba(255,255,255,.22);border-radius:999px}
.nav-section-label{display:block;margin:12px 10px 3px;color:#88aaa7;font-size:.68rem;font-weight:800;letter-spacing:.09em;text-transform:uppercase}
.nav-btn{display:flex;align-items:center;gap:11px;min-height:42px;padding:10px 12px}
.nav-icon{display:grid;place-items:center;flex:0 0 23px;width:23px;font-size:16px}
.legacy-view{display:none!important}

.topbar{gap:20px}
.topbar-main{display:flex;align-items:center;min-width:250px}
.global-search-wrap{position:relative;flex:1;max-width:560px;min-width:260px}
.global-search-wrap>input{height:44px;padding:0 76px 0 42px;border-radius:14px;background:var(--card-2);box-shadow:none}
.global-search-icon{position:absolute;left:15px;top:50%;transform:translateY(-50%);z-index:2;color:var(--muted);font-size:21px}
.global-search-wrap kbd{position:absolute;right:12px;top:50%;transform:translateY(-50%);padding:3px 7px;border:1px solid var(--border);border-bottom-width:2px;border-radius:6px;background:var(--card);color:var(--muted);font-size:.7rem;font-family:inherit}
.global-search-results{position:absolute;z-index:90;left:0;right:0;top:calc(100% + 8px);max-height:min(520px,70vh);overflow:auto;padding:7px;border:1px solid var(--border);border-radius:15px;background:var(--card);box-shadow:0 20px 48px rgba(15,23,42,.18)}
.global-search-results button{display:grid;grid-template-columns:82px 1fr;gap:10px;width:100%;padding:11px 12px;border:0;border-radius:10px;background:transparent;color:var(--text);text-align:left}
.global-search-results button:hover,.global-search-results button:focus{background:var(--bg-soft);outline:none}
.global-search-results strong,.global-search-results small{display:block}.global-search-results small{margin-top:3px;color:var(--muted);line-height:1.35}
.search-result-kind{align-self:start;display:inline-flex;justify-content:center;padding:4px 7px;border-radius:999px;background:#e6fffb;color:#0f766e;font-size:.69rem;font-weight:800;text-transform:uppercase}
.global-search-empty{padding:22px;text-align:center;color:var(--muted)}

.notification-wrap{position:relative}
.notification-btn{position:relative}
.notification-count{position:absolute;right:-5px;top:-6px;display:grid;place-items:center;min-width:20px;height:20px;padding:0 5px;border:2px solid var(--card);border-radius:999px;background:#dc2626;color:#fff;font-size:.65rem;font-weight:900}
.notification-panel{position:absolute;z-index:95;right:0;top:calc(100% + 9px);width:min(390px,calc(100vw - 24px));max-height:70vh;overflow:auto;border:1px solid var(--border);border-radius:16px;background:var(--card);box-shadow:0 20px 48px rgba(15,23,42,.2)}
.notification-head{position:sticky;top:0;z-index:1;display:flex;align-items:center;justify-content:space-between;padding:14px 16px;border-bottom:1px solid var(--border);background:var(--card)}
.notification-list{display:grid;padding:7px}
.notification-item{display:grid;grid-template-columns:38px 1fr;gap:10px;width:100%;padding:12px;border:0;border-radius:11px;background:transparent;color:var(--text);text-align:left}
.notification-item:hover{background:var(--bg-soft)}
.notification-item-icon{display:grid;place-items:center;width:36px;height:36px;border-radius:11px;background:#eff6ff;font-weight:900}
.notification-item.danger .notification-item-icon{background:#fee2e2;color:#b91c1c}.notification-item.warning .notification-item-icon{background:#fef3c7;color:#92400e}.notification-item.info .notification-item-icon{background:#dbeafe;color:#1d4ed8}
.notification-item strong,.notification-item small{display:block}.notification-item small{margin-top:4px;color:var(--muted);line-height:1.35}
.notification-empty{padding:28px 18px;text-align:center;color:var(--ok);font-weight:800}

.v11-toolbar{margin-bottom:16px}.v11-toolbar input[type="month"]{max-width:190px}
.v11-mini-kpis,.v11-operational-kpis{grid-template-columns:repeat(4,minmax(0,1fr))}
.stat-adjustment{border-top-color:#8b5cf6;color:#6d28d9}.stat-inventory{border-top-color:#0891b2;color:#0e7490}
.v11-inline-meta{line-height:1.55}
.origin-pill{display:inline-flex;padding:5px 9px;border-radius:999px;background:#ede9fe;color:#6d28d9;font-size:.75rem;font-weight:800}.origin-pill.manual{background:#e0f2fe;color:#0369a1}
.badge.adjustment{background:#ede9fe;color:#6d28d9}.badge.adjustment.increase{background:#dcfce7;color:#166534}.badge.adjustment.decrease{background:#fee2e2;color:#991b1b}

.wide-dialog{width:min(1100px,calc(100vw - 24px));max-width:none}
.inventory-dialog-form{max-height:92vh;overflow:hidden;grid-template-rows:auto auto auto minmax(220px,1fr) auto}
.inventory-lines-wrap{max-height:52vh;border:1px solid var(--border);border-radius:13px}
.inventory-lines-wrap table{min-width:720px}.inventory-lines-wrap thead{position:sticky;top:0;z-index:2}
.inventory-search-row{display:flex;align-items:center;gap:12px}.inventory-search-row input{flex:1}.inventory-search-row span{white-space:nowrap;color:var(--muted);font-weight:800}
.inventory-count-input{min-width:120px;padding:9px 10px;text-align:right}
.inventory-difference{display:inline-flex;min-width:64px;justify-content:flex-end}.inventory-difference.positive{color:#047857}.inventory-difference.negative{color:#b91c1c}.inventory-difference.zero{color:var(--muted)}

.history-tabs{display:flex;gap:8px;margin-bottom:16px;padding:6px;border:1px solid var(--border);border-radius:13px;background:var(--card);width:max-content;max-width:100%}
.history-tab{border:0;border-radius:9px;padding:10px 15px;background:transparent;color:var(--muted);font-weight:800}.history-tab.active{background:var(--primary);color:#fff}
.history-pane{display:none}.history-pane.active{display:block}
.audit-action{display:inline-flex;padding:5px 9px;border-radius:999px;background:#e0f2fe;color:#0369a1;font-size:.75rem;font-weight:800}.audit-action.audit-warning,.audit-action.audit-danger{background:#fee2e2;color:#991b1b}.audit-action.audit-success{background:#dcfce7;color:#166534}

body.dark .global-search-wrap>input,
body.dark .global-search-results,
body.dark .notification-panel,
body.dark .notification-head,
body.dark .history-tabs{background:var(--card);color:var(--text)}
body.dark .search-result-kind{background:#153f3b;color:#7de7da}
body.dark .notification-item-icon{background:#243641}
body.dark .inventory-lines-wrap{border-color:var(--border)}

@media(max-width:1180px){
  .global-search-wrap{max-width:420px}
  .topbar-main{min-width:210px}
  .sync-btn{display:none}
}
@media(max-width:900px){
  .topbar{flex-wrap:wrap;height:auto;min-height:82px}
  .topbar-main{flex:1;min-width:0}
  .global-search-wrap{order:3;flex-basis:100%;max-width:none;width:100%}
  .global-search-wrap kbd{display:none}
  .v11-mini-kpis,.v11-operational-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:650px){
  .top-actions{gap:7px}.top-actions .status-pill{display:none}
  .notification-panel{position:fixed;top:82px;right:12px;left:12px;width:auto;max-height:72vh}
  .global-search-results{position:fixed;top:142px;left:12px;right:12px;max-height:65vh}
  .v11-toolbar{align-items:stretch}.v11-toolbar>*{width:100%;max-width:none!important}.v11-toolbar .btn{margin-left:0!important}
  .v11-mini-kpis,.v11-operational-kpis{grid-template-columns:1fr 1fr}
  .inventory-search-row{align-items:stretch;flex-direction:column}.inventory-search-row span{text-align:right}
  .inventory-dialog-form{padding:14px}
}
@media(max-width:420px){.v11-mini-kpis,.v11-operational-kpis{grid-template-columns:1fr}.global-search-results button{grid-template-columns:70px 1fr}}
@media print{
  .global-search-wrap,.notification-wrap,.history-tabs{display:none!important}
}


/* v11 — permissions du rôle Lecteur */
.read-only-pill{background:#eef2ff;color:#3730a3;border-color:#c7d2fe}
.read-only-mode #addMedicineBtn,
.read-only-mode #addMovementBtn,
.read-only-mode #newEntryBtn,
.read-only-mode #newExitBtn,
.read-only-mode #newAdjustmentBtn,
.read-only-mode #newInventoryBtn,
.read-only-mode #catalogAddSelected,
.read-only-mode #restoreBtn,
.read-only-mode #resetBtn,
.read-only-mode #chooseCenterLogoBtn,
.read-only-mode #removeCenterLogoBtn,
.read-only-mode #centerProfileForm button[type="submit"],
.read-only-mode #view-medicines .row-actions,
.read-only-mode #view-entries .row-actions,
.read-only-mode #view-exits .row-actions,
.read-only-mode #view-adjustments .row-actions,
.read-only-mode #view-movements .row-actions,
.read-only-mode [data-add],
.read-only-mode [data-remove],
.read-only-mode [data-stock],
.read-only-mode [data-delete-inventory]{display:none!important}


/* ===== Correctif v11.0.0 — listes déroulantes natives ===== */
select{
  min-height:46px;
  padding:0 42px 0 13px;
  border:1px solid var(--border);
  border-radius:11px;
  background-color:#fff;
  color:var(--text);
  font:inherit;
  font-weight:600;
  line-height:1.2;
  appearance:none;
  -webkit-appearance:none;
  background-image:
    linear-gradient(45deg,transparent 50%,#64748b 50%),
    linear-gradient(135deg,#64748b 50%,transparent 50%);
  background-position:
    calc(100% - 18px) 20px,
    calc(100% - 13px) 20px;
  background-size:5px 5px,5px 5px;
  background-repeat:no-repeat;
  outline:none;
  cursor:pointer;
}
select:hover{border-color:#b8c7cf}
select:disabled{opacity:.65;cursor:not-allowed;background-color:#f2f5f6}
.toolbar select{
  width:auto;
  min-width:190px;
  flex:0 0 auto;
}
#memberRole{min-width:180px}
#licenseStatusFilter{min-width:205px}
.role-select{min-width:160px;max-width:220px}
body.dark select{
  background-color:var(--card);
  color:var(--text);
  background-image:
    linear-gradient(45deg,transparent 50%,#b8c7cf 50%),
    linear-gradient(135deg,#b8c7cf 50%,transparent 50%);
}
body.dark select:disabled{background-color:var(--card-2)}
@media(max-width:650px){
  .toolbar select{width:100%;min-width:0;flex:1 1 100%}
  #memberRole,#licenseStatusFilter,.role-select{width:100%;min-width:0;max-width:none}
}

/* ===== Correctif v11.0.0 — fenêtre « Nouveau centre » ===== */
#centerAdminDialog.form-dialog{
  width:min(900px,calc(100vw - 32px));
  max-width:900px;
  max-height:calc(100vh - 32px);
  max-height:calc(100dvh - 32px);
  overflow:hidden;
}
#centerAdminDialog .center-admin-dialog{
  width:100%;
  max-width:none;
  max-height:calc(100vh - 32px);
  max-height:calc(100dvh - 32px);
  margin:0;
  padding:24px;
  overflow-x:hidden;
  overflow-y:auto;
  background:var(--card);
  color:var(--text);
}
#centerAdminDialog .dialog-head{
  align-items:flex-start;
  gap:18px;
  margin-bottom:18px;
}
#centerAdminDialog .dialog-head>div{min-width:0}
#centerAdminDialog .dialog-head h2{line-height:1.2}
#centerAdminDialog .dialog-head p{
  margin:5px 0 0;
  color:var(--muted);
  line-height:1.45;
}
#centerAdminDialog .dialog-head .icon-btn{
  flex:0 0 auto;
  width:40px;
  height:40px;
  padding:0;
  border-radius:10px;
  font-size:27px;
  line-height:1;
}
#centerAdminDialog .dialog-head .icon-btn:hover{background:var(--card-2)}
#centerAdminDialog .required-help{margin:0 0 10px}
#centerAdminDialog .form-grid{
  grid-template-columns:repeat(2,minmax(0,1fr));
  column-gap:18px;
  row-gap:15px;
}
#centerAdminDialog .form-grid>label{
  display:grid;
  gap:7px;
  min-width:0;
  align-content:start;
  font-weight:600;
}
#centerAdminDialog .form-grid input,
#centerAdminDialog .form-grid select,
#centerAdminDialog .form-grid textarea,
#centerAdminDialog .password-field{
  width:100%;
  min-width:0;
}
#centerAdminDialog .password-field{margin-top:0}
#centerAdminDialog textarea{
  min-height:76px;
  resize:vertical;
}
#centerAdminDialog .form-section-title{margin:22px 0 14px}
#centerAdminDialog .dialog-actions{
  margin:20px -24px -24px;
  padding:16px 24px 24px;
  border-top:1px solid var(--border);
  background:var(--card);
}
body.dark #centerAdminDialog .dialog-head .icon-btn:hover{background:var(--card-2)}
@media(max-width:760px){
  #centerAdminDialog.form-dialog{
    width:calc(100vw - 16px);
    max-width:none;
    max-height:calc(100vh - 16px);
    max-height:calc(100dvh - 16px);
  }
  #centerAdminDialog .center-admin-dialog{
    max-height:calc(100vh - 16px);
    max-height:calc(100dvh - 16px);
    padding:18px;
  }
  #centerAdminDialog .form-grid{grid-template-columns:1fr}
  #centerAdminDialog .span-2{grid-column:1}
  #centerAdminDialog .dialog-head{gap:10px;margin-bottom:15px}
  #centerAdminDialog .dialog-actions{
    margin:18px -18px -18px;
    padding:14px 18px 18px;
    flex-direction:column-reverse;
  }
  #centerAdminDialog .dialog-actions .btn{width:100%}
}

/* ===== Correctif v11.0.0 — Référentiel visible sur téléphone en mode portrait ===== */
@media (max-width:700px) and (orientation:portrait){
  #view-catalog .table-wrap{
    overflow-x:hidden;
    border:0;
    background:transparent;
  }
  #view-catalog .catalog-table{
    display:block;
    width:100%;
    min-width:0!important;
    border-collapse:separate;
    border-spacing:0;
  }
  #view-catalog .catalog-table thead{display:none}
  #view-catalog .catalog-table tbody{
    display:grid;
    width:100%;
    gap:10px;
  }
  #view-catalog .catalog-table tbody tr{
    display:grid;
    grid-template-columns:36px minmax(0,1fr);
    gap:8px 10px;
    width:100%;
    padding:12px;
    border:1px solid var(--border,#dbe4ea);
    border-radius:14px;
    background:var(--card,var(--surface,#fff));
    box-shadow:0 3px 12px rgba(15,23,42,.05);
  }
  #view-catalog .catalog-table tbody tr.catalog-row-selected{
    border-color:rgba(15,118,110,.35);
    background:rgba(15,118,110,.055);
  }
  #view-catalog .catalog-table tbody td{
    display:none;
    min-width:0;
    padding:0;
    border:0;
  }
  #view-catalog .catalog-table tbody td:nth-child(1){
    display:flex;
    grid-column:1;
    grid-row:1;
    align-items:center;
    justify-content:center;
  }
  #view-catalog .catalog-table tbody td:nth-child(2){
    display:flex;
    grid-column:2;
    grid-row:1;
    align-items:center;
  }
  #view-catalog .catalog-table tbody td:nth-child(3){
    display:block!important;
    grid-column:1/-1;
    grid-row:2;
    min-width:0!important;
  }
  #view-catalog .catalog-designation{
    display:block;
    width:100%;
    color:var(--text,#0f172a);
    font-size:.95rem;
    font-weight:800;
    line-height:1.38;
    white-space:normal;
    overflow-wrap:anywhere;
    word-break:normal;
  }
  #view-catalog .catalog-table tbody td:nth-child(9){
    display:flex;
    grid-column:1/-1;
    grid-row:3;
    flex-wrap:wrap;
    gap:8px;
    padding-top:3px;
  }
  #view-catalog .catalog-table tbody td:nth-child(9) .btn{
    flex:1 1 145px;
    min-height:40px;
    margin:0;
    white-space:normal;
  }
  #view-catalog .catalog-code{
    max-width:100%;
    overflow:hidden;
    text-overflow:ellipsis;
  }
}

/* ===== v11.0.0 — Sélecteurs personnalisés globaux ===== */
.cs-select{
  position:relative;
  display:block;
  width:100%;
  min-width:0;
}
.cs-select-native{
  position:absolute!important;
  left:0!important;
  bottom:0!important;
  width:1px!important;
  height:1px!important;
  margin:0!important;
  padding:0!important;
  opacity:0!important;
  pointer-events:none!important;
}
.cs-select-trigger{
  width:100%;
  min-height:46px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:10px 13px 10px 14px;
  border:1px solid var(--border,#dbe4ea);
  border-radius:12px;
  background:var(--card,#fff);
  color:var(--text,#14212b);
  font:inherit;
  font-weight:650;
  line-height:1.25;
  text-align:left;
  cursor:pointer;
  box-shadow:0 1px 2px rgba(15,23,42,.025);
  transition:border-color .16s ease,box-shadow .16s ease,background .16s ease,transform .12s ease;
}
.cs-select-trigger:hover{
  border-color:color-mix(in srgb,var(--primary,#0f766e) 52%,var(--border,#dbe4ea));
  background:color-mix(in srgb,var(--card,#fff) 96%,var(--primary,#0f766e));
}
.cs-select-trigger:focus-visible,
.cs-select.is-open .cs-select-trigger{
  outline:none;
  border-color:var(--primary,#0f766e);
  box-shadow:0 0 0 3px rgba(15,118,110,.14),0 8px 20px rgba(15,23,42,.07);
}
.cs-select.is-open .cs-select-trigger{transform:translateY(-1px)}
.cs-select-value{
  min-width:0;
  flex:1;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.cs-select.is-placeholder .cs-select-value{color:var(--muted,#667085);font-weight:550}
.cs-select-chevron{
  width:9px;
  height:9px;
  flex:0 0 9px;
  border-right:2px solid currentColor;
  border-bottom:2px solid currentColor;
  color:var(--muted,#667085);
  transform:rotate(45deg) translateY(-2px);
  transform-origin:center;
  transition:transform .18s ease,color .18s ease;
}
.cs-select.is-open .cs-select-chevron{
  color:var(--primary,#0f766e);
  transform:rotate(225deg) translate(-1px,-1px);
}
.cs-select.is-disabled .cs-select-trigger{
  background:var(--card-2,#f2f5f6);
  color:var(--muted,#98a2b3);
  cursor:not-allowed;
  box-shadow:none;
  opacity:.78;
}
.cs-select.is-invalid .cs-select-trigger{
  border-color:#dc2626;
  box-shadow:0 0 0 3px rgba(220,38,38,.1);
}
.cs-select-menu{
  position:fixed;
  z-index:6000;
  display:flex;
  flex-direction:column;
  min-width:180px;
  max-width:calc(100vw - 24px);
  max-height:min(420px,calc(100dvh - 24px));
  overflow:hidden;
  border:1px solid color-mix(in srgb,var(--border,#dbe4ea) 82%,var(--primary,#0f766e));
  border-radius:15px;
  background:var(--card,#fff);
  color:var(--text,#14212b);
  box-shadow:0 22px 60px rgba(15,23,42,.22),0 4px 15px rgba(15,23,42,.08);
  animation:cs-select-in .14s ease-out;
}
.cs-select-menu[hidden],.cs-select-backdrop[hidden]{display:none!important}
@keyframes cs-select-in{
  from{opacity:0;transform:translateY(-5px) scale(.985)}
  to{opacity:1;transform:translateY(0) scale(1)}
}
.cs-select-menu-head{
  display:none;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:14px 15px 10px;
  border-bottom:1px solid var(--border,#dbe4ea);
}
.cs-select-menu-title{
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  font-size:.95rem;
}
.cs-select-menu-close{
  width:36px;
  height:36px;
  flex:0 0 36px;
  display:grid;
  place-items:center;
  padding:0;
  border:0;
  border-radius:10px;
  background:var(--card-2,#f2f5f6);
  color:var(--text,#14212b);
  font-size:24px;
  line-height:1;
  cursor:pointer;
}
.cs-select-search-wrap{
  display:flex;
  align-items:center;
  gap:8px;
  margin:10px;
  padding:0 11px;
  border:1px solid var(--border,#dbe4ea);
  border-radius:11px;
  background:var(--card-2,#f7fafb);
}
.cs-select-search-icon{color:var(--muted,#667085);font-size:19px;line-height:1}
.cs-select-search{
  width:100%;
  min-width:0;
  height:40px!important;
  margin:0!important;
  padding:0!important;
  border:0!important;
  outline:0!important;
  background:transparent!important;
  color:var(--text,#14212b)!important;
  box-shadow:none!important;
  font:inherit;
}
.cs-select-options{
  min-height:0;
  overflow:auto;
  overflow-y:auto;
  overscroll-behavior:contain;
  -webkit-overflow-scrolling:touch;
  touch-action:pan-y;
  padding:6px;
  scrollbar-width:thin;
}
.cs-select-option{
  width:100%;
  min-height:42px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:9px 11px;
  border:0;
  border-radius:10px;
  background:transparent;
  color:var(--text,#14212b);
  font:inherit;
  line-height:1.32;
  text-align:left;
  cursor:pointer;
  transition:background .12s ease,color .12s ease;
}
.cs-select-option:hover,
.cs-select-option:focus-visible,
.cs-select-option.is-active{
  outline:none;
  background:color-mix(in srgb,var(--primary,#0f766e) 9%,var(--card,#fff));
}
.cs-select-option.is-selected{
  background:color-mix(in srgb,var(--primary,#0f766e) 14%,var(--card,#fff));
  color:var(--primary-dark,#0b5f59);
  font-weight:800;
}
.cs-select-option:disabled{opacity:.48;cursor:not-allowed}
.cs-select-option-label{min-width:0;overflow-wrap:anywhere}
.cs-select-option-check{
  width:23px;
  height:23px;
  flex:0 0 23px;
  display:grid;
  place-items:center;
  border-radius:999px;
  background:var(--primary,#0f766e);
  color:#fff;
  font-size:13px;
  opacity:0;
  transform:scale(.7);
  transition:opacity .12s ease,transform .12s ease;
}
.cs-select-option.is-selected .cs-select-option-check{opacity:1;transform:scale(1)}
.cs-select-empty{
  display:grid;
  gap:4px;
  padding:24px 14px;
  color:var(--muted,#667085);
  text-align:center;
}
.cs-select-empty strong{color:var(--text,#14212b)}
.cs-select-backdrop{display:none}

/* Dimensions selon l'emplacement d'origine */
.toolbar .cs-select--toolbar{width:auto;min-width:190px;flex:0 0 auto}
#addMemberForm .cs-select{min-width:180px}
#licenseStatusFilter + .cs-select-trigger{min-width:205px}
.cs-select--role{min-width:160px;max-width:220px}
.catalog-filters .cs-select,.catalog-toolbar .cs-select{min-width:190px}
#centerAdminDialog .cs-select{margin:0;width:100%}

/* Harmonisation des anciens sélecteurs sanitaires déjà personnalisés */
.searchable-select-trigger{
  font-weight:650;
  border-radius:12px;
  box-shadow:0 1px 2px rgba(15,23,42,.025);
  cursor:pointer;
}
.searchable-select-menu{border-radius:15px;box-shadow:0 22px 60px rgba(15,23,42,.2)}
.searchable-select-option{cursor:pointer}

body.dark .cs-select-trigger,
body.dark .cs-select-menu{background:var(--card,#14212b);color:var(--text,#f8fafc)}
body.dark .cs-select-search-wrap{background:var(--card-2,#1c2b35)}
body.dark .cs-select-option:hover,
body.dark .cs-select-option:focus-visible,
body.dark .cs-select-option.is-active{background:rgba(45,212,191,.09)}
body.dark .cs-select-option.is-selected{background:rgba(45,212,191,.15);color:#99f6e4}
body.dark .cs-select-menu-close{background:var(--card-2,#1c2b35);color:var(--text,#f8fafc)}

@media(max-width:700px){
  .toolbar .cs-select--toolbar,
  #addMemberForm .cs-select,
  .cs-select--role,
  .catalog-filters .cs-select,
  .catalog-toolbar .cs-select{
    width:100%;
    min-width:0;
    max-width:none;
    flex:1 1 100%;
  }
  .cs-select-menu{
    left:12px!important;
    right:12px!important;
    top:auto!important;
    bottom:12px!important;
    width:auto!important;
    max-width:none;
    max-height:min(72dvh,620px)!important;
    border-radius:20px;
    animation:cs-select-mobile-in .18s ease-out;
  }
  @keyframes cs-select-mobile-in{
    from{opacity:0;transform:translateY(18px)}
    to{opacity:1;transform:translateY(0)}
  }
  .cs-select-menu-head{display:flex}
  .cs-select-search-wrap{margin:8px 12px}
  .cs-select-options{padding:6px 8px 12px}
  .cs-select-option{min-height:47px;padding:11px 12px}
  .cs-select-backdrop{
    position:fixed;
    inset:0;
    z-index:5999;
    display:block;
    width:100%;
    height:100%;
    padding:0;
    border:0;
    background:rgba(2,15,18,.5);
    backdrop-filter:blur(2px);
    cursor:default;
  }
}

/* ===== Correctif v11.0.0 — contraste complet du mode sombre ===== */
:root{
  --panel:var(--card);
  --surface:var(--card-2);
  --surface-soft:#f0fdfa;
  --input-bg:#fff;
  --primary-soft:#e6fffa;
  --text-muted:var(--muted);
  --border-color:var(--border);
}
body.dark{
  --panel:var(--card);
  --surface:var(--card-2);
  --surface-soft:#132d31;
  --input-bg:var(--card-2);
  --primary-soft:rgba(45,212,191,.12);
  --text-muted:var(--muted);
  --border-color:var(--border);
}

/* Référentiel : compteurs lisibles */
body.dark .catalog-summary{
  background:#132d31;
  border:1px solid var(--border);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.025);
}
body.dark .catalog-summary strong{color:#f8fafc}
body.dark .catalog-summary span{color:#c7d6dd}

/* Commandes : totaux lisibles */
body.dark .order-totals{
  background:var(--card);
  border-color:var(--border);
}
body.dark .order-totals>div{
  background:var(--card-2);
  border-color:#415563;
  color:var(--text);
}
body.dark .order-totals span{color:#c7d6dd}
body.dark .order-totals strong{color:#f8fafc}
body.dark .order-totals .order-value-summary strong{color:#5eead4}

/* Paramètres : onglets, champs et listes sanitaires */
body.dark .settings-tabs{
  background:var(--card);
  border-color:var(--border);
}
body.dark .settings-tab{color:#c7d6dd}
body.dark .settings-tab:hover{background:rgba(45,212,191,.08);color:#f8fafc}
body.dark .settings-tab.active{background:var(--primary);color:#062e2a}
body.dark .center-logo-editor{
  background:rgba(45,212,191,.045);
  border-color:var(--border);
}
body.dark .center-profile-form input,
body.dark .center-profile-form textarea{
  background:var(--card-2);
  color:var(--text);
  border-color:var(--border);
}
body.dark .center-profile-form input[readonly]{
  background:#12202a;
  color:#d7e7ec;
}
body.dark .searchable-select-trigger,
body.dark .searchable-select-menu,
body.dark .searchable-select-option{
  background:var(--card-2);
  color:var(--text);
  border-color:var(--border);
}
body.dark .searchable-select-search-wrap{
  background:#101b24;
  border-color:var(--border);
}
body.dark .searchable-select-search{
  background:transparent!important;
  color:var(--text)!important;
}
body.dark .searchable-select-search::placeholder{color:#8297a2}
body.dark .searchable-select-option:hover,
body.dark .searchable-select-option:focus{
  background:rgba(45,212,191,.10);
}
body.dark .searchable-select-option.selected{
  background:rgba(45,212,191,.16);
  color:#99f6e4;
}
body.dark .searchable-select.disabled .searchable-select-trigger{
  background:#111c25;
  color:#81949f;
}
body.dark .input-with-action{
  background:var(--card-2);
  border-color:var(--border);
}
body.dark .input-with-action button{
  background:rgba(45,212,191,.10);
  color:#99f6e4;
  border-color:var(--border);
}
body.dark .sync-state-row{
  background:rgba(45,212,191,.08);
  color:var(--text);
}

/* Les anciens sélecteurs sanitaires ne doivent jamais rester visibles en double. */
.searchable-native-select,
.searchable-select-native{
  position:absolute!important;
  width:1px!important;
  height:1px!important;
  padding:0!important;
  margin:0!important;
  border:0!important;
  opacity:0!important;
  pointer-events:none!important;
  clip:rect(0 0 0 0)!important;
  clip-path:inset(50%)!important;
  overflow:hidden!important;
  white-space:nowrap!important;
}


/* ===== v11.0.0 — identité et données strictement isolées par centre ===== */
.identity-permission-notice,
.data-scope-banner{
  display:flex;
  align-items:flex-start;
  gap:10px;
  margin:0 0 16px;
  padding:12px 14px;
  border:1px solid var(--border);
  border-radius:12px;
  background:var(--card-2);
  color:var(--text);
  line-height:1.45;
}
.identity-permission-notice.full{border-color:#86efac;background:#f0fdf4;color:#166534}
.identity-permission-notice.limited{border-color:#93c5fd;background:#eff6ff;color:#1e40af}
.identity-permission-notice.readonly{border-color:#cbd5e1;background:#f8fafc;color:#475569}
.data-scope-banner{flex-wrap:wrap;justify-content:space-between}
.data-scope-banner strong{color:var(--primary-dark)}
.data-scope-banner span{color:var(--muted)}
.center-profile-form input:disabled,
.center-profile-form textarea:disabled,
.center-profile-form select:disabled,
.center-profile-form input[readonly]{
  cursor:not-allowed;
  opacity:.82;
  background:var(--bg-soft);
  color:var(--muted);
}
.center-profile-form.identity-limited .searchable-select.disabled .searchable-select-trigger,
.center-profile-form.identity-readonly .searchable-select.disabled .searchable-select-trigger{
  cursor:not-allowed;
  opacity:.82;
  background:var(--bg-soft);
  color:var(--muted);
}
body.dark .identity-permission-notice.full{background:#123524;color:#86efac;border-color:#225f3b}
body.dark .identity-permission-notice.limited{background:#142c4a;color:#93c5fd;border-color:#294f7c}
body.dark .identity-permission-notice.readonly{background:#25313a;color:#cbd5e1;border-color:#45545f}
body.dark .data-scope-banner{background:var(--card-2);color:var(--text)}
body.dark .data-scope-banner strong{color:#7de7da}
body.dark .center-profile-form input:disabled,
body.dark .center-profile-form textarea:disabled,
body.dark .center-profile-form select:disabled,
body.dark .center-profile-form input[readonly],
body.dark .center-profile-form.identity-limited .searchable-select.disabled .searchable-select-trigger,
body.dark .center-profile-form.identity-readonly .searchable-select.disabled .searchable-select-trigger{
  background:#1d2a32;
  color:#9fb0ba;
  border-color:#3b4b55;
}
@media(max-width:650px){
  .data-scope-banner{display:grid;gap:5px}
}

/* Référentiel : actions des produits déjà rattachés au centre */
.catalog-stock-create{
  background:var(--primary)!important;
  color:#fff!important;
  border:1px solid var(--primary)!important;
}
.catalog-stock-create:hover{
  background:var(--primary-dark)!important;
  border-color:var(--primary-dark)!important;
}
.catalog-stock-remove{
  margin-top:8px!important;
  background:#dc2626!important;
  color:#ffffff!important;
  border:1px solid #dc2626!important;
  box-shadow:0 5px 12px rgba(220,38,38,.18);
}
.catalog-stock-remove:hover{
  background:#b91c1c!important;
  color:#ffffff!important;
  border-color:#b91c1c!important;
}
body.dark .catalog-stock-remove{
  background:#ef4444!important;
  color:#ffffff!important;
  border-color:#ef4444!important;
}
body.dark .catalog-stock-remove:hover{
  background:#dc2626!important;
  border-color:#dc2626!important;
}


/* ===== Actions centres et confirmation mot de passe ===== */
.btn.center-action-success{
  background:linear-gradient(135deg,#0f766e,#0d9488);
  color:#fff;
  border:1px solid rgba(15,118,110,.22);
  box-shadow:0 7px 16px rgba(15,118,110,.18);
}
.btn.center-action-success:hover{
  background:linear-gradient(135deg,#0b655f,#0f766e);
  color:#fff;
  box-shadow:0 10px 22px rgba(15,118,110,.24);
}
.btn.center-action-danger{
  background:linear-gradient(135deg,#dc2626,#b91c1c);
  color:#fff;
  border:1px solid rgba(185,28,28,.22);
  box-shadow:0 7px 16px rgba(220,38,38,.18);
}
.btn.center-action-danger:hover{
  background:linear-gradient(135deg,#b91c1c,#991b1b);
  color:#fff;
  box-shadow:0 10px 22px rgba(220,38,38,.25);
}
.btn.center-action-success:disabled,
.btn.center-action-danger:disabled{
  opacity:.48;
  box-shadow:none;
}

.password-change-confirm-dialog{
  border:0;
  padding:0;
  width:min(92vw,520px);
  max-width:520px;
  border-radius:26px;
  overflow:visible;
  background:transparent;
  box-shadow:none;
}
.password-change-confirm-dialog::backdrop{
  background:rgba(2,18,17,.68);
  backdrop-filter:blur(6px);
}
.password-change-confirm-card{
  position:relative;
  overflow:hidden;
  padding:34px 32px 30px;
  border:1px solid var(--border);
  border-radius:26px;
  background:var(--card);
  color:var(--text);
  text-align:center;
  box-shadow:0 28px 80px rgba(0,0,0,.34);
}
.password-change-confirm-card::before{
  content:"";
  position:absolute;
  inset:0 0 auto;
  height:7px;
  background:linear-gradient(90deg,#0f766e,#14b8a6,#22c55e);
}
.password-change-confirm-close{
  position:absolute;
  top:17px;
  right:18px;
  width:38px;
  height:38px;
  display:grid;
  place-items:center;
  border:0;
  border-radius:12px;
  background:var(--card-2);
  color:var(--muted);
  font-size:25px;
  line-height:1;
  cursor:pointer;
}
.password-change-confirm-close:hover{
  color:var(--text);
  transform:translateY(-1px);
}
.password-change-confirm-icon{
  width:82px;
  height:82px;
  margin:4px auto 18px;
  display:grid;
  place-items:center;
  border-radius:24px;
  background:linear-gradient(145deg,#ccfbf1,#dcfce7);
  box-shadow:0 14px 30px rgba(15,118,110,.15);
  font-size:41px;
}
.password-change-confirm-kicker{
  margin:0 0 8px;
  color:#0f766e;
  font-size:.78rem;
  font-weight:900;
  letter-spacing:.12em;
  text-transform:uppercase;
}
.password-change-confirm-card h2{
  margin:0 36px 12px;
  font-size:clamp(1.45rem,4vw,1.95rem);
  letter-spacing:-.025em;
}
.password-change-confirm-text{
  margin:0 auto 20px;
  max-width:410px;
  color:var(--muted);
  line-height:1.6;
}
.password-change-confirm-center{
  display:flex;
  flex-direction:column;
  gap:5px;
  margin:0 0 24px;
  padding:14px 16px;
  border:1px solid var(--border);
  border-radius:15px;
  background:var(--card-2);
  text-align:left;
}
.password-change-confirm-center span{
  color:var(--muted);
  font-size:.78rem;
  font-weight:800;
  text-transform:uppercase;
  letter-spacing:.07em;
}
.password-change-confirm-center strong{
  overflow-wrap:anywhere;
}
.password-change-confirm-actions{
  display:grid;
  grid-template-columns:1fr 1.35fr;
  gap:12px;
}
.password-change-confirm-actions .btn{
  min-height:48px;
}
body.dark .password-change-confirm-icon{
  background:linear-gradient(145deg,#153d39,#174431);
}
body.dark .password-change-confirm-kicker{
  color:#5eead4;
}
@media(max-width:560px){
  .password-change-confirm-card{padding:30px 20px 22px}
  .password-change-confirm-actions{grid-template-columns:1fr}
  .password-change-confirm-actions .btn{width:100%}
}


/* ===== Correctifs centres / licences — août 2026 ===== */
.btn.license-action-success{
  background:linear-gradient(135deg,#0f766e,#0d9488);
  color:#fff;
  border:1px solid rgba(15,118,110,.22);
  box-shadow:0 7px 16px rgba(15,118,110,.18);
}
.btn.license-action-success:hover{
  background:linear-gradient(135deg,#0b655f,#0f766e);
  color:#fff;
  box-shadow:0 10px 22px rgba(15,118,110,.24);
}
.btn.license-action-success:disabled{
  opacity:.48;
  box-shadow:none;
}
#centerAdminDialog .conditional-field{
  margin-top:8px;
}
#centerAdminDialog .conditional-field[hidden]{
  display:none!important;
}
#centerAdminDialog input:not([type="checkbox"]):not([type="radio"])::placeholder,
.center-profile-form input:not([type="checkbox"]):not([type="radio"])::placeholder{
  color:#94a3b8;
  opacity:1;
}
body.dark #centerAdminDialog input::placeholder,
body.dark .center-profile-form input::placeholder{
  color:#80909c;
}

/* ===== Confirmation avant activation des licences ===== */
.license-kpis{
  grid-template-columns:repeat(3,minmax(0,1fr));
}
.status-badge.trial{
  background:#e0f2fe;
  color:#075985;
}
.license-banner.trial{
  border-left-color:#0284c7;
}
.license-activation-confirm-dialog{
  width:min(94vw,560px);
  max-width:560px;
  padding:0;
  border:0;
  border-radius:22px;
  background:transparent;
  color:var(--text);
  overflow:visible;
}
.license-activation-confirm-dialog::backdrop{
  background:rgba(15,23,42,.62);
  backdrop-filter:blur(4px);
}
.license-activation-confirm-card{
  position:relative;
  padding:34px 32px 28px;
  border:1px solid var(--border);
  border-radius:22px;
  background:var(--surface);
  box-shadow:0 28px 80px rgba(15,23,42,.28);
  text-align:center;
}
.license-activation-confirm-close{
  position:absolute;
  top:14px;
  right:16px;
  width:36px;
  height:36px;
  border:0;
  border-radius:50%;
  background:var(--card-2);
  color:var(--muted);
  font-size:1.45rem;
  line-height:1;
  cursor:pointer;
}
.license-activation-confirm-close:hover{
  background:var(--border);
  color:var(--text);
}
.license-activation-confirm-icon{
  display:grid;
  place-items:center;
  width:72px;
  height:72px;
  margin:0 auto 16px;
  border-radius:22px;
  background:linear-gradient(145deg,#dcfce7,#ccfbf1);
  font-size:2rem;
  box-shadow:inset 0 0 0 1px rgba(15,118,110,.1);
}
.license-activation-confirm-kicker{
  margin:0 0 8px;
  color:#0f766e;
  font-size:.78rem;
  font-weight:900;
  letter-spacing:.08em;
  text-transform:uppercase;
}
.license-activation-confirm-card h2{
  margin:0 38px 10px;
  font-size:clamp(1.25rem,3vw,1.65rem);
  line-height:1.25;
}
.license-activation-confirm-text{
  max-width:465px;
  margin:0 auto 20px;
  color:var(--muted);
  line-height:1.6;
}
.license-activation-confirm-center{
  display:flex;
  flex-direction:column;
  gap:5px;
  margin-bottom:14px;
  padding:15px 16px;
  border:1px solid var(--border);
  border-radius:15px;
  background:var(--card-2);
  text-align:left;
}
.license-activation-confirm-center span{
  color:var(--muted);
  font-size:.76rem;
  font-weight:900;
  letter-spacing:.07em;
  text-transform:uppercase;
}
.license-activation-confirm-center strong{
  font-size:1.03rem;
  overflow-wrap:anywhere;
}
.license-activation-confirm-center small{
  color:var(--muted);
  line-height:1.45;
  overflow-wrap:anywhere;
}
.license-activation-confirm-warning{
  display:flex;
  align-items:flex-start;
  gap:10px;
  margin-bottom:22px;
  padding:12px 14px;
  border:1px solid #fde68a;
  border-radius:14px;
  background:#fffbeb;
  color:#92400e;
  text-align:left;
}
.license-activation-confirm-warning p{
  margin:0;
  font-size:.88rem;
  line-height:1.5;
}
.license-activation-confirm-actions{
  display:grid;
  grid-template-columns:1fr 1.55fr;
  gap:12px;
}
.license-activation-confirm-actions .btn{
  min-height:48px;
}
body.dark .status-badge.trial{
  background:rgba(2,132,199,.2);
  color:#7dd3fc;
}
body.dark .license-activation-confirm-icon{
  background:linear-gradient(145deg,#153d39,#174431);
}
body.dark .license-activation-confirm-warning{
  border-color:rgba(245,158,11,.34);
  background:rgba(120,53,15,.24);
  color:#fcd34d;
}
@media(max-width:850px){
  .license-kpis{grid-template-columns:repeat(3,minmax(0,1fr))}
}
@media(max-width:620px){
  .license-kpis{grid-template-columns:1fr}
  .license-activation-confirm-card{padding:30px 20px 22px}
  .license-activation-confirm-card h2{margin-left:24px;margin-right:24px}
  .license-activation-confirm-actions{grid-template-columns:1fr}
  .license-activation-confirm-actions .btn{width:100%}
}

/* ===== Abonnements mensuels personnalisés et arrêt depuis l'interface ===== */
.license-row-actions{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  min-width:230px;
}
.license-row-actions .btn{
  min-height:38px;
  padding:9px 13px;
  white-space:nowrap;
}
.btn.license-action-stop{
  background:linear-gradient(135deg,#dc2626,#b91c1c);
  color:#fff;
  border:1px solid rgba(153,27,27,.3);
  box-shadow:0 7px 16px rgba(220,38,38,.2);
}
.btn.license-action-stop:hover{
  background:linear-gradient(135deg,#b91c1c,#991b1b);
  color:#fff;
  box-shadow:0 10px 22px rgba(220,38,38,.28);
}
.btn.license-action-stop:disabled{
  opacity:.48;
  box-shadow:none;
}
.license-duration-field{
  margin:0 0 14px;
  padding:15px 16px;
  border:1px solid var(--border);
  border-radius:15px;
  background:var(--card-2);
  text-align:left;
}
.license-duration-field label{
  display:block;
  margin-bottom:8px;
  color:var(--text);
  font-size:.88rem;
  font-weight:850;
}
.license-duration-input-wrap{
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  align-items:center;
  overflow:hidden;
  border:1px solid var(--border);
  border-radius:13px;
  background:var(--surface);
  transition:border-color .18s ease,box-shadow .18s ease;
}
.license-duration-input-wrap:focus-within{
  border-color:#0d9488;
  box-shadow:0 0 0 3px rgba(13,148,136,.15);
}
.license-duration-input-wrap input{
  width:100%;
  min-width:0;
  min-height:48px;
  padding:11px 14px;
  border:0!important;
  outline:0!important;
  background:transparent!important;
  color:var(--text);
  font:inherit;
  font-weight:800;
  box-shadow:none!important;
}
.license-duration-input-wrap span{
  align-self:stretch;
  display:grid;
  place-items:center;
  min-width:66px;
  padding:0 14px;
  border-left:1px solid var(--border);
  color:var(--muted);
  font-weight:850;
}
.license-duration-field small{
  display:block;
  margin-top:7px;
  color:var(--muted);
  font-size:.8rem;
  line-height:1.4;
}
.license-duration-field small.valid{
  color:#0f766e;
  font-weight:750;
}
.license-stop-confirm-icon{
  background:linear-gradient(145deg,#fee2e2,#fecaca);
  box-shadow:inset 0 0 0 1px rgba(220,38,38,.12);
}
.license-stop-confirm-kicker{
  color:#b91c1c;
}
.license-stop-confirm-warning{
  display:flex;
  align-items:flex-start;
  gap:10px;
  margin-bottom:22px;
  padding:12px 14px;
  border:1px solid #fecaca;
  border-radius:14px;
  background:#fff1f2;
  color:#9f1239;
  text-align:left;
}
.license-stop-confirm-warning p{
  margin:0;
  font-size:.88rem;
  line-height:1.5;
}
body.dark .license-duration-field{
  background:var(--card-2);
}
body.dark .license-duration-field small.valid{
  color:#5eead4;
}
body.dark .license-stop-confirm-icon{
  background:linear-gradient(145deg,#4c1d1d,#5f1f2a);
}
body.dark .license-stop-confirm-kicker{
  color:#fca5a5;
}
body.dark .license-stop-confirm-warning{
  border-color:rgba(248,113,113,.32);
  background:rgba(127,29,29,.23);
  color:#fecaca;
}
@media(max-width:700px){
  .license-row-actions{
    min-width:0;
    flex-direction:column;
  }
  .license-row-actions .btn{
    width:100%;
  }
}


/* ===== Correctifs ergonomiques : actions, inventaire et traçabilité ===== */
.row-actions{align-items:center;gap:7px}
.row-actions button,
.row-actions .protected-movement{
  display:inline-grid;
  place-items:center;
  width:36px;
  height:36px;
  padding:0;
  border:1px solid var(--border);
  border-radius:10px;
  background:var(--card-2);
  color:#475569;
  transition:transform .15s ease,background .15s ease,border-color .15s ease,color .15s ease;
}
.row-actions button:hover{transform:translateY(-1px);border-color:#94a3b8;background:var(--card)}
.row-actions button[data-action="edit"]{color:#0f766e;background:#ecfdf5;border-color:#a7f3d0}
.row-actions button[data-action="edit"]:hover{background:#d1fae5;border-color:#6ee7b7}
.row-actions button[data-action="view"]{color:#2563eb;background:#eff6ff;border-color:#bfdbfe}
.row-actions button[data-action="view"]:hover{background:#dbeafe;border-color:#93c5fd}
.row-actions button[data-action="delete"]{color:#dc2626;background:#fff1f2;border-color:#fecdd3}
.row-actions button[data-action="delete"]:hover{background:#ffe4e6;border-color:#fda4af}
.row-actions .protected-movement{color:#7c3aed;background:#f5f3ff;border-color:#ddd6fe;cursor:not-allowed}
.action-icon{width:18px;height:18px;stroke-width:2}
body.dark .row-actions button,
body.dark .row-actions .protected-movement{background:#1f313a;border-color:#40545f;color:#d5e1e6}
body.dark .row-actions button[data-action="edit"]{background:#103f37;border-color:#1f7667;color:#79e0ce}
body.dark .row-actions button[data-action="view"]{background:#172f55;border-color:#315d9f;color:#93c5fd}
body.dark .row-actions button[data-action="delete"]{background:#4b1f29;border-color:#7f3341;color:#fda4af}
body.dark .row-actions .protected-movement{background:#34245b;border-color:#5b4194;color:#c4b5fd}

#inventoryDialog{max-height:calc(100dvh - 16px);overflow:hidden}
.inventory-dialog-form{
  max-height:calc(100dvh - 16px);
  overflow:hidden;
  grid-template-rows:auto auto auto minmax(180px,1fr) auto;
}
.inventory-lines-wrap{min-height:180px;max-height:none;overflow:auto}
.inventory-dialog-form>.dialog-actions{
  position:sticky;
  bottom:0;
  z-index:8;
  flex-wrap:wrap;
  margin:0 -22px -22px;
  padding:14px 22px;
  border-top:1px solid var(--border);
  background:var(--card);
  box-shadow:0 -12px 28px rgba(15,23,42,.08);
}

.purpose-banner{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:18px;
  margin-bottom:16px;
  padding:16px 18px;
  border:1px solid #bae6fd;
  border-radius:15px;
  background:#f0f9ff;
  color:#0c4a6e;
}
.purpose-banner strong{display:block;font-size:1rem}
.purpose-banner p{margin:5px 0 0;color:#075985;line-height:1.45}
.purpose-tag{display:inline-flex;white-space:nowrap;padding:7px 10px;border-radius:999px;background:#e0f2fe;color:#0369a1;font-size:.76rem;font-weight:900}
.history-toolbar .history-period-field{display:grid;gap:4px;color:var(--muted);font-size:.75rem;font-weight:800}
.history-toolbar .history-period-field input{min-width:170px}
body.dark .purpose-banner{background:#112f3d;border-color:#245b72;color:#bae6fd}
body.dark .purpose-banner p{color:#9dd9f0}
body.dark .purpose-tag{background:#164e63;color:#bae6fd}

@media(max-width:650px){
  #inventoryDialog{width:calc(100vw - 10px);max-height:calc(100dvh - 10px)}
  .inventory-dialog-form{max-height:calc(100dvh - 10px);padding:14px;grid-template-rows:auto auto auto minmax(150px,1fr) auto}
  .inventory-dialog-form>.dialog-actions{margin:0 -14px -14px;padding:12px 14px;display:grid;grid-template-columns:1fr 1fr}
  .inventory-dialog-form>.dialog-actions .btn{width:100%;padding:11px 10px}
  .inventory-dialog-form>.dialog-actions .btn:last-child{grid-column:1/-1}
  .purpose-banner{align-items:flex-start;flex-direction:column}
  .history-toolbar .history-period-field{width:100%}
  .history-toolbar .history-period-field input{max-width:none;width:100%}
}

/* ===== v11.0.0 — fiches de stock mensuelles ===== */
.stock-sheet-purpose{margin-bottom:16px}
.stock-sheet-controls{display:grid;gap:16px;margin-bottom:18px}
.stock-sheet-filter-grid{display:grid;grid-template-columns:minmax(180px,.65fr) minmax(280px,1.4fr) minmax(180px,.75fr);gap:14px}
.stock-sheet-filter-grid label{display:grid;gap:7px;color:var(--muted);font-size:.82rem;font-weight:800}
.stock-sheet-filter-grid input,.stock-sheet-filter-grid select{width:100%;min-width:0}
.stock-sheet-actions{display:flex;gap:10px;flex-wrap:wrap}
.stock-sheet-actions .btn{margin:0}
.stock-sheet-help{margin:0;padding-top:2px}
.stock-sheet-empty{text-align:center;color:var(--muted)}
.stock-sheet-empty strong{display:block;margin-bottom:5px;color:var(--text);font-size:1.05rem}
.stock-sheets-preview{display:grid;gap:22px}
.stock-sheet-page{
  --sheet-line:#111827;
  width:100%;
  padding:18px;
  border:1px solid var(--border);
  border-radius:14px;
  background:#fff;
  color:#111;
  box-shadow:var(--shadow-soft);
  overflow:hidden;
}
.stock-sheet-document-head{display:grid;grid-template-columns:1fr 1.25fr 1fr;align-items:start;gap:16px;margin-bottom:14px}
.stock-sheet-ministry{font-size:.68rem;line-height:1.45}
.stock-sheet-ministry small{display:block;margin-top:8px;color:#334155;font-weight:700}
.stock-sheet-title-block{text-align:center}
.stock-sheet-title-block h2{margin:0 0 8px;font-family:Georgia,"Times New Roman",serif;font-size:1.45rem;letter-spacing:.04em}
.stock-sheet-title-block strong{font-size:.72rem}
.stock-sheet-service{text-align:right;font-size:.78rem;border-bottom:1px dotted #111;padding-bottom:6px}
.stock-sheet-meta-grid{display:grid;grid-template-columns:1.55fr .75fr;gap:28px;align-items:end;margin-bottom:14px}
.stock-sheet-product-meta{display:grid;gap:5px}
.stock-sheet-product-meta p{display:grid;grid-template-columns:165px 1fr;gap:8px;margin:0;font-family:Georgia,"Times New Roman",serif;font-size:.78rem}
.stock-sheet-product-meta span{min-height:17px;border-bottom:1px dotted #111;font-family:Arial,sans-serif;font-weight:700}
.stock-sheet-mini-table{width:100%;min-width:0;border-collapse:collapse;font-size:.72rem}
.stock-sheet-mini-table th,.stock-sheet-mini-table td{border:1px solid var(--sheet-line);padding:5px 7px;text-align:center;color:#111;background:#fff}
.stock-sheet-table-wrap{width:100%;overflow-x:auto}
.stock-sheet-table{width:100%;min-width:1260px;border-collapse:collapse;table-layout:fixed;font-size:.61rem;color:#111;background:#fff}
.stock-sheet-table th,.stock-sheet-table td{border:1px solid var(--sheet-line);padding:4px 3px;text-align:center;vertical-align:middle;line-height:1.22;overflow-wrap:anywhere}
.stock-sheet-table thead th{font-family:Georgia,"Times New Roman",serif;font-weight:800;background:#f8fafc}
.stock-sheet-table thead th small{font-size:.5rem;font-weight:600}
.stock-sheet-table tbody td{height:25px}
.stock-sheet-table th:nth-child(1),.stock-sheet-table td:nth-child(1){width:68px}
.stock-sheet-table th:nth-child(2),.stock-sheet-table td:nth-child(2){width:190px;text-align:left;padding-left:6px}
.stock-sheet-table th:nth-child(3),.stock-sheet-table td:nth-child(3),
.stock-sheet-table th:nth-child(4),.stock-sheet-table td:nth-child(4),
.stock-sheet-table th:nth-child(5),.stock-sheet-table td:nth-child(5){width:55px}
.stock-sheet-table th:nth-child(6),.stock-sheet-table td:nth-child(6){width:76px}
.stock-sheet-table th:nth-child(7),.stock-sheet-table td:nth-child(7){width:78px}
.stock-sheet-table th:nth-child(8),.stock-sheet-table td:nth-child(8){width:72px}
.stock-sheet-table th:nth-child(9),.stock-sheet-table td:nth-child(9){width:80px}
.stock-sheet-table th:nth-child(10),.stock-sheet-table td:nth-child(10),
.stock-sheet-table th:nth-child(11),.stock-sheet-table td:nth-child(11){width:48px}
.stock-sheet-table th:nth-child(12),.stock-sheet-table td:nth-child(12){width:62px}
.stock-sheet-table th:nth-child(13),.stock-sheet-table td:nth-child(13){width:180px;text-align:left;padding-left:6px}
.stock-sheet-footer{display:flex;justify-content:space-between;gap:12px;margin-top:7px;font-size:.62rem;font-weight:700}
body.dark .stock-sheet-page{border-color:#6b7d86;box-shadow:none}

@media(max-width:850px){
  .stock-sheet-filter-grid{grid-template-columns:1fr 1fr}
  .stock-sheet-filter-grid label:nth-child(2){grid-column:1/-1;grid-row:1}
}
@media(max-width:600px){
  .stock-sheet-filter-grid{grid-template-columns:1fr}
  .stock-sheet-filter-grid label:nth-child(2){grid-column:auto;grid-row:auto}
  .stock-sheet-actions{display:grid;grid-template-columns:1fr}
  .stock-sheet-actions .btn{width:100%}
  .stock-sheet-page{padding:10px}
  .stock-sheet-document-head{grid-template-columns:1fr;text-align:left}
  .stock-sheet-title-block{text-align:left}
  .stock-sheet-service{text-align:left}
  .stock-sheet-meta-grid{grid-template-columns:1fr}
}

@page stockSheetPage{size:A4 landscape;margin:6mm}
@media print{
  body.printing-stock-sheets .print-identity{display:none!important}
  body.printing-stock-sheets #view-stock-sheets>.purpose-banner,
  body.printing-stock-sheets #view-stock-sheets>.stock-sheet-controls,
  body.printing-stock-sheets #view-stock-sheets>.stock-sheet-empty{display:none!important}
  body.printing-stock-sheets #view-stock-sheets,
  body.printing-stock-sheets #view-stock-sheets *{visibility:visible!important}
  body.printing-stock-sheets #view-stock-sheets{position:static!important;inset:auto!important;width:100%!important}
  body.printing-stock-sheets .stock-sheets-preview{display:block!important}
  body.printing-stock-sheets .stock-sheet-page{
    page:stockSheetPage;
    break-after:page;
    page-break-after:always;
    width:100%!important;
    min-height:190mm;
    margin:0!important;
    padding:0!important;
    border:0!important;
    border-radius:0!important;
    box-shadow:none!important;
    overflow:visible!important;
  }
  body.printing-stock-sheets .stock-sheet-page:last-child{break-after:auto;page-break-after:auto}
  body.printing-stock-sheets .stock-sheet-document-head{margin-bottom:8px;gap:10px}
  body.printing-stock-sheets .stock-sheet-title-block h2{font-size:15pt;margin-bottom:4px}
  body.printing-stock-sheets .stock-sheet-meta-grid{margin-bottom:7px;gap:18px}
  body.printing-stock-sheets .stock-sheet-product-meta{gap:2px}
  body.printing-stock-sheets .stock-sheet-product-meta p{grid-template-columns:142px 1fr;font-size:7.2pt}
  body.printing-stock-sheets .stock-sheet-mini-table{font-size:6.6pt}
  body.printing-stock-sheets .stock-sheet-mini-table th,
  body.printing-stock-sheets .stock-sheet-mini-table td{padding:3px 4px}
  body.printing-stock-sheets .stock-sheet-table-wrap{overflow:visible!important}
  body.printing-stock-sheets .stock-sheet-table{min-width:0!important;width:100%!important;font-size:5.6pt}
  body.printing-stock-sheets .stock-sheet-table th,
  body.printing-stock-sheets .stock-sheet-table td{padding:2px 2px;line-height:1.12}
  body.printing-stock-sheets .stock-sheet-table tbody td{height:7.4mm}
  body.printing-stock-sheets .stock-sheet-footer{font-size:5.6pt;margin-top:3px}
}


/* Ajout groupé de médicaments */
.batch-medicine-dialog{width:min(1180px,96vw);max-width:none}
.batch-medicine-form{padding:20px;display:grid;gap:16px}
.batch-common-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;align-items:end}
.batch-common-grid label{display:grid;gap:6px}
.batch-apply-expiry{height:44px}
.batch-table-wrap{max-height:58vh;overflow:auto;border:1px solid var(--border);border-radius:14px}
.batch-medicine-table{width:100%;border-collapse:collapse;min-width:1050px}
.batch-medicine-table th{position:sticky;top:0;z-index:2;background:var(--bg-soft);white-space:nowrap}
.batch-medicine-table th,.batch-medicine-table td{padding:9px;border-bottom:1px solid var(--border);vertical-align:middle}
.batch-medicine-table input{min-width:90px;width:100%;padding:9px;border:1px solid var(--border);border-radius:9px;background:var(--card);color:var(--text)}
.batch-medicine-name{min-width:280px}.batch-medicine-name strong,.batch-medicine-name small{display:block}.batch-medicine-name small{margin-top:3px;color:var(--muted)}
.batch-name-label{display:block;margin:0}.batch-name-label>span{display:block;margin-bottom:5px;font-size:12px;color:var(--muted);font-weight:700}.batch-name-label .batch-name{width:100%;min-width:240px;box-sizing:border-box;font:inherit;font-weight:700}.batch-name-label .batch-name:focus{position:relative;z-index:2}
.catalog-check-count{font-weight:800;color:var(--primary);white-space:nowrap}
@media(max-width:850px){.batch-common-grid{grid-template-columns:1fr 1fr}.batch-medicine-dialog{width:98vw}.batch-table-wrap{max-height:62vh}}
@media(max-width:520px){.batch-common-grid{grid-template-columns:1fr}}


/* ===== Sélection multiple et retrait sécurisé du stock — shell 27 ===== */
.medicine-bulk-bar{
  display:flex;
  align-items:center;
  gap:14px;
  flex-wrap:wrap;
  margin:0 0 12px;
  padding:12px 14px;
  border:1px solid #fecaca;
  border-radius:14px;
  background:#fff7f7;
}
.medicine-bulk-select-all{display:flex;align-items:center;gap:9px;font-weight:750;cursor:pointer}
.medicine-bulk-select-all input,.medicine-row-check,#medicineHeaderSelectAll{width:18px;height:18px;accent-color:#0f766e;cursor:pointer}
.medicine-bulk-actions{display:flex;gap:9px;margin-left:auto;flex-wrap:wrap}
#selectMedicinesBtn.active-selection{background:#0f766e;color:#fff;border-color:#0f766e}
#view-medicines .col-bulk-select{min-width:52px;width:52px;text-align:center!important;background:#f8fafc;color:#172026}
#view-medicines .stock-sheet-header .col-bulk-select{background:#20252b;color:#fff}
#view-medicines .stock-sheet-row.medicine-row-selected td{box-shadow:inset 0 0 0 2px rgba(15,118,110,.26)}
body.dark .medicine-bulk-bar{background:#3b2025;border-color:#7f3341}
body.dark #view-medicines .col-bulk-select{background:#293740;color:#edf7f6}
@media(max-width:760px){
  .medicine-bulk-bar{align-items:stretch}
  .medicine-bulk-select-all{width:100%}
  .medicine-bulk-actions{width:100%;margin-left:0}
  .medicine-bulk-actions .btn{flex:1 1 150px}
}
@media print{.medicine-bulk-bar,.bulk-selection-cell,#selectMedicinesBtn{display:none!important}}

#confirmMessage{white-space:pre-line}
.read-only-mode #selectMedicinesBtn,.read-only-mode #medicineBulkBar{display:none!important}

/* ===== CS STOCK v11.0.0 — ergonomie Android / mobile — shell 28 ===== */
.mobile-filter-toggle,
.mobile-wizard-progress,
.mobile-wizard-actions,
.inventory-next-missing,
.inventory-mobile-progress,
.mobile-card-details{display:none}

.mobile-card-details svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round}

@media(max-width:760px){
  /* Saisie confortable */
  input,select,textarea,.select-field,.cs-select-trigger,.searchable-select-trigger{font-size:16px!important}
  input:not([type="checkbox"]):not([type="radio"]),select,.select-field,.cs-select-trigger,.searchable-select-trigger{min-height:50px}
  textarea{min-height:96px}
  .btn{min-height:48px;padding:12px 14px;font-size:.96rem}
  .icon-btn{min-width:44px;min-height:44px}

  /* Fenêtres principales plein écran */
  #medicineDialog,#movementDialog,#inventoryDialog,#adjustmentDialog,#batchMedicineDialog{
    inset:0!important;
    width:100vw!important;
    max-width:none!important;
    height:100vh!important;
    height:100dvh!important;
    max-height:none!important;
    margin:0!important;
    padding:0!important;
    border:0!important;
    border-radius:0!important;
  }
  #medicineDialog::backdrop,#movementDialog::backdrop,#inventoryDialog::backdrop,#adjustmentDialog::backdrop,#batchMedicineDialog::backdrop{background:rgba(3,18,17,.72)}
  #medicineDialog>form,#movementDialog>form,#inventoryDialog>form,#adjustmentDialog>form,#batchMedicineDialog>form{
    width:100%;height:100%;max-height:none!important;overflow-y:auto!important;overscroll-behavior:contain;
    padding:14px 14px calc(104px + env(safe-area-inset-bottom))!important;
    display:grid;align-content:start;gap:14px;
  }
  #medicineDialog .dialog-head,#movementDialog .dialog-head,#inventoryDialog .dialog-head,#adjustmentDialog .dialog-head,#batchMedicineDialog .dialog-head{
    position:sticky;top:-14px;z-index:18;margin:-14px -14px 0;padding:14px;
    border-bottom:1px solid var(--border);background:var(--card);
  }
  #medicineDialog .dialog-head h2,#movementDialog .dialog-head h2,#inventoryDialog .dialog-head h2,#adjustmentDialog .dialog-head h2,#batchMedicineDialog .dialog-head h2{font-size:1.16rem}
  .required-help{margin:0;font-size:.78rem}

  /* Assistants en étapes */
  .mobile-wizard-progress{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:11px 12px;border:1px solid var(--border);border-radius:14px;background:var(--card-2)}
  .mobile-wizard-progress-copy{display:grid;gap:2px}.mobile-wizard-progress-copy small{color:var(--muted);font-weight:800}.mobile-wizard-progress-copy strong{font-size:.96rem}
  .mobile-wizard-dots{display:flex;gap:5px}.mobile-wizard-dots i{display:block;width:20px;height:5px;border-radius:999px;background:var(--border)}.mobile-wizard-dots i.active{background:var(--primary)}
  .mobile-wizard-form [data-mobile-step]:not(.mobile-step-active){display:none!important}
  .mobile-wizard-form .mobile-step-grid-hidden{display:none!important}
  .mobile-wizard-original-actions{display:none!important}
  .mobile-wizard-actions{
    position:fixed;z-index:25;left:0;right:0;bottom:0;display:grid;grid-template-columns:1fr 1fr;gap:9px;
    padding:11px 14px calc(11px + env(safe-area-inset-bottom));border-top:1px solid var(--border);background:var(--card);box-shadow:0 -12px 30px rgba(15,23,42,.12)
  }
  .mobile-wizard-actions .btn{width:100%;margin:0}
  .mobile-wizard-actions .mobile-wizard-next,.mobile-wizard-actions .mobile-wizard-save{grid-column:2}
  .mobile-wizard-actions .mobile-wizard-cancel{grid-column:1;grid-row:1}
  .mobile-wizard-actions .mobile-wizard-back{grid-column:1;grid-row:1}
  .mobile-wizard-actions .mobile-wizard-back:not(.hidden)+.mobile-wizard-next,
  .mobile-wizard-actions .mobile-wizard-back:not(.hidden)~.mobile-wizard-save{grid-column:2}
  .mobile-wizard-actions .hidden{display:none!important}
  #movementSduCard{margin:2px 0;padding:14px}

  /* Actions fixes des formulaires sans assistant */
  #adjustmentDialog .dialog-actions,#batchMedicineDialog .dialog-actions,#inventoryDialog .dialog-actions{
    position:fixed;z-index:24;left:0;right:0;bottom:0;margin:0!important;padding:11px 14px calc(11px + env(safe-area-inset-bottom))!important;
    border-top:1px solid var(--border);background:var(--card);box-shadow:0 -12px 30px rgba(15,23,42,.12)
  }
  #adjustmentDialog .dialog-actions,#batchMedicineDialog .dialog-actions{display:grid;grid-template-columns:1fr 1fr}
  #adjustmentDialog .dialog-actions .btn,#batchMedicineDialog .dialog-actions .btn{width:100%;margin:0}

  /* Barre Mon stock plus courte */
  #view-medicines .medicine-toolbar{display:grid;grid-template-columns:1fr 1fr;gap:9px;align-items:stretch}
  #view-medicines .medicine-toolbar #medicineSearch{grid-column:1/-1;max-width:none;width:100%}
  .mobile-filter-toggle{display:flex;grid-column:1/-1;align-items:center;justify-content:space-between;width:100%}
  .mobile-filter-toggle.active{border-color:var(--primary);color:var(--primary)}
  #view-medicines .medicine-toolbar .mobile-filter-control{display:none;width:100%;max-width:none;margin:0}
  #view-medicines .medicine-toolbar.mobile-filters-open .mobile-filter-control{display:flex;grid-column:1/-1}
  #view-medicines .medicine-toolbar.mobile-filters-open #clearMedicineFiltersBtn.hidden{display:none!important}
  #view-medicines .medicine-toolbar .mobile-stock-primary-action{width:100%;margin:0}
  #view-medicines #selectMedicinesBtn{grid-column:1/-1}
  #view-medicines #expiryFilterSummary{margin:0 0 10px}

  /* Tous les tableaux importants deviennent des cartes */
  .table-wrap:has(.mobile-card-table){overflow:visible!important;border:0!important;background:transparent!important}
  .mobile-card-table{display:block!important;width:100%!important;min-width:0!important;border-collapse:separate!important}
  .mobile-card-table thead{display:none!important}
  .mobile-card-table tbody{display:grid!important;gap:11px;width:100%}
  .mobile-card-table tbody tr.mobile-data-card{
    position:relative;display:grid!important;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:10px 12px;width:100%;padding:14px;
    border:1px solid var(--border);border-radius:16px;background:var(--card);box-shadow:0 5px 16px rgba(15,23,42,.06)
  }
  .mobile-card-table tbody td{display:flex!important;min-width:0!important;padding:0!important;border:0!important;flex-direction:column;gap:4px;align-items:flex-start!important;text-align:left!important;white-space:normal!important}
  .mobile-card-table tbody td::before{content:attr(data-label);display:block;color:var(--muted);font-size:.69rem;font-weight:850;letter-spacing:.035em;text-transform:uppercase}
  .mobile-card-table tbody td[data-label="Produit"],
  .mobile-card-table tbody td[data-label="Médicament"],
  .mobile-card-table tbody td[data-label="Nom du médicament"],
  .mobile-card-table tbody td[data-label="Référence"]{grid-column:1/-1}
  .mobile-card-table tbody td[data-label="Actions"],.mobile-card-table tbody td:last-child:has(.row-actions){grid-column:1/-1}
  .mobile-card-table .row-actions{display:flex!important;width:100%;justify-content:flex-end;gap:8px}
  .mobile-card-table .row-actions button{min-width:46px;min-height:44px;border-radius:12px}
  .mobile-card-table .table-subline{margin-top:2px}
  .mobile-card-table tr.mobile-empty-row{display:block!important;padding:18px;border:1px dashed var(--border);border-radius:14px;background:var(--card)}
  .mobile-card-table tr.mobile-empty-row td{display:block!important;text-align:center!important}
  .mobile-card-table tr.mobile-empty-row td::before{display:none}

  /* Carte stock : résumé d’abord, détails à la demande */
  .mobile-stock-table tbody tr{padding-top:16px!important}
  .mobile-stock-table .col-name{grid-column:1/-1;padding-right:34px!important}
  .mobile-stock-table .col-name strong{font-size:1rem;line-height:1.35}
  .mobile-stock-table .col-type,.mobile-stock-table .col-source{grid-column:auto}
  .mobile-stock-table .col-available strong,.mobile-stock-table .col-available{font-size:1.05rem;font-weight:850;color:var(--primary-dark)}
  .mobile-stock-table tr:not(.mobile-expanded) .col-unit,
  .mobile-stock-table tr:not(.mobile-expanded) .col-price,
  .mobile-stock-table tr:not(.mobile-expanded) .col-required,
  .mobile-stock-table tr:not(.mobile-expanded) .col-initial,
  .mobile-stock-table tr:not(.mobile-expanded) .col-entries,
  .mobile-stock-table tr:not(.mobile-expanded) .col-exits{display:none!important}
  .mobile-stock-table .col-actions{grid-column:1/-1;border-top:1px solid var(--border)!important;padding-top:10px!important}
  .mobile-stock-table .col-actions .row-actions{justify-content:space-between}
  .mobile-card-details{display:inline-flex!important;align-items:center;gap:7px;width:auto!important;padding:0 12px!important;color:var(--primary)!important;background:var(--primary-soft)!important;border:1px solid rgba(15,118,110,.18)!important}
  .mobile-stock-table .bulk-selection-cell:not(.hidden){position:absolute;top:12px;right:12px;display:flex!important;width:auto!important;z-index:2}
  .mobile-stock-table .bulk-selection-cell:not(.hidden)::before{display:none}
  .mobile-stock-table .medicine-row-check{width:24px;height:24px}

  /* Inventaire rapide */
  #inventoryDialog .inventory-search-row{position:sticky;top:66px;z-index:13;display:grid;grid-template-columns:1fr auto;gap:8px;margin:0 -2px;padding:8px 2px;background:var(--card)}
  #inventoryDialog .inventory-search-row input{grid-column:1/-1;width:100%}
  #inventoryDialog #inventoryProgress{align-self:center;text-align:left;font-size:.82rem}
  .inventory-next-missing{display:inline-flex;min-height:42px;padding:8px 11px;font-size:.82rem}
  .inventory-mobile-progress{display:block;height:7px;margin-top:-7px;border-radius:999px;background:var(--border);overflow:hidden}
  .inventory-mobile-progress span{display:block;width:0;height:100%;border-radius:inherit;background:var(--primary);transition:width .2s ease}
  .inventory-lines-wrap{min-height:0!important;max-height:none!important;overflow:visible!important;border:0!important}
  .mobile-inventory-count-table tbody tr{grid-template-columns:1fr 1fr!important}
  .mobile-inventory-count-table tbody td:first-child{grid-column:1/-1}
  .mobile-inventory-count-table .inventory-count-input{width:100%;min-width:0;min-height:56px;font-size:1.15rem!important;font-weight:850;text-align:center}
  .mobile-inventory-count-table .inventory-difference{font-size:1.08rem;justify-content:flex-start}
  #inventoryDialog .inventory-dialog-form>.dialog-actions{display:grid!important;grid-template-columns:1fr 1fr!important}
  #inventoryDialog .inventory-dialog-form>.dialog-actions .btn:last-child{grid-column:1/-1}

  /* Ajout de plusieurs produits sans tableau horizontal */
  #batchMedicineDialog .batch-common-grid{grid-template-columns:1fr!important}
  #batchMedicineDialog .batch-table-wrap{max-height:none;overflow:visible;border:0}
  .mobile-batch-table tbody tr{grid-template-columns:1fr 1fr!important}
  .mobile-batch-table tbody td:first-child{grid-column:1/-1}
  .mobile-batch-table input{width:100%!important;min-width:0!important;min-height:50px}
  .mobile-batch-table tbody td:last-child{grid-column:1/-1;align-items:flex-end!important}

  /* Barres de recherche des autres écrans */
  .v11-toolbar{display:grid;grid-template-columns:1fr 1fr;gap:9px}
  .v11-toolbar>input{grid-column:1/-1;width:100%!important;max-width:none!important}
  .v11-toolbar>.btn{width:100%;margin:0!important}

  body.dark .mobile-card-table tbody tr.mobile-data-card{box-shadow:none}
  body.dark .mobile-wizard-actions,
  body.dark #adjustmentDialog .dialog-actions,
  body.dark #batchMedicineDialog .dialog-actions,
  body.dark #inventoryDialog .dialog-actions{box-shadow:0 -12px 30px rgba(0,0,0,.28)}
}

@media(min-width:761px){
  .mobile-wizard-form [data-mobile-step]{display:revert!important}
}
@media(max-width:760px){
  .mobile-card-table .bulk-selection-cell.hidden{display:none!important}
}
@media(max-width:760px){
  #inventoryDialog>form{padding-bottom:calc(165px + env(safe-area-inset-bottom))!important}
}


/* shell-35 — licence en consultation pour les centres */
.license-managed-note{
  margin:16px 0 0;
  padding:12px 14px;
  border:1px solid var(--border, #dbe5e4);
  border-radius:12px;
  background:var(--surface-soft, #f6faf9);
  color:var(--muted, #64748b);
  font-size:.92rem;
  line-height:1.45;
}

/* ===== Renouvellement Wave avec reçu — shell-36 ===== */
.renewal-panel-head{align-items:flex-start;gap:18px}.renewal-panel-head>div{flex:1}.renewal-open-btn{white-space:nowrap}
.renewal-center-panel,.renewal-admin-panel{overflow:hidden}.renewal-current-request{margin-top:8px}.renewal-history-wrap{margin-top:22px;border-top:1px solid var(--border,#dfe7ee);padding-top:18px}.renewal-history-wrap h3{margin:0 0 12px;font-size:1rem}
.renewal-empty-card{display:flex;flex-direction:column;gap:5px;padding:20px;border:1px dashed #b8c8d6;border-radius:14px;background:rgba(15,111,198,.035)}.renewal-empty-card strong{font-size:1rem}.renewal-empty-card span{color:var(--muted,#667085);font-size:.9rem}
.renewal-active-card{border:1px solid #bfdbfe;border-left:5px solid #0b6bcb;border-radius:15px;padding:18px;background:linear-gradient(135deg,rgba(219,234,254,.65),rgba(255,255,255,.9))}.renewal-active-card.payment_declared,.renewal-active-card.under_review{border-left-color:#7c3aed;background:linear-gradient(135deg,rgba(237,233,254,.7),rgba(255,255,255,.9))}.renewal-active-top{display:flex;justify-content:space-between;gap:12px;align-items:flex-start}.renewal-active-top h3{margin:4px 0 0}.renewal-request-number{font-size:.76rem;font-weight:800;letter-spacing:.07em;color:#64748b}.renewal-active-meta{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;margin-top:16px}.renewal-active-meta span{display:flex;flex-direction:column;gap:4px;padding:10px 12px;border-radius:11px;background:rgba(255,255,255,.72)}.renewal-active-meta small{color:#64748b}.renewal-active-meta strong{font-size:.88rem;overflow-wrap:anywhere}.renewal-active-actions{display:flex;gap:10px;margin-top:15px;flex-wrap:wrap}.renewal-waiting-note{margin:14px 0 0;padding:11px 13px;border-radius:10px;background:rgba(124,58,237,.08);color:#5b21b6;font-size:.9rem}
.renewal-history{display:grid;gap:8px}.renewal-history-row{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:11px 12px;border:1px solid var(--border,#e2e8f0);border-radius:11px}.renewal-history-row>div:first-child{display:flex;flex-direction:column;gap:3px}.renewal-history-row small{color:var(--muted,#64748b)}.renewal-history-status{display:flex;align-items:flex-end;flex-direction:column;gap:4px;text-align:right}
.renewal-status{display:inline-flex;align-items:center;justify-content:center;padding:5px 9px;border-radius:999px;font-size:.72rem;font-weight:800;white-space:nowrap}.renewal-status.warning{background:#fef3c7;color:#92400e}.renewal-status.info{background:#e0e7ff;color:#3730a3}.renewal-status.success{background:#d1fae5;color:#065f46}.renewal-status.danger{background:#fee2e2;color:#991b1b}.renewal-status.muted-status{background:#e2e8f0;color:#475569}.danger-text{color:#b42318!important}
.renewal-pending-badge{display:inline-flex;padding:7px 11px;border-radius:999px;background:#fff3cd;color:#8a5700;font-weight:800;font-size:.8rem}.renewal-admin-toolbar{padding:0 18px 14px}.renewal-admin-table-wrap{border-top:1px solid var(--border,#e2e8f0)}.renewal-admin-row.needs-review{background:rgba(255,247,214,.65)}.renewal-small-btn{padding:7px 10px!important;font-size:.78rem!important;white-space:nowrap}
.renewal-dialog{border:0;padding:0;background:transparent;max-width:min(720px,calc(100vw - 24px));width:100%}.renewal-dialog::backdrop{background:rgba(2,12,27,.65);backdrop-filter:blur(4px)}.renewal-dialog-card{position:relative;background:var(--surface,#fff);color:var(--text,#15202b);border-radius:22px;padding:27px;box-shadow:0 25px 80px rgba(0,0,0,.28);max-height:calc(100vh - 28px);overflow:auto}.renewal-dialog-close{position:absolute;right:15px;top:13px;width:39px;height:39px;border:0;border-radius:50%;background:#eef3f7;color:#344054;font-size:1.45rem;cursor:pointer}.renewal-kicker{margin:0 0 6px;text-transform:uppercase;letter-spacing:.1em;font-size:.73rem;font-weight:900;color:#0b6bcb}.renewal-dialog-card h2{margin:0 42px 8px 0;font-size:1.55rem}.renewal-dialog-intro{margin:0 0 18px;color:var(--muted,#667085);line-height:1.55}
.renewal-plans-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:11px}.renewal-plan-card{position:relative;display:flex;flex-direction:column;align-items:flex-start;gap:5px;padding:16px;border:2px solid #dce6ef;border-radius:15px;background:var(--surface,#fff);color:inherit;cursor:pointer;text-align:left;transition:.18s ease}.renewal-plan-card:hover{border-color:#8abbe9;transform:translateY(-1px)}.renewal-plan-card.selected{border-color:#0b6bcb;background:rgba(11,107,203,.065);box-shadow:0 0 0 3px rgba(11,107,203,.11)}.renewal-plan-duration{font-weight:800;color:#334155}.renewal-plan-card strong{font-size:1.35rem}.renewal-plan-card small{color:#64748b}.renewal-plan-best{position:absolute;right:9px;top:9px;padding:4px 7px;border-radius:999px;background:#d1fae5;color:#047857;font-size:.65rem;font-weight:900}.renewal-plan-summary{display:flex;flex-direction:column;gap:4px;margin-top:14px;padding:13px 15px;border-radius:12px;background:#eff6ff;border:1px solid #bfdbfe}.renewal-plan-summary span,.renewal-plan-summary small{color:#475569}.renewal-dialog-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:20px;flex-wrap:wrap}
.renewal-payment-summary{display:flex;flex-direction:column;gap:4px;padding:13px 15px;border:1px solid #bfdbfe;background:#eff6ff;border-radius:12px;margin:15px 0}.renewal-payment-summary>strong{font-size:1.18rem}.renewal-payment-summary small{color:#64748b}.wave-payment-action{display:grid;grid-template-columns:68px minmax(0,1fr);align-items:center;gap:14px;margin:16px 0 18px}.wave-pay-logo{display:block;width:68px;height:68px;object-fit:cover;border-radius:18px;background:#24bde9;border:1px solid rgba(14,116,144,.15);box-shadow:0 8px 20px rgba(8,145,190,.2)}.wave-pay-button{display:flex;align-items:center;justify-content:center;min-height:64px;padding:13px 24px;border:0;border-radius:999px;background:#24bdf0;color:#fff;text-decoration:none;box-shadow:0 9px 18px rgba(8,157,202,.25),0 2px 4px rgba(15,23,42,.12);transition:transform .18s ease,box-shadow .18s ease,filter .18s ease;-webkit-tap-highlight-color:transparent}.wave-pay-button:hover{transform:translateY(-1px);filter:brightness(1.02);box-shadow:0 12px 24px rgba(8,157,202,.3),0 3px 6px rgba(15,23,42,.12)}.wave-pay-button:active{transform:translateY(1px) scale(.995);box-shadow:0 5px 12px rgba(8,157,202,.22)}.wave-pay-button:focus-visible{outline:3px solid rgba(36,189,240,.3);outline-offset:3px}.wave-pay-label{color:#fff;font-size:1.16rem;font-weight:900;letter-spacing:.01em;text-shadow:0 1px 1px rgba(0,54,74,.12)}.renewal-payment-help{display:flex;flex-direction:column;gap:3px;margin:13px 0;padding:11px 13px;border-radius:10px;background:#f8fafc;color:#475569;font-size:.86rem}.renewal-payment-form{display:grid;grid-template-columns:1fr 1fr;gap:13px}.renewal-payment-form label,.renewal-review-note,.renewal-rejection-field{display:flex;flex-direction:column;gap:7px;font-size:.86rem;font-weight:700}.renewal-payment-form input,.renewal-review-dialog textarea{width:100%;min-height:45px;border:1px solid #cbd5e1;border-radius:10px;padding:10px 12px;background:var(--surface,#fff);color:inherit;font:inherit}.renewal-receipt-field{grid-column:1/-1}.renewal-file-hint{font-size:.76rem;color:#64748b;font-weight:400}.renewal-receipt-preview{grid-column:1/-1;display:flex;align-items:center;gap:12px;padding:10px;border:1px solid #dbe5ee;border-radius:11px}.renewal-receipt-preview img{width:72px;height:72px;object-fit:cover;border-radius:8px}.renewal-receipt-preview span{display:flex;flex-direction:column;gap:4px;overflow:hidden}.renewal-receipt-preview strong{overflow:hidden;text-overflow:ellipsis}.renewal-payment-form .form-error,.renewal-payment-form .renewal-dialog-actions{grid-column:1/-1}
.renewal-review-details{margin-top:16px}.renewal-review-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}.renewal-review-grid span{display:flex;flex-direction:column;gap:3px;padding:10px 12px;background:#f8fafc;border-radius:10px}.renewal-review-grid small{color:#64748b}.renewal-review-grid strong{overflow-wrap:anywhere}.renewal-review-warning{padding:11px 13px;border-radius:10px;background:#fff7d6;color:#7a4b00;font-size:.86rem}.renewal-receipt-link{display:flex;align-items:center;justify-content:center;margin:13px 0;padding:12px;border-radius:11px;background:#e0f2fe;color:#075985;font-weight:800;text-decoration:none}.renewal-receipt-link.loading{opacity:.65;pointer-events:none}.renewal-review-note,.renewal-rejection-field{margin-top:12px}.renewal-review-actions{justify-content:space-between}.renewal-review-actions .danger{margin-right:auto}
body.dark .renewal-active-card{background:linear-gradient(135deg,rgba(17,55,91,.72),rgba(19,35,48,.94));border-color:#245883}body.dark .renewal-active-card.payment_declared,body.dark .renewal-active-card.under_review{background:linear-gradient(135deg,rgba(62,38,104,.7),rgba(19,35,48,.94));border-color:#6d4faa}body.dark .renewal-active-meta span,body.dark .renewal-plan-card,body.dark .renewal-dialog-card,body.dark .renewal-payment-form input,body.dark .renewal-review-dialog textarea{background:#132431;color:#e7f0f5;border-color:#36505f}body.dark .renewal-plan-card.selected{background:rgba(27,112,190,.18);border-color:#4aa3e8}body.dark .renewal-history-row{border-color:#314958}body.dark .renewal-empty-card{background:rgba(21,83,132,.12);border-color:#3b5a6b}body.dark .renewal-dialog-close{background:#263c49;color:#e6eef3}body.dark .renewal-payment-help,body.dark .renewal-review-grid span{background:#182c39}body.dark .renewal-plan-summary,body.dark .renewal-payment-summary{background:#152f45;border-color:#275a7c}body.dark .renewal-admin-row.needs-review{background:rgba(105,75,9,.22)}
@media(max-width:720px){.renewal-panel-head{display:flex;flex-direction:column}.renewal-open-btn{width:100%}.renewal-active-meta{grid-template-columns:1fr}.renewal-history-row{align-items:flex-start}.renewal-dialog{max-width:100vw;width:100%;margin:0;min-height:100dvh}.renewal-dialog-card{min-height:100dvh;border-radius:0;padding:24px 17px 28px;max-height:100dvh}.renewal-plans-grid{grid-template-columns:1fr 1fr}.renewal-plan-card{padding:13px}.renewal-plan-card strong{font-size:1.12rem}.renewal-plan-best{position:static;margin-top:3px}.renewal-payment-form{grid-template-columns:1fr}.renewal-payment-form label,.renewal-payment-form .form-error,.renewal-payment-form .renewal-dialog-actions,.renewal-receipt-field,.renewal-receipt-preview{grid-column:1}.renewal-review-grid{grid-template-columns:1fr}.renewal-dialog-actions{position:sticky;bottom:-28px;margin-left:-17px;margin-right:-17px;padding:13px 17px 18px;background:linear-gradient(transparent,var(--surface,#fff) 18%);z-index:3}.renewal-dialog-actions .btn{min-height:48px;flex:1}.renewal-review-actions{position:static;margin:18px 0 0;padding:0;background:none;flex-direction:column}.renewal-review-actions .btn{width:100%}.renewal-admin-table-wrap{overflow-x:auto}}

@media(max-width:720px){.wave-payment-action{grid-template-columns:60px minmax(0,1fr);gap:11px;margin:15px 0 17px}.wave-pay-logo{width:60px;height:60px;border-radius:16px}.wave-pay-button{min-height:60px;border-radius:999px}.wave-pay-label{font-size:1.12rem}}

/* SHELL-39 — paiement Wave épuré et fortement visible */
.wave-payment-action{display:grid!important;grid-template-columns:64px minmax(0,1fr)!important;align-items:center!important;gap:14px!important;width:100%!important;margin:18px 0 20px!important}
.wave-pay-logo{display:block!important;width:64px!important;height:64px!important;object-fit:cover!important;border-radius:14px!important;background:#27bde8!important;border:0!important;box-shadow:0 6px 16px rgba(0,0,0,.14)!important}
.wave-pay-button{display:flex!important;align-items:center!important;justify-content:center!important;width:100%!important;min-height:62px!important;border:0!important;border-radius:999px!important;background:#28bdec!important;color:#fff!important;text-decoration:none!important;box-shadow:0 8px 18px rgba(16,153,199,.28)!important}
.wave-pay-button .wave-pay-label{font-size:1.25rem!important;font-weight:900!important;color:#fff!important;line-height:1!important}
.wave-pay-button img,.wave-pay-button svg{display:none!important}
@media(max-width:480px){.wave-payment-action{grid-template-columns:58px minmax(0,1fr)!important;gap:12px!important}.wave-pay-logo{width:58px!important;height:58px!important}.wave-pay-button{min-height:58px!important}.wave-pay-button .wave-pay-label{font-size:1.18rem!important}}


/* shell-42 — une seule demande de renouvellement ouverte par centre */
.renewal-open-btn:disabled,
.renewal-open-btn.renewal-request-pending{
  background:#cfd5da !important;
  border-color:#cfd5da !important;
  color:#66717a !important;
  box-shadow:none !important;
  opacity:1 !important;
  cursor:not-allowed !important;
  transform:none !important;
  filter:none !important;
}
body.dark .renewal-open-btn:disabled,
body.dark .renewal-open-btn.renewal-request-pending{
  background:#3b4650 !important;
  border-color:#46525d !important;
  color:#b8c1c8 !important;
}


/* shell-43 — péremption facultative */
.field-optional{
  margin-left:.35rem;
  font-size:.75rem;
  font-weight:600;
  color:var(--muted, #64748b);
}


/* shell-44 — duplication sécurisée d’un produit */
.row-actions button[data-action="duplicate"]{
  color:#5b21b6;
  background:#f5f3ff;
  border-color:#ddd6fe;
}
.row-actions button[data-action="duplicate"]:hover{
  background:#ede9fe;
  border-color:#c4b5fd;
}
body.dark .row-actions button[data-action="duplicate"]{
  color:#c4b5fd;
  background:#2e2450;
  border-color:#554483;
}
.duplicate-medicine-notice{
  display:flex;
  flex-direction:column;
  gap:4px;
  padding:11px 13px;
  margin:0 0 4px;
  border:1px solid #c4b5fd;
  border-radius:12px;
  background:#f5f3ff;
  color:#4c1d95;
  line-height:1.4;
}
.duplicate-medicine-notice strong{font-size:.88rem}
.duplicate-medicine-notice span{font-size:.8rem;color:#6d28d9}
body.dark .duplicate-medicine-notice{background:#251f3f;border-color:#554483;color:#ddd6fe}
body.dark .duplicate-medicine-notice span{color:#c4b5fd}
@media(max-width:720px){
  #view-medicines .row-actions{gap:8px!important;justify-content:flex-end!important}
  #view-medicines .row-actions button[data-action="duplicate"]{min-width:46px;min-height:44px}
}


/* =========================================================
   shell-45 — barre Stock toujours accessible au défilement
   ========================================================= */
:root{--stock-toolbar-top:82px}

#view-medicines.active .medicine-toolbar{
  position:sticky;
  top:calc(var(--stock-toolbar-top,82px) + 8px);
  z-index:9;
  margin:-8px -10px 14px;
  padding:10px;
  border:1px solid color-mix(in srgb,var(--border) 88%,transparent);
  border-radius:15px;
  background:color-mix(in srgb,var(--card) 94%,transparent);
  box-shadow:0 10px 26px rgba(15,23,42,.10);
  backdrop-filter:blur(14px);
  -webkit-backdrop-filter:blur(14px);
}

body.dark #view-medicines.active .medicine-toolbar{
  background:color-mix(in srgb,var(--card) 94%,transparent);
  box-shadow:0 12px 30px rgba(0,0,0,.28);
}

@media(max-width:760px){
  #view-medicines.active .medicine-toolbar{
    top:var(--stock-toolbar-top,68px);
    z-index:12;
    margin:-12px calc(-1 * var(--mobile-gutter,14px)) 12px!important;
    padding:9px var(--mobile-gutter,14px) 10px!important;
    border-width:0 0 1px!important;
    border-radius:0 0 16px 16px!important;
    box-shadow:0 9px 22px rgba(15,23,42,.10)!important;
    background:color-mix(in srgb,var(--card) 97%,transparent)!important;
  }
  body.dark #view-medicines.active .medicine-toolbar{
    box-shadow:0 10px 24px rgba(0,0,0,.30)!important;
  }
  #view-medicines .medicine-toolbar.mobile-filters-open{
    max-height:calc(100dvh - var(--stock-toolbar-top,68px) - 18px);
    overflow-y:auto;
    overscroll-behavior:contain;
    scrollbar-width:thin;
  }
  #view-medicines .medicine-toolbar #selectMedicinesBtn.mobile-filter-control{
    grid-column:1/-1!important;
  }
}

@media print{
  #view-medicines.active .medicine-toolbar{position:static!important}
}


/* =========================================================
   shell-49 — notifications au-dessus de la barre Stock fixe
   ========================================================= */
@media(max-width:760px){
  .topbar{
    z-index:40!important;
  }
  #view-medicines.active .medicine-toolbar{
    z-index:20!important;
  }
  .notification-panel{
    z-index:60!important;
  }
}

/* shell-53 — un même article peut être ajouté à plusieurs programmes */
.catalog-row-actions{display:flex;flex-wrap:wrap;gap:.4rem;align-items:center}
.catalog-row-actions .small-btn{white-space:nowrap}
@media (max-width:720px){.catalog-row-actions{align-items:stretch}.catalog-row-actions .small-btn{flex:1 1 auto}}

/* ===== shell-56 — Fenêtre centre mobile : contenu scrollable + actions toujours visibles ===== */
#centerAdminDialog .center-admin-dialog{
  display:flex;
  flex-direction:column;
  padding:0;
  overflow:hidden;
}
#centerAdminDialog .center-admin-scroll{
  flex:1 1 auto;
  min-height:0;
  overflow-x:hidden;
  overflow-y:auto;
  overscroll-behavior:contain;
  -webkit-overflow-scrolling:touch;
  padding:24px;
  scrollbar-gutter:stable;
}
#centerAdminDialog .dialog-actions{
  flex:0 0 auto;
  margin:0;
  padding:14px 24px calc(14px + env(safe-area-inset-bottom, 0px));
  border-top:1px solid var(--border);
  background:var(--card);
  box-shadow:0 -10px 28px rgba(15,23,42,.08);
  z-index:25;
}
body.dark #centerAdminDialog .dialog-actions{
  box-shadow:0 -10px 28px rgba(0,0,0,.24);
}
@media(max-width:760px){
  #centerAdminDialog.form-dialog{
    width:calc(100vw - 12px);
    max-height:calc(100dvh - 12px);
    margin:auto;
  }
  #centerAdminDialog .center-admin-dialog{
    height:min(920px,calc(100dvh - 12px));
    max-height:calc(100dvh - 12px);
  }
  #centerAdminDialog .center-admin-scroll{
    padding:16px 16px 20px;
  }
  #centerAdminDialog .dialog-actions{
    display:grid;
    grid-template-columns:minmax(0,.82fr) minmax(0,1.18fr);
    gap:10px;
    padding:11px 16px calc(11px + env(safe-area-inset-bottom, 0px));
  }
  #centerAdminDialog .dialog-actions .btn{
    width:100%;
    min-width:0;
    min-height:48px;
    margin:0;
    padding:11px 10px;
  }
}
@media(max-width:380px){
  #centerAdminDialog .dialog-actions{
    grid-template-columns:1fr;
  }
}


/* ===== Suppression définitive des centres — shell-60 ===== */
.btn.center-action-delete{
  background:#7f1d1d;
  color:#fff;
  border:1px solid rgba(127,29,29,.30);
  box-shadow:0 7px 16px rgba(127,29,29,.18);
}
.btn.center-action-delete:hover{
  background:#641818;
  color:#fff;
  box-shadow:0 10px 22px rgba(127,29,29,.25);
}
.btn.center-action-delete:disabled{
  opacity:.45;
  cursor:not-allowed;
  box-shadow:none;
}
.center-delete-confirm-card::before{
  background:linear-gradient(90deg,#991b1b,#dc2626,#ef4444);
}
.center-delete-confirm-icon{
  background:#fee2e2;
  box-shadow:0 14px 30px rgba(220,38,38,.16);
}
.center-delete-confirm-kicker{color:#b91c1c}
.center-delete-confirm-field{
  margin:0 0 20px;
  padding:14px 16px;
  border:1px solid #fecaca;
  border-radius:15px;
  background:#fff7f7;
  text-align:left;
}
.center-delete-confirm-field label{
  display:block;
  margin-bottom:9px;
  color:var(--text);
  font-size:.88rem;
  font-weight:750;
  line-height:1.5;
}
.center-delete-confirm-field input{
  width:100%;
  min-height:48px;
  padding:10px 12px;
  border:1px solid #fca5a5;
  border-radius:12px;
  background:var(--surface);
  color:var(--text);
  font:inherit;
  font-weight:800;
}
.center-delete-confirm-field input:focus{
  border-color:#dc2626;
  outline:0;
  box-shadow:0 0 0 3px rgba(220,38,38,.13);
}
.center-delete-confirm-field small{
  display:block;
  margin-top:8px;
  color:var(--muted);
  line-height:1.45;
}
body.dark .center-delete-confirm-icon{background:#4c1d1d}
body.dark .center-delete-confirm-field{background:#351b1b;border-color:#7f1d1d}
body.dark .center-delete-confirm-field input{border-color:#7f1d1d}

/* shell-64 — expérience offline-first */
.offline-mode-banner{
  margin:0 20px 10px;
  padding:10px 14px;
  border:1px solid rgba(180,83,9,.24);
  border-radius:14px;
  background:rgba(245,158,11,.11);
  display:flex;
  align-items:center;
  gap:10px;
  font-size:.9rem;
}
.offline-mode-banner strong{white-space:nowrap;color:#92400e}
.offline-mode-banner span{color:var(--muted,#64748b)}
.nav-btn.offline-locked{opacity:.52}
.nav-btn.offline-locked::after{content:"hors ligne";margin-left:auto;font-size:.68rem;opacity:.78}
@media (max-width:720px){
  .offline-mode-banner{margin:0 10px 8px;padding:9px 11px;align-items:flex-start;flex-direction:column;gap:2px;font-size:.8rem}
}

@media (max-width:720px){
  .batch-medicine-name{min-width:250px}
  .batch-name-label .batch-name{min-width:220px;font-size:16px}
}
