/* PSR Pilotage — thème sombre (choisi par chaque utilisateur : Clair, Sombre ou Automatique) */
html[data-theme="dark"]{
  color-scheme:dark;
  --bg:#0E1513; --ink:#E2EBE7; --muted:#93A59D; --line:#2B3934; --line2:#22302B;
  --vert-pale:#163629; --vert-texte:#6FD3A2; --vert-fonce:#5FD19B; --orange:#F2A65E; --orange-pale:#3A2A17; --rouge:#FF8A80;
  --s1:#16201D; --s2:#1C2824; --s3:#23312C;
}
html[data-theme="dark"] body{background:var(--bg);color:var(--ink)}
html[data-theme="dark"] a{color:#6FD3A2}
html[data-theme="dark"] h1,html[data-theme="dark"] h2,html[data-theme="dark"] h3,html[data-theme="dark"] .acc-h{color:#EAF2EE}
html[data-theme="dark"] .foot,html[data-theme="dark"] .muted,html[data-theme="dark"] .sous,html[data-theme="dark"] small{color:var(--muted)}

/* surfaces */
html[data-theme="dark"] :is(.card,.tl-carte,.tuile,.sem-j,.acc-r,.pl-tel-jour,.pl-tel-modes,.pl-tel-jours button,.mj-fleche,.liste-aff,.liste-aff .it-aff,
  .pop,.menu-scinder,.menu-scinder button,.zone,.zone-depot,.depot,.aide,.sous-onglets,.filtres,.bascule-vue a,.btn2,.btn-choisir,.ic,.decal button,
  .prev-btn,.prev-total,.prev-aucune,.cr-pl,.ag-nom,.ag-jt,.ag-axe,.ag-coin,.ag-coin2,.todo-ajout,.consignes,.cloture-bandeau,.apercu-signature,
  .etapes-insc span,.mois-case span,.client-tag,.chip-sans,.tag.auto,.kb-col>header .nb,.ca-pied,.mj-bouton.secondaire,.pl-tel-jour header .plus){
  background:var(--s1)!important;color:var(--ink);border-color:var(--line)!important}
html[data-theme="dark"] :is(.card,.tl-carte,.tuile,.sem-j){box-shadow:0 1px 0 rgba(255,255,255,.02),0 4px 14px rgba(0,0,0,.35)}
html[data-theme="dark"] :is(.acc-aff a:hover,.acc-cartes a:hover,.acc-taches a:hover,.liste-aff .it-aff:hover,.ag-p:hover,.tuile:hover,.sem-j:hover){background:var(--s3)!important}
html[data-theme="dark"] :is(.bascule-vue a.on,.pl-tel-modes button.on,.niveau.actif){background:var(--vert-pale)!important;color:#8BE3B7!important}
html[data-theme="dark"] dialog{background:var(--s1);color:var(--ink);border:1px solid var(--line)}
html[data-theme="dark"] dialog::backdrop{background:rgba(0,0,0,.55)}

/* champs de saisie */
html[data-theme="dark"] :is(input,select,textarea){background:var(--s2);color:var(--ink);border-color:var(--line)}
html[data-theme="dark"] :is(input,select,textarea):focus{border-color:#3FAF7F;outline-color:#3FAF7F}
html[data-theme="dark"] input::placeholder,html[data-theme="dark"] textarea::placeholder{color:#6F827A}
html[data-theme="dark"] :is(input.rempli,input.cellule:hover,input.cellule:focus,select.a-renseigner,.heures-lignes input:disabled){background:var(--s3)!important}

/* tableaux */
html[data-theme="dark"] th{background:var(--s2)!important;color:#A8B9B1;border-color:var(--line)!important}
html[data-theme="dark"] td{border-color:var(--line2)!important}
html[data-theme="dark"] :is(table.factu tbody tr:nth-child(even) td){background:#131C19!important}
html[data-theme="dark"] :is(table.factu tbody tr:hover td,tbody tr:hover td){background:var(--s3)!important}
html[data-theme="dark"] :is(table.prev td.col-aff,table.prev th.col-aff,table.prev td.avant,table.prev th.avant,table.prev tfoot td,table.synthese tr.total td,
  td.case.cible,td.case.courant,table.planning td.aujourdhui,table.planning th.aujourdhui,table.planning td.we,table.planning th.we,tr.ligne-terminee td){background:var(--s2)!important}
html[data-theme="dark"] tr.ligne-terminee td{background:#12261D!important}

/* jauges, barres */
html[data-theme="dark"] :is(.jauge,.acc-barre,.barre-nat,.barre-age){background:#26332E!important}
html[data-theme="dark"] .tl-point::before{background:var(--line)}
html[data-theme="dark"] .tl-point::after{box-shadow:0 0 0 3px var(--bg)}

/* encadrés colorés (accès, matos, météo, alertes) */
html[data-theme="dark"] :is(.mj-acces,.tl-alerte,.mto.alerte,.mj-mto.alerte,.acc-hero-mto .conseil){background:#3A2C14!important;border-color:#6B5320!important;color:#F7D9A6!important}
html[data-theme="dark"] :is(.mj-matos,.kb-av.complet,.liste-aff .it-jum,.liste-aff .bloc-jum .liste-jum){background:#132A20!important;border-color:#23513C!important;color:#BFEBD3}
html[data-theme="dark"] :is(.mto,.mj-mto){background:#132236!important;border-color:#27456B!important;color:#B7D4F5!important}
html[data-theme="dark"] .bandeau.trello-etat{background:#12233A!important;border-color:#2B4E7A!important;color:#C4DCF7}
html[data-theme="dark"] .bandeau.ok{background:#12261D;border-color:#23513C;color:#BFEBD3}
html[data-theme="dark"] .bandeau.alerte,html[data-theme="dark"] .bandeau.err{background:#3A2014;border-color:#6B3A20;color:#F7C9A6}

/* textes écrits en dur dans les pages d'accueil et d'organisation */
html[data-theme="dark"] :is(.tl-titre,.tl-h b,.sem-t b,.aff-t,.acc-c-t,.mj-titre,.mj-date b,.kb-titre,.todo-t span){color:#EAF2EE}
html[data-theme="dark"] :is(.tl-avec,.tuile span,.kb-b,.aff-g small){color:#A8B9B1}
html[data-theme="dark"] .tl-avec i{background:#1E3A2E;color:#9FE3C1}
html[data-theme="dark"] .tl-item.hors .tl-carte,html[data-theme="dark"] .mj-cr.hors{background:repeating-linear-gradient(135deg,#18211E 0 8px,#141C19 8px 16px)!important}

/* planning (agenda) */
html[data-theme="dark"] .ag-col{background-image:repeating-linear-gradient(to bottom,transparent 0,transparent 45px,#1F2B27 45px,#1F2B27 46px),
  repeating-linear-gradient(to bottom,transparent 0,transparent 22px,#18221F 22px,#18221F 23px)}
html[data-theme="dark"] .ag-jour.auj .ag-col{background-color:#122019}
html[data-theme="dark"] :is(.ag-jour.we,.ag-jour.we .ag-jt){background:#121A17!important}
html[data-theme="dark"] .ag-ev{background:color-mix(in srgb, var(--c) 28%, #16201D);color:#E8F1ED}
html[data-theme="dark"] .ag-ev .ag-hh{color:#A8B9B1}
html[data-theme="dark"] .ag-ev.lieu,html[data-theme="dark"] .ag-ev.hors{background:repeating-linear-gradient(135deg,#1C2522 0 6px,#18201D 6px 12px);color:#A8B9B1}
html[data-theme="dark"] .ag-trou{background:rgba(232,137,58,.08)}
html[data-theme="dark"] .pl-tel-cr{background:color-mix(in srgb, var(--c) 22%, #16201D)!important;color:#E8F1ED}

/* organisation (façon Trello, comme le thème sombre de Trello) */
html[data-theme="dark"] .tableau-trello .kb-col{background:#101204!important;box-shadow:none}
html[data-theme="dark"] .tableau-trello .kb-col>header{color:#B6C2CF}
html[data-theme="dark"] :is(.kb-carte,.tableau-trello .kb-carte){background:#22272B!important;color:#B6C2CF;box-shadow:0 1px 1px rgba(0,0,0,.5)}
html[data-theme="dark"] .kb-carte .kb-titre{color:#DEE4EA}
html[data-theme="dark"] .kb-sous{color:#8C9BAB}
html[data-theme="dark"] .kb-av{background:#2C333A!important;color:#B6C2CF}
html[data-theme="dark"] body.kb-tel .kb-onglets button{background:rgba(34,39,43,.9);color:#DEE4EA}
html[data-theme="dark"] body.kb-tel .kb-onglets button.on{background:#22272B;box-shadow:0 0 0 2px #579DFF}
html[data-theme="dark"] .org-liste li{border-color:var(--line2)}

/* divers */
html[data-theme="dark"] .tirer{background:var(--s2);color:#6FD3A2}
html[data-theme="dark"] .login-page{background:var(--bg)}
html[data-theme="dark"] img[src*="logo-psr"]{filter:drop-shadow(0 0 1px rgba(255,255,255,.2))}
html[data-theme="dark"] .ca-sugg{background:#26332E!important;color:#A8B9B1}
html[data-theme="dark"] .ca-sugg.fort{background:#163629!important;color:#8BE3B7}
html[data-theme="dark"] .ca-sugg.moyen{background:#3A2A17!important;color:#F2C28E}
/* les pastilles d'état (couleurs pastel) restent lisibles : on les assombrit légèrement */
html[data-theme="dark"] .chip{filter:brightness(.88) saturate(1.05)}
html[data-theme="dark"] .choix-theme button.on{background:var(--vert-pale);color:#8BE3B7}
html[data-theme="dark"] .ag-ev.parallele{background:repeating-linear-gradient(135deg,rgba(255,255,255,.06) 0 5px,transparent 5px 10px),color-mix(in srgb, var(--c) 20%, #16201D)}
html[data-theme="dark"] .ag-ev.hors-fazeos{background:repeating-linear-gradient(135deg,#132236 0 6px,#101D2E 6px 12px);color:#B7D4F5}
html[data-theme="dark"] .ag-ev.lieu{background:#1A2320;color:#93A59D}
html[data-theme="dark"] .puce{filter:brightness(.85) saturate(1.05)}
/* légendes en ovale (Facturation, Suivi…) : fond sombre, texte clair, couleur de la nature ou de l'état en accent */
html[data-theme="dark"] .leg{background:var(--s1)!important;color:var(--ink)!important;border-color:var(--line)!important}
html[data-theme="dark"] .leg b{color:var(--c,#6FD3A2)!important}
html[data-theme="dark"] .leg.actif{background:color-mix(in srgb, var(--c,#6FD3A2) 22%, #16201D)!important;border-color:var(--c,#6FD3A2)!important}

html[data-theme="dark"] :is(.cr-pl .aff,.ag-ev .ag-aff,.pl-tel-cr .s.aff,.aff-sous){color:#7FB3E8}

html[data-theme="dark"] .tache-feuille{background:#16241E;color:var(--ink)}
html[data-theme="dark"] .tf-p{border-color:#2E4A3E}
