/* theme.css - identité visuelle de RoastPotatoes (15/11/2026), d'après la feuille de route « interface moderne » :
   terracotta + crème + anthracite, coins arrondis, ombres légères, police du système, icônes Lucide (icones.js).
   S'applique seulement aux pages dont le <body> porte data-theme="rp" (essai sur RQuiz avant les autres éditeurs).
   Écarts voulus avec les valeurs proposées, pour rester lisible (règles WCAG AA) :
     gris secondaire #72777D -> #62666B (4,5:1 minimum sur le fond crème) ;
     bordure des champs #E5E1DA -> #8E8A83 (un champ doit se voir : 3:1 minimum ; #E5E1DA reste pour les séparations) ;
     boutons pleins : #A95732 au lieu de #C76D42 (texte blanc lisible) ; #C76D42 reste la couleur des barres et repères. */
body.theme-rp {
  --rp-primary:#C76D42; --rp-primary-hover:#A95732; --rp-primary-soft:#FBEEE7;
  /* boutons pleins (texte blanc) : #C76D42 n'offre que 3,7:1 avec le blanc -> #A95732 (5,1:1), survol #8E4526 */
  --rp-bouton:#A95732; --rp-bouton-hover:#8E4526;
  --rp-background:#F7F5F0; --rp-surface:#FFFFFF; --rp-surface-2:#F1EDE6;
  --rp-text:#292B2E; --rp-muted:#62666B; --rp-border:#E5E1DA; --rp-border-ctl:#D3CDC3; --rp-field:#8E8A83;
  --rp-radius:10px; --rp-radius-s:8px; --rp-spacing:8px;
  --rp-font:"Segoe UI Variable Text","Segoe UI",system-ui,-apple-system,"Helvetica Neue",Arial,sans-serif;
  --rp-ombre:0 1px 2px rgba(41,43,46,.06), 0 2px 8px rgba(41,43,46,.06);
  /* les variables déjà utilisées par l'application prennent les nouvelles valeurs */
  --fond:var(--rp-background); --haut:var(--rp-surface); --bord:var(--rp-border); --accent:var(--rp-primary-hover);
  --nav:#292B2E; --nav-texte:#ECEAE6; --nav-doux:#A3A6AA; --nav-survol:#35383C;
  --entete:var(--rp-surface); --travail:var(--rp-background); --ligne:var(--rp-border); --c:var(--rp-primary); --focus:#A95732;
  font-family:var(--rp-font); color:var(--rp-text); background:var(--rp-background);
}

/* ---------------------------------------------------------------- boutons : les mêmes partout */
body.theme-rp :where(button) { font:inherit; display:inline-flex; align-items:center; justify-content:center; gap:6px; padding:6px 12px;
  background:var(--rp-surface); color:var(--rp-text); border:1px solid var(--rp-border-ctl); border-radius:var(--rp-radius-s); box-shadow:none; line-height:1.25; }
