/* ─── Ilmgage Notes — same paper, ink and green as books.ilmgage.ai ─── */
:root {
  --paper: #faf7f1;
  --paper-raised: #ffffff;
  --paper-sunk: #f3efe6;
  --ink: #2b2620;
  --ink-soft: #6b6257;
  --ink-faint: #9a9084;
  --accent: #1e6f5c;
  --accent-soft: #e4efeb;
  --gold: #b28a3e;
  --gold-soft: #f3ead8;
  --quran: #2f5d3a;
  --quran-soft: #eef5ee;
  --hadith: #7a4a1e;
  --hadith-soft: #f8efe4;
  --tafsir: #3b5a7a;
  --tafsir-soft: #eaf0f6;
  --rule: #e6dfd3;
  --danger: #a0473a;
  --shadow: 0 1px 3px rgba(60, 50, 30, 0.08), 0 8px 24px rgba(60, 50, 30, 0.06);
  --font-ar: "Amiri", "Scheherazade New", "Noto Naskh Arabic", "Geeza Pro", serif;
  --font-quran: "Amiri Quran", "Amiri", serif;
  --font-en: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --font-ui: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --side: 264px;
  --lib: 420px;
  --top: 56px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #1b1916; --paper-raised: #23211d; --paper-sunk: #171512;
    --ink: #ece6da; --ink-soft: #b6ad9f; --ink-faint: #857c70;
    --accent: #5bb39a; --accent-soft: #1f3530; --gold: #d0a85c; --gold-soft: #3a3020;
    --quran: #8fc79b; --quran-soft: #1e2b21; --hadith: #e0a56b; --hadith-soft: #32261a; --tafsir: #8fb2d6; --tafsir-soft: #1d2834;
    --rule: #38332c; --danger: #e08a7c; --shadow: 0 1px 3px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.3);
  }
}
:root[data-theme="dark"] {
  --paper: #1b1916; --paper-raised: #23211d; --paper-sunk: #171512;
  --ink: #ece6da; --ink-soft: #b6ad9f; --ink-faint: #857c70;
  --accent: #5bb39a; --accent-soft: #1f3530; --gold: #d0a85c; --gold-soft: #3a3020;
  --quran: #8fc79b; --quran-soft: #1e2b21; --hadith: #e0a56b; --hadith-soft: #32261a; --tafsir: #8fb2d6; --tafsir-soft: #1d2834;
  --rule: #38332c; --danger: #e08a7c;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { background: var(--paper); color: var(--ink); font-family: var(--font-en); font-size: 17px; line-height: 1.7; -webkit-font-smoothing: antialiased; overflow: hidden; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.ar, [lang="ar"] { font-family: var(--font-ar); }

/* ─── buttons ─── */
.btn { font-family: var(--font-ui); font-size: 0.82rem; font-weight: 600; padding: 0.38rem 0.8rem; border-radius: 8px; border: 1px solid var(--accent); background: var(--paper-raised); color: var(--accent); cursor: pointer; white-space: nowrap; display: inline-block; }
.btn:hover { background: var(--accent-soft); text-decoration: none; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { border-color: var(--rule); color: var(--ink-soft); }
.btn.small { font-size: 0.74rem; padding: 0.24rem 0.6rem; }
.btn:disabled { opacity: 0.55; cursor: default; }
.iconbtn { background: none; border: 0; cursor: pointer; font-size: 1.2rem; color: var(--ink-soft); padding: 0.2rem 0.5rem; border-radius: 6px; line-height: 1; }
.iconbtn:hover { background: var(--paper-sunk); }
.linkbtn { background: none; border: 0; color: var(--accent); cursor: pointer; font-family: var(--font-ui); font-size: 0.82rem; }
.toggle { font-family: var(--font-ui); font-size: 0.78rem; border: 1px solid var(--rule); background: none; color: var(--ink-faint); border-radius: 999px; padding: 0.15rem 0.6rem; cursor: pointer; }
.toggle#tashkil { font-family: var(--font-ar); font-size: 0.95rem; padding: 0 0.6rem; }
.toggle.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* ─── top bar ─── */
.topbar { height: var(--top); display: flex; align-items: center; gap: 1rem; padding: 0 1rem; border-bottom: 1px solid var(--rule); background: var(--paper); position: relative; z-index: 5; }
.brand { font-family: var(--font-ui); font-weight: 700; color: var(--ink); font-size: 1.05rem; display: flex; align-items: baseline; gap: 0.35rem; }
.brand:hover { text-decoration: none; }
.brand-ar { font-family: var(--font-ar); color: var(--accent); font-size: 1.15rem; font-weight: 400; }
.brand small { font-weight: 500; font-size: 0.66rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-faint); }
.top-mid { flex: 1; display: flex; justify-content: center; }
#note-search { width: min(420px, 100%); font-family: var(--font-ui); font-size: 0.85rem; padding: 0.42rem 0.8rem; border: 1px solid var(--rule); border-radius: 999px; background: var(--paper-raised); color: var(--ink); }
#note-search:focus { outline: none; border-color: var(--accent); }
.top-right { display: flex; align-items: center; gap: 0.5rem; }
.sync-state { font-family: var(--font-ui); font-size: 0.7rem; color: var(--ink-faint); white-space: nowrap; }
.only-narrow { display: none; }

/* ─── layout ─── */
.shell { display: grid; grid-template-columns: var(--side) 1fr 0; height: calc(100% - var(--top)); transition: grid-template-columns 0.18s ease; }
body.lib-open .shell { grid-template-columns: var(--side) 1fr var(--lib); }
.side { border-inline-end: 1px solid var(--rule); background: var(--paper-sunk); display: flex; flex-direction: column; min-height: 0; font-family: var(--font-ui); font-size: 0.86rem; }
.side-sec { padding: 0.8rem 0.7rem 0.4rem; }
.side-sec.grow { flex: 1; min-height: 0; overflow: auto; border-top: 1px solid var(--rule); }
.side-k { display: flex; justify-content: space-between; align-items: center; font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-faint); padding: 0 0.3rem 0.45rem; }
.side-k .add { background: none; border: 0; color: var(--accent); font-size: 1.1rem; cursor: pointer; line-height: 1; }
#notebooks { max-height: 30vh; overflow: auto; }
.nb { display: flex; align-items: center; gap: 0.5rem; width: 100%; text-align: start; background: none; border: 0; padding: 0.38rem 0.5rem; border-radius: 7px; cursor: pointer; color: var(--ink); }
.nb:hover { background: var(--paper-raised); }
.nb.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nb-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); flex: none; }
.nb-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.new-row { display: flex; gap: 0.4rem; padding: 0 0.3rem 0.6rem; }
.pg { display: block; padding: 0.5rem 0.6rem; border-radius: 8px; color: var(--ink); margin-bottom: 2px; }
.pg:hover { background: var(--paper-raised); text-decoration: none; }
.pg.on { background: var(--paper-raised); box-shadow: inset 3px 0 0 var(--accent); }
.pg-title { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pg-meta { display: block; font-size: 0.72rem; color: var(--ink-faint); }
.pg-snip { display: block; font-size: 0.74rem; color: var(--ink-soft); margin-top: 0.2rem; }
.empty { color: var(--ink-faint); font-size: 0.8rem; padding: 0.4rem; }
.side-foot { padding: 0.6rem 1rem; border-top: 1px solid var(--rule); font-size: 0.74rem; color: var(--ink-faint); }

.main { overflow: auto; min-width: 0; }
.no-page { font-family: var(--font-ui); color: var(--ink-faint); text-align: center; margin-top: 20vh; }
.page { max-width: 820px; margin: 0 auto; padding: 2.2rem 2rem 30vh; }
.page-top { display: flex; align-items: center; gap: 0.5rem; }
.page-title { flex: 1; font-family: var(--font-en); font-size: 2rem; font-weight: 600; border: 0; background: none; color: var(--ink); padding: 0.1rem 0; min-width: 0; }
.page-title:focus { outline: none; }
.page-title:dir(rtl) { font-family: var(--font-ar); }
.page-meta { font-family: var(--font-ui); font-size: 0.74rem; color: var(--ink-faint); margin: 0.2rem 0 1.2rem; }

/* ─── the editor ─── */
.page-body { outline: none; min-height: 40vh; font-size: 1.04rem; line-height: 1.8; }
.page-body > * + * { margin-top: 0.55em; }
.page-body p[dir="auto"]:dir(rtl), .page-body li:dir(rtl), .page-body h2:dir(rtl), .page-body h3:dir(rtl) { font-family: var(--font-ar); font-size: 1.32em; line-height: 2; }
.page-body h2 { font-size: 1.5rem; margin-top: 1.3em; }
.page-body h3 { font-size: 1.2rem; margin-top: 1.1em; }
.page-body ul, .page-body ol { padding-inline-start: 1.5em; }
.page-body ul[data-type="taskList"] { list-style: none; padding-inline-start: 0.2em; }
.page-body ul[data-type="taskList"] li { display: flex; gap: 0.5em; }
.page-body ul[data-type="taskList"] li > label { margin-top: 0.15em; }
.page-body blockquote { border-inline-start: 3px solid var(--rule); padding-inline-start: 1em; color: var(--ink-soft); }
.page-body hr { border: 0; border-top: 1px solid var(--rule); margin: 1.4em 0; }
.page-body mark { background: #fbeaa5; color: inherit; border-radius: 2px; }
.page-body p.is-editor-empty:first-child::before { content: attr(data-placeholder); color: var(--ink-faint); float: left; height: 0; pointer-events: none; font-family: var(--font-ui); font-size: 0.92rem; }
.page-body [data-at] { position: relative; }
.page-body [data-at]::before { content: ""; position: absolute; inset-inline-start: -1.1rem; top: 0.75em; width: 6px; height: 6px; border-radius: 50%; background: var(--gold); opacity: 0.55; }
.page-body.lesson-linked [data-at] { cursor: pointer; }
.page-body .ProseMirror-selectednode.qcard { outline: 2px solid var(--accent); }

/* quote cards */
.qcard { margin: 0.9em 0; border: 1px solid var(--rule); border-inline-start: 4px solid var(--gold); background: var(--paper-raised); border-radius: 10px; padding: 0.65rem 0.95rem 0.75rem; box-shadow: var(--shadow); user-select: text; }
.qcard.k-quran { border-inline-start-color: var(--quran); background: linear-gradient(var(--quran-soft), var(--quran-soft)) padding-box; }
.qcard.k-hadith { border-inline-start-color: var(--hadith); }
.qcard.k-tafsir { border-inline-start-color: var(--tafsir); }
.qcard.k-book { border-inline-start-color: var(--gold); }
.qc-head { display: flex; align-items: center; gap: 0.55rem; font-family: var(--font-ui); font-size: 0.74rem; flex-wrap: wrap; }
.qc-kind { font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-faint); font-size: 0.64rem; }
.qc-label { font-weight: 600; color: var(--accent); }
.qc-time { border: 1px solid var(--gold); color: var(--gold); background: none; border-radius: 999px; font-size: 0.68rem; padding: 0 0.5rem; cursor: pointer; }
.qc-tools { margin-inline-start: auto; display: flex; gap: 0.25rem; opacity: 0.35; }
.qcard:hover .qc-tools { opacity: 1; }
.qc-tools button { border: 1px solid var(--rule); background: var(--paper); border-radius: 6px; font-size: 0.68rem; padding: 0 0.4rem; cursor: pointer; color: var(--ink-soft); }
.qc-ar { font-family: var(--font-ar); font-size: 1.42rem; line-height: 2.05; margin: 0.35rem 0 0.1rem; border: 0; padding: 0; color: var(--ink); text-align: right; }
.k-quran .qc-ar { font-family: var(--font-quran); font-size: 1.5rem; color: var(--quran); }
.qc-en { font-size: 0.95rem; color: var(--ink-soft); line-height: 1.65; margin-top: 0.3rem; }
.qc-src { font-family: var(--font-ui); font-size: 0.7rem; color: var(--ink-faint); margin-top: 0.35rem; }
.qc-grade { font-family: var(--font-ui); font-size: 0.66rem; font-weight: 600; padding: 0 0.45rem; border-radius: 999px; background: var(--gold-soft); color: var(--gold); }
.qc-grade.g-sahih { background: var(--quran-soft); color: var(--quran); }
.qc-grade.g-hasan { background: var(--accent-soft); color: var(--accent); }
.qc-grade.g-daif, .qc-grade.g-mawdu { background: #f6e3df; color: var(--danger); }
.ts-chip { border: 1px solid var(--gold); color: var(--gold); background: none; border-radius: 999px; font-family: var(--font-ui); font-size: 0.7rem; padding: 0 0.45rem; cursor: pointer; vertical-align: 0.1em; }

.sources { margin-top: 2.5rem; padding-top: 0.8rem; border-top: 1px solid var(--rule); display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; font-family: var(--font-ui); }
.src-k { font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-faint); margin-inline-end: 0.4rem; }
.src-chip { font-size: 0.74rem; border: 1px solid var(--rule); background: var(--paper-raised); border-radius: 999px; padding: 0.1rem 0.6rem; cursor: pointer; color: var(--ink-soft); }
.src-chip.k-quran { border-color: var(--quran); color: var(--quran); }
.src-chip.k-hadith { border-color: var(--hadith); color: var(--hadith); }
.src-chip.k-tafsir { border-color: var(--tafsir); color: var(--tafsir); }

/* ─── lesson header ─── */
.lesson { border: 1px solid var(--rule); background: var(--paper-raised); border-radius: 12px; padding: 0.8rem 1rem; margin-bottom: 1.4rem; font-family: var(--font-ui); }
.lesson-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0.6rem; }
.lf { display: flex; flex-direction: column; gap: 0.15rem; font-size: 0.68rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-faint); }
.lf input, .lf select { font-family: var(--font-ui); font-size: 0.86rem; text-transform: none; letter-spacing: 0; font-weight: 400; border: 1px solid var(--rule); border-radius: 7px; padding: 0.32rem 0.5rem; background: var(--paper); color: var(--ink); min-width: 0; }
.lf input:focus, .lf select:focus { outline: none; border-color: var(--accent); }
.rec-bar:empty { display: none; }
.rec-bar { margin-top: 0.8rem; }

