/* ==========================================================================
   تفسیر موضوعی قرآن — پوستهٔ سایت
   حال‌وهوا: تذهیب نسخه‌های خطی — لاجورد و طلا روی کاغذ نخودی
   ========================================================================== */

@font-face {
  font-family: "Vazirmatn";
  src: url("../fonts/vazirmatn-variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Amiri";
  src: url("../fonts/amiri-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Amiri";
  src: url("../fonts/amiri-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ---------- متغیرها ---------- */
:root {
  color-scheme: light;
  --font-ui: "Vazirmatn", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  --font-quran: "Amiri", "Scheherazade New", "Traditional Arabic", "Times New Roman", serif;

  --bg: #f6f1e6;
  --bg-deep: #ede5d3;
  --surface: #fffdf8;
  --surface-2: #f8f3e7;
  --field: #ffffff;
  --ink: #1b2333;
  --ink-soft: #3f485a;
  --muted: #636b7d;
  --line: #e2d9c4;
  --line-soft: #ece5d4;
  --line-strong: #cfc4a9;

  --lapis: #1e3d78;
  --lapis-solid: #1f4186;
  --lapis-solid-hover: #173368;
  --lapis-tint: #e5eaf5;
  --ring: rgba(31, 65, 134, .22);

  --gold: #c9a04a;
  --gold-ink: #7d5c16;
  --gold-tint: #f4e9cb;

  --teal: #17736c;
  --teal-tint: #dcefec;
  --amber: #8a5d0c;
  --amber-tint: #f7ead0;
  --red: #a3322b;
  --red-solid: #b23a32;
  --red-tint: #f7e1dd;
  --orange: #a84a12;
  --orange-tint: #fbe5d3;

  /* نوارهای لاجوردی (سربرگ و هدر) در هر دو پوسته تیره می‌مانند */
  --band: #132551;
  --band-2: #1b3670;
  --band-ink: #f6f0dd;
  --band-muted: #b8c2dc;
  --band-gold: #e3c57a;

  --radius: 16px;
  --shadow-sm: 0 1px 2px rgba(27, 35, 51, .05), 0 2px 8px -4px rgba(27, 35, 51, .08);
  --shadow-md: 0 2px 4px rgba(27, 35, 51, .05), 0 14px 32px -16px rgba(27, 35, 51, .28);
  --page-shadow: 0 1px 3px rgba(27, 35, 51, .16), 0 10px 28px -14px rgba(27, 35, 51, .3);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1322;
  --bg-deep: #090e1a;
  --surface: #151c2f;
  --surface-2: #1a2238;
  --field: #101727;
  --ink: #ece7d8;
  --ink-soft: #cdc8ba;
  --muted: #9198aa;
  --line: #27314d;
  --line-soft: #1f2841;
  --line-strong: #37446a;

  --lapis: #a3bdf5;
  --lapis-solid: #2f55a6;
  --lapis-solid-hover: #3a63bb;
  --lapis-tint: #1b2947;
  --ring: rgba(163, 189, 245, .28);

  --gold: #d3b062;
  --gold-ink: #dfc27d;
  --gold-tint: #2f2a1c;

  --teal: #62c9bf;
  --teal-tint: #12302d;
  --amber: #e0b765;
  --amber-tint: #33290f;
  --red: #f0968d;
  --red-solid: #b8433a;
  --red-tint: #3a1b19;
  --orange: #f1a66f;
  --orange-tint: #3a2414;

  --band: #0b1630;
  --band-2: #13244c;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-md: 0 14px 34px -16px rgba(0, 0, 0, .7);
  --page-shadow: 0 1px 3px rgba(0, 0, 0, .5), 0 10px 28px -14px rgba(0, 0, 0, .8);
}

/* ---------- پایه ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font: 400 1rem/1.9 var(--font-ui);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { line-height: 1.55; text-wrap: balance; }
a { color: var(--lapis); text-underline-offset: .25em; }
img, svg, video, canvas { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
[lang="ar"] { font-family: var(--font-quran); }

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 6px;
}

.main { flex: 1 0 auto; min-width: 0; }
.wrap { width: min(100% - 2rem, 72rem); margin-inline: auto; }
.page { padding-block: 1.75rem 4rem; }
.page--narrow { width: min(100% - 2rem, 56rem); }
.page--form { width: min(100% - 2rem, 58rem); }
.page--slim { width: min(100% - 2rem, 42rem); }

.sr {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; inset-inline-start: 1rem; top: -4rem; z-index: 500;
  padding: .5rem 1rem; border-radius: 10px; background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow-md); transition: top .15s;
}
.skip:focus { top: .75rem; }

.icon { width: 1.25em; height: 1.25em; flex: none; }

/* ---------- دکمه‌ها ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  min-height: 2.75rem; padding: .45rem 1.15rem;
  border: 1px solid transparent; border-radius: 12px;
  background: transparent; color: var(--ink);
  font: 600 .95rem/1.5 var(--font-ui); text-decoration: none; white-space: nowrap;
  cursor: pointer; user-select: none;
  transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s, transform .1s;
}
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn--sm { min-height: 2.25rem; padding: .25rem .8rem; font-size: .86rem; border-radius: 10px; }
.btn--block { width: 100%; }
.btn--primary { background: var(--lapis-solid); color: #fff; box-shadow: 0 1px 0 rgba(255, 255, 255, .12) inset, 0 6px 14px -8px rgba(31, 65, 134, .7); }
.btn--primary:hover { background: var(--lapis-solid-hover); }
.btn--gold { background: linear-gradient(180deg, #e0bf6f, #c59b41); color: #231a04; box-shadow: 0 1px 0 rgba(255, 255, 255, .35) inset; }
.btn--gold:hover { background: linear-gradient(180deg, #e8ca80, #cfa64c); }
.btn--ghost { border-color: var(--line-strong); background: var(--surface); color: var(--ink-soft); }
.btn--ghost:hover { border-color: var(--gold); color: var(--ink); background: var(--surface-2); }
.btn--danger { background: var(--red-solid); color: #fff; }
.btn--danger:hover { filter: brightness(.92); }
.btn--danger-ghost { border-color: color-mix(in srgb, var(--red) 45%, transparent); color: var(--red); }
.btn--danger-ghost:hover { background: var(--red-tint); }

.iconbtn {
  display: inline-grid; place-items: center; flex: none;
  width: 2.5rem; height: 2.5rem; padding: 0;
  border: 0; border-radius: 10px; background: transparent; color: var(--ink-soft);
  cursor: pointer; text-decoration: none;
  transition: background-color .15s, color .15s;
}
.iconbtn:hover { background: var(--line-soft); color: var(--ink); }
.iconbtn--danger:hover { background: var(--red-tint); color: var(--red); }
.iconbtn[disabled] { opacity: .35; cursor: default; }

/* ---------- سربرگ ---------- */
.topbar {
  position: relative; z-index: 30;
  background: var(--band); color: var(--band-ink);
  border-bottom: 1px solid rgba(201, 160, 74, .5);
}
.topbar__in { display: flex; align-items: center; gap: 1rem; min-height: 4.25rem; }
.brand { display: flex; align-items: center; gap: .7rem; min-width: 0; color: inherit; text-decoration: none; }
.brand__mark { width: 2.4rem; height: 2.4rem; flex: none; fill: rgba(227, 197, 122, .14); stroke: var(--band-gold); stroke-width: 2; stroke-linejoin: round; }
.brand__text { display: flex; flex-direction: column; min-width: 0; line-height: 1.5; }
.brand__title { font-weight: 800; font-size: 1.02rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand__sub { font-size: .74rem; color: var(--band-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.nav { display: flex; align-items: center; gap: .15rem; flex: 1; min-width: 0; margin-inline-start: 1rem; }
.nav__link {
  padding: .35rem .85rem; border-radius: 9px;
  color: var(--band-ink); opacity: .82; text-decoration: none; font-weight: 500; font-size: .94rem; white-space: nowrap;
  transition: background-color .15s, opacity .15s;
}
.nav__link:hover { opacity: 1; background: rgba(255, 255, 255, .08); }
.nav__link.is-active { opacity: 1; background: rgba(255, 255, 255, .1); box-shadow: inset 0 -2px 0 var(--band-gold); }
.nav__search {
  display: flex; align-items: center; margin-inline-start: auto;
  background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .16); border-radius: 999px;
  padding-inline: .95rem .2rem; transition: border-color .15s, background-color .15s;
}
.nav__search:focus-within { border-color: var(--band-gold); background: rgba(255, 255, 255, .13); }
.nav__search input[type="search"], .nav__search input[type="search"]:focus {
  width: 12.5rem; min-width: 0; min-height: 0; height: 2.25rem; padding: 0; border: 0; border-radius: 0; outline: 0;
  background: transparent; box-shadow: none; color: inherit; font-size: .9rem;
}
.nav__search input[type="search"]::placeholder { color: var(--band-muted); opacity: 1; }
.nav__search button { display: grid; place-items: center; width: 2.1rem; height: 2.1rem; border: 0; border-radius: 50%; background: transparent; color: var(--band-gold); cursor: pointer; }
.nav__search input::-webkit-search-cancel-button { display: none; }

.topbar__tools { display: flex; align-items: center; gap: .35rem; flex: none; }
.topbar .iconbtn { color: var(--band-ink); }
.topbar .iconbtn:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.icon--sun, .icon--close, .icon--shrink { display: none; }
[data-theme="dark"] .icon--sun { display: block; }
[data-theme="dark"] .icon--moon { display: none; }
.nav-toggle { display: none; }
.nav-toggle[aria-expanded="true"] .icon--menu { display: none; }
.nav-toggle[aria-expanded="true"] .icon--close { display: block; }

@media (max-width: 62rem) {
  .nav-toggle { display: inline-grid; }
  .nav {
    display: none; position: absolute; top: 100%; inset-inline: 0; margin: 0;
    flex-direction: column; align-items: stretch; gap: .25rem;
    padding: .75rem 1rem 1rem; background: var(--band);
    border-bottom: 1px solid rgba(201, 160, 74, .5); box-shadow: 0 18px 30px -18px rgba(0, 0, 0, .6);
  }
  .nav.is-open { display: flex; }
  .nav__link { padding: .6rem .85rem; font-size: 1rem; }
  .nav__link.is-active { box-shadow: inset 3px 0 0 var(--band-gold); }
  .nav__search { margin: .4rem 0 0; }
  .nav__search input[type="search"], .nav__search input[type="search"]:focus { flex: 1; width: auto; height: 2.6rem; font-size: 1rem; }
  .topbar__in { justify-content: space-between; }
  .topbar__panel span { display: none; }
  .topbar__panel { padding-inline: .6rem; }
}

/* ---------- نوار بخش‌های پنل ---------- */
.subnav { background: var(--surface); border-bottom: 1px solid var(--line); position: relative; z-index: 20; }
.subnav__in { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.subnav__tabs { display: flex; gap: .15rem; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.subnav__tabs::-webkit-scrollbar { display: none; }
.subnav__tabs a {
  display: inline-flex; align-items: center; gap: .4rem; padding: .85rem .8rem;
  color: var(--muted); text-decoration: none; font-weight: 600; font-size: .9rem; white-space: nowrap;
  border-bottom: 2px solid transparent; transition: color .15s, border-color .15s;
}
.subnav__tabs a:hover { color: var(--ink); }
.subnav__tabs a.is-active { color: var(--lapis); border-bottom-color: var(--gold); }
.subnav__user { display: flex; align-items: center; gap: .75rem; flex: none; margin: 0; }
.subnav__who { display: flex; flex-direction: column; line-height: 1.4; text-align: end; font-size: .85rem; }
.subnav__who small { color: var(--muted); font-size: .74rem; }
@media (max-width: 46rem) {
  .subnav__who { display: none; }
  .subnav__user .btn { padding-inline: .6rem; }
}

/* ---------- سرصفحهٔ خانه ---------- */
.hero, .pagehead {
  position: relative; isolation: isolate; overflow: hidden;
  color: var(--band-ink);
  background: radial-gradient(120% 95% at 50% -10%, #2a4c96 0%, var(--band-2) 42%, var(--band) 100%);
  border-bottom: 4px double rgba(214, 178, 96, .85);
}
[data-theme="dark"] .hero, [data-theme="dark"] .pagehead {
  background: radial-gradient(120% 95% at 50% -10%, #1d3672 0%, var(--band-2) 42%, var(--band) 100%);
}
.hero::before, .pagehead::before, body.is-bare::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: url("../img/pattern.svg") center top / 80px 80px;
  -webkit-mask-image: radial-gradient(ellipse 85% 100% at 50% 20%, #000 15%, transparent 80%);
  mask-image: radial-gradient(ellipse 85% 100% at 50% 20%, #000 15%, transparent 80%);
}
.hero { text-align: center; }
.hero__in { padding-block: clamp(2.25rem, 6.5vw, 4.5rem) clamp(2.25rem, 6vw, 4rem); }
.hero__bismillah {
  margin: 0 0 .35rem; color: var(--band-gold);
  font: 400 clamp(1.55rem, 4.2vw, 2.3rem)/1.9 var(--font-quran);
}
.hero__title { margin: 0; font-size: clamp(1.85rem, 5.4vw, 3.25rem); font-weight: 850; line-height: 1.4; letter-spacing: -.01em; }
.hero__lead { margin: .55rem auto 0; max-width: 40rem; color: #d9e0f2; font-size: clamp(1rem, 2.3vw, 1.15rem); }
.hero__meta {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: .3rem .75rem;
  margin: .85rem 0 0; color: var(--band-muted); font-size: .92rem;
}
.hero__dot { color: var(--band-gold); font-size: .5rem; }

.search { display: flex; align-items: center; gap: .5rem; }
.search--hero {
  max-width: 38rem; margin: 1.75rem auto 0; padding: .4rem; padding-inline-start: 1.1rem;
  background: #fffdf8; color: #1b2333; border-radius: 18px;
  box-shadow: 0 0 0 1px rgba(214, 178, 96, .7), 0 22px 50px -22px rgba(0, 0, 0, .75);
}
.search--hero .icon { color: #8a8f9c; }
.search--hero input[type="search"], .search--hero input[type="search"]:focus {
  flex: 1; width: auto; min-width: 0; min-height: 0; height: 2.75rem; padding: 0; border: 0; border-radius: 0; outline: 0;
  background: transparent; box-shadow: none; color: inherit; font-size: 1rem;
}
.search--hero input[type="search"]::placeholder { color: #8a8f9c; opacity: 1; }
.search--hero:focus-within { box-shadow: 0 0 0 2px var(--band-gold), 0 22px 50px -22px rgba(0, 0, 0, .75); }

.stats { display: flex; flex-wrap: wrap; justify-content: center; gap: .75rem clamp(1.5rem, 6vw, 3.75rem); margin: 2rem 0 0; }
.stats div { display: flex; flex-direction: column; align-items: center; }
.stats dd { margin: 0; color: var(--band-gold); font-size: clamp(1.6rem, 4.2vw, 2.25rem); font-weight: 800; line-height: 1.35; font-variant-numeric: tabular-nums; }
.stats dd.stats__text { font-size: clamp(1.05rem, 2.6vw, 1.3rem); line-height: 2.15; font-weight: 700; }
.stats dt { color: var(--band-muted); font-size: .84rem; }
.stats dd a { color: inherit; text-decoration: none; }
.stats dd a:hover { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: .2em; }

/* ---------- سرصفحهٔ صفحه‌های داخلی ---------- */
.pagehead { padding-block: 1.25rem 1.6rem; }
.pagehead__title { margin: .5rem 0 0; font-size: clamp(1.5rem, 4.4vw, 2.2rem); font-weight: 800; }
.pagehead__meta { margin: .2rem 0 0; color: var(--band-muted); font-size: .92rem; }
.pagehead--surah { text-align: center; padding-bottom: 1.25rem; }
.pagehead--surah .crumbs { justify-content: center; }

.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .5rem; font-size: .84rem; color: var(--band-muted); }
.crumbs a { color: inherit; text-decoration: none; }
.crumbs a:hover { color: var(--band-ink); text-decoration: underline; }
.crumbs > span:last-child { color: var(--band-ink); }
.crumbs--dark { color: var(--muted); margin-bottom: 1rem; }
.crumbs--dark a:hover, .crumbs--dark > span:last-child { color: var(--ink); }

/* کتیبهٔ نام سوره */
.cartouche {
  display: inline-block; margin: 1rem 0 .55rem; padding: 3px; max-width: 100%;
  background: linear-gradient(180deg, #edd493, #b98f36);
  clip-path: polygon(1.5rem 0, calc(100% - 1.5rem) 0, 100% 50%, calc(100% - 1.5rem) 100%, 1.5rem 100%, 0 50%);
  font-weight: 400;
}
.cartouche__in {
  display: block; padding: .35rem clamp(2.25rem, 8vw, 4rem) .7rem;
  background: linear-gradient(180deg, #17306a, #0f2150);
  clip-path: polygon(1.5rem 0, calc(100% - 1.5rem) 0, 100% 50%, calc(100% - 1.5rem) 100%, 1.5rem 100%, 0 50%);
  color: #f6e6b4; font: 700 clamp(1.7rem, 6.2vw, 2.9rem)/1.75 var(--font-quran);
}
.surah-nav { display: flex; justify-content: space-between; gap: 1rem; margin-top: .9rem; font-size: .88rem; }
.surah-nav a {
  display: inline-flex; align-items: center; gap: .25rem; padding: .25rem .6rem; border-radius: 9px;
  color: var(--band-muted); text-decoration: none; transition: background-color .15s, color .15s;
}
.surah-nav a:hover { color: var(--band-ink); background: rgba(255, 255, 255, .08); }

/* ---------- بخش‌ها ---------- */
.section { margin-top: 2.75rem; }
.section:first-child { margin-top: .5rem; }
.section__head {
  display: flex; align-items: center; gap: 1rem; margin-bottom: 1.1rem;
  background: linear-gradient(var(--line), var(--line)) center / 100% 1px no-repeat;
}
.section__head h2 {
  display: inline-flex; align-items: center; gap: .55rem; margin: 0; padding-inline-end: 1rem;
  background: var(--bg); font-size: 1.3rem; font-weight: 800;
}
.section__star { width: 1.15rem; height: 1.15rem; fill: var(--gold); flex: none; }
.more {
  display: inline-flex; align-items: center; gap: .15rem; margin-inline-start: auto; padding-inline-start: 1rem;
  background: var(--bg); color: var(--lapis); font-size: .9rem; font-weight: 600; text-decoration: none; white-space: nowrap;
}
.more:hover { text-decoration: underline; }

/* ---------- کارت‌ها ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.cards { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 20.5rem), 1fr)); }

.note-card {
  position: relative; display: flex; flex-direction: column; gap: .5rem; min-width: 0;
  padding: 1.05rem 1.2rem .95rem;
  transition: transform .18s, box-shadow .18s, border-color .18s;
}
.note-card:hover { border-color: var(--gold); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.note-card__top { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; font-size: .8rem; }
.note-card__session { margin-inline-start: auto; color: var(--gold-ink); font-weight: 700; white-space: nowrap; }
.note-card__title { margin: 0; font-size: 1.08rem; font-weight: 700; line-height: 1.75; overflow-wrap: anywhere; }
.note-card__title a { color: var(--ink); text-decoration: none; }
.note-card__title a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.note-card__title a:focus-visible { outline: none; }
.note-card__title a:focus-visible::after { outline: 2px solid var(--gold); outline-offset: 2px; }
.note-card__text {
  margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.9;
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.note-card__foot {
  display: flex; flex-wrap: wrap; align-items: center; gap: .35rem 1rem;
  margin-top: auto; padding-top: .7rem; border-top: 1px dashed var(--line);
  color: var(--muted); font-size: .8rem;
}
.note-card__files { display: flex; flex-wrap: wrap; gap: .3rem; margin-inline-start: auto; }
.meta { display: inline-flex; align-items: center; gap: .3rem; min-width: 0; }
.meta .icon { width: 1rem; height: 1rem; opacity: .75; }

.chip {
  position: relative; z-index: 1; display: inline-flex; align-items: center; padding: .05rem .65rem;
  border-radius: 999px; background: var(--lapis-tint); color: var(--lapis);
  font-weight: 600; text-decoration: none; white-space: nowrap;
}
a.chip:hover { box-shadow: inset 0 0 0 1px var(--lapis); }
.chip--plain { background: transparent; box-shadow: inset 0 0 0 1px var(--line-strong); color: var(--ink-soft); font-weight: 500; }

.tag {
  display: inline-flex; align-items: center; padding: .05rem .55rem; border-radius: 7px;
  background: var(--gold-tint); color: var(--gold-ink); font-size: .76rem; font-weight: 700; white-space: nowrap;
}
.tag--summary { background: var(--teal-tint); color: var(--teal); }
.tag--audio { background: var(--amber-tint); color: var(--amber); }
.tag--slides { background: var(--orange-tint); color: var(--orange); }
.tag--video { background: var(--lapis-tint); color: var(--lapis); }
.tag--exam { background: var(--red-tint); color: var(--red); }
.tag--resource, .tag--plain { background: var(--line-soft); color: var(--ink-soft); }

.filepill {
  display: inline-flex; align-items: center; gap: .25rem; padding: 0 .5rem; border-radius: 999px;
  background: var(--line-soft); color: var(--ink-soft); font-size: .74rem; font-weight: 600; line-height: 1.9;
}
.filepill .icon { width: .95rem; height: .95rem; }
.filepill--pdf { background: var(--red-tint); color: var(--red); }
.filepill--image { background: var(--teal-tint); color: var(--teal); }
.filepill--audio { background: var(--amber-tint); color: var(--amber); }
.filepill--video { background: var(--lapis-tint); color: var(--lapis); }
.filepill--slides { background: var(--orange-tint); color: var(--orange); }

/* کارتی که خودش پخش‌کننده یا دکمهٔ دانلود دارد: فقط عنوان پیوند است، نه کل کارت */
.note-card--rich { gap: .65rem; }
.note-card--rich:hover { transform: none; }
.note-card--rich .note-card__title a::after { content: none; }
.note-card--rich .note-card__title a:hover { color: var(--lapis); text-decoration: underline; }
.note-card__more { display: inline-flex; align-items: center; gap: .35rem; width: fit-content; color: var(--lapis); font-size: .85rem; font-weight: 600; text-decoration: none; }
.note-card__more:hover { text-decoration: underline; }
.note-card__more .icon { width: 1rem; height: 1rem; }
.stack { display: grid; gap: .9rem; }

/* ---------- زبانه‌های نوع محتوا ---------- */
.typetabs { display: flex; gap: .4rem; margin: 0 0 1.25rem; padding-bottom: .2rem; overflow-x: auto; scrollbar-width: none; }
.typetabs::-webkit-scrollbar { display: none; }
.typetab {
  display: inline-flex; align-items: center; gap: .4rem; flex: none; padding: .35rem .9rem;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 999px;
  color: var(--ink-soft); font-size: .9rem; font-weight: 600; text-decoration: none; white-space: nowrap;
  transition: border-color .15s, background-color .15s, color .15s;
}
.typetab .icon { width: 1.05rem; height: 1.05rem; }
.typetab b { min-width: 1.5rem; padding: 0 .4rem; border-radius: 999px; background: var(--line-soft); color: var(--muted); font-size: .76rem; line-height: 1.7; text-align: center; }
.typetab:hover { border-color: var(--gold); color: var(--ink); }
.typetab.is-active { background: var(--lapis-solid); border-color: transparent; color: #fff; }
.typetab.is-active b { background: rgba(255, 255, 255, .22); color: #fff; }

/* ---------- بخش‌های صفحهٔ سوره: جزوه‌ها، صوت و ویس، اسلاید، سایر ---------- */
.group { margin-top: 2.25rem; scroll-margin-top: 1rem; }
.typetabs + .group, .page > .group:first-child { margin-top: .25rem; }
.group__head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem .75rem;
  margin-bottom: 1rem; padding-bottom: .65rem; border-bottom: 1px solid var(--line);
}
.group__head h2 { display: flex; align-items: center; gap: .6rem; margin: 0; font-size: 1.2rem; font-weight: 800; }
.group__head h2 small { padding: 0 .6rem; border-radius: 999px; background: var(--line-soft); color: var(--muted); font-size: .8rem; font-weight: 600; line-height: 1.8; }
.group__icon { display: inline-grid; place-items: center; flex: none; width: 2.2rem; height: 2.2rem; border-radius: 11px; background: var(--gold-tint); color: var(--gold-ink); }
.group__icon--audio { background: var(--amber-tint); color: var(--amber); }
.group__icon--slides { background: var(--orange-tint); color: var(--orange); }
.group__icon--other { background: var(--lapis-tint); color: var(--lapis); }
.group__empty { margin: 0; padding: .9rem 1.1rem; border: 1px dashed var(--line-strong); border-radius: 12px; color: var(--muted); font-size: .92rem; }

/* ---------- پخش‌کنندهٔ صوت‌ها و ویس‌ها ---------- */
.tracks { display: grid; gap: .45rem; margin: 0; padding: 0; list-style: none; }
.track {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .4rem .7rem;
  padding: .5rem .65rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: 13px;
  transition: border-color .15s, background-color .15s;
}
.track.is-ready { grid-template-columns: auto minmax(0, 1fr) auto; }
.track.is-active { border-color: var(--gold); background: var(--gold-tint); }
.track__btn {
  display: inline-grid; place-items: center; flex: none; width: 2.75rem; height: 2.75rem; padding: 0;
  border: 0; border-radius: 50%; background: var(--lapis-solid); color: #fff; cursor: pointer;
  box-shadow: 0 6px 14px -8px rgba(31, 65, 134, .8); transition: background-color .15s, transform .1s;
}
.track__btn:hover { background: var(--lapis-solid-hover); }
.track__btn:active { transform: scale(.96); }
.track__btn .icon { width: 1.3rem; height: 1.3rem; }
.track__btn .icon--play { transform: translateX(1px); }
.track__btn .icon--pause, .track.is-playing .track__btn .icon--play { display: none; }
.track.is-playing .track__btn .icon--pause { display: block; }
.track__main { display: grid; grid-template-columns: minmax(0, 1fr); gap: .1rem; min-width: 0; }
.track__head { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; min-width: 0; }
.track__title {
  flex: 1; min-width: 0; font-size: .95rem; font-weight: 600; line-height: 1.7; text-align: right; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.track__time { flex: none; color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; }
.track__ctrl { display: flex; align-items: center; gap: .6rem; }
.track__seek { flex: 1; min-width: 0; height: 1.6rem; margin: 0; accent-color: var(--lapis-solid); cursor: pointer; }
.track__speed {
  flex: none; min-width: 3.1rem; height: 1.9rem; padding: 0 .5rem; border: 1px solid var(--line-strong); border-radius: 999px;
  background: var(--surface); color: var(--ink-soft); font-size: .8rem; font-weight: 700; cursor: pointer;
}
.track__speed:hover { border-color: var(--gold); }
.track__error { margin: 0; color: var(--red); font-size: .82rem; font-weight: 600; }
.track__native { display: block; width: 100%; height: 2.4rem; margin-top: .3rem; }
[data-theme="dark"] .track__seek { accent-color: var(--gold); }

.filelist--compact { gap: .45rem; }
.filelist--compact .filelist__item { padding: .5rem .65rem; background: var(--surface-2); box-shadow: none; border-radius: 13px; }
.filelist--compact .filelist__icon { width: 2.3rem; height: 2.3rem; }

.clip { margin: 0 0 1rem; }
.clip video { display: block; width: 100%; max-height: 75vh; border-radius: 12px; background: #000; }
.clip figcaption { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .3rem 1rem; margin-top: .4rem; color: var(--muted); font-size: .85rem; }
.clip figcaption a { display: inline-flex; align-items: center; gap: .3rem; color: var(--lapis); font-weight: 600; text-decoration: none; }
.clip figcaption .icon { width: 1rem; height: 1rem; }

/* ---------- سوره‌ها ---------- */
.surah-grid { display: grid; gap: .7rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 15.5rem), 1fr)); }
.surah-tile {
  display: flex; align-items: center; gap: .8rem; min-width: 0; padding: .6rem .9rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-sm);
  color: var(--ink); text-decoration: none;
  transition: transform .18s, box-shadow .18s, border-color .18s;
}
.surah-tile:hover { border-color: var(--gold); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.surah-tile.is-empty { background: transparent; box-shadow: none; }
.surah-tile.is-empty .star-badge { opacity: .6; }
.surah-tile.is-empty .surah-tile__name { color: var(--ink-soft); }
.surah-tile__body { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.surah-tile__name { font: 700 1.38rem/1.7 var(--font-quran); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.surah-tile__meta { color: var(--muted); font-size: .78rem; line-height: 1.6; }
.surah-tile__count {
  flex: none; padding: 0 .6rem; border-radius: 999px; background: var(--gold-tint); color: var(--gold-ink);
  font-size: .76rem; font-weight: 700; line-height: 2;
}

.star-badge { position: relative; display: inline-grid; place-items: center; flex: none; width: 2.75rem; height: 2.75rem; }
.star-badge__shape { position: absolute; inset: 0; width: 100%; height: 100%; fill: var(--gold-tint); stroke: var(--gold); stroke-width: 1.6; stroke-linejoin: round; }
.star-badge__num { position: relative; color: var(--gold-ink); font-size: .86rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.star-badge--xl { width: 6.5rem; height: 6.5rem; margin-bottom: .75rem; }
.star-badge--xl .star-badge__num { font-size: 1.7rem; font-weight: 800; }

.filterbar { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.5rem; margin-bottom: 1.25rem; }
.filterbar .search--inline { flex: 1 1 16rem; max-width: 28rem; }

/* خط زمانیِ جلسه‌ها در صفحهٔ سوره */
.timeline { position: relative; margin: 0; padding: 0; list-style: none; }
.timeline__item { position: relative; display: grid; grid-template-columns: 2.75rem minmax(0, 1fr); gap: .9rem; align-items: start; margin-bottom: 1rem; }
.timeline__item:not(:last-child)::before {
  content: ""; position: absolute; top: 2rem; bottom: -2rem; inset-inline-start: calc(1.375rem - 1px); width: 2px;
  background: var(--gold); opacity: .4;
}
.timeline__mark { position: relative; display: grid; place-items: center; padding-block: .3rem; margin-top: .55rem; background: var(--bg); }
.timeline__dot { width: 1.05rem; height: 1.05rem; margin-block: .55rem; fill: var(--gold); }
@media (max-width: 30rem) {
  .timeline__item:not(:last-child)::before { inset-inline-start: calc(1.125rem - 1px); }
  .timeline__item { grid-template-columns: 2.25rem minmax(0, 1fr); gap: .6rem; }
  .timeline .star-badge { width: 2.25rem; height: 2.25rem; }
  .timeline .star-badge__num { font-size: .76rem; }
}

/* ---------- صفحهٔ جزوه ---------- */
.note__head { margin-bottom: 1.5rem; }
.note__tags { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin-bottom: .6rem; font-size: .85rem; }
.note__title { margin: 0 0 .6rem; font-size: clamp(1.5rem, 4.4vw, 2.15rem); font-weight: 800; line-height: 1.65; overflow-wrap: anywhere; }
.note__meta { display: flex; flex-wrap: wrap; gap: .3rem 1.4rem; margin: 0; padding: 0; list-style: none; color: var(--muted); font-size: .9rem; }
.note__meta li { display: inline-flex; align-items: center; gap: .35rem; }
.note__meta .icon { width: 1.05rem; height: 1.05rem; opacity: .8; }

.staffbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem;
  margin-block: 1rem; padding: .55rem .9rem;
  border: 1px dashed var(--line-strong); border-radius: 12px; background: var(--surface-2);
  color: var(--ink-soft); font-size: .85rem;
}
.staffbar > span { display: inline-flex; align-items: center; gap: .4rem; }

.prose { padding: clamp(1.1rem, 3.2vw, 2rem); font-size: 1.05rem; line-height: 2.15; overflow-wrap: anywhere; }
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose p { margin: 0 0 1.05em; }
.prose h2 { margin: 1.7em 0 .5em; font-size: 1.35rem; font-weight: 800; color: var(--lapis); }
.prose h3 { margin: 1.5em 0 .4em; font-size: 1.15rem; font-weight: 700; }
.prose h4 { margin: 1.3em 0 .3em; font-size: 1.02rem; font-weight: 700; color: var(--ink-soft); }
.prose ul, .prose ol { margin: 0 0 1.05em; padding-inline-start: 1.6rem; }
.prose ol { list-style: persian; }
.prose li { margin-bottom: .25em; padding-inline-start: .2rem; }
.prose li::marker { color: var(--gold-ink); font-weight: 700; }
.prose blockquote {
  margin: 1.2em 0; padding: .7rem 1.2rem; border-inline-start: 3px solid var(--gold);
  border-start-end-radius: 12px; border-end-end-radius: 12px; background: var(--surface-2); color: var(--ink-soft);
}
.prose blockquote p { margin: 0; }
.prose hr {
  width: 45%; height: 1px; margin: 2.2em auto; border: 0;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
.prose a { color: var(--lapis); overflow-wrap: anywhere; }
.prose strong { font-weight: 700; }
.ayah { color: var(--lapis); font: 400 1.22em/2.3 var(--font-quran); }
.about { font-size: 1rem; }

/* فهرست فایل‌ها */
.files { margin-top: 1.75rem; }
.files__title { display: flex; align-items: center; gap: .45rem; margin: 0 0 .75rem; font-size: 1.1rem; font-weight: 700; }
.files__title small { color: var(--muted); font-weight: 400; font-size: .85rem; }
.filelist { display: grid; gap: .6rem; margin: 0; padding: 0; list-style: none; }
.filelist__item {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .6rem .9rem;
  padding: .7rem .9rem; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-sm);
}
.filelist__icon {
  display: grid; place-items: center; flex: none; width: 2.6rem; height: 2.6rem; border-radius: 11px;
  background: var(--line-soft); color: var(--ink-soft);
}
.filelist__icon--pdf { background: var(--red-tint); color: var(--red); }
.filelist__icon--image { background: var(--teal-tint); color: var(--teal); }
.filelist__icon--audio { background: var(--amber-tint); color: var(--amber); }
.filelist__icon--video { background: var(--lapis-tint); color: var(--lapis); }
.filelist__icon--slides { background: var(--orange-tint); color: var(--orange); }
.filelist__body { display: flex; flex-direction: column; min-width: 0; line-height: 1.6; }
.filelist__name { font-weight: 600; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: right; }
.filelist__body small { color: var(--muted); font-size: .8rem; }
.filelist__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .4rem; }
.filelist__media { grid-column: 1 / -1; width: 100%; }
video.filelist__media { max-height: 70vh; border-radius: 10px; background: #000; }
@media (max-width: 38rem) {
  .filelist__item { grid-template-columns: auto minmax(0, 1fr); }
  .filelist__actions { grid-column: 1 / -1; }
  .filelist__actions .btn { flex: 1; }
}

/* ---------- نمایشگر PDF ---------- */
.reader {
  margin-top: 1.75rem; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--bg-deep); scroll-margin-top: .5rem;
}
.reader__bar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: .5rem; min-height: 3.25rem; padding-block: .35rem; padding-inline: .9rem .35rem;
  background: var(--surface); border-bottom: 1px solid var(--line);
  border-radius: calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0;
}
.reader__file { display: flex; align-items: center; gap: .5rem; flex: 1; min-width: 0; color: var(--ink-soft); font-size: .9rem; font-weight: 600; }
.reader__name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reader__file select { min-height: 2.25rem; padding-block: .2rem; font-size: .88rem; max-width: 100%; }
.reader__ctrl { display: flex; align-items: center; gap: .1rem; flex: none; }
.reader__page { padding-inline: .5rem; color: var(--muted); font-size: .84rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.reader__progress { position: absolute; inset-inline: 0; bottom: -2px; height: 3px; overflow: hidden; }
.reader__progress span { display: block; width: 0; height: 100%; background: var(--gold); transition: width .25s; }
.reader__stage { position: relative; min-height: 10rem; padding: clamp(.5rem, 2vw, 1.25rem); overflow-x: auto; }
.reader__pages {
  --zoom: 1;
  display: flex; flex-direction: column; align-items: center; gap: clamp(.5rem, 1.6vw, 1rem);
  /* با بزرگ‌نمایی، پهنای صفحه‌ها از قاب بیشتر می‌شود و قاب افقی پیمایش می‌خورد */
  width: max(100%, min(calc(100% * var(--zoom)), calc(58rem * var(--zoom))));
}
.reader__pages:empty { display: none; }
.rpage {
  position: relative; flex: none; width: calc(100% * min(1, var(--zoom))); max-width: calc(58rem * var(--zoom)); aspect-ratio: 1 / 1.414;
  background: #fff; border-radius: 3px; box-shadow: var(--page-shadow); overflow: hidden; scroll-margin-top: 4.25rem;
}
.rpage::before {
  content: attr(data-label); position: absolute; inset: 0; display: grid; place-items: center;
  color: #a3a7b3; font-size: .9rem;
}
.rpage canvas { position: relative; display: block; width: 100%; height: 100%; }
.rpage.is-failed::before { content: "نمایش این صفحه ممکن نشد"; color: #b23a32; }
.reader__msg { padding: 2.25rem 1rem; text-align: center; color: var(--muted); }
.reader__msg p { margin: 0 0 .9rem; }
.reader__msg p:last-child { margin: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; }
.reader.is-ready .reader__msg { display: none; }
.reader__spinner {
  width: 2.2rem; height: 2.2rem; margin: 0 auto .9rem; border-radius: 50%;
  border: 3px solid var(--line-strong); border-top-color: var(--gold); animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.reader__resume {
  display: flex; align-items: center; gap: .4rem; margin: 0 auto .9rem; padding: .35rem 1rem;
  border: 1px solid var(--gold); border-radius: 999px; background: var(--gold-tint); color: var(--gold-ink);
  font-size: .86rem; font-weight: 600; cursor: pointer;
}
.reader.is-full {
  position: fixed; inset: 0; z-index: 400; margin: 0; border: 0; border-radius: 0;
  overflow: auto; overscroll-behavior: contain;
}
.reader.is-full .reader__bar { border-radius: 0; padding-top: max(.35rem, env(safe-area-inset-top)); }
.reader.is-full .icon--expand { display: none; }
.reader.is-full .icon--shrink { display: block; }
body.has-full { overflow: hidden; }
@media (max-width: 34rem) {
  .reader__file .icon { display: none; }
  .reader__page { padding-inline: .2rem; font-size: .8rem; }
  .reader__ctrl .iconbtn { width: 2.25rem; height: 2.25rem; }
}

/* تصویرهای جزوه */
.shots { display: grid; gap: 1.1rem; justify-items: center; margin-top: 1.75rem; }
.shots .files__title { justify-self: stretch; margin-bottom: -.35rem; }
.shot { margin: 0; max-width: 100%; }
.shot a { display: block; cursor: zoom-in; border-radius: 8px; }
.shot img { display: block; max-width: 100%; height: auto; border-radius: 8px; background: #fff; box-shadow: var(--page-shadow); }
.shot figcaption { display: flex; justify-content: center; align-items: center; gap: .4rem .9rem; margin-top: .35rem; color: var(--muted); font-size: .8rem; }
.shot figcaption a { display: inline-flex; align-items: center; gap: .25rem; color: var(--lapis); font-weight: 600; text-decoration: none; cursor: pointer; }
.shot figcaption a:hover { text-decoration: underline; }
.shot figcaption .icon { width: 1rem; height: 1rem; }

.lightbox { position: fixed; inset: 0; z-index: 500; display: flex; flex-direction: column; background: rgba(6, 10, 20, .95); color: #fff; }
.lightbox__bar { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .4rem .6rem; padding-top: max(.4rem, env(safe-area-inset-top)); }
.lightbox__bar .iconbtn { color: #fff; }
.lightbox__bar .iconbtn:hover { background: rgba(255, 255, 255, .14); color: #fff; }
.lightbox__count { font-size: .9rem; opacity: .85; font-variant-numeric: tabular-nums; }
.lightbox__tools { display: flex; align-items: center; gap: .1rem; }
.lightbox__stage { flex: 1; min-height: 0; overflow: auto; display: grid; place-items: center; padding: .5rem; overscroll-behavior: contain; }
.lightbox__img { display: block; max-width: 100%; max-height: 100%; object-fit: contain; cursor: zoom-in; background: #fff; }
.lightbox.is-zoomed .lightbox__stage { place-items: start center; }
.lightbox.is-zoomed .lightbox__img { max-width: none; max-height: none; width: max(100%, 1400px); cursor: zoom-out; }

/* جزوهٔ قبلی / بعدی */
.note__nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; margin-top: 2.5rem; }
.note__navlink {
  display: flex; align-items: center; gap: .6rem; min-width: 0; padding: .75rem 1rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-sm);
  color: var(--ink); text-decoration: none; transition: border-color .15s, box-shadow .15s;
}
.note__navlink:hover { border-color: var(--gold); box-shadow: var(--shadow-md); }
.note__navlink span { display: flex; flex-direction: column; min-width: 0; line-height: 1.6; }
.note__navlink small { color: var(--muted); font-size: .78rem; }
.note__navlink b { font-size: .92rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.note__navlink--next { justify-content: flex-end; text-align: end; }
.note__navlink .icon { color: var(--gold-ink); }

/* ---------- پیام‌ها ---------- */
.banner, .flash {
  display: flex; align-items: flex-start; gap: .6rem; padding: .7rem 1rem;
  border: 1px solid transparent; border-radius: 12px; font-size: .95rem; line-height: 1.9;
}
.banner { margin-bottom: 1.1rem; }
.banner p, .flash p { margin: 0; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.banner ul { margin: .2rem 0 0; padding-inline-start: 1.2rem; }
.banner .icon, .flash .icon { margin-top: .32rem; }
.banner--err, .flash--err { background: var(--red-tint); border-color: color-mix(in srgb, var(--red) 30%, transparent); color: var(--red); }
.banner--warn { background: var(--amber-tint); border-color: color-mix(in srgb, var(--amber) 30%, transparent); color: var(--amber); }
.banner a { color: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: .2em; }
.flash--ok { background: var(--teal-tint); border-color: color-mix(in srgb, var(--teal) 30%, transparent); color: var(--teal); }
.flashes { display: grid; gap: .5rem; padding-top: 1rem; }
.flash__close { display: grid; place-items: center; flex: none; width: 1.9rem; height: 1.9rem; margin: .05rem 0; padding: 0; border: 0; border-radius: 8px; background: transparent; color: inherit; cursor: pointer; opacity: .7; }
.flash__close:hover { opacity: 1; background: rgba(127, 127, 127, .15); }
.flash__close .icon { margin: 0; width: 1rem; height: 1rem; }
.is-bare .flashes { position: fixed; top: 0; inset-inline: 0; z-index: 50; width: min(100% - 2rem, 34rem); }

.empty { padding: clamp(2rem, 8vw, 4rem) 1rem; text-align: center; }
.empty__mark { width: 4.25rem; height: 4.25rem; margin-bottom: .6rem; fill: var(--gold-tint); stroke: var(--gold); stroke-width: 1.3; stroke-linejoin: round; }
.empty h1, .empty h2 { margin: 0 0 .4rem; font-size: 1.3rem; font-weight: 800; }
.empty p { max-width: 30rem; margin: 0 auto 1.25rem; color: var(--muted); }
.empty--inline { padding: 2rem 1rem; color: var(--muted); }

.note-box { display: flex; gap: .7rem; margin-top: 1.25rem; padding: .9rem 1rem; border-radius: 12px; background: var(--lapis-tint); color: var(--ink-soft); font-size: .9rem; }
.note-box .icon { color: var(--lapis); margin-top: .3rem; }
.note-box p { margin: .15rem 0 0; }

/* ---------- فرم‌ها ---------- */
.form { display: grid; gap: 1.1rem; }
.field { display: grid; gap: .35rem; align-content: start; min-width: 0; margin: 0; padding: 0; border: 0; }
.field__label { padding: 0; color: var(--ink-soft); font-size: .9rem; font-weight: 600; }
/* legend بیرون از شبکهٔ fieldset چیده می‌شود و gap به آن نمی‌رسد؛ همان فاصله را خودش می‌گیرد تا با فیلدهای کناری هم‌تراز بماند */
legend.field__label { margin-bottom: .35rem; }
.req { color: var(--red); font-style: normal; }
.field__hint { color: var(--muted); font-size: .8rem; line-height: 1.75; }
.field__error { color: var(--red); font-size: .85rem; font-weight: 600; }
.field--short { max-width: 22rem; }

input[type="text"], input[type="password"], input[type="search"], input[type="number"], select, textarea {
  width: 100%; min-height: 2.75rem; padding: .45rem .85rem;
  border: 1px solid var(--line-strong); border-radius: 10px;
  background-color: var(--field); color: var(--ink);
  font-size: 1rem; line-height: 1.7;
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .75; }
input[type="text"]:focus, input[type="password"]:focus, input[type="search"]:focus, select:focus, textarea:focus {
  outline: 0; border-color: var(--lapis-solid); box-shadow: 0 0 0 3px var(--ring);
}
textarea { display: block; min-height: 8rem; line-height: 2.05; resize: vertical; }
select {
  appearance: none; -webkit-appearance: none; padding-inline-end: 2.3rem; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a8f9c' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: left .7rem center; background-size: 1.1rem;
}
input[dir="ltr"] { text-align: left; }

.form__row { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); align-items: start; }
.form__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .6rem; }
.inputgroup { display: flex; gap: .5rem; }
.inputgroup input { flex: 1; min-width: 0; }

.check { display: flex; align-items: flex-start; gap: .6rem; cursor: pointer; font-size: .95rem; }
.check input { flex: none; width: 1.2rem; height: 1.2rem; margin: .38rem 0 0; accent-color: var(--lapis-solid); cursor: pointer; }
.check small { color: var(--muted); font-size: .82rem; }
.check--card { padding: .85rem 1rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.check--card > span { display: flex; flex-direction: column; }
.check--card small { line-height: 1.8; }

.segmented { display: inline-flex; flex-wrap: wrap; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.segmented label { position: relative; cursor: pointer; }
.segmented input { position: absolute; inset: 0; opacity: 0; pointer-events: none; }
.segmented span {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem; padding: .35rem .95rem;
  border-radius: 9px; color: var(--muted); font-size: .9rem; font-weight: 600; white-space: nowrap;
  transition: background-color .15s, color .15s, box-shadow .15s;
}
.segmented input:checked + span { background: var(--surface); color: var(--lapis); box-shadow: 0 0 0 1px var(--line-strong), var(--shadow-sm); }
.segmented input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 1px; }
.segmented--block { display: flex; }
.segmented--block label { flex: 1; }
.segmented--block span { width: 100%; }

.switch { position: relative; display: inline-flex; align-items: center; gap: .55rem; cursor: pointer; font-size: .92rem; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch__track { position: relative; flex: none; width: 2.6rem; height: 1.5rem; border-radius: 999px; background: var(--line-strong); transition: background-color .2s; }
.switch__track::after {
  content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 1.125rem; height: 1.125rem;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: inset-inline-start .2s;
}
.switch input:checked + .switch__track { background: var(--lapis-solid); }
.switch input:checked + .switch__track::after { inset-inline-start: calc(100% - 1.125rem - 3px); }
.switch input:focus-visible + .switch__track { outline: 2px solid var(--gold); outline-offset: 2px; }
.switch input:disabled ~ span { opacity: .5; }

.search--inline {
  min-height: 2.75rem; padding-inline: .8rem; border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--field); color: var(--muted); transition: border-color .15s, box-shadow .15s;
}
.search--inline:focus-within { border-color: var(--lapis-solid); box-shadow: 0 0 0 3px var(--ring); }
.search--inline input, .search--inline input:focus {
  flex: 1; min-width: 0; min-height: 0; height: 2.5rem; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; color: var(--ink);
}

/* ---------- صفحه‌های ورود ---------- */
body.is-bare {
  position: relative; isolation: isolate;
  background: radial-gradient(120% 90% at 50% 0%, #2a4c96 0%, var(--band-2) 40%, var(--band) 100%) fixed;
}
.is-bare .main { display: grid; place-items: center; padding: 2rem 1rem; }
.authcard {
  width: min(100%, 26rem); padding: clamp(1.5rem, 5vw, 2.25rem);
  background: var(--surface); border: 1px solid rgba(214, 178, 96, .6); border-radius: 22px;
  box-shadow: 0 34px 80px -28px rgba(0, 0, 0, .75);
}
.authcard--wide { width: min(100%, 32rem); }
.authcard__brand { display: inline-flex; align-items: center; gap: .5rem; margin-bottom: .9rem; color: var(--gold-ink); font-size: .9rem; font-weight: 700; text-decoration: none; }
.authcard__mark { width: 1.8rem; height: 1.8rem; fill: var(--gold-tint); stroke: var(--gold); stroke-width: 2; stroke-linejoin: round; }
.authcard h1 { margin: 0 0 .35rem; font-size: 1.45rem; font-weight: 800; }
.authcard__lead { margin: 0 0 1.25rem; color: var(--muted); font-size: .92rem; }
.authcard__lead code { padding: .05rem .35rem; border-radius: 6px; background: var(--line-soft); font-size: .85em; }
.authcard__back { display: inline-flex; align-items: center; gap: .3rem; margin-top: 1.25rem; color: var(--muted); font-size: .88rem; text-decoration: none; }
.authcard__back:hover { color: var(--ink); }

/* ---------- پنل ---------- */
.panelhead { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1rem; margin-bottom: 1.25rem; }
.panelhead h1 { margin: 0; font-size: 1.6rem; font-weight: 800; }
.panelhead p { margin: .1rem 0 0; color: var(--muted); font-size: .92rem; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: .75rem; margin: 0 0 1.25rem; }
.kpis > div { display: flex; flex-direction: column; padding: .8rem 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-sm); line-height: 1.6; }
.kpis dt { color: var(--muted); font-size: .82rem; order: -1; }
.kpis dd { margin: 0; color: var(--lapis); font-size: 1.7rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.kpis small { color: var(--muted); font-size: .78rem; }

.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem; margin-bottom: 1.25rem; padding: .9rem 1rem; }
.filters .field { flex: 1 1 10rem; }
.filters .field--grow { flex: 3 1 15rem; }
.filters__actions { display: flex; gap: .5rem; }

.tablewrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { padding: .7rem .9rem; border-bottom: 1px solid var(--line); color: var(--muted); font-size: .8rem; font-weight: 600; text-align: start; white-space: nowrap; }
.table td { padding: .65rem .9rem; border-bottom: 1px solid var(--line-soft); vertical-align: middle; line-height: 1.7; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table .num { text-align: center; font-variant-numeric: tabular-nums; }
.table small { display: block; color: var(--muted); font-size: .78rem; }
.table__title { min-width: 13rem; }
.table__title a { color: var(--ink); font-weight: 600; text-decoration: none; }
.table__title a:hover { color: var(--lapis); text-decoration: underline; }
.table__actions { white-space: nowrap; text-align: end; }
.table__actions form { display: inline; margin: 0; }
.status { display: inline-flex; align-items: center; gap: .4rem; font-size: .82rem; font-weight: 600; white-space: nowrap; }
.status::before { content: ""; width: .5rem; height: .5rem; border-radius: 50%; background: currentColor; }
.status--ok { color: var(--teal); }
.status--draft { color: var(--amber); }
@media (max-width: 50rem) {
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; }
  .table tr { padding: .8rem 1rem; border-bottom: 1px solid var(--line); }
  .table tbody tr:last-child { border-bottom: 0; }
  .table td { display: flex; justify-content: space-between; gap: 1rem; padding: .1rem 0; border: 0; text-align: start; }
  .table td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: .8rem; flex: none; }
  .table td small { display: inline; margin-inline-start: .4rem; }
  .table .table__title { display: block; min-width: 0; margin-bottom: .3rem; font-size: 1rem; }
  .table .table__title::before { display: none; }
  .table .table__title small { display: block; margin: 0; }
  .table .num { text-align: start; }
  .table__actions { justify-content: flex-start; margin-top: .4rem; }
  .table tbody tr:hover td { background: transparent; }
}

.formcard { display: grid; gap: 1.1rem; padding: clamp(1rem, 3vw, 1.6rem); }
.formcard h2 { display: flex; align-items: center; gap: .55rem; margin: 0; font-size: 1.1rem; font-weight: 700; }
.formcard h2 small { color: var(--muted); font-size: .8rem; font-weight: 400; }
.formcard__step { display: inline-grid; place-items: center; flex: none; width: 1.75rem; height: 1.75rem; border-radius: 50%; background: var(--lapis-tint); color: var(--lapis); font-size: .88rem; font-weight: 700; }
.noteform { gap: 1.25rem; }
.form__row--3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 14.5rem), 1fr)); }
.range { display: flex; align-items: center; gap: .5rem; color: var(--muted); font-size: .9rem; }
.range input { flex: 1; min-width: 0; text-align: center; }
.dateparts { display: flex; gap: .35rem; }
.dateparts select { flex: 1 1 0; min-width: 0; padding-inline: .5rem 1.6rem; background-position: left .35rem center; background-size: .95rem; font-size: .92rem; }
.dateparts .btn { flex: none; min-height: 2.75rem; padding-inline: .6rem; }

.kindpick { display: flex; flex-wrap: wrap; gap: .45rem; }
.kindpick__item { position: relative; cursor: pointer; }
.kindpick__item input { position: absolute; inset: 0; opacity: 0; pointer-events: none; }
.kindpick__item span {
  display: inline-flex; align-items: center; gap: .4rem; padding: .5rem .95rem;
  background: var(--field); border: 1px solid var(--line-strong); border-radius: 12px;
  color: var(--ink-soft); font-size: .92rem; font-weight: 600; white-space: nowrap;
  transition: border-color .15s, background-color .15s, color .15s, box-shadow .15s;
}
.kindpick__item:hover span { border-color: var(--gold); }
.kindpick__item input:checked + span { background: var(--lapis-tint); border-color: var(--lapis-solid); color: var(--lapis); box-shadow: inset 0 0 0 1px var(--lapis-solid); }
.kindpick__item input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 2px; }
@media (min-width: 40rem) {
  .field--span2 { grid-column: span 2; }
}

.dropzone {
  padding: 1.5rem 1rem; border: 2px dashed var(--line-strong); border-radius: 14px; background: var(--surface-2);
  text-align: center; transition: border-color .15s, background-color .15s;
}
.dropzone.is-over { border-color: var(--gold); background: var(--gold-tint); }
.dropzone__icon { width: 2.2rem; height: 2.2rem; color: var(--lapis); }
.dropzone p { margin: .2rem 0 .8rem; color: var(--ink-soft); }
.dropzone small { display: block; margin-top: .75rem; color: var(--muted); font-size: .8rem; line-height: 1.8; }
.uploader { display: grid; gap: .75rem; }
.uploader__hint { margin: 0; color: var(--muted); font-size: .82rem; }
.frows { display: grid; gap: .5rem; margin: 0; padding: 0; list-style: none; }
.frows:empty { display: none; }
.frow {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .75rem;
  padding-block: .5rem; padding-inline: .7rem .4rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
}
.frow__body { display: grid; min-width: 0; line-height: 1.6; }
.frow__body b { font-size: .92rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: right; }
.frow__body small { color: var(--muted); font-size: .78rem; }
input.frow__title { min-height: 2.1rem; margin-top: .35rem; padding: .15rem .6rem; font-size: .88rem; }
.frow.is-error input.frow__title { display: none; }
.uploader__notes:empty { display: none; }
.uploader__note { margin: 0 0 .4rem; padding: .55rem .85rem; border-radius: 10px; background: var(--amber-tint); color: var(--amber); font-size: .85rem; line-height: 1.8; }
.frow__bar { height: 5px; margin-top: .3rem; border-radius: 3px; background: var(--line); overflow: hidden; }
.frow__bar span { display: block; width: 0; height: 100%; border-radius: 3px; background: var(--lapis-solid); transition: width .2s; }
.frow:not(.is-uploading) .frow__bar { display: none; }
.frow.is-uploading [data-row-up], .frow.is-uploading [data-row-down] { visibility: hidden; }
.frow.is-error { border-color: color-mix(in srgb, var(--red) 55%, transparent); background: var(--red-tint); }
.frow.is-error small { color: var(--red); font-weight: 600; }
.frow.is-error [data-row-up], .frow.is-error [data-row-down] { visibility: hidden; }
.frow__actions { display: flex; }
.frow__actions .iconbtn { width: 2.2rem; height: 2.2rem; }
.frow:first-child [data-row-up], .frow:last-child [data-row-down] { opacity: .3; pointer-events: none; }

.editor { border: 1px solid var(--line-strong); border-radius: 12px; background: var(--field); overflow: hidden; transition: border-color .15s, box-shadow .15s; }
.editor:focus-within { border-color: var(--lapis-solid); box-shadow: 0 0 0 3px var(--ring); }
.editor__bar { display: flex; flex-wrap: wrap; align-items: center; gap: .15rem; padding: .3rem; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.editor__bar button {
  min-width: 2.2rem; height: 2.2rem; padding: 0 .6rem; border: 0; border-radius: 8px; background: transparent;
  color: var(--ink-soft); font-size: .85rem; cursor: pointer; transition: background-color .15s;
}
.editor__bar button:hover { background: var(--line-soft); }
.editor__spacer { flex: 1; }
.editor__tab.is-active { background: var(--surface); color: var(--lapis); box-shadow: 0 0 0 1px var(--line-strong); font-weight: 600; }
.editor textarea, .editor textarea:focus { min-height: 16rem; border: 0; border-radius: 0; box-shadow: none; background: transparent; }
.editor__preview { min-height: 16rem; padding: 1rem 1.2rem; font-size: 1rem; }
.editor__preview:empty::before { content: "چیزی برای پیش‌نمایش نیست."; color: var(--muted); }

.formbar {
  position: sticky; bottom: 0; z-index: 15;
  display: flex; flex-wrap: wrap; align-items: center; gap: .6rem;
  padding: .7rem 1rem; padding-bottom: max(.7rem, env(safe-area-inset-bottom));
  background: var(--surface); border: 1px solid var(--line); border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0; box-shadow: 0 -10px 30px -18px rgba(27, 35, 51, .45);
}
.formbar__status { flex: 1; min-width: 0; color: var(--muted); font-size: .85rem; }
.formbar__status.is-busy { color: var(--amber); font-weight: 600; }
@media (max-width: 36rem) {
  .formbar .segmented { width: 100%; }
  .formbar .segmented label { flex: 1; }
  .formbar .segmented span { width: 100%; padding-inline: .4rem; }
  .formbar__status:empty { display: none; }
  .formbar .btn { flex: 1; }
}

.dangerzone {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1rem;
  margin-top: 2rem; padding: .9rem 1rem; border: 1px dashed color-mix(in srgb, var(--red) 40%, transparent); border-radius: 14px;
}
.dangerzone p { margin: 0; color: var(--muted); font-size: .9rem; }

/* ---------- کاربران: ترم جاری ---------- */
.termcard { display: grid; gap: .9rem; margin-bottom: 1.5rem; padding: 1rem 1.2rem; }
.termcard__now { display: flex; align-items: flex-start; gap: .85rem; }
.termcard__mark { flex: none; width: 2.5rem; height: 2.5rem; fill: var(--gold-tint); stroke: var(--gold); stroke-width: 2; stroke-linejoin: round; }
.termcard__now small { display: block; color: var(--muted); font-size: .78rem; line-height: 1.5; }
.termcard__now > div > b { font-size: 1.12rem; }
.termcard__now p { margin: .15rem 0 0; color: var(--ink-soft); font-size: .92rem; }
.termcard__warn { display: flex; align-items: flex-start; gap: .4rem; color: var(--amber) !important; font-weight: 600; }
.termcard__warn .icon { margin-top: .3rem; }
.termcard__new summary { width: fit-content; list-style: none; }
.termcard__new summary::-webkit-details-marker { display: none; }
.termcard__form { margin-top: .9rem; padding-top: 1rem; border-top: 1px dashed var(--line); }
.listhead { display: flex; align-items: center; gap: .5rem; margin: 1.75rem 0 .7rem; font-size: 1.1rem; font-weight: 800; }
.listhead small { color: var(--muted); font-size: .82rem; font-weight: 500; }
.table__actions .btn { vertical-align: middle; }

/* ---------- صفحه‌بندی ---------- */
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .3rem; margin-top: 2rem; }
.pager__num, .pager__step {
  display: inline-flex; align-items: center; justify-content: center; gap: .15rem; min-width: 2.5rem; height: 2.5rem; padding: 0 .7rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  color: var(--ink); font-size: .9rem; font-weight: 600; text-decoration: none;
}
a.pager__num:hover, a.pager__step:hover { border-color: var(--gold); }
.pager__num.is-current { background: var(--lapis-solid); border-color: transparent; color: #fff; }
.pager__gap { padding-inline: .3rem; color: var(--muted); }

/* ---------- پنجرهٔ تأیید ---------- */
.dialog {
  width: min(92vw, 26rem); padding: 0; border: 1px solid var(--line); border-radius: 18px;
  background: var(--surface); color: var(--ink); box-shadow: 0 40px 90px -30px rgba(0, 0, 0, .7);
}
.dialog::backdrop { background: rgba(8, 12, 24, .62); }
.dialog__box { padding: 1.4rem; }
.dialog__text { margin: 0 0 1.25rem; line-height: 2; overflow-wrap: anywhere; }
.dialog__actions { display: flex; justify-content: flex-end; gap: .5rem; }

/* ---------- پانوشت ---------- */
.footer { flex: none; margin-top: auto; padding-block: 1.4rem; background: var(--bg-deep); border-top: 1px solid var(--line); font-size: .88rem; }
.footer__in { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem 2rem; }
.footer__brand { display: flex; align-items: center; gap: .65rem; min-width: 0; }
.footer__brand div { display: flex; flex-direction: column; min-width: 0; line-height: 1.6; }
.footer__brand span { color: var(--muted); font-size: .8rem; }
.footer__mark { width: 2rem; height: 2rem; flex: none; fill: var(--gold-tint); stroke: var(--gold); stroke-width: 2; stroke-linejoin: round; }
.footer__links { display: flex; flex-wrap: wrap; gap: .3rem 1.4rem; }
.footer__links a { display: inline-flex; align-items: center; gap: .3rem; color: var(--ink-soft); text-decoration: none; }
.footer__links a:hover { color: var(--lapis); text-decoration: underline; }
.footer__links .icon { width: 1rem; height: 1rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; scroll-behavior: auto !important; }
}

@media print {
  .topbar, .subnav, .footer, .reader__bar, .staffbar, .note__nav, .filelist__actions, .flashes { display: none !important; }
  body { background: #fff; color: #000; }
  .card { border: 0; box-shadow: none; }
}