body.theme-rp :where(button):hover { background:#F3EFE8; }
body.theme-rp :where(button):active { background:#EAE4DA; }
body.theme-rp :where(button):disabled { opacity:.5; }
body.theme-rp button .ico { flex:none; }
body.theme-rp button.principal, body.theme-rp #entete .barre button.principal { background:var(--rp-bouton); border-color:var(--rp-bouton); color:#fff; font-weight:600; }
body.theme-rp button.principal:hover, body.theme-rp #entete .barre button.principal:hover { background:var(--rp-bouton-hover); border-color:var(--rp-bouton-hover); filter:none; }
body.theme-rp button.icone-seule { padding:6px 8px; }
/* champs (:where = priorité faible, pour ne pas écraser les cases noires de la grille de RCross, etc.) */
body.theme-rp :where(input[type=text], input[type=number], input[type=password], textarea, select) {
  font:inherit; color:var(--rp-text); background:var(--rp-surface); border:1px solid var(--rp-field); border-radius:var(--rp-radius-s); padding:6px 8px; }
body.theme-rp :where(input[type=checkbox]) { accent-color:var(--rp-primary); width:16px; height:16px; }
body.theme-rp :focus-visible { outline:2px solid var(--focus); outline-offset:2px; }

/* ---------------------------------------------------------------- coque */
body.theme-rp #nav .marque { font-weight:700; letter-spacing:0; }
body.theme-rp #nav button { border-radius:0; border:0; border-left:4px solid transparent; background:none; color:inherit; justify-content:flex-start; padding:8px 14px; }
body.theme-rp #nav button:hover { background:var(--nav-survol); }
body.theme-rp #nav button[aria-current="page"] { background:#3A3D42; border-left-color:var(--rp-primary); }
body.theme-rp #nav button .ic { color:#D5D2CC; }
body.theme-rp #nav button .ic .ico { width:18px; height:18px; }
body.theme-rp #nav .bas { border-top-color:#3A3D42; }
body.theme-rp #entete { border-top:3px solid var(--rp-primary); gap:16px; padding:10px 16px; }
body.theme-rp #entete .qui b { font-size:18px; font-weight:650; display:flex; align-items:center; gap:8px; }
body.theme-rp #entete .qui b::before { content:""; width:12px; height:12px; border-radius:50%; background:var(--type, var(--rp-primary)); }
body.theme-rp #entete .qui span { color:var(--rp-muted); }
body.theme-rp #entete .barre { gap:8px; }
body.theme-rp #entete .barre .sep { width:1px; align-self:stretch; background:var(--rp-border); margin:2px 2px; }
body.theme-rp #entete .barre button { border-color:var(--rp-border-ctl); background:var(--rp-surface); border-radius:var(--rp-radius-s); }
body.theme-rp #entete .barre button:hover { background:#F3EFE8; }
body.theme-rp #espace .titre { padding:10px 16px 12px; gap:10px; }
body.theme-rp #espace .titre input { border-radius:var(--rp-radius-s); border-color:var(--rp-field); font-size:16px; }
body.theme-rp #statut { color:var(--rp-muted); background:var(--rp-surface); }
body.theme-rp #b-nav, body.theme-rp #b-props { border-radius:var(--rp-radius-s); }

/* liste à gauche + ses boutons */
body.theme-rp .col-liste { background:var(--rp-surface); border-right-color:var(--rp-border); }
body.theme-rp .col-liste > .liste { background:var(--rp-surface); }
body.theme-rp .liste .q { border-bottom-color:var(--rp-border) !important; padding:9px 12px !important; }
body.theme-rp .liste .q:hover { background:#FAF8F4; }
body.theme-rp .liste .q.sel { background:var(--rp-primary-soft) !important; box-shadow:inset 3px 0 0 var(--rp-primary); }
body.theme-rp .liste .q b { color:var(--rp-primary-hover) !important; }
body.theme-rp .liste .q small { color:var(--rp-muted) !important; }
body.theme-rp .col-liste > .outils { background:var(--rp-surface); border-top-color:var(--rp-border); gap:6px; }
body.theme-rp .col-liste > .outils button { border-radius:var(--rp-radius-s); border-color:var(--rp-border-ctl); }

/* zone de travail : le contenu posé sur une « carte » blanche */
body.theme-rp .detail { padding:16px 20px !important; }
body.theme-rp .detail h3 { color:var(--rp-text) !important; font-size:14px !important; font-weight:650; margin:18px 0 6px !important; }
body.theme-rp .detail h3:first-of-type { margin-top:4px !important; }
body.theme-rp .aide { color:var(--rp-muted) !important; }
body.theme-rp table.paires { background:var(--rp-surface); border:1px solid var(--rp-border); border-radius:var(--rp-radius); border-collapse:separate; border-spacing:0; overflow:hidden; box-shadow:var(--rp-ombre); }
body.theme-rp .paires th { background:var(--rp-surface-2); color:var(--rp-text); border-bottom:1px solid var(--rp-border); font-weight:600; padding:8px; }
body.theme-rp .paires td { border-bottom:1px solid var(--rp-border); padding:5px 6px; }
body.theme-rp .paires tr:last-child td { border-bottom:0; }
body.theme-rp .paires td.n { color:var(--rp-muted); }

/* en-têtes de tableaux propres à un éditeur (RCloze, RCross) */
body.theme-rp .trous th, body.theme-rp .defs .titre-sens { background:var(--rp-surface-2); color:var(--rp-text); }
body.theme-rp .defs { border-color:var(--rp-border); border-radius:var(--rp-radius-s); overflow:hidden; }

/* panneau de propriétés */
body.theme-rp #props { background:var(--rp-surface); border-left-color:var(--rp-border); padding:16px; }
body.theme-rp #props h2 { color:var(--rp-muted); font-weight:650; }
body.theme-rp #props ul.verif li { border-radius:var(--rp-radius-s); }

/* fenêtre « Configurer » et aperçu */
body.theme-rp #dlg { background:var(--rp-background); border:0; border-radius:12px; overflow:hidden; box-shadow:0 12px 40px rgba(0,0,0,.28); }
body.theme-rp #dlg-titre, body.theme-rp #dlg-menu { background:var(--rp-surface); border-bottom-color:var(--rp-border); }
body.theme-rp #dlg-titre button { border:0; }
body.theme-rp .onglets { gap:4px; padding:10px 12px 0; }
body.theme-rp .onglets button { border:1px solid transparent; border-bottom:0; border-radius:var(--rp-radius-s) var(--rp-radius-s) 0 0; background:transparent; margin:0; padding:6px 12px; color:var(--rp-muted); }
body.theme-rp .onglets button.on { background:var(--rp-surface); border-color:var(--rp-border); color:var(--rp-text); box-shadow:inset 0 3px 0 var(--rp-primary); top:1px; }
body.theme-rp #pages { background:var(--rp-surface); border-color:var(--rp-border); border-radius:0 0 var(--rp-radius) var(--rp-radius); margin:0 12px; }
body.theme-rp fieldset.grp { border-color:var(--rp-border); border-radius:var(--rp-radius-s); }
body.theme-rp .pied-dlg button { border-radius:var(--rp-radius-s); }
body.theme-rp #c-ok { background:var(--rp-bouton); border-color:var(--rp-bouton); color:#fff; }
body.theme-rp #c-ok:hover { background:var(--rp-bouton-hover); }
body.theme-rp #apercu-boite { border-radius:12px; }
body.theme-rp #apercu-tete { background:var(--rp-surface); border-bottom-color:var(--rp-border); }
body.theme-rp #apercu-creer { background:var(--rp-bouton); border-color:var(--rp-bouton); color:#fff; font-weight:600; }

/* barre de menus (version Windows légère et version en ligne) */
body.theme-rp #rp-menu { background:var(--rp-surface); border-bottom:1px solid var(--rp-border); font-family:var(--rp-font); }
body.theme-rp #rp-menu .rp-mb { border:0; border-radius:6px; margin:2px 0; padding:4px 10px; background:none; }
body.theme-rp #rp-menu .rp-m:hover > .rp-mb, body.theme-rp #rp-menu .rp-m.ouvert > .rp-mb { background:#F3EFE8; }
body.theme-rp #rp-menu .rp-panel { background:var(--rp-surface); border:1px solid var(--rp-border); border-radius:var(--rp-radius-s); box-shadow:0 8px 24px rgba(0,0,0,.14); padding:4px; }
body.theme-rp #rp-menu .rp-i { border-radius:6px; }
body.theme-rp #rp-menu .rp-i:hover, body.theme-rp #rp-menu .rp-i:focus { background:var(--rp-primary-soft); }
body.theme-rp #rp-menu hr { border-top-color:var(--rp-border); }

/* choix du format (RMatch, RCloze) : libellé et liste ensemble */
body.theme-rp .bloc-format { display:inline-flex; align-items:center; gap:6px; white-space:nowrap; }
body.theme-rp .bloc-format select { min-width:0; max-width:300px; }

/* icône du module à côté de son nom (logo C, 15/11/2026) */
body.theme-rp #entete .qui b::before { width:32px; height:32px; background:var(--type-icone) center/contain no-repeat; }
body.theme-rp #nav .marque img { background:none; width:30px; height:30px; }

/* ================================================================ THÈME SOMBRE (15/11/2026)
   Activé par mode.js (<html data-mode="sombre">). Même identité : terracotta sur anthracite.
   Contrastes vérifiés (texte 12,6:1, gris 6,5:1, accent 6,7:1, bord des champs 3,4:1, blanc sur bouton 5,1:1). */
html[data-mode="sombre"] { color-scheme:dark; }
html[data-mode="sombre"] body.theme-rp {
  --rp-primary:#D9805A; --rp-primary-hover:#E59A76; --rp-primary-soft:#3B2A21;
  --rp-bouton:#A95732; --rp-bouton-hover:#BD6640;
  --rp-background:#1B1C1E; --rp-surface:#242629; --rp-surface-2:#2D3034;
  --rp-text:#ECEAE6; --rp-muted:#A7AAAF; --rp-border:#3A3D42; --rp-border-ctl:#4A4E54; --rp-field:#73777D;
  --rp-ombre:0 1px 2px rgba(0,0,0,.4), 0 2px 8px rgba(0,0,0,.3);
  --nav:#141517; --nav-texte:#ECEAE6; --nav-doux:#A7AAAF; --nav-survol:#222427;
  --focus:#E59A76;
}
/* survols et sélections écrits en clair dans les règles du thème clair */
html[data-mode="sombre"] body.theme-rp :where(button):hover, html[data-mode="sombre"] body.theme-rp #entete .barre button:hover { background:#2F3236; }
html[data-mode="sombre"] body.theme-rp :where(button):active { background:#383B40; }
html[data-mode="sombre"] body.theme-rp #nav button[aria-current="page"] { background:#2A2D31; }
html[data-mode="sombre"] body.theme-rp .liste .q:hover { background:#2A2C30; }
html[data-mode="sombre"] body.theme-rp .paires tr.sel td { background:var(--rp-primary-soft); }
html[data-mode="sombre"] body.theme-rp #rp-menu .rp-m:hover > .rp-mb, html[data-mode="sombre"] body.theme-rp #rp-menu .rp-m.ouvert > .rp-mb { background:#2F3236; }
/* vérification du panneau Propriétés, pastille du bouton Propriétés */
html[data-mode="sombre"] body.theme-rp #props ul.verif li.ok { background:#1F3321; color:#9BD39B; }
html[data-mode="sombre"] body.theme-rp #props ul.verif li.pb, html[data-mode="sombre"] body.theme-rp #b-props .pastille { background:#3A2A12; color:#F2C27B; }
/* fenêtres « Configurer », « Insérer… » et aperçu */
html[data-mode="sombre"] body.theme-rp .champ > label:not(.chk), html[data-mode="sombre"] body.theme-rp .chk, html[data-mode="sombre"] body.theme-rp .cap { color:var(--rp-text); }
html[data-mode="sombre"] body.theme-rp .cap input:disabled { background:#2A2C30; color:#7C8086; }
html[data-mode="sombre"] body.theme-rp #dlg2 { background:var(--rp-background); border-color:var(--rp-border); }
html[data-mode="sombre"] body.theme-rp #dlg2 h2 { background:var(--rp-surface); border-color:var(--rp-border); color:var(--rp-text); }
html[data-mode="sombre"] body.theme-rp #apercu-boite { background:var(--rp-surface); }
html[data-mode="sombre"] body.theme-rp #apercu-note { color:var(--rp-muted); }
/* ce qui est propre à certains éditeurs */
html[data-mode="sombre"] body.theme-rp .defs .rang small, html[data-mode="sombre"] body.theme-rp .vide, html[data-mode="sombre"] body.theme-rp .rang .n { color:var(--rp-muted); }
html[data-mode="sombre"] body.theme-rp .defs .rang { border-bottom-color:var(--rp-border); }
html[data-mode="sombre"] body.theme-rp .col-liste > .outils button, html[data-mode="sombre"] body.theme-rp #espace > .outils button { background:var(--rp-surface); color:var(--rp-text); border-color:var(--rp-border-ctl); }
html[data-mode="sombre"] body.theme-rp .etat, html[data-mode="sombre"] body.theme-rp #c-langue-l { color:var(--rp-muted); }
html[data-mode="sombre"] body.theme-rp #apercu span { background:var(--rp-surface-2); color:var(--rp-text); }   /* RMix : parties de la phrase */
html[data-mode="sombre"] body.theme-rp .vue { background:#2A2C30; }                                            /* RMap : autour de l'image */
html[data-mode="sombre"] body.theme-rp .coord { color:var(--rp-muted); }
html[data-mode="sombre"] body.theme-rp .formatbar, html[data-mode="sombre"] body.theme-rp #fmt-aide, html[data-mode="sombre"] body.theme-rp .trous td.n { color:var(--rp-muted) !important; }
html[data-mode="sombre"] body.theme-rp #dims { color:var(--rp-muted) !important; }   /* RMap : couleur écrite dans la page */
