/* Bayān 10.10 — thème consolidé unique. Base historique + normalisation finale. */
/* Bayān 9.1 — système de thèmes global */
:root{
  --bayaan-bg:#f6f3ec;--bayaan-surface:#fffdf8;--bayaan-surface-2:#f2eee5;--bayaan-field:#fff;
  --bayaan-text:#102a25;--bayaan-muted:#64736e;--bayaan-border:#dcd9cf;--bayaan-accent:#1f685a;
  --bayaan-accent-2:#0f493f;--bayaan-gold:#c38d3f;--bayaan-shadow:0 18px 50px rgba(25,48,42,.12);
  --bayaan-hero-a:#102a25;--bayaan-hero-b:#174d42;--bayaan-hero-text:#fff;--bayaan-hero-muted:#d5e3de;
}
html[data-bayaan-theme="dark"]{
  --bayaan-bg:#0b1110;--bayaan-surface:#121a18;--bayaan-surface-2:#17211e;--bayaan-field:#0f1715;
  --bayaan-text:#edf5f1;--bayaan-muted:#9aaba5;--bayaan-border:#2a3934;--bayaan-accent:#63a993;
  --bayaan-accent-2:#86c4b1;--bayaan-gold:#d4ab68;--bayaan-shadow:0 22px 60px rgba(0,0,0,.34);
  --bayaan-hero-a:#0b1815;--bayaan-hero-b:#15342c;--bayaan-hero-text:#f2f8f5;--bayaan-hero-muted:#b5c7c0;
}
html[data-bayaan-theme="pastel"]{
  --bayaan-bg:#f3edef;--bayaan-surface:#fffafa;--bayaan-surface-2:#eee7e9;--bayaan-field:#fffdfd;
  --bayaan-text:#4d4048;--bayaan-muted:#7c6d75;--bayaan-border:#dfd2d7;--bayaan-accent:#738f85;
  --bayaan-accent-2:#5e776f;--bayaan-gold:#b4936d;--bayaan-shadow:0 20px 55px rgba(96,75,86,.10);
  --bayaan-hero-a:#d9e4df;--bayaan-hero-b:#eadde2;--bayaan-hero-text:#493b43;--bayaan-hero-muted:#6f6269;
}
html[data-bayaan-theme="luxury"]{
  --bayaan-bg:#100d0b;--bayaan-surface:#191512;--bayaan-surface-2:#211a16;--bayaan-field:#15110f;
  --bayaan-text:#f5ecdc;--bayaan-muted:#c1b39f;--bayaan-border:#3a3028;--bayaan-accent:#8f3147;
  --bayaan-accent-2:#b24761;--bayaan-gold:#d8b16a;--bayaan-shadow:0 25px 75px rgba(0,0,0,.42);
  --bayaan-hero-a:#17110f;--bayaan-hero-b:#3b1720;--bayaan-hero-text:#fff7e8;--bayaan-hero-muted:#d5c3ac;
}

/* Map the shared palette onto the various historical CSS variable sets. */
html[data-bayaan-theme]:not([data-bayaan-theme="current"]){
  --ink:var(--bayaan-text)!important;--muted:var(--bayaan-muted)!important;--line:var(--bayaan-border)!important;
  --paper:var(--bayaan-surface)!important;--card:var(--bayaan-surface)!important;--panel:var(--bayaan-surface)!important;
  --cream:var(--bayaan-bg)!important;--shadow:var(--bayaan-shadow)!important;
  --green:var(--bayaan-accent)!important;--green2:var(--bayaan-accent-2)!important;
  --forest:var(--bayaan-accent-2)!important;--forest-2:var(--bayaan-accent)!important;--forest-soft:var(--bayaan-accent)!important;
  --accent:var(--bayaan-accent)!important;--accent-dark:var(--bayaan-accent-2)!important;
  --blue:var(--bayaan-accent)!important;--blue2:var(--bayaan-accent-2)!important;
  --gold:var(--bayaan-gold)!important;--gold-soft:color-mix(in srgb,var(--bayaan-gold) 72%,white)!important;
}
html[data-bayaan-theme]:not([data-bayaan-theme="current"]) body{
  background:radial-gradient(circle at 82% -10%,color-mix(in srgb,var(--bayaan-accent) 18%,transparent),transparent 35%),var(--bayaan-bg)!important;
  color:var(--bayaan-text)!important;
  transition:background .22s ease,color .22s ease;
}
html[data-bayaan-theme]:not([data-bayaan-theme="current"]) body::before{opacity:.28!important}
html[data-bayaan-theme]:not([data-bayaan-theme="current"]) .topbar{
  background:color-mix(in srgb,var(--bayaan-surface) 91%,transparent)!important;
  color:var(--bayaan-text)!important;border-color:var(--bayaan-border)!important;box-shadow:0 10px 35px color-mix(in srgb,var(--bayaan-bg) 55%,transparent)!important;
}
html[data-bayaan-theme]:not([data-bayaan-theme="current"]) .brand,
html[data-bayaan-theme]:not([data-bayaan-theme="current"]) .brand strong{color:var(--bayaan-text)!important}
html[data-bayaan-theme]:not([data-bayaan-theme="current"]) .brand small{color:var(--bayaan-muted)!important}
html[data-bayaan-theme]:not([data-bayaan-theme="current"]) .brand-mark,
html[data-bayaan-theme]:not([data-bayaan-theme="current"]) .mark{background:var(--bayaan-accent-2)!important;color:var(--bayaan-gold)!important;border-color:color-mix(in srgb,var(--bayaan-gold) 55%,transparent)!important}

