/* =========================================================
   Makdecrypte — design uniforme global
   Barre supérieure, boutons, menus, police et couleurs
   ========================================================= */
:root{
  --mk-blue:#2563eb;
  --mk-blue-2:#4f8cff;
  --mk-violet:#7c3aed;
  --mk-green:#16a34a;
  --mk-red:#dc2626;
  --mk-orange:#f97316;
  --mk-dark:#0f172a;
  --mk-text:#0f172a;
  --mk-muted:#64748b;
  --mk-bg:#eef4fb;
  --mk-glass:rgba(255,255,255,.64);
  --mk-line:rgba(255,255,255,.68);
  --mk-shadow:0 18px 45px rgba(15,23,42,.10), inset 0 1px 0 rgba(255,255,255,.48);
  --mk-radius:24px;
  --mk-radius-sm:14px;
  --mk-sidebar:280px;
}

*{box-sizing:border-box}
html{font-family:Inter,Segoe UI,Arial,sans-serif!important;background:var(--mk-bg)!important;}
body{font-family:Inter,Segoe UI,Arial,sans-serif!important;color:var(--mk-text)!important;}
body.appPage,body.userPage{
  margin:0!important;
  min-height:100dvh!important;
  background:
    radial-gradient(circle at 12% 20%,rgba(96,165,250,.22),transparent 28%),
    radial-gradient(circle at 88% 16%,rgba(168,85,247,.18),transparent 26%),
    linear-gradient(180deg,#f6f9ff,#eef4fb)!important;
}
body.appPage{height:100dvh!important;display:flex!important;flex-direction:column!important;overflow:hidden!important;}
body.userPage{height:auto!important;overflow:auto!important;}
body.portalHome{font-family:Inter,Segoe UI,Arial,sans-serif!important;}

/* Barre supérieure commune */
body.appPage>header,
body.userPage>header,
.appHeader{
  flex:0 0 auto!important;
  height:auto!important;
  min-height:0!important;
  padding:16px 24px 14px!important;
  margin:0!important;
  color:#fff!important;
  background:linear-gradient(135deg,var(--mk-blue),var(--mk-violet))!important;
  border:0!important;
  border-radius:0!important;
  box-shadow:0 12px 30px rgba(79,140,255,.22)!important;
  display:block!important;
  position:relative!important;
  z-index:20!important;
}
body.appPage>header .brand,
body.userPage>header .brand,
.appHeader .brand{
  display:block!important;
  margin:0!important;
  padding:0!important;
}
body.appPage>header h1,
body.userPage>header h1,
.appHeader h1,
.appHeader .brand h1{
  margin:0!important;
  padding:0!important;
  color:#fff!important;
  font-size:28px!important;
  line-height:1.05!important;
  font-weight:950!important;
  letter-spacing:-.045em!important;
  display:flex!important;
  align-items:center!important;
  gap:10px!important;
}
body.appPage>header h1 i,
body.userPage>header h1 i,
.appHeader h1 i{margin:0!important;font-size:1em!important;line-height:1!important;}
body.appPage>header p,
body.userPage>header .sub,
.appHeader p,
.appHeader .sub,
.appHeader .brand p,
.appHeader .brand .sub{
  display:flex!important;
  align-items:center!important;
  gap:8px!important;
  margin:7px 0 0!important;
  padding:0!important;
  color:rgba(255,255,255,.92)!important;
  font-size:14px!important;
  line-height:1.25!important;
  font-weight:800!important;
  opacity:1!important;
}
body.appPage>header p i,
body.userPage>header .sub i,
.appHeader p i,
.appHeader .sub i{margin:0!important;}

.headerPortalActions,
.headerActions{
  width:100%!important;
  display:flex!important;
  align-items:center!important;
  justify-content:flex-start!important;
  gap:10px!important;
  flex-wrap:wrap!important;
  margin:13px 0 0!important;
  padding:0!important;
  overflow:visible!important;
}
.headerPortalActions .portalBtn,
.headerActions .portalBtn,
.headerPortalActions a.portalBtn,
.headerPortalActions button.portalBtn,
.headerActions a.portalBtn,
.headerActions button.portalBtn{
  appearance:none!important;
  -webkit-appearance:none!important;
  border:1px solid rgba(255,255,255,.38)!important;
  border-radius:14px!important;
  min-height:40px!important;
  padding:9px 13px!important;
  background:rgba(255,255,255,.18)!important;
  color:#fff!important;
  font:900 14px/1 Inter,Segoe UI,Arial,sans-serif!important;
  text-decoration:none!important;
  cursor:pointer!important;
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
  gap:7px!important;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 10px 22px rgba(15,23,42,.08)!important;
  white-space:nowrap!important;
  transition:background .18s ease,transform .18s ease,border-color .18s ease!important;
}
.headerPortalActions .portalBtn:hover,
.headerActions .portalBtn:hover{
  background:rgba(255,255,255,.27)!important;
  transform:translateY(-1px)!important;
}
.headerPortalActions .portalBtn.current,
.headerActions .portalBtn.current{
  background:rgba(255,255,255,.34)!important;
  border-color:rgba(255,255,255,.72)!important;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.34),0 12px 28px rgba(15,23,42,.12)!important;
}
.headerPortalActions .dangerPortal,
.headerActions .dangerPortal,
.headerPortalActions .portalBtn.dangerPortal,
.headerActions .portalBtn.dangerPortal{
  background:rgba(220,38,38,.94)!important;
  color:#fff!important;
  border-color:rgba(248,113,113,.62)!important;
}
.headerPortalActions .dangerPortal:hover,
.headerActions .dangerPortal:hover{background:#dc2626!important;}
.headerPortalActions .portalBtn i,
.headerActions .portalBtn i{margin:0!important;font-size:1em!important;}

.mysqlSyncBadge,.syncBadge,#timeMysqlState,.status.ok{
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
  gap:7px!important;
  min-height:40px!important;
  border-radius:999px!important;
  padding:9px 13px!important;
  background:#dcfce7!important;
  color:#166534!important;
  border:1px solid #bbf7d0!important;
  font:900 14px/1 Inter,Segoe UI,Arial,sans-serif!important;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.50),0 10px 22px rgba(15,23,42,.06)!important;
  white-space:nowrap!important;
}
.mysqlSyncBadge.info,.syncBadge.info,#timeMysqlState.info,#timeMysqlState:not(.ok):not(.bad){background:#dbeafe!important;color:#1e3a8a!important;border-color:#bfdbfe!important;}
.mysqlSyncBadge.ok,.syncBadge.ok,#timeMysqlState.ok{background:#dcfce7!important;color:#166534!important;border-color:#bbf7d0!important;}
.mysqlSyncBadge.bad,.syncBadge.bad,#timeMysqlState.bad{background:#fee2e2!important;color:#991b1b!important;border-color:#fecaca!important;}
.mysqlSyncBadge i,.syncBadge i,#timeMysqlState i{margin:0!important;}

