html.theme-dark{
  color-scheme:dark;
  --bg:#0d1726;
  --card:#131f33;
  --txt:#eaf1fb;
  --muted:#9eb0c7;
  --border:#2a3950;
  --ring:rgba(96,165,250,.28);

  --app-bg:#0b1422;
  --surface:#131f33;
  --surface-soft:#18263d;
  --surface-muted:#1a2a43;
  --line:#2a3950;
  --line-strong:#365070;
  --text:#eaf1fb;
  --text-muted:#9eb0c7;
  --brand:#60a5fa;
  --brand-strong:#93c5fd;
  --brand-soft:rgba(96,165,250,.16);
  --input-bg:#0c1627;
  --input-text:#f8fbff;
  --topbar-bg:rgba(11,20,34,.84);
  --topbar-border:rgba(42,57,80,.92);
  --mobile-overlay:rgba(2,6,23,.72);

  --pri:#60a5fa;
  --pri-hover:#93c5fd;
  --pri-soft:rgba(96,165,250,.16);

  --shadow-sm:0 1px 2px rgba(0,0,0,.18);
  --shadow-soft:0 14px 34px rgba(0,0,0,.22);
  --shadow-md:0 10px 24px rgba(0,0,0,.18);
  --shadow-lg:0 18px 36px rgba(0,0,0,.22);
  --shadow-float:0 24px 48px rgba(0,0,0,.28);
}

html.theme-dark body{
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(37,99,235,.10), transparent 45%),
    radial-gradient(900px 500px at 100% 0%, rgba(16,185,129,.06), transparent 35%),
    var(--app-bg);
  color:var(--text);
}

html.theme-dark .topbar{
  background:var(--topbar-bg) !important;
  border-bottom-color:var(--topbar-border) !important;
  box-shadow:0 1px 0 rgba(255,255,255,.03);
}

html.theme-dark .brand,
html.theme-dark .brand__name,
html.theme-dark .userbar__name,
html.theme-dark .user__name,
html.theme-dark .mnavTitle{
  color:var(--text) !important;
}

html.theme-dark .topbar .nav a,
html.theme-dark .topbar .nav__link,
html.theme-dark .mnavLinks a,
html.theme-dark .menuitem{
  color:var(--text-muted) !important;
}

html.theme-dark .topbar .nav a:hover,
html.theme-dark .topbar .nav__link:hover,
html.theme-dark .mnavLinks a:hover,
html.theme-dark .menuitem:hover{
  background:rgba(255,255,255,.04) !important;
  color:var(--text) !important;
}

html.theme-dark .topbar .nav a.is-active,
html.theme-dark .topbar .nav__link.is-active,
html.theme-dark .mnavLinks a.is-active{
  background:rgba(96,165,250,.16) !important;
  color:#dce9ff !important;
  border-color:rgba(96,165,250,.18) !important;
}

html.theme-dark .seasonpill,
html.theme-dark .topbar__burger,
html.theme-dark .iconbtn,
html.theme-dark .user__btn,
html.theme-dark .mnavClose,
html.theme-dark .themeToggle__track{
  border-color:var(--line) !important;
}

html.theme-dark .user__menu,
html.theme-dark .mnavPanel{
  background:var(--surface) !important;
  border-color:var(--line) !important;
  box-shadow:var(--shadow-float) !important;
}

html.theme-dark .card,
html.theme-dark .panel,
html.theme-dark .hero,
html.theme-dark .kpi,
html.theme-dark .banner,
html.theme-dark .filters,
html.theme-dark .tablewrap,
html.theme-dark .tableWrap,
html.theme-dark .widget,
html.theme-dark .statsCard,
html.theme-dark .chartCard,
html.theme-dark .kpiCard,
html.theme-dark .modal__content,
html.theme-dark .auth-card,
html.theme-dark .authCard,
html.theme-dark .loginCard,
html.theme-dark .formCard,
html.theme-dark .card.soft,
html.theme-dark .kpi .box{
  background:var(--surface) !important;
  color:var(--text) !important;
  border-color:var(--line) !important;
  box-shadow:var(--shadow-soft) !important;
}

html.theme-dark .banner--err{
  background:rgba(127,29,29,.20) !important;
  color:#fecaca !important;
  border-color:rgba(248,113,113,.32) !important;
}
html.theme-dark .banner--warn{
  background:rgba(146,64,14,.18) !important;
  color:#fde68a !important;
  border-color:rgba(245,158,11,.28) !important;
}