/* ─── library panel ─── */
.library { border-inline-start: 1px solid var(--rule); background: var(--paper-raised); display: flex; flex-direction: column; min-height: 0; min-width: 0; overflow: hidden; font-family: var(--font-ui); font-size: 0.86rem; }
.lib-head { display: flex; align-items: center; border-bottom: 1px solid var(--rule); padding: 0 0.4rem; }
.lib-tabs { display: flex; flex: 1; overflow-x: auto; }
.lib-tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 0.7rem 0.6rem 0.55rem; cursor: pointer; color: var(--ink-soft); font-size: 0.8rem; font-weight: 600; white-space: nowrap; }
.lib-tabs button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.lib-badge { display: inline-block; min-width: 1.2em; padding: 0 0.3em; border-radius: 999px; background: var(--gold); color: #fff; font-size: 0.66rem; text-align: center; }
.lib-close { background: none; border: 0; font-size: 1.3rem; color: var(--ink-faint); cursor: pointer; padding: 0 0.4rem; }
.lib-body { flex: 1; overflow: auto; padding: 0.8rem; }
.lib-input, .lib-select { width: 100%; font: inherit; padding: 0.5rem 0.7rem; border: 1px solid var(--rule); border-radius: 9px; background: var(--paper); color: var(--ink); margin-bottom: 0.6rem; }
.lib-select { width: auto; flex: 1; min-width: 0; margin-bottom: 0; }
.lib-input:focus, .lib-select:focus { outline: none; border-color: var(--accent); }
.lib-row { display: flex; gap: 0.4rem; align-items: center; margin-bottom: 0.6rem; flex-wrap: wrap; }
.lib-status { color: var(--ink-faint); font-size: 0.8rem; padding: 0.3rem 0 0.6rem; line-height: 1.5; }
.lib-sub { font-size: 0.78rem; color: var(--ink-soft); margin: 0.6rem 0 0.4rem; font-weight: 600; }
.lib-sub .ar { font-size: 1rem; font-weight: 400; }
.lib-chips { display: flex; flex-wrap: wrap; gap: 0.3rem; margin: 0.4rem 0 0.6rem; }
.chip { font-family: var(--font-ar); font-size: 0.92rem; border: 1px solid var(--rule); background: var(--paper); border-radius: 999px; padding: 0 0.6rem; cursor: pointer; color: var(--ink-soft); }
.chip.on { border-color: var(--tafsir); color: var(--tafsir); background: var(--tafsir-soft); }
.res { border: 1px solid var(--rule); border-radius: 10px; padding: 0.55rem 0.7rem; margin-bottom: 0.55rem; background: var(--paper); }
.res.focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.res-head { display: flex; gap: 0.5rem; align-items: center; justify-content: space-between; }
.res-label { font-weight: 600; color: var(--ink); font-size: 0.78rem; }
.res-sub { font-size: 0.74rem; color: var(--ink-faint); }
.res-ar { font-family: var(--font-ar); font-size: 1.18rem; line-height: 1.95; margin: 0.3rem 0; color: var(--ink); text-align: right; }
.k-quran .res-ar { font-family: var(--font-quran); color: var(--quran); }
.res-en { font-family: var(--font-en); font-size: 0.86rem; color: var(--ink-soft); line-height: 1.55; }
.res-snip { font-size: 0.86rem; color: var(--ink-soft); line-height: 1.6; margin: 0.25rem 0; }
.res-snip:dir(rtl) { font-family: var(--font-ar); font-size: 1.1rem; }
.res-snip mark { background: #fbeaa5; color: inherit; }
.res-actions { display: flex; gap: 0.4rem; margin-top: 0.4rem; }
.toc-row { display: flex; flex-direction: column; align-items: flex-start; width: 100%; text-align: start; background: none; border: 0; border-bottom: 1px dashed var(--rule); padding: 0.4rem 0.2rem; cursor: pointer; color: var(--ink-soft); font-size: 0.78rem; }
.toc-row .ar { font-size: 1.05rem; color: var(--ink); align-self: flex-end; }
.toc-row:hover { background: var(--paper); }

/* ─── popups ─── */
.pop { position: fixed; z-index: 20; background: var(--paper-raised); border: 1px solid var(--rule); border-radius: 10px; box-shadow: var(--shadow); font-family: var(--font-ui); }
.slash { width: 270px; padding: 0.3rem; max-height: 340px; overflow: auto; }
.slash button { display: flex; flex-direction: column; align-items: flex-start; width: 100%; background: none; border: 0; text-align: start; padding: 0.35rem 0.55rem; border-radius: 7px; cursor: pointer; }
.slash button b { font-size: 0.84rem; font-weight: 600; }
.slash button span { font-size: 0.72rem; color: var(--ink-faint); }
.slash button.on, .slash button:hover { background: var(--accent-soft); }
.suggest { padding: 0.3rem 0.6rem; font-size: 0.78rem; color: var(--ink-soft); cursor: pointer; }
.suggest kbd { font-family: var(--font-ui); font-size: 0.68rem; border: 1px solid var(--rule); border-bottom-width: 2px; border-radius: 4px; padding: 0 0.3rem; margin-inline-end: 0.25rem; }
.toast { position: fixed; left: 50%; bottom: 1.6rem; transform: translate(-50%, 12px); background: #2b2620; color: #fff; font-family: var(--font-ui); font-size: 0.84rem; padding: 0.55rem 1rem; border-radius: 10px; opacity: 0; pointer-events: none; transition: all 0.18s ease; z-index: 30; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast a { color: #f3d48f; }
.spin { display: inline-block; width: 0.8em; height: 0.8em; border: 2px solid var(--rule); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; margin-inline-end: 0.45em; vertical-align: -0.1em; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── sign-in dialog ─── */
.auth-dlg { margin: auto; border: 1px solid var(--rule); border-radius: 14px; background: var(--paper-raised); color: var(--ink); box-shadow: var(--shadow); width: min(420px, calc(100% - 32px)); padding: 0; }
.auth-dlg::backdrop { background: rgba(30, 25, 20, 0.35); }
.auth-form { display: grid; gap: 0.6rem; padding: 1.3rem 1.4rem; font-family: var(--font-ui); position: relative; }
.auth-form h2 { font-size: 1.1rem; }
.auth-form p { font-size: 0.84rem; color: var(--ink-soft); line-height: 1.5; }
.auth-form input { font: inherit; font-size: 0.9rem; padding: 0.55rem 0.7rem; border: 1px solid var(--rule); border-radius: 8px; background: var(--paper); color: var(--ink); }
.auth-form input:focus { outline: none; border-color: var(--accent); }
.auth-x { position: absolute; top: 0.6rem; right: 0.8rem; background: none; border: 0; font-size: 1.3rem; color: var(--ink-faint); cursor: pointer; }
.auth-links { font-size: 0.8rem; color: var(--ink-faint); }
.auth-msg { font-size: 0.8rem; min-height: 1em; }
.auth-msg.err { color: var(--danger); }

/* ─── narrow screens: the notebooks become a drawer, the library a sheet ─── */
@media (max-width: 900px) {
  :root { --lib: 100vw; }
  .only-narrow { display: inline-block; }
  .shell, body.lib-open .shell { grid-template-columns: 1fr; }
  .side { position: fixed; top: var(--top); bottom: 0; left: 0; width: min(300px, 86vw); z-index: 10; transform: translateX(-102%); transition: transform 0.18s ease; box-shadow: var(--shadow); }
  body.side-open .side { transform: none; }
  .library { position: fixed; inset: var(--top) 0 0 0; z-index: 11; transform: translateY(102%); transition: transform 0.2s ease; }
  body.lib-open .library { transform: none; }
  .top-mid { display: none; }
  .sync-state { display: none; }
  .page { padding: 1.4rem 1rem 30vh; }
  .page-title { font-size: 1.5rem; }
  .brand small { display: none; }
  .topbar { gap: 0.5rem; padding: 0 0.6rem; }
  .toggle#english { display: none; }
}

/* ─── print / PDF: just the page ─── */
@media print {
  body { overflow: visible; background: #fff; }
  .topbar, .side, .library, .page-meta, #page-menu, .lesson, .pop, .qc-tools, .sources { display: none !important; }
  .shell { display: block; height: auto; }
  .main { overflow: visible; }
  .page { padding: 0; max-width: none; }
  .qcard { box-shadow: none; break-inside: avoid; }
}

/* drop-down menus */
.menu { min-width: 200px; padding: 0.3rem; }
.menu button { display: flex; justify-content: space-between; gap: 1rem; width: 100%; background: none; border: 0; text-align: start; padding: 0.4rem 0.6rem; border-radius: 7px; cursor: pointer; font-size: 0.84rem; }
.menu button span { color: var(--ink-faint); font-size: 0.74rem; }
.menu button:hover, .menu button:focus { background: var(--accent-soft); outline: none; }
.menu button.danger { color: var(--danger); }
.menu hr { border: 0; border-top: 1px solid var(--rule); margin: 0.25rem 0; }
.nb-more { margin-inline-start: auto; opacity: 0; padding: 0 0.3rem; border-radius: 5px; color: var(--ink-faint); }
.nb:hover .nb-more, .nb.on .nb-more { opacity: 1; }
.nb-more:hover { background: var(--paper-sunk); }

/* ─── recording, playback, transcript ─── */
.rec-bar { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin-top: 0.9rem; font-size: 0.82rem; }
.rec-start { display: inline-flex; align-items: center; gap: 0.4rem; }
.rec-dot { display: inline-block; width: 0.65em; height: 0.65em; border-radius: 50%; background: #d4483b; }
.rec-start .rec-dot { background: #fff; }
.rec-time .rec-dot { animation: pulse 1.2s ease-in-out infinite; margin-inline-end: 0.4em; }
.rec-time .rec-dot.paused { animation: none; background: var(--ink-faint); }
@keyframes pulse { 50% { opacity: 0.3; } }
.rec-time { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 1rem; }
.rec-hint { color: var(--ink-faint); font-size: 0.76rem; flex-basis: 100%; }
.rec-status { color: var(--ink-soft); }
.rec-err { color: var(--danger); font-size: 0.78rem; flex-basis: 100%; }
.rec-bar progress { width: 180px; }
.rec-player { display: flex; gap: 0.5rem; align-items: center; margin-top: 0.8rem; position: sticky; top: 0; z-index: 2; background: var(--paper-raised); }
.rec-player audio { flex: 1; min-width: 0; height: 36px; }
.rec-player select { font: inherit; font-size: 0.78rem; border: 1px solid var(--rule); border-radius: 7px; background: var(--paper); color: var(--ink); padding: 0.2rem; }
.transcript { margin-top: 0.9rem; border-top: 1px solid var(--rule); padding-top: 0.7rem; }
.tx-head { display: flex; align-items: center; gap: 0.6rem; justify-content: space-between; }
.tx-search { font: inherit; font-size: 0.8rem; border: 1px solid var(--rule); border-radius: 999px; padding: 0.2rem 0.7rem; background: var(--paper); color: var(--ink); width: 200px; }
.tx-refs { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; margin: 0.6rem 0; }
.tx-link { display: inline-flex; align-items: center; gap: 0.35rem; border: 1px solid var(--rule); border-radius: 999px; padding: 0.05rem 0.25rem 0.05rem 0.1rem; font-size: 0.76rem; background: var(--paper); }
.tx-link.k-quran { border-color: var(--quran); }
.tx-link.k-hadith { border-color: var(--hadith); }
.tx-link.k-book { border-color: var(--gold); }
.tx-list { max-height: 340px; overflow: auto; border: 1px solid var(--rule); border-radius: 9px; background: var(--paper); }
.tx-seg { display: flex; gap: 0.5rem; align-items: baseline; padding: 0.3rem 0.6rem; border-bottom: 1px dashed var(--rule); }
.tx-seg.now { background: var(--gold-soft); }
.tx-seg.linked { box-shadow: inset 3px 0 0 var(--quran); }
.tx-text { flex: 1; font-family: var(--font-en); font-size: 0.92rem; line-height: 1.6; }
.tx-text:dir(rtl) { font-family: var(--font-ar); font-size: 1.12rem; }
.tx-t { border: 0; background: none; color: var(--gold); font-variant-numeric: tabular-nums; font-size: 0.74rem; cursor: pointer; padding: 0 0.2rem; }
.tx-q { border: 1px solid var(--rule); background: var(--paper-raised); border-radius: 6px; font-size: 0.68rem; cursor: pointer; color: var(--accent); opacity: 0.4; }
.tx-seg:hover .tx-q, .tx-link .tx-q { opacity: 1; }