/* Structure commune des applications */
body.appPage>.app{
  flex:1 1 auto!important;
  min-height:0!important;
  height:auto!important;
  width:100%!important;
  display:grid!important;
  grid-template-columns:var(--mk-sidebar) minmax(0,1fr)!important;
  overflow:hidden!important;
  background:transparent!important;
}
body.appPage>.app>nav{
  width:auto!important;
  height:100%!important;
  max-height:none!important;
  overflow:auto!important;
  padding:14px!important;
  background:linear-gradient(180deg,rgba(15,23,42,.94),rgba(15,23,42,.86))!important;
  color:#fff!important;
  border:0!important;
  display:flex!important;
  flex-direction:column!important;
  gap:8px!important;
}
body.appPage>.app>nav button{
  width:100%!important;
  min-height:44px!important;
  margin:0!important;
  padding:11px 13px!important;
  border:1px solid rgba(255,255,255,.07)!important;
  border-radius:14px!important;
  background:rgba(255,255,255,.06)!important;
  color:#e5eefc!important;
  font:900 14px/1.15 Inter,Segoe UI,Arial,sans-serif!important;
  text-align:left!important;
  cursor:pointer!important;
  display:flex!important;
  align-items:center!important;
  gap:9px!important;
  box-shadow:none!important;
  white-space:normal!important;
}
body.appPage>.app>nav button i{margin:0!important;font-size:16px!important;color:inherit!important;opacity:1!important;}
body.appPage>.app>nav button:hover,
body.appPage>.app>nav button.active{
  background:linear-gradient(135deg,var(--mk-blue),var(--mk-violet))!important;
  color:#fff!important;
  border-color:rgba(255,255,255,.18)!important;
  box-shadow:0 12px 28px rgba(37,99,235,.22)!important;
}
body.appPage>.app>main{
  min-width:0!important;
  height:100%!important;
  min-height:0!important;
  overflow:auto!important;
  padding:18px!important;
  background:transparent!important;
}
body.appPage .pageTop,
body.appPage .pageTitle{
  display:flex!important;
  align-items:flex-start!important;
  justify-content:space-between!important;
  gap:12px!important;
  flex-wrap:wrap!important;
  margin-bottom:14px!important;
}
body.appPage h2,
body.userPage h2{
  color:#0f172a!important;
  font-family:Inter,Segoe UI,Arial,sans-serif!important;
  font-weight:950!important;
  letter-spacing:-.045em!important;
}
body.appPage h2{font-size:28px!important;line-height:1.08!important;}
body.appPage .card,
body.userPage .card{
  background:var(--mk-glass)!important;
  backdrop-filter:blur(18px)!important;
  -webkit-backdrop-filter:blur(18px)!important;
  border:1px solid var(--mk-line)!important;
  border-radius:var(--mk-radius)!important;
  box-shadow:var(--mk-shadow)!important;
}
body.appPage .btn,
body.userPage .btn,
body.portalHome .btn{
  border-radius:14px!important;
  font-family:Inter,Segoe UI,Arial,sans-serif!important;
  font-weight:900!important;
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
  gap:7px!important;
  text-decoration:none!important;
  cursor:pointer!important;
}
body.appPage input,
body.appPage select,
body.appPage textarea,
body.userPage input,
body.userPage select,
body.userPage textarea{
  font-family:Inter,Segoe UI,Arial,sans-serif!important;
  border-radius:14px!important;
}

/* Page utilisateurs : même largeur, même haut de page, mais sans menu latéral */
body.userPage .wrap{
  width:min(1180px,100%)!important;
  max-width:1180px!important;
  margin:0 auto!important;
  padding:18px!important;
}

/* Accueil : garder le portail centré mais avec les mêmes boutons/couleurs */
body.portalHome .card{border-radius:28px!important;box-shadow:var(--mk-shadow)!important;}
body.portalHome .appCard{border-radius:24px!important;}
body.portalHome .appCard.finance .appIcon{background:linear-gradient(135deg,var(--mk-blue),var(--mk-violet))!important;}
body.portalHome .appCard.time .appIcon{background:linear-gradient(135deg,var(--mk-orange),var(--mk-violet))!important;}
body.portalHome .appCard.pharmacy .appIcon{background:linear-gradient(135deg,var(--mk-green),var(--mk-blue))!important;}

@media(max-width:900px){
  :root{--mk-sidebar:230px;}
  body.appPage>header,body.userPage>header,.appHeader{padding:14px 16px 12px!important;}
  body.appPage>header h1,body.userPage>header h1,.appHeader h1,.appHeader .brand h1{font-size:24px!important;}
  .headerPortalActions,.headerActions{gap:8px!important;overflow-x:auto!important;overflow-y:hidden!important;flex-wrap:nowrap!important;scrollbar-width:none!important;padding-bottom:2px!important;}
  .headerPortalActions::-webkit-scrollbar,.headerActions::-webkit-scrollbar{display:none!important;}
  .headerPortalActions .portalBtn,.headerActions .portalBtn,.mysqlSyncBadge,.syncBadge,#timeMysqlState{flex:0 0 auto!important;min-height:36px!important;padding:8px 10px!important;font-size:12.5px!important;}
}
@media(max-width:720px){
  body.appPage{height:100dvh!important;overflow:hidden!important;}
  body.appPage>.app{grid-template-columns:1fr!important;grid-template-rows:auto 1fr!important;}
  body.appPage>.app>nav{
    height:auto!important;
    max-height:86px!important;
    overflow:auto!important;
    flex-direction:row!important;
    gap:8px!important;
    padding:10px!important;
  }
  body.appPage>.app>nav button{flex:0 0 auto!important;width:auto!important;min-height:38px!important;font-size:12.5px!important;padding:9px 11px!important;white-space:nowrap!important;}
  body.appPage>.app>main{padding:12px!important;}
  body.appPage h2{font-size:24px!important;}
  body.userPage .wrap{padding:12px!important;}
}

/* =========================================================
   Mode sombre global — Makdecrypte
   ========================================================= */
