/* Alfamous1 — feuille de style. Thème clair par défaut, sombre selon le système ou le bouton. */
:root {
  --fond: #f7f4ee;
  --surface: #ffffff;
  --texte: #1f2328;
  --discret: #5f6670;
  --bordure: #e3ddd2;
  --accent: #8a4b16;
  --accent-doux: #f3e5d6;
  --surligne: #fbe3a6;
  --lien: #8a4b16;
  --ombre: 0 1px 2px rgba(0, 0, 0, .05), 0 4px 16px rgba(0, 0, 0, .04);
  --arabe: 'Amiri', 'Scheherazade New', 'Traditional Arabic', serif;
  --latin: 'Source Sans 3', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='clair']) {
    --fond: #15171a; --surface: #1d2024; --texte: #e8e6e1; --discret: #a3a8b0; --bordure: #30343a;
    --accent: #e0a46c; --accent-doux: #3a2b1d; --surligne: #6b4f12; --lien: #e8b27d;
    --ombre: none; color-scheme: dark;
  }
}
:root[data-theme='sombre'] {
  --fond: #15171a; --surface: #1d2024; --texte: #e8e6e1; --discret: #a3a8b0; --bordure: #30343a;
  --accent: #e0a46c; --accent-doux: #3a2b1d; --surligne: #6b4f12; --lien: #e8b27d;
  --ombre: none; color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0; background: var(--fond); color: var(--texte);
  font: 17px/1.55 var(--latin);
}
a { color: var(--lien); }
[lang='ar'], .ar { font-family: var(--arabe); direction: rtl; }

/* ---------- En-tête ---------- */
.entete { position: sticky; top: 0; z-index: 10; background: var(--fond); border-bottom: 1px solid var(--bordure); padding: 12px 16px 8px; }
.entete-haut, .recherche, .options, main, .pied { max-width: 920px; margin: 0 auto; }
.entete-haut { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.logo { font: 700 24px/1 var(--latin); color: var(--texte); text-decoration: none; letter-spacing: -.01em; }
.logo-sous { display: block; font-weight: 400; font-size: 13px; color: var(--discret); margin-top: 2px; }
.entete-actions { display: flex; align-items: center; gap: 10px; }
.choix-trad { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--discret); }
select, input, button { font: inherit; color: inherit; }
/* Champs de saisie : 16 px au moins partout, sinon l'iPhone zoome quand on les touche (le zoom reste permis).
   Un champ prend la taille de son parent, mais jamais moins de 16 px ; tests/champs-16px.test.mjs. */
input, select, textarea { font-size: max(16px, 1em); }
select { background: var(--surface); border: 1px solid var(--bordure); border-radius: 8px; padding: 4px 8px; }
.bouton-icone { background: none; border: 1px solid var(--bordure); border-radius: 50%; width: 36px; height: 36px; cursor: pointer; font-size: 18px; }

