/* IRANSansX (licensed from fontiran.com) — files in public/fonts/iransans/.
   Regular covers weights 300–500 and Bold covers 600–900. If the files are missing, Vazirmatn is used. */
@font-face {
  font-family: 'IRANSans';
  src: url('/static/fonts/iransans/iransans-regular.woff2?v=fanum') format('woff2'), url('/static/fonts/iransans/iransans-regular.woff?v=fanum') format('woff');
  font-weight: 300 500;
  font-display: swap;
}
@font-face {
  font-family: 'IRANSans';
  src: url('/static/fonts/iransans/iransans-bold.woff2?v=fanum') format('woff2'), url('/static/fonts/iransans/iransans-bold.woff?v=fanum') format('woff');
  font-weight: 600 900;
  font-display: swap;
}

@font-face {
  font-family: 'Vazirmatn';
  src: url('/static/fonts/Vazirmatn[wght].woff2') format('woff2-variations'), url('/static/fonts/Vazirmatn[wght].woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --ink: #15261d;
  --text: #26352c;
  --muted: #5d6b62;
  --line: #dde6e0;
  --bg: #f4f6f2;
  --surface: #ffffff;
  --soft: #eef3ee;
  --brand: #1f7a43;
  --brand-dark: #145a30;
  --brand-soft: #e4f2e8;
  --accent: #b9722a;
  --stage: #0f2419;
  --stage-2: #1a3d2a;
  --stage-text: #e9f1ec;
  --ok: #2e7d4f;
  --warn: #a86a12;
  --err: #b3362f;
  --radius: 10px;
  --lime: #a9c83b;
  --shadow: 0 1px 2px rgba(16, 32, 43, .06), 0 4px 16px rgba(16, 32, 43, .06);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: 'IRANSans', 'Vazirmatn', Tahoma, sans-serif; font-size: 16px; line-height: 1.8;
  font-feature-settings: "ss02"; /* IRANSansX: show 0-9 with Persian digit shapes */
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { color: var(--ink); line-height: 1.45; margin: 0 0 .5em; }
h2 { font-size: 1.25rem; }
button, input, select, textarea { font: inherit; color: inherit; }
code { background: var(--soft); padding: 0 .35em; border-radius: 4px; font-size: .9em; }
[dir="ltr"], .ltr { direction: ltr; unicode-bidi: isolate; font-family: "Segoe UI", Tahoma, Arial, sans-serif; font-feature-settings: normal; }
.skip { position: absolute; right: 8px; top: -60px; background: #fff; padding: 8px; z-index: 99; }
.skip:focus { top: 8px; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 55%, white); outline-offset: 2px; }

.wrap { max-width: 1280px; margin: 0 auto; padding: 0 20px; }
.wrap.narrow { max-width: 960px; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: .85rem; margin: .25em 0 .75em; }
.empty { padding: 28px; text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  background: var(--brand); color: #fff; border: 1px solid var(--brand); border-radius: 8px;
  padding: .5em 1.1em; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--brand-dark); text-decoration: none; }
.btn:disabled { opacity: .6; cursor: wait; }
.btn-small { padding: .25em .8em; font-size: .9rem; }
.btn-ghost { background: transparent; color: var(--brand); }
.btn-ghost:hover { background: var(--brand-soft); }
.btn-dark { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.18); color: var(--stage-text); font-weight: 500; }
.btn-dark:hover { background: rgba(255,255,255,.16); }
.btn-dark.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-danger { background: var(--err); border-color: var(--err); }
.btn.full { width: 100%; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--brand); cursor: pointer; }
.linkbtn:hover { text-decoration: underline; }
.linkbtn.danger { color: var(--err); }