html[data-theme="dark"]{
  color-scheme:dark;
  --mk-bg:#08111f;
  --mk-text:#e5eefc;
  --mk-muted:#a7b6cc;
  --mk-dark:#020617;
  --mk-glass:rgba(15,23,42,.74);
  --mk-line:rgba(148,163,184,.22);
  --mk-shadow:0 18px 50px rgba(0,0,0,.38), inset 0 1px 0 rgba(255,255,255,.05);
  --bg:#08111f;
  --text:#e5eefc;
  --muted:#a7b6cc;
  --border:rgba(148,163,184,.22);
  --glass:rgba(15,23,42,.74);
  --line:rgba(148,163,184,.22);
  background:#08111f!important;
}
html[data-theme="dark"] body,
html[data-theme="dark"] body.appPage,
html[data-theme="dark"] body.userPage,
html[data-theme="dark"] body.portalHome{
  color:#e5eefc!important;
  background:
    radial-gradient(circle at 12% 20%,rgba(37,99,235,.18),transparent 30%),
    radial-gradient(circle at 88% 16%,rgba(124,58,237,.18),transparent 28%),
    linear-gradient(180deg,#08111f,#0f172a)!important;
}
html[data-theme="dark"] body:before{background:rgba(37,99,235,.15)!important;}
html[data-theme="dark"] body:after{background:rgba(124,58,237,.14)!important;}
html[data-theme="dark"] body.appPage>header,
html[data-theme="dark"] body.userPage>header,
html[data-theme="dark"] .appHeader{
  background:linear-gradient(135deg,#1d4ed8,#5b21b6)!important;
  box-shadow:0 16px 38px rgba(0,0,0,.36)!important;
}
html[data-theme="dark"] .headerPortalActions .portalBtn,
html[data-theme="dark"] .headerActions .portalBtn,
html[data-theme="dark"] .headerPortalActions a.portalBtn,
html[data-theme="dark"] .headerPortalActions button.portalBtn,
html[data-theme="dark"] .headerActions a.portalBtn,
html[data-theme="dark"] .headerActions button.portalBtn{
  background:rgba(15,23,42,.28)!important;
  color:#f8fafc!important;
  border-color:rgba(255,255,255,.22)!important;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.12),0 10px 24px rgba(0,0,0,.20)!important;
}
html[data-theme="dark"] .headerPortalActions .portalBtn:hover,
html[data-theme="dark"] .headerActions .portalBtn:hover,
html[data-theme="dark"] .headerPortalActions .portalBtn.current,
html[data-theme="dark"] .headerActions .portalBtn.current{
  background:rgba(255,255,255,.18)!important;
  border-color:rgba(255,255,255,.40)!important;
}
html[data-theme="dark"] .themeToggle{
  background:rgba(15,23,42,.38)!important;
  border-color:rgba(255,255,255,.30)!important;
}
html[data-theme="dark"] .headerPortalActions .dangerPortal,
html[data-theme="dark"] .headerActions .dangerPortal,
html[data-theme="dark"] .headerPortalActions .portalBtn.dangerPortal,
html[data-theme="dark"] .headerActions .portalBtn.dangerPortal{
  background:rgba(185,28,28,.95)!important;
  color:#fff!important;
  border-color:rgba(248,113,113,.45)!important;
}
html[data-theme="dark"] .mysqlSyncBadge,
html[data-theme="dark"] .syncBadge,
html[data-theme="dark"] #timeMysqlState,
html[data-theme="dark"] .status.ok{
  background:rgba(20,83,45,.78)!important;
  color:#dcfce7!important;
  border-color:rgba(134,239,172,.24)!important;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.08),0 10px 22px rgba(0,0,0,.18)!important;
}
html[data-theme="dark"] .mysqlSyncBadge.info,
html[data-theme="dark"] .syncBadge.info,
html[data-theme="dark"] #timeMysqlState.info,
html[data-theme="dark"] #timeMysqlState:not(.ok):not(.bad){
  background:rgba(30,64,175,.68)!important;
  color:#dbeafe!important;
  border-color:rgba(147,197,253,.24)!important;
}
html[data-theme="dark"] .mysqlSyncBadge.bad,
html[data-theme="dark"] .syncBadge.bad,
html[data-theme="dark"] #timeMysqlState.bad,
html[data-theme="dark"] .status.bad{
  background:rgba(127,29,29,.78)!important;
  color:#fee2e2!important;
  border-color:rgba(252,165,165,.24)!important;
}
html[data-theme="dark"] body.appPage>.app>nav{
  background:linear-gradient(180deg,rgba(2,6,23,.98),rgba(15,23,42,.94))!important;
  border-right:1px solid rgba(148,163,184,.12)!important;
}
html[data-theme="dark"] body.appPage>.app>nav button{
  background:rgba(255,255,255,.04)!important;
  color:#dbeafe!important;
  border-color:rgba(148,163,184,.12)!important;
}
html[data-theme="dark"] body.appPage>.app>nav button:hover,
html[data-theme="dark"] body.appPage>.app>nav button.active{
  background:linear-gradient(135deg,#2563eb,#7c3aed)!important;
  color:#fff!important;
  box-shadow:0 12px 28px rgba(0,0,0,.28)!important;
}
html[data-theme="dark"] body.appPage>main,
html[data-theme="dark"] body.appPage>.app>main,
html[data-theme="dark"] .wrap{
  color:#e5eefc!important;
}
html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] h3,
html[data-theme="dark"] h4,
html[data-theme="dark"] .title,
html[data-theme="dark"] .dayTaskTitle,
html[data-theme="dark"] .dayTaskSectionTitle,
html[data-theme="dark"] .privacyPreview,
html[data-theme="dark"] .dayStat .num{
  color:#f8fafc!important;
}
html[data-theme="dark"] p,
html[data-theme="dark"] label,
html[data-theme="dark"] .subtitle,
html[data-theme="dark"] .muted,
html[data-theme="dark"] .sectionNote,
html[data-theme="dark"] .clockSub,
html[data-theme="dark"] .barlabel,
html[data-theme="dark"] .fileMeta,
html[data-theme="dark"] .dayTaskMeta,
html[data-theme="dark"] .dayTaskMeta b,
html[data-theme="dark"] .dayTaskNote,
html[data-theme="dark"] .mini h3,
html[data-theme="dark"] .mini p,
html[data-theme="dark"] .appCard p,
html[data-theme="dark"] .card h3,
html[data-theme="dark"] .kpi h3{
  color:#a7b6cc!important;
}
html[data-theme="dark"] .card,
html[data-theme="dark"] body.appPage .card,
html[data-theme="dark"] body.userPage .card,
html[data-theme="dark"] body.portalHome .card,
html[data-theme="dark"] .contentCard,
html[data-theme="dark"] .fileCard,
html[data-theme="dark"] .projectGroup,
html[data-theme="dark"] .weekDay,
html[data-theme="dark"] .day,
html[data-theme="dark"] .dayTaskCard,
html[data-theme="dark"] .dayStat,
html[data-theme="dark"] .miniCard,
html[data-theme="dark"] .reportBox,
html[data-theme="dark"] .tableWrap,
html[data-theme="dark"] .tableScroll,
html[data-theme="dark"] .lockCard{
  background:rgba(15,23,42,.76)!important;
  color:#e5eefc!important;
  border-color:rgba(148,163,184,.22)!important;
  box-shadow:var(--mk-shadow)!important;
}
html[data-theme="dark"] .appCard,
html[data-theme="dark"] .brand,
html[data-theme="dark"] .field input,
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea{
  background:rgba(15,23,42,.72)!important;
  color:#f8fafc!important;
  border-color:rgba(148,163,184,.26)!important;
}
html[data-theme="dark"] .brand{color:#dbeafe!important;}
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder{color:#94a3b8!important;}
html[data-theme="dark"] input:focus,
html[data-theme="dark"] select:focus,
html[data-theme="dark"] textarea:focus{
  outline:4px solid rgba(96,165,250,.18)!important;
  border-color:#60a5fa!important;
}
html[data-theme="dark"] .btn.light,
html[data-theme="dark"] .light{
  background:rgba(30,41,59,.88)!important;
  color:#dbeafe!important;
  border-color:rgba(147,197,253,.22)!important;
}
html[data-theme="dark"] .btn.primary,
html[data-theme="dark"] .primary{
  background:linear-gradient(135deg,#2563eb,#7c3aed)!important;
  color:#fff!important;
}
html[data-theme="dark"] .btn.good,
html[data-theme="dark"] .good{background:#15803d!important;color:#fff!important;}
html[data-theme="dark"] .btn.danger,
html[data-theme="dark"] .danger{background:#b91c1c!important;color:#fff!important;}
html[data-theme="dark"] .btn.orange,
html[data-theme="dark"] .orange{background:#c2410c!important;color:#fff!important;}
html[data-theme="dark"] .btn.purple,
html[data-theme="dark"] .purple{background:#6d28d9!important;color:#fff!important;}
html[data-theme="dark"] table,
html[data-theme="dark"] tbody,
html[data-theme="dark"] .desktopTable,
html[data-theme="dark"] .tableScroll table{
  background:rgba(15,23,42,.86)!important;
  color:#e5eefc!important;
}
html[data-theme="dark"] th{
  background:rgba(30,64,175,.32)!important;
  color:#dbeafe!important;
  border-color:rgba(148,163,184,.18)!important;
}
html[data-theme="dark"] td{
  color:#dbeafe!important;
  border-color:rgba(148,163,184,.16)!important;
}
html[data-theme="dark"] tr:hover td{background:rgba(30,41,59,.78)!important;}
html[data-theme="dark"] .clockBox,
html[data-theme="dark"] .currentTask,
html[data-theme="dark"] .nextTask,
html[data-theme="dark"] .schedule,
html[data-theme="dark"] .weekTask,
html[data-theme="dark"] .fixedTask{
  background:rgba(15,23,42,.70)!important;
  color:#e5eefc!important;
  border-color:rgba(148,163,184,.22)!important;
}
html[data-theme="dark"] .clockTime,
html[data-theme="dark"] .time,
html[data-theme="dark"] .dayHour,
html[data-theme="dark"] .arrow{color:#93c5fd!important;}
html[data-theme="dark"] .progress{background:rgba(148,163,184,.22)!important;}
html[data-theme="dark"] .note,
html[data-theme="dark"] .contentCard.blog,
html[data-theme="dark"] .projectGroup.blog,
html[data-theme="dark"] .dayTaskCard.blog{
  background:rgba(20,83,45,.30)!important;
  border-color:rgba(134,239,172,.22)!important;
  color:#dcfce7!important;
}
html[data-theme="dark"] .warn,
html[data-theme="dark"] .nextTask,
html[data-theme="dark"] .contentCard.autre,
html[data-theme="dark"] .projectGroup.autre,
html[data-theme="dark"] .dayTaskCard.autre{
  background:rgba(124,45,18,.26)!important;
  border-color:rgba(251,146,60,.22)!important;
  color:#ffedd5!important;
}
html[data-theme="dark"] .alert,
html[data-theme="dark"] .contentCard.youtube,
html[data-theme="dark"] .projectGroup.youtube,
html[data-theme="dark"] .dayTaskCard.youtube{
  background:rgba(127,29,29,.28)!important;
  border-color:rgba(252,165,165,.22)!important;
  color:#fee2e2!important;
}
html[data-theme="dark"] .contentCard.tiktok,
html[data-theme="dark"] .projectGroup.tiktok,
html[data-theme="dark"] .dayTaskCard.tiktok,
html[data-theme="dark"] .historyItem{
  background:rgba(76,29,149,.28)!important;
  border-color:rgba(196,181,253,.22)!important;
  color:#ede9fe!important;
}
html[data-theme="dark"] .empty{
  color:#94a3b8!important;
  background:rgba(15,23,42,.48)!important;
  border-color:rgba(148,163,184,.16)!important;
}
html[data-theme="dark"] .badge,
html[data-theme="dark"] .typePill,
html[data-theme="dark"] .shareBadge,
html[data-theme="dark"] .mini{
  border-color:rgba(148,163,184,.20)!important;
}
html[data-theme="dark"] .b-wait{background:rgba(113,63,18,.55)!important;color:#fef3c7!important;}
html[data-theme="dark"] .b-work{background:rgba(30,64,175,.55)!important;color:#dbeafe!important;}
html[data-theme="dark"] .b-done{background:rgba(20,83,45,.62)!important;color:#dcfce7!important;}
html[data-theme="dark"] .b-late{background:rgba(127,29,29,.60)!important;color:#fee2e2!important;}
html[data-theme="dark"] .b-stop{background:rgba(51,65,85,.72)!important;color:#e2e8f0!important;}
html[data-theme="dark"] .b-purple{background:rgba(76,29,149,.62)!important;color:#ede9fe!important;}
html[data-theme="dark"] .typePill.youtube{background:rgba(127,29,29,.58)!important;color:#fee2e2!important;}
html[data-theme="dark"] .typePill.tiktok{background:rgba(76,29,149,.60)!important;color:#ede9fe!important;}
html[data-theme="dark"] .typePill.blog{background:rgba(20,83,45,.60)!important;color:#dcfce7!important;}
html[data-theme="dark"] .typePill.autre{background:rgba(30,64,175,.60)!important;color:#dbeafe!important;}
html[data-theme="dark"] .today{outline-color:#60a5fa!important;}
html[data-theme="dark"] .mini{background:rgba(30,41,59,.72)!important;color:#dbeafe!important;}
html[data-theme="dark"] .bar{background:rgba(96,165,250,.45)!important;}
html[data-theme="dark"] .bar.green{background:rgba(34,197,94,.38)!important;}
html[data-theme="dark"] .bar.red{background:rgba(239,68,68,.38)!important;}
html[data-theme="dark"] .bar.purple{background:rgba(168,85,247,.38)!important;}
html[data-theme="dark"] .bar.orange{background:rgba(249,115,22,.38)!important;}
html[data-theme="dark"] .lockOverlay{background:rgba(2,6,23,.78)!important;}
html[data-theme="dark"] .secureNote{background:rgba(30,64,175,.28)!important;color:#dbeafe!important;border-color:rgba(147,197,253,.22)!important;}
html[data-theme="dark"] .error{background:rgba(127,29,29,.55)!important;color:#fee2e2!important;border-color:rgba(252,165,165,.25)!important;}
html[data-theme="dark"] .homeTopActions{display:flex!important;align-items:center!important;justify-content:space-between!important;gap:12px!important;flex-wrap:wrap!important;}
.homeTopActions{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;}
.homeThemeBtn{min-height:38px!important;padding:9px 12px!important;}
html[data-theme="dark"] canvas{filter:brightness(.94) contrast(1.06);}
@media(max-width:720px){
  html[data-theme="dark"] body.appPage>.app>nav{border-top:1px solid rgba(148,163,184,.12)!important;border-right:0!important;}
}
/* Respecte les liens réservés aux administrateurs tant que le script ne les affiche pas. */
#financeUsersLink[style*="display:none"],#financeUsersLink[style*="display: none"],
#timeUsersLink[style*="display:none"],#timeUsersLink[style*="display: none"],
#pharmacyUsersLink[style*="display:none"],#pharmacyUsersLink[style*="display: none"],
#usersLink[style*="display:none"],#usersLink[style*="display: none"]{display:none!important;}

/* =========================================================
   Correctif lisibilité — mode sombre renforcé
   Objectif : aucun texte noir ou gris trop faible sur fond sombre
   ========================================================= */
html[data-theme="dark"]{
  --mk-panel:rgba(15,23,42,.88);
  --mk-panel-2:rgba(30,41,59,.86);
  --mk-panel-3:rgba(2,6,23,.46);
  --mk-text-strong:#f8fafc;
  --mk-text-soft:#dbeafe;
  --mk-text-muted:#cbd5e1;
  --mk-text-dim:#94a3b8;
  --mk-border-strong:rgba(148,163,184,.34);
  --mk-border-soft:rgba(148,163,184,.20);
  --mk-blue-soft:#93c5fd;
  --mk-green-soft:#86efac;
  --mk-red-soft:#fca5a5;
  --mk-orange-soft:#fdba74;
  --mk-purple-soft:#c4b5fd;
}

html[data-theme="dark"] body.appPage main,
html[data-theme="dark"] body.appPage>.app>main,
html[data-theme="dark"] body.userPage .wrap,
html[data-theme="dark"] body.portalHome .shell{
  color:var(--mk-text-soft)!important;
}

/* Les marques/titres dans les barres restent transparents et blancs. */
html[data-theme="dark"] .appHeader .brand,
html[data-theme="dark"] body.appPage>header .brand,
html[data-theme="dark"] body.userPage>header .brand{
  background:transparent!important;
  border:0!important;
  box-shadow:none!important;
  color:#fff!important;
}
html[data-theme="dark"] .appHeader .brand h1,
html[data-theme="dark"] .appHeader .brand p,
html[data-theme="dark"] body.appPage>header .brand h1,
html[data-theme="dark"] body.appPage>header .brand p,
html[data-theme="dark"] body.userPage>header .brand h1,
html[data-theme="dark"] body.userPage>header .brand .sub{
  color:#fff!important;
}
html[data-theme="dark"] .appHeader .brand p,
html[data-theme="dark"] body.appPage>header .brand p,
html[data-theme="dark"] body.userPage>header .brand .sub{
  color:rgba(255,255,255,.92)!important;
}

/* Titres et chiffres importants */
html[data-theme="dark"] :is(
  h1,h2,h3,h4,h5,h6,
  .title,.pageTitle h2,.pageTop h2,.dayTaskSectionTitle,
  .big,.kpi .big,.dashboardLiveDate,.dashboardLiveTime,
  .privacyPreview,.recordTitle,.recordAmount,.budgetName,
  .forecastText b,.moneyReading b,.recordMeta b,.dayTaskMeta b,
  .alertCard h4,.guideCard h4,.strategyCard h4,.libraryCard h4,
  .brainCard b,.diagnosticItem b,.ifThenItem b,.ratioValue,.scoreLabel,
  .scoreCircle,.workloadItem .value,.pomodoroTime,
  #currentTaskTitle,#nextTaskTitle,.taskMainTitle,.taskEmptyState,
  .calendarTitle,.calendarAmount,.mysqlSyncMini b,
  .stat b,.miniCard h3,.fileName,.weekDay h3
){color:var(--mk-text-strong)!important;}

/* Textes secondaires */
html[data-theme="dark"] :is(
  p,label,small,.sub,.subtitle,.muted,.hint,.sectionNote,.clockSub,
  .barlabel,.fileMeta,.recordDate,.recordCfa,.recordMeta,.budgetStats,
  .forecastText,.moneyReading,.checkItem span,.ruleItem,.guideCard p,
  .guideCard ul,.strategyCard p,.strategyCard ul,.libraryCard ul,
  .brainCard span,.diagnosticItem span,.ifThenItem span,.ratioCard h4,
  .ratioCard p,.compareDelta,.analysisSub,.importHint,.calendarText,
  .calendarEmpty,.mysqlLoginCard p,.mysqlSyncMini span,.titheStatus,
  .workloadItem .label,.pomodoroSettings label,.pomodoroSettings small,
  .focusLabel,.timerLabel,.timeRange,#currentTaskProject,#nextTaskTime,
  .taskEmptySub,.taskLabel,.pageTitle p,.stat span,.miniCard p
){color:var(--mk-text-muted)!important;}

/* Surfaces : cartes, panneaux, listes, mini-cartes */
html[data-theme="dark"] :is(
  .card,.appCard,.miniCard,.fileCard,.contentCard,.projectGroup,.weekDay,.day,
  .dayTaskCard,.dayStat,.reportBox,.tableWrap,.tableScroll,.lockCard,
  .panelToggle,.incomeMini,.depenseMini,.debtMini,.calendarMini,
  .todayMoneyCard,.manualForecastCard,.autoProvisionCard,.forecastAutoNote,
  .analysisChartCard,.analysisTableCard,.guideCard,.strategyCard,.libraryCard,
  .brainCard,.ratioCard,.diagnosticItem,.ifThenItem,.ruleItem,.checkItem,
  .alertCard,.budgetCard,.calendarItem,.expenseMobileCard,.recordCard,
  .mysqlLoginCard,.mysqlSyncMini,.focusSettingsCard,.workloadItem,.freeSlot
){
  background:var(--mk-panel)!important;
  color:var(--mk-text-soft)!important;
  border-color:var(--mk-border-soft)!important;
  box-shadow:var(--mk-shadow)!important;
}
html[data-theme="dark"] :is(.panelToggle,.miniCard,.expenseMobileCard,.recordCard,.calendarItem,.freeSlot){
  background:var(--mk-panel-2)!important;
}
html[data-theme="dark"] :is(.card,.appCard,.miniCard,.fileCard,.contentCard,.projectGroup,.weekDay,.day,.dayTaskCard,.tableWrap,.tableScroll) a:not(.btn):not(.portalBtn){
  color:var(--mk-blue-soft)!important;
}

/* Formulaires */
html[data-theme="dark"] :is(input,select,textarea,.field input,.focusSelect){
  background:rgba(2,6,23,.58)!important;
  color:var(--mk-text-strong)!important;
  border-color:var(--mk-border-strong)!important;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.04)!important;
}
html[data-theme="dark"] :is(input,select,textarea)::placeholder{color:var(--mk-text-dim)!important;}
html[data-theme="dark"] option,
html[data-theme="dark"] optgroup{
  background:#0f172a!important;
  color:#f8fafc!important;
}
html[data-theme="dark"] :is(input,select,textarea):disabled{
  background:rgba(51,65,85,.55)!important;
  color:#94a3b8!important;
}

/* Boutons secondaires et boutons neutres */
html[data-theme="dark"] :is(.btn.light,.light,.panelToggle,.addOptionBtn,.homeThemeBtn){
  background:rgba(30,41,59,.92)!important;
  color:#e5eefc!important;
  border-color:var(--mk-border-strong)!important;
}
html[data-theme="dark"] :is(.btn.light,.light,.panelToggle,.addOptionBtn,.homeThemeBtn):hover{
  background:rgba(51,65,85,.96)!important;
  color:#fff!important;
}
html[data-theme="dark"] :is(.btn.primary,.primary){background:linear-gradient(135deg,#2563eb,#7c3aed)!important;color:#fff!important;}
html[data-theme="dark"] :is(.btn.good,.good,.btn.green,.green){background:#15803d!important;color:#fff!important;}
html[data-theme="dark"] :is(.btn.danger,.danger){background:#b91c1c!important;color:#fff!important;}
html[data-theme="dark"] :is(.btn.orange,.orange){background:#c2410c!important;color:#fff!important;}
html[data-theme="dark"] :is(.btn.purple,.purple){background:#6d28d9!important;color:#fff!important;}

/* Tableaux */
html[data-theme="dark"] :is(table,.desktopTable,.tableScroll table){
  background:rgba(15,23,42,.92)!important;
  color:var(--mk-text-soft)!important;
}
html[data-theme="dark"] :is(th,thead th){
  background:rgba(30,64,175,.36)!important;
  color:#dbeafe!important;
  border-color:var(--mk-border-soft)!important;
}
html[data-theme="dark"] :is(td,tbody td){
  background:transparent!important;
  color:#e5eefc!important;
  border-color:rgba(148,163,184,.16)!important;
}
html[data-theme="dark"] td b{color:#f8fafc!important;}
html[data-theme="dark"] tr:hover td{background:rgba(51,65,85,.55)!important;}
html[data-theme="dark"] .tableScroll td::before{color:#93c5fd!important;}

/* Badges, statuts et alertes */
html[data-theme="dark"] :is(.badge,.typePill,.shareBadge,.status,.dbStatus,.infoChip){
  border:1px solid var(--mk-border-soft)!important;
  color:#e5eefc!important;
}
html[data-theme="dark"] :is(.badge.ok,.ok,.status.ok,.dbStatus:not(.off),.msg.ok,.workloadAlert.ok,.planStateBox.ok,.forecastGuardBox.ok){
  background:rgba(20,83,45,.72)!important;
  color:#dcfce7!important;
  border-color:rgba(134,239,172,.28)!important;
}
html[data-theme="dark"] :is(.badge.warn,.warn,.workloadAlert.warn,.planStateBox.warn,.forecastGuardBox.warn){
  background:rgba(124,45,18,.70)!important;
  color:#ffedd5!important;
  border-color:rgba(251,146,60,.28)!important;
}
html[data-theme="dark"] :is(.badge.bad,.bad,.status.bad,.dbStatus.off,.msg.bad,.workloadAlert.danger,.planStateBox.bad,.forecastGuardBox.bad,.error,.alert){
  background:rgba(127,29,29,.72)!important;
  color:#fee2e2!important;
  border-color:rgba(252,165,165,.28)!important;
}
html[data-theme="dark"] :is(.badge.info,.info,.forecastGuardBox.info){
  background:rgba(30,64,175,.62)!important;
  color:#dbeafe!important;
  border-color:rgba(147,197,253,.28)!important;
}
html[data-theme="dark"] .note{background:rgba(20,83,45,.36)!important;color:#dcfce7!important;border-color:rgba(134,239,172,.28)!important;}

/* Couleurs financières plus visibles */
html[data-theme="dark"] .moneyGood{color:var(--mk-green-soft)!important;}
html[data-theme="dark"] .moneyBad{color:var(--mk-red-soft)!important;}
html[data-theme="dark"] .moneyWarn{color:var(--mk-orange-soft)!important;}
html[data-theme="dark"] :is(.clockTime,.time,.dayHour,.dashboardLiveTime,.goalProgressText,.arrow,.titleIcon,.checkItem i,.diag-info i){color:var(--mk-blue-soft)!important;}
html[data-theme="dark"] :is(.diag-good i){color:var(--mk-green-soft)!important;}
html[data-theme="dark"] :is(.diag-warn i){color:var(--mk-orange-soft)!important;}
html[data-theme="dark"] :is(.diag-bad i){color:var(--mk-red-soft)!important;}

/* Icônes et bulles */
html[data-theme="dark"] :is(.iconBubble,.goalIcon,.statIcon,.appIcon,.smartIcon,.brainCard .brainIcon,.alertCard .icon,.calendarIcon,#depenses .expenseMobileTitle i){
  background:rgba(30,41,59,.92)!important;
  color:#93c5fd!important;
  border:1px solid rgba(148,163,184,.22)!important;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.05)!important;
}
html[data-theme="dark"] :is(.iconBubble.income,.statIcon.ok,.alert-success .icon){color:#86efac!important;background:rgba(20,83,45,.55)!important;}
html[data-theme="dark"] :is(.iconBubble.fixed,.statIcon.bad,.alert-danger .icon){color:#fca5a5!important;background:rgba(127,29,29,.55)!important;}
html[data-theme="dark"] :is(.iconBubble.daily,.statIcon.warn,.alert-warning .icon){color:#fdba74!important;background:rgba(124,45,18,.55)!important;}
html[data-theme="dark"] :is(.iconBubble.goal,.smartIcon.task,.typePill.tiktok){color:#c4b5fd!important;background:rgba(76,29,149,.55)!important;}
html[data-theme="dark"] .iconText,
html[data-theme="dark"] .iconBadge{color:#f8fafc!important;background:rgba(30,41,59,.86)!important;border-color:var(--mk-border-soft)!important;}

/* Cartes colorées des tâches et projets */
html[data-theme="dark"] :is(.contentCard.youtube,.projectGroup.youtube,.dayTaskCard.youtube){background:rgba(127,29,29,.32)!important;border-color:rgba(252,165,165,.28)!important;color:#fee2e2!important;}
html[data-theme="dark"] :is(.contentCard.tiktok,.projectGroup.tiktok,.dayTaskCard.tiktok){background:rgba(76,29,149,.34)!important;border-color:rgba(196,181,253,.28)!important;color:#ede9fe!important;}
html[data-theme="dark"] :is(.contentCard.blog,.projectGroup.blog,.dayTaskCard.blog){background:rgba(20,83,45,.32)!important;border-color:rgba(134,239,172,.28)!important;color:#dcfce7!important;}
html[data-theme="dark"] :is(.contentCard.autre,.projectGroup.autre,.dayTaskCard.autre){background:rgba(30,64,175,.34)!important;border-color:rgba(147,197,253,.28)!important;color:#dbeafe!important;}
html[data-theme="dark"] .dayTaskNote{background:rgba(2,6,23,.35)!important;border-color:rgba(148,163,184,.28)!important;color:#cbd5e1!important;}

/* Graphiques, progressions et éléments spéciaux */
html[data-theme="dark"] .progress{background:rgba(148,163,184,.24)!important;}
html[data-theme="dark"] .progress span{background:linear-gradient(90deg,#60a5fa,#a78bfa)!important;}
html[data-theme="dark"] .scoreCircle{
  background:conic-gradient(#86efac 0deg,#86efac var(--scoreDeg,0deg),rgba(51,65,85,.82) var(--scoreDeg,0deg))!important;
  color:#f8fafc!important;
}
html[data-theme="dark"] .lockOverlay{background:rgba(2,6,23,.86)!important;}
html[data-theme="dark"] .secureNote{background:rgba(30,64,175,.36)!important;color:#dbeafe!important;border-color:rgba(147,197,253,.28)!important;}
html[data-theme="dark"] .toast,
html[data-theme="dark"] .notifyToast{background:#020617!important;color:#f8fafc!important;border:1px solid rgba(148,163,184,.24)!important;}
html[data-theme="dark"] .notifyToast small{color:#cbd5e1!important;}

/* Accueil */
html[data-theme="dark"] body.portalHome .brand{
  background:rgba(30,41,59,.86)!important;
  color:#dbeafe!important;
  border-color:var(--mk-border-soft)!important;
}
html[data-theme="dark"] body.portalHome .appCard{
  background:rgba(15,23,42,.82)!important;
  color:#f8fafc!important;
  border-color:var(--mk-border-soft)!important;
}
html[data-theme="dark"] body.portalHome .appCard p{color:#cbd5e1!important;}
html[data-theme="dark"] body.portalHome .arrow{color:#93c5fd!important;}

/* Mobile finance : libellés/valeurs */
html[data-theme="dark"] #depenses :is(.expenseMobileTitle,.expenseMobileValue,.expenseMobileCfa),
html[data-theme="dark"] #depenses .expenseMobileTitle,
html[data-theme="dark"] .expenseMobileValue{color:#f8fafc!important;}
html[data-theme="dark"] #depenses .expenseMobileLabel{color:#93c5fd!important;}
html[data-theme="dark"] .expenseMobileEmpty,
html[data-theme="dark"] .empty{background:rgba(15,23,42,.68)!important;color:#cbd5e1!important;border-color:var(--mk-border-soft)!important;}

/* Sélection, séparateurs et détails */
html[data-theme="dark"] hr,
html[data-theme="dark"] .divider{border-color:var(--mk-border-soft)!important;background:var(--mk-border-soft)!important;}
html[data-theme="dark"] ::selection{background:rgba(96,165,250,.45)!important;color:#fff!important;}
html[data-theme="dark"] canvas{filter:brightness(.98) contrast(1.08)!important;}

/* =========================================================
   CORRECTIF FINAL — Mode sombre stable et lisible
   Finance + Temps + Pharmacie + Utilisateurs + Accueil
   ========================================================= */
html[data-theme="dark"]{
  color-scheme:dark;
  --bg:#08111f!important;
  --card:#101a2e!important;
  --text:#edf4ff!important;
  --muted:#c3cfdd!important;
  --border:rgba(148,163,184,.32)!important;
  --dark:#050b16!important;
  --softblue:rgba(37,99,235,.18)!important;
  --softgreen:rgba(22,163,74,.18)!important;
  --softred:rgba(220,38,38,.18)!important;
  --softorange:rgba(249,115,22,.18)!important;
  --glass:rgba(16,26,46,.88)!important;
  --line:rgba(148,163,184,.28)!important;
  --shadow:0 18px 45px rgba(0,0,0,.38), inset 0 1px 0 rgba(255,255,255,.05)!important;
}

html[data-theme="dark"] body.appPage,
html[data-theme="dark"] body.userPage,
html[data-theme="dark"] body.portalHome{
  background:
    radial-gradient(circle at 14% 16%,rgba(37,99,235,.18),transparent 30%),
    radial-gradient(circle at 86% 10%,rgba(124,58,237,.20),transparent 34%),
    linear-gradient(180deg,#08111f 0%,#0b1220 54%,#050b16 100%)!important;
  color:#edf4ff!important;
}

/* Zone centrale : ne jamais revenir au blanc en mode sombre */
html[data-theme="dark"] body.appPage>.app,
html[data-theme="dark"] body.appPage>.app>main,
html[data-theme="dark"] body.appPage main,
html[data-theme="dark"] .page,
html[data-theme="dark"] .page.active,
html[data-theme="dark"] .pageBody,
html[data-theme="dark"] .dashboardScroll,
html[data-theme="dark"] .dashCards,
html[data-theme="dark"] .screenGrid,
html[data-theme="dark"] .wrap{
  background:transparent!important;
  color:#edf4ff!important;
}

/* En-têtes internes collants : problème principal sur Temps */
html[data-theme="dark"] body.appPage .pageTop,
html[data-theme="dark"] body.appPage .pageTitle,
html[data-theme="dark"] body.appPage .page>.row:first-child,
html[data-theme="dark"] body.appPage .dashTop,
html[data-theme="dark"] body.appPage .focusHeader,
html[data-theme="dark"] body.appPage .planningHeader{
  background:linear-gradient(180deg,rgba(8,17,31,.96) 0%,rgba(8,17,31,.90) 72%,rgba(8,17,31,.78) 100%)!important;
  color:#edf4ff!important;
  border-color:rgba(148,163,184,.22)!important;
  box-shadow:0 10px 24px rgba(0,0,0,.18)!important;
}
html[data-theme="dark"] body.appPage .page>h2{
  background:linear-gradient(180deg,rgba(8,17,31,.96) 0%,rgba(8,17,31,.86) 100%)!important;
  color:#f8fafc!important;
}

/* Tous les grands titres/labels doivent rester lisibles */
html[data-theme="dark"] body.appPage :is(h1,h2,h3,h4,h5,h6,.big,.title,.cardTitle,.pageTitle,.pageTitle h2,.pageTop h2,.dashTop h2,.dayTaskTitle,.taskMainTitle,.fileName,.budgetName,.recordTitle,.calendarTitle,.dashboardLiveTime,.clockTime,.kpi .big,.ratioValue,.scoreCircle),
html[data-theme="dark"] body.userPage :is(h1,h2,h3,h4,h5,h6,.big,.title),
html[data-theme="dark"] body.portalHome :is(h1,h2,h3,h4,h5,h6,.big,.title){
  color:#f8fafc!important;
}
html[data-theme="dark"] body.appPage :is(p,label,small,.sub,.subtitle,.muted,.hint,.sectionNote,.clockSub,.recordMeta,.recordDate,.recordCfa,.budgetStats,.taskLabel,.timeRange,.fileMeta,.dayTaskMeta,.dayTaskNote,.calendarText,.calendarEmpty,.stat span,.miniCard p,.card p),
html[data-theme="dark"] body.userPage :is(p,label,small,.sub,.subtitle,.muted,.hint),
html[data-theme="dark"] body.portalHome :is(p,label,small,.sub,.subtitle,.muted,.hint){
  color:#c3cfdd!important;
}

/* Cartes et surfaces */
html[data-theme="dark"] body.appPage :is(.card,.kpi,.miniCard,.fileCard,.contentCard,.projectGroup,.weekDay,.day,.dayTaskCard,.dayStat,.reportBox,.tableWrap,.tableScroll,.lockCard,.taskInfoCard,.currentCard,.nextCard,.clockBox,.todayMoneyCard,.manualForecastCard,.autoProvisionCard,.forecastAutoNote,.analysisChartCard,.analysisTableCard,.guideCard,.strategyCard,.libraryCard,.brainCard,.ratioCard,.diagnosticItem,.ifThenItem,.ruleItem,.checkItem,.alertCard,.budgetCard,.calendarItem,.expenseMobileCard,.recordCard,.mysqlLoginCard,.mysqlSyncMini,.focusSettingsCard,.workloadItem,.freeSlot,.incomeMini,.depenseMini,.debtMini,.calendarMini),
html[data-theme="dark"] body.userPage :is(.card,.tableWrap,.tableScroll,.userCard),
html[data-theme="dark"] body.portalHome :is(.card,.appCard){
  background:rgba(16,26,46,.90)!important;
  color:#edf4ff!important;
  border-color:rgba(148,163,184,.28)!important;
  box-shadow:0 18px 45px rgba(0,0,0,.36),inset 0 1px 0 rgba(255,255,255,.05)!important;
}
html[data-theme="dark"] body.appPage :is(.miniCard,.expenseMobileCard,.recordCard,.calendarItem,.freeSlot,.panelToggle,.mysqlSyncMini){
  background:rgba(30,41,59,.88)!important;
}

/* Formulaires */
html[data-theme="dark"] body.appPage :is(input,select,textarea),
html[data-theme="dark"] body.userPage :is(input,select,textarea),
html[data-theme="dark"] body.portalHome :is(input,select,textarea){
  background:#07101f!important;
  color:#f8fafc!important;
  border:1px solid rgba(148,163,184,.42)!important;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.04)!important;
}
html[data-theme="dark"] body.appPage :is(input,select,textarea)::placeholder,
html[data-theme="dark"] body.userPage :is(input,select,textarea)::placeholder,
html[data-theme="dark"] body.portalHome :is(input,select,textarea)::placeholder{color:#94a3b8!important;}
html[data-theme="dark"] option{background:#0f172a!important;color:#f8fafc!important;}
html[data-theme="dark"] body.appPage :is(input,select,textarea):focus,
html[data-theme="dark"] body.userPage :is(input,select,textarea):focus,
html[data-theme="dark"] body.portalHome :is(input,select,textarea):focus{
  outline:3px solid rgba(96,165,250,.22)!important;
  border-color:#60a5fa!important;
}

/* Boutons */
html[data-theme="dark"] body.appPage :is(.btn.light,.light,.smallBtn,.panelToggle,.addOptionBtn),
html[data-theme="dark"] body.userPage :is(.btn.light,.light,.smallBtn),
html[data-theme="dark"] body.portalHome :is(.btn.light,.light,.homeThemeBtn){
  background:#1e293b!important;
  color:#f8fafc!important;
  border-color:rgba(148,163,184,.34)!important;
}
html[data-theme="dark"] body.appPage :is(.btn.light,.light,.smallBtn,.panelToggle,.addOptionBtn):hover,
html[data-theme="dark"] body.userPage :is(.btn.light,.light,.smallBtn):hover,
html[data-theme="dark"] body.portalHome :is(.btn.light,.light,.homeThemeBtn):hover{
  background:#334155!important;
  color:#fff!important;
}
html[data-theme="dark"] body.appPage :is(.btn.primary,.primary){background:linear-gradient(135deg,#2563eb,#7c3aed)!important;color:#fff!important;}
html[data-theme="dark"] body.appPage :is(.btn.good,.good,.green){background:#15803d!important;color:#fff!important;}
html[data-theme="dark"] body.appPage :is(.btn.orange,.orange){background:#c2410c!important;color:#fff!important;}
html[data-theme="dark"] body.appPage :is(.btn.danger,.danger){background:#b91c1c!important;color:#fff!important;}
html[data-theme="dark"] body.appPage :is(.btn.purple,.purple){background:#6d28d9!important;color:#fff!important;}

/* Tableaux */
html[data-theme="dark"] body.appPage :is(table,.desktopTable,.tableScroll table,.tableWrap table),
html[data-theme="dark"] body.userPage :is(table,.desktopTable,.tableScroll table,.tableWrap table){
  background:#101a2e!important;
  color:#edf4ff!important;
}
html[data-theme="dark"] body.appPage :is(th,thead th),
html[data-theme="dark"] body.userPage :is(th,thead th){
  background:#172554!important;
  color:#dbeafe!important;
  border-color:rgba(148,163,184,.26)!important;
}
html[data-theme="dark"] body.appPage :is(td,tbody td),
html[data-theme="dark"] body.userPage :is(td,tbody td){
  background:transparent!important;
  color:#e5eefc!important;
  border-color:rgba(148,163,184,.18)!important;
}
html[data-theme="dark"] body.appPage tr:hover td,
html[data-theme="dark"] body.userPage tr:hover td{background:rgba(51,65,85,.60)!important;}
html[data-theme="dark"] body.appPage td b,
html[data-theme="dark"] body.userPage td b{color:#fff!important;}

/* Badges, statuts, notifications */
html[data-theme="dark"] body.appPage :is(.badge,.typePill,.shareBadge,.status,.dbStatus,.infoChip,.mysqlSyncBadge,.syncBadge,#timeMysqlState){
  border:1px solid rgba(148,163,184,.26)!important;
  color:#e5eefc!important;
}
html[data-theme="dark"] body.appPage :is(.ok,.badge.ok,.status.ok,.dbStatus:not(.off),.msg.ok,.workloadAlert.ok,.planStateBox.ok,.forecastGuardBox.ok,.mysqlSyncBadge.ok,.syncBadge.ok,#timeMysqlState.ok){
  background:rgba(20,83,45,.78)!important;color:#dcfce7!important;border-color:rgba(134,239,172,.30)!important;
}
html[data-theme="dark"] body.appPage :is(.warn,.badge.warn,.workloadAlert.warn,.planStateBox.warn,.forecastGuardBox.warn){
  background:rgba(124,45,18,.74)!important;color:#ffedd5!important;border-color:rgba(251,146,60,.30)!important;
}
html[data-theme="dark"] body.appPage :is(.bad,.badge.bad,.status.bad,.dbStatus.off,.msg.bad,.workloadAlert.danger,.planStateBox.bad,.forecastGuardBox.bad,.error,.alert,.mysqlSyncBadge.bad,.syncBadge.bad,#timeMysqlState.bad){
  background:rgba(127,29,29,.76)!important;color:#fee2e2!important;border-color:rgba(252,165,165,.30)!important;
}
html[data-theme="dark"] body.appPage :is(.info,.badge.info,.mysqlSyncBadge.info,.syncBadge.info,#timeMysqlState.info,#timeMysqlState:not(.ok):not(.bad)){
  background:rgba(30,64,175,.68)!important;color:#dbeafe!important;border-color:rgba(147,197,253,.30)!important;
}

/* Progressions, icônes et accents */
html[data-theme="dark"] body.appPage .progress{background:rgba(148,163,184,.25)!important;}
html[data-theme="dark"] body.appPage .progress span{background:linear-gradient(90deg,#60a5fa,#a78bfa)!important;}
html[data-theme="dark"] body.appPage :is(.moneyGood,.diag-good i){color:#86efac!important;}
html[data-theme="dark"] body.appPage :is(.moneyBad,.diag-bad i){color:#fca5a5!important;}
html[data-theme="dark"] body.appPage :is(.moneyWarn,.diag-warn i){color:#fdba74!important;}
html[data-theme="dark"] body.appPage :is(.clockTime,.time,.dayHour,.arrow,.titleIcon,.checkItem i,.diag-info i,.goalProgressText){color:#93c5fd!important;}
html[data-theme="dark"] body.appPage :is(.iconBubble,.goalIcon,.statIcon,.appIcon,.smartIcon,.brainCard .brainIcon,.alertCard .icon,.calendarIcon,#depenses .expenseMobileTitle i){
  background:rgba(30,41,59,.92)!important;
  color:#93c5fd!important;
  border:1px solid rgba(148,163,184,.26)!important;
}

/* Cartes colorées de tâches : sombre mais identifiable */
html[data-theme="dark"] body.appPage :is(.contentCard.youtube,.projectGroup.youtube,.dayTaskCard.youtube){background:rgba(127,29,29,.34)!important;border-color:rgba(252,165,165,.30)!important;color:#fee2e2!important;}
html[data-theme="dark"] body.appPage :is(.contentCard.tiktok,.projectGroup.tiktok,.dayTaskCard.tiktok){background:rgba(76,29,149,.36)!important;border-color:rgba(196,181,253,.30)!important;color:#ede9fe!important;}
html[data-theme="dark"] body.appPage :is(.contentCard.blog,.projectGroup.blog,.dayTaskCard.blog){background:rgba(20,83,45,.34)!important;border-color:rgba(134,239,172,.30)!important;color:#dcfce7!important;}
html[data-theme="dark"] body.appPage :is(.contentCard.autre,.projectGroup.autre,.dayTaskCard.autre){background:rgba(30,64,175,.36)!important;border-color:rgba(147,197,253,.30)!important;color:#dbeafe!important;}
html[data-theme="dark"] body.appPage .dayTaskNote{background:rgba(2,6,23,.40)!important;color:#cbd5e1!important;border-color:rgba(148,163,184,.30)!important;}

/* Menus latéraux : contraste uniforme */
html[data-theme="dark"] body.appPage>.app>nav{background:linear-gradient(180deg,#050b16,#0b1220)!important;border-right:1px solid rgba(148,163,184,.16)!important;}
html[data-theme="dark"] body.appPage>.app>nav button{background:rgba(30,41,59,.55)!important;color:#e5eefc!important;border-color:rgba(148,163,184,.18)!important;}
html[data-theme="dark"] body.appPage>.app>nav button:hover,
html[data-theme="dark"] body.appPage>.app>nav button.active{background:linear-gradient(135deg,#2563eb,#7c3aed)!important;color:#fff!important;}

/* Notes/vides/overlays */
html[data-theme="dark"] body.appPage :is(.empty,.expenseMobileEmpty){background:rgba(16,26,46,.82)!important;color:#cbd5e1!important;border-color:rgba(148,163,184,.24)!important;}
html[data-theme="dark"] body.appPage :is(.note){background:rgba(20,83,45,.36)!important;color:#dcfce7!important;border-color:rgba(134,239,172,.28)!important;}
html[data-theme="dark"] body.appPage :is(.toast,.notifyToast){background:#020617!important;color:#f8fafc!important;border:1px solid rgba(148,163,184,.24)!important;}
html[data-theme="dark"] body.appPage .lockOverlay{background:rgba(2,6,23,.88)!important;}
html[data-theme="dark"] canvas{filter:brightness(.98) contrast(1.08)!important;}

@media(max-width:720px){
  html[data-theme="dark"] body.appPage .page>.row:first-child,
  html[data-theme="dark"] body.appPage .pageTop,
  html[data-theme="dark"] body.appPage .dashTop{background:rgba(8,17,31,.96)!important;}
}