.recherche { display: flex; gap: 8px; margin-top: 12px; }
.recherche .champ { flex: 1; min-width: 0; position: relative; display: flex; }
.recherche input {
  flex: 1; min-width: 0; font-size: 18px; padding: 10px 44px 10px 14px; border-radius: 10px;
  border: 1px solid var(--bordure); background: var(--surface);
}
.recherche .effacer {
  position: absolute; padding: 0; right: 6px; top: 50%; transform: translateY(-50%);
  width: 30px; height: 30px; border-radius: 50%; border: 0; background: transparent;
  color: var(--discret); font-weight: 400; font-size: 20px; line-height: 1; cursor: pointer;
}
.recherche .effacer:hover { color: var(--accent); }
.options select { max-width: 280px; }
.recherche input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
/* Bouton de recherche : une loupe (nom accessible « Chercher » dans index.html), pour laisser la place au champ. */
.recherche .bouton-chercher {
  flex: none; width: 46px; padding: 0; border: 0; border-radius: 10px; background: var(--accent); color: #fff;
  cursor: pointer; display: grid; place-items: center;
}
.recherche .bouton-chercher svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.recherche .bouton-chercher:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
:root[data-theme='sombre'] .recherche .bouton-chercher { color: #1d2024; }
@media (prefers-color-scheme: dark) { :root:not([data-theme='clair']) .recherche .bouton-chercher { color: #1d2024; } }
.options { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; font-size: 14px; color: var(--discret); margin-top: 8px; }
.exemples a { margin: 0 3px; }

/* ---------- Contenu ---------- */
main { padding: 16px; min-height: 60vh; }
.titre { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; margin: 8px 0 16px; }
.titre h1 { margin: 0; font-size: 22px; }
.titre .ar { font-size: 30px; }
.resume { color: var(--discret); font-size: 15px; }
.message { padding: 24px; text-align: center; color: var(--discret); }
.erreur { color: #b42318; }

.verset {
  background: var(--surface); border: 1px solid var(--bordure); border-radius: 12px;
  padding: 14px 16px; margin-bottom: 12px; box-shadow: var(--ombre);
}
.verset-entete { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--discret); }
.ref { font-weight: 600; color: var(--accent); text-decoration: none; background: var(--accent-doux); padding: 1px 8px; border-radius: 999px; }
.verset .ar { font-size: 28px; line-height: 2.1; margin: 6px 0 4px; text-align: right; }
.mot { cursor: pointer; border-radius: 4px; padding: 0 1px; }
.mot:hover, .mot:focus { background: var(--accent-doux); outline: none; }
.mot.surligne { background: var(--surligne); }
.tr { font-style: italic; color: var(--discret); font-size: 15px; margin: 0; }
.trad { margin: 8px 0 0; padding-top: 8px; border-top: 1px dashed var(--bordure); font-size: 16px; }
.basmala { text-align: center; font-size: 28px; margin: 4px 0 16px; }

.nav { display: flex; justify-content: space-between; gap: 8px; margin: 16px 0; }
.nav a { text-decoration: none; padding: 6px 12px; border: 1px solid var(--bordure); border-radius: 8px; background: var(--surface); }
.plus { display: block; margin: 12px auto; padding: 8px 18px; border-radius: 8px; border: 1px solid var(--bordure); background: var(--surface); cursor: pointer; }

/* ---------- Racine ---------- */
.racine-titre { font-size: 44px; line-height: 1.2; }
.panneaux { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
@media (max-width: 640px) { .panneaux { grid-template-columns: 1fr; } }
.panneau { background: var(--surface); border: 1px solid var(--bordure); border-radius: 12px; padding: 12px 14px; }
.panneau h2 { font-size: 15px; margin: 0 0 8px; color: var(--discret); font-weight: 600; }
.puces { display: flex; flex-wrap: wrap; gap: 6px; direction: rtl; }
.puce {
  font-family: var(--arabe); font-size: 20px; text-decoration: none; color: var(--texte);
  border: 1px solid var(--bordure); border-radius: 999px; padding: 0 10px; background: var(--fond);
}
.puce small { font-family: var(--latin); font-size: 12px; color: var(--discret); margin-inline-start: 4px; }
.puce:hover { border-color: var(--accent); }
.repartition { display: flex; align-items: flex-end; gap: 1px; height: 60px; margin-top: 4px; }
.repartition a { flex: 1; background: var(--accent); opacity: .75; min-height: 1px; border-radius: 1px 1px 0 0; }
.repartition a:hover { opacity: 1; }
.repartition-legende { display: flex; justify-content: space-between; font-size: 12px; color: var(--discret); }

/* ---------- Onglets, tableaux ---------- */
.panneau { margin-bottom: 12px; }
.onglets { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--bordure); margin: 8px 0 12px; }
.onglets button, .lettres button, .tableau th button {
  background: none; border: 0; cursor: pointer; color: var(--discret); font: inherit;
}
.onglets button { padding: 8px 12px; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.onglets button.actif { color: var(--texte); border-bottom-color: var(--accent); font-weight: 600; }
.onglets small { color: var(--discret); font-weight: 400; }
.aide { color: var(--discret); font-size: 14px; margin: 0 0 8px; }
.tableau { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--bordure); border-radius: 12px; overflow: hidden; font-size: 15px; }
.tableau th, .tableau td { padding: 6px 10px; border-bottom: 1px solid var(--bordure); text-align: left; }
.tableau th { background: var(--fond); font-weight: 600; font-size: 13px; color: var(--discret); }
.tableau th button { font-weight: 600; font-size: 13px; padding: 0; }
.tableau th button.actif { color: var(--accent); }
.tableau td .ar { font-size: 22px; text-decoration: none; }
.tableau tr:last-child td { border-bottom: 0; }
.lettres { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 12px; direction: rtl; }
.lettres button { font-family: var(--arabe); font-size: 20px; padding: 0 10px; border: 1px solid var(--bordure); border-radius: 8px; background: var(--surface); color: var(--texte); }
.lettres button.actif { border-color: var(--accent); color: var(--accent); }
.plus-terme { color: var(--discret); font-family: var(--latin); font-size: 18px; margin: 0 4px; }
.lien-racine-titre { color: inherit; text-decoration: none; border-bottom: 1px dotted var(--accent); }
.lien-racine { font-size: 22px; }
.fiche-actions { margin: 8px 0 0; font-size: 14px; }
.intro ul { padding-inline-start: 20px; color: var(--texte); }
.intro li { margin: 4px 0; }
code { background: var(--accent-doux); padding: 0 4px; border-radius: 4px; }

/* ---------- Accueil ---------- */
.intro { font-size: 17px; margin-bottom: 16px; }
.grille-sourates { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.grille-sourates a {
  display: flex; justify-content: space-between; align-items: center; gap: 6px; text-decoration: none; color: var(--texte);
  background: var(--surface); border: 1px solid var(--bordure); border-radius: 10px; padding: 8px 10px; font-size: 14px;
}
.grille-sourates a:hover { border-color: var(--accent); }
.grille-sourates .n { color: var(--accent); font-weight: 600; min-width: 2.2em; }
.grille-sourates .ar { font-size: 18px; }

/* ---------- Fiche d'un mot ---------- */
.fiche-mot {
  position: fixed; z-index: 20; left: 50%; bottom: 16px; transform: translateX(-50%);
  width: min(520px, calc(100% - 24px)); background: var(--surface); color: var(--texte);
  border: 1px solid var(--bordure); border-radius: 14px; padding: 14px 16px 12px; box-shadow: 0 8px 30px rgba(0, 0, 0, .18);
}
.fiche-mot .ar { font-size: 34px; text-align: center; margin: 0; }
.fiche-mot dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 8px 0 0; font-size: 15px; }
.fiche-mot dt { color: var(--discret); }
.fiche-mot dd { margin: 0; }
.fiche-mot .fermer { position: absolute; top: 6px; right: 10px; background: none; border: 0; font-size: 22px; cursor: pointer; color: var(--discret); }

.pied { padding: 24px 16px 40px; font-size: 13px; color: var(--discret); text-align: center; }

.lien-bouton { background: none; border: 0; padding: 0; color: var(--lien); text-decoration: underline; cursor: pointer; font: inherit; }

/* Versets voisins (bas de carte) */
.voisins { display: flex; justify-content: center; gap: 10px; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--bordure); }
.voisin {
  display: inline-flex; align-items: center; gap: 4px; background: none; cursor: pointer;
  border: 1px solid var(--bordure); border-radius: 999px; padding: 2px 12px 2px 8px; font-size: 13px; color: var(--discret);
}
.voisin[data-voisin="1"] { padding: 2px 8px 2px 12px; }
.voisin:hover, .voisin:focus-visible { border-color: var(--accent); color: var(--accent); outline: none; }
.voisin svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.voisin:disabled { opacity: .5; cursor: wait; }
.verset.contexte { border-style: dashed; box-shadow: none; }
@keyframes eclair { from { background: var(--accent-doux); } to { background: var(--surface); } }
.verset.eclair { animation: eclair 1.2s ease-out; }

.trad-source { display: block; font-size: 12px; color: var(--discret); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 2px; }

/* ---------- Comptes (phase 2) ---------- */
.compte { display: flex; align-items: center; gap: 8px; font-size: 14px; flex-wrap: wrap; justify-content: flex-end; }
.compte-nom { font-weight: 600; }
.badge-niveau { font-size: 12px; border: 1px solid var(--accent); color: var(--accent); border-radius: 999px; padding: 0 8px; }
.lien-bouton.alerte { color: #b42318; }
.fenetre {
  border: 1px solid var(--bordure); border-radius: 14px; padding: 18px 20px; width: min(520px, calc(100% - 24px));
  background: var(--surface); color: var(--texte); box-shadow: 0 8px 30px rgba(0, 0, 0, .25);
}
.fenetre::backdrop { background: rgba(0, 0, 0, .35); }
.fenetre h2 { margin: 0 0 10px; font-size: 20px; }
.fenetre .fermer { position: absolute; top: 8px; right: 12px; background: none; border: 0; font-size: 22px; cursor: pointer; color: var(--discret); }
.fenetre label { display: block; font-size: 14px; color: var(--discret); margin: 8px 0; }
.fenetre input, .fenetre textarea {
  display: block; width: 100%; margin-top: 4px; font-size: 16px; padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--bordure); background: var(--fond); color: var(--texte);
}
.fenetre-bas { display: flex; justify-content: flex-end; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin-top: 14px; }
.form-msg { color: #b42318; font-size: 14px; margin: 6px 0 0; min-height: 1em; }
.btn { border: 1px solid var(--bordure); background: var(--surface); color: var(--texte); border-radius: 8px; padding: 5px 14px; cursor: pointer; font-size: 14px; }
.btn.principal { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
:root[data-theme='sombre'] .btn.principal { color: #1d2024; }
@media (prefers-color-scheme: dark) { :root:not([data-theme='clair']) .btn.principal { color: #1d2024; } }
.btn.danger-plein { background: #b42318; border-color: #b42318; color: #fff; font-weight: 600; }
.btn:disabled { opacity: .5; cursor: wait; }
.version { border-left: 3px solid var(--bordure); padding: 4px 10px; margin: 8px 0; white-space: pre-wrap; }
.version.actuelle { border-color: var(--accent); }
.version small { color: var(--discret); display: block; }

/* ---------- Commentaires sous le verset ---------- */
.verset-pied { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--bordure); }
.verset-pied .voisins { margin: 0; padding: 0; border: 0; grid-column: 2; }
.verset-pied .bouton-com { grid-column: 3; justify-self: end; }
@media (max-width: 520px) { .verset-pied { grid-template-columns: 1fr auto; } .verset-pied .voisins { grid-column: 1; justify-content: flex-start; } .verset-pied .bouton-com { grid-column: 2; } }
.bouton-com {
  display: inline-flex; align-items: center; gap: 6px; background: none; cursor: pointer; font-size: 13px; white-space: nowrap;
  border: 1px solid var(--bordure); border-radius: 999px; padding: 2px 12px; color: var(--discret);
}
.bouton-com.a-des { color: var(--accent); border-color: var(--accent); background: var(--accent-doux); font-weight: 600; }
.bouton-com:hover, .bouton-com:focus-visible { border-color: var(--accent); color: var(--accent); outline: none; }
.bouton-com svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }

.commentaires { margin-top: 12px; border-top: 1px solid var(--bordure); padding-top: 10px; }
.com-entete { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.com-entete h3 { margin: 0; font-size: 15px; }
.com-entete .discret { font-size: 13px; color: var(--discret); }
.com-liste { max-height: 460px; overflow-y: auto; padding-right: 4px; overscroll-behavior: contain; }
.com { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--bordure); }
.com:last-child { border-bottom: 0; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent-doux); color: var(--accent); display: grid; place-items: center; font-weight: 700; font-size: 15px; }
.com-meta { font-size: 13px; color: var(--discret); display: flex; flex-wrap: wrap; gap: 2px 8px; align-items: baseline; }
.com-meta .auteur { color: var(--texte); font-weight: 600; font-size: 15px; }
.toi { font-size: 11px; background: var(--accent); color: var(--surface); border-radius: 999px; padding: 0 6px; }
.com-texte { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.com-texte .ar { font-size: 20px; }
.com-texte.placeholder { color: var(--discret); font-style: italic; }
.com.masque { opacity: .65; }
.com-texte.barre { text-decoration: line-through; text-decoration-color: var(--discret); }
.bandeau-masque { font-size: 12px; color: var(--discret); background: var(--fond); border: 1px solid var(--bordure); border-radius: 6px; padding: 1px 8px; display: inline-block; margin-top: 4px; }
.com-actions { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 4px; font-size: 13px; }
.com-actions button { background: none; border: 0; padding: 0; cursor: pointer; color: var(--discret); font: inherit; }
.com-actions button:hover { color: var(--accent); text-decoration: underline; }
.com-actions .danger:hover { color: #b42318; }
.signal { color: #b42318; font-size: 12px; }
.ecrire { margin-top: 10px; background: var(--fond); border: 1px solid var(--bordure); border-radius: 10px; padding: 10px; }
.ecrire textarea { width: 100%; min-height: 84px; resize: vertical; font: inherit; color: inherit; background: var(--surface); border: 1px solid var(--bordure); border-radius: 8px; padding: 8px 10px; }
.ecrire textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.ecrire-bas { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; font-size: 13px; color: var(--discret); }
.ecrire.connexion { text-align: center; font-size: 14px; color: var(--discret); }
.ecrire.connexion .btn { margin: 6px 4px 0; }

/* ---------- Menu Lecture / Mes Notes / Forum (phase 2) ---------- */
.menu { display: flex; gap: 4px; max-width: 920px; margin: 8px auto 0; border-bottom: 1px solid var(--bordure); }
.menu a { padding: 6px 12px; text-decoration: none; color: var(--discret); border-bottom: 2px solid transparent; margin-bottom: -1px; font-size: 15px; }
.menu a.actif { color: var(--texte); border-bottom-color: var(--accent); font-weight: 600; }

/* ---------- Mes Notes et forum ---------- */
.barre-outils { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.filtres { display: flex; flex-wrap: wrap; gap: 4px; }
.filtres button { border: 1px solid var(--bordure); background: var(--surface); color: var(--discret); border-radius: 999px; padding: 2px 12px; cursor: pointer; font-size: 13px; }
.filtres button.actif { border-color: var(--accent); color: var(--accent); background: var(--accent-doux); font-weight: 600; }
a.btn { text-decoration: none; display: inline-block; }
.liste-fils { background: var(--surface); border: 1px solid var(--bordure); border-radius: 12px; overflow: hidden; }
.fil-ligne { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 12px 14px; border-bottom: 1px solid var(--bordure); text-decoration: none; color: inherit; }
.fil-ligne:last-child { border-bottom: 0; }
.fil-ligne:hover { background: var(--fond); }
.fil-ligne.masque .fil-titre { font-style: italic; color: var(--discret); }
.fil-titre { font-weight: 600; font-size: 16px; }
.fil-meta { font-size: 13px; color: var(--discret); display: flex; flex-wrap: wrap; gap: 2px 10px; align-items: center; }
.fil-meta .extrait { overflow-wrap: anywhere; }
.fil-droite { text-align: right; font-size: 13px; color: var(--discret); white-space: nowrap; }
.fil-droite b { display: block; color: var(--texte); font-size: 15px; }
.lien-cible { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; border: 1px solid var(--bordure); border-radius: 999px; padding: 0 8px; background: var(--fond); color: var(--texte); text-decoration: none; }
.lien-cible .ar { font-size: 16px; }
.etat { font-size: 11px; border-radius: 999px; padding: 0 7px; font-weight: 600; }
.etat.prive { background: var(--fond); border: 1px solid var(--bordure); color: var(--discret); }
.etat.publie { background: #e3f1e6; color: #1f6b35; }
:root[data-theme='sombre'] .etat.publie { background: #1f3b27; color: #9fd9ae; }
@media (prefers-color-scheme: dark) { :root:not([data-theme='clair']) .etat.publie { background: #1f3b27; color: #9fd9ae; } }
.vide { padding: 24px; text-align: center; color: var(--discret); margin: 0; }
.retour { display: inline-block; margin-bottom: 10px; font-size: 14px; }
.editeur { background: var(--surface); border: 1px solid var(--bordure); border-radius: 12px; padding: 14px 16px; box-shadow: var(--ombre); }
.editeur label { display: block; font-size: 14px; color: var(--discret); margin: 10px 0 4px; }
.editeur input[type=text], .editeur textarea, .editeur select { display: block; width: 100%; margin-top: 4px; font-size: 16px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--bordure); background: var(--fond); color: var(--texte); }
.editeur textarea { min-height: 180px; resize: vertical; font: inherit; font-size: 16px; }
.editeur input:disabled { opacity: .5; }
.ligne-lien { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 8px; }
.ligne-lien select, .ligne-lien input { margin-top: 0 !important; }
@media (max-width: 560px) { .ligne-lien { grid-template-columns: 1fr; } }
.editeur-bas { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; margin-top: 12px; }
.editeur-bas .gauche, .editeur-bas .droite { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.aide-pub { font-size: 13px; color: var(--discret); margin: 8px 0 0; }
.fil-tete { background: var(--surface); border: 1px solid var(--bordure); border-radius: 12px; padding: 14px 16px; margin-bottom: 12px; box-shadow: var(--ombre); }
.fil-tete h1 { font-size: 22px; margin: 6px 0; }
.verset-cite { background: var(--fond); border: 1px solid var(--bordure); border-radius: 10px; padding: 6px 10px; margin: 8px 0; font-size: 13px; }
.verset-cite .ar { font-size: 24px; text-align: right; margin: 0; }
.message-fil { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--bordure); }
.message-fil:last-of-type { border-bottom: 0; }
.message-fil.masque { opacity: .65; }
.reponses { background: var(--surface); border: 1px solid var(--bordure); border-radius: 12px; padding: 4px 16px 12px; }
.reponses h2 { font-size: 15px; margin: 10px 0 0; }
.reponses h2 .aide { font-weight: 400; font-size: 13px; }
.com-actions a { color: var(--discret); font-size: 13px; }
.forum-verset { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--bordure); font-size: 14px; display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; color: var(--discret); }
.forum-verset:empty { display: none; }

/* ---------- Lexique (phase 3) ---------- */
.filtre-lexique { flex: 1; min-width: 220px; font-size: 16px; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--bordure); background: var(--surface); }
.liste-lex { background: var(--surface); border: 1px solid var(--bordure); border-radius: 12px; overflow: hidden; }
.lex-ligne { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 10px 14px; border-bottom: 1px solid var(--bordure); color: inherit; text-decoration: none; align-items: center; }
.lex-ligne:last-child { border-bottom: 0; }
.lex-ligne:hover { background: var(--fond); }
.lex-cle { font-size: 17px; font-weight: 600; text-align: start; }
.lex-cle .ar { font-size: 24px; font-weight: 400; }
.lex-extrait { font-size: 14px; color: var(--discret); grid-column: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lex-droite { grid-row: 1 / span 2; grid-column: 2; text-align: right; font-size: 13px; color: var(--discret); white-space: nowrap; }
.lex-droite b { color: var(--texte); font-size: 15px; }
.etiquette { font-size: 11px; font-weight: 400; border-radius: 999px; padding: 0 7px; border: 1px solid var(--bordure); color: var(--discret); background: var(--fond); margin-inline-start: 6px; vertical-align: middle; }
.entree-tete, .bloc { background: var(--surface); border: 1px solid var(--bordure); border-radius: 12px; padding: 14px 16px; margin-bottom: 12px; box-shadow: var(--ombre); }
.entree-haut { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.entree-cle { margin: 0; font-size: 32px; line-height: 1.3; }
.entree-cle .ar { font-size: 48px; font-weight: 400; }
.entree-haut .aide { margin: 0; }
.chiffres { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 8px 0 4px; font-size: 15px; }
.chiffres b { font-size: 18px; }
.liens-entree { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 14px; margin-top: 6px; }
.liens-entree:empty { display: none; }
.rappel { font-size: 13px; color: var(--discret); margin: 10px 0 0; padding-top: 8px; border-top: 1px dashed var(--bordure); }
.bloc > .commentaires { margin-top: 0; border-top: 0; padding-top: 0; }
.bloc > h2 { font-size: 16px; margin: 0 0 8px; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.bloc > h2 small { font-weight: 400; color: var(--discret); font-size: 13px; }
.proches-opt { font-size: 14px; color: var(--discret); display: flex; gap: 6px 14px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
.puce.avec-lex { border-color: var(--accent); background: var(--accent-doux); }
.pt { color: var(--accent); }
.legende { font-size: 12px; color: var(--discret); margin: 8px 0 0; }
.encadre-lex { background: var(--accent-doux); border: 1px solid var(--accent); border-radius: 12px; padding: 8px 14px; margin: 0 0 12px; font-size: 15px; }
.lex-fiche { margin: 8px 0 0; padding-top: 8px; border-top: 1px dashed var(--bordure); font-size: 14px; }

/* ---------- Historique sous le champ de recherche (phase 3) ---------- */
.historique { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 20; background: var(--surface); border: 1px solid var(--bordure); border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, .14); padding: 4px 0; font-size: 15px; max-height: 60vh; overflow-y: auto; }
.historique h4 { margin: 6px 12px 2px; font-size: 12px; color: var(--discret); font-weight: 600; display: flex; justify-content: space-between; }
.historique h4 button { background: none; border: 0; color: var(--discret); font: inherit; cursor: pointer; text-decoration: underline; }
.historique a { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 4px 12px; color: var(--texte); text-decoration: none; }
.historique a:hover, .historique a.actif { background: var(--accent-doux); }
.historique a small { color: var(--discret); white-space: nowrap; }
.historique .police-ar { font-family: var(--arabe); font-size: 19px; }
.historique a > span { unicode-bidi: isolate; }

/* ---------- Sélection et copie de versets (phase 3) ---------- */
.verset-infos { display: inline-flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.choisir { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; user-select: none; }
.verset.choisi { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.barre-copie { position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; background: var(--surface); border-top: 2px solid var(--accent); box-shadow: 0 -4px 16px rgba(0, 0, 0, .08); padding: 8px 16px; }
.barre-copie-in { max-width: 920px; margin: 0 auto; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.barre-copie small { color: var(--discret); }
.barre-copie .droite { display: flex; gap: 6px; flex-wrap: wrap; }
body:has(.barre-copie:not([hidden])) .pied { padding-bottom: 90px; }
.options-copie { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.options-copie label { margin: 4px 0; }
.fenetre .options-copie input { display: inline; width: auto; margin: 0 4px 0 0; }
@media (max-width: 520px) { .options-copie { grid-template-columns: 1fr; } }
.apercu-copie { background: var(--fond); border: 1px solid var(--bordure); border-radius: 8px; padding: 10px; white-space: pre-wrap; font: 14px/1.6 var(--latin); max-height: 300px; overflow: auto; margin: 8px 0 0; }

/* ---------- Onglet Membres (admins) ---------- */
.membres { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--bordure); border-radius: 12px; overflow: hidden; font-size: 15px; }
.membres th, .membres td { padding: 8px 10px; border-bottom: 1px solid var(--bordure); text-align: left; vertical-align: middle; }
.membres th { background: var(--fond); font-size: 13px; color: var(--discret); font-weight: 600; }
.membres tr:last-child td { border-bottom: 0; }
.membres .nom { font-weight: 600; }
.membres .courriel { font-size: 13px; color: var(--discret); display: block; overflow-wrap: anywhere; }
.membres .date { font-size: 13px; color: var(--discret); white-space: nowrap; }
.membres .nombre { text-align: right; font-variant-numeric: tabular-nums; }
.membres select { font-size: 16px; }
.membres tr.bloque .nom { text-decoration: line-through; color: var(--discret); }
.pastille { font-size: 11px; border-radius: 999px; padding: 0 7px; font-weight: 600; white-space: nowrap; }
.pastille.ok { background: #e3f1e6; color: #1f6b35; }
.pastille.non { background: #fbe9e7; color: #b42318; }
:root[data-theme='sombre'] .pastille.ok { background: #1f3b27; color: #9fd9ae; }
:root[data-theme='sombre'] .pastille.non { background: #3b1f1f; color: #f0a8a0; }
.journal-niveaux { margin-top: 16px; }
.journal-niveaux p { margin: 4px 0; font-size: 14px; color: var(--discret); }
@media (max-width: 720px) {
  .membres thead { display: none; }
  .membres tr { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 10px; padding: 8px 10px; border-bottom: 1px solid var(--bordure); }
  .membres td { border: 0; padding: 0; text-align: left; }
  .membres td:first-child, .membres td.col-niveau { grid-column: 1 / -1; }
  .membres td[data-l]:not(:first-child):not(.col-niveau)::before { content: attr(data-l) ' : '; color: var(--discret); font-size: 12px; }
}

/* ---------- Articles (docs/ARTICLES.md ; maquette docs/maquettes/articles.html) ---------- */
.filtres a.filtre { border: 1px solid var(--bordure); background: var(--surface); color: var(--discret); border-radius: 999px; padding: 2px 12px; font-size: 13px; text-decoration: none; }
.filtres a.filtre.actif { border-color: var(--accent); color: var(--accent); background: var(--accent-doux); font-weight: 600; }
.art-recherche { flex: 1; min-width: 220px; font-size: 16px; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--bordure); background: var(--surface); }
.libelles-filtre { display: flex; flex-wrap: wrap; gap: 4px; margin: -4px 0 12px; font-size: 13px; color: var(--discret); align-items: center; }
.libelles-filtre a { border: 1px dashed var(--bordure); color: var(--discret); border-radius: 6px; padding: 0 8px; font-size: 12px; text-decoration: none; }
.libelles-filtre a.actif { border-style: solid; border-color: var(--accent); color: var(--accent); background: var(--accent-doux); }
.art-ligne { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 4px 14px; padding: 12px 14px; border-bottom: 1px solid var(--bordure); align-items: start; color: inherit; text-decoration: none; }
.art-ligne:last-child { border-bottom: 0; }
.art-ligne:hover { background: var(--fond); }
.vignette { width: 64px; height: 48px; border-radius: 8px; background: linear-gradient(135deg, var(--accent-doux), var(--fond)); border: 1px solid var(--bordure); display: grid; place-items: center; font-family: var(--arabe); font-size: 20px; color: var(--accent); overflow: hidden; }
.vignette img { width: 100%; height: 100%; object-fit: cover; }
.art-centre { display: flex; flex-direction: column; min-width: 0; }
.art-titre { font-weight: 600; font-size: 16px; }
.art-resume { font-size: 14px; color: var(--discret); margin: 2px 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.art-meta { font-size: 12px; color: var(--discret); display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.art-droite { text-align: right; font-size: 13px; color: var(--discret); white-space: nowrap; }
.famille { font-size: 11px; font-weight: 600; border-radius: 999px; padding: 0 8px; }
.f-racines { background: #f3e5d6; color: #8a4b16; }
.f-critiques { background: #e6e3f3; color: #4a3d8f; }
.f-identite { background: #dff0ea; color: #1f6b4f; }
.f-reflexions { background: #e9edf2; color: #3c4a5c; }
:root[data-theme='sombre'] .famille { filter: brightness(.8) saturate(1.3); }
@media (prefers-color-scheme: dark) { :root:not([data-theme='clair']) .famille { filter: brightness(.8) saturate(1.3); } }
.libelle { font-size: 11px; border: 1px solid var(--bordure); border-radius: 6px; padding: 0 6px; color: var(--discret); text-decoration: none; }
.etat.brouillon { background: #fff4d6; color: #8a6100; border: 1px solid #f0d58a; }
.etat.retire { background: var(--fond); color: var(--discret); border: 1px dashed var(--bordure); }
.travail { padding: 8px 12px; }
.travail summary { cursor: pointer; font-weight: 600; margin-bottom: 8px; }
.travail summary small { font-weight: 400; color: var(--discret); }

.art-page { background: var(--surface); border: 1px solid var(--bordure); border-radius: 12px; padding: 18px 22px; box-shadow: var(--ombre); margin-bottom: 12px; }
.art-page h1 { font-size: 28px; line-height: 1.25; margin: 8px 0; }
.art-page .chapeau { font-size: 17px; color: var(--discret); margin: 0 0 12px; }
.actions-art { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.couverture { max-width: 100%; border-radius: 10px; margin: 8px 0; }
.corps-art { font-size: 17px; line-height: 1.7; overflow-wrap: anywhere; }
.corps-art h2 { font-size: 22px; margin: 22px 0 8px; }
.corps-art h3 { font-size: 19px; margin: 18px 0 6px; }
.corps-art img { max-width: 100%; height: auto; }
.corps-art iframe { width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 8px; }
.corps-art table { border-collapse: collapse; margin: 12px 0; width: 100%; display: block; overflow-x: auto; }
.corps-art th, .corps-art td { border: 1px solid var(--bordure); padding: 4px 8px; text-align: start; vertical-align: top; }
.corps-art blockquote { border-inline-start: 3px solid var(--bordure); margin: 12px 0; padding: 2px 14px; color: var(--discret); }
.corps-art [lang='ar'], .corps-art [dir='rtl'] { font-family: var(--arabe); font-size: 1.25em; }
.corps-art .encadre { background: var(--fond); border: 1px solid var(--bordure); border-radius: 10px; padding: 4px 14px; margin: 12px 0; }
.corps-art .verset-bloc { border-inline-start: 3px solid var(--accent); background: var(--fond); border-radius: 8px; padding: 8px 14px; margin: 12px 0; }
.corps-art .verset-bloc .ar { font-size: 26px; text-align: right; line-height: 2; margin: 0; }
.corps-art .verset-bloc .tr { margin: 0; font-style: italic; color: var(--discret); font-size: 15px; }
.corps-art .verset-bloc .refv { font-size: 13px; color: var(--accent); font-weight: 600; text-decoration: none; }
.pied-art { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 14px; color: var(--discret); margin-top: 14px; padding-top: 10px; border-top: 1px dashed var(--bordure); align-items: center; }
.sources-art { display: block; }
.sources-art b { color: var(--texte); }
.sources-art li { margin: 4px 0; font-size: 15px; }

/* Éditeur */
main:has(.atelier) { max-width: 1180px; }
.atelier { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 14px; align-items: start; }
@media (max-width: 900px) { .atelier { grid-template-columns: 1fr; } }
.ed-champs { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.ed-champs .plein { grid-column: 1 / -1; }
.ed-champs small { font-size: 12px; }
@media (max-width: 560px) { .ed-champs { grid-template-columns: 1fr; } }
.ligne-image { display: flex; gap: 6px; align-items: center; }
.ligne-image input { flex: 1; margin-top: 4px; }
.barre-ed { display: flex; flex-wrap: wrap; gap: 2px; border: 1px solid var(--bordure); border-bottom: 0; border-radius: 8px 8px 0 0; padding: 4px; background: var(--fond); margin-top: 12px; align-items: center; }
.barre-ed button { border: 1px solid transparent; background: none; border-radius: 6px; padding: 2px 8px; cursor: pointer; font-size: 14px; color: var(--texte); }
.barre-ed button:hover:not(:disabled) { border-color: var(--bordure); background: var(--surface); }
.barre-ed button:disabled { opacity: .4; cursor: default; }
.barre-ed .sep { width: 1px; height: 20px; background: var(--bordure); margin: 0 4px; }
.barre-ed .modes { margin-left: auto; display: flex; gap: 2px; }
.barre-ed .modes button.actif { background: var(--accent); color: #fff; }
.zone-ed { border: 1px solid var(--bordure); border-radius: 0 0 8px 8px; background: var(--surface); padding: 12px 16px; min-height: 380px; max-height: 70vh; overflow: auto; }
.zone-ed:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.editeur textarea.zone-html { display: block; width: 100%; margin: 0; font: 16px/1.5 ui-monospace, Consolas, monospace; resize: vertical; min-height: 380px; }
.ed-etat { font-size: 13px; color: var(--discret); margin-top: 6px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px; }
.actions-ed { position: sticky; bottom: 0; z-index: 15; margin: 14px -16px -14px; padding: 10px 16px; background: var(--surface); border-top: 2px solid var(--accent); border-radius: 0 0 12px 12px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.actions-ed .gauche, .actions-ed .droite { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.bandeau-local { background: var(--accent-doux); border: 1px solid var(--accent); border-radius: 10px; padding: 8px 12px; margin-bottom: 12px; font-size: 14px; }

/* Panneau Contexte */
.contexte { position: sticky; top: 12px; background: var(--surface); border: 1px solid var(--bordure); border-radius: 12px; max-height: calc(100vh - 24px); overflow: auto; }
.contexte > h2 { font-size: 16px; margin: 0; padding: 10px 14px; border-bottom: 1px solid var(--bordure); display: flex; justify-content: space-between; align-items: baseline; }
.contexte > h2 small { font-weight: 400; color: var(--discret); font-size: 12px; }
.ctx { border-bottom: 1px solid var(--bordure); }
.ctx summary { padding: 8px 14px; cursor: pointer; font-weight: 600; font-size: 14px; display: flex; gap: 6px; }
.ctx summary .n { font-weight: 400; color: var(--discret); font-size: 13px; margin-left: auto; }
.ctx-corps { padding: 0 14px 10px; font-size: 14px; }
.ctx-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 8px; padding: 6px 0; border-top: 1px dashed var(--bordure); align-items: start; }
.ctx-item:first-child { border-top: 0; }
.ctx-item .petit, .ctx-suite { font-size: 12px; color: var(--discret); }
.ctx-suite { padding: 8px 14px; margin: 0; }
.ctx-item .actions { display: flex; flex-direction: column; gap: 2px; align-items: flex-end; }
.ctx-item .actions button { background: none; border: 0; padding: 0; color: var(--lien); cursor: pointer; font-size: 12px; text-decoration: underline; }
.cite { font-size: 12px; display: inline-flex; gap: 4px; align-items: center; color: var(--discret); margin: 0 !important; }
.note-ctx { width: 100%; font-size: 16px; padding: 2px 6px; border-radius: 6px; border: 1px solid var(--bordure); background: var(--fond); color: var(--texte); margin-top: 2px; }
.ctx-ajout { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.ctx-ajout input { flex: 1; min-width: 0; font-size: 16px; padding: 4px 8px; border-radius: 6px; border: 1px solid var(--bordure); background: var(--fond); color: var(--texte); }
.ctx-source input { flex-basis: 100%; }

/* Fenêtres larges (aperçu, historique) */
.fenetre.large { max-width: min(960px, 96vw); width: 96vw; }
.versions { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 12px; }
@media (max-width: 640px) { .versions { grid-template-columns: 1fr; } }
.v-liste button { display: block; width: 100%; text-align: left; border: 1px solid var(--bordure); background: var(--fond); border-radius: 8px; padding: 6px 8px; margin-bottom: 6px; cursor: pointer; font-size: 13px; color: var(--texte); }
.v-liste button.actif { border-color: var(--accent); background: var(--accent-doux); }
.apercu-version { max-height: 60vh; overflow: auto; border: 1px solid var(--bordure); border-radius: 8px; padding: 8px 12px; }
.fenetre .choix { display: flex; gap: 8px; align-items: center; color: var(--texte); }
.fenetre .choix input[type=radio], .fenetre .choix input[type=checkbox] { display: inline-block; width: auto; margin: 0; }
.editeur .cite input, .contexte input[type=checkbox] { width: auto; display: inline-block; margin: 0; }
/* Articles sous les versets, choix d'un article */
.ligne-articles { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--bordure); font-size: 14px; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; color: var(--discret); }
.ligne-articles a { font-weight: 600; }
.liste-choix { max-height: 50vh; overflow: auto; border: 1px solid var(--bordure); border-radius: 8px; padding: 4px 10px; }
.liste-choix .choix { padding: 4px 0; border-bottom: 1px dashed var(--bordure); margin: 0; }
.liste-choix .choix:last-child { border-bottom: 0; }
/* Panneau Contexte complet, Dossier pour Claude */
.verif { font-size: 11px; border-radius: 4px; padding: 0 5px; font-weight: 600; }
.verif.fait { background: #e3f1e6; color: #1f6b35; }
.verif.deduction { background: #e6e3f3; color: #4a3d8f; }
.verif.hypothese { background: #fff4d6; color: #8a6100; }
.ctx-ajout select { font-size: 16px; padding: 2px 4px; border-radius: 6px; border: 1px solid var(--bordure); background: var(--fond); color: var(--texte); }
.contexte summary .etat { font-weight: 400; }
.fenetre textarea.dossier { min-height: 55vh; font: 16px/1.5 ui-monospace, Consolas, monospace; white-space: pre; }
.fenetre [data-filtre-choix] { margin-bottom: 8px; }
.articles-lies h2 { font-size: 16px; margin: 0 0 8px; }