html[data-bayaan-theme]:not([data-bayaan-theme="current"]) :is(.panel,.search-panel,.result-card,.summary-card,.hero-card,.verse-card,.metric,.research-sources-panel,.term-profile,.word-profile,.occurrence-navigator,.v7-compare-panel,.v7-study-corpus,.v7-note-editor,.v7-note-editor-shell,.v7-notes-sidebar,.v7-work-card,.v7-work-hero,.v7-note-list-item,.v7-study-item,.lab-card,.research-lab-card,.similarity-card,.query-builder-card){
  background:var(--bayaan-surface)!important;color:var(--bayaan-text)!important;border-color:var(--bayaan-border)!important;box-shadow:var(--bayaan-shadow)!important;
}
html[data-bayaan-theme]:not([data-bayaan-theme="current"]) :is(input,select,textarea,[contenteditable="true"]){
  background:var(--bayaan-field)!important;color:var(--bayaan-text)!important;border-color:var(--bayaan-border)!important;caret-color:var(--bayaan-accent)!important;
}
html[data-bayaan-theme]:not([data-bayaan-theme="current"]) :is(input,textarea)::placeholder{color:color-mix(in srgb,var(--bayaan-muted) 78%,transparent)!important}
html[data-bayaan-theme]:not([data-bayaan-theme="current"]) :is(.ghost-btn,.ghost-button,.secondary-button,.result-action,.nav-button,.nav-btn,.nav-tab,.icon-button,.v7-workspace-tabs button,.v7-note-head-actions button,.v7-rich-toolbar button){
  color:var(--bayaan-text)!important;border-color:var(--bayaan-border)!important;
}
html[data-bayaan-theme]:not([data-bayaan-theme="current"]) :is(.ghost-btn,.ghost-button,.secondary-button,.result-action,.icon-button,.v7-workspace-tabs button,.v7-note-head-actions button,.v7-rich-toolbar button){background:var(--bayaan-surface-2)!important}
html[data-bayaan-theme]:not([data-bayaan-theme="current"]) :is(.primary-btn,.primary-button,.nav-button.active,.nav-btn.active,.nav-tab.active){background:var(--bayaan-accent)!important;color:#fff!important;border-color:transparent!important}
html[data-bayaan-theme="luxury"] :is(.primary-btn,.primary-button,.nav-button.active,.nav-btn.active,.nav-tab.active){background:linear-gradient(135deg,#7f253d,#a64258)!important;color:#fff6e7!important;box-shadow:0 8px 24px rgba(110,29,49,.28)!important}
html[data-bayaan-theme="pastel"] :is(.primary-btn,.primary-button,.nav-button.active,.nav-btn.active,.nav-tab.active){color:#fff!important}
html[data-bayaan-theme]:not([data-bayaan-theme="current"]) :is(.main-nav,.menu-toggle,.theme-trigger){border-color:var(--bayaan-border)!important}
html[data-bayaan-theme]:not([data-bayaan-theme="current"]) .main-nav.mobile-open{background:color-mix(in srgb,var(--bayaan-surface) 96%,transparent)!important}
html[data-bayaan-theme]:not([data-bayaan-theme="current"]) :is(.history-bar,.reader-toolbar,.v7-rich-toolbar){background:color-mix(in srgb,var(--bayaan-surface-2) 94%,transparent)!important;border-color:var(--bayaan-border)!important;color:var(--bayaan-text)!important}
html[data-bayaan-theme]:not([data-bayaan-theme="current"]) :is(.translation,.french,.french-verse,.prose p,.match-note,.status,.muted,.v7-note-french,.v7-note-dates,.v7-work-list span){color:var(--bayaan-muted)!important}
html[data-bayaan-theme]:not([data-bayaan-theme="current"]) :is(.arabic-verse,.arabic,.hebrew,.syriac,.greek,.v7-note-original,.v7-arabic){color:var(--bayaan-text)!important}
html[data-bayaan-theme]:not([data-bayaan-theme="current"]) :is(.badge,.verse-ref,.search-type-badge,.v7-corpus-chip,.v7-selected-reason,.v7-relation-badge){background:var(--bayaan-surface-2)!important;color:var(--bayaan-accent-2)!important;border-color:var(--bayaan-border)!important}
html[data-bayaan-theme="dark"] :is(.badge,.verse-ref,.search-type-badge,.v7-corpus-chip,.v7-selected-reason,.v7-relation-badge),
html[data-bayaan-theme="luxury"] :is(.badge,.verse-ref,.search-type-badge,.v7-corpus-chip,.v7-selected-reason,.v7-relation-badge){color:var(--bayaan-gold)!important}
html[data-bayaan-theme]:not([data-bayaan-theme="current"]) :is(.modal-card,.options-menu,.options-popover,.action-menu,.v7-verse-picker,.search-box){background:var(--bayaan-surface)!important;color:var(--bayaan-text)!important;border-color:var(--bayaan-border)!important}
html[data-bayaan-theme]:not([data-bayaan-theme="current"]) :is(.empty-state,.empty,.v7-note-empty,.v7-note-list-empty,.v7-note-no-verses){background:var(--bayaan-surface-2)!important;color:var(--bayaan-muted)!important;border-color:var(--bayaan-border)!important}
html[data-bayaan-theme]:not([data-bayaan-theme="current"]) :is(table,.data-table) :is(th,td){border-color:var(--bayaan-border)!important;color:var(--bayaan-text)!important}
html[data-bayaan-theme]:not([data-bayaan-theme="current"]) :is(.bar,.progress-track){background:var(--bayaan-surface-2)!important}
html[data-bayaan-theme]:not([data-bayaan-theme="current"]) :is(.bar i,.progress-fill){background:var(--bayaan-accent)!important}
html[data-bayaan-theme]:not([data-bayaan-theme="current"]) .embedded-view{background:var(--bayaan-bg)!important}
html[data-bayaan-theme]:not([data-bayaan-theme="current"]) .embedded-view iframe{background:var(--bayaan-bg)!important}

/* Hero identity per theme. */
html[data-bayaan-theme]:not([data-bayaan-theme="current"]) :is(#compareView .hero,.app-shell>.hero,.hero:not(.hero-card)){
  background:radial-gradient(circle at 82% 18%,color-mix(in srgb,var(--bayaan-gold) 18%,transparent),transparent 27%),linear-gradient(140deg,var(--bayaan-hero-a),var(--bayaan-hero-b))!important;
  color:var(--bayaan-hero-text)!important;
}
html[data-bayaan-theme]:not([data-bayaan-theme="current"]) :is(#compareView .hero,.app-shell>.hero,.hero:not(.hero-card)) p{color:var(--bayaan-hero-muted)!important}
html[data-bayaan-theme="pastel"] .hero-card{background:radial-gradient(circle at 88% 12%,rgba(193,157,170,.18),transparent 30%),linear-gradient(135deg,#fffafb,#f1ebe9)!important}
html[data-bayaan-theme="luxury"] .hero-card{background:radial-gradient(circle at 86% 16%,rgba(216,177,106,.13),transparent 28%),linear-gradient(145deg,#1f1915,#15110f)!important;border-color:#4b3d30!important}
html[data-bayaan-theme="dark"] .hero-card{background:radial-gradient(circle at 86% 16%,rgba(99,169,147,.12),transparent 28%),linear-gradient(145deg,#15211e,#0f1715)!important}
html[data-bayaan-theme="luxury"] :is(h1,h2,h3,.brand strong,.result-ref,.verse-ref){font-family:Georgia,"Times New Roman",serif;letter-spacing:.01em}
html[data-bayaan-theme="luxury"] :is(.eyebrow,.version-badge){color:var(--bayaan-gold)!important;letter-spacing:.15em}
html[data-bayaan-theme="pastel"] :is(.eyebrow,.version-badge){color:#9b7180!important}

/* Notes retain semantic highlighter colors even in dark themes, but text stays readable. */
html[data-bayaan-theme="dark"] :is(.v7-note-verse-card.highlight-yellow,.v7-note-passage.highlight-yellow){background:#2b281b!important}
html[data-bayaan-theme="dark"] :is(.v7-note-verse-card.highlight-green,.v7-note-passage.highlight-green){background:#182a22!important}
html[data-bayaan-theme="dark"] :is(.v7-note-verse-card.highlight-blue,.v7-note-passage.highlight-blue){background:#18242d!important}
html[data-bayaan-theme="dark"] :is(.v7-note-verse-card.highlight-rose,.v7-note-passage.highlight-rose){background:#2b1c22!important}
html[data-bayaan-theme="luxury"] :is(.v7-note-verse-card.highlight-yellow,.v7-note-passage.highlight-yellow){background:#2a2317!important}
html[data-bayaan-theme="luxury"] :is(.v7-note-verse-card.highlight-green,.v7-note-passage.highlight-green){background:#1d2820!important}
html[data-bayaan-theme="luxury"] :is(.v7-note-verse-card.highlight-blue,.v7-note-passage.highlight-blue){background:#19232a!important}
html[data-bayaan-theme="luxury"] :is(.v7-note-verse-card.highlight-rose,.v7-note-passage.highlight-rose){background:#311c23!important}

/* Global theme chooser. */
.theme-switcher{position:relative;flex:0 0 auto}
.theme-trigger{display:inline-flex;align-items:center;gap:8px;min-height:42px;padding:8px 11px;border:1px solid rgba(16,42,37,.13);border-radius:13px;background:var(--bayaan-surface);color:var(--bayaan-text);font:inherit;font-size:12px;font-weight:800;cursor:pointer;box-shadow:0 7px 20px rgba(16,42,37,.07)}
.theme-trigger-icon{font-size:17px;line-height:1}.theme-trigger-name{color:var(--bayaan-muted);font-weight:700}
.theme-panel{position:absolute;z-index:210;right:0;top:calc(100% + 10px);width:min(330px,calc(100vw - 24px));padding:10px;border:1px solid var(--bayaan-border);border-radius:18px;background:color-mix(in srgb,var(--bayaan-surface) 97%,transparent);box-shadow:0 24px 70px rgba(0,0,0,.22);backdrop-filter:blur(22px)}
.theme-panel[hidden]{display:none!important}.theme-panel-title{display:block;padding:5px 7px 9px;color:var(--bayaan-muted);font-size:11px;font-weight:850;letter-spacing:.08em;text-transform:uppercase}
.theme-choice{width:100%;display:grid;grid-template-columns:38px 1fr auto;gap:10px;align-items:center;text-align:left;border:1px solid transparent;border-radius:13px;padding:9px;background:transparent;color:var(--bayaan-text);cursor:pointer}
.theme-choice:hover{background:var(--bayaan-surface-2)}.theme-choice.active{border-color:color-mix(in srgb,var(--bayaan-accent) 52%,var(--bayaan-border));background:var(--bayaan-surface-2)}
.theme-choice strong,.theme-choice small{display:block}.theme-choice strong{font-size:13px}.theme-choice small{margin-top:2px;color:var(--bayaan-muted);font-size:10.5px;line-height:1.3}.theme-choice-check{color:var(--bayaan-accent);font-weight:900}.theme-choice:not(.active) .theme-choice-check{opacity:0}
.theme-swatch{width:38px;height:38px;border-radius:12px;border:1px solid rgba(0,0,0,.1);box-shadow:inset 0 0 0 3px rgba(255,255,255,.25)}
.theme-swatch.current{background:linear-gradient(135deg,#103a32 0 48%,#f4efe5 48% 100%)}
.theme-swatch.dark{background:linear-gradient(135deg,#0b1110 0 48%,#63a993 48% 73%,#d4ab68 73%)}
.theme-swatch.pastel{background:linear-gradient(135deg,#eadde2 0 38%,#d9e4df 38% 70%,#fffafa 70%)}
.theme-swatch.luxury{background:linear-gradient(135deg,#15110f 0 48%,#7f253d 48% 73%,#d8b16a 73%)}

@media(max-width:1100px){.theme-trigger-name{display:none}}
@media(max-width:900px){.theme-trigger{width:46px;height:46px;justify-content:center;padding:7px}.theme-trigger-label{display:none}.theme-panel{position:fixed;right:12px;top:70px}}
@media(prefers-reduced-motion:reduce){html[data-bayaan-theme] body{transition:none!important}}

/* Bayān 9.2 — stable mobile form focus.
   iOS Safari zooms the viewport when focusing a text control whose computed
   font size is below 16px. Keep every editable control at 16px on touch-sized
   layouts and harden containers against accidental horizontal expansion. */
html{
  -webkit-text-size-adjust:100%;
  text-size-adjust:100%;
  max-width:100%;
}
body{
  max-width:100%;
  overflow-x:hidden;
  overflow-x:clip;
}
:is(input,select,textarea,[contenteditable="true"]){
  box-sizing:border-box;
  max-width:100%;
  min-width:0;
}
@media (max-width: 900px){
  :is(
    input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]),
    select,
    textarea,
    [contenteditable="true"]
  ){
    font-size:16px!important;
    line-height:1.35;
    max-width:100%!important;
    min-width:0!important;
    transform:none!important;
  }
  :is(
    input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]),
    select,
    textarea,
    [contenteditable="true"]
  ):focus{
    font-size:16px!important;
    transform:none!important;
  }
  :is(form,.search-box,.search-line,.search-panel,.filters,.filters-row,.field,.control,.input-group,.adv-toolbar,.adv-rule,.v90c-grid,.v7-note-editor,.v7-note-editor-shell){
    min-width:0;
    max-width:100%;
  }
}

/* ==========================================================================\n   Bayān 10.4 — couche de contraste universelle\n   Tous les modules historiques passent par une palette sémantique unique.\n   Objectif: conserver une lisibilité forte dans Actuel / Sombre / Pastel / Luxe.\n   ========================================================================== */
:root{
  --bayaan-action-bg:#1f685a;
  --bayaan-action-text:#ffffff;
  --bayaan-action-hover:#174f45;
  --bayaan-link:#155b50;
  --bayaan-focus:#1f685a;
  --bayaan-info-bg:#e8f1ee;--bayaan-info-text:#16483f;
  --bayaan-success-bg:#e5f2ea;--bayaan-success-text:#20553f;
  --bayaan-warning-bg:#fff0d5;--bayaan-warning-text:#704c12;
  --bayaan-danger-bg:#f8e4e6;--bayaan-danger-text:#7b2836;
  --bayaan-selection:#d9ebe5;
}
html[data-bayaan-theme="dark"]{
  --bayaan-action-bg:#2f7564;--bayaan-action-text:#ffffff;--bayaan-action-hover:#3b8874;
  --bayaan-link:#9bdcc7;--bayaan-focus:#8bd4bd;
  --bayaan-info-bg:#172a31;--bayaan-info-text:#b8dded;
  --bayaan-success-bg:#172a22;--bayaan-success-text:#b8e2c9;
  --bayaan-warning-bg:#302719;--bayaan-warning-text:#f2d59a;
  --bayaan-danger-bg:#321c22;--bayaan-danger-text:#f2bdc7;
  --bayaan-selection:#24473d;
}
html[data-bayaan-theme="pastel"]{
  --bayaan-action-bg:#5e776f;--bayaan-action-text:#ffffff;--bayaan-action-hover:#4c655d;
  --bayaan-link:#526f66;--bayaan-focus:#5e776f;
  --bayaan-info-bg:#e5eef0;--bayaan-info-text:#365d67;
  --bayaan-success-bg:#e5eee8;--bayaan-success-text:#3e6253;
  --bayaan-warning-bg:#f5ead8;--bayaan-warning-text:#73572d;
  --bayaan-danger-bg:#f3e2e6;--bayaan-danger-text:#7a4250;
  --bayaan-selection:#e2ebe7;
}
html[data-bayaan-theme="luxury"]{
  --bayaan-action-bg:#8f3147;--bayaan-action-text:#fffaf0;--bayaan-action-hover:#a63c55;
  --bayaan-link:#e4bd78;--bayaan-focus:#d8b16a;
  --bayaan-info-bg:#1c2930;--bayaan-info-text:#c7e0ec;
  --bayaan-success-bg:#1d2921;--bayaan-success-text:#c4e4cd;
  --bayaan-warning-bg:#322719;--bayaan-warning-text:#f0d194;
  --bayaan-danger-bg:#361c24;--bayaan-danger-text:#f4bdca;
  --bayaan-selection:#42212a;
}

/* Base text and inherited typography. */
html[data-bayaan-theme] body,
html[data-bayaan-theme] :is(main,section,article,aside,dialog,details,summary,form,fieldset,legend,label){color:var(--bayaan-text)}
html[data-bayaan-theme] :is(h1,h2,h3,h4,h5,h6,strong,b,.title,.heading,.result-ref){color:inherit}
html[data-bayaan-theme] :is(p,li,dd,dt,small,.subtitle,.description,.help,.hint,.meta,.caption){border-color:var(--bayaan-border)}
html[data-bayaan-theme] a:not(.brand){color:var(--bayaan-link)}
html[data-bayaan-theme] ::selection{background:var(--bayaan-selection);color:var(--bayaan-text)}

/* Form controls: never inherit a pale historical fill/text pairing. */
html[data-bayaan-theme] :is(input,select,textarea,[contenteditable="true"]){
  background:var(--bayaan-field)!important;color:var(--bayaan-text)!important;border-color:var(--bayaan-border)!important;
}
html[data-bayaan-theme] :is(input,select,textarea,[contenteditable="true"]):focus{
  outline:3px solid color-mix(in srgb,var(--bayaan-focus) 24%,transparent)!important;
  border-color:var(--bayaan-focus)!important;box-shadow:none!important;
}
html[data-bayaan-theme] :is(input,textarea)::placeholder{color:var(--bayaan-muted)!important;opacity:.86!important}
html[data-bayaan-theme] select option{background:var(--bayaan-surface)!important;color:var(--bayaan-text)!important}

/* Generic panels/cards used by every generation of Bayān. */
html[data-bayaan-theme] :is(
  .panel,.card,.search-panel,.result-card,.summary-card,.hero-card,.verse-card,.metric,.table-card,.table-wrap,
  .research-sources-panel,.term-profile,.word-profile,.occurrence-navigator,.query-builder-card,.similarity-card,
  .lab-card,.research-lab-card,.v90-card,.v90c-card,.v100-os,.v100-panel,.v100-result-card,.v100-graph-detail,
  .v100-evidence,.v100-versions,.v100-discovery-grid article,.v100-shared,.v100-snapshots article,.v100-ms-image,.v100-ms-editor,
  .v7-compare-panel,.v7-study-corpus,.v7-note-editor,.v7-note-editor-shell,.v7-notes-sidebar,.v7-work-card,.v7-work-hero,
  .v7-note-list-item,.v7-study-item,.modal-card,.options-menu,.options-popover,.action-menu,.search-box,.v7-verse-picker
){background-color:var(--bayaan-surface)!important;color:var(--bayaan-text)!important;border-color:var(--bayaan-border)!important}

/* Secondary surfaces, toolbars, rows and code areas. */
html[data-bayaan-theme] :is(
  .history-bar,.reader-toolbar,.v7-rich-toolbar,.toolbar,.filters,.filter-bar,.controls,.control-bar,
  .v100-plan article,.v100-hyp-score,.v100-evidence-grid section,.v100-api,.v100-reasons span,.v100-discovery-grid span,
  pre,code,.code,.empty-state,.empty,.v7-note-empty,.v7-note-list-empty,.v7-note-no-verses
){background-color:var(--bayaan-surface-2)!important;color:var(--bayaan-text)!important;border-color:var(--bayaan-border)!important}

/* Muted copy: explicit but still readable. */
html[data-bayaan-theme] :is(
  .muted,.status,.translation,.french,.french-verse,.match-note,.v7-note-french,.v7-note-dates,.v7-work-list span,
  .v100-history small,.v100-toolbar small,.v100-warning,.v100-method,.v100-empty,.v100-empty-small,.v100-shared small,
  .v100-snapshots small,.theme-choice small,.theme-panel-title,.brand small
){color:var(--bayaan-muted)!important}

/* Default interactive controls. */
html[data-bayaan-theme] :is(
  .ghost-btn,.ghost-button,.secondary-button,.result-action,.icon-button,.text-button,.previous-search-button,
  .copy-range-button,.download-range-button,.download-surah-button,.phonetic-surah-button,.play-french-surah-button,
  .v7-workspace-tabs button,.v7-note-head-actions button,.v7-rich-toolbar button,.v7-tab,.v7-tabs button,
  .v7-compare-button,.v7-picker-actions button,.v7-inline-actions button,.v7-item-actions button,.v7-word-actions button,
  .v8-protocol-actions button,.v8-token-inspector-actions button,.v90-actions button,.v90-tabs button,.v90c-tabs button,
  .v100-actions button,.v100-hyp-actions button,.v100-toolbar button,.v100-result-card footer button,.v100-snapshots button,
  .v100-history button,.v100-hyp-list button,.v100-ms-saved button
){background:var(--bayaan-surface-2)!important;color:var(--bayaan-text)!important;border-color:var(--bayaan-border)!important}
html[data-bayaan-theme] :is(
  .ghost-btn,.ghost-button,.secondary-button,.result-action,.icon-button,.text-button,
  .v7-workspace-tabs button,.v7-note-head-actions button,.v7-rich-toolbar button,.v100-actions button,.v100-hyp-actions button,
  .v100-toolbar button,.v100-result-card footer button,.v100-snapshots button,.v100-history button,.v100-hyp-list button
):hover{background:color-mix(in srgb,var(--bayaan-surface-2) 72%,var(--bayaan-accent) 28%)!important;color:var(--bayaan-text)!important}

/* Primary / selected controls always use a tested foreground/background pair. */
html[data-bayaan-theme] :is(
  .primary-btn,.primary-button,.calculate-button,.search-button,.submit-button,
  .nav-button.active,.nav-btn.active,.nav-tab.active,.v7-tab.active,.v7-tabs button.active,.v7-workspace-tabs button.active,
  .v90-tabs button.active,.v90c-tabs button.active,.v100-tabs button.active,.v100-new-hyp,
  .audio-main-toggle.active,.audio-range-hero-button,.copy-range-hero-button,.v88-filter-toggle-main.active,.v88-filter-toggle-sub.active
){background:var(--bayaan-action-bg)!important;color:var(--bayaan-action-text)!important;border-color:var(--bayaan-action-bg)!important;text-shadow:none!important}
html[data-bayaan-theme] :is(
  .primary-btn,.primary-button,.calculate-button,.search-button,.submit-button,
  .nav-button.active,.nav-btn.active,.nav-tab.active,.v7-tab.active,.v7-tabs button.active,.v7-workspace-tabs button.active,
  .v90-tabs button.active,.v90c-tabs button.active,.v100-tabs button.active,.v100-new-hyp
):hover{background:var(--bayaan-action-hover)!important;color:var(--bayaan-action-text)!important}

/* Navigation inactive state. */
html[data-bayaan-theme] :is(.nav-button,.nav-btn,.nav-tab,.v7-tab,.v100-tabs button,.v90-tabs button,.v90c-tabs button){color:var(--bayaan-text)!important;border-color:var(--bayaan-border)!important}
html[data-bayaan-theme] :is(.nav-button,.nav-btn,.nav-tab,.v7-tab,.v100-tabs button,.v90-tabs button,.v90c-tabs button):not(.active):hover{
  background:var(--bayaan-surface-2)!important;color:var(--bayaan-text)!important
}

/* Badges/chips: old green-on-green combinations are forbidden. */
html[data-bayaan-theme] :is(
  .badge,.verse-ref,.search-type-badge,.v7-corpus-chip,.v7-selected-reason,.v7-relation-badge,.v100-badge,
  .occurrence-badge,.gospel-badge,.method-pill,.calc-chip,.v89-local-save-badge,.v89-selection-badge,.v89-work-badges span
){background:var(--bayaan-surface-2)!important;color:var(--bayaan-link)!important;border-color:var(--bayaan-border)!important}

/* Tables. */
html[data-bayaan-theme] :is(table,.data-table,.analysis-table,.v90-table,.v90c-table){background:var(--bayaan-surface)!important;color:var(--bayaan-text)!important;border-color:var(--bayaan-border)!important}
html[data-bayaan-theme] :is(table,.data-table,.analysis-table,.v90-table,.v90c-table) th{
  background:var(--bayaan-surface-2)!important;color:var(--bayaan-text)!important;border-color:var(--bayaan-border)!important
}
html[data-bayaan-theme] :is(table,.data-table,.analysis-table,.v90-table,.v90c-table) td{color:var(--bayaan-text)!important;border-color:var(--bayaan-border)!important}
html[data-bayaan-theme] :is(table,.data-table,.analysis-table,.v90-table,.v90c-table) tr:hover td{background:color-mix(in srgb,var(--bayaan-surface-2) 82%,var(--bayaan-accent) 18%)!important}

/* Semantic status colors with dedicated readable foregrounds. */
html[data-bayaan-theme] :is(.v100-level.donnee,.v100-level.donnée,.status-success,.success){background:var(--bayaan-success-bg)!important;color:var(--bayaan-success-text)!important}
html[data-bayaan-theme] :is(.v100-level.calcul,.status-info,.info){background:var(--bayaan-info-bg)!important;color:var(--bayaan-info-text)!important}
html[data-bayaan-theme] :is(.v100-level.hypothese,.v100-level.hypothèse,.status-warning,.warning){background:var(--bayaan-warning-bg)!important;color:var(--bayaan-warning-text)!important}
html[data-bayaan-theme] :is(.status-danger,.danger,.danger-soft-button){background:var(--bayaan-danger-bg)!important;color:var(--bayaan-danger-text)!important;border-color:color-mix(in srgb,var(--bayaan-danger-text) 35%,var(--bayaan-border))!important}
html[data-bayaan-theme] .v100-ms-diff del{background:var(--bayaan-danger-bg)!important;color:var(--bayaan-danger-text)!important}
html[data-bayaan-theme] .v100-ms-diff ins{background:var(--bayaan-success-bg)!important;color:var(--bayaan-success-text)!important}

/* Research OS dark hero/publication surfaces stay deliberately high contrast. */
html[data-bayaan-theme] :is(.v100-os>summary,.v100-publication){
  background:linear-gradient(135deg,var(--bayaan-hero-a),var(--bayaan-hero-b))!important;color:var(--bayaan-hero-text)!important
}
html[data-bayaan-theme] :is(.v100-os>summary,.v100-publication) :is(h1,h2,h3,h4,strong,.v100-badge){color:var(--bayaan-hero-text)!important}
html[data-bayaan-theme] :is(.v100-os>summary,.v100-publication) :is(p,small){color:var(--bayaan-hero-muted)!important}
html[data-bayaan-theme] .v100-pub-actions button{background:color-mix(in srgb,var(--bayaan-hero-text) 12%,transparent)!important;color:var(--bayaan-hero-text)!important;border-color:color-mix(in srgb,var(--bayaan-hero-text) 28%,transparent)!important}
html[data-bayaan-theme] .v100-pub-actions .primary-btn{background:var(--bayaan-action-bg)!important;color:var(--bayaan-action-text)!important;border-color:var(--bayaan-action-bg)!important}

/* Verse / original scripts and highlights. */
html[data-bayaan-theme] :is(.arabic,.arabic-verse,.hebrew,.syriac,.greek,.v7-note-original,.v7-arabic,.v100-original){color:var(--bayaan-text)!important}
html[data-bayaan-theme] mark{background:var(--bayaan-warning-bg)!important;color:var(--bayaan-warning-text)!important;padding:.05em .16em;border-radius:.2em}

/* Native widgets and scrollbars. */
html[data-bayaan-theme] :is(hr){border-color:var(--bayaan-border)!important}
html[data-bayaan-theme] :is(input[type="range"]){accent-color:var(--bayaan-action-bg)}
html[data-bayaan-theme] :is(input[type="checkbox"],input[type="radio"]){accent-color:var(--bayaan-action-bg)}
html[data-bayaan-theme] *{scrollbar-color:var(--bayaan-border) var(--bayaan-surface-2)}

/* Theme chooser must itself remain readable in every theme. */
html[data-bayaan-theme] .theme-trigger{background:var(--bayaan-surface)!important;color:var(--bayaan-text)!important;border-color:var(--bayaan-border)!important}
html[data-bayaan-theme] .theme-panel{background:var(--bayaan-surface)!important;color:var(--bayaan-text)!important;border-color:var(--bayaan-border)!important}
html[data-bayaan-theme] .theme-choice{color:var(--bayaan-text)!important}
html[data-bayaan-theme] .theme-choice:hover,
html[data-bayaan-theme] .theme-choice.active{background:var(--bayaan-surface-2)!important;color:var(--bayaan-text)!important}
html[data-bayaan-theme] .theme-choice-check{color:var(--bayaan-link)!important}


/* ===== NORMALISATION FINALE 10.10 ===== */
/* ========================================================================== 
   Bayān 10.6 — Accessibilité visuelle universelle
   Couche finale chargée après tous les styles historiques.
   Objectifs :
   - contraste texte normal >= 4.5:1 ; gros texte / composants >= 3:1 ;
   - surfaces et bordures clairement séparées ;
   - états actif / inactif / survol / focus identifiables sans dépendre d'une
     nuance trop proche ;
   - compatibilité de tous les anciens modules avec les 4 thèmes.
   ========================================================================== */

/* ---------- 1. Palettes à contraste renforcé ---------- */
:root,
html[data-bayaan-theme="current"]{
  --bayaan-bg:#edf2f0;
  --bayaan-surface:#ffffff;
  --bayaan-surface-2:#dde7e3;
  --bayaan-surface-3:#cbd9d4;
  --bayaan-field:#ffffff;
  --bayaan-text:#0d211c;
  --bayaan-muted:#435a52;
  --bayaan-border:#718a81;
  --bayaan-border-strong:#536b63;
  --bayaan-accent:#125a4b;
  --bayaan-accent-2:#073c33;
  --bayaan-link:#0b5145;
  --bayaan-gold:#8c5a12;
  --bayaan-emphasis:#744807;
  --bayaan-action-bg:#125a4b;
  --bayaan-action-text:#ffffff;
  --bayaan-action-hover:#073f35;
  --bayaan-focus:#b76300;
  --bayaan-selection:#cce5dc;
  --bayaan-shadow:0 14px 38px rgba(13,33,28,.13);
  --bayaan-nav-bg:#083a31;
  --bayaan-nav-text:#f7fffc;
  --bayaan-nav-muted:#cfe2db;
  --bayaan-nav-border:#5f8176;
  --bayaan-nav-active-bg:#f0cf89;
  --bayaan-nav-active-text:#2c220c;
  --bayaan-hero-a:#0b342c;
  --bayaan-hero-b:#125a4b;
  --bayaan-hero-text:#ffffff;
  --bayaan-hero-muted:#d9ebe5;
  --bayaan-info-bg:#dcecf3;--bayaan-info-text:#143d4d;
  --bayaan-success-bg:#dcede3;--bayaan-success-text:#184831;
  --bayaan-warning-bg:#f7e5bf;--bayaan-warning-text:#5b3b05;
  --bayaan-danger-bg:#f3dae0;--bayaan-danger-text:#6b1f2e;
}
html[data-bayaan-theme="dark"]{
  --bayaan-bg:#07100d;
  --bayaan-surface:#111a17;
  --bayaan-surface-2:#1d2b26;
  --bayaan-surface-3:#2b3c36;
  --bayaan-field:#0b1512;
  --bayaan-text:#f5faf7;
  --bayaan-muted:#b4c6bf;
  --bayaan-border:#61766e;
  --bayaan-border-strong:#8ba097;
  --bayaan-accent:#66cfb0;
  --bayaan-accent-2:#96e6cf;
  --bayaan-link:#8fe0c8;
  --bayaan-gold:#f1c879;
  --bayaan-emphasis:#f1c879;
  --bayaan-action-bg:#1d6a58;
  --bayaan-action-text:#ffffff;
  --bayaan-action-hover:#287c68;
  --bayaan-focus:#f1c879;
  --bayaan-selection:#285344;
  --bayaan-shadow:0 18px 46px rgba(0,0,0,.46);
  --bayaan-nav-bg:#050d0a;
  --bayaan-nav-text:#f8fffc;
  --bayaan-nav-muted:#b8ccc4;
  --bayaan-nav-border:#687e75;
  --bayaan-nav-active-bg:#72d5b7;
  --bayaan-nav-active-text:#06231b;
  --bayaan-hero-a:#071511;
  --bayaan-hero-b:#12392f;
  --bayaan-hero-text:#f7fffb;
  --bayaan-hero-muted:#c4d9d1;
  --bayaan-info-bg:#19303a;--bayaan-info-text:#cbeaf7;
  --bayaan-success-bg:#193126;--bayaan-success-text:#c8ecd7;
  --bayaan-warning-bg:#382b15;--bayaan-warning-text:#f5daa2;
  --bayaan-danger-bg:#3a1d25;--bayaan-danger-text:#f7c6d0;
}
html[data-bayaan-theme="pastel"]{
  --bayaan-bg:#f5ecef;
  --bayaan-surface:#fffcfd;
  --bayaan-surface-2:#eadbe1;
  --bayaan-surface-3:#d9c7cf;
  --bayaan-field:#ffffff;
  --bayaan-text:#2c2227;
  --bayaan-muted:#5e4d55;
  --bayaan-border:#937b86;
  --bayaan-border-strong:#735d67;
  --bayaan-accent:#496b61;
  --bayaan-accent-2:#304e46;
  --bayaan-link:#3c5f55;
  --bayaan-gold:#7b5731;
  --bayaan-emphasis:#6b3f52;
  --bayaan-action-bg:#496b61;
  --bayaan-action-text:#ffffff;
  --bayaan-action-hover:#36564d;
  --bayaan-focus:#8a4661;
  --bayaan-selection:#e5ccd6;
  --bayaan-shadow:0 14px 38px rgba(71,47,58,.14);
  --bayaan-nav-bg:#40554e;
  --bayaan-nav-text:#ffffff;
  --bayaan-nav-muted:#e1ece8;
  --bayaan-nav-border:#91aaa1;
  --bayaan-nav-active-bg:#f1d8e2;
  --bayaan-nav-active-text:#35252c;
  --bayaan-hero-a:#e4d8dd;
  --bayaan-hero-b:#d8e5e0;
  --bayaan-hero-text:#2c2227;
  --bayaan-hero-muted:#5e4d55;
  --bayaan-info-bg:#dfeaf1;--bayaan-info-text:#355367;
  --bayaan-success-bg:#e0eae3;--bayaan-success-text:#365442;
  --bayaan-warning-bg:#f2e3c8;--bayaan-warning-text:#67461b;
  --bayaan-danger-bg:#f0dde3;--bayaan-danger-text:#713444;
}
html[data-bayaan-theme="luxury"]{
  --bayaan-bg:#0e090a;
  --bayaan-surface:#181112;
  --bayaan-surface-2:#2b1e21;
  --bayaan-surface-3:#3a282d;
  --bayaan-field:#130c0e;
  --bayaan-text:#fff5e8;
  --bayaan-muted:#d8c4b2;
  --bayaan-border:#806169;
  --bayaan-border-strong:#a7838c;
  --bayaan-accent:#e17893;
  --bayaan-accent-2:#f0a3b7;
  --bayaan-link:#f0c778;
  --bayaan-gold:#f0c778;
  --bayaan-emphasis:#f0c778;
  --bayaan-action-bg:#8b2e46;
  --bayaan-action-text:#ffffff;
  --bayaan-action-hover:#a63d58;
  --bayaan-focus:#f0c778;
  --bayaan-selection:#542536;
  --bayaan-shadow:0 20px 56px rgba(0,0,0,.55);
  --bayaan-nav-bg:#120a0c;
  --bayaan-nav-text:#fff7ec;
  --bayaan-nav-muted:#dbc8b8;
  --bayaan-nav-border:#806169;
  --bayaan-nav-active-bg:#e4b96b;
  --bayaan-nav-active-text:#2d1906;
  --bayaan-hero-a:#160d0f;
  --bayaan-hero-b:#431522;
  --bayaan-hero-text:#fff7eb;
  --bayaan-hero-muted:#decbbb;
  --bayaan-info-bg:#1b3039;--bayaan-info-text:#d0eaf6;
  --bayaan-success-bg:#1b2e22;--bayaan-success-text:#cdead6;
  --bayaan-warning-bg:#382814;--bayaan-warning-text:#f7d89a;
  --bayaan-danger-bg:#3b1a24;--bayaan-danger-text:#fac4d0;
}

/* ---------- 2. Pont vers toutes les variables historiques ---------- */
html[data-bayaan-theme]{
  --ink:var(--bayaan-text)!important;
  --muted:var(--bayaan-muted)!important;
  --line:var(--bayaan-border)!important;
  --paper:var(--bayaan-surface)!important;
  --card:var(--bayaan-surface)!important;
  --panel:var(--bayaan-surface)!important;
  --cream:var(--bayaan-bg)!important;
  --bg:var(--bayaan-bg)!important;
  --header:var(--bayaan-nav-bg)!important;
  --shadow:var(--bayaan-shadow)!important;
  --green:var(--bayaan-accent)!important;
  --green2:var(--bayaan-accent-2)!important;
  --green-deep:var(--bayaan-accent-2)!important;
  --deep-green:var(--bayaan-accent-2)!important;
  --forest:var(--bayaan-accent-2)!important;
  --forest-2:var(--bayaan-accent)!important;
  --forest-soft:var(--bayaan-surface-2)!important;
  --accent:var(--bayaan-accent)!important;
  --accent-dark:var(--bayaan-accent-2)!important;
  --blue:var(--bayaan-link)!important;
  --blue2:var(--bayaan-accent)!important;
  --gold:var(--bayaan-gold)!important;
  --gold-soft:var(--bayaan-warning-bg)!important;
  --danger:var(--bayaan-danger-text)!important;
  --v88-forest:var(--bayaan-accent-2)!important;
  --v88-forest-2:var(--bayaan-accent)!important;
  --v88-line:var(--bayaan-border)!important;
  --v88-ink:var(--bayaan-text)!important;
  --mobile-paper:var(--bayaan-surface)!important;
  --mobile-line:var(--bayaan-border)!important;
  --mobile-green:var(--bayaan-action-bg)!important;
  --mobile-green-soft:var(--bayaan-surface-2)!important;
  --mobile-gold:var(--bayaan-nav-active-bg)!important;
}

/* ---------- 3. Fond, texte, séparation des surfaces ---------- */
html[data-bayaan-theme] body{
  background:var(--bayaan-bg)!important;
  color:var(--bayaan-text)!important;
}
html[data-bayaan-theme] body::before{opacity:.12!important}
html[data-bayaan-theme] :is(main,section,article,aside,form,fieldset,details,dialog,label,legend){color:var(--bayaan-text)}
html[data-bayaan-theme] :is(h1,h2,h3,h4,h5,h6,strong,b,.title,.heading){color:inherit}
html[data-bayaan-theme] :is(.muted,.meta,.caption,.description,.help,.hint,.status,.translation,.french,.french-verse){color:var(--bayaan-muted)!important}
html[data-bayaan-theme] a:not(.brand){color:var(--bayaan-link)!important;text-decoration-thickness:1.5px;text-underline-offset:2px}
html[data-bayaan-theme] ::selection{background:var(--bayaan-selection);color:var(--bayaan-text)}
html[data-bayaan-theme] hr{border-color:var(--bayaan-border)!important}

/* Les cartes ne sont plus distinguées seulement par une ombre faible. */
html[data-bayaan-theme] :is(
  .panel,.card,.search-panel,.result-card,.summary-card,.hero-card,.verse-card,.metric,.table-card,.table-wrap,
  .research-sources-panel,.research-source-card,.term-profile,.word-profile,.occurrence-navigator,.query-builder-card,
  .similarity-card,.lab-card,.research-lab-card,.v90-card,.v90c-card,.v100-os,.v100-panel,.v100-result-card,
  .v100-graph-detail,.v100-evidence,.v100-versions,.v100-discovery-grid article,.v100-shared,.v100-snapshots article,
  .v100-ms-image,.v100-ms-editor,.v7-compare-panel,.v7-study-corpus,.v7-note-editor,.v7-note-editor-shell,
  .v7-notes-sidebar,.v7-work-card,.v7-work-hero,.v7-note-list-item,.v7-study-item,.modal-card,.options-menu,
  .options-popover,.action-menu,.search-box,.v7-verse-picker,.critical-apparatus-panel,.critical-loading,.critical-empty,
  .critical-source,.critical-witness,.critical-status,.v8-token-inspector-card,.advanced-query-builder,
  .similarity-result-group,.verse-similarity-search,.similarity-reference-preview,.similarity-shared-panel
){
  background-color:var(--bayaan-surface)!important;
  color:var(--bayaan-text)!important;
  border-color:var(--bayaan-border)!important;
}
html[data-bayaan-theme] :is(
  .panel,.card,.search-panel,.result-card,.summary-card,.hero-card,.verse-card,.metric,.table-card,
  .research-sources-panel,.research-source-card,.lab-card,.research-lab-card,.v90-card,.v90c-card,
  .v100-panel,.v100-result-card,.v7-work-card,.critical-apparatus-panel,.advanced-query-builder,
  .similarity-result-group,.verse-similarity-search
){border-width:1px!important;border-style:solid!important;box-shadow:var(--bayaan-shadow)!important}

html[data-bayaan-theme] :is(
  .history-bar,.reader-toolbar,.v7-rich-toolbar,.toolbar,.filters,.filter-bar,.controls,.control-bar,.airy-disclosure,
  .critical-status-grid>div,.adv-method-note,.ring-score,.similarity-result-group-body,.v100-plan article,.v100-hyp-score,
  .v100-evidence-grid section,.v100-api,.v100-reasons span,.v100-discovery-grid span,pre,code,.code,.empty-state,.empty,
  .v7-note-empty,.v7-note-list-empty,.v7-note-no-verses,.summary-note,.copy-options label,.calc-chip
){
  background-color:var(--bayaan-surface-2)!important;
  color:var(--bayaan-text)!important;
  border-color:var(--bayaan-border)!important;
}
html[data-bayaan-theme] .airy-disclosure>summary{color:var(--bayaan-text)!important}
html[data-bayaan-theme] .airy-disclosure-body{border-color:var(--bayaan-border)!important}
html[data-bayaan-theme] :is(.airy-summary-copy small,.airy-chevron){color:var(--bayaan-muted)!important}
html[data-bayaan-theme] .airy-summary-icon{background:var(--bayaan-surface-3)!important;color:var(--bayaan-accent-2)!important;border:1px solid var(--bayaan-border)!important}

/* ---------- 4. En-tête et navigation : contraste indépendant du thème ---------- */
html[data-bayaan-theme] .topbar{
  background:var(--bayaan-nav-bg)!important;
  color:var(--bayaan-nav-text)!important;
  border-color:var(--bayaan-nav-border)!important;
  box-shadow:0 8px 24px rgba(0,0,0,.24)!important;
}
html[data-bayaan-theme] .topbar :is(.brand,.brand strong,.brand-mark,.mark){color:var(--bayaan-nav-text)!important}
html[data-bayaan-theme] .topbar .brand small{color:var(--bayaan-nav-muted)!important}
html[data-bayaan-theme] .topbar :is(.brand-mark,.mark){
  background:color-mix(in srgb,var(--bayaan-nav-text) 10%,transparent)!important;
  border:1px solid var(--bayaan-nav-border)!important;
}
html[data-bayaan-theme] .topbar :is(.nav-button,.nav-btn,.nav-tab,.menu-toggle){
  background:transparent!important;
  color:var(--bayaan-nav-text)!important;
  border-color:transparent!important;
}
html[data-bayaan-theme] .topbar :is(.nav-button,.nav-btn,.nav-tab,.menu-toggle):hover{
  background:color-mix(in srgb,var(--bayaan-nav-text) 13%,transparent)!important;
  color:var(--bayaan-nav-text)!important;
}
html[data-bayaan-theme] .topbar :is(.nav-button.active,.nav-btn.active,.nav-tab.active){
  background:var(--bayaan-nav-active-bg)!important;
  color:var(--bayaan-nav-active-text)!important;
  border-color:var(--bayaan-nav-active-bg)!important;
  box-shadow:0 3px 10px rgba(0,0,0,.22)!important;
}
html[data-bayaan-theme] .topbar .nav-button.active :is(span,i),
html[data-bayaan-theme] .topbar .nav-btn.active :is(span,i),
html[data-bayaan-theme] .topbar .nav-tab.active :is(span,i){color:var(--bayaan-nav-active-text)!important}
html[data-bayaan-theme] .menu-toggle-bars i{background:var(--bayaan-nav-text)!important}
html[data-bayaan-theme] .main-nav.mobile-open{background:var(--bayaan-nav-bg)!important;border-color:var(--bayaan-nav-border)!important}
html[data-bayaan-theme] .version-badge{color:var(--bayaan-gold)!important}

/* Theme switcher dans un en-tête sombre. */
html[data-bayaan-theme] .topbar .theme-trigger{
  background:color-mix(in srgb,var(--bayaan-nav-text) 10%,transparent)!important;
  color:var(--bayaan-nav-text)!important;
  border-color:var(--bayaan-nav-border)!important;
}
html[data-bayaan-theme] .theme-panel{
  background:var(--bayaan-surface)!important;color:var(--bayaan-text)!important;
  border:1px solid var(--bayaan-border-strong)!important;box-shadow:var(--bayaan-shadow)!important
}
html[data-bayaan-theme] .theme-choice{color:var(--bayaan-text)!important;border:1px solid transparent!important}
html[data-bayaan-theme] .theme-choice:hover{background:var(--bayaan-surface-2)!important;border-color:var(--bayaan-border)!important}
html[data-bayaan-theme] .theme-choice.active{background:var(--bayaan-surface-2)!important;border-color:var(--bayaan-border-strong)!important}
html[data-bayaan-theme] .theme-choice small,.theme-panel-title{color:var(--bayaan-muted)!important}
html[data-bayaan-theme] .theme-choice-check{color:var(--bayaan-link)!important}

/* ---------- 5. Formulaires ---------- */
html[data-bayaan-theme] :is(input,select,textarea,[contenteditable="true"]){
  background:var(--bayaan-field)!important;
  color:var(--bayaan-text)!important;
  border:1px solid var(--bayaan-border-strong)!important;
  box-shadow:none!important;
}
html[data-bayaan-theme] :is(input,select,textarea,[contenteditable="true"]):hover{border-color:var(--bayaan-accent-2)!important}
html[data-bayaan-theme] :is(input,select,textarea,[contenteditable="true"]):focus,
html[data-bayaan-theme] :is(button,a,[tabindex],summary):focus-visible{
  outline:3px solid var(--bayaan-focus)!important;
  outline-offset:2px!important;
  box-shadow:0 0 0 2px var(--bayaan-bg)!important;
}
html[data-bayaan-theme] :is(input,textarea)::placeholder{color:var(--bayaan-muted)!important;opacity:1!important}
html[data-bayaan-theme] select option{background:var(--bayaan-surface)!important;color:var(--bayaan-text)!important}
html[data-bayaan-theme] :is(input[type="checkbox"],input[type="radio"],input[type="range"]){accent-color:var(--bayaan-action-bg)}

/* ---------- 6. Boutons et états ---------- */
html[data-bayaan-theme] :is(
  .primary-btn,.primary-button,.calculate-button,.search-button,.submit-button,.audio-range-hero-button,.copy-range-hero-button,
  .v100-new-hyp,.v88-filter-toggle-main.active,.v88-filter-toggle-sub.active
){
  background:var(--bayaan-action-bg)!important;
  color:var(--bayaan-action-text)!important;
  border:1px solid var(--bayaan-action-bg)!important;
  text-shadow:none!important;
}
html[data-bayaan-theme] :is(.primary-btn,.primary-button,.calculate-button,.search-button,.submit-button,.v100-new-hyp):hover{
  background:var(--bayaan-action-hover)!important;color:var(--bayaan-action-text)!important;border-color:var(--bayaan-action-hover)!important
}
html[data-bayaan-theme] :is(
  .ghost-btn,.ghost-button,.secondary-button,.secondary-btn,.result-action,.icon-button,.text-button,.previous-search-button,
  .copy-range-button,.download-range-button,.download-surah-button,.phonetic-surah-button,.play-french-surah-button,
  .v7-workspace-tabs button,.v7-note-head-actions button,.v7-rich-toolbar button,.v7-tab,.v7-tabs button,.v7-compare-button,
  .v7-picker-actions button,.v7-inline-actions button,.v7-item-actions button,.v7-word-actions button,.v8-protocol-actions button,
  .v8-token-inspector-actions button,.critical-actions button,.adv-builder-actions>button:not(.primary-btn),.v90-actions button,
  .v90-tabs button,.v90c-tabs button,.v100-actions button,.v100-hyp-actions button,.v100-toolbar button,
  .v100-result-card footer button,.v100-snapshots button,.v100-history button,.v100-hyp-list button,.v100-ms-saved button,
  .tag-cloud button,.quick-searches button,.verse-actions .icon-button
){
  background:var(--bayaan-surface-2)!important;
  color:var(--bayaan-text)!important;
  border:1px solid var(--bayaan-border-strong)!important;
}
html[data-bayaan-theme] :is(
  .ghost-btn,.ghost-button,.secondary-button,.secondary-btn,.result-action,.icon-button,.text-button,
  .v7-workspace-tabs button,.v7-note-head-actions button,.v7-rich-toolbar button,.critical-actions button,
  .v8-protocol-actions button,.v8-token-inspector-actions button,.adv-builder-actions>button:not(.primary-btn),
  .v100-actions button,.v100-hyp-actions button,.v100-toolbar button,.v100-result-card footer button,.tag-cloud button,
  .quick-searches button,.verse-actions .icon-button
):hover{
  background:var(--bayaan-surface-3)!important;color:var(--bayaan-text)!important;border-color:var(--bayaan-accent-2)!important
}
html[data-bayaan-theme] :is(
  .v7-tab.active,.v7-tabs button.active,.v7-workspace-tabs button.active,.v90-tabs button.active,.v90c-tabs button.active,
  .v100-tabs button.active,.audio-main-toggle.active
){
  background:var(--bayaan-action-bg)!important;color:var(--bayaan-action-text)!important;border-color:var(--bayaan-action-bg)!important
}
html[data-bayaan-theme] :is(button,[role="button"],[aria-disabled="true"],input,select,textarea):disabled,
html[data-bayaan-theme] [aria-disabled="true"]{
  opacity:1!important;background:var(--bayaan-surface-2)!important;color:var(--bayaan-muted)!important;
  border-color:var(--bayaan-border)!important;cursor:not-allowed!important;text-decoration:none!important
}

/* ---------- 7. Badges, onglets, tableaux ---------- */
html[data-bayaan-theme] :is(
  .badge,.verse-ref,.search-type-badge,.v7-corpus-chip,.v7-selected-reason,.v7-relation-badge,.v100-badge,.occurrence-badge,
  .gospel-badge,.method-pill,.calc-chip,.v89-local-save-badge,.v89-selection-badge,.v89-work-badges span,.similarity-shared-words b
){
  background:var(--bayaan-surface-2)!important;
  color:var(--bayaan-link)!important;
  border:1px solid var(--bayaan-border-strong)!important;
}
html[data-bayaan-theme] :is(.eyebrow,.section-kicker,.analysis-rank){color:var(--bayaan-emphasis)!important}
html[data-bayaan-theme] :is(table,.data-table,.analysis-table,.v90-table,.v90c-table){
  background:var(--bayaan-surface)!important;color:var(--bayaan-text)!important;border-color:var(--bayaan-border)!important
}
html[data-bayaan-theme] :is(table,.data-table,.analysis-table,.v90-table,.v90c-table) th{
  background:var(--bayaan-surface-2)!important;color:var(--bayaan-text)!important;border-color:var(--bayaan-border)!important
}
html[data-bayaan-theme] :is(table,.data-table,.analysis-table,.v90-table,.v90c-table) td{color:var(--bayaan-text)!important;border-color:var(--bayaan-border)!important}
html[data-bayaan-theme] :is(table,.data-table,.analysis-table,.v90-table,.v90c-table) tbody tr:nth-child(even) td{background:color-mix(in srgb,var(--bayaan-surface-2) 44%,var(--bayaan-surface))!important}
html[data-bayaan-theme] :is(table,.data-table,.analysis-table,.v90-table,.v90c-table) tr:hover td{background:var(--bayaan-surface-2)!important}

/* ---------- 8. Héros, Research OS et zones sombres ---------- */
html[data-bayaan-theme] :is(#compareView .hero,.app-shell>.hero,.hero:not(.hero-card),.v100-os>summary,.v100-publication){
  background:linear-gradient(135deg,var(--bayaan-hero-a),var(--bayaan-hero-b))!important;
  color:var(--bayaan-hero-text)!important;border-color:var(--bayaan-border-strong)!important
}
html[data-bayaan-theme] :is(#compareView .hero,.app-shell>.hero,.hero:not(.hero-card),.v100-os>summary,.v100-publication) :is(h1,h2,h3,h4,strong){color:var(--bayaan-hero-text)!important}
html[data-bayaan-theme] :is(#compareView .hero,.app-shell>.hero,.hero:not(.hero-card),.v100-os>summary,.v100-publication) :is(p,small){color:var(--bayaan-hero-muted)!important}
html[data-bayaan-theme] .hero-script :is(span,i,b,em){color:var(--bayaan-gold)!important}
html[data-bayaan-theme="pastel"] :is(#compareView .hero,.app-shell>.hero,.hero:not(.hero-card)){
  border:1px solid var(--bayaan-border-strong)!important
}
html[data-bayaan-theme] .v100-pub-actions button{
  background:color-mix(in srgb,var(--bayaan-hero-text) 14%,transparent)!important;
  color:var(--bayaan-hero-text)!important;border-color:color-mix(in srgb,var(--bayaan-hero-text) 45%,transparent)!important
}
html[data-bayaan-theme] .v100-hero-open{border-color:color-mix(in srgb,var(--bayaan-hero-text) 50%,transparent)!important;color:var(--bayaan-hero-text)!important}
html[data-bayaan-theme] .v100-hero-open>span{color:var(--bayaan-gold)!important}
html[data-bayaan-theme] .v100-hero-open small{color:var(--bayaan-hero-muted)!important}

/* ---------- 9. Notes, alertes et statuts sémantiques ---------- */
html[data-bayaan-theme] :is(.status-success,.success,.v100-level.donnee,.v100-level.donnée){background:var(--bayaan-success-bg)!important;color:var(--bayaan-success-text)!important;border-color:var(--bayaan-success-text)!important}
html[data-bayaan-theme] :is(.status-info,.info,.v100-level.calcul){background:var(--bayaan-info-bg)!important;color:var(--bayaan-info-text)!important;border-color:var(--bayaan-info-text)!important}
html[data-bayaan-theme] :is(.status-warning,.warning,.v100-level.hypothese,.v100-level.hypothèse){background:var(--bayaan-warning-bg)!important;color:var(--bayaan-warning-text)!important;border-color:var(--bayaan-warning-text)!important}
html[data-bayaan-theme] :is(.status-danger,.danger,.danger-soft-button){background:var(--bayaan-danger-bg)!important;color:var(--bayaan-danger-text)!important;border-color:var(--bayaan-danger-text)!important}
html[data-bayaan-theme] mark{background:var(--bayaan-warning-bg)!important;color:var(--bayaan-warning-text)!important;border-radius:.22em;padding:.05em .16em}
html[data-bayaan-theme] .v100-ms-diff del{background:var(--bayaan-danger-bg)!important;color:var(--bayaan-danger-text)!important}
html[data-bayaan-theme] .v100-ms-diff ins{background:var(--bayaan-success-bg)!important;color:var(--bayaan-success-text)!important}

/* ---------- 10. Modules historiques explicitement normalisés ---------- */
html[data-bayaan-theme] :is(.critical-source b,.critical-status strong,.critical-parallel>summary,.critical-status-grid b,
  .research-sources-panel>summary,.research-source-card dd,.v8-note-tokens h4,.v8-token-inspector details summary,
  .advanced-query-builder>summary,.adv-why>summary,.verse-similarity-search>summary,.similarity-result-group-title strong,
  .similarity-reference-preview>div strong){color:var(--bayaan-text)!important}
html[data-bayaan-theme] :is(.critical-source p,.critical-status p,.critical-empty p,.critical-witness p,.critical-status-grid span,
  .research-source-card dt,.research-source-card p,.v8-note-tokens>header>span,.advanced-query-builder>summary small,
  .adv-toolbar label,.adv-range label,.adv-why>summary span,.verse-similarity-search summary small,.verse-similarity-note,
  .similarity-result-group-title small,.similarity-reference-preview>div,.similarity-reference-preview #similarityReferenceFrench,
  .similarity-shared-panel>span){color:var(--bayaan-muted)!important}
html[data-bayaan-theme] .advanced-query-builder[open]>summary{background:var(--bayaan-surface-2)!important;border-color:var(--bayaan-border)!important}
html[data-bayaan-theme] .adv-method-note{background:var(--bayaan-info-bg)!important;color:var(--bayaan-info-text)!important;border:1px solid var(--bayaan-info-text)!important}
html[data-bayaan-theme] .advanced-query-builder>summary em{color:var(--bayaan-emphasis)!important}

/* Recherche par fragment de verset */
html[data-bayaan-theme] .verse-similarity-icon{
  background:var(--bayaan-action-bg)!important;color:var(--bayaan-gold)!important;border:1px solid var(--bayaan-border-strong)!important
}
html[data-bayaan-theme] :is(.verse-similarity-chevron,.similarity-result-group-chevron){color:var(--bayaan-emphasis)!important}
html[data-bayaan-theme] .similarity-badge,
html[data-bayaan-theme] .similarity-result-group-count{
  background:var(--bayaan-action-bg)!important;color:var(--bayaan-action-text)!important;border:1px solid var(--bayaan-action-bg)!important
}
html[data-bayaan-theme] .similarity-reference-preview p[lang="ar"]{color:var(--bayaan-text)!important}
html[data-bayaan-theme] .similarity-result-group>summary:hover,
html[data-bayaan-theme] .verse-similarity-search>summary:hover{background:var(--bayaan-surface-2)!important}
html[data-bayaan-theme] .similarity-result-group-body{background:color-mix(in srgb,var(--bayaan-surface-2) 66%,var(--bayaan-surface))!important}

/* Évangiles / Torah / Peshitta */
html[data-bayaan-theme] :is(.check-row label,.copy-options label){background:var(--bayaan-surface-2)!important;color:var(--bayaan-text)!important;border:1px solid var(--bayaan-border)!important}
html[data-bayaan-theme] :is(.summary-note,.warning){border-color:var(--bayaan-warning-text)!important}
html[data-bayaan-theme] :is(.letter-card){background:var(--bayaan-surface)!important;border-color:var(--bayaan-border)!important;color:var(--bayaan-text)!important}
html[data-bayaan-theme] :is(.chapter-title,.reader-head){color:var(--bayaan-text)!important}
html[data-bayaan-theme] :is(.syriac,.hebrew,.greek,.arabic,.arabic-verse,.v7-note-original,.v7-arabic,.v100-original){color:var(--bayaan-text)!important}

/* ---------- 11. Graphiques : couleurs lisibles dans les 4 thèmes ---------- */
html[data-bayaan-theme] .analysis-bar-track,
html[data-bayaan-theme] .bar,
html[data-bayaan-theme] .progress-track{background:var(--bayaan-surface-3)!important;border:1px solid var(--bayaan-border)!important}
html[data-bayaan-theme] .analysis-bar-track i,
html[data-bayaan-theme] .bar i,
html[data-bayaan-theme] .progress-fill{background:linear-gradient(90deg,var(--bayaan-action-bg),var(--bayaan-gold))!important}
html[data-bayaan-theme] .chart-axis{stroke:var(--bayaan-border-strong)!important;stroke-width:1.5!important}
html[data-bayaan-theme] .chart-line{stroke:var(--bayaan-accent)!important;stroke-width:3!important}
html[data-bayaan-theme] .chart-point{fill:var(--bayaan-gold)!important;stroke:var(--bayaan-surface)!important;stroke-width:2!important}
html[data-bayaan-theme] .network-edge{stroke:var(--bayaan-border-strong)!important;opacity:.72!important}
html[data-bayaan-theme] .semantic-edge{stroke:var(--bayaan-gold)!important;opacity:.7!important}
html[data-bayaan-theme] .network-node circle{fill:var(--bayaan-surface)!important;stroke:var(--bayaan-accent)!important;stroke-width:2.5!important}
html[data-bayaan-theme] .network-node text{fill:var(--bayaan-text)!important}
html[data-bayaan-theme] .semantic-node circle{fill:var(--bayaan-warning-bg)!important;stroke:var(--bayaan-gold)!important}
html[data-bayaan-theme] .ring-score{background:var(--bayaan-surface-2)!important;border:1px solid var(--bayaan-border)!important}
html[data-bayaan-theme] .ring-score strong{color:var(--bayaan-link)!important}
html[data-bayaan-theme] .ring-score span{color:var(--bayaan-muted)!important}
html[data-bayaan-theme] .ring-pair{border-color:var(--bayaan-border)!important;background:var(--bayaan-surface)!important}
html[data-bayaan-theme] .ring-pair>span{background:var(--bayaan-action-bg)!important;color:var(--bayaan-action-text)!important}
html[data-bayaan-theme] .ring-pair i{color:var(--bayaan-emphasis)!important}

/* ---------- 12. Menus, modales, toast, info-bulles ---------- */
html[data-bayaan-theme] :is(.modal,.popover,.tooltip,.word-tooltip){color:var(--bayaan-text)!important}
html[data-bayaan-theme] :is(.modal-card,.options-menu,.options-popover,.action-menu,.word-tooltip){
  background:var(--bayaan-surface)!important;border-color:var(--bayaan-border-strong)!important;color:var(--bayaan-text)!important
}
html[data-bayaan-theme] :is(.toast,.embed-toolbar,.sources-note){
  background:var(--bayaan-nav-bg)!important;color:var(--bayaan-nav-text)!important;border-color:var(--bayaan-nav-border)!important
}
html[data-bayaan-theme] :is(.toast,.embed-toolbar,.sources-note) :is(small,p){color:var(--bayaan-nav-muted)!important}
html[data-bayaan-theme] .modal-close{background:var(--bayaan-surface-2)!important;color:var(--bayaan-text)!important;border:1px solid var(--bayaan-border)!important}

/* ---------- 13. Mode Focus : bouton toujours lisible ---------- */
html[data-bayaan-theme] .airy-focus-toggle{
  background:var(--bayaan-surface)!important;color:var(--bayaan-text)!important;border:1px solid var(--bayaan-border-strong)!important
}
html[data-bayaan-theme] .airy-focus-toggle .airy-focus-dot{background:var(--bayaan-muted)!important}
html[data-bayaan-theme] .airy-focus-toggle[aria-pressed="true"]{
  background:var(--bayaan-action-bg)!important;color:var(--bayaan-action-text)!important;border-color:var(--bayaan-action-bg)!important
}
html[data-bayaan-theme] .airy-focus-toggle[aria-pressed="true"] .airy-focus-dot{background:var(--bayaan-gold)!important}

/* ---------- 14. Ne jamais utiliser l'opacité pour rendre du texte "secondaire" ---------- */
html[data-bayaan-theme] :is(.muted,.meta,.caption,.description,.hint,.help,small){opacity:1}

/* ---------- 15. Scrollbars et indicateurs ---------- */
html[data-bayaan-theme] *{scrollbar-color:var(--bayaan-border-strong) var(--bayaan-surface-2)}
html[data-bayaan-theme] .scroll-top{background:var(--bayaan-action-bg)!important;color:var(--bayaan-action-text)!important;border:1px solid var(--bayaan-action-bg)!important}

@media (prefers-contrast:more){
  html[data-bayaan-theme]{--bayaan-border:var(--bayaan-border-strong)}
  html[data-bayaan-theme] :is(.panel,.card,.verse-card,.result-card,input,select,textarea,button){border-width:2px!important}
}
@media (prefers-reduced-motion:reduce){
  html[data-bayaan-theme] *,html[data-bayaan-theme] *::before,html[data-bayaan-theme] *::after{scroll-behavior:auto!important;transition:none!important;animation-duration:.001ms!important;animation-iteration-count:1!important}
}

/* ---------- 16. Sélections spécialisées et lecteurs ---------- */
html[data-bayaan-theme] :is(.gospel-picker,.gospel-tabs){
  background:var(--bayaan-surface-2)!important;border:1px solid var(--bayaan-border)!important
}
html[data-bayaan-theme] :is(.gospel-picker button,.gospel-tab){
  background:var(--bayaan-surface)!important;color:var(--bayaan-text)!important;border:1px solid var(--bayaan-border)!important
}
html[data-bayaan-theme] :is(.gospel-picker button,.gospel-tab):hover{
  background:var(--bayaan-surface-3)!important;border-color:var(--bayaan-border-strong)!important;color:var(--bayaan-text)!important
}
html[data-bayaan-theme] :is(.gospel-picker button.active,.gospel-tab.active){
  background:var(--bayaan-action-bg)!important;color:var(--bayaan-action-text)!important;border-color:var(--bayaan-action-bg)!important;
  box-shadow:0 0 0 2px var(--bayaan-bg)!important
}
html[data-bayaan-theme] :is(.gospel-picker button.active,.gospel-tab.active) :is(span,b){color:var(--bayaan-action-text)!important;opacity:1!important}

html[data-bayaan-theme] :is(.v7-note-list-item.active,.v100-hyp-list button.active){
  background:var(--bayaan-selection)!important;color:var(--bayaan-text)!important;border:2px solid var(--bayaan-focus)!important;
  box-shadow:none!important
}
html[data-bayaan-theme] :is(.audio-dock){
  background:var(--bayaan-nav-bg)!important;color:var(--bayaan-nav-text)!important;border:1px solid var(--bayaan-nav-border)!important
}
html[data-bayaan-theme] .audio-dock small{color:var(--bayaan-nav-muted)!important;opacity:1!important}

/* Les labels interactifs ne doivent jamais redevenir gris trop clair. */
html[data-bayaan-theme] :is(.filters label,.toolbar label,.section-head>label,.control label,.field label,.adv-toolbar label,.adv-range label){color:var(--bayaan-muted)!important}

/* Séparateurs structurels visibles. */
html[data-bayaan-theme] :is(.section-head,.analysis-card-heading,.result-card header,.v100-result-card header,.v7-note-passages,.v7-note-formatbar){border-color:var(--bayaan-border)!important}

/* ---------- 17. Texte sémantique : neutraliser les anciennes couleurs codées en dur ---------- */
html[data-bayaan-theme] :is(h1,h2,h3,h4,h5,h6,p,li,dt,dd,legend,label,strong,b){color:inherit!important}
html[data-bayaan-theme] small{color:var(--bayaan-muted)!important;opacity:1!important}
html[data-bayaan-theme] :is(.topbar,.hero,.v100-os>summary,.v100-publication,.critical-head,.reading-dialog-header,.audio-dock) small{color:inherit!important}
html[data-bayaan-theme] :is(.topbar,.hero,.v100-os>summary,.v100-publication,.critical-head,.reading-dialog-header,.audio-dock) :is(h1,h2,h3,h4,h5,h6,p,strong,b){color:inherit!important}

/* Appareil critique : le bandeau garde une vraie rupture visuelle. */
html[data-bayaan-theme] .critical-head{
  background:linear-gradient(135deg,var(--bayaan-hero-a),var(--bayaan-hero-b))!important;
  color:var(--bayaan-hero-text)!important;border-color:var(--bayaan-border-strong)!important
}
html[data-bayaan-theme] .critical-head span{color:var(--bayaan-gold)!important}
html[data-bayaan-theme] .critical-head small{color:var(--bayaan-hero-muted)!important}
html[data-bayaan-theme] .critical-close{background:transparent!important;color:var(--bayaan-hero-text)!important;border-color:color-mix(in srgb,var(--bayaan-hero-text) 55%,transparent)!important}
html[data-bayaan-theme] :is(.critical-reading,.critical-parallel){background:var(--bayaan-surface)!important;color:var(--bayaan-text)!important;border-color:var(--bayaan-border)!important}
html[data-bayaan-theme] .critical-reading>span{background:var(--bayaan-surface-2)!important;color:var(--bayaan-emphasis)!important;border:1px solid var(--bayaan-border)!important}
html[data-bayaan-theme] :is(.critical-reading b,.critical-reading small,.critical-witness>span){color:var(--bayaan-muted)!important}
html[data-bayaan-theme] .critical-source a{background:var(--bayaan-surface-2)!important;color:var(--bayaan-link)!important;border:1px solid var(--bayaan-border)!important}

/* Laboratoire comparatif (v90c). */
html[data-bayaan-theme] .v90c-lab{background:var(--bayaan-surface)!important;color:var(--bayaan-text)!important;border-color:var(--bayaan-border)!important}
html[data-bayaan-theme] .v90c-lab>summary{background:var(--bayaan-surface-2)!important;color:var(--bayaan-text)!important;border-color:var(--bayaan-border)!important}
html[data-bayaan-theme] .v90c-lab>summary small{color:var(--bayaan-muted)!important}
html[data-bayaan-theme] .v90c-lab>summary em{color:var(--bayaan-emphasis)!important;border-color:var(--bayaan-border-strong)!important}
html[data-bayaan-theme] .v90c-tabs{background:var(--bayaan-surface-2)!important;border:1px solid var(--bayaan-border)!important}
html[data-bayaan-theme] :is(.v90c-panel,.v90c-card,.v90c-graph,.v90c-saved article,#v90cSaved article,.v90c-corpus-bars article){background:var(--bayaan-surface)!important;color:var(--bayaan-text)!important;border-color:var(--bayaan-border)!important}
html[data-bayaan-theme] .v90c-score span,
html[data-bayaan-theme] :is(.v90c-align-col+section span,#v90cAlignmentLinks span){background:var(--bayaan-surface-2)!important;color:var(--bayaan-text)!important;border:1px solid var(--bayaan-border)!important}
html[data-bayaan-theme] .v90c-align-col button.selected{background:var(--bayaan-action-bg)!important;color:var(--bayaan-action-text)!important;border-color:var(--bayaan-action-bg)!important}
html[data-bayaan-theme] .v90c-graph line{stroke:var(--bayaan-border-strong)!important}
html[data-bayaan-theme] .v90c-graph circle{fill:var(--bayaan-surface-2)!important;stroke:var(--bayaan-accent)!important}
html[data-bayaan-theme] .v90c-graph text{fill:var(--bayaan-text)!important}
html[data-bayaan-theme] .v90c-graph line+text{fill:var(--bayaan-emphasis)!important}
html[data-bayaan-theme] .v90c-corpus-bars i{background:var(--bayaan-surface-3)!important}
html[data-bayaan-theme] .v90c-corpus-bars i b{background:var(--bayaan-action-bg)!important}

/* Laboratoire coranique v90. */
html[data-bayaan-theme] #v90ResearchLab,
html[data-bayaan-theme] :is(.v90-tool-panel,.v90-empty,.v90-result-summary,.v90-result-card,.v90-two-col article,.v90-timeline,.v90-group-compare article,.v90-entity-grid article,.v90-graph,.v90-saved article){
  background:var(--bayaan-surface)!important;color:var(--bayaan-text)!important;border-color:var(--bayaan-border)!important
}
html[data-bayaan-theme] .v90-tabs{background:var(--bayaan-surface-2)!important;border:1px solid var(--bayaan-border)!important}
html[data-bayaan-theme] :is(.v90-result-card details,.v90-neighbors span,.v90-score-grid span){background:var(--bayaan-surface-2)!important;color:var(--bayaan-text)!important}
html[data-bayaan-theme] .v90-reference{background:var(--bayaan-nav-bg)!important;color:var(--bayaan-nav-text)!important;border:1px solid var(--bayaan-nav-border)!important}
html[data-bayaan-theme] .v90-reference p{color:var(--bayaan-nav-text)!important}
html[data-bayaan-theme] .v90-kwic strong{background:var(--bayaan-warning-bg)!important;color:var(--bayaan-warning-text)!important}
html[data-bayaan-theme] .v90-distribution i,.v100-bars i{background:var(--bayaan-surface-3)!important;border:1px solid var(--bayaan-border)!important}
html[data-bayaan-theme] .v90-distribution b,.v100-bars i b{background:var(--bayaan-action-bg)!important}
html[data-bayaan-theme] .v90-graph line{stroke:var(--bayaan-border-strong)!important}
html[data-bayaan-theme] .v90-graph circle{fill:var(--bayaan-surface-2)!important;stroke:var(--bayaan-accent)!important}
html[data-bayaan-theme] .v90-graph text{fill:var(--bayaan-text)!important}
html[data-bayaan-theme] .v90-graph text.count{fill:var(--bayaan-muted)!important}

/* ---------- 18. Tajwīd : couleurs distinctes + contrastes lisibles ---------- */
html[data-bayaan-theme="current"] :is(.tajweed-ham-wasl,.tajweed-lam-shamsiya),
html[data-bayaan-theme="pastel"] :is(.tajweed-ham-wasl,.tajweed-lam-shamsiya){color:#545a57!important;background:#e5e9e7!important}
html[data-bayaan-theme="current"] .tajweed-madd-normal,
html[data-bayaan-theme="pastel"] .tajweed-madd-normal{color:#145ca8!important;background:#e1ecf8!important}
html[data-bayaan-theme="current"] .tajweed-madd-permissible,
html[data-bayaan-theme="pastel"] .tajweed-madd-permissible{color:#3847a8!important;background:#e5e7f8!important}
html[data-bayaan-theme="current"] .tajweed-madd-necessary,
html[data-bayaan-theme="pastel"] .tajweed-madd-necessary{color:#6c2e9b!important;background:#efe1f6!important}
html[data-bayaan-theme="current"] .tajweed-madd-obligatory,
html[data-bayaan-theme="pastel"] .tajweed-madd-obligatory{color:#7a267c!important;background:#f2e0f2!important}
html[data-bayaan-theme="current"] .tajweed-qalqalah,
html[data-bayaan-theme="pastel"] .tajweed-qalqalah{color:#a6221b!important;background:#f8e1df!important}
html[data-bayaan-theme="current"] :is(.tajweed-ikhfa,.tajweed-ikhfa-shafawi),
html[data-bayaan-theme="pastel"] :is(.tajweed-ikhfa,.tajweed-ikhfa-shafawi){color:#8a4b00!important;background:#f7e8d2!important}
html[data-bayaan-theme="current"] :is(.tajweed-idgham-shafawi,.tajweed-idgham-ghunnah,.tajweed-idgham-no-ghunnah,.tajweed-idgham-mutajanisayn,.tajweed-idgham-mutaqaribayn),
html[data-bayaan-theme="pastel"] :is(.tajweed-idgham-shafawi,.tajweed-idgham-ghunnah,.tajweed-idgham-no-ghunnah,.tajweed-idgham-mutajanisayn,.tajweed-idgham-mutaqaribayn){color:#0d6848!important;background:#dceee6!important}
html[data-bayaan-theme="current"] .tajweed-iqlab,
html[data-bayaan-theme="pastel"] .tajweed-iqlab{color:#00657a!important;background:#d9eef2!important}
html[data-bayaan-theme="current"] .tajweed-ghunnah,
html[data-bayaan-theme="pastel"] .tajweed-ghunnah{color:#086a3b!important;background:#ddeee4!important}

html[data-bayaan-theme="dark"] :is(.tajweed-ham-wasl,.tajweed-lam-shamsiya),
html[data-bayaan-theme="luxury"] :is(.tajweed-ham-wasl,.tajweed-lam-shamsiya){color:#d5ddd9!important;background:#29312e!important}
html[data-bayaan-theme="dark"] .tajweed-madd-normal,
html[data-bayaan-theme="luxury"] .tajweed-madd-normal{color:#8fc5ff!important;background:#162a3d!important}
html[data-bayaan-theme="dark"] .tajweed-madd-permissible,
html[data-bayaan-theme="luxury"] .tajweed-madd-permissible{color:#b5beff!important;background:#222847!important}
html[data-bayaan-theme="dark"] .tajweed-madd-necessary,
html[data-bayaan-theme="luxury"] .tajweed-madd-necessary{color:#d7a8f5!important;background:#33203e!important}
html[data-bayaan-theme="dark"] .tajweed-madd-obligatory,
html[data-bayaan-theme="luxury"] .tajweed-madd-obligatory{color:#f1a7ec!important;background:#3c1f3b!important}
html[data-bayaan-theme="dark"] .tajweed-qalqalah,
html[data-bayaan-theme="luxury"] .tajweed-qalqalah{color:#ff9c94!important;background:#40201d!important}
html[data-bayaan-theme="dark"] :is(.tajweed-ikhfa,.tajweed-ikhfa-shafawi),
html[data-bayaan-theme="luxury"] :is(.tajweed-ikhfa,.tajweed-ikhfa-shafawi){color:#ffd08a!important;background:#3b2a14!important}
html[data-bayaan-theme="dark"] :is(.tajweed-idgham-shafawi,.tajweed-idgham-ghunnah,.tajweed-idgham-no-ghunnah,.tajweed-idgham-mutajanisayn,.tajweed-idgham-mutaqaribayn),
html[data-bayaan-theme="luxury"] :is(.tajweed-idgham-shafawi,.tajweed-idgham-ghunnah,.tajweed-idgham-no-ghunnah,.tajweed-idgham-mutajanisayn,.tajweed-idgham-mutaqaribayn){color:#8ce3bd!important;background:#173428!important}
html[data-bayaan-theme="dark"] .tajweed-iqlab,
html[data-bayaan-theme="luxury"] .tajweed-iqlab{color:#7fe2f5!important;background:#15323a!important}
html[data-bayaan-theme="dark"] .tajweed-ghunnah,
html[data-bayaan-theme="luxury"] .tajweed-ghunnah{color:#83e0aa!important;background:#173423!important}
html[data-bayaan-theme] .tajweed-token{border-radius:.2em;box-decoration-break:clone;-webkit-box-decoration-break:clone}

/* ========================================================================== 
   Bayān 10.10 — SYSTÈME DE THÈME CONSOLIDÉ
   Une seule couche finale pour tout Bayān.
   Règle stricte : clair = surfaces claires / texte foncé ; sombre = surfaces
   sombres / texte clair. Aucun composant historique ne conserve son ancien
   blanc/vert/bordeaux hors de cette logique.
   ========================================================================== */

/* --- 10.10 palettes finales ------------------------------------------------ */
:root,
html[data-bayaan-theme="current"]{
  color-scheme:light;
  --bayaan-bg:#f4f1ea;
  --bayaan-surface:#fffdf8;
  --bayaan-surface-2:#ece8df;
  --bayaan-surface-3:#ded8cc;
  --bayaan-field:#ffffff;
  --bayaan-text:#17231f;
  --bayaan-muted:#4c5b55;
  --bayaan-border:#7f8d86;
  --bayaan-border-strong:#596860;
  --bayaan-accent:#0f5c4a;
  --bayaan-accent-2:#0a4035;
  --bayaan-link:#0d5848;
  --bayaan-gold:#8a5b14;
  --bayaan-emphasis:#805311;
  --bayaan-action-bg:#0f5c4a;
  --bayaan-action-text:#ffffff;
  --bayaan-action-hover:#0a4337;
  --bayaan-focus:#9c6200;
  --bayaan-selection:#dceee7;
  --bayaan-shadow:0 16px 38px rgba(23,35,31,.12);
  --bayaan-nav-bg:#fffdf8;
  --bayaan-nav-text:#17231f;
  --bayaan-nav-muted:#4c5b55;
  --bayaan-nav-border:#7f8d86;
  --bayaan-nav-active-bg:#dceee7;
  --bayaan-nav-active-text:#0a4035;
  --bayaan-hero-a:#fffdf8;
  --bayaan-hero-b:#e6eee9;
  --bayaan-hero-text:#17231f;
  --bayaan-hero-muted:#4c5b55;
  --bayaan-info-bg:#e0edf2;--bayaan-info-text:#173d4a;
  --bayaan-success-bg:#e1eee6;--bayaan-success-text:#1d4933;
  --bayaan-warning-bg:#f6e5c4;--bayaan-warning-text:#5f3d08;
  --bayaan-danger-bg:#f3dde2;--bayaan-danger-text:#702636;
  --bayaan-highlight-bg:#f6c94d;
  --bayaan-highlight-text:#1a1304;
  --bayaan-highlight-border:#9b6500;
}
html[data-bayaan-theme="pastel"]{
  color-scheme:light;
  --bayaan-bg:#f8f1f4;
  --bayaan-surface:#fffafd;
  --bayaan-surface-2:#f0e1e8;
  --bayaan-surface-3:#e1ced7;
  --bayaan-field:#fffefe;
  --bayaan-text:#30242a;
  --bayaan-muted:#66545d;
  --bayaan-border:#9b818d;
  --bayaan-border-strong:#735e68;
  --bayaan-accent:#704d60;
  --bayaan-accent-2:#4d3441;
  --bayaan-link:#654555;
  --bayaan-gold:#7a541c;
  --bayaan-emphasis:#76511f;
  --bayaan-action-bg:#704d60;
  --bayaan-action-text:#ffffff;
  --bayaan-action-hover:#543947;
  --bayaan-focus:#8a4661;
  --bayaan-selection:#ead6df;
  --bayaan-shadow:0 16px 40px rgba(69,45,56,.13);
  --bayaan-nav-bg:#fffafd;
  --bayaan-nav-text:#30242a;
  --bayaan-nav-muted:#66545d;
  --bayaan-nav-border:#9b818d;
  --bayaan-nav-active-bg:#ead6df;
  --bayaan-nav-active-text:#402d36;
  --bayaan-hero-a:#fffafd;
  --bayaan-hero-b:#f0e2e8;
  --bayaan-hero-text:#30242a;
  --bayaan-hero-muted:#66545d;
  --bayaan-info-bg:#e7edf4;--bayaan-info-text:#345064;
  --bayaan-success-bg:#e5eee8;--bayaan-success-text:#365244;
  --bayaan-warning-bg:#f3e4c9;--bayaan-warning-text:#65451c;
  --bayaan-danger-bg:#f1dfe5;--bayaan-danger-text:#713746;
  --bayaan-highlight-bg:#f5c84a;
  --bayaan-highlight-text:#1a1203;
  --bayaan-highlight-border:#956000;
}
html[data-bayaan-theme="dark"]{
  color-scheme:dark;
  --bayaan-bg:#07100d;
  --bayaan-surface:#0f1a16;
  --bayaan-surface-2:#182722;
  --bayaan-surface-3:#23372f;
  --bayaan-field:#0b1512;
  --bayaan-text:#f5faf7;
  --bayaan-muted:#bed0c8;
  --bayaan-border:#667b72;
  --bayaan-border-strong:#8ca096;
  --bayaan-accent:#73d4b6;
  --bayaan-accent-2:#a9e8d5;
  --bayaan-link:#9de4cf;
  --bayaan-gold:#efcb80;
  --bayaan-emphasis:#efcb80;
  --bayaan-action-bg:#73d4b6;
  --bayaan-action-text:#082219;
  --bayaan-action-hover:#9ae4ce;
  --bayaan-focus:#f0cc80;
  --bayaan-selection:#285344;
  --bayaan-shadow:0 18px 48px rgba(0,0,0,.52);
  --bayaan-nav-bg:#09130f;
  --bayaan-nav-text:#f7fcf9;
  --bayaan-nav-muted:#bed0c8;
  --bayaan-nav-border:#667b72;
  --bayaan-nav-active-bg:#73d4b6;
  --bayaan-nav-active-text:#082219;
  --bayaan-hero-a:#0a1511;
  --bayaan-hero-b:#172a22;
  --bayaan-hero-text:#f5faf7;
  --bayaan-hero-muted:#bed0c8;
  --bayaan-info-bg:#19303a;--bayaan-info-text:#cbeaf7;
  --bayaan-success-bg:#193126;--bayaan-success-text:#c8ecd7;
  --bayaan-warning-bg:#382b15;--bayaan-warning-text:#f5daa2;
  --bayaan-danger-bg:#3a1d25;--bayaan-danger-text:#f7c6d0;
  --bayaan-highlight-bg:#f0c44f;
  --bayaan-highlight-text:#181000;
  --bayaan-highlight-border:#ffe29a;
}
html[data-bayaan-theme="luxury"]{
  color-scheme:dark;
  --bayaan-bg:#07090d;
  --bayaan-surface:#0d1118;
  --bayaan-surface-2:#141a23;
  --bayaan-surface-3:#1c2532;
  --bayaan-field:#0a0e14;
  --bayaan-text:#f7f1e8;
  --bayaan-muted:#c7bba9;
  --bayaan-border:#6e5a3b;
  --bayaan-border-strong:#9d8255;
  --bayaan-accent:#d2b26f;
  --bayaan-accent-2:#f0d9a5;
  --bayaan-link:#e9d0a0;
  --bayaan-gold:#d8b86e;
  --bayaan-emphasis:#d8b86e;
  --bayaan-action-bg:#d2b26f;
  --bayaan-action-text:#171208;
  --bayaan-action-hover:#e4c783;
  --bayaan-focus:#e3c57d;
  --bayaan-selection:#253149;
  --bayaan-shadow:0 22px 60px rgba(0,0,0,.62);
  --bayaan-nav-bg:#080b10;
  --bayaan-nav-text:#f8f2e9;
  --bayaan-nav-muted:#c8bdad;
  --bayaan-nav-border:#6e5a3b;
  --bayaan-nav-active-bg:#d2b26f;
  --bayaan-nav-active-text:#171208;
  --bayaan-hero-a:#080b11;
  --bayaan-hero-b:#111a27;
  --bayaan-hero-text:#f8f2e9;
  --bayaan-hero-muted:#c8bdad;
  --bayaan-info-bg:#152235;--bayaan-info-text:#d7e4f5;
  --bayaan-success-bg:#17271f;--bayaan-success-text:#d2eadb;
  --bayaan-warning-bg:#302512;--bayaan-warning-text:#f0d49d;
  --bayaan-danger-bg:#321a20;--bayaan-danger-text:#f0c4cc;
  --bayaan-highlight-bg:#e0b84c;
  --bayaan-highlight-text:#171106;
  --bayaan-highlight-border:#f1d48a;
}

/* --- 10.10 héritage et arrière-plan : aucune bande hors thème ------------- */
html[data-bayaan-theme],
html[data-bayaan-theme] body,
html[data-bayaan-theme] .app-shell,
html[data-bayaan-theme] main,
html[data-bayaan-theme] .embedded-view{
  background-color:var(--bayaan-bg)!important;
  color:var(--bayaan-text)!important;
}
html[data-bayaan-theme] body{background-image:none!important}
html[data-bayaan-theme] .embedded-view iframe{background:var(--bayaan-bg)!important}
html[data-bayaan-theme="luxury"],html[data-bayaan-theme="luxury"] body{
  background-color:#07090d!important;
  background-image:
    radial-gradient(circle at 18% -10%,rgba(210,178,111,.10),transparent 31%),
    radial-gradient(circle at 91% 12%,rgba(43,67,105,.18),transparent 34%),
    linear-gradient(180deg,#07090d 0%,#090d14 48%,#07090d 100%)!important;
}

/* Legacy aliases are forced to the final semantic palette. */
html[data-bayaan-theme]{
  --ink:var(--bayaan-text)!important;--muted:var(--bayaan-muted)!important;--line:var(--bayaan-border)!important;
  --paper:var(--bayaan-surface)!important;--card:var(--bayaan-surface)!important;--panel:var(--bayaan-surface)!important;
  --cream:var(--bayaan-bg)!important;--bg:var(--bayaan-bg)!important;--header-bg:var(--bayaan-nav-bg)!important;
  --forest:var(--bayaan-accent)!important;--forest-2:var(--bayaan-accent-2)!important;
  --green:var(--bayaan-accent)!important;--green2:var(--bayaan-accent-2)!important;
  --blue:var(--bayaan-accent)!important;--blue2:var(--bayaan-accent-2)!important;
  --deep:var(--bayaan-accent)!important;--accent:var(--bayaan-accent)!important;--accent-dark:var(--bayaan-accent-2)!important;
  --gold:var(--bayaan-gold)!important;--gold-soft:var(--bayaan-highlight-bg)!important;
  --shadow:var(--bayaan-shadow)!important;
}

/* --- 10.10 navigation : même polarité que le thème ------------------------- */
html[data-bayaan-theme] :is(.topbar,.app-header){
  background:color-mix(in srgb,var(--bayaan-nav-bg) 97%,transparent)!important;
  color:var(--bayaan-nav-text)!important;
  border-color:var(--bayaan-nav-border)!important;
}
html[data-bayaan-theme] :is(.main-nav,.topbar nav){
  background:var(--bayaan-surface-2)!important;
  color:var(--bayaan-nav-text)!important;
  border-color:var(--bayaan-nav-border)!important;
}
html[data-bayaan-theme] :is(.nav-button,.nav-tab,.nav-btn){
  background:transparent!important;color:var(--bayaan-nav-muted)!important;border-color:transparent!important;
}
html[data-bayaan-theme] :is(.nav-button.active,.nav-tab.active,.nav-btn.active){
  background:var(--bayaan-nav-active-bg)!important;color:var(--bayaan-nav-active-text)!important;
  border-color:var(--bayaan-border-strong)!important;
}
html[data-bayaan-theme] .main-nav .nav-button .nav-icon{color:var(--bayaan-emphasis)!important}
html[data-bayaan-theme] .main-nav .nav-button.active .nav-icon{color:var(--bayaan-nav-active-text)!important}
html[data-bayaan-theme] :is(.brand,.brand strong,.brand small){color:var(--bayaan-nav-text)!important}
html[data-bayaan-theme] .brand-mark{
  background:var(--bayaan-surface-2)!important;color:var(--bayaan-accent)!important;border-color:var(--bayaan-nav-border)!important;
}

/* Mobile nav: neutralise le vert/jaune codé en dur de mobile-nav-v75. */
@media(max-width:900px){
  html[data-bayaan-theme] .topbar{background:var(--bayaan-nav-bg)!important;color:var(--bayaan-nav-text)!important}
  html[data-bayaan-theme] .main-nav{
    background:var(--bayaan-surface-2)!important;border-color:var(--bayaan-nav-border)!important;
    overflow:visible!important;grid-template-columns:repeat(6,minmax(0,1fr))!important;
  }
  html[data-bayaan-theme] .main-nav .nav-button{color:var(--bayaan-nav-muted)!important;background:transparent!important}
  html[data-bayaan-theme] .main-nav .nav-button.active{
    background:var(--bayaan-nav-active-bg)!important;color:var(--bayaan-nav-active-text)!important;
    box-shadow:inset 0 0 0 1px var(--bayaan-border-strong)!important;
  }
}
@media(max-width:360px){
  html[data-bayaan-theme] .main-nav{grid-template-columns:repeat(6,minmax(0,1fr))!important;overflow:visible!important}
}

/* --- 10.10 héros, page headers et SOURATE COMPLÈTE ------------------------ */
html[data-bayaan-theme] :is(
  .hero,.hero-card,.page-header,.surah-reader-header,.chapter-title,.v89-work-page-header,.method-header
){
  background:linear-gradient(135deg,var(--bayaan-hero-a),var(--bayaan-hero-b))!important;
  color:var(--bayaan-hero-text)!important;border-color:var(--bayaan-border-strong)!important;
}
html[data-bayaan-theme] :is(.hero,.hero-card,.page-header,.surah-reader-header,.chapter-title,.v89-work-page-header) :is(h1,h2,h3,strong,b){color:var(--bayaan-hero-text)!important}
html[data-bayaan-theme] :is(.hero,.hero-card,.page-header,.surah-reader-header,.chapter-title,.v89-work-page-header) p{color:var(--bayaan-hero-muted)!important}
html[data-bayaan-theme] :is(.hero,.hero-card,.page-header,.surah-reader-header,.chapter-title,.v89-work-page-header) :is(.eyebrow,.kicker,.overline){color:var(--bayaan-emphasis)!important}
html[data-bayaan-theme] .surah-reader-arabic{color:var(--bayaan-emphasis)!important;text-shadow:none!important}

/* --- 10.10 surfaces : inventaire des composants historiques --------------- */
html[data-bayaan-theme] :is(
  .panel,.card,.search-panel,.result-card,.summary-card,.verse-card,.reader-verse-card,.metric,.stat-card,
  .calculator-card,.breakdown-card,.table-card,.table-wrap,.method-card,.source-note,
  .term-profile,.term-profile-grid article,.word-profile,.word-profile-grid article,.occurrence-navigator,
  .root-family-overview,.root-family-card,.equivalent-overview,.equivalent-word-card,.matched-words-panel,.matched-word-chip,
  .similarity-reference-preview,.similarity-shared-panel,.verse-similarity-search,.similarity-result-group,
  .search-options-panel,.bulk-result-panel,.verse-options-panel,.reading-options-panel,.v89-work-options-panel,.v89-note-options-panel,
  .surah-reader-notice,.reading-launcher,.reader-head,.reader-toolbar,.history-bar,.reading-dialog,.audio-range-dialog,
  .copy-range-card,.multi-range-item,.fixed-rules-card,.letter-chip,.reference-cell,.numeric-controls,
  .v7-study-drawer,.v7-study-item,.v7-notes-sidebar,.v7-note-editor-shell,.v7-work-card,.v7-work-hero,.v7-work-section,
  .v7-note-list-item,.v7-note-verses,.v7-verse-picker,.v7-note-no-verses,.v7-lexicon-dialog,.v7-lex-context,
  .v7-word-card dl div,.v7-definition,.v7-online-definition,.v7-saved-searches,.v7-note-empty,
  .research-sources-panel,.research-source-card,.advanced-query-builder,.query-builder-card,.similarity-card,.lab-card,.research-lab-card,
  .v90-card,.v90-result-card,.v90-tool-panel,.v90-empty,.v90-result-summary,.v90-timeline,.v90-graph,
  .v90c-lab,.v90c-panel,.v90c-card,.v90c-graph,
  .v100-os,.v100-panel,.v100-result-card,.v100-graph-detail,.v100-evidence,.v100-versions,.v100-ms-image,.v100-ms-editor,
  .modal-card,.options-menu,.options-popover,.action-menu,.critical-apparatus-panel,.critical-loading,.critical-empty,.critical-source,.critical-witness,
  .gospel-picker button,.stats-grid article,.token-grid div,.lexicon-block
){
  background:var(--bayaan-surface)!important;
  color:var(--bayaan-text)!important;
  border-color:var(--bayaan-border)!important;
  text-shadow:none!important;
}

html[data-bayaan-theme] :is(
  .filters,.filter-bar,.controls,.control-bar,.search-control-group,.airy-disclosure,.airy-disclosure-body,
  .segmented-control,.reader-toolbar,.history-bar,.v7-rich-toolbar,.toolbar,.v7-tabs,.v90-tabs,.v90c-tabs,.v100-tabs,
  .verse-ref,.verse-head,.summary-note,.copy-options label,.calc-chip,.empty-state,.empty
){
  background:var(--bayaan-surface-2)!important;color:var(--bayaan-text)!important;border-color:var(--bayaan-border)!important;
}

/* Toute typographie dans une surface reste lisible, même si l'ancien CSS la forçait en blanc/vert pâle. */
html[data-bayaan-theme] :is(
  .stat-card,.term-profile,.term-profile-grid article,.word-profile,.word-profile-grid article,.matched-word-chip,.matched-words-panel,
  .verse-card,.reader-verse-card,.surah-reader-notice,.search-options-panel,.reading-options-panel,.verse-options-panel,
  .v7-match-explanation,.why,.adv-why,.metric,.summary-card,.panel,.card
) :is(h1,h2,h3,h4,h5,h6,strong,b,label,legend,dt,dd){color:var(--bayaan-text)!important}
html[data-bayaan-theme] :is(
  .stat-card,.term-profile,.term-profile-grid article,.word-profile,.word-profile-grid article,.matched-word-chip,.matched-words-panel,
  .verse-card,.reader-verse-card,.surah-reader-notice,.metric,.summary-card,.panel,.card
) :is(p,small,.meta,.description,.translation,.french,.french-verse,.translit){color:var(--bayaan-muted)!important}

/* --- 10.10 formulaires et boutons ----------------------------------------- */
html[data-bayaan-theme] :is(input,select,textarea,[contenteditable="true"]){
  background:var(--bayaan-field)!important;color:var(--bayaan-text)!important;border-color:var(--bayaan-border)!important;
}
html[data-bayaan-theme] :is(input,textarea)::placeholder{color:var(--bayaan-muted)!important;opacity:.88!important}
html[data-bayaan-theme] :is(
  .primary-button,.primary-btn,.action-primary,.play-surah-button,.audio-verse-button,.calculate-button
){background:var(--bayaan-action-bg)!important;color:var(--bayaan-action-text)!important;border-color:var(--bayaan-action-bg)!important}
html[data-bayaan-theme] :is(
  .secondary-button,.secondary-btn,.ghost-btn,.ghost-button,.icon-button,.result-action,.text-button,
  .v89-options>summary,.verse-actions button,.quick-searches button,.v7-rich-toolbar button,.v7-tabs button
){background:var(--bayaan-surface-2)!important;color:var(--bayaan-text)!important;border-color:var(--bayaan-border)!important}
html[data-bayaan-theme] :is(button,[role="button"],summary):focus-visible{
  outline:3px solid var(--bayaan-focus)!important;outline-offset:2px!important;
}
html[data-bayaan-theme] button:disabled{opacity:.65!important}

/* --- 10.10 POURQUOI CE RÉSULTAT : le fond remplit TOUT l'encadré ---------- */
html[data-bayaan-theme] :is(.v7-match-explanation,.why,.adv-why){
  background:var(--bayaan-surface-2)!important;color:var(--bayaan-text)!important;
  border:1px solid var(--bayaan-border-strong)!important;border-left:4px solid var(--bayaan-accent)!important;
  border-radius:14px!important;overflow:hidden!important;padding:0!important;
}
html[data-bayaan-theme] :is(.v7-match-explanation,.why,.adv-why)>summary{
  background:transparent!important;color:var(--bayaan-text)!important;
  padding:12px 14px!important;margin:0!important;border:0!important;
}
html[data-bayaan-theme] :is(.v7-match-explanation,.why,.adv-why)>summary span{
  display:inline-block!important;background:var(--bayaan-surface)!important;color:var(--bayaan-text)!important;
  border:1px solid var(--bayaan-border)!important;border-radius:999px!important;padding:4px 9px!important;opacity:1!important;
}
html[data-bayaan-theme] :is(.v7-match-explanation,.why,.adv-why)>ul,
html[data-bayaan-theme] :is(.v7-match-explanation,.why,.adv-why)>div{
  background:transparent!important;color:var(--bayaan-text)!important;padding:0 16px 14px!important;
}

/* --- 10.10 surlignage : fond or/jaune = texte TOUJOURS sombre ------------- */
html[data-bayaan-theme] :is(
  mark,.arabic-word.match,.hebrew-word.match,.syriac-word.match,.greek .tok.match,.match,
  .search-highlight,.match-highlight,.highlighted-word,.word-match,.selected-word
){
  background:var(--bayaan-highlight-bg)!important;color:var(--bayaan-highlight-text)!important;
  border-color:var(--bayaan-highlight-border)!important;text-shadow:none!important;
  box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--bayaan-highlight-border) 55%,transparent)!important;
}
html[data-bayaan-theme] :is(mark,.arabic-word.match,.hebrew-word.match,.syriac-word.match,.match) *{color:var(--bayaan-highlight-text)!important}

/* Notes : les couleurs de surlignage sont des surfaces claires, donc texte foncé fixe. */
html[data-bayaan-theme] :is(.v7-note-verse-card.highlight-yellow,.v7-note-passage.highlight-yellow){background:#fff0a8!important;color:#231900!important}
html[data-bayaan-theme] :is(.v7-note-verse-card.highlight-green,.v7-note-passage.highlight-green){background:#d9f0df!important;color:#13281c!important}
html[data-bayaan-theme] :is(.v7-note-verse-card.highlight-blue,.v7-note-passage.highlight-blue){background:#dbeaf8!important;color:#13232f!important}
html[data-bayaan-theme] :is(.v7-note-verse-card.highlight-rose,.v7-note-passage.highlight-rose){background:#f6dce4!important;color:#30151e!important}
html[data-bayaan-theme] :is(.v7-note-verse-card,.v7-note-passage)[class*="highlight-"] :is(p,strong,span,label,small){color:inherit!important}

/* --- 10.10 détails Mīzān --------------------------------------------------- */
html[data-bayaan-theme] .stat-card>span{color:var(--bayaan-muted)!important}
html[data-bayaan-theme] .stat-card>strong{color:var(--bayaan-accent)!important}
html[data-bayaan-theme] .stat-card>small{color:var(--bayaan-muted)!important}
html[data-bayaan-theme] .term-profile-grid article:first-child strong{color:var(--bayaan-accent)!important}
html[data-bayaan-theme] .term-profile-value{background:var(--bayaan-action-bg)!important;color:var(--bayaan-action-text)!important}
html[data-bayaan-theme] :is(.arabic-verse,.arabic,.hebrew,.syriac,.greek,.v7-arabic){color:var(--bayaan-text)!important}
html[data-bayaan-theme] :is(.french-verse,.translation,.french,.phonetic-verse,.translit){color:var(--bayaan-muted)!important}
html[data-bayaan-theme] .verse-ref strong,html[data-bayaan-theme] .surah-name{color:var(--bayaan-accent)!important}
html[data-bayaan-theme] .verse-ref span{color:var(--bayaan-muted)!important}
html[data-bayaan-theme] :is(.search-type-badge,.badge,.occurrence-badge,.selected-verse-badge){
  background:var(--bayaan-surface-2)!important;color:var(--bayaan-text)!important;border-color:var(--bayaan-border)!important;
}
html[data-bayaan-theme] :is(.numeric-controls,.fixed-rules-card,.surah-reader-notice,.warning){
  background:var(--bayaan-warning-bg)!important;color:var(--bayaan-warning-text)!important;border-color:var(--bayaan-border)!important;
}
html[data-bayaan-theme] :is(.numeric-controls,.fixed-rules-card,.surah-reader-notice,.warning) :is(p,span,strong,b,small){color:inherit!important}
html[data-bayaan-theme] .switch-ui{background:var(--bayaan-surface-3)!important;border:1px solid var(--bayaan-border)!important}
html[data-bayaan-theme] .switch-ui::after{background:var(--bayaan-surface)!important}
html[data-bayaan-theme] .switch-field input:checked + .switch-ui{background:var(--bayaan-accent)!important}

/* --- 10.10 stacking : aucun filtre/menu ne passe derrière la navigation --- */
:root{--mizan-topbar-height:78px}
.surah-toolbar{top:var(--mizan-topbar-height)!important;z-index:140!important}
#surahView{padding-top:68px!important}
html[data-bayaan-theme] .surah-toolbar{
  background:color-mix(in srgb,var(--bayaan-nav-bg) 97%,transparent)!important;
  color:var(--bayaan-nav-text)!important;border-color:var(--bayaan-nav-border)!important;
}
html[data-bayaan-theme] :is(
  .v89-options[open],.reading-options-menu[open],.verse-options-menu[open],.search-options-menu[open],.bulk-result-actions[open],
  .airy-disclosure[open]
){position:relative!important;z-index:1000!important;overflow:visible!important}
html[data-bayaan-theme] :is(
  .reading-options-panel,.verse-options-panel,.search-options-panel,.bulk-result-panel,.v89-work-options-panel,.v89-note-options-panel
){z-index:1001!important;box-shadow:0 20px 54px rgba(0,0,0,.28)!important}
html[data-bayaan-theme] .airy-disclosure-body{position:relative!important;z-index:1!important}
html[data-bayaan-theme] .theme-panel{z-index:100000!important}

/* Sticks liés au topbar : utiliser la hauteur réelle mesurée par JS. */
#researchWorkView .v7-tabs{top:calc(var(--mizan-topbar-height) + 8px)!important}
.v7-notes-sidebar{top:calc(var(--mizan-topbar-height) + 18px)!important}
.v7-rich-toolbar{top:calc(var(--mizan-topbar-height) + 54px)!important}

/* --- 10.10 Luxe : véritable identité obsidienne / bleu nuit / champagne ---- */
html[data-bayaan-theme="luxury"] :is(.topbar,.app-header){
  background:linear-gradient(180deg,rgba(8,11,16,.98),rgba(7,9,13,.98))!important;
  border-bottom:1px solid #6e5a3b!important;
  box-shadow:0 14px 42px rgba(0,0,0,.46)!important;
}
html[data-bayaan-theme="luxury"] :is(.hero,.hero-card,.page-header,.surah-reader-header,.chapter-title,.v89-work-page-header){
  background:
    radial-gradient(circle at 84% 8%,rgba(210,178,111,.16),transparent 28%),
    radial-gradient(circle at 10% 92%,rgba(35,56,91,.30),transparent 36%),
    linear-gradient(135deg,#080b11 0%,#101723 55%,#151f31 100%)!important;
  border:1px solid #80683f!important;
  box-shadow:0 26px 74px rgba(0,0,0,.60),inset 0 1px 0 rgba(240,217,165,.10)!important;
}
html[data-bayaan-theme="luxury"] :is(
  .panel,.card,.search-panel,.result-card,.summary-card,.verse-card,.reader-verse-card,.stat-card,.term-profile,
  .term-profile-grid article,.word-profile,.word-profile-grid article,.matched-words-panel,.matched-word-chip,
  .v100-panel,.v90-card,.v90-result-card,.v90c-card,.v7-work-card,.v7-note-editor-shell,.verse-options-panel,.reading-options-panel
){
  background:linear-gradient(155deg,#111722 0%,#0c1119 100%)!important;
  border-color:#6e5a3b!important;
  box-shadow:0 18px 46px rgba(0,0,0,.36),inset 0 1px 0 rgba(236,210,157,.055)!important;
}
html[data-bayaan-theme="luxury"] :is(.eyebrow,.kicker,.section-kicker,.overline,.matched-words-label,.stat-card>span){
  color:#d8b86e!important;letter-spacing:.12em
}
html[data-bayaan-theme="luxury"] :is(.primary-button,.primary-btn,.nav-tab.active,.nav-button.active,.term-profile-value){
  background:linear-gradient(180deg,#dec27f,#c7a65f)!important;color:#171208!important;
  border-color:#ead59f!important;box-shadow:0 8px 26px rgba(210,178,111,.17)!important;
}
html[data-bayaan-theme="luxury"] .brand-mark{
  background:linear-gradient(145deg,#162036,#0a0e15)!important;color:#e0c27d!important;border-color:#80683f!important;
}

/* --- 10.10 thème picker dans le viewport ---------------------------------- */
.theme-panel{
  position:fixed!important;right:auto!important;bottom:auto!important;
  width:min(360px,calc(100vw - 24px))!important;max-width:calc(100vw - 24px)!important;
  max-height:calc(100vh - 24px)!important;overflow:auto!important;overscroll-behavior:contain!important;
  background:var(--bayaan-surface)!important;color:var(--bayaan-text)!important;
  border:1px solid var(--bayaan-border-strong)!important;
}
.theme-choice{background:transparent!important;color:var(--bayaan-text)!important}
.theme-choice:hover,.theme-choice.active{background:var(--bayaan-surface-2)!important;color:var(--bayaan-text)!important}
.theme-choice strong{color:var(--bayaan-text)!important}.theme-choice small{color:var(--bayaan-muted)!important}

/* --- 10.10 préférence de contraste ---------------------------------------- */
@media(prefers-contrast:more){
  html[data-bayaan-theme] :is(.panel,.card,.verse-card,.stat-card,.metric,.airy-disclosure,input,select,textarea,button){border-width:2px!important}
  html[data-bayaan-theme] :is(.muted,.meta,small,.description){opacity:1!important}
}

/* ========================================================================== 
   Bayān 10.10.1 — audit final CSS / mobile / overlays
   ========================================================================== */

/* Toute la zone d'application reçoit le fond du thème : aucune bande résiduelle. */
html[data-bayaan-theme] :is(body,.app-shell,.view,.search-view,.reader-view,.research-work-view,#searchView,#surahView,#analysisView,#researchWorkView,.page-shell,.content-shell,.embedded-view){
  background:var(--bayaan-bg)!important;
  color:var(--bayaan-text)!important;
}

/* Les surfaces de contenu historiques suivent toutes la polarité du thème. */
html[data-bayaan-theme] :is(
  .search-stats,.stat-card,.term-profile,.term-profile-grid article,.term-profile-context,.matched-words-panel,.matched-word-chip,
  .occurrence-navigator,.occurrence-navigator-controls,.reading-launcher,.surah-reader-shell,.reader-verse-card,.verse-card,
  .verse-ref,.verse-content,.verse-actions,.v7-match-explanation,.v7-match-explanation>summary,.v7-match-explanation>ul,
  .search-options-panel,.reading-options-panel,.verse-options-panel,.bulk-result-panel,
  .v89-options>summary,.airy-disclosure,.airy-disclosure-body,.search-control-group,.filters-row,
  .copy-dialog,.verse-info-dialog,.v7-lexicon-dialog,.v7-lexicon-context,.v7-word-card dl div,.v7-online-definition,
  .analysis-card,.analysis-panel,.analysis-result,.analysis-section,.network-card,.frequency-card,.rhythm-card,.ring-card,
  .torah-card,.gospel-card,.chapter-card,.result-row,.result-block
){
  background-color:var(--bayaan-surface)!important;
  color:var(--bayaan-text)!important;
  border-color:var(--bayaan-border)!important;
}
html[data-bayaan-theme] :is(.filters-row,.search-control-group,.airy-disclosure-body,.term-profile-context,.verse-ref){
  background-color:var(--bayaan-surface-2)!important;
}

/* HERO sourate : jamais texte sombre sur fond sombre / inversement. */
html[data-bayaan-theme] .surah-reader-header{
  background:
    radial-gradient(circle at 83% 16%,color-mix(in srgb,var(--bayaan-gold) 16%,transparent),transparent 29%),
    linear-gradient(138deg,var(--bayaan-hero-a),var(--bayaan-hero-b))!important;
  color:var(--bayaan-hero-text)!important;
  border-color:var(--bayaan-border-strong)!important;
}
html[data-bayaan-theme] .surah-reader-header :is(h1,p){color:var(--bayaan-hero-text)!important}
html[data-bayaan-theme] .surah-reader-header p:last-child{color:var(--bayaan-hero-muted)!important;opacity:1!important}
html[data-bayaan-theme] .surah-reader-arabic{color:var(--bayaan-gold)!important;text-shadow:none!important}

/* Pourquoi ce résultat : le fond remplit l'encadré complet, badge compris. */
html[data-bayaan-theme] .v7-match-explanation{
  background:var(--bayaan-surface-2)!important;
  color:var(--bayaan-text)!important;
  border:1px solid var(--bayaan-border-strong)!important;
  border-left:5px solid var(--bayaan-accent)!important;
  padding:0!important;
  overflow:hidden!important;
}
html[data-bayaan-theme] .v7-match-explanation>summary{
  width:100%!important;
  box-sizing:border-box!important;
  background:var(--bayaan-surface-2)!important;
  color:var(--bayaan-text)!important;
  padding:12px 14px!important;
}
html[data-bayaan-theme] .v7-match-explanation>summary span{
  background:var(--bayaan-surface)!important;
  color:var(--bayaan-text)!important;
  border:1px solid var(--bayaan-border)!important;
  opacity:1!important;
}
html[data-bayaan-theme] .v7-match-explanation :is(ul,li,p,strong,small){color:var(--bayaan-text)!important}

/* Surlignage invariant : or clair + texte presque noir, y compris descendants. */
html[data-bayaan-theme] :is(mark,.match,.arabic-word.match,.hebrew-word.match,.syriac-word.match,.search-highlight,.match-highlight,.highlighted-word,.word-match,.selected-word){
  background:var(--bayaan-highlight-bg)!important;
  color:var(--bayaan-highlight-text)!important;
  border-color:var(--bayaan-highlight-border)!important;
  text-shadow:none!important;
  opacity:1!important;
}
html[data-bayaan-theme] :is(mark,.match,.arabic-word.match,.hebrew-word.match,.syriac-word.match,.search-highlight,.match-highlight,.highlighted-word,.word-match,.selected-word) *{
  color:var(--bayaan-highlight-text)!important;
  opacity:1!important;
}

/* Menus et filtres : au-dessus du contenu, jamais rognés. */
html[data-bayaan-theme] :is(.search-panel,.results-section,.results-list,.verse-card,.verse-actions,.surah-toolbar,.surah-toolbar-main,.v89-options,.reading-options-menu,.verse-options-menu,.search-options-menu,.airy-disclosure){overflow:visible!important}
html[data-bayaan-theme] :is(.v89-options[open],.reading-options-menu[open],.verse-options-menu[open],.search-options-menu[open],.airy-disclosure[open]){z-index:5000!important}
html[data-bayaan-theme] :is(.reading-options-panel,.verse-options-panel,.search-options-panel,.bulk-result-panel){
  background:var(--bayaan-surface)!important;
  color:var(--bayaan-text)!important;
  border:1px solid var(--bayaan-border-strong)!important;
  box-shadow:0 22px 60px rgba(0,0,0,.28)!important;
  z-index:5001!important;
}
html[data-bayaan-theme] :is(.reading-options-panel,.verse-options-panel,.search-options-panel,.bulk-result-panel) :is(label,span,strong,small,p){color:var(--bayaan-text)!important}
html[data-bayaan-theme] :is(.reading-options-panel,.verse-options-panel,.search-options-panel,.bulk-result-panel) :is(input,select,textarea){background:var(--bayaan-field)!important;color:var(--bayaan-text)!important}

/* Barre de lecture : sticky sous la vraie hauteur du header. Pas de contenu caché. */
:root{--mizan-topbar-height:78px}
#surahView{padding-top:0!important;overflow:visible!important}
.surah-toolbar{
  position:sticky!important;
  top:var(--mizan-topbar-height)!important;
  z-index:900!important;
  overflow:visible!important;
}
.topbar{z-index:1000!important}

/* Le sélecteur de thème reste toujours dans le viewport. */
.theme-panel{
  position:fixed!important;
  z-index:100000!important;
  max-width:calc(100vw - 24px)!important;
  max-height:calc(100vh - 24px)!important;
  overflow:auto!important;
}

/* Luxe : noir bleuté, champagne, or satiné, aucune surface blanche. */
html[data-bayaan-theme="luxury"]{
  --bayaan-bg:#05070b;
  --bayaan-surface:#0b0f16;
  --bayaan-surface-2:#111824;
  --bayaan-surface-3:#182334;
  --bayaan-field:#080c12;
  --bayaan-text:#f8f2e7;
  --bayaan-muted:#cabfae;
  --bayaan-border:#715d3e;
  --bayaan-border-strong:#a68a58;
  --bayaan-accent:#d8b96f;
  --bayaan-accent-2:#f0d9a3;
  --bayaan-link:#e7c986;
  --bayaan-gold:#e0bd6a;
  --bayaan-emphasis:#e0bd6a;
  --bayaan-action-bg:#d8b96f;
  --bayaan-action-text:#171208;
  --bayaan-action-hover:#efd28b;
  --bayaan-focus:#f0cf80;
  --bayaan-nav-bg:#06090e;
  --bayaan-nav-text:#fbf5ea;
  --bayaan-nav-muted:#c8bdab;
  --bayaan-nav-border:#715d3e;
  --bayaan-nav-active-bg:#d8b96f;
  --bayaan-nav-active-text:#171208;
  --bayaan-hero-a:#06090f;
  --bayaan-hero-b:#132035;
  --bayaan-hero-text:#fbf5ea;
  --bayaan-hero-muted:#cbbfae;
}
html[data-bayaan-theme="luxury"] body{
  background:
    radial-gradient(circle at 10% -10%,rgba(224,189,106,.09),transparent 28%),
    radial-gradient(circle at 90% 8%,rgba(38,66,111,.25),transparent 32%),
    linear-gradient(180deg,#05070b 0%,#080d15 52%,#05070b 100%)!important;
}
html[data-bayaan-theme="luxury"] :is(.panel,.card,.search-panel,.verse-card,.reader-verse-card,.stat-card,.term-profile,.term-profile-grid article,.matched-words-panel,.v7-match-explanation,.reading-options-panel,.verse-options-panel,.search-options-panel,.airy-disclosure,.airy-disclosure-body){
  background:linear-gradient(145deg,#101722 0%,#0a0f17 100%)!important;
  color:#f8f2e7!important;
  border-color:#715d3e!important;
  box-shadow:0 18px 46px rgba(0,0,0,.42),inset 0 1px 0 rgba(240,217,163,.07)!important;
}
html[data-bayaan-theme="luxury"] :is(.eyebrow,.kicker,.section-kicker,.overline,.matched-words-label,.stat-card>span){color:#e0bd6a!important}

/* Mobile : lisibilité et empilement. */
@media(max-width:900px){
  html[data-bayaan-theme] .topbar{z-index:1000!important}
  html[data-bayaan-theme] .main-nav{z-index:2!important}
  html[data-bayaan-theme] .surah-toolbar{z-index:900!important}
  html[data-bayaan-theme] :is(.reading-options-panel,.verse-options-panel,.search-options-panel){max-width:calc(100vw - 20px)!important}
  html[data-bayaan-theme] .v7-match-explanation{margin-inline:0!important;width:100%!important;box-sizing:border-box!important}
}

/* --- 10.10.1 audit des anciens composants : neutralisation par familles --- */
html[data-bayaan-theme] :is(
  [class$="-card"],[class*="-card "],[class$="-panel"],[class*="-panel "],
  [class$="-dialog"],[class*="-dialog "],[class$="-popover"],[class*="-popover "],
  [class$="-drawer"],[class*="-drawer "],[class$="-item"],[class*="-item "],
  [class$="-metric"],[class*="-metric "],[class$="-summary"],[class*="-summary "]
){border-color:var(--bayaan-border)!important;color:var(--bayaan-text)!important}

/* Surface opaque pour les composants qui historiquement imposaient du blanc. */
html[data-bayaan-theme] :is(
  .adv-proof,.v7-note-body,.v8-token-annotation,.v8-protocol-bar,.v8-inspector-meta>div,.v8-inspector-evidence,
  .v7-note-stats,.v7-compare-notes,.v7-column-empty,.v7-notes-empty,.v7-note-editor-empty,.v7-note-passages-empty,
  .word-profile-head,.metric-grid div,.equivalent-word-chip,.verse-info-metric,.audio-range-summary,.audio-range-boundary,
  .audio-language-mode,.copy-range-boundary,.v90-proof,.v90c-proof,.v7-work-stats article,.v8-quran-source-card,
  .concept-info,.numeric-word-card,.numeric-word-metrics,.corpus-accordion,.corpus-heading,.text-status,.word-grid div,
  .verse-value-banner,.accent-stat,.intertext-card,.verse-motif-card,.analysis-warning,.analytics-controls,
  .fixed-rules-mini,.equivalence-toggle,.root-family-note,.root-family-empty,.occurrence-sequence-badge,
  .tajweed-legend-item,.source-pill,.v8-evidence,.v8-source-id,.adv-help,.adv-check,.v7-compare-method,
  .v90c-method,.v90c-empty,.v8-quran-research-tools
){
  background:var(--bayaan-surface-2)!important;
  color:var(--bayaan-text)!important;
  border-color:var(--bayaan-border)!important;
}

/* Contrôles historiques : jamais texte clair sur bouton clair. */
html[data-bayaan-theme] :is(
  .audio-stop-button,.audio-nav-button,.french-verse-button,.phonetic-verse-button,.open-surah-button,.scroll-to-top,
  .dialog-close,.range-remove-button,.root-family-toggle,.v7-advanced-toggle,.v7-study-launcher,.v7-add-study,
  .v100-open-os,.critical-toggle,.adv-remove,.v7-compare-add,.danger-btn,.source-link,.motif-links a
){
  background:var(--bayaan-surface-2)!important;
  color:var(--bayaan-text)!important;
  border-color:var(--bayaan-border-strong)!important;
}
html[data-bayaan-theme] :is(.french-toggle-button,.active-audio-button,.audio-main-toggle.active){
  background:var(--bayaan-action-bg)!important;color:var(--bayaan-action-text)!important;border-color:var(--bayaan-action-bg)!important;
}

/* Texte secondaire hérité : contraste minimal conservé. */
html[data-bayaan-theme] :is(
  .hero-copy>p:last-child,.root-family-note,.copy-range-boundary label small,.player-reciter-field,.french-player-field span,
  .reading-launcher-copy small,.v8-provenance-line,.v8-token-meta span,.v7-compare-notes,.v7-note-title-wrap small,
  .french-line,.arabic-translation,.v90c-method,.v90c-empty
){color:var(--bayaan-muted)!important;opacity:1!important}

/* SVG / graphes : visibles en clair comme en sombre. */
html[data-bayaan-theme] :is(.network-node,.network-center,.v100-graph) circle{
  fill:var(--bayaan-surface-2)!important;stroke:var(--bayaan-accent)!important;
}
html[data-bayaan-theme] :is(.network-node,.network-center,.v100-graph) text{fill:var(--bayaan-text)!important}
html[data-bayaan-theme] :is(.network-edge,.v100-graph) line{stroke:var(--bayaan-border-strong)!important}

/* Sélections / états : conserver leur sens sans casser le contraste. */
html[data-bayaan-theme] :is(.reader-verse-card.selected-verse,.verse-card.target,.verse-card.speaking,.verse-card.audio-playing){
  border-color:var(--bayaan-accent)!important;
  box-shadow:0 0 0 2px color-mix(in srgb,var(--bayaan-accent) 30%,transparent),var(--bayaan-shadow)!important;
}
html[data-bayaan-theme] .reader-verse-card.selected-verse .verse-ref{
  background:var(--bayaan-selection)!important;color:var(--bayaan-text)!important;
}

/* Les détails dépliables occupent toujours tout leur encadré, y compris Pastel. */
html[data-bayaan-theme] details.v7-match-explanation,
html[data-bayaan-theme] details.airy-disclosure,
html[data-bayaan-theme] details.v89-options:not(.reading-options-menu):not(.verse-options-menu):not(.search-options-menu){
  background:var(--bayaan-surface-2)!important;
}
html[data-bayaan-theme] details.v7-match-explanation[open],
html[data-bayaan-theme] details.airy-disclosure[open]{background:var(--bayaan-surface-2)!important}

/* Petite largeur : aucun composant ne déborde latéralement. */
@media(max-width:600px){
  html[data-bayaan-theme] :is(.search-panel,.surah-reader-shell,.verse-card,.reader-verse-card,.term-profile,.occurrence-navigator,.v7-match-explanation,.reading-options-panel,.verse-options-panel,.search-options-panel){
    max-width:100%!important;box-sizing:border-box!important;
  }
  html[data-bayaan-theme] :is(.reading-options-panel,.verse-options-panel,.search-options-panel){border-radius:14px!important}
}

/* --- 10.10.1 priorité finale sur les anciens !important à forte spécificité --- */
html[data-bayaan-theme] #analyticsView .primary-button,
html[data-bayaan-theme] #v90ResearchLab .primary-button{
  background:var(--bayaan-action-bg)!important;
  color:var(--bayaan-action-text)!important;
  border-color:var(--bayaan-action-bg)!important;
}
html[data-bayaan-theme] #analyticsView .secondary-button,
html[data-bayaan-theme] #analyticsView button:not(.primary-button),
html[data-bayaan-theme] #v90ResearchLab button:not(.primary-button){
  background:var(--bayaan-surface-2)!important;
  color:var(--bayaan-text)!important;
  border-color:var(--bayaan-border)!important;
}
html[data-bayaan-theme] #analyticsView .secondary-button:hover,
html[data-bayaan-theme] #analyticsView button:not(.primary-button):hover,
html[data-bayaan-theme] #v90ResearchLab button:not(.primary-button):hover{
  background:color-mix(in srgb,var(--bayaan-surface-2) 72%,var(--bayaan-accent) 28%)!important;
  color:var(--bayaan-text)!important;
  border-color:var(--bayaan-border-strong)!important;
}
html[data-bayaan-theme] #v90ResearchLab .v90-tabs button.active,
html[data-bayaan-theme] #researchWorkView .v7-tabs button.active{
  background:var(--bayaan-action-bg)!important;
  color:var(--bayaan-action-text)!important;
  border-color:var(--bayaan-action-bg)!important;
}
html[data-bayaan-theme] #researchWorkView .v7-tabs{
  background:color-mix(in srgb,var(--bayaan-surface) 96%,transparent)!important;
  color:var(--bayaan-text)!important;
  border-color:var(--bayaan-border)!important;
}
html[data-bayaan-theme] .v7-overview-label textarea,
html[data-bayaan-theme] .v7-note-verse-card textarea{
  background:var(--bayaan-field)!important;
  color:var(--bayaan-text)!important;
  border-color:var(--bayaan-border)!important;
}

/* Correctif de spécificité final : l'encadré « Pourquoi ce résultat ? » est
   volontairement teinté sur TOUTE sa surface, pas uniquement son résumé. */
html[data-bayaan-theme="current"] body details.v7-match-explanation{background:#ece8df!important;background-image:none!important}
html[data-bayaan-theme="pastel"] body details.v7-match-explanation{background:#f0e1e8!important;background-image:none!important}
html[data-bayaan-theme="dark"] body details.v7-match-explanation{background:#182722!important;background-image:none!important}
html[data-bayaan-theme="luxury"] body details.v7-match-explanation{background:#111824!important;background-image:none!important}
html[data-bayaan-theme] body details.v7-match-explanation>summary{background:transparent!important}
html[data-bayaan-theme] body details.v7-match-explanation>ul,
html[data-bayaan-theme] body details.v7-match-explanation>div{background:transparent!important}
