/* Darul Tafheem Teaching Studio — mobile-first, logical properties for RTL. */
:root{
  --emerald:#0B5D43; --emerald-2:#073D2C; --gold:#C9A227; --gold-2:#A8841C;
  --ivory:#FAF6EC; --bg:#F4EFE1; --surface:#FFFDF6; --surface-muted:#F0E9D8;
  --text:#1D2A24; --muted:#5F6F66; --border:#DDD2B8;
  --jali:#B3372C; --khafi:#C77F1A; --ok:#1E7A4C; --danger:#B3372C;
  --shadow:0 1px 2px rgb(29 42 36/.05),0 10px 28px -14px rgb(29 42 36/.22);
  --radius:16px;
}
html[data-theme="dark"]{
  color-scheme:dark;
  --bg:#0D1512; --surface:#16211C; --surface-muted:#1E2D26;
  --text:#ECE7D8; --muted:#9DB0A5; --border:#2E4238;
  --emerald:#3FAE85; --emerald-2:#0B5D43; --gold:#D4AF37;
  --ivory:#1E2D26; --shadow:0 1px 2px rgb(0 0 0/.4),0 10px 28px -14px rgb(0 0 0/.6);
}
/* System theme: no data-theme attribute (or explicit light) follows the OS. */
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    color-scheme:dark;
    --bg:#0D1512; --surface:#16211C; --surface-muted:#1E2D26;
    --text:#ECE7D8; --muted:#9DB0A5; --border:#2E4238;
    --emerald:#3FAE85; --emerald-2:#0B5D43; --gold:#D4AF37;
    --ivory:#1E2D26; --shadow:0 1px 2px rgb(0 0 0/.4),0 10px 28px -14px rgb(0 0 0/.6);
  }
}
*{box-sizing:border-box}
html{scroll-behavior:smooth}
body{
  margin:0; background:var(--bg); color:var(--text);
  font-family:"Noto Sans","Noto Naskh Arabic","Noto Nastaliq Urdu",system-ui,-apple-system,"Segoe UI",sans-serif;
  line-height:1.55; padding-block-end:96px; overflow-x:clip;
}
[lang="ar"],[dir="rtl"] .quran-text{font-family:"Amiri Quran","Noto Naskh Arabic",serif}
.quran-text{font-family:"Amiri Quran","Noto Naskh Arabic",serif; font-size:1.55rem; line-height:1.9; text-align:center}
#ayahCard .quran-text,#hadithCard .quran-text{font-size:1.3rem; line-height:1.85}
#hadithCard .clampable{display:-webkit-box;-webkit-line-clamp:5;-webkit-box-orient:vertical;overflow:hidden}
#hadithCard.expanded .clampable{display:block;-webkit-line-clamp:unset;overflow:visible}
html{scroll-padding-top:72px}
.card{scroll-margin-top:72px}
.ur-text{font-family:"Noto Nastaliq Urdu","Noto Naskh Arabic",serif; line-height:2}
a{color:var(--emerald)}
h1{font-size:1.5rem; margin:.4rem 0 .8rem}
h2{font-size:1.15rem; margin:.2rem 0 .6rem}
h3{font-size:1rem; margin:1rem 0 .4rem}
.muted{color:var(--muted)} .small{font-size:.85rem}
.visually-hidden{position:absolute!important;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.skip-link{position:absolute;inset-inline-start:8px;top:-48px;background:var(--emerald);color:#fff;padding:8px 12px;border-radius:8px;z-index:99}
.skip-link:focus{top:8px}
.row{display:flex;align-items:center} .row>*{min-inline-size:0} .gap{gap:10px} .wrap{flex-wrap:wrap}
.grid-2{display:grid;grid-template-columns:1fr;gap:12px}
@media(min-width:720px){.grid-2{grid-template-columns:1fr 1fr}}
.field{display:flex;flex-direction:column;gap:4px;margin-block-end:10px}
.field input,.field select,.field textarea{inline-size:100%}
.field-span{grid-column:1/-1}
label{font-weight:600;font-size:.9rem}
input,select,textarea{font:inherit;color:var(--text);background:var(--surface);border:1px solid var(--border);border-radius:10px;padding:10px 12px;max-inline-size:100%}
input:focus,select:focus,textarea:focus{outline:2px solid var(--gold);outline-offset:1px}
button{font:inherit;cursor:pointer}
.btn{border:1px solid var(--border);background:var(--surface);color:var(--text);border-radius:999px;padding:9px 18px;font-weight:600}
.btn:hover{border-color:var(--gold)}
.btn-primary{background:var(--emerald);border-color:var(--emerald);color:#fff}
.btn-primary:hover{background:var(--emerald-2)}
.btn-ghost{background:transparent}
.btn-sm{padding:5px 12px;font-size:.88rem}
.btn[aria-pressed="true"],.btn.active{background:var(--emerald);color:#fff;border-color:var(--emerald)}
.link-btn{background:none;border:0;color:var(--emerald);text-decoration:underline;padding:0}
.icon-btn{border:1px solid var(--border);background:var(--surface);color:var(--text);border-radius:50%;inline-size:38px;block-size:38px;font-size:1.1rem}
.control-select{padding:8px 10px;border-radius:999px}
.pill{display:inline-block;background:var(--surface-muted);border:1px solid var(--border);border-radius:999px;padding:4px 12px;font-weight:600}
.chip-row{display:flex;flex-wrap:wrap;gap:6px;margin-block-start:6px}
.chip{border:1px solid var(--gold);border-radius:999px;padding:3px 10px;background:var(--ivory);color:var(--text)}
.form-error{color:var(--danger);font-weight:600}
.banner{margin:12px;padding:12px 16px;border-radius:var(--radius);border:1px solid var(--border)}
.banner-warn{background:#FFF4D6;color:#4A3600;border-color:#E7C46A}
html[data-theme="dark"] .banner-warn{background:#3A2F10;color:#F5E6B0}

/* ---- App shell: light translucent top bar on phone, fixed rail on desktop.
   Matches the approved app shell: no solid colour bar, brand + controls
   on the page background, pill tab bar, 240px left rail at >=1024px. ---- */
.app-header{position:sticky;top:0;z-index:40;background:var(--bg);border-block-end:1px solid var(--border);padding-block-start:env(safe-area-inset-top)}
@supports ((-webkit-backdrop-filter:blur(8px)) or (backdrop-filter:blur(8px))){
  .app-header{background:color-mix(in srgb,var(--bg) 95%,transparent);-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px)}
}
.header-inner{max-inline-size:768px;margin:0 auto;display:flex;align-items:center;gap:8px;padding:10px 16px}
.brand{display:flex;align-items:center;gap:10px;background:none;border:0;color:var(--text);text-align:start;padding:0;min-inline-size:0;flex:0 0 auto}
.brand-logo{inline-size:36px;block-size:36px;object-fit:cover;border-radius:8px;box-shadow:0 0 0 1px var(--border)}
.brand-mark{inline-size:36px;block-size:36px;display:grid;place-items:center;border-radius:8px;background:var(--gold);color:#20301F;font-size:1.2rem}
.brand-text{display:none;flex-direction:column;line-height:1.2;min-inline-size:0}
@media(min-width:560px){.brand-text{display:flex}}
.brand-text strong{font-size:1rem;white-space:nowrap}
.brand-text small{display:none;font-size:11px;letter-spacing:.04em;text-transform:uppercase;color:var(--muted);white-space:nowrap}
@media(min-width:640px){.brand-text small{display:block}}
.header-controls{margin-inline-start:auto;display:flex;align-items:center;gap:8px;min-inline-size:0;flex-wrap:nowrap}
.header-controls .control-select{background:var(--surface);color:var(--text)}
#authArea{display:flex;gap:8px;align-items:center;min-inline-size:0}
@media(max-width:639px){.auth-visitor{display:none}}
@media(max-width:399px){.header-inner{padding-inline:12px}.tab-btn .tab-label{font-size:10px}}
.me-chip{font-weight:600;white-space:nowrap}
@media(min-width:1024px){.app-header{display:none}}
.layout{display:block;max-inline-size:768px;margin:0 auto;padding:16px}
.side-nav{display:none}
.main{margin:0}
@media(min-width:1024px){
  .layout{max-inline-size:1024px;padding:16px 24px 64px;padding-inline-start:264px}
  .side-nav{display:flex;position:fixed;inset-block:0;inset-inline-start:0;z-index:30;inline-size:240px;flex-direction:column;background:var(--surface);border-inline-end:1px solid var(--border);padding:24px 12px 20px}
  .rail-brand{padding:0 8px 20px}
  .rail-brand .brand{gap:12px}
  .rail-brand .brand-logo,.rail-brand .brand-mark{inline-size:44px;block-size:44px;border-radius:12px}
  .rail-brand .brand-text{display:flex}
  .rail-brand .brand-text strong{font-size:1.1rem}
  .rail-brand .brand-text small{display:block}
  .rail-links{display:flex;flex-direction:column;gap:4px}
  .side-link{display:flex;align-items:center;gap:12px;text-align:start;border:0;background:none;color:var(--text);border-radius:12px;padding:10px 14px;font-weight:600;font-size:15px}
  .side-link:hover{background:var(--surface-muted)}
  .side-link.active{background:var(--emerald);color:#fff}
  .rail-foot{margin-block-start:auto;display:flex;flex-direction:column;gap:12px;padding:0 8px}
  .rail-appearance{display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:.9rem;color:var(--muted)}
  .lang-pills{display:flex;gap:2px;border:1px solid var(--border);border-radius:999px;padding:3px;background:var(--surface)}
  .lang-pills button{flex:1 1 0;border:0;background:none;border-radius:999px;padding:7px 4px;font-weight:600;color:var(--muted);min-inline-size:0}
  .lang-pills button[aria-pressed="true"]{background:var(--emerald);color:#fff}
  .rail-auth{border-block-start:1px solid var(--border);padding-block-start:12px;display:flex;flex-direction:column;gap:8px}
  .rail-auth .btn{inline-size:100%}
  .rail-user{font-size:.9rem;line-height:1.35;min-inline-size:0}
  .rail-user strong{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .rail-user span{color:var(--muted);font-size:.8rem}
  body{padding-block-end:20px}
  .app-footer{margin-inline-start:240px}
}
.view[hidden]{display:none!important}
.card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);box-shadow:var(--shadow);padding:16px;margin-block-end:14px}
.hero{background:linear-gradient(135deg,var(--emerald),var(--emerald-2) 60%,#0E6B4D);color:#fff;border-radius:var(--radius);padding:22px 18px;margin-block-end:14px}
.hero h1{font-size:1.7rem;margin:.2rem 0}
.hero-ar{font-family:"Noto Kufi Arabic",sans-serif;font-size:1.1rem;margin:.2rem 0}
.hero-sub,.hero-tag{opacity:.92}
.hero .btn-ghost{color:#fff;border-color:rgba(255,255,255,.6)}

/* ---- Home: mirrors the approved Home screen ---- */
.home-stack{display:flex;flex-direction:column;gap:24px}
.home-stack .card{margin-block-end:0}
.home-stack h2{font-size:1.25rem;margin:0 0 8px}
.brand-hero{position:relative;overflow:hidden;background:linear-gradient(128deg,#062E21 0%,#0B5D43 58%,#0E7050 100%);color:#fff;border-radius:var(--radius);box-shadow:var(--shadow);padding:16px}
@media(min-width:600px){.brand-hero{padding:24px}}
.brand-hero::before{content:"";position:absolute;inset:0;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56' viewBox='0 0 56 56'%3E%3Cpath d='M28 4l5.5 13.5L47 12l-5.5 13.5L55 28l-13.5 5.5L47 47l-13.5-5.5L28 55l-5.5-13.5L9 47l5.5-13.5L1 28l13.5-5.5L9 9l13.5 5.5z' fill='none' stroke='%23c9a227' stroke-opacity='0.16'/%3E%3C/svg%3E");background-size:56px 56px;pointer-events:none}
.brand-hero>*{position:relative}
.hero-top{display:flex;align-items:center;gap:12px}
@media(min-width:600px){.hero-top{gap:16px}}
.hero-logo{inline-size:56px;block-size:56px;flex:0 0 auto;border-radius:16px;object-fit:cover;box-shadow:0 0 0 2px rgba(201,162,39,.7)}
@media(min-width:600px){.hero-logo{inline-size:80px;block-size:80px}}
.hero-logo-mark{display:grid;place-items:center;background:var(--ivory);color:var(--gold);font-size:1.8rem}
.hero-titles{min-inline-size:0}
.hero-kicker{margin:0;font-size:11px;font-weight:700;letter-spacing:.22em;text-transform:uppercase;color:var(--gold)}
.hero-name{margin:2px 0 0;font-size:1.5rem;line-height:1.2;overflow-wrap:anywhere}
@media(min-width:600px){.hero-name{font-size:2.25rem}}
.hero-date{margin:2px 0 0;font-size:.9rem;color:rgba(255,255,255,.85)}
.hero-actions{margin-block-start:16px;display:flex;flex-wrap:wrap;gap:8px}
.btn-white{background:#fff;border-color:#fff;color:#073D2C}
.btn-white:hover{background:#F4EFE1}
.btn-outline-light{background:transparent;border-color:rgba(255,255,255,.5);color:#fff}
.btn-outline-light:hover{border-color:#fff}
.steps-strip{list-style:none;margin:0;padding:0;display:grid;grid-template-columns:repeat(3,1fr);gap:8px}
.step-chip{display:flex;align-items:center;gap:8px;inline-size:100%;text-align:start;border:1px solid var(--border);background:var(--surface);color:var(--text);border-radius:var(--radius);box-shadow:var(--shadow);padding:10px 12px;font-weight:600;font-size:13px;line-height:1.3;min-inline-size:0}
.step-num{flex:0 0 auto;display:grid;place-items:center;inline-size:28px;block-size:28px;border-radius:50%;background:var(--emerald);color:#fff;font-size:.9rem;font-weight:700}
.daily-card{overflow:hidden;padding:0}
.daily-bar{block-size:4px;background:var(--gold)}
.daily-grid{display:grid;gap:0}
@media(min-width:1024px){.daily-grid{grid-template-columns:1fr 1fr}}
.daily-half{padding:16px}
@media(min-width:600px){.daily-half{padding:20px}}
.daily-half + .daily-half{border-block-start:1px solid var(--border)}
@media(min-width:1024px){.daily-half + .daily-half{border-block-start:0;border-inline-start:1px solid var(--border)}}
.daily-label{margin:0 0 4px;font-size:12px;font-weight:700;letter-spacing:.14em;text-transform:uppercase;color:var(--emerald)}
.daily-ar{margin-block:12px}
.daily-text{margin-block:12px;font-size:15px;line-height:1.65}
.prayer-ramadan-grid{display:grid;gap:24px}
@media(min-width:1280px){.prayer-ramadan-grid{grid-template-columns:1fr 1fr}}
.prayer-head{display:flex;flex-wrap:wrap;align-items:center;gap:8px}
.prayer-head h2{margin:0}
.hijri-chip{border-radius:999px;background:var(--surface-muted);padding:4px 10px;font-size:.78rem;font-weight:600}
.hijri-chip:empty{display:none}
.prayer-head .control-select{margin-inline-start:auto}
.next-prayer{margin:8px 0 0;font-size:.9rem}
.next-prayer:empty{display:none}
.account-cards{display:grid;gap:12px;margin-block:16px}
@media(min-width:600px){.account-cards{grid-template-columns:1fr 1fr}}
.account-mini{border-radius:12px;background:var(--surface-muted);padding:14px 16px}
.account-mini-title{margin:0 0 4px;font-weight:700;font-size:1rem}
.account-mini p{margin:0}
.how-steps{list-style:none;margin:12px 0 0;padding:0;display:flex;flex-direction:column;gap:16px}
.how-steps li{display:flex;gap:12px}
.step-badge{flex:0 0 auto;display:grid;place-items:center;inline-size:32px;block-size:32px;border-radius:50%;background:var(--emerald);color:#fff;font-weight:700}
.how-step-title{margin:0;font-weight:600}
.how-steps .btn{margin-block-start:8px}
#liveSections{display:flex;flex-direction:column;gap:24px}
#liveSections[hidden]{display:none}
.live-band{background:var(--emerald);color:#fff;border-radius:var(--radius);padding:20px}
.live-band h2{color:#fff}
.live-band p{margin:0 0 12px;font-size:.92rem;color:rgba(255,255,255,.88)}
.section-head{display:flex;align-items:baseline;justify-content:space-between;gap:10px;margin-block-end:12px}
.section-head h2{margin:0}
#todayClasses,#upNextList,#recentLessons{display:flex;flex-direction:column;gap:8px}
@media(min-width:1024px){#todayClasses,#upNextList,#recentLessons{display:grid;grid-template-columns:1fr 1fr;gap:12px}}
#todayClasses .list-item,#upNextList .list-item,#recentLessons .list-item{margin-block-end:0}
.today-row{border:2px solid rgba(201,162,39,.7)}
.row-meta{color:var(--muted);font-size:.88rem}
.row-chip{border-radius:999px;background:var(--surface-muted);padding:2px 8px;font-size:.75rem;font-weight:600;white-space:nowrap}
.upnext-row{display:flex;align-items:center;gap:12px}
.upnext-main{flex:1 1 auto;min-inline-size:0;text-align:start;background:none;border:0;padding:0;color:var(--text)}
.upnext-main strong{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.upnext-main span{color:var(--muted);font-size:.85rem}
.avatar{flex:0 0 auto;display:grid;place-items:center;inline-size:40px;block-size:40px;border-radius:50%;background:var(--emerald);color:#fff;font-weight:700}
.stat-tiles{display:grid;grid-template-columns:repeat(2,1fr);gap:12px}
@media(min-width:1024px){.stat-tiles{grid-template-columns:repeat(4,1fr)}}
.stat-tile{border:1px solid var(--border);background:var(--surface);border-radius:var(--radius);padding:12px;text-align:center}
.stat-tile strong{display:block;font-size:1.5rem;line-height:1.2}
.stat-tile span{font-size:.72rem;font-weight:700;letter-spacing:.08em;text-transform:uppercase;color:var(--muted)}
.quick-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:12px}
@media(min-width:600px){.quick-grid{grid-template-columns:repeat(3,1fr)}}
.quick-action{border:1px solid var(--border);background:var(--surface);color:var(--text);border-radius:var(--radius);padding:16px;text-align:start;min-inline-size:0}
.qa-label{display:block;font-weight:700;font-size:1rem}
.qa-hint{display:block;margin-block-start:2px;font-size:.88rem;color:var(--muted);line-height:1.4}
.stat-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:10px}
@media(min-width:600px){.stat-grid{grid-template-columns:repeat(4,1fr)}}
.stat{background:var(--surface-muted);border:1px solid var(--border);border-radius:12px;padding:12px;text-align:center}
.stat strong{display:block;font-size:1.4rem}
.stat span{font-size:.85rem;color:var(--muted)}
.steps{margin:0;padding-inline-start:1.2rem}
.steps li{margin-block-end:10px}
.prayer-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin-block-start:10px}
@media(min-width:600px){.prayer-grid{grid-template-columns:repeat(6,1fr)}}
.prayer-cell{background:var(--surface-muted);border-radius:10px;padding:8px;text-align:center}
.prayer-cell strong{display:block}
.bottom-nav{position:fixed;inset-block-end:0;inset-inline:0;z-index:50;background:var(--surface);border-block-start:1px solid var(--border);padding-block-end:max(4px,env(safe-area-inset-bottom))}
@supports ((-webkit-backdrop-filter:blur(8px)) or (backdrop-filter:blur(8px))){
  .bottom-nav{background:color-mix(in srgb,var(--surface) 97%,transparent);-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px)}
}
.bottom-nav-inner{max-inline-size:768px;margin:0 auto;display:grid;grid-template-columns:repeat(7,1fr);gap:2px;padding:6px 4px 0}
@media(min-width:1024px){.bottom-nav{display:none}}
.tab-btn{border:0;background:none;color:var(--muted);padding:6px 2px 2px;display:flex;flex-direction:column;align-items:center;gap:2px;min-inline-size:0;border-radius:12px}
.tab-pill{display:flex;align-items:center;justify-content:center;inline-size:44px;block-size:32px;border-radius:999px;font-size:1.15rem;line-height:1}
.tab-btn.active .tab-pill{background:var(--emerald);color:#fff}
.tab-label{font-size:11px;font-weight:600;line-height:1.2;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-inline-size:100%}
.tab-btn.active{color:var(--emerald)}
.tab-btn.active .tab-label{color:var(--emerald)}
.app-footer{max-inline-size:1180px;margin:18px auto 0;padding:14px;text-align:center;border-block-start:1px solid var(--border)}
.modal{position:fixed;inset:0;z-index:80;display:grid;place-items:start center;overflow:auto;background:rgba(0,0,0,.55);padding:20px 12px}
.modal[hidden]{display:none!important}
.modal-card{position:relative;background:var(--surface);color:var(--text);border-radius:16px;padding:20px;inline-size:min(520px,100%);margin-block-start:4vh;box-shadow:var(--shadow)}
.modal-x{position:absolute;inset-block-start:8px;inset-inline-end:8px;border:0;background:none;font-size:1.5rem;color:var(--text)}
.captcha-box{border:1px dashed var(--gold);border-radius:10px;padding:10px}
.captcha-q{font-weight:700;font-size:1.05rem}
.toast{position:fixed;inset-block-end:84px;inset-inline-start:50%;transform:translateX(-50%);background:var(--text);color:var(--bg);padding:10px 18px;border-radius:999px;z-index:90;font-weight:600;max-inline-size:92vw;text-align:center}
.toast[hidden]{display:none!important}
[dir="rtl"] .toast{transform:translateX(50%)}

/* Library */
.surah-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:8px}
@media(min-width:600px){.surah-grid{grid-template-columns:repeat(3,1fr)}}
.surah-btn{display:flex;flex-direction:column;align-items:flex-start;gap:2px;text-align:start;border:1px solid var(--border);background:var(--surface);color:var(--text);border-radius:12px;padding:10px}
.surah-btn:hover,.surah-btn.active{border-color:var(--gold);background:var(--ivory)}
.surah-no{font-weight:800;color:var(--emerald)}
.surah-en{font-weight:700}
.surah-ar{font-family:"Amiri Quran",serif;font-size:1.3rem}
.ayah-block{border-block-end:1px solid var(--border);padding:14px 4px}
.ayah-words{display:flex;flex-wrap:wrap;gap:6px;justify-content:center}
.word{position:relative;border:0;background:none;padding:8px 6px;border-radius:8px;font-family:"Amiri Quran","Noto Naskh Arabic",serif;font-size:1.75rem;line-height:1.9;color:var(--text)}
.word:hover{background:var(--surface-muted)}
.word.hidden-word{color:transparent;text-shadow:0 0 14px rgba(0,0,0,.35)}
.word.playing{background:#FFE9A8;color:#1D2A24}
.word .mark-pill{position:absolute;inset-block-start:-6px;inset-inline-start:50%;transform:translateX(-50%);font-family:"Noto Sans",sans-serif;font-size:10px;font-weight:800;line-height:1;padding:3px 7px;border-radius:999px;color:#fff;white-space:nowrap}
[dir="rtl"] .word .mark-pill{transform:translateX(50%)}
.mark-pill.jali{background:var(--jali)} .mark-pill.khafi{background:#C77F1A}
.word .past-badge{position:absolute;inset-block-end:-4px;inset-inline-end:-2px;font-family:"Noto Sans",sans-serif;font-size:10px;font-weight:700;background:var(--surface-muted);border:1px solid var(--border);border-radius:999px;padding:0 6px}
.ayah-trans{color:var(--muted);text-align:center;max-inline-size:640px;margin:6px auto 0}
.ayah-meta{display:flex;gap:8px;justify-content:center;flex-wrap:wrap;margin-block-start:6px}
.ayah-meta .btn-sm{font-size:.8rem}
.qaida-grid{display:grid;gap:6px}
.qaida-row{display:flex;flex-wrap:wrap;gap:6px;justify-content:center}

/* Floating marking panel — viewport FRACTIONS via left/top % + transform. */
.tier-btn[data-tier="jali"].active{background:var(--jali);color:#fff;border-color:var(--jali)}
.tier-btn[data-tier="khafi"].active{background:#C77F1A;color:#fff;border-color:#C77F1A}
.help-btn.active{background:var(--emerald);color:#fff;border-color:var(--emerald)}
.reader-card{position:relative}

/* Lists */
.list-item{border:1px solid var(--border);border-radius:12px;padding:12px;margin-block-end:8px;background:var(--surface)}
.list-item h3{margin:0 0 4px}
.kv{display:flex;flex-wrap:wrap;gap:4px 14px;font-size:.9rem}
.bar-chart{display:flex;align-items:flex-end;gap:4px;block-size:90px;margin-block:8px}
.bar-chart .bar{flex:1;background:var(--emerald);border-radius:4px 4px 0 0;min-block-size:4px;position:relative}
.bar-chart .bar span{position:absolute;inset-block-start:-18px;inset-inline-start:50%;transform:translateX(-50%);font-size:.7rem}
[dir="rtl"] .bar-chart .bar span{transform:translateX(50%)}
.wa-text{white-space:pre-wrap;background:var(--surface-muted);border:1px solid var(--border);border-radius:10px;padding:12px;font:inherit}
#sigCanvas{inline-size:100%;block-size:160px;border:1px dashed var(--border);border-radius:8px;background:#fff;touch-action:none}

/* Certificate: scale-to-fit preview + artifact print path (theme.css). */
.font-cert-sans{font-family:"Helvetica Neue",Helvetica,Arial,"Noto Sans","Segoe UI",sans-serif}
.font-cert-ar{font-family:"Noto Kufi Arabic","Noto Sans Arabic",sans-serif}
.font-signature{font-family:"Great Vibes",cursive}
@page certPage{size:A4 landscape;margin:0}
.cert-print-root{page:certPage;position:relative;overflow:hidden;width:100%}
/* The sheet is fully inline-styled: kill UA <p>/<h3> margins (1em
   top+bottom each) or the column overflows the 794px sheet and the
   Arabic date line + footer land on/below the gold frame. Inline
   margin-top spacings still apply on top of this reset. */
.cert-print-root p,.cert-print-root h3{margin:0}
.cert-scale-inner{position:absolute;top:0;left:0;transform-origin:top left}
.cert-builder-grid>*{min-width:0}
.cert-stack{display:flex;flex-direction:column;gap:24px}
.cert-maxw{max-width:760px;margin-inline:auto;width:100%}
.cert-builder-grid{display:grid;gap:16px}
@media(min-width:1024px){.cert-builder-grid{grid-template-columns:minmax(0,380px) 1fr}}
.section-title{font-size:1.25rem;margin:0 0 8px}
.form-stack{display:grid;gap:10px}
.between{justify-content:space-between}
.mono{font-family:ui-monospace,SFMono-Regular,Menlo,monospace}
/* Large-view + signature-studio overlays (Certificates.tsx CertLargeView). */
.overlay{position:fixed;inset:0;z-index:80;overflow:auto;background:rgba(0,0,0,.6);padding:12px}
.overlay[hidden]{display:none!important}
@media(min-width:640px){.overlay{padding:24px}}
.overlay-close-row{display:flex;justify-content:flex-end;margin-block-end:12px}
.overlay-x{display:flex;align-items:center;justify-content:center;width:36px;height:36px;border:0;border-radius:50%;background:#fff;color:#262626;font-size:1.15rem;line-height:1}
.overlay-cert{margin:0 auto;width:min(1000px,100%)}
.overlay-panel{max-width:36rem;margin:8vh auto 0;background:var(--surface);color:var(--text);border:1px solid var(--border);border-radius:16px;padding:20px;box-shadow:var(--shadow)}
/* Signature editor (app Signature Studio). */
.sig-editor h3{margin:0 0 10px;font-size:1.05rem}
.sig-pad-wrap svg{display:block;width:100%;height:110px;border:1px dashed var(--border);border-radius:8px;background:#fff;touch-action:none}
.sig-type-preview{min-height:64px;display:grid;place-items:center;border:1px dashed var(--border);border-radius:8px;background:#fff;padding:8px}
.sig-msg{margin:8px 0 0;font-size:.9rem}
/* Certificate badge picker + logo-size preview (admin profile form). */
.badge-picker{display:grid;grid-template-columns:repeat(2,1fr);gap:8px}
@media(min-width:600px){.badge-picker{grid-template-columns:repeat(4,1fr)}}
.badge-opt{border:2px solid var(--border);background:var(--surface);border-radius:12px;padding:10px 6px;font-weight:600;color:var(--text)}
.badge-opt.selected{border-color:var(--emerald);box-shadow:0 0 0 2px var(--emerald)}
.badge-opt-art{display:block;max-width:84px;margin:0 auto 6px}
.badge-opt-art svg{width:100%;height:auto;display:block}
.logo-size-preview{display:grid;place-items:center;border:1px dashed var(--border);border-radius:8px;background:var(--surface-muted);overflow:hidden}
@media print{
  body *{visibility:hidden}
  .print-area,.print-area *{visibility:visible}
  .print-area{position:absolute;inset:0;margin:0;box-shadow:none!important;-webkit-print-color-adjust:exact;print-color-adjust:exact}
  .cert-scale-inner{transform:none!important}
  .no-print{display:none!important}
}

/* ---- Teaching studio (Studio.tsx parity) ---- */
.sr-only{position:absolute!important;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.st-flex1{min-width:0;flex:1}
.st-msauto{margin-inline-start:auto}
.st-center{text-align:center}
.st-block{display:block}
.st-err{color:var(--jali)}
.st-kicker{margin:16px 0 8px;font-size:.75rem;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:var(--muted)}
.st-kicker.st-nomargin{margin:0}
.st-nomargin{margin:0}
.st-note{margin:8px 0 0;font-size:.9rem}
.st-dim{font-weight:400;opacity:.8}
.st-select{inline-size:100%;min-height:44px}
.st-select-sm{inline-size:auto;min-height:36px;padding:6px 10px;border-radius:999px}
.st-input{inline-size:100%}
.st-btn{min-height:36px;padding:6px 14px;font-size:.9rem}
@media(min-width:640px){.st-btn{min-height:44px;padding:8px 16px;font-size:.95rem}}
.st-chips{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin-block-start:8px}
.st-chip{display:flex;align-items:center;gap:10px;min-height:40px;border-radius:999px;padding:8px 20px 8px 8px;background:var(--surface-muted);border:0;font-weight:600;color:var(--text)}
@media(min-width:640px){.st-chip{min-height:48px}}
.st-chip.on{background:var(--emerald);color:#fff}
.st-chip.on .avatar{background:rgba(255,255,255,.25)}
/* Setup */
.st-setup{overflow:hidden;padding:0}
.st-setup-hero{border-radius:0;padding:14px 16px}
@media(min-width:640px){.st-setup-hero{padding:16px 20px}}
.st-setup-title{font-size:1.25rem;margin:0;color:#fff}
@media(min-width:640px){.st-setup-title{font-size:1.75rem}}
.st-setup-sub{margin:4px 0 0;max-width:36rem;font-size:.9rem;color:rgba(255,255,255,.85)}
.st-setup-body{padding:12px}
@media(min-width:640px){.st-setup-body{padding:20px}}
.st-step{display:flex;align-items:center;gap:10px;font-size:1rem;font-weight:700;margin:22px 0 0}
.st-step:first-child{margin-top:0}
.st-stepnum{flex:0 0 auto;display:grid;place-items:center;width:32px;height:32px;border-radius:50%;background:var(--emerald);color:#fff;font-size:1rem}
.st-step-body{margin-top:12px;font-size:1rem}
.st-bookgrid{display:grid;gap:10px;margin-block-start:12px}
@media(min-width:640px){.st-bookgrid{grid-template-columns:repeat(3,1fr)}}
.st-bookgrid-3{grid-template-columns:repeat(3,1fr)}
.st-bookcard{min-height:80px;border:2px solid;border-radius:16px;padding:14px 16px;text-align:start;background:var(--surface);color:var(--text)}
.st-bookcard.on{color:#fff}
.st-bookcard-t{display:block;font-size:1.1rem;font-weight:700}
.st-bookcard-h{display:block;margin-top:2px;font-size:.85rem;color:var(--muted)}
.st-bookcard-h.on{color:rgba(255,255,255,.85)}
.st-bookbtn{min-height:40px;border:2px solid;border-radius:12px;padding:10px 8px;font-size:1rem;font-weight:700;background:var(--surface);color:var(--text)}
@media(min-width:640px){.st-bookbtn{min-height:48px}}
.st-bookbtn.on{color:#fff}
.st-scriptpill .st-dim{opacity:.8}
.st-soundbox{margin-block-start:12px;border-radius:12px;background:var(--surface-muted);padding:14px 16px}
.st-soundbox .st-kicker{margin-top:0}
.st-soundlist{list-style:none;margin:8px 0 0;padding:0;display:grid;gap:6px}
.st-check{display:flex;align-items:flex-start;gap:10px;font-size:.9rem;font-weight:400;cursor:pointer}
.st-check input{flex:0 0 auto;width:20px;height:20px;margin-top:2px;accent-color:var(--emerald)}
.st-ready{margin:8px 0 0;font-size:.9rem;font-weight:600;color:var(--emerald)}
.st-goto{margin-block-start:20px;min-height:40px;padding:12px 24px;font-size:1rem}
@media(min-width:640px){.st-goto{min-height:48px}}
/* Session bar + live */
.st-sessionbar{padding:10px}
@media(min-width:640px){.st-sessionbar{padding:10px 12px}}
.st-name{font-weight:600;margin:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.st-sub{margin:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.st-callbtn{display:block;margin-block-start:8px;text-align:center;text-decoration:none}
.st-live{padding:10px 12px}
.st-live-title{font-weight:600}
.st-onair{display:inline-flex;align-items:center;gap:6px;border-radius:999px;background:var(--jali);color:#fff;padding:4px 10px;font-size:.75rem;font-weight:700;letter-spacing:.04em}
.st-dot{width:8px;height:8px;border-radius:50%;background:#fff;animation:st-pulse 1.4s ease-in-out infinite}
@keyframes st-pulse{0%,100%{opacity:1}50%{opacity:.35}}
.st-code{font-family:ui-monospace,monospace;font-size:1rem;font-weight:700;letter-spacing:.2em}
.st-endbtn{color:var(--jali)}
.st-live-err{margin:8px 0 0;font-size:.9rem;color:var(--jali)}
.st-bookbar{padding:10px}
@media(min-width:640px){.st-bookbar{padding:16px}}
/* Toolbar */
.st-toolbar{display:flex;flex-wrap:wrap;align-items:center;gap:8px}
.st-fontgroup{display:flex;align-items:center;gap:4px}
.st-inkcolors{display:flex;align-items:center;gap:4px}
.st-inkdot{width:32px;height:32px;border-radius:50%;border:2px solid transparent;padding:0}
.st-goto{display:flex;align-items:center;gap:6px;font-size:.9rem}
.st-tajkey{padding:12px 16px}
.st-tajkey summary{cursor:pointer;font-size:.9rem;font-weight:600}
.st-keylist{list-style:none;margin:8px 0 0;padding:0;display:flex;flex-wrap:wrap;gap:6px 16px}
.st-keylist li{display:flex;align-items:center;gap:6px;font-size:.9rem}
.st-keychip{width:14px;height:14px;border-radius:3px;box-shadow:inset 0 0 0 1px var(--border)}
/* Reader */
.mushaf-frame{position:relative;border:2px solid var(--gold);border-radius:var(--radius);outline:1px solid var(--border);outline-offset:5px;background:var(--surface);padding:16px 12px}
@media(min-width:640px){.mushaf-frame{padding:24px 32px}}
/* ---- Book dressing: the printed-mushaf look shared by the Library books
   and the teaching studio. Token-based so light and dark themes both work. ---- */
.book-band{border:1px solid var(--gold);outline:1px solid var(--gold);outline-offset:3px;border-radius:12px;background:var(--ivory);padding:14px 12px 12px;text-align:center}
.book-band-ar{font-size:1.9rem;line-height:1.7;margin:0}
.book-band-en{font-size:1.1rem;font-weight:700;margin:6px 0 0}
.book-band-meta{margin:4px 0 0}
.book-band-orn{display:flex;align-items:center;justify-content:center;gap:10px;margin:8px 0 0;color:var(--gold)}
.book-band-orn::before,.book-band-orn::after{content:"";height:1px;flex:1;max-width:90px;background:var(--gold)}
.book-band-diamond{width:9px;height:9px;background:var(--gold);transform:rotate(45deg);flex:none}
.book-pagemark{display:flex;align-items:center;justify-content:center;gap:10px;margin:0 0 6px}
.book-pagemark-num{display:inline-flex;align-items:center;justify-content:center;min-width:38px;height:38px;padding:0 8px;border:2px solid var(--gold);border-radius:50%;font-weight:700;color:var(--emerald);background:var(--surface)}
.book-translation-en{margin:8px 0 0;font-size:15px;line-height:1.65;color:var(--muted)}
.book-translation-ur{margin:8px 0 0;text-align:right}
.book-note{border:1px dashed var(--gold);border-radius:10px;padding:8px 12px;background:var(--ivory)}
.seg{display:inline-flex;border:1px solid var(--border);border-radius:999px;overflow:hidden;background:var(--surface)}
.seg .seg-btn{border:0;background:transparent;padding:7px 13px;font-weight:600;font-size:.88rem;color:var(--text)}
.seg .seg-btn + .seg-btn{border-inline-start:1px solid var(--border)}
.seg .seg-btn[aria-pressed="true"]{background:var(--emerald);color:#fff}
.book-cover{border:1px solid var(--gold);border-radius:12px;background:var(--ivory);padding:16px 12px;text-align:center}
.book-cover h2{margin:2px 0 0}
.book-contents{list-style:none;margin:10px 0 0;padding:0;display:flex;flex-direction:column;gap:6px}
.book-contents button{width:100%;text-align:start;background:var(--surface);border:1px solid var(--border);border-radius:10px;padding:9px 12px;font:inherit;cursor:pointer;color:var(--text)}
.book-contents button[aria-current="true"]{border-color:var(--gold);background:var(--ivory);font-weight:700}
.book-contents button:hover{border-color:var(--gold)}
.book-pagenav{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.book-pagenav .st-flex1{flex:1}
.st-translation-select{max-width:100%}
.st-reader{scroll-margin-top:72px}
.st-surahhead{margin-bottom:12px;text-align:center}
@media(min-width:640px){.st-surahhead{margin-bottom:20px}}
.st-surah-ar{font-size:1.5rem;line-height:1.9}
@media(min-width:640px){.st-surah-ar{font-size:1.9rem}}
.st-surah-en{margin-top:4px;font-size:1.1rem;font-weight:700;letter-spacing:.03em}
.stw-ayahs{display:grid;gap:20px}
.stw-ayah{scroll-margin-top:96px}
.stw-line{text-align:right;line-height:2.2;margin:0}
.stw-word{position:relative;display:inline-flex;flex-direction:column;align-items:center;margin:0 2px;padding:0 4px;border:0;border-radius:6px;background:transparent;font:inherit;color:inherit;cursor:pointer;transition:background-color .15s}
.stw-pill{margin-bottom:2px;border-radius:999px;padding:0 6px;font-family:"Noto Sans",sans-serif;font-size:10px;line-height:16px;font-weight:700;white-space:nowrap;color:#fff}
.stw-badge{position:absolute;bottom:-4px;inset-inline-start:-4px;border-radius:999px;background:var(--emerald);color:#fff;padding:0 4px;font-family:"Noto Sans",sans-serif;font-size:10px;line-height:16px}
.stw-ayahnum{display:inline-flex;align-items:center;justify-content:center;width:1.4em;height:1.4em;margin:0 4px;border:1px solid var(--gold);border-radius:50%;font-size:.55em;color:var(--emerald);vertical-align:middle}
.stw-ayahbar{display:flex;align-items:center;gap:12px;margin-top:4px}
.stw-playbtn{display:flex;align-items:center;justify-content:center;width:36px;height:36px;border:0;border-radius:50%;background:var(--surface-muted);color:var(--emerald)}
.stw-loopbtn{border:0;border-radius:999px;padding:4px 10px;font-size:.75rem;font-weight:600;background:var(--surface-muted);color:var(--muted)}
.stw-loopbtn.on{background:var(--emerald);color:#fff}
.stw-translation{margin:4px 0 0;font-size:.9rem;line-height:1.6;color:var(--muted)}
.stw-pagefoot{margin-top:28px;border-top:1px solid var(--border);padding-top:12px}
.st-pagefoot-row{justify-content:space-between}
.st-page-ar{font-size:1.5rem;color:var(--emerald)}
.st-pagepick{display:flex;align-items:center;justify-content:center;gap:8px;margin-top:12px;font-size:.9rem}
.st-attrib{margin:16px 0 0;font-size:.75rem}
.stw-ink{position:absolute;inset:0;width:100%;height:100%;z-index:2}
/* Qaida */
.st-qaida-band{margin-bottom:20px;border-radius:16px;padding:16px;text-align:center;color:#fff}
.st-qaida-ar{font-size:1.5rem;line-height:1.9;color:#fff}
@media(min-width:640px){.st-qaida-ar{font-size:2.25rem}}
.st-qaida-title{margin-top:4px;font-size:1.25rem;font-weight:700}
.st-intro{max-width:36rem;margin:0 auto;font-size:1rem;color:var(--muted)}
.st-marked-count{margin:4px 0 0;font-size:1rem;font-weight:600;color:var(--emerald)}
.st-qaida-rows{margin-top:20px;display:grid;gap:10px}
.st-qaida-row{display:flex;flex-wrap:wrap;gap:8px}
.st-qaida-item{flex:1;min-width:56px;min-height:56px;border:2px solid;border-radius:12px;padding:10px;text-align:center;background:var(--surface)}
@media(min-width:640px){.st-qaida-item{min-width:64px;min-height:64px}}
.st-qaida-t{display:block;line-height:1.4}
.st-qaida-cap{display:block;margin-top:4px;font-size:.75rem;line-height:1.4;font-weight:600;color:var(--muted)}
.st-qaida-foot{margin-top:28px}
/* Tajweed book */
.st-taj-head{margin-bottom:20px;border-radius:16px;padding:16px;text-align:center}
.st-taj-head .st-qaida-title{color:#fff}
.st-taj-rules{margin-top:20px;display:grid;gap:16px}
.st-taj-rule{border:1px solid var(--border);border-radius:16px;background:var(--surface-muted);padding:16px}
@media(min-width:640px){.st-taj-rule{padding:16px 20px}}
.st-taj-top{justify-content:space-between;align-items:baseline}
.st-taj-name{font-size:1.25rem;font-weight:700;margin:0}
.st-taj-ar{font-size:1.9rem;color:var(--emerald)}
.st-taj-text{margin:6px 0 0;font-size:1rem;line-height:1.7}
.st-taj-ex{margin:12px 0 0}
.st-taj-extext{font-size:1.5rem;line-height:1.9}
@media(min-width:640px){.st-taj-extext{font-size:1.9rem}}
/* Session marks + finish */
.st-h2{font-size:1.1rem;font-weight:700;margin:0 0 8px}
.st-marklist{list-style:none;margin:8px 0 0;padding:0;display:grid;gap:8px}
.st-markrow{display:flex;flex-wrap:wrap;align-items:center;gap:8px;border-radius:8px;background:var(--surface-muted);padding:8px 12px;font-size:.9rem}
.st-markword{font-size:1.25rem}
.st-finishgrid{display:grid;gap:12px;margin-top:12px}
@media(min-width:640px){.st-finishgrid{grid-template-columns:1fr 1fr}}
.st-span2{grid-column:1/-1}
.st-stars{display:flex;gap:4px;margin-top:4px}
.st-star{width:40px;height:40px;border:0;border-radius:50%;background:var(--surface-muted);color:var(--muted);font-size:1rem}
.st-star.on{background:var(--gold);color:#231a00}
.st-status{margin:8px 0 0}
/* Focus view */
.st-focusview{position:fixed!important;inset:0;z-index:60;overflow-y:auto;background:var(--bg);padding:12px;display:block}
@media(min-width:640px){.st-focusview{padding:12px 20px}}
.st-focusview>*{margin-bottom:12px}
.st-focusbar{display:flex;align-items:center;gap:8px;padding:8px 12px}
/* Correction tray + floating tools panel */
.st-tray{position:fixed;inset-inline:0;bottom:0;z-index:70;border-top:1px solid var(--border);background:var(--surface);box-shadow:0 -8px 30px rgba(0,0,0,.18)}
.st-tray-inner{max-width:48rem;margin:0 auto;padding:12px 16px calc(12px + max(12px,env(safe-area-inset-bottom)))}
.st-tray-float{position:fixed;z-index:70;width:330px;max-width:94vw;border:1px solid var(--border);border-radius:16px;background:var(--surface);box-shadow:0 16px 44px rgba(0,0,0,.32)}
.st-tray-scroll{max-height:74vh;overflow-y:auto;padding:8px 12px}
.st-panel-handle{display:flex;align-items:center;gap:8px;border-bottom:1px solid var(--border);padding:8px 12px;cursor:grab;touch-action:none;user-select:none}
.st-grip{display:grid;grid-template-columns:repeat(3,4px);gap:3px;flex:0 0 auto}
.st-grip i{display:block;width:4px;height:4px;border-radius:50%;background:var(--muted)}
.st-panel-title{font-size:.75rem;font-weight:700}
.st-panel-hint{min-width:0;flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:11px}
.st-tray-head{font-size:.9rem;margin:0}
.st-tray-word{font-size:1.5rem}
.st-tierrow{display:flex;gap:8px;margin-top:8px}
.st-tierbtn{flex:1;border:0;border-radius:8px;padding:8px 12px;font-size:.9rem;font-weight:600;background:var(--surface-muted);color:var(--text)}
.st-tierbtn.on-jali{background:var(--jali);color:#fff}
.st-tierbtn.on-khafi{background:var(--khafi);color:#fff}
.st-custom{margin-top:12px;border-top:1px solid var(--border);padding-top:10px}
.st-saverow{display:flex;gap:8px;margin-top:8px}
.st-tools{position:fixed;z-index:70;width:300px;max-width:92vw;border:1px solid var(--border);border-radius:16px;background:var(--surface);box-shadow:0 16px 44px rgba(0,0,0,.32)}
.st-tools-top{display:flex;align-items:stretch}
.st-tools-top .st-panel-handle{flex:1;border-bottom:0}
.st-collapse{flex:0 0 auto;border:0;border-bottom:1px solid var(--border);background:none;padding:0 12px;font-size:.9rem;color:var(--muted)}
.st-tools-body{display:grid;gap:10px;padding:10px 12px}
.st-toolbtn{min-height:36px;padding:6px 12px;font-size:13px}
.st-pagenav{border-top:1px solid var(--border);padding-top:8px;justify-content:space-between}

/* ---- Header: pill language switcher + footer credit (App.tsx) ---- */
.lang-switcher{display:flex;gap:2px;border:1px solid var(--border);border-radius:999px;padding:2px;background:var(--surface)}
.lang-switcher button{border:0;background:transparent;color:var(--text);border-radius:999px;padding:5px 10px;font-size:.82rem;font-weight:600;cursor:pointer}
.lang-switcher button.active{background:var(--emerald);color:#fff}
.owned-by{display:flex;align-items:center;justify-content:center;gap:6px;font-size:.85rem;color:var(--muted);margin:0}
.owned-star{width:16px;height:16px;flex:none}
.owned-name{font-weight:700;color:var(--text)}
@media(max-width:559px){.brand-text{display:none}}
@media(max-width:639px){.auth-visitor{display:none!important}}

/* ---- Auth full-page screen (artifact AuthShell) ---- */
.auth-screen{position:fixed;inset:0;z-index:100;overflow-y:auto;background:var(--bg);padding:28px 16px calc(28px + env(safe-area-inset-bottom))}
.auth-screen[hidden]{display:none!important}
.auth-shell{position:relative;max-width:28rem;margin:0 auto}
.auth-close{position:absolute;top:-8px;inset-inline-end:-4px;width:36px;height:36px;border:0;border-radius:50%;background:var(--surface);color:var(--text);font-size:1.2rem;line-height:1;box-shadow:var(--shadow)}
.auth-brand{text-align:center;margin-block-end:18px}
.auth-logo{width:64px;height:64px;border-radius:14px;object-fit:cover;display:block;margin:0 auto 8px}
.auth-brand-name{font-size:1.3rem;margin:0}
.auth-brand-sub{margin:2px 0 0;color:var(--muted)}
.auth-card{background:var(--surface);border:1px solid var(--border);border-radius:16px;padding:20px;box-shadow:var(--shadow)}
.auth-card h2{margin:0 0 4px}
.role-pills{display:flex;gap:8px;margin-block-end:12px}
.role-pills button{flex:1;border:1px solid var(--border);background:var(--surface);color:var(--text);border-radius:999px;padding:9px 12px;font-weight:600}
.role-pills button.active{background:var(--emerald);color:#fff;border-color:var(--emerald)}
.captcha-row{display:flex;gap:8px;align-items:stretch}
.captcha-box{flex:1}
.captcha-q{margin:0;border:1px dashed var(--gold);border-radius:10px;padding:10px 12px;font-weight:700;background:var(--surface-muted)}
.auth-card .captcha-row input{flex:1}
.btn-block{display:block;width:100%}
.auth-switch{margin-top:14px;display:grid;gap:8px}
.form-error{color:var(--danger);font-size:.9rem;margin:8px 0 0}

/* ---- More view ---- */
.more-title{margin:0 0 4px}
.more-sub{color:var(--muted);margin:0}
.more-h2{font-size:1.05rem;margin:0 0 8px}
.more-h3{font-size:.98rem;margin:0 0 6px}
.more-card{margin-block-end:14px}
.more-appicon{width:48px;height:48px;border-radius:12px;object-fit:cover;flex:none}
.more-install-btn{width:100%;text-align:start}
.more-install-grid{display:grid;grid-template-columns:1fr;gap:8px}
@media(min-width:640px){.more-install-grid{grid-template-columns:repeat(3,1fr)}}
.more-install-cell{border:1px solid var(--border);border-radius:12px;padding:12px;background:var(--surface)}
.more-install-cell-t{margin:0 0 4px}
.more-lang{display:flex;gap:8px}
.more-theme-pills{display:flex;gap:8px;flex-wrap:wrap}
.more-steps{display:grid;gap:10px;margin:0;padding:0;list-style:none}
.more-stepbadge{display:inline-grid;place-items:center;width:26px;height:26px;flex:none;border-radius:50%;background:var(--emerald);color:#fff;font-weight:700;font-size:.85rem}
.more-about{margin:0;padding-inline-start:18px;display:grid;gap:6px}
.more-pwgrid{display:grid;gap:10px}
.more-cta{display:flex;gap:8px;flex-wrap:wrap}
.cert-row-del-confirm{background:var(--danger);color:#fff;border-color:var(--danger)}

/* ---- Language typography + RTL (theme.css verbatim rules) ---- */
html[lang="ur"] body{line-height:2}
html[lang="ur"] .font-display{line-height:2.1}
html[lang="ur"] button,html[lang="ur"] select,html[lang="ur"] input{line-height:1.9}
html[lang="ar"] body{line-height:1.8}
html[lang="ur"] body{font-family:"Noto Nastaliq Urdu","Noto Naskh Arabic",serif}
html[lang="ar"] body{font-family:"Noto Naskh Arabic","Noto Sans",sans-serif}
[dir="rtl"] input:not([dir="ltr"]),[dir="rtl"] select,[dir="rtl"] textarea{text-align:right}
[dir="rtl"] .flip-rtl{transform:scaleX(-1)}

/* ---- Phone tap targets + compaction (theme.css) ---- */
button,[role="button"],select,summary,input:not([type="checkbox"],[type="radio"]){min-height:2rem}
@media (max-width:1023px){
  :root{--radius:13px}
  body{font-size:15px}
  h1{font-size:1.3rem}
  h2{font-size:1.08rem}
  .card{padding:12px}
  .layout{padding:12px}
}

/* Prayer tiles (Daily.tsx PrayerTimesCard): next tile accent + white text. */
.prayer-cell-label{margin:0;font-size:11px;font-weight:600;letter-spacing:.04em;text-transform:uppercase;color:var(--muted)}
.prayer-cell-time{margin:2px 0 0;font-size:13px;font-weight:600;white-space:nowrap}
.prayer-cell.is-next{background:var(--emerald);color:#fff}
.prayer-cell.is-next .prayer-cell-label{color:rgba(255,255,255,.8)}
.prayer-next{margin:0 0 2px;font-weight:600}
.prayer-next-name{color:var(--emerald);font-weight:700}
.prayer-foot{margin:8px 0 0}
.rows-list{list-style:none;margin:0;padding:0;display:grid;gap:8px}
.linklike{background:none;border:0;color:var(--emerald);text-decoration:underline;padding:0}

/* ---- Complete-build fixes (20261130): responsive C1-C8/C11, B1/B2 status,
   A3 neutral fallbacks. Overrides only; nothing above is rewritten. ---- */
[hidden]{display:none!important}

/* C1: roster rows fit at 360: grid column may not exceed its container,
   the middle column shrinks, name ellipsises, meta wraps, chevron fixed. */
.rows-list{grid-template-columns:minmax(0,1fr)}
.rows-list>li{min-width:0}
.stu-roster-item{display:flex;width:100%;min-width:0;align-items:center;gap:12px;text-align:start;cursor:pointer}
.stu-roster-main{min-width:0;flex:1 1 0}
.stu-roster-name{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:1.1rem;line-height:1.25}
.stu-roster-meta{display:block;overflow-wrap:anywhere}
.stu-roster-chevron{flex:0 0 auto;font-size:1.25rem}

/* C2: 3-step strip fits at 360: columns shrink below content size, labels wrap. */
.steps-strip{grid-template-columns:repeat(3,minmax(0,1fr))}
.step-chip{min-width:0;padding:10px 8px}
.step-chip-label{min-width:0;overflow-wrap:anywhere}
@media(max-width:400px){.step-chip{font-size:12px;padding:8px 6px;gap:6px}.step-num{inline-size:24px;block-size:24px;font-size:.8rem}}

/* C3: Library label/select pairs: label shrinks, select truncates instead
   of covering the label text. */
#libQuran label.row,#libHadith label.row,#libTafsir label.row,#libRamadan label.row{flex:1 1 220px;min-width:0;gap:6px}
#libQuran label.row>span,#libHadith label.row>span,#libTafsir label.row>span{flex:0 0 auto}
#libQuran .control-select,#libHadith .control-select,#libTafsir .control-select,#libRamadan .control-select{min-width:0;flex:1 1 auto;max-width:100%}

/* C4: Class View at 360: focus bar wraps, tools hint wraps, page label
   sits on its own line above Prev/Next instead of being squeezed. */
.st-focusbar{flex-wrap:wrap}
.st-focusbar .st-flex1{flex:1 1 140px}
.st-focusbar .btn{flex:0 0 auto}
.st-panel-hint{white-space:normal;overflow:visible;line-height:1.35}
.st-pagenav{flex-wrap:wrap}
.st-pagenav>span{flex:1 1 100%;order:-1;text-align:center}
.st-pagefoot-row{flex-wrap:wrap}
.st-pagepick{flex-wrap:wrap}

/* C5: compact sign-in entry in the sticky phone header (signed-out only;
   the header markup is server-rendered; only the visitor sign-in button
   is shown, create-account stays in the footer/rail). */
@media(max-width:639px){
  .app-header [data-open-auth="signin"].auth-visitor{display:inline-flex!important;align-items:center;min-height:44px;padding:8px 12px;white-space:nowrap}
  .app-header [data-open-auth="signup"].auth-visitor{display:none!important}
  .header-inner{gap:6px}
  .lang-switcher button{padding:5px 8px}
}

/* C6: mode-switch on the auth screen is a plain link, not a second
   stacked primary button (the go-sign-in button stays hidden until its
   error case, via the global [hidden] rule above). */
.auth-switch #authSwitchToSignup{background:none;border:0;text-decoration:underline;padding:10px 8px;min-height:44px}

/* C7: tap targets >=44px: buttons, chips, tray close, portal tabs,
   studio controls. Mushaf words get padding (hit area) with no change
   to the script's font-stretch or letter-spacing. */
.btn{min-height:44px}
.btn-sm{min-height:44px;min-width:44px;padding:8px 14px}
.icon-btn{inline-size:44px;block-size:44px}
.chip{min-height:44px;padding:8px 12px;display:inline-flex;align-items:center}
.st-btn{min-height:44px}
.st-chip{min-height:44px}
.st-tierbtn{min-height:44px}
.st-toolbtn{min-height:44px}
.st-bookbtn{min-height:44px}
.st-collapse{min-height:44px;min-width:44px}
.st-star{width:44px;height:44px}
.st-inkdot{width:44px;height:44px}
.seg .seg-btn{min-height:44px;padding:10px 14px}
.portal-tab{min-height:44px}
.overlay-x{width:44px;height:44px}
.auth-close{width:44px;height:44px}
.stw-word{padding:4px 8px;margin:2px}

/* C8: portal child-reader text >=14px; gold category labels in a darker
   gold (#8A5E00 = 5.6:1 on the ivory portal background). */
#portalFamilyWrap .muted.small{font-size:14px}
#portalFamilyWrap .row-chip{font-size:14px;padding:4px 10px}
.portal-khafi{color:#8A5E00}
.portal-jali{color:var(--jali)}
html[data-theme="dark"] .portal-khafi{color:#E3AC45}

/* C11: family sessions do not get the teacher bottom/rail nav. */
body.family-role .bottom-nav .tab-btn[data-view="teach"],
body.family-role .bottom-nav .tab-btn[data-view="students"],
body.family-role .bottom-nav .tab-btn[data-view="reports"],
body.family-role .bottom-nav .tab-btn[data-view="certificates"]{display:none}
body.family-role .bottom-nav-inner{grid-template-columns:repeat(3,1fr)}
body.family-role .side-link[data-view="teach"],
body.family-role .side-link[data-view="students"],
body.family-role .side-link[data-view="reports"],
body.family-role .side-link[data-view="certificates"]{display:none}

/* A3: academy-name setup prompt (More branding card) + Home hint. */
.setup-prompt{border:1px dashed var(--gold);border-radius:12px;padding:12px;background:var(--ivory);margin-block-end:12px}
.setup-prompt p{margin:0 0 6px}
.brand-setup-hint{margin:0 0 4px}

/* B1: certificate signature status line in the builder. */
.sig-status{font-size:.9rem;margin:12px 0 0;line-height:1.5}
.sig-status .sig-ok{color:var(--ok);font-weight:700}
.sig-status .sig-missing{color:var(--danger);font-weight:700}

/* D3 mount point (filled by a later workstream; empty = invisible). */
.resume-slot:empty{display:none}
.resume-slot{margin-block-end:12px}

/* --- Additions workstream (2026-11-30): tour, resume, stars/badges,
       flip cards, pending marks, sync pill. Reuses existing vars. --- */
.dt-tour-card{position:fixed;left:12px;right:12px;bottom:calc(76px + env(safe-area-inset-bottom));z-index:60;max-width:520px;margin:0 auto;background:var(--surface);color:var(--text);border:1px solid var(--border);border-radius:var(--radius);box-shadow:var(--shadow);padding:14px 16px}
.dt-tour-head{display:flex;justify-content:space-between;align-items:center;gap:8px}
.dt-tour-x{border:0;background:transparent;font-size:1.4rem;line-height:1;cursor:pointer;color:var(--muted);min-width:44px;min-height:44px}
.dt-tour-foot{display:flex;align-items:center;gap:8px;justify-content:flex-end;flex-wrap:wrap}
.dt-tour-dots{margin-inline-end:auto;display:flex;gap:6px}
.dt-tour-dot{width:8px;height:8px;border-radius:50%;background:var(--border)}
.dt-tour-dot.on{background:var(--emerald)}
.dt-tour-highlight{outline:3px solid var(--gold) !important;outline-offset:3px;border-radius:8px}
.dt-resume-card{display:flex;flex-direction:column;gap:2px;width:100%;text-align:start;background:var(--surface);color:var(--text);border:1px solid var(--border);border-inline-start:4px solid var(--gold);border-radius:var(--radius);padding:12px 14px;cursor:pointer;min-height:44px}
.dt-resume-label{font-weight:700}
.dt-resume-where{font-weight:600}
.dt-stars-line{display:flex;align-items:baseline;gap:8px}
.dt-stars-count{font-size:1.8rem;font-weight:800;color:var(--gold-2)}
.dt-stars-label{font-weight:600}
.dt-praise{font-style:italic}
.dt-badge{display:flex;flex-direction:column;gap:2px;border:1px solid var(--border);border-radius:var(--radius);padding:10px 12px;margin-block-end:8px;background:var(--surface-muted)}
.dt-badge-art{display:block;max-width:56px}
.dt-badge-art svg{width:100%;height:auto;display:block}
.dt-flip{display:block;width:100%;background:transparent;border:0;padding:0;cursor:pointer;text-align:inherit;color:inherit;min-height:44px}
.dt-flip-inner{display:block;position:relative}
.dt-flip-face{display:flex;flex-direction:column;gap:2px}
.dt-flip-back{display:none}
.dt-flip.is-flipped .dt-flip-front{display:none}
.dt-flip.is-flipped .dt-flip-back{display:flex}
.st-markrow.is-pending{border:1px dashed var(--gold);border-radius:8px;padding:6px 8px}
.st-pending-label{font-size:.8rem;font-weight:700;color:var(--gold-2);border:1px dashed var(--gold);border-radius:999px;padding:2px 8px;white-space:nowrap}
.stw-pill.is-pending{outline:1px dashed var(--gold);outline-offset:1px}
.dt-sync-pill{display:flex;align-items:center;gap:8px;flex-wrap:wrap;background:var(--surface-muted);border:1px solid var(--border);border-radius:999px;padding:4px 10px;font-size:.85rem;max-width:100%}
.dt-sync-dot{width:10px;height:10px;border-radius:50%;background:var(--ok);flex:none}
.dt-sync-dot.is-offline{background:var(--danger)}
.dt-sync-retry{border:0;background:transparent;color:var(--emerald);font-weight:700;cursor:pointer;min-height:44px;padding:0 6px}
@media (max-width:420px){.dt-tour-card{left:8px;right:8px}}