html.theme-dark .field{
  border-bottom-color:rgba(158,176,199,.14) !important;
}

html.theme-dark h1,
html.theme-dark h2,
html.theme-dark h3,
html.theme-dark h4,
html.theme-dark h5,
html.theme-dark h6,
html.theme-dark .pageTitle,
html.theme-dark .section-title,
html.theme-dark .panel__title,
html.theme-dark .hero h2,
html.theme-dark label,
html.theme-dark .field > label,
html.theme-dark .field label,
html.theme-dark th,
html.theme-dark td,
html.theme-dark .meta-label,
html.theme-dark .meta-value,
html.theme-dark .kpi__value,
html.theme-dark .kpi .v,
html.theme-dark .userbar__name,
html.theme-dark .user__name,
html.theme-dark .table td::before{
  color:var(--text) !important;
}

html.theme-dark p,
html.theme-dark .p,
html.theme-dark .small,
html.theme-dark .muted,
html.theme-dark .subtext,
html.theme-dark .note,
html.theme-dark .hint,
html.theme-dark .hero .sub,
html.theme-dark .panel__sub,
html.theme-dark .kpi__label,
html.theme-dark .kpi__hint,
html.theme-dark .rowMag .line2,
html.theme-dark .user__role,
html.theme-dark .pager .meta,
html.theme-dark .kpi .t{
  color:var(--text-muted) !important;
}

html.theme-dark a:not(.btn):not(.nav__link):not(.menuitem){
  color:#cfe2ff;
}

html.theme-dark .btn{
  background:var(--surface-soft) !important;
  color:var(--text) !important;
  border-color:var(--line) !important;
  box-shadow:none !important;
}

html.theme-dark .btn:hover{
  background:#1d2d46 !important;
  border-color:var(--line-strong) !important;
}

