/* V9 — semantic, contrast-safe surface tokens for light and dark appearances.
   This stylesheet is deliberately last: older version-specific colours must not override accessibility. */
:root[data-theme="light"]{
  color-scheme:light;
  --ink:#19372d;--muted:#53695b;--border:#d5e2d5;--paper:#ffffff;--light:#f6f8f4;
  --ui-soft:#f0f5ee;--ui-raised:#ffffff;--ui-warm:#fff8ea;--ui-warm-line:#dcc99e;
  --ui-warm-ink:#624820;--ui-accent:#225f46;--ui-accent-ink:#ffffff;
  --ui-link:#176244;--ui-arabic:#204a39;--ui-strong:#17382b;--ui-faint:#5f7465;
  --ui-pill:#e7f1e8;--ui-pill-ink:#244c34;--ui-friday:#f6e7c5;--ui-friday-ink:#634818;
  --ui-today:#e4f2e8;--ui-today-ink:#1b4e37;--ui-input:#ffffff;
}
:root[data-theme="dark"]{
  color-scheme:dark;
  --forest:#2a694f;--ink:#edf5ed;--muted:#bbcdbf;--border:#426052;--paper:#1a3027;--light:#101f1a;
  --ui-soft:#243b30;--ui-raised:#1e352b;--ui-warm:#3d3324;--ui-warm-line:#8b7144;
  --ui-warm-ink:#f8dfaa;--ui-accent:#b7e5c6;--ui-accent-ink:#0c291e;
  --ui-link:#bbebcb;--ui-arabic:#f6e5be;--ui-strong:#f4f8f1;--ui-faint:#b8cbbc;
  --ui-pill:#2e513b;--ui-pill-ink:#e0f0de;--ui-friday:#5b4829;--ui-friday-ink:#fff0bf;
  --ui-today:#264f3b;--ui-today-ink:#f0faed;--ui-input:#11271f;
}
:root[data-theme] body,:root[data-theme] .app-content{background:var(--light);color:var(--ink)}
:root[data-theme] .topbar,:root[data-theme] .footer,:root[data-theme] .mobile-tabbar{background:var(--paper);border-color:var(--border);color:var(--muted)}
:root[data-theme] .topbar-left,:root[data-theme] .location-tag,:root[data-theme] .footer .creator,:root[data-theme] .footer .creator strong{color:var(--muted)}
:root[data-theme] .topbar-monogram{background:var(--ui-soft);color:var(--ui-strong)}
:root[data-theme] .page-header h1,:root[data-theme] .page-title,:root[data-theme] .page-header p,:root[data-theme] .v4-section-head h2,:root[data-theme] .section-header h2{color:var(--ink)}
:root[data-theme] .date-chip,:root[data-theme] .v8-theme-quick{background:var(--ui-raised);color:var(--ink);border-color:var(--border)}
:root[data-theme] .panel,:root[data-theme] .surface,:root[data-theme] .card,:root[data-theme] .time-card,:root[data-theme] .quick-link,:root[data-theme] .v4-home-actions a,:root[data-theme] .surah-card,:root[data-theme] .juz-button,:root[data-theme] .v4-dua-card,:root[data-theme] .audio-panel,:root[data-theme] .v8-tv-shell,:root[data-theme] .v8-services-hero,:root[data-theme] .v6-dhikr-card{
 background:var(--paper)!important;color:var(--ink)!important;border-color:var(--border)!important;box-shadow:none;
}
:root[data-theme] :is(.panel,.card,.surface,.time-card,.quick-link,.surah-card,.audio-panel,.v6-dhikr-card,.v8-services-hero,.v8-tv-toolbar) :is(h1,h2,h3,h4,strong,b){color:var(--ui-strong)}
:root[data-theme] :is(.panel,.card,.surface,.time-card,.quick-link,.surah-card,.audio-panel,.v6-dhikr-card,.v8-services-hero) :is(p,small){color:var(--muted)}
:root[data-theme] :is(.muted,.mini-help,.v4-section-note,.v6-table-hint,.translation,.dua-english,.v6-dhikr-meaning,.v6-dhikr-source>span,.surah-meaning,.audio-label,.v8-source-line,.v8-bearing-note,.v8-eid-facts span,.v8-fasting-times span){color:var(--muted)!important}
:root[data-theme] :is(.v4-dua-card,.dua-panel,.v4-continue-reading,.reader-intro,.v6-dhikr-intro,.offline-box,.v6-reminder-shortcut,.v8-fasting-times,.v8-eid-facts,.v8-segment,.v8-theme-options button,.v8-compact-links a){background:var(--ui-soft)!important;border-color:var(--border)!important;color:var(--ink)!important}
:root[data-theme] .dua-panel{background:var(--ui-warm)!important;border-color:var(--ui-warm-line)!important}
:root[data-theme] .dua-panel :is(h2,h3,strong){color:var(--ui-warm-ink)!important}
:root[data-theme] .dua-panel :is(p,small,.dua-english,.translation){color:var(--ui-warm-ink)!important}
:root[data-theme] :is(.dua-arabic,.dhikr-arabic,.reader .verse-arabic,.verse-arabic,.v4-dua-card .dua-arabic,.surah-card-arabic){color:var(--ui-arabic)!important}
:root[data-theme] .v4-dua-card h2,:root[data-theme] .v6-dhikr-intro h2,:root[data-theme] .v6-dhikr-card h2{color:var(--ui-strong)!important}
:root[data-theme] .v4-dua-card .v4-dua-tools,:root[data-theme] .v6-dhikr-source,:root[data-theme] .reader .verse,:root[data-theme] .prayer-row{border-color:var(--border)!important}
:root[data-theme] .source-pill,:root[data-theme] .badge,:root[data-theme] .quick-icon,:root[data-theme] .surah-number,:root[data-theme] .verse-num,:root[data-theme] .v6-repetitions{background:var(--ui-pill)!important;color:var(--ui-pill-ink)!important;border-color:var(--border)!important}
:root[data-theme] .v6-repetitions{background:var(--ui-warm)!important;color:var(--ui-warm-ink)!important;border-color:var(--ui-warm-line)!important}
:root[data-theme] .jummah-box{background:var(--ui-warm)!important;border-color:var(--ui-warm-line)!important;color:var(--ui-warm-ink)!important}
:root[data-theme] .jummah-box :is(h2,h3,strong,b,p,span,small,.eyebrow){color:var(--ui-warm-ink)!important}
:root[data-theme] .jummah-entry{border-color:var(--ui-warm-line)!important}
:root[data-theme] .prayer-header{background:var(--ui-soft)!important;color:var(--muted)!important}
:root[data-theme] .prayer-row{background:transparent;color:var(--ink)!important}
:root[data-theme] .prayer-row strong{color:var(--ui-strong)!important}
:root[data-theme] .prayer-row .sub{color:var(--muted)!important}
:root[data-theme] .prayer-row.active{background:var(--ui-today)!important;color:var(--ui-today-ink)!important}
:root[data-theme] .prayer-row.active :is(strong,span){color:var(--ui-today-ink)!important}
:root[data-theme] .time-card.highlight{background:var(--ui-today)!important;border-color:var(--ui-accent)!important}
:root[data-theme] .time-card.highlight :is(h3,strong,p,span){color:var(--ui-today-ink)!important}
:root[data-theme] .quick-link :is(strong,p,span){color:var(--ink)!important}
:root[data-theme] .quick-link p,:root[data-theme] .v4-home-actions span{color:var(--muted)!important}
:root[data-theme] .v4-home-actions :is(strong,span){color:var(--ink)!important}
:root[data-theme] .v4-home-actions span{color:var(--muted)!important}
:root[data-theme] .v8-section-switch button,:root[data-theme] .v8-theme-options button,:root[data-theme] .v8-segment button{background:var(--ui-soft)!important;border-color:var(--border)!important;color:var(--ink)!important}
:root[data-theme] .v8-section-switch button.active,:root[data-theme] .v8-theme-options button.active,:root[data-theme] .v8-segment button.on,:root[data-theme] .tab.active{background:var(--ui-accent)!important;color:var(--ui-accent-ink)!important;border-color:var(--ui-accent)!important}
:root[data-theme] .v8-theme-options small{color:inherit!important;opacity:1}
:root[data-theme] .tab,:root[data-theme] .btn.ghost,:root[data-theme] .qari-option,:root[data-theme] .juz-button,:root[data-theme] .surah-heart,:root[data-theme] .surah-open,:root[data-theme] .v8-compact-links a{background:var(--ui-raised)!important;color:var(--ink)!important;border-color:var(--border)!important}
:root[data-theme] .surah-open{background:transparent!important}
:root[data-theme] .surah-open:hover,:root[data-theme] .surah-heart:hover,:root[data-theme] .qari-option:hover,:root[data-theme] .juz-button:hover{background:var(--ui-soft)!important}
:root[data-theme] .qari-option.selected,:root[data-theme] .surah-heart.is-favorite{background:var(--ui-pill)!important;color:var(--ui-pill-ink)!important;border-color:var(--ui-accent)!important}
:root[data-theme] .qari-selector{background:var(--ui-input);border-color:var(--ui-accent)}
:root[data-theme] .qari-option.selected .qari-selector:after{background:var(--ui-accent)}
:root[data-theme] .surah-card .surah-content strong,:root[data-theme] .surah-card .surah-meaning,:root[data-theme] .surah-card .surah-card-arabic{color:var(--ink)!important}
:root[data-theme] .surah-card .surah-meaning{color:var(--muted)!important}
:root[data-theme] .surah-card .surah-card-arabic{color:var(--ui-arabic)!important}
:root[data-theme] :is(.btn:not(.ghost):not(.light),button.primary){background:#225b43;color:#fff;border-color:#3b7558}
:root[data-theme="dark"] :is(.btn:not(.ghost):not(.light),button.primary){background:#316d50;color:#fff;border-color:#70a985}
:root[data-theme] .btn.light{background:var(--ui-soft);color:var(--ink);border-color:var(--border)}
:root[data-theme] :is(.field,input:not([type="checkbox"]):not([type="range"]),textarea,select){background:var(--ui-input)!important;color:var(--ink)!important;border-color:var(--border)!important}
:root[data-theme] :is(input,textarea)::placeholder{color:var(--muted)!important;opacity:1}
:root[data-theme] :is(.form-label,.v8-form label,.v8-imam-contact h3,.v8-form h2){color:var(--ink)!important}
:root[data-theme] :is(.v8-contact-link,.v8-official,.v6-dhikr-source a,.section-title a,.v8-feature-card>a,.v8-source-line a){color:var(--ui-link)!important}
:root[data-theme] .v8-season-hero .v8-official,:root[data-theme] .v8-madrassah-hero .v8-official{color:#ffe1a1!important}
:root[data-theme] .status-note,:root[data-theme] .info-banner,:root[data-theme] .v8-verification{background:var(--ui-warm)!important;color:var(--ui-warm-ink)!important;border-color:var(--ui-warm-line)!important}
:root[data-theme] .status-note :is(strong,small,span,a),:root[data-theme] .info-banner :is(strong,small,span,a){color:var(--ui-warm-ink)!important}
:root[data-theme] .v8-fasting-times :is(strong,span),:root[data-theme] .v8-eid-facts :is(strong,span){color:var(--ink)!important}
:root[data-theme] .v8-fasting-times span,:root[data-theme] .v8-eid-facts span{color:var(--muted)!important}
:root[data-theme] .v8-compass{border-color:var(--border);background:radial-gradient(circle,var(--ui-raised) 0%,var(--ui-soft) 58%,var(--paper) 59%,var(--ui-soft) 61%)!important;box-shadow:0 4px 25px #091b1429}
:root[data-theme] .v8-compass-axis{border-color:var(--border)}
:root[data-theme] .v8-compass>span{color:var(--ui-warm-ink)}
:root[data-theme] .v8-qibla-core{background:#174432;color:#fff0cd}
:root[data-theme] .v8-tv-toolbar{background:var(--paper);color:var(--ink)}
:root[data-theme] .v8-tv-stage,:root[data-theme] .v8-tv-stage *{color:#f5f6ee}
:root[data-theme] .v8-tv-stage .eyebrow,:root[data-theme] .v8-tv-line b,:root[data-theme] .v8-tv-next>strong{color:#f3d9a4!important}
:root[data-theme] .v8-tv-stage :is(.v8-tv-now span,.v8-tv-stage-foot,.v8-tv-credit){color:#d7e4d8!important}
:root[data-theme] .v6-schedule-caption,:root[data-theme] .v6-friday-key,:root[data-theme] .v6-table-hint{color:var(--ink)!important}
:root[data-theme] .v6-friday-key>span{background:var(--ui-friday)!important;border-color:var(--ui-warm-line)!important}
:root[data-theme] .v6-schedule-scroll{background:var(--paper)!important;border-color:var(--border)!important}
:root[data-theme] .v6-schedule-table tbody tr:not(.v6-friday-row):not(.v6-current-row) :is(td,th){background:var(--paper)!important;color:var(--ink)!important;border-color:var(--border)!important}
:root[data-theme] .v6-schedule-table tbody tr:nth-child(even):not(.v6-friday-row):not(.v6-current-row) :is(td,th){background:var(--ui-soft)!important}
:root[data-theme] .v6-schedule-table tbody tr.v6-friday-row :is(td,th){background:var(--ui-friday)!important;color:var(--ui-friday-ink)!important;border-color:var(--ui-warm-line)!important}
:root[data-theme] .v6-schedule-table tbody tr.v6-current-row:not(.v6-friday-row) :is(td,th){background:var(--ui-today)!important;color:var(--ui-today-ink)!important;border-color:var(--border)!important}
:root[data-theme] .v6-schedule-table tbody .v6-sticky-date{box-shadow:2px 0 4px #0b23171c;border-right:1px solid var(--border)!important}
:root[data-theme] .v6-schedule-table thead th{background:#184333!important;color:#fff!important;border-color:#56755b!important}
:root[data-theme="dark"] .v6-schedule-table thead th{background:#30664e!important;color:#fff!important}
:root[data-theme] .v6-schedule-table thead th:first-child{box-shadow:3px 0 5px #071c1420}
:root[data-theme] .v4-pref-row{border-color:var(--border);background:var(--paper)!important}
:root[data-theme] .v4-pref-row :is(strong,small,label){color:var(--ink)!important}
:root[data-theme] .v4-pref-row small{color:var(--muted)!important}
:root[data-theme] .v6-prayer-focus-card{background:var(--paper)!important;border-color:var(--ui-warm-line)!important;color:var(--ink)!important}
:root[data-theme] .v6-prayer-focus-card :is(h2,.v6-focus-arabic){color:var(--ui-strong)!important}
:root[data-theme] .v6-prayer-focus-card :is(.v6-focus-message,.v6-focus-dismiss,.v6-focus-note){color:var(--muted)!important}
:root[data-theme] .v6-prayer-focus-card .v6-focus-time{color:var(--ui-warm-ink)!important}
:root[data-theme="dark"] .sidebar{background:#0d2921}
:root[data-theme="dark"] .mobile-tabbar a{color:#bbd1c1}
:root[data-theme="dark"] .mobile-tabbar a.active{color:#e7cd94}
:root[data-theme="dark"] .footer .creator strong{color:#f3dca8}
:root[data-theme] a:not(.btn):hover{text-decoration-color:currentColor}
/* Keep scroll-head labels visible while preserving a full-row Friday highlight. */
:root[data-theme] .v6-schedule-scroll{scrollbar-color:var(--muted) var(--ui-soft)}
@media print{ :root[data-theme] .v6-schedule-table tbody tr.v6-friday-row :is(td,th){background:#f6e7c5!important;color:#634818!important;print-color-adjust:exact} }

/* Final contrast corrections from rendered-text auditing. */
:root[data-theme="light"]{--ui-eyebrow:#815914}
:root[data-theme="dark"]{--ui-eyebrow:#eac58b}
:root[data-theme] .eyebrow{color:var(--ui-eyebrow)!important}
:root[data-theme] :is(.home-hero,.v8-season-hero,.v8-madrassah-hero,.quran-banner,.v8-tv-stage,.v4-hero) .eyebrow{color:#f1d69d!important}
:root[data-theme] .v4-next-card .eyebrow{color:#f5d9a6!important}
:root[data-theme] .time-card .secondary-time,:root[data-theme] .time-card .secondary-time span{color:var(--muted)!important}
:root[data-theme] .text-link,:root[data-theme] a.source-link{color:var(--ui-link)!important}
:root[data-theme] .v4-live-indicator{color:var(--muted)!important}
:root[data-theme] .offline-box small,:root[data-theme] .reader-status,:root[data-theme] .verse-key{color:var(--muted)!important}
:root[data-theme] .v8-season-links .btn.ghost{background:transparent!important;color:#fff!important;border-color:#afcdb6!important}