/* ---------- header ---------- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar-inner { display: flex; align-items: center; gap: 24px; height: 68px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none !important; }
.brand strong { display: block; font-size: 1.15rem; line-height: 1.2; }
.brand small { display: block; color: var(--muted); font-size: .78rem; line-height: 1.3; }
.topsearch { flex: 1; display: flex; max-width: 560px; margin-inline-start: auto; }
.topsearch input { flex: 1; border: 1px solid var(--line); border-inline-end: 0; border-radius: 0 8px 8px 0; padding: .45em .9em; background: var(--bg); min-width: 0; }
.topsearch button { border: 1px solid var(--brand); background: var(--brand); color: #fff; border-radius: 8px 0 0 8px; padding: 0 .9em; cursor: pointer; display: grid; place-items: center; }
.usernav { display: flex; align-items: center; gap: 16px; white-space: nowrap; }
.usernav form { margin: 0; }
.mainnav { background: var(--brand); }
.mainnav .wrap { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.mainnav a { color: #fff; padding: .7em 1em; font-weight: 500; white-space: nowrap; opacity: .92; }
.mainnav a:hover, .mainnav a.on { background: rgba(255,255,255,.12); text-decoration: none; opacity: 1; }

/* ---------- home ---------- */
.hero { background: linear-gradient(160deg, var(--stage) 0%, var(--stage-2) 100%); color: var(--stage-text); padding: 56px 0; }
.hero-inner { display: grid; grid-template-columns: 1fr auto; gap: 48px; align-items: center; }
.hero h1 { color: #fff; font-size: clamp(1.6rem, 3.4vw, 2.4rem); font-weight: 800; }
.hero p { color: #c6d8cc; max-width: 640px; }
.hero-note { font-size: .88rem; }
.hero-search { display: flex; gap: 8px; max-width: 620px; margin: 20px 0 8px; }
.hero-search input { flex: 1; border: 0; border-radius: 8px; padding: .75em 1em; min-width: 0; color: var(--text); background: #fff; }
.hero-search.big input { border: 1px solid var(--line); }
.hero-search .btn { background: var(--accent); border-color: var(--accent); }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, auto)); gap: 12px; margin: 0; }
.stats div { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12); border-radius: var(--radius); padding: 14px 22px; text-align: center; }
.stats dt { font-size: .85rem; color: #a9c2b1; }
.stats dd { margin: 0; font-size: 1.9rem; font-weight: 800; color: #fff; line-height: 1.3; }
.stats.light { grid-template-columns: repeat(4, 1fr); margin: 16px 0 24px; }
.stats.light div { background: var(--surface); border-color: var(--line); }
.stats.light dt { color: var(--muted); }
.stats.light dd { color: var(--ink); }
.section { margin: 40px 0; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--brand-soft); color: var(--brand-dark); border: 1px solid transparent; border-radius: 999px; padding: .2em .9em; font-size: .9rem; cursor: pointer; }
.chip small { color: var(--muted); }
.chip:hover { text-decoration: none; border-color: var(--brand); }
.chip.plain { background: var(--soft); color: var(--text); cursor: default; }
.chip.plain:hover { border-color: transparent; }
.chip.on { background: var(--brand); color: #fff; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 20px; }
.card { display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); color: var(--text); text-decoration: none !important; transition: transform .15s; }
.card:hover { transform: translateY(-2px); }
.thumb { position: relative; aspect-ratio: 16 / 9; background: var(--stage); display: block; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.dur { position: absolute; left: 8px; bottom: 8px; background: rgba(0,0,0,.72); color: #fff; font-size: .78rem; padding: 0 6px; border-radius: 4px; direction: ltr; }
.progress { position: absolute; inset: auto 0 0 0; height: 4px; background: rgba(255,255,255,.3); }
.progress i { display: block; height: 100%; background: var(--accent); }
.card-body { padding: 10px 14px 14px; display: block; }
.card-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-weight: 600; color: var(--ink); line-height: 1.6; }
.card-meta { display: block; color: var(--muted); font-size: .85rem; margin-top: 4px; }

/* ---------- browse ---------- */
.crumbs { font-size: .9rem; color: var(--muted); margin: 18px 0 10px; }
.page-title { font-size: 1.6rem; margin: 8px 0 6px; }
.eyebrow { color: var(--accent); font-weight: 600; margin: 18px 0 0; font-size: .9rem; }
.lead { color: var(--muted); margin: 0 0 20px; }
.count { color: var(--muted); font-size: .9rem; }
.browse { display: grid; grid-template-columns: 230px 1fr; gap: 24px; margin-bottom: 48px; align-items: start; }
.browse-side { background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); position: sticky; top: 130px; }
.side-head { background: var(--brand); color: #fff; padding: .7em 1.2em; font-weight: 600; }
.browse-side a { display: block; padding: .6em 1.2em; border-bottom: 1px solid var(--line); }
.browse-side a.on { background: var(--soft); color: var(--ink); font-weight: 600; border-inline-start: 4px solid var(--accent); }
.browse-main { min-width: 0; }
.toolbar { display: flex; align-items: center; gap: 16px; background: var(--surface); padding: 10px 14px; border-radius: var(--radius); box-shadow: var(--shadow); flex-wrap: wrap; }
.letters { display: flex; flex-wrap: wrap; gap: 2px; flex: 1; }
.letters a { min-width: 30px; text-align: center; padding: 0 6px; border-radius: 6px; font-weight: 500; }
.letters a.on { background: var(--brand); color: #fff; text-decoration: none; }
.per select { border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; margin-inline-start: 6px; background: #fff; }
.row { display: grid; grid-template-columns: 220px 1fr; gap: 18px; background: var(--surface); border-radius: var(--radius); padding: 14px; margin: 12px 0; box-shadow: var(--shadow); }
.row-thumb { position: relative; aspect-ratio: 16/9; border-radius: 8px; overflow: hidden; background: var(--stage); align-self: start; }
.row-thumb img { width: 100%; height: 100%; object-fit: cover; }
.row-body { min-width: 0; }
.row h3 { font-size: 1.1rem; margin: 0; }
.row .en { color: var(--muted); font-size: .85rem; margin: 0; text-align: right; }
.row .people { margin: 2px 0 6px; }
.row .snippet { font-size: .92rem; color: var(--text); background: var(--soft); border-radius: 6px; padding: 6px 10px; }
mark { background: #fbe3b8; color: inherit; padding: 0 2px; border-radius: 3px; }
.row-actions { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px; }
.abstract { flex-basis: 100%; order: 3; }
.abstract summary { display: inline-flex; cursor: pointer; background: var(--soft); border-radius: 999px; padding: .2em .9em; font-size: .9rem; list-style: none; }
.abstract summary::before { content: '◂'; margin-inline-end: 6px; transition: transform .2s; }
.abstract[open] summary::before { transform: rotate(-90deg); }
.abstract p { margin: 8px 0 0; color: var(--text); font-size: .95rem; }
.row-actions > .abstract { order: 0; flex-basis: auto; }
.row-actions > .abstract[open] { flex-basis: 100%; }
.badge { font-size: .78rem; background: #fdf1e3; color: #8a531d; border-radius: 999px; padding: .15em .8em; }
.hits { margin: -6px 0 14px; padding: 6px 14px; display: flex; gap: 10px; flex-wrap: wrap; font-size: .9rem; color: var(--muted); }
.hits a { direction: ltr; }
.pager { display: flex; justify-content: center; gap: 20px; margin: 24px 0; }
.groups { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.groups a { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: var(--surface); padding: .75em 1em; border-radius: 8px; box-shadow: var(--shadow); color: var(--ink); }
.groups b { background: var(--brand-soft); color: var(--brand-dark); border-radius: 999px; min-width: 28px; text-align: center; font-size: .85rem; padding: 0 8px; }
.groups small { color: var(--muted); }

/* ---------- video page ---------- */
.stage { background: var(--stage); color: var(--stage-text); padding: 24px 0 28px; }
.stage-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 0; border-radius: var(--radius); overflow: hidden; background: #000; box-shadow: 0 10px 40px rgba(0,0,0,.35); }
.stage-grid.no-side { grid-template-columns: 1fr; }
.player-col { background: #000; min-width: 0; display: flex; flex-direction: column; }
.player { display: flex; flex-direction: column; height: 100%; }
.player video { width: 100%; aspect-ratio: 16/9; background: #000; display: block; flex: 1; }
video::cue { font-family: 'IRANSans', 'Vazirmatn', Tahoma, sans-serif; font-feature-settings: "ss02"; font-size: 1.05em; line-height: 1.6; background: rgba(0,0,0,.72); color: #fff; }
.player-bar { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding: 8px 14px; background: #0a1a11; font-size: .88rem; color: #b8cabe; }
.speed { display: flex; align-items: center; gap: 4px; }
.speed button { background: transparent; border: 1px solid rgba(255,255,255,.15); color: #cfdbe3; border-radius: 6px; padding: 0 8px; cursor: pointer; font-size: .82rem; }
.speed button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.quality select { background: #13301f; color: #fff; border: 1px solid rgba(255,255,255,.2); border-radius: 6px; padding: 0 6px; margin-inline-start: 6px; }
.subtoggle, .quality label { flex-direction: row; font-weight: 400; font-size: inherit; }
.subtoggle { display: flex; align-items: center; gap: 6px; cursor: pointer; margin-inline-start: auto; }
.locked { position: relative; aspect-ratio: 16/9; background: #000; }
.locked img { width: 100%; height: 100%; object-fit: cover; opacity: .35; }
.locked-msg { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 20px; gap: 6px; }
.locked-msg strong { font-size: 1.2rem; color: #fff; }
.locked-msg p { color: #c5d3dc; margin: 0; }
.locked-msg .btns { display: flex; gap: 10px; margin-top: 10px; }
.locked-msg .btn-ghost { color: #fff; border-color: rgba(255,255,255,.5); }
.locked-msg .btn-ghost:hover { background: rgba(255,255,255,.1); }

.side-panel { background: #fff; color: var(--text); display: flex; flex-direction: column; min-height: 0; max-height: 100%; position: relative; }
.stage-grid:not(.no-side) .side-panel { height: 0; min-height: 100%; }
.tabs { display: flex; border-bottom: 1px solid var(--line); flex: none; }
.tab { flex: 1; background: none; border: 0; border-bottom: 3px solid transparent; padding: .7em .5em; cursor: pointer; font-weight: 600; color: var(--muted); }
.tab.on { color: var(--ink); border-bottom-color: var(--brand); }
.tab.icon { flex: none; width: 46px; color: var(--brand); font-size: 1.1rem; }
.tab.icon.off { color: #b6bfc6; }
.tabpane { display: none; flex: 1; min-height: 0; flex-direction: column; }
.tabpane.on { display: flex; }
.tsearch { display: flex; gap: 6px; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--line); flex: none; }
.tsearch input { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 6px; padding: .25em .7em; font-size: .9rem; background: var(--bg); }
.tcount { font-size: .8rem; color: var(--muted); white-space: nowrap; }
.langpick select { border: 1px solid var(--line); border-radius: 6px; font-size: .85rem; padding: 2px 4px; background: #fff; }
.transcript { position: relative; overflow-y: auto; padding: 6px 16px 40px; flex: 1; font-size: .93rem; line-height: 1.95; overscroll-behavior: contain; }
.tseg { font-size: .9rem; color: var(--brand-dark); background: var(--brand-soft); padding: 4px 10px; border-radius: 6px; margin: 14px 0 6px; }
.para { margin: 10px 0 14px; }
.para-head { display: flex; align-items: center; gap: 8px; font-size: .82rem; }
.ts { background: none; border: 0; padding: 0; color: var(--brand); cursor: pointer; font-weight: 700; direction: ltr; }
.spk { font-weight: 700; color: var(--ink); }
.para p { margin: 2px 0 0; }
.cue { cursor: pointer; border-radius: 3px; transition: background .15s; }
.cue:hover { background: var(--soft); }
.cue.hit { background: #fbe3b8; }
.cue.on { background: var(--brand); color: #fff; box-shadow: 0 0 0 2px var(--brand); }
.segments { list-style: none; margin: 0; padding: 6px 0; overflow-y: auto; flex: 1; }
.seg { display: grid; grid-template-columns: 30px 1fr auto; gap: 8px; align-items: center; width: 100%; text-align: right; background: none; border: 0; border-bottom: 1px solid var(--line); padding: .7em 1em; cursor: pointer; }
.seg:hover { background: var(--soft); }
.seg.on { background: var(--brand-soft); }
.seg .n { background: var(--brand); color: #fff; border-radius: 50%; width: 26px; height: 26px; display: grid; place-items: center; font-size: .8rem; }
.seg time { color: var(--muted); font-size: .85rem; direction: ltr; }

.stage-meta { padding-top: 18px; }
.stage-meta h1 { color: #fff; font-size: clamp(1.25rem, 2.4vw, 1.7rem); margin-bottom: 0; }
.stage-meta .en { color: #9fb8a7; margin: 0; font-size: .9rem; text-align: right; }
.stage-meta .people a { color: #b7de7a; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

.video-body { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 32px; padding-top: 28px; padding-bottom: 56px; align-items: start; }
.box-section { margin-bottom: 32px; }
.box-section > h2 { border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.abstract-text { text-align: justify; }
.terms { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.term-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.term-box h3 { font-size: .95rem; border-bottom: 1px solid var(--line); padding-bottom: 6px; margin-bottom: 10px; }
.rail { display: grid; grid-auto-flow: column; grid-auto-columns: 220px; gap: 14px; overflow-x: auto; padding-bottom: 10px; scroll-snap-type: x mandatory; }
.rail .card { scroll-snap-align: start; }
.rail .card.current { outline: 3px solid var(--accent); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 18px; overflow: hidden; }
.panel > :not(.panel-title):not(.kv):not(.panel-sub) { margin-inline: 16px; }
.panel > form:last-child, .panel > p:last-child, .panel > a:last-child { margin-bottom: 16px; }
.panel-title { display: block; font-size: 1.05rem; margin: 0; padding: 12px 16px; border-bottom: 1px solid var(--line); cursor: default; }
details.panel > summary.panel-title { cursor: pointer; }
.panel-sub { background: var(--soft); font-weight: 600; font-size: .9rem; padding: 6px 16px; }
.kv { display: grid; grid-template-columns: 110px 1fr; margin: 0; font-size: .9rem; }
.kv dt { color: var(--muted); padding: 7px 16px; border-bottom: 1px solid var(--line); }
.kv dd { margin: 0; padding: 7px 0 7px 16px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.orig { display: inline-block; margin-top: 12px; }

/* ---------- forms / auth ---------- */
.auth { display: grid; place-items: center; padding: 48px 20px 72px; }
.auth-card { width: 100%; max-width: 420px; background: var(--surface); padding: 28px; border-radius: 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px; }
.auth-card h1 { font-size: 1.4rem; margin: 0; }
.auth-card .alt { text-align: center; margin: 0; font-size: .92rem; }
label { display: flex; flex-direction: column; gap: 4px; font-weight: 500; font-size: .92rem; }
label small { color: var(--muted); font-weight: 400; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), textarea, select { border: 1px solid #cfd7de; border-radius: 8px; padding: .5em .8em; background: #fff; font-weight: 400; width: 100%; }
textarea { resize: vertical; line-height: 1.8; }
input:focus, textarea:focus, select:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px var(--brand-soft); }
label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
.notice { padding: 10px 14px; border-radius: 8px; font-size: .92rem; margin: 10px 0; }
.notice.ok { background: #e4f3ea; color: var(--ok); }
.notice.err { background: #fbe9e7; color: var(--err); }
.notice.warn { background: #fdf1e3; color: var(--warn); }
.stack { display: flex; flex-direction: column; gap: 10px; }

/* ---------- admin ---------- */
.adminnav { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 10px 0 18px; overflow-x: auto; }
.adminnav a { padding: .6em 1em; color: var(--muted); border-bottom: 3px solid transparent; white-space: nowrap; }
.adminnav a.on { color: var(--ink); border-bottom-color: var(--brand); font-weight: 600; text-decoration: none; }
.table-wrap { overflow-x: auto; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 48px; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: right; background: var(--soft); padding: 10px 12px; font-weight: 600; white-space: nowrap; }
.table td { padding: 10px 12px; border-top: 1px solid var(--line); vertical-align: middle; }
.nowrap { white-space: nowrap; }
form.inline { display: inline; }
.pill { display: inline-block; border-radius: 999px; padding: 0 .8em; font-size: .8rem; white-space: nowrap; }
.pill.green { background: #e4f3ea; color: var(--ok); }
.pill.amber { background: #fdf1e3; color: var(--warn); }
.pill.red { background: #fbe9e7; color: var(--err); }
.pill.grey { background: var(--soft); color: var(--muted); }
.admin-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 28px; align-items: start; margin-bottom: 56px; }
.admin-form fieldset { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px 18px; margin: 0 0 18px; display: flex; flex-direction: column; gap: 12px; }
.admin-form legend { font-weight: 700; color: var(--ink); padding: 0 6px; }
.narrow-form { max-width: 680px; margin-bottom: 56px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-actions { display: flex; gap: 10px; position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 30%); padding: 18px 0 12px; }
.admin-side .panel > .stack, .admin-side .panel > p, .admin-side .panel > .bar, .admin-side .panel > ul, .admin-side .panel > form { margin: 12px 16px; }
.media-status { font-weight: 500; }
.bar { height: 8px; background: var(--soft); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--brand); transition: width .4s; }
.sublist { list-style: none; padding: 0; }
.sublist li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.danger-zone { border-color: #f0c9c5; }
.danger-zone form { margin: 14px 16px !important; }

/* ---------- footer / toast ---------- */
.footer { background: var(--ink); color: #b5c2cc; padding: 32px 0; font-size: .9rem; }
.footer-inner { display: flex; justify-content: space-between; gap: 32px; flex-wrap: wrap; }
.footer strong { color: #fff; }
.footer p { max-width: 560px; margin: 6px 0 0; }
.footer nav { display: flex; gap: 18px; }
.footer a { color: #cfe8d6; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 8px; opacity: 0; transition: all .25s; z-index: 50; box-shadow: var(--shadow); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .stage-grid { grid-template-columns: minmax(0, 1fr); }
  .stage-grid:not(.no-side) .side-panel { height: auto; max-height: 420px; min-height: 0; }
  .side-panel > * { min-height: 0; }
  .video-body { grid-template-columns: minmax(0, 1fr); }
  .admin-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .topbar-inner { flex-wrap: wrap; height: auto; padding: 10px 20px; gap: 10px; }
  .topsearch { order: 3; flex-basis: 100%; max-width: none; }
  .usernav { margin-inline-start: auto; }
  .topbar { position: static; }
  .hero-inner { grid-template-columns: 1fr; }
  .browse { grid-template-columns: minmax(0, 1fr); }
  .browse-side { position: static; display: flex; overflow-x: auto; }
  .side-head { display: none; }
  .browse-side a { border-bottom: 0; white-space: nowrap; }
  .browse-side a.on { border-inline-start: 0; border-bottom: 3px solid var(--accent); }
  .row { grid-template-columns: minmax(0, 1fr); }
  .terms, .two { grid-template-columns: minmax(0, 1fr); }
  .locked-msg strong { font-size: 1rem; }
  .locked-msg p { font-size: .85rem; }
  .stats.light { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 520px) {
  .wrap { padding: 0 16px; }
  .brand small { display: none; }
  .stats { grid-template-columns: repeat(3, 1fr); }
  .stats div { padding: 10px; }
  .stats dd { font-size: 1.4rem; }
  .hero-search { flex-direction: column; }
  .kv { grid-template-columns: 96px 1fr; }
}

/* ================= brand: Fekr Bonyan logo, Alachigh Ravan owner ================= */
.brand img.brand-mark { width: 46px; height: 46px; object-fit: contain; }
.hero { background: radial-gradient(120% 140% at 90% 0%, #24573a 0%, var(--stage) 55%); }
.hero h1 { position: relative; }
.mainnav { background: linear-gradient(90deg, var(--brand-dark), var(--brand)); }
.cert-logo.tall { height: 92px; max-width: 120px; }
.cert-head { top: 22px; }
.cert-issuer { display: flex; align-items: center; gap: 10px; margin-top: 14px; font-size: .82rem; color: var(--muted); }
.cert-issuer img { height: 54px; width: auto; }
.foot-brand .owner { display: inline-flex; align-items: center; gap: 10px; margin-top: 12px; color: #cfe8d6; }
.foot-brand .owner:hover { text-decoration: none; }
.owner-logo { background: #fff; border-radius: 8px; padding: 4px 6px; display: inline-flex; }
.owner-logo img { height: 44px; width: auto; }

/* ---- form cards: legend as a header inside the card; Persian-safe inline code ---- */
code { font-family: inherit; }
code[dir="ltr"], pre code { font-family: ui-monospace, Consolas, monospace; }
.admin-form fieldset { padding-top: 0; }
.admin-form legend { float: right; width: 100%; font-size: 1.05rem; padding: 14px 0 10px; margin: 0 0 4px; border-bottom: 1px solid var(--line); }
.admin-form legend + * { clear: both; }

.filepick { display: flex; flex-direction: row !important; align-items: center; gap: 10px; position: relative; border: 1px dashed var(--line); border-radius: 8px; padding: 8px 10px; cursor: pointer; background: var(--bg); min-width: 0; }
.filepick:hover { border-color: var(--brand); }
.filepick input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.filepick-name { color: var(--muted); font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; direction: ltr; unicode-bidi: plaintext; }
.filepick.has .filepick-name { color: var(--ink); }

.admin-form [hidden], .admin-side [hidden] { display: none !important; }
#hiddenData .linkbtn { margin-inline-start: 6px; }

.people .role { opacity: .75; font-size: .9em; }
.type-pill { background: rgba(255,255,255,.12); }
.disclaimer { font-size: .85rem; border-inline-start: 3px solid var(--accent); padding: 4px 10px; margin: 8px 0; opacity: .9; }
.kv dd.pre { white-space: pre-line; }

.pat-box { border: 1px dashed var(--line); border-radius: 8px; padding: 8px 12px; }
.pat-box summary { cursor: pointer; font-weight: 600; }
.pat-box[open] { display: flex; flex-direction: column; gap: 10px; }

/* ---------- v10.2: layout review ---------- */
/* space between page content and the footer on every page */
#main { padding-bottom: 56px; }
/* justified RTL text for descriptions. font-kerning is off because Chrome breaks Persian letter joins
   when it justifies text set in IRANSans with kerning on */
.abstract-text, .pc-bio, .md-page p, .md-page li, .gloss dd, .panel .pre, .row-body .abstract, .anote p, .para p, .lead, .justify {
  text-align: justify; font-kerning: none;
}
/* long button labels wrap instead of pushing the page wider on phones */
.btn { max-width: 100%; }
a.btn, button.btn { white-space: normal; }
.app-ver { white-space: nowrap; }
/* sortable admin tables */
.table-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 8px 0 10px; }
.table-filter { max-width: 320px; flex: 1 1 220px; }
th.sort-th { cursor: pointer; user-select: none; white-space: nowrap; }
th.sort-th::after { content: ' ↕'; opacity: .35; font-size: .8em; }
th.sort-th[aria-sort="ascending"]::after { content: ' ▲'; opacity: .8; }
th.sort-th[aria-sort="descending"]::after { content: ' ▼'; opacity: .8; }
th.sort-th:hover, th.sort-th:focus-visible { color: var(--brand); }

.foot-ver { font-size: .75rem; opacity: .7; margin-top: 12px; padding-top: 10px; border-top: 1px solid rgba(255,255,255,.12); }

/* ---------- from fekr-video v2–v10: badges, admin tabs, stats ---------- */
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { background: #a9651f; }
.subbadge { background: #e4f3ea; color: var(--ok); border-radius: 999px; padding: .1em .8em; font-size: .85rem; font-weight: 600; }
.count-dot { background: var(--err); color: #fff; border-radius: 999px; padding: 0 7px; font-size: .75rem; }
.warn-text { color: var(--warn); } .ok-text { color: var(--ok); } .err-text { color: var(--err); }
/* admin: tabs, filters, payments */
.subtabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.subtabs a { padding: .25em .9em; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--text); font-size: .9rem; }
.subtabs a.on { background: var(--brand); border-color: var(--brand); color: #fff; text-decoration: none; }
.filterbar { display: flex; gap: 8px; max-width: 480px; margin-bottom: 14px; }
.grant { display: flex; gap: 4px; align-items: center; }
.grant input { width: 64px !important; padding: .2em .4em !important; text-align: center; }
.review { display: flex; flex-direction: column; gap: 4px; min-width: 180px; }
.review input { padding: .2em .5em !important; font-size: .85rem; }
td.small { font-size: .85rem; }
.legend-link { font-size: .8rem; font-weight: 400; margin-inline-start: 8px; }
/* stats */
.stats.light.six { grid-template-columns: repeat(6, 1fr); }
.chart-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.chart svg { display: block; width: calc(100% - 32px); height: 150px; margin: 14px 16px; background: linear-gradient(var(--line) 1px, transparent 1px) 0 0 / 100% 25%; }
.chart.tall svg { height: 220px; }
.chart svg rect:hover { opacity: .75; }
.axis { display: flex; justify-content: space-between; padding: 0 16px 10px; font-size: .8rem; color: var(--muted); }
.meter { display: inline-block; width: 80px; height: 8px; background: var(--soft); border-radius: 99px; overflow: hidden; vertical-align: middle; }
.meter i { display: block; height: 100%; background: var(--brand); }
.selrow td { background: var(--brand-soft); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 860px) { .two-col { grid-template-columns: minmax(0, 1fr); } .an-pop { max-width: 85%; font-size: .82rem; } }
.app-ver { margin-inline-start: auto; align-self: center; font-size: .75rem; color: var(--muted); }
.app-ver b { color: var(--brand); }

/* ================= articles admin (v0.3) ================= */
.four { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.filters input[type=search] { flex: 2 1 260px; width: auto; }
.filters select { flex: 1 1 160px; width: auto; }
.art-cell { min-width: 260px; }
.art-cell small { display: block; line-height: 1.6; }
.ltr-title { display: block; text-align: left; }
.table-tools select { width: auto; flex: 0 1 320px; }
.admin-side .panel p .pill { margin: 2px 0; }
.job-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin: 12px 0 18px; }
.job-box .bar { margin: 8px 0; }
.result-list { font-size: .9rem; max-height: 260px; overflow: auto; background: var(--soft); border-radius: 8px; padding: 8px 12px; }
.cover-edit { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.cover-edit img { width: 120px; height: auto; border: 1px solid var(--line); border-radius: 4px; }
@media (max-width: 760px) { .four { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ================= public pages (v0.5) ================= */
.crumbs { font-size: .85rem; color: var(--muted); margin: 16px 0 6px; }
.sub-h { font-size: 1.05rem; margin: 18px 0 8px; }
.art-row { background: var(--surface); border-bottom: 1px dashed var(--line); padding: 14px 18px; }
.art-row:first-of-type { border-radius: var(--radius) var(--radius) 0 0; }
.art-title { font-size: 1.05rem; margin: 0 0 4px; font-weight: 600; }
.art-title[dir="ltr"], .art-h1[dir="ltr"], .art-meta[dir="ltr"], .art-authors[dir="ltr"], .art-src[dir="ltr"] { text-align: left; }
.art-orig { color: var(--muted); margin: 0 0 4px; font-size: .9rem; }
.art-meta { font-size: .88rem; color: var(--text); margin: 0; display: flex; flex-direction: column; }
.art-meta a { color: inherit; }
.art-authors a:hover, .art-src a:hover { color: var(--brand); }
.art-doi { color: var(--brand) !important; font-size: .82rem; }
.art-hit { font-size: .88rem; background: var(--soft); border-radius: 6px; padding: 4px 10px; margin: 6px 0 0; }
.art-hit mark, mark { background: #fff1a8; padding: 0 2px; border-radius: 2px; }
.art-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-start; margin-top: 8px; }
.art-actions details.abs { flex-basis: 100%; order: 10; }
.art-actions details.abs[open] summary { margin-bottom: 4px; }
.art-actions details.abs summary { display: inline-block; cursor: pointer; border: 1px solid var(--line); border-radius: 6px; padding: 1px 10px; font-size: .85rem; background: #fff; }
.art-actions details.abs p { font-size: .9rem; background: var(--soft); padding: 10px 14px; border-radius: 8px; margin: 0; }
.chip-btn { border: 1px solid var(--line); border-radius: 6px; padding: 1px 10px; font-size: .85rem; background: #fff; color: var(--text); cursor: pointer; text-decoration: none !important; }
.chip-btn:hover { border-color: var(--brand); color: var(--brand); }
.chip-btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip-btn.primary:hover { background: var(--brand-dark); color: #fff; }
.save-toggle.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }
.oa-badge { font-size: .78rem; color: #b8620b; border: 1px solid #f0c38a; background: #fff6ea; border-radius: 999px; padding: 0 9px; }
.oa-badge::before { content: '🔓 '; }
.type-badge { font-size: .78rem; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 0 9px; background: #fff; }

/* article page */
.art-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; align-items: start; margin-top: 10px; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.art-h1 { font-size: clamp(1.25rem, 2.4vw, 1.7rem); }
.big { font-size: 1rem; }
.art-authors.big a { color: var(--brand); }
.orcid { font-size: .7rem; background: #a6ce39; color: #fff !important; border-radius: 50%; padding: 1px 4px; vertical-align: middle; }
.read-box { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin: 16px 0; }
.read-box .notice { margin: 0; flex: 1 1 100%; }
.btn-big { padding: .65em 1.4em; font-size: 1.05rem; }
.art-sec { margin: 22px 0; }
.art-sec h2 { font-size: 1.05rem; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.abstract-text p { margin: 0 0 .8em; }
.abstract-text[dir="ltr"], .abstract-text:dir(ltr) { text-align: justify; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { background: var(--soft); border-radius: 999px; padding: 1px 12px; font-size: .85rem; color: var(--text); }
.tag.topic { background: var(--brand-soft); color: var(--brand-dark); }
.tag.approach { background: #fdf1e3; color: #8a5413; }
.cite-box { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 12px 16px; font-size: .92rem; padding-inline-start: 2.2em; text-indent: -1.4em; overflow-wrap: anywhere; }
.cite-box[dir="ltr"] { font-family: Georgia, "Times New Roman", serif; text-align: left; }
.thumb-link img { width: 100%; border: 1px solid var(--line); border-radius: 6px; box-shadow: var(--shadow); margin-bottom: 16px; }
.journal-mini { display: flex; gap: 10px; align-items: center; padding: 12px 16px; }
.journal-mini img { border: 1px solid var(--line); }

/* journals */
.az-bar { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; background: var(--soft); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 14px; }
.az { display: flex; flex-wrap: wrap; gap: 2px 10px; font-family: "Segoe UI", Tahoma, Arial, sans-serif; }
.az span { color: #b6c2ba; }
.az a.on { font-weight: 700; text-decoration: underline; }
.az-jump { display: flex; gap: 0; }
.az-jump input { border-radius: 0 8px 8px 0 !important; min-width: 200px; }
.az-jump .btn { border-radius: 8px 0 0 8px; }
.jlist { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 40px; }
.jrow { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 18px; padding: 18px; border-bottom: 1px dashed var(--line); }
.jrow h2 { font-size: 1.2rem; margin: 0 0 4px; font-weight: 500; }
.jcover img, .jabout-cover { border: 1px solid var(--line); box-shadow: 0 1px 3px rgba(0,0,0,.12); background: #fff; }
.jfacts { margin: 4px 0; font-size: .9rem; font-family: "Segoe UI", Tahoma, Arial, sans-serif; text-align: left; }
.jfacts div { display: flex; gap: 6px; }
.jfacts dt { font-weight: 700; }
.jfacts dd { margin: 0; }
.jfacts.col div { display: block; margin-bottom: 6px; }
.jgrid { display: grid; grid-template-columns: 230px minmax(0, 1fr) 230px; gap: 18px; align-items: start; margin-bottom: 40px; }
.vols { font-size: .9rem; }
.vol-year { background: var(--soft); padding: 2px 16px; font-weight: 700; color: var(--muted); }
.vol summary { padding: 4px 16px; cursor: pointer; }
.vol ul { list-style: none; margin: 0; padding: 0 0 4px; }
.vol li a { display: block; padding: 2px 34px; color: var(--text); }
.vol li a.on { background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; }
.issue-head { background: var(--soft); border-radius: 8px; padding: 8px 14px; font-family: "Segoe UI", Tahoma, Arial, sans-serif; }
.pad-in { padding: 14px 16px; }
.jabout-cover { width: 100%; max-width: 180px; display: block; margin: 0 auto 12px; }

/* browse / search */
.groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin-bottom: 40px; }
.adv-search { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 20px; display: flex; flex-direction: column; gap: 10px; }
.adv-rows { display: flex; flex-direction: column; gap: 8px; }
.adv-row { display: grid; grid-template-columns: 120px minmax(0, 1fr) auto 180px; gap: 8px; align-items: center; }
.adv-row:first-child { grid-template-columns: minmax(0, 1fr) auto 180px; }
.adv-row .in { color: var(--muted); }
.adv-filters { border: 0; border-top: 1px solid var(--line); padding: 10px 0 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; }
.adv-filters legend { font-weight: 700; padding: 0 0 4px; }
.adv-filters select { width: auto; }
.years input { width: 80px !important; display: inline-block; }
.person-head { margin-bottom: 14px; }
.note-art { font-size: 1rem; margin: 18px 0 6px; }
blockquote.note { margin: 0 0 8px; background: var(--surface); border-inline-start: 4px solid #f3d34a; padding: 8px 14px; border-radius: 6px; font-size: .92rem; }
blockquote.note p { margin: 4px 0 0; color: var(--ink); }
.hl-green { border-color: #7fd18b !important; } .hl-blue { border-color: #8cc3f2 !important; } .hl-pink { border-color: #f2a1c4 !important; }

@media (max-width: 1080px) { .jgrid { grid-template-columns: 210px minmax(0, 1fr); } .jabout { grid-column: 1 / -1; } }
@media (max-width: 860px) {
  .art-grid, .jgrid { grid-template-columns: minmax(0, 1fr); }
  .art-side { order: -1; }
  .thumb-link { display: none; }
  .adv-row, .adv-row:first-child { grid-template-columns: minmax(0, 1fr); }
  .adv-row .in { display: none; }
  .jrow { grid-template-columns: 64px minmax(0, 1fr); gap: 12px; }
  .jrow .jcover img { width: 64px; }
}

/* ================= reader ================= */
.reader { background: #e9ece9; min-height: 80vh; }
.rbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; background: var(--stage); color: var(--stage-text); padding: 6px 14px; }
.rbar a, .rbar button { color: var(--stage-text); }
.rbar-back { font-size: 1.3rem; text-decoration: none !important; padding: 0 6px; }
.rbar-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .92rem; }
.rbar-group { display: flex; align-items: center; gap: 4px; }
.rbar button { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.18); border-radius: 6px; min-width: 34px; height: 32px; cursor: pointer; font-size: 1rem; }
.rbar button:hover { background: rgba(255,255,255,.18); }
.rbar-page { font-size: .85rem; white-space: nowrap; margin-inline-end: 6px; }
.rbar-page input { width: 48px !important; padding: .1em .3em !important; text-align: center; display: inline-block; color: var(--text); }
.rquota { background: #eef6f0; color: var(--ok); font-size: .82rem; padding: 4px 16px; text-align: center; }
.rquota.warn { background: #fdf1e3; color: var(--warn); }
.rquota.free { background: #fff6ea; color: #b8620b; }
.rbody { display: flex; align-items: flex-start; }
.rside { width: 290px; flex: none; position: sticky; top: 44px; max-height: calc(100vh - 44px); overflow: auto; background: #fff; border-inline-end: 1px solid var(--line); padding: 10px 14px 40px; font-size: .9rem; }
.rside h2 { font-size: .95rem; margin: 12px 0 6px; }
.toc { list-style: none; padding: 0; margin: 0; }
.toc a { display: flex; justify-content: space-between; gap: 8px; padding: 3px 4px; color: var(--text); border-radius: 4px; }
.toc a:hover { background: var(--soft); text-decoration: none; }
.hl-list { list-style: none; padding: 0; margin: 0; }
.hl-list li { border-inline-start: 4px solid #f3d34a; padding: 4px 8px; margin-bottom: 6px; background: var(--soft); border-radius: 4px; font-size: .85rem; }
.hl-list li p { margin: 2px 0 0; color: var(--ink); }
.rpages { flex: 1; min-width: 0; padding: 16px 12px 60px; display: flex; flex-direction: column; align-items: center; gap: 14px; --zoom: 1; }
.rpage { position: relative; width: min(100%, calc(860px * var(--zoom))); background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.18); container-type: inline-size; overflow: hidden; user-select: none; }
.rpage img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; -webkit-user-drag: none; }
.rpage-msg { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); font-size: .9rem; text-align: center; padding: 20px; }
.rpage-msg.err { color: var(--warn); }
.rtext { position: absolute; inset: 0; line-height: 1; user-select: text; }
.rtext span { position: absolute; white-space: pre; color: transparent; transform-origin: 0 0; font-family: sans-serif; cursor: text; }
.rtext span::selection { background: rgba(31, 122, 67, .32); color: transparent; }
.rtext span[data-hl] { background: rgba(255, 225, 60, .45); cursor: pointer; }
.rtext span[data-hl="green"] { background: rgba(110, 210, 120, .42); }
.rtext span[data-hl="blue"] { background: rgba(120, 180, 245, .42); }
.rtext span[data-hl="pink"] { background: rgba(245, 150, 190, .42); }
.rwm { position: absolute; inset: 0; pointer-events: none; display: flex; flex-direction: column; justify-content: space-around; align-items: center; overflow: hidden; }
.rwm span { transform: rotate(-24deg); color: rgba(20, 60, 40, .10); font-size: 3.2cqw; font-weight: 700; white-space: nowrap; user-select: none; }
.selbar { position: absolute; z-index: 30; display: flex; gap: 4px; background: var(--ink); border-radius: 8px; padding: 4px; box-shadow: 0 4px 16px rgba(0,0,0,.25); }
.selbar button { background: transparent; color: #fff; border: 0; border-radius: 5px; padding: 3px 9px; cursor: pointer; font-size: .85rem; }
.selbar button:hover { background: rgba(255,255,255,.14); }
.selbar .sw { width: 22px; height: 22px; padding: 0; border-radius: 50%; border: 2px solid rgba(255,255,255,.6); }
.sw.yellow { background: #ffe13c; } .sw.green { background: #6ed278; } .sw.blue { background: #78b4f5; }
.notepop { position: fixed; z-index: 40; bottom: 20px; left: 50%; transform: translateX(-50%); width: min(94vw, 460px); background: #fff; border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.3); padding: 14px 16px; }
.np-quote { font-size: .88rem; color: var(--muted); max-height: 5.5em; overflow: hidden; margin: 0 0 8px; }
body.night .reader { background: #10150f; }
body.night .rpage { background: #1b1f1c; }
body.night .rpage img { filter: invert(.88) hue-rotate(180deg); }
body.night .rwm span { color: rgba(220, 240, 230, .10); }
@media (max-width: 760px) {
  .rside { position: fixed; top: 44px; bottom: 0; right: 0; z-index: 25; width: 86vw; box-shadow: -4px 0 16px rgba(0,0,0,.2); }
  .rbar-title { display: none; }
  .rpages { padding: 10px 4px 60px; }
}
@media print { body:has(#reader) * { visibility: hidden !important; } body:has(#reader)::after { content: 'چاپ صفحه‌های مقاله ممکن نیست.'; visibility: visible; } }
.rbar-page { display: inline-flex; flex-direction: row; align-items: center; gap: 4px; font-weight: 400; }
/* Latin text inside dir="auto" elements: Latin font and Latin digits (IRANSans' ss02 would show ۰–۹) */
[dir="auto"]:dir(ltr), .ltr-auto:dir(ltr) { font-family: "Segoe UI", Tahoma, Arial, sans-serif; font-feature-settings: normal; }

/* ---------- from fekr-video v8/v11: glossary, home, banners, steps, faq ---------- */
.section { margin: 40px 0; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.letters { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 18px; }
.letters a { padding: 0 .6em; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.gloss dt { font-weight: 700; margin-top: 12px; } .gloss dd { margin: 2px 0 0; color: var(--text); }
.en-term { color: var(--muted); margin-top: -8px; }
.hero-inner.no-stats { grid-template-columns: 1fr; }
.hero-cta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.btn-ghost-light { background: transparent; color: #fff; border-color: rgba(255,255,255,.55); }
.btn-ghost-light:hover { background: rgba(255,255,255,.1); color: #fff; }
/* banners */
.banners { margin: 28px 0 8px; }
.banner-track { position: relative; }
.banner { display: none; position: relative; overflow: hidden; border-radius: 16px; min-height: 190px; color: #fff; text-decoration: none; box-shadow: var(--shadow); }
.banner.on { display: flex; animation: bannerIn .35s ease; }
.banner:hover { text-decoration: none; }
.banner img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.banner.has-img::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to left, rgba(10,25,16,.86) 0%, rgba(10,25,16,.55) 45%, rgba(10,25,16,0) 80%); }
.banner-text { position: relative; z-index: 1; display: flex; flex-direction: column; justify-content: center; gap: 8px; padding: 28px 36px; max-width: 640px; }
.banner-text strong { font-size: clamp(1.2rem, 2.4vw, 1.7rem); font-weight: 800; line-height: 1.5; }
.banner-text span { font-size: .98rem; opacity: .92; line-height: 1.9; }
.banner-btn { align-self: flex-start; font-style: normal; font-weight: 700; margin-top: 6px; background: #fff; color: var(--brand-dark); padding: .5em 1.1em; border-radius: 8px; }
.theme-brand { background: linear-gradient(135deg, var(--brand-dark), var(--brand)); }
.theme-accent { background: linear-gradient(135deg, #8f5519, var(--accent)); }
.theme-accent .banner-btn { color: #8f5519; }
.theme-dark { background: linear-gradient(135deg, var(--stage), var(--stage-2)); }
.theme-light { background: var(--brand-soft); color: var(--ink); border: 1px solid var(--line); }
.theme-light .banner-btn { background: var(--brand); color: #fff; }
.theme-light.has-img { color: #fff; }
.banner-nav { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 10px; }
.banner-arrow { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); cursor: pointer; color: var(--ink); display: grid; place-items: center; padding: 0; }
.banner-arrow:hover { color: var(--brand); border-color: var(--brand); }
.banner-dots { display: flex; gap: 6px; }
.banner-dots button { width: 9px; height: 9px; padding: 0; border-radius: 50%; border: 0; background: #c8d3cc; cursor: pointer; }
.banner-dots button.on { background: var(--brand); width: 22px; border-radius: 6px; }
@keyframes bannerIn { from { opacity: .3; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .banner.on { animation: none; } }
@media (max-width: 640px) {
  .banner { min-height: 220px; }
  .banner.has-img::after { background: linear-gradient(to top, rgba(10,25,16,.9) 0%, rgba(10,25,16,.55) 60%, rgba(10,25,16,.2) 100%); }
  .banner-text { justify-content: flex-end; padding: 22px 20px; }
}
.banner-row { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.banner.mini { display: flex; min-height: 64px; width: 160px; flex: 0 0 160px; border-radius: 8px; }
.banner.mini .banner-text { padding: 8px 10px; }
.banner.mini strong { font-size: .8rem; }
.banner-meta { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.path-card:hover { text-decoration: none; border-inline-start-color: var(--accent); }
.path-card span { color: var(--muted); font-size: .9rem; }
.path-card em { font-style: normal; color: var(--brand); font-size: .85rem; font-weight: 600; }
/* how it works */
.steps { list-style: none; padding: 0; margin: 12px 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; counter-reset: st; }
.steps li { counter-increment: st; background: var(--surface); border-radius: 12px; padding: 18px 20px 18px 20px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 4px; position: relative; padding-inline-start: 62px; }
.steps li::before { content: counter(st, persian); position: absolute; inset-inline-start: 18px; top: 18px; width: 32px; height: 32px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; }
/* faq */
.faq details { background: var(--surface); border-radius: 10px; margin: 8px 0; box-shadow: var(--shadow); }
.faq summary { cursor: pointer; padding: 14px 18px; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; color: var(--brand); font-size: 1.3rem; line-height: 1; }
.faq details[open] summary::after { content: '−'; }
.faq details p { margin: 0; padding: 0 18px 16px; color: var(--muted); line-height: 2; text-align: justify; font-kerning: none; }
.art-list .art-row:last-child { border-bottom: 0; }
.art-list { border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.hero-link { color: #fff; text-decoration: underline; }
.jstrip { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; }
.jcard { display: flex; flex-direction: column; gap: 4px; color: var(--ink); font-size: .85rem; line-height: 1.5; }
.jcard img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border: 1px solid var(--line); border-radius: 4px; background: #fff; }
.jcard:hover { text-decoration: none; color: var(--brand); }
.tag small { color: var(--muted); }

/* ================= assistant (v0.6) ================= */
.ai-grid { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 20px; align-items: start; margin-bottom: 40px; }
.ai-side { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; font-size: .9rem; }
.ai-side h2 { font-size: .95rem; margin: 16px 0 6px; }
.conv-list, .basket-list { list-style: none; padding: 0; margin: 0; }
.conv-list li, .basket-list li { position: relative; padding: 6px 8px 6px 24px; border-radius: 6px; }
.conv-list li.on { background: var(--brand-soft); }
.conv-list li a, .basket-list li a { display: block; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-list small, .basket-list small { display: block; color: var(--muted); font-size: .75rem; }
.conv-list .del-conv, .basket-list .basket-toggle { position: absolute; left: 4px; top: 6px; color: var(--muted); font-size: 1.1rem; }
.ai-main { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; min-height: 70vh; }
.ai-scope { margin: 0; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--soft); font-size: .9rem; }
.chat-log { flex: 1; padding: 16px; display: flex; flex-direction: column; gap: 12px; overflow: auto; }
.chat-empty { color: var(--muted); text-align: center; margin: auto; max-width: 520px; }
.msg { max-width: 92%; border-radius: 12px; padding: 10px 14px; line-height: 1.95; }
.msg.user { align-self: flex-start; background: var(--brand-soft); color: var(--ink); }
.msg.assistant { align-self: flex-end; background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); width: 92%; }
.msg.error { border-color: #f0c9c5; color: var(--err); }
.msg.pending .dots::after { content: ' …'; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }
.msg-body h3, .msg-body h4, .msg-body h5 { font-size: 1rem; margin: 10px 0 4px; }
.msg-body p { margin: 0 0 8px; text-align: justify; font-kerning: none; }
.msg-body ul, .msg-body ol { margin: 4px 0 8px; padding-inline-start: 22px; }
.md-table { overflow-x: auto; margin: 8px 0; }
.md-table table { border-collapse: collapse; font-size: .88rem; min-width: 100%; }
.md-table th, .md-table td { border: 1px solid var(--line); padding: 6px 8px; vertical-align: top; text-align: start; }
.md-table th { background: var(--soft); }
.md-note { background: var(--soft); border-radius: 6px; padding: 6px 10px; margin: 6px 0; }
.cite-link { font-size: .85em; white-space: nowrap; background: var(--brand-soft); border-radius: 4px; padding: 0 4px; }
.msg-foot { display: flex; gap: 10px; align-items: center; border-top: 1px dashed var(--line); margin-top: 8px; padding-top: 4px; font-size: .75rem; color: var(--muted); }
.chat-form { border-top: 1px solid var(--line); padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.chat-opts { display: flex; gap: 8px; flex-wrap: wrap; }
.chat-opts select { width: auto; }
.chat-input { display: flex; gap: 8px; align-items: flex-end; }
.chat-input textarea { flex: 1; resize: vertical; min-height: 44px; }
.chat-selection { background: #fff8d6; border-radius: 6px; padding: 4px 10px; margin: 0 12px; font-size: .82rem; }
/* reader side panel */
.ai-btn { width: auto !important; padding: 0 10px; font-size: .85rem !important; background: var(--accent) !important; border-color: var(--accent) !important; }
.ai-panel { position: fixed; z-index: 35; top: 0; bottom: 0; left: 0; width: min(440px, 100vw); background: #fff; box-shadow: 4px 0 24px rgba(0,0,0,.25); display: flex; flex-direction: column; }
.ai-panel[hidden] { display: none; }
.ai-panel-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; background: var(--stage); color: #fff; }
.ai-panel-head button { color: #fff; font-size: 1.4rem; }
.ai-panel #chat { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.ai-panel .chat-log { min-height: 0; }
.ai-panel .msg.assistant { width: 100%; max-width: 100%; }
@media (max-width: 860px) { .ai-grid { grid-template-columns: minmax(0, 1fr); } .ai-side { order: 2; } }
.three { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.chart svg { height: 160px; }
@media (max-width: 640px) { .three { grid-template-columns: minmax(0, 1fr); } }
.central-box { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; background: var(--brand-soft); border: 1px solid #cfe5d6; border-radius: var(--radius); padding: 12px 16px; margin: 0 0 16px; color: var(--brand-dark); }
.central-box:hover { text-decoration: none; border-color: var(--brand); }
.central-box span { color: var(--muted); font-size: .9rem; }
.central-box em { font-style: normal; margin-inline-start: auto; font-weight: 600; }

/* ---------- v1.2: Persian / English sections, keywords, new home ---------- */
/* segmented language tabs (journals, browse, glossary) */
.langtabs { display: inline-flex; flex-wrap: wrap; gap: 4px; background: var(--soft); border: 1px solid var(--line); border-radius: 12px; padding: 4px; margin: 0 0 16px; }
.langtabs a { display: inline-flex; align-items: center; gap: 8px; padding: .4em 1em; border-radius: 9px; color: var(--text); font-weight: 500; }
.langtabs a small { background: rgba(0,0,0,.06); border-radius: 999px; padding: 0 8px; font-size: .78rem; line-height: 1.7; }
.langtabs a:hover { text-decoration: none; background: #fff; }
.langtabs a.on { background: var(--brand); color: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.langtabs a.on small { background: rgba(255,255,255,.22); }
.az.az-fa { font-family: inherit; gap: 2px 8px; }

/* hero */
.hero-v2 { padding: 56px 0 84px; position: relative; overflow: hidden; }
.hero-v2::after { content: ''; position: absolute; inset-inline-start: -120px; bottom: -160px; width: 420px; height: 420px; border-radius: 50%; background: radial-gradient(circle, rgba(169, 200, 59, .16), transparent 70%); pointer-events: none; }
.hero-v2 .hero-inner > div { position: relative; z-index: 1; }
.hero-kicker { display: inline-block; font-size: .82rem !important; color: #d9e8c4 !important; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14); border-radius: 999px; padding: 2px 12px; margin: 0 0 12px; }
.hero-v2 h1 { max-width: 760px; }
.hero-search { display: block; max-width: 680px; margin: 22px 0 10px; }
.hero-search-row { display: flex; gap: 8px; background: #fff; border-radius: 12px; padding: 6px; box-shadow: 0 8px 28px rgba(0,0,0,.25); }
.hero-search-row input { flex: 1; border: 0; padding: .6em .8em; min-width: 0; color: var(--text); background: transparent; outline: none; }
.hero-search-row .btn { border-radius: 9px; }
.seg { display: inline-flex; gap: 2px; border: 0; margin: 0 0 10px; padding: 3px; background: rgba(255,255,255,.08); border-radius: 10px; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: .2em 1em; border-radius: 8px; color: #cfe0d5; font-size: .9rem; }
.seg input:checked + span { background: #fff; color: var(--brand-dark); font-weight: 600; }
.seg input:focus-visible + span { outline: 2px solid #fff; outline-offset: 1px; }
.hero-sugg { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: .85rem; margin: 10px 0 0; }
.hero-sugg > span { color: #a9c2b1; }
.hero-sugg .kw { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.18); color: #fff; }
.hero-sugg .kw:hover { background: rgba(255,255,255,.2); }
.stats.stats-2x2 { grid-template-columns: repeat(2, minmax(120px, 1fr)); }

/* entry cards overlap the bottom of the hero */
.entry-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin: -48px 0 8px; position: relative; z-index: 2; }
.entry { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 12px; align-items: center; background: var(--surface); border-radius: 14px; padding: 16px 18px; box-shadow: 0 2px 4px rgba(16,32,43,.05), 0 10px 28px rgba(16,32,43,.10); color: var(--ink); border: 1px solid transparent; transition: transform .15s, border-color .15s; }
.entry:hover { text-decoration: none; transform: translateY(-2px); border-color: var(--brand-soft); }
.entry-ic { grid-row: 1 / span 2; width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-dark); }
.entry-ic svg { width: 24px; height: 24px; }
.entry b { font-size: 1.02rem; }
.entry small { color: var(--muted); font-size: .82rem; }
.entry-ai .entry-ic { background: #fdf1e3; color: #8a5413; }

/* two language columns */
.dual { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.section.dual { margin-top: 32px; }
.panel { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); padding: 18px 20px; min-width: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); padding-bottom: 10px; margin-bottom: 6px; }
.panel-head h2, .panel-head h3 { margin: 0; font-size: 1.08rem; display: flex; align-items: center; gap: 8px; }
.panel-head a { font-size: .88rem; white-space: nowrap; }
.panel-empty { color: var(--muted); font-size: .9rem; margin: 18px 0; text-align: center; }
.lang-dot { display: inline-grid; place-items: center; min-width: 30px; height: 24px; padding: 0 6px; border-radius: 6px; font-size: .72rem; font-weight: 700; background: var(--brand-soft); color: var(--brand-dark); font-family: "Segoe UI", Tahoma, Arial, sans-serif; }
.lang-dot.en { background: #e3edf7; color: #24476b; }

/* compact article cards */
.acards { display: flex; flex-direction: column; }
.acard { padding: 12px 0; border-bottom: 1px dashed var(--line); }
.acard:last-child { border-bottom: 0; }
.acard h3 { font-size: 1rem; font-weight: 600; margin: 0 0 4px; line-height: 1.55; }
.acard h3 a { color: var(--ink); }
.acard h3 a:hover { color: var(--brand); }
.acard p { margin: 0; font-size: .85rem; color: var(--muted); line-height: 1.6; }
.acard-src { font-style: italic; }
.acard[dir="ltr"] .acard-src { font-style: italic; }
.acard:not([dir]) .acard-src { font-style: normal; }
.acard-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px !important; }
.acard[dir="ltr"] .acard-badges { justify-content: flex-end; }
.acard-badges:empty { display: none; }
.acard-badges span { font-size: .72rem; border-radius: 999px; padding: 0 9px; line-height: 1.9; font-style: normal; }
.b-full { background: var(--brand-soft); color: var(--brand-dark); }
.b-oa { background: #fff3d6; color: #7a5a06; }
.b-type { background: var(--soft); color: var(--text); }

/* keyword chips and the language chooser */
.kw-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; }
.kw { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 1px 12px; font-size: .86rem; color: var(--text); }
.kw small { color: var(--muted); font-size: .75rem; }
.kw:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
.kw-pop { position: absolute; z-index: 60; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; box-shadow: 0 8px 24px rgba(16,32,43,.18); font-size: .85rem; max-width: calc(100vw - 16px); }
.kw-pop .chip-btn { padding: 2px 14px; }
.kw-index { display: flex; flex-direction: column; gap: 4px; margin-bottom: 40px; }
.kw-group { background: var(--surface); border-radius: 12px; padding: 10px 16px 14px; box-shadow: var(--shadow); }
.kw-letter { font-size: 1.05rem; color: var(--brand-dark); margin: 0; }
.kw-title { font-size: 1.6rem; }
.kw-def { background: var(--surface); border-radius: 10px; padding: 12px 16px; box-shadow: var(--shadow); }
.kw-choice { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 18px 0; }
.kw-choice a { display: flex; flex-direction: column; gap: 2px; background: var(--surface); border: 2px solid var(--line); border-radius: 12px; padding: 14px 18px; color: var(--ink); }
.kw-choice a span { color: var(--muted); font-size: .88rem; }
.kw-choice a:hover { border-color: var(--brand); text-decoration: none; }
.kw-choice a.on { border-color: var(--brand); background: var(--brand-soft); }
.kw-choice a.none { opacity: .6; }

@media (max-width: 1080px) { .entry-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) {
  .dual { grid-template-columns: minmax(0, 1fr); }
  .hero-v2 { padding: 36px 0 72px; }
}
@media (max-width: 520px) {
  .entry-cards { gap: 10px; }
  .entry { padding: 12px; column-gap: 10px; }
  .entry-ic { width: 38px; height: 38px; }
  .hero-search-row .btn { padding: .5em .8em; }
  .kw-choice { grid-template-columns: minmax(0, 1fr); }
  .langtabs { display: flex; }
  .langtabs a { flex: 1; justify-content: center; padding: .4em .6em; }
}
.panel .jstrip { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 12px; margin-top: 10px; }
@media (max-width: 520px) { .panel .jstrip { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; } .panel .jcard { font-size: .78rem; } }
/* hero without the stats column: centred */
.hero-v2 .hero-inner.no-stats { text-align: center; justify-items: center; }
.hero-v2 .hero-inner.no-stats p { margin-inline: auto; }
.hero-v2 .hero-inner.no-stats .hero-search { margin-inline: auto; }
.hero-v2 .hero-inner.no-stats .hero-sugg, .hero-v2 .hero-inner.no-stats .hero-cta { justify-content: center; }
.hero-v2 .hero-inner.no-stats h1 { margin-inline: auto; }
.seg { width: fit-content; }
.hero-v2 .hero-inner.no-stats .seg { margin-inline: auto; }
.hero-v2 h1 { text-wrap: balance; }
@media (max-width: 520px) {
  .entry { grid-template-columns: minmax(0, 1fr); row-gap: 6px; text-align: center; justify-items: center; }
  .entry-ic { grid-row: auto; }
  .entry b { font-size: .95rem; }
}
/* admin: automatic sources */
.admin-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 20px; margin: 18px 0; }
.admin-card h2 { font-size: 1.1rem; }
.inline-form { display: inline; }
.inline-form select { max-width: 220px; }
.members-only { background: var(--brand-soft); border-radius: var(--radius); padding: 14px 18px; }
.members-only p { margin: 0 0 8px; }
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

/* v1.7: «نیازمند بررسی» */
.review-why { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.pill.amber { background: #fff4d6; color: #7a5200; }

/* ================= tests bank (v0.1) ================= */
.hero-tests .hero-inner { grid-template-columns: 1fr; gap: 18px; max-width: 860px; }
.hero-tests h1 { color: #fff; font-size: 1.9rem; margin: 0; }
.hero-tests .lead { color: #d8e6dc; margin: 0; }
.hero-kicker { margin: 0; color: #a9c2b1; font-weight: 600; }
.hero-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.tcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 4px; }
.tcard h3 { font-size: 1.05rem; margin: 0; }
.tcard-en { margin: 0; color: var(--muted); font-size: .85rem; text-align: right; }
.tcard-purpose { margin: 4px 0; font-size: .92rem; font-kerning: none; }
.tcard-badges { display: flex; flex-wrap: wrap; gap: 6px; margin: auto 0 0; padding-top: 6px; align-items: center; }
.abbr { font-size: .8em; color: var(--brand); background: var(--brand-soft); border-radius: 6px; padding: 0 .4em; white-space: nowrap; }
.test-head h1 { margin-bottom: .1em; }
.test-en { color: var(--muted); margin: 0 0 .3em; text-align: right; }
.test-head .actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 0; }
.test-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; margin-top: 18px; align-items: start; }
.test-sec { margin: 0 0 22px; }
.test-sec h2 { font-size: 1.1rem; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.test-sec p { font-kerning: none; }
.test-side { position: sticky; top: 130px; display: grid; gap: 14px; }
.run-panel h2 { font-size: 1rem; }
.run-panel form + form { margin-top: 10px; }
.items-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; }
.items-box summary { cursor: pointer; font-weight: 700; }
.items-list { padding-inline-start: 1.6em; }
.items-list li { margin: 4px 0; }
.docs, .refs { padding-inline-start: 1.2em; }
.docs li, .refs li { margin: 4px 0; }
.parts { padding-inline-start: 1.4em; }
.parts li { margin: 6px 0; }
.parts .row-actions { display: inline-flex; gap: 8px; margin-inline-start: 10px; }
.parts .row-actions form, form.inline { display: inline; }
.steps-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.steps3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; padding: 0; list-style: none; counter-reset: s; }
.steps3 li { counter-increment: s; display: flex; flex-direction: column; gap: 4px; }
.steps3 li b::before { content: counter(s, persian) ". "; color: var(--brand); }
.steps3 span { color: var(--muted); font-size: .92rem; }
.share-link { width: 100%; font-size: 1rem; padding: .6em .8em; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.share-box .actions, .wrap > .actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 14px 0; }
.vpages { display: grid; gap: 18px; justify-items: center; }
.vpage { position: relative; margin: 0; width: min(100%, 860px); background: #fff; box-shadow: var(--shadow); user-select: none; }
.vpage img { width: 100%; height: 100%; display: block; pointer-events: none; }
.vpage figcaption { position: absolute; bottom: 6px; inset-inline-start: 10px; font-size: .75rem; color: var(--muted); }
.vwm { position: absolute; inset: 0; display: grid; place-items: center; color: rgba(20, 40, 30, .09); font-size: 1.6rem; font-weight: 700; transform: rotate(-25deg); pointer-events: none; text-align: center; }
/* participants */
.bare-top .topbar-inner { justify-content: center; }
.take { max-width: 760px; }
.take-form { display: grid; gap: 14px; }
.take-form .q { display: grid; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.take-form fieldset.q { margin: 0; }
.take-form input:not([type=radio]):not([type=checkbox]) { padding: .55em .8em; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
.consent { background: var(--soft); border-radius: var(--radius); padding: 12px 14px; }
.take-step { color: var(--muted); margin: 8px 0 4px; }
.take-bar { height: 6px; background: var(--soft); border-radius: 3px; overflow: hidden; margin-bottom: 16px; }
.take-bar span { display: block; height: 100%; background: var(--brand); }
.take-instr { background: var(--brand-soft); border-radius: var(--radius); padding: 10px 14px; font-kerning: none; }
.item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px 8px; margin: 0; }
.item legend { font-weight: 600; padding: 0; margin-bottom: 8px; line-height: 1.7; float: inline-start; width: 100%; }
.item.missing { border-color: var(--accent); background: #fff8ef; }
.inum { display: inline-grid; place-items: center; min-width: 1.8em; height: 1.8em; border-radius: 50%; background: var(--soft); color: var(--muted); font-size: .8rem; margin-inline-end: 4px; }
.opts { display: flex; flex-wrap: wrap; gap: 6px 8px; clear: both; }
.opt { display: inline-flex; flex-direction: row; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 999px; padding: .4em .9em; cursor: pointer; background: var(--bg); text-align: start; }
.opt input { width: auto; margin: 0; flex: none; }
.opt:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
@media (max-width: 860px) {
  .test-grid { grid-template-columns: 1fr; }
  .test-side { position: static; }
  .steps3 { grid-template-columns: 1fr; }
  .hero-tests h1 { font-size: 1.4rem; }
  .hero-stats { grid-template-columns: repeat(3, 1fr); }
  .opts { flex-direction: column; align-items: stretch; }
}

/* ===== v0.1.1: home page, form alignment, button spacing ===== */
.hero-tests .hero-sugg { margin: 0; }
.hero-tests .hero-cta { margin: 4px 0 0; }
.hero-tests .hero-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 10px; }
.btn-ghost-light { background: transparent; border: 1px solid rgba(255,255,255,.45); color: #fff; }
.btn-ghost-light:hover { background: rgba(255,255,255,.1); text-decoration: none; }
.feat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.feat { display: flex; flex-direction: column; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px; box-shadow: var(--shadow); color: var(--text); text-decoration: none !important; transition: transform .15s, border-color .15s; }
.feat:hover { transform: translateY(-2px); border-color: var(--brand); }
.feat-ic { width: 46px; height: 46px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; margin-bottom: 4px; }
.feat b { color: var(--ink); }
.feat span:last-child { color: var(--muted); font-size: .9rem; line-height: 1.8; }
.fmt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.fmt { display: flex; flex-direction: column; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; color: var(--ink); text-decoration: none !important; }
.fmt:hover { border-color: var(--brand); }
.fmt small { color: var(--muted); }
.steps-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.steps-head h2 { margin: 0; }
.who-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.who { background: var(--surface); border-inline-start: 4px solid var(--brand); border-radius: 10px; padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; box-shadow: var(--shadow); }
.who span { color: var(--muted); font-size: .92rem; line-height: 1.8; }
.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; margin-bottom: 8px; }
.faq summary { cursor: pointer; font-weight: 600; color: var(--ink); }
.faq details p { margin: 10px 0 0; color: var(--text); line-height: 1.9; }
.banks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.banks a { background: linear-gradient(160deg, var(--stage), var(--stage-2)); color: #fff; border-radius: 14px; padding: 18px; display: flex; flex-direction: column; gap: 4px; text-decoration: none !important; }
.banks a span { color: #c6d8cc; font-size: .9rem; }
/* form fields of a row line up at the bottom, whatever the length of their hints; inputs and selects the same height */
.two, .three, .four { align-items: end; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select { min-height: 2.75rem; }
/* forms with a field and a button on one line: room between them */
form.inline-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 14px 0; }
form.inline-form > input:not([type=file]), form.inline-form > select { flex: 1 1 240px; width: auto; max-width: none; }
form.inline-form > .btn, form.inline-form > button { flex: none; }
.form-actions { margin-top: 6px; }
.panel > form + form, .stack > form + form { margin-top: 10px; }
.wrap > .actions, .share-box .actions { gap: 12px; }
.narrow-form.stack { display: flex; flex-direction: column; gap: 10px; }
@media (max-width: 860px) {
  .feat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .who-grid, .banks { grid-template-columns: 1fr; }
  .hero-tests .hero-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .feat-grid { grid-template-columns: 1fr; }
}
.narrow-form + .narrow-form.stack { margin-top: -36px; }