html.theme-dark .btn.primary{
  background:linear-gradient(180deg, #3b82f6 0%, #2563eb 100%) !important;
  color:#fff !important;
  border-color:transparent !important;
}

html.theme-dark .btn.primary:hover{
  background:linear-gradient(180deg, #60a5fa 0%, #3b82f6 100%) !important;
}

html.theme-dark .btn.danger,
html.theme-dark .iconbtn.danger{
  background:rgba(239,68,68,.14) !important;
  color:#fecaca !important;
  border-color:rgba(248,113,113,.18) !important;
}

html.theme-dark .chip,
html.theme-dark .badge,
html.theme-dark .pill{
  box-shadow:none !important;
}

html.theme-dark .badge.gray{
  background:rgba(148,163,184,.12) !important;
  color:#cbd5e1 !important;
  border-color:rgba(148,163,184,.22) !important;
}

html.theme-dark .badge.blue{
  background:rgba(59,130,246,.18) !important;
  color:#dbeafe !important;
  border-color:rgba(96,165,250,.28) !important;
}
html.theme-dark .badge.green{
  background:rgba(22,163,74,.18) !important;
  color:#dcfce7 !important;
  border-color:rgba(74,222,128,.24) !important;
}
html.theme-dark .badge.amber{
  background:rgba(245,158,11,.18) !important;
  color:#fde68a !important;
  border-color:rgba(251,191,36,.24) !important;
}
html.theme-dark .badge.red{
  background:rgba(239,68,68,.18) !important;
  color:#fecaca !important;
  border-color:rgba(248,113,113,.24) !important;
}

html.theme-dark .pill{
  background:var(--surface-soft) !important;
  color:var(--text-muted) !important;
  border-color:var(--line) !important;
}

html.theme-dark .table{
  color:var(--text) !important;
}
html.theme-dark .table th{
  background:rgba(255,255,255,.03) !important;
  color:var(--text) !important;
  border-bottom-color:var(--line) !important;
}
html.theme-dark .table td{
  color:var(--text) !important;
  border-bottom-color:rgba(158,176,199,.14) !important;
}
html.theme-dark .table tr:hover td{
  background:rgba(255,255,255,.03) !important;
}
html.theme-dark .tablewrap thead th{
  background:var(--surface-soft) !important;
}

html.theme-dark input,
html.theme-dark select,
html.theme-dark textarea,
html.theme-dark .field input,
html.theme-dark .field select,
html.theme-dark .field textarea,
html.theme-dark .table .inline-edit input,
html.theme-dark .table .inline-edit select,
html.theme-dark input[type="date"]{
  background:var(--input-bg) !important;
  color:var(--input-text) !important;
  border-color:var(--line) !important;
  box-shadow:none !important;
}
html.theme-dark input::placeholder,
html.theme-dark textarea::placeholder{
  color:#70829d !important;
}
html.theme-dark input:focus,
html.theme-dark select:focus,
html.theme-dark textarea:focus{
  border-color:#4f83c7 !important;
  box-shadow:0 0 0 3px rgba(79,131,199,.20) !important;
}
html.theme-dark input[type="date"]::-webkit-calendar-picker-indicator{
  filter:invert(1) brightness(1.25);
}

html.theme-dark .alert.alert-danger{
  background:rgba(127,29,29,.22) !important;
  color:#fecaca !important;
  border-color:rgba(248,113,113,.28) !important;
}
html.theme-dark .alert-icon{
  fill:#f87171 !important;
}

html.theme-dark .auth-wrap{
  background:none !important;
}
html.theme-dark .auth-card{
  background:linear-gradient(180deg, rgba(19,31,51,.98) 0%, rgba(15,27,45,.98) 100%) !important;
  border-color:var(--line) !important;
}
html.theme-dark .auth-subtitle{
  color:var(--text-muted) !important;
}
html.theme-dark .brand-badge{
  box-shadow:0 10px 24px rgba(37,99,235,.18) !important;
}

html.theme-dark .dash .panel,
html.theme-dark .dash .kpi,
html.theme-dark .dash .hero{
  background:rgba(19,31,51,.96) !important;
}

html.theme-dark .chartBox{
  background:transparent !important;
}

html.theme-dark .card:hover,
html.theme-dark .panel:hover,
html.theme-dark .hero:hover,
html.theme-dark .kpi:hover{
  box-shadow:0 14px 34px rgba(0,0,0,.18) !important;
}

html.theme-dark .menuitem--danger{
  color:#fecaca !important;
}
html.theme-dark .menuitem--danger:hover{
  background:rgba(239,68,68,.12) !important;
}

html.theme-dark .pwd-toggle{
  color:var(--text-muted) !important;
}
html.theme-dark .pwd-toggle:hover{
  background:rgba(255,255,255,.05) !important;
  color:var(--text) !important;
}

html.theme-dark .themeToggle__track{
  background:linear-gradient(180deg, #1a2b46 0%, #142238 100%) !important;
  border-color:#2e4664 !important;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.04), 0 8px 20px rgba(0,0,0,.18) !important;
}
html.theme-dark .themeToggle__thumb{
  background:linear-gradient(180deg,#dbe6ff 0%,#cad8f6 100%) !important;
}
html.theme-dark .themeToggle__icon--sun{ color:#6f88ac !important; }
html.theme-dark .themeToggle__icon--moon{ color:#f8fbff !important; }

html.theme-dark .legend,
html.theme-dark .chart-legend,
html.theme-dark .apexcharts-legend-text{
  color:var(--text-muted) !important;
}

html.theme-dark hr{
  border-color:var(--line) !important;
}

html.theme-dark .footer-note,
html.theme-dark .meta,
html.theme-dark .foot{
  color:var(--text-muted) !important;
}
html.theme-dark .tabs .tab,
html.theme-dark .modalTabs .tab,
html.theme-dark .tab {
  background: #18263d !important;
  color: #dbe7fb !important;
  border-color: #2c4260 !important;
  box-shadow: none !important;
}

html.theme-dark .tabs .tab:hover,
html.theme-dark .modalTabs .tab:hover,
html.theme-dark .tab:hover {
  background: #1c2d47 !important;
  color: #f8fbff !important;
  border-color: #355176 !important;
}

html.theme-dark .tabs .tab.active,
html.theme-dark .modalTabs .tab.active,
html.theme-dark .tab.active {
  background: rgba(59,130,246,.18) !important;
  color: #dceaff !important;
  border-color: rgba(96,165,250,.40) !important;
}

html.theme-dark .tabs .tab[disabled],
html.theme-dark .modalTabs .tab[disabled],
html.theme-dark .tab[disabled],
html.theme-dark .tabs .tab.disabled,
html.theme-dark .modalTabs .tab.disabled,
html.theme-dark .tab.disabled {
  background: #132238 !important;
  color: #6f88ac !important;
  border-color: #233957 !important;
  opacity: 1 !important;
  cursor: not-allowed !important;
}

/* ── pos_reports/edit & rapports edit – dark mode ─────────────────── */
html.theme-dark .fileBox{
  background:var(--surface) !important;
  border-color:var(--line) !important;
}
html.theme-dark .filePreview{
  background:var(--surface-soft) !important;
  border-color:var(--line) !important;
}
html.theme-dark .fileMeta .name{
  color:var(--text) !important;
}
html.theme-dark .fileMeta .sub{
  color:var(--text-muted) !important;
}
html.theme-dark .photoItem{
  background:var(--surface) !important;
  border-color:var(--line) !important;
}
html.theme-dark .thumb{
  border-color:var(--line) !important;
  opacity:.92;
}
html.theme-dark .field input[disabled],
html.theme-dark .field select[disabled],
html.theme-dark input[disabled]{
  background:rgba(255,255,255,.04) !important;
  color:var(--text-muted) !important;
  border-color:var(--line) !important;
  cursor:not-allowed;
}
html.theme-dark .err-banner{
  background:rgba(127,29,29,.22) !important;
  color:#fecaca !important;
  border-color:rgba(248,113,113,.28) !important;
}
html.theme-dark .smallMuted{
  color:var(--text-muted) !important;
}
html.theme-dark .sub{
  color:var(--text-muted) !important;
}
html.theme-dark .divider{
  border-top-color:var(--line) !important;
}

/* ── reports/edit – dark mode ─────────────────────────────────────── */
html.theme-dark .radio5 label{
  background:var(--surface-soft) !important;
  color:var(--text) !important;
  border-color:var(--line) !important;
}
html.theme-dark .radio5 label:hover{
  border-color:var(--brand) !important;
  background:var(--surface-muted) !important;
}
html.theme-dark .radio5 label:has(input:checked){
  background:var(--brand) !important;
  border-color:transparent !important;
  color:#fff !important;
}
html.theme-dark .ssel__input{
  background:var(--input-bg) !important;
  color:var(--input-text) !important;
  border-color:var(--line) !important;
}
html.theme-dark .ssel__dd{
  background:var(--surface) !important;
  border-color:var(--line) !important;
  box-shadow:0 12px 28px rgba(0,0,0,.28) !important;
}
html.theme-dark .ssel__item:hover{
  background:rgba(255,255,255,.05) !important;
}
html.theme-dark .ssel__item b{
  color:var(--text) !important;
}
html.theme-dark .ssel__item small,
html.theme-dark .ssel__empty{
  color:var(--text-muted) !important;
}
html.theme-dark .sectionCard{
  background:var(--surface) !important;
  border-color:var(--line) !important;
}
html.theme-dark .sectionHead b{
  color:var(--text) !important;
}
html.theme-dark .sectionHead .small{
  color:var(--text-muted) !important;
}
html.theme-dark .tableWrap{
  border-color:var(--line) !important;
}
html.theme-dark .glpiHelp{
  color:var(--text-muted) !important;
}
html.theme-dark #refErr{
  background:rgba(127,29,29,.22) !important;
  color:#fecaca !important;
  border-color:rgba(248,113,113,.28) !important;
}
html.theme-dark #refInfo{
  color:var(--text-muted) !important;
}

/* ── Mobile table rows (app.css sets background:#fff at 820px) ─── */
@media (max-width:820px) {
  html.theme-dark .table tr {
    background:var(--surface) !important;
    border-color:var(--line) !important;
    box-shadow:var(--shadow-sm) !important;
  }
  html.theme-dark .table td {
    border-bottom-color:var(--line) !important;
  }
}

/* ── Mobile nav dropdown (hardcoded #fff at 820px and 900px) ───── */
@media (max-width:900px) {
  html.theme-dark .nav {
    background:var(--surface) !important;
    border-color:var(--line) !important;
    box-shadow:var(--shadow-float) !important;
  }
}

/* ── iconbtn (zoneville, admin pages) ──────────────────────────── */
html.theme-dark .iconbtn {
  background:var(--surface-soft) !important;
  color:var(--text) !important;
  border-color:var(--line) !important;
}
html.theme-dark .iconbtn:hover {
  background:var(--surface-muted) !important;
}

/* ── pager__btn ─────────────────────────────────────────────────── */
html.theme-dark .pager__btn {
  background:var(--surface-soft) !important;
  color:var(--text) !important;
  border-color:var(--line) !important;
}
html.theme-dark .pager__btn:hover {
  background:var(--surface-muted) !important;
}

/* ── chip (report view) ─────────────────────────────────────────── */
html.theme-dark .chip {
  background:var(--surface-soft) !important;
  color:var(--text) !important;
  border-color:var(--line) !important;
}

/* ── badge semantic colors (ok/warn/draft/bad/dim) ──────────────── */
html.theme-dark .badge.ok {
  background:rgba(22,163,74,.18) !important;
  color:#bbf7d0 !important;
  border-color:rgba(74,222,128,.24) !important;
}
html.theme-dark .badge.warn {
  background:rgba(245,158,11,.18) !important;
  color:#fde68a !important;
  border-color:rgba(251,191,36,.24) !important;
}
html.theme-dark .badge.draft {
  background:rgba(59,130,246,.14) !important;
  color:#bfdbfe !important;
  border-color:rgba(96,165,250,.22) !important;
}
html.theme-dark .badge.bad,
html.theme-dark .badge.danger {
  background:rgba(239,68,68,.18) !important;
  color:#fecaca !important;
  border-color:rgba(248,113,113,.24) !important;
}
html.theme-dark .badge.dim {
  background:rgba(148,163,184,.10) !important;
  color:var(--text-muted) !important;
  border-color:rgba(148,163,184,.18) !important;
}

/* ── btn.danger light background ───────────────────────────────── */
html.theme-dark .btn.danger {
  background:rgba(239,68,68,.14) !important;
  color:#fecaca !important;
  border-color:rgba(248,113,113,.18) !important;
}

/* ── card.soft + kpi.box + thumb2 not caught by generic .card ──── */
html.theme-dark .thumb2 {
  background:var(--surface-soft) !important;
  border-color:var(--line) !important;
}

/* ── navdd (Rapports dropdown topbar) ───────────────────────────── */
html.theme-dark .navdd__btn {
  background:var(--surface-soft) !important;
  color:var(--text) !important;
  border-color:var(--line) !important;
}
html.theme-dark .navdd__btn:hover,
html.theme-dark .nav__link:hover {
  background:rgba(255,255,255,.05) !important;
  color:var(--text) !important;
}
html.theme-dark .navdd__menu {
  background:var(--surface) !important;
  border-color:var(--line) !important;
  box-shadow:var(--shadow-float) !important;
}
html.theme-dark .navdd__item {
  color:var(--text) !important;
}
html.theme-dark .navdd__item:hover {
  background:rgba(255,255,255,.05) !important;
  color:var(--text) !important;
}

/* ── seasonpill (topbar season indicator) ───────────────────────── */
html.theme-dark .seasonpill {
  background:var(--surface-soft) !important;
  color:var(--text-muted) !important;
}

/* ── is-locked (disabled/readonly fields) ───────────────────────── */
html.theme-dark .is-locked {
  background:rgba(255,255,255,.04) !important;
  color:var(--text-muted) !important;
  border-color:var(--line) !important;
}

/* ── field select hover ─────────────────────────────────────────── */
html.theme-dark .field select:hover {
  background-color:var(--surface-muted) !important;
  border-color:var(--line-strong) !important;
}

/* ── badge.lock (saisons) ───────────────────────────────────────── */
html.theme-dark .badge.lock {
  background:rgba(148,163,184,.14) !important;
  color:#cbd5e1 !important;
  border-color:rgba(148,163,184,.24) !important;
}

/* ── banner.err (recap.css uses .banner.err not .banner--err) ───── */
html.theme-dark .banner.err {
  background:rgba(127,29,29,.20) !important;
  color:#fecaca !important;
  border-color:rgba(248,113,113,.32) !important;
}

/* ── btn.icon.gray / btn.icon.danger (access page) ─────────────── */
html.theme-dark .btn.icon.gray {
  background:var(--surface-soft) !important;
  border-color:var(--line) !important;
  color:var(--text) !important;
}
html.theme-dark .btn.icon.danger {
  background:rgba(239,68,68,.14) !important;
  border-color:rgba(248,113,113,.22) !important;
  color:#fca5a5 !important;
}

/* ── kbd (magasins help tooltip) ────────────────────────────────── */
html.theme-dark .kbd {
  background:var(--surface-soft) !important;
  border-color:var(--line) !important;
  color:var(--text-muted) !important;
}

/* ── modal__img (image viewer modal) ───────────────────────────── */
html.theme-dark .modal__img {
  background:#0d1117 !important;
  border-color:rgba(255,255,255,.1) !important;
}