/* =====================================================================
   مدرسه آنلاین — استایل اصلی (RTL)
   رنگ‌ها: سبز تخته‌سیاه + زرد مدادی روی زمینه کاغذی
   ===================================================================== */
@font-face {
  font-family: 'Vazirmatn';
  src: url('../vendor/vazirmatn/Vazirmatn-Variable.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --ink: #1d2a35;
  --ink-soft: #5b6873;
  --paper: #f4f3ee;
  --surface: #ffffff;
  --line: #e4e2da;
  --board: #1e5b4f;          /* سبز تخته */
  --board-deep: #143e36;
  --board-soft: #e3efe9;
  --pencil: #e4a11b;         /* زرد مدادی */
  --pencil-soft: #fdf3dc;
  --danger: #c2413a;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(29,42,53,.05), 0 4px 16px rgba(29,42,53,.05);
  --sidebar-w: 264px;

  --bs-body-font-family: 'Vazirmatn', Tahoma, sans-serif;
  --bs-body-color: var(--ink);
  --bs-body-bg: var(--paper);
  --bs-primary: #1e5b4f;
  --bs-primary-rgb: 30,91,79;
  --bs-link-color: #1e5b4f;
  --bs-link-color-rgb: 30,91,79;
  --bs-link-hover-color: #143e36;
  --bs-border-color: var(--line);
  --bs-border-radius: 10px;
}

body { font-family: var(--bs-body-font-family); background: var(--paper); color: var(--ink); font-size: .94rem; }
.btn-primary {
  --bs-btn-bg: var(--board); --bs-btn-border-color: var(--board);
  --bs-btn-hover-bg: var(--board-deep); --bs-btn-hover-border-color: var(--board-deep);
  --bs-btn-active-bg: var(--board-deep); --bs-btn-active-border-color: var(--board-deep);
  --bs-btn-disabled-bg: var(--board); --bs-btn-disabled-border-color: var(--board);
}
.btn-outline-primary {
  --bs-btn-color: var(--board); --bs-btn-border-color: var(--board);
  --bs-btn-hover-bg: var(--board); --bs-btn-hover-border-color: var(--board);
  --bs-btn-active-bg: var(--board-deep); --bs-btn-active-border-color: var(--board-deep);
}
.btn-warning { --bs-btn-bg: var(--pencil); --bs-btn-border-color: var(--pencil); --bs-btn-color: #2a2000; }
.text-primary { color: var(--board) !important; }
.bg-primary { background-color: var(--board) !important; }
.form-control:focus, .form-select:focus { border-color: #7fb3a5; box-shadow: 0 0 0 .2rem rgba(30,91,79,.15); }
.form-check-input:checked { background-color: var(--board); border-color: var(--board); }
.nav-pills .nav-link.active { background: var(--board); }
.page-item.active .page-link { background: var(--board); border-color: var(--board); }
.page-link { color: var(--board); }

/* ---------- ساختار */
.app-shell { display: flex; min-height: 100vh; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.content { padding: 1.5rem; max-width: 1400px; width: 100%; margin: 0 auto; }

/* ---------- منوی کناری */
.sidebar {
  width: var(--sidebar-w); background: var(--board-deep); color: #d7e6e1;
  display: flex; flex-direction: column;
  background-image: linear-gradient(180deg, #17473e 0%, #123a32 100%);
}
@media (min-width: 992px) {
  .sidebar { position: sticky; top: 0; height: 100vh; flex-shrink: 0; visibility: visible !important; transform: none !important; }
}
.sidebar-brand { display: flex; align-items: center; justify-content: space-between; padding: 1.1rem 1.1rem 1rem; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-mark { width: 40px; height: 40px; border-radius: 10px; background: var(--pencil); color: #1d2a35; display: grid; place-items: center; font-size: 1.3rem; }
.brand-name { display: block; color: #fff; font-weight: 800; font-size: 1.05rem; line-height: 1.3; }
.brand-school { display: block; color: #a9c7bf; font-size: .78rem; max-width: 170px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-nav { overflow-y: auto; padding: .6rem .6rem 2rem; flex: 1; }
.sidebar-nav::-webkit-scrollbar { width: 6px; } .sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 3px; }
.nav-group { font-size: .72rem; font-weight: 700; color: #7fa59b; padding: 1rem .75rem .35rem; letter-spacing: .02em; }
.nav-item {
  display: flex; align-items: center; gap: .7rem; padding: .55rem .75rem; border-radius: 9px;
  color: #d7e6e1; text-decoration: none; font-size: .9rem; margin-bottom: 2px; transition: background .15s;
}
.nav-item i { font-size: 1.05rem; opacity: .85; }
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: rgba(228,161,27,.16); color: #fff; box-shadow: inset -3px 0 0 var(--pencil); }
.nav-item.active i { color: var(--pencil); opacity: 1; }

/* ---------- نوار بالا */
.topbar {
  position: sticky; top: 0; z-index: 1020; display: flex; align-items: center; gap: .75rem;
  background: rgba(244,243,238,.92); backdrop-filter: blur(8px); padding: .7rem 1.5rem; border-bottom: 1px solid var(--line);
}
.page-title { font-size: 1.15rem; font-weight: 800; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn-icon { width: 40px; height: 40px; border-radius: 10px; display: inline-grid; place-items: center; font-size: 1.2rem; color: var(--ink); background: transparent; border: 0; }
.btn-icon:hover { background: #e9e7df; }
.notif-badge { position: absolute; top: 2px; left: 2px; font-size: .65rem; }
.btn-user { display: flex; align-items: center; gap: .5rem; border: 0; background: transparent; padding: .25rem .5rem; border-radius: 10px; }
.btn-user:hover { background: #e9e7df; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--board); color: #fff; display: inline-grid; place-items: center; font-weight: 700; flex-shrink: 0; }
.avatar-sm { width: 28px; height: 28px; font-size: .8rem; }
.avatar-lg { width: 64px; height: 64px; font-size: 1.6rem; }
.school-switch { border: 1px solid var(--line); }
.dropdown-menu { --bs-dropdown-link-active-bg: var(--board); border-color: var(--line); }
.dropdown-item i { margin-left: .4rem; }

/* ---------- کارت‌ها */
.card { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-header { background: transparent; border-bottom: 1px solid var(--line); font-weight: 700; padding: .85rem 1.1rem; }
.card-header .bi { color: var(--board); margin-left: .35rem; }
.card-body { padding: 1.1rem; }
.stat {
  display: flex; align-items: center; gap: 1rem; padding: 1rem 1.1rem; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); height: 100%; text-decoration: none; color: inherit;
}
.stat:hover { border-color: #c9d9d3; }
.stat-icon { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; font-size: 1.35rem; background: var(--board-soft); color: var(--board); flex-shrink: 0; }
.stat-icon.y { background: var(--pencil-soft); color: #a36f00; }
.stat-icon.r { background: #fbe6e4; color: var(--danger); }
.stat-icon.b { background: #e5edf8; color: #2d5ea8; }
.stat-value { font-size: 1.5rem; font-weight: 800; line-height: 1.1; }
.stat-label { color: var(--ink-soft); font-size: .82rem; }

.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table > :not(caption) > * > * { padding: .65rem .75rem; vertical-align: middle; }
.table thead th { font-size: .8rem; color: var(--ink-soft); font-weight: 700; background: #faf9f5; border-bottom-width: 1px; white-space: nowrap; }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: #f7f6f1; }
.table-responsive { border-radius: var(--radius); }

.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--ink-soft); }
.empty-state > i { font-size: 2.6rem; color: #b9c5c0; display: block; margin-bottom: .5rem; }

.form-label { font-weight: 600; font-size: .86rem; margin-bottom: .3rem; }
.form-text { font-size: .78rem; }
.required::after { content: ' *'; color: var(--danger); }
.badge { font-weight: 600; }
.filter-bar { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem; margin-bottom: 1rem; }

/* ---------- ورود */
.login-page { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.login-art {
  background: var(--board-deep); color: #e7f1ed; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between;
  background-image:
    radial-gradient(circle at 20% 20%, rgba(255,255,255,.06) 0 2px, transparent 3px),
    linear-gradient(160deg, #1e5b4f 0%, #123a32 100%);
  background-size: 28px 28px, 100% 100%;
  position: relative; overflow: hidden;
}
.login-art h1 { font-weight: 900; font-size: 2.4rem; line-height: 1.5; }
.login-art .chalk { font-size: 1.05rem; color: #bcd7cf; max-width: 420px; line-height: 2; }
.login-art .ruler { height: 10px; background: repeating-linear-gradient(90deg, var(--pencil) 0 2px, transparent 2px 14px); opacity: .7; border-top: 2px solid var(--pencil); }
.login-form { display: flex; align-items: center; justify-content: center; padding: 2rem; }
.login-card { width: 100%; max-width: 380px; }
@media (max-width: 991px) { .login-page { grid-template-columns: 1fr; } .login-art { display: none; } }

/* ---------- چارت سازمانی */
.org-tree, .org-tree ul { list-style: none; margin: 0; padding: 0; }
.org-tree ul { padding-top: 22px; position: relative; display: flex; justify-content: center; }
.org-tree li { position: relative; padding: 22px 6px 0; text-align: center; display: flex; flex-direction: column; align-items: center; }
.org-tree > li { padding-top: 0; }
.org-tree li::before, .org-tree li::after {
  content: ''; position: absolute; top: 0; right: 50%; width: 50%; height: 22px; border-top: 2px solid #c9d6d1;
}
.org-tree li::after { right: auto; left: 50%; border-right: 2px solid #c9d6d1; }
.org-tree li:only-child::before, .org-tree li:only-child::after { display: none; }
.org-tree li:only-child { padding-top: 0; }
.org-tree li:first-child::before, .org-tree li:last-child::after { border: 0 none; }
.org-tree li:last-child::before { border-left: 2px solid #c9d6d1; border-radius: 0 0 0 6px; }
.org-tree li:first-child::after { border-radius: 0 0 6px 0; }
.org-tree ul ul::before { content: ''; position: absolute; top: 0; left: 50%; border-left: 2px solid #c9d6d1; width: 0; height: 22px; }
.org-tree > li > ul::before { content: ''; position: absolute; top: 0; left: 50%; border-left: 2px solid #c9d6d1; width: 0; height: 22px; }
.org-node {
  background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--board); border-radius: 10px;
  padding: .6rem .8rem; min-width: 150px; max-width: 200px; box-shadow: var(--shadow);
}
.org-node .t { font-weight: 800; font-size: .88rem; }
.org-node .p { font-size: .8rem; color: var(--ink-soft); margin-top: .2rem; }
.org-node.vacant { border-top-color: #c9c4b4; }
.org-node.vacant .p { color: #b0a890; font-style: italic; }
.org-node .acts { margin-top: .35rem; display: flex; justify-content: center; gap: .25rem; }
.org-scroll { overflow-x: auto; padding: 1rem 0 2rem; }
.org-scroll > .org-tree { display: inline-flex; min-width: 100%; justify-content: center; }

/* ---------- برنامه هفتگی */
.tt { table-layout: fixed; min-width: 760px; }
.tt th, .tt td { text-align: center; border: 1px solid var(--line) !important; }
.tt td { height: 74px; padding: .3rem !important; }
.tt .day { background: #faf9f5; font-weight: 700; width: 90px; }
.tt .slot { border-radius: 8px; padding: .35rem .3rem; font-size: .8rem; line-height: 1.6; height: 100%; display: flex; flex-direction: column; justify-content: center; }
.tt .slot b { font-size: .85rem; }
.tt .slot small { color: rgba(0,0,0,.6); }
.tt select { font-size: .78rem; }
.tt .now { outline: 2px solid var(--pencil); outline-offset: -2px; }

/* ---------- پیام‌رسان */
.chat-wrap { display: grid; grid-template-columns: 320px 1fr; height: calc(100vh - 140px); min-height: 480px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.chat-list { border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.chat-list .search { padding: .6rem; border-bottom: 1px solid var(--line); }
.chat-groups { overflow-y: auto; flex: 1; }
.chat-g { display: flex; gap: .6rem; align-items: center; padding: .65rem .8rem; cursor: pointer; border-bottom: 1px solid #f0eee7; }
.chat-g:hover { background: #f8f7f2; }
.chat-g.active { background: var(--board-soft); }
.chat-g .gt { font-weight: 700; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-g .gl { font-size: .78rem; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-g .gi { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: var(--board-soft); color: var(--board); font-size: 1.1rem; flex-shrink: 0; }
.chat-main { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.chat-head { padding: .7rem 1rem; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: .6rem; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 1rem; background: #f6f5f0; background-image: radial-gradient(#e8e5da 1px, transparent 1px); background-size: 18px 18px; }
.msg { max-width: 72%; margin-bottom: .5rem; display: flex; flex-direction: column; }
.msg .bubble { padding: .5rem .75rem; border-radius: 12px; background: #fff; box-shadow: 0 1px 1px rgba(0,0,0,.05); word-wrap: break-word; white-space: pre-wrap; }
.msg .who { font-size: .74rem; font-weight: 700; color: var(--board); margin-bottom: .1rem; }
.msg .meta { font-size: .68rem; color: var(--ink-soft); margin-top: .15rem; display: flex; gap: .4rem; }
.msg.me { margin-right: auto; align-items: flex-end; }
.msg.me .bubble { background: #dcefe7; }
.msg.other { margin-left: auto; }
.msg .reply { border-right: 3px solid var(--pencil); padding-right: .5rem; font-size: .78rem; color: var(--ink-soft); margin-bottom: .25rem; }
.msg .deleted { font-style: italic; color: var(--ink-soft); }
.chat-input { border-top: 1px solid var(--line); padding: .6rem; display: flex; gap: .5rem; align-items: flex-end; }
.chat-input textarea { resize: none; max-height: 140px; }
.chat-day { text-align: center; margin: .8rem 0; }
.chat-day span { background: rgba(29,42,53,.08); border-radius: 20px; padding: .15rem .8rem; font-size: .75rem; }
@media (max-width: 767px) {
  .chat-wrap { grid-template-columns: 1fr; height: calc(100vh - 120px); }
  .chat-wrap.open .chat-list { display: none; }
  .chat-wrap:not(.open) .chat-main { display: none; }
  .msg { max-width: 88%; }
}

/* ---------- ماتریس دسترسی */
.matrix th.rot { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; font-size: .78rem; padding: .5rem .25rem !important; }
.matrix td, .matrix th { text-align: center; }
.matrix td:first-child, .matrix th:first-child { text-align: right; position: sticky; right: 0; background: #fff; z-index: 1; }
.matrix .mod td { background: #faf9f5 !important; font-weight: 800; color: var(--board); }
.matrix select { min-width: 110px; font-size: .78rem; }

/* ---------- جلسات امروز */
.session-card { border-right: 4px solid var(--board); }
.session-card.live { border-right-color: var(--danger); }
.session-card.done { border-right-color: #adb5bd; opacity: .85; }
.live-dot { width: 9px; height: 9px; background: var(--danger); border-radius: 50%; display: inline-block; animation: pulse 1.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(194,65,58,.6); } 70% { box-shadow: 0 0 0 8px rgba(194,65,58,0); } 100% { box-shadow: 0 0 0 0 rgba(194,65,58,0); } }

.att-btns .btn { min-width: 60px; }
.score-input { width: 80px; text-align: center; direction: ltr; }
.gradebook td, .gradebook th { text-align: center; white-space: nowrap; }
.gradebook td:first-child, .gradebook th:first-child { text-align: right; position: sticky; right: 0; background: #fff; z-index: 1; }

.lesson-body { line-height: 2.1; font-size: 1rem; }
.file-list a { text-decoration: none; }
.dir-ltr { direction: ltr; text-align: left; }
.text-ink-soft { color: var(--ink-soft); }
.color-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; vertical-align: middle; }

@media (max-width: 575px) {
  .content { padding: 1rem .75rem; }
  .topbar { padding: .6rem .75rem; }
  .stat-value { font-size: 1.25rem; }
}
@media print {
  .sidebar, .topbar, .page-actions, .no-print { display: none !important; }
  .content { padding: 0; }
  .card { box-shadow: none; }
}

/* ---------- کلاس داخلی سامانه */
.room-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1.1fr) 230px; gap: .75rem; height: calc(100vh - 170px); min-height: 520px; }
.room-board, .room-chat, .room-people { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.board-body { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; background: #24423b; background-image: radial-gradient(rgba(255,255,255,.05) 1px, transparent 1px); background-size: 16px 16px; overflow: auto; min-height: 0; }
.board-img { max-width: 100%; max-height: 100%; object-fit: contain; cursor: zoom-in; background: #fff; }
.board-pdf { width: 100%; flex: 1; border: 0; background: #fff; min-height: 300px; }
.board-text { color: #f4f1e6; font-size: 1.35rem; line-height: 2.1; padding: 1.25rem 1.5rem; white-space: pre-wrap; width: 100%; font-family: inherit; }
.board-img + .board-text { font-size: 1rem; background: rgba(0,0,0,.35); }
.board-empty { color: #9fbcb3; text-align: center; }
.board-empty i { font-size: 3rem; display: block; margin-bottom: .5rem; }
.room-msgs { flex: 1; overflow-y: auto; padding: .75rem; background: #f6f5f0; min-height: 0; }
.room-msgs .msg { max-width: 92%; }
.room-msgs .msg.host .bubble { border-right: 3px solid var(--pencil); }
.room-msgs audio.voice, .chat-msgs audio { width: 240px; max-width: 100%; height: 36px; }
.room-people .list-group { overflow-y: auto; }
.online-dot { width: 8px; height: 8px; border-radius: 50%; background: #2fb36b; display: inline-block; flex-shrink: 0; }
.btn.recording { animation: pulse 1.4s infinite; }
@media (max-width: 1199px) {
  .room-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); height: auto; }
  .room-board { grid-column: 1 / -1; height: 52vh; }
  .room-chat { height: 60vh; }
  .room-people { height: 60vh; }
}
@media (max-width: 767px) {
  .room-grid { grid-template-columns: 1fr; }
  .room-board { height: 40vh; }
  .room-people { height: auto; max-height: 30vh; }
}

/* ---------- آزمون */
.exam-timer { font-size: 1.8rem; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--board); }
.q-num { width: 30px; height: 30px; border-radius: 50%; background: var(--board-soft); color: var(--board); display: grid; place-items: center; font-weight: 800; flex-shrink: 0; }
.exam-opt { cursor: pointer; background: #fff; transition: background .15s; }
.exam-opt:hover { background: #f6f5f0; }
.exam-opt:has(input:checked) { border-color: var(--board) !important; background: var(--board-soft); }
.exam-bar { position: sticky; bottom: 0; background: rgba(244,243,238,.96); backdrop-filter: blur(6px); border-top: 1px solid var(--line); padding: .75rem 0; display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; z-index: 10; }
body.exam-taking .exam-timer { position: sticky; top: 70px; }

/* ---------- تقویم */
.cal { table-layout: fixed; min-width: 720px; }
.cal th { text-align: center; }
.cal td { height: 112px; vertical-align: top; border: 1px solid var(--line) !important; padding: .3rem !important; background: #fff; }
.cal td.off { background: #f7f6f1; }
.cal td.hol .dnum { color: var(--danger); }
.cal td.today { background: var(--pencil-soft); }
.cal .dnum { font-weight: 800; font-size: .9rem; margin-bottom: .2rem; }
.cal-item { display: block; font-size: .72rem; line-height: 1.5; padding: .1rem .35rem; margin-bottom: .2rem; border-right: 3px solid; background: #f6f5f0; border-radius: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); text-decoration: none; cursor: default; }
a.cal-item, .cal-item[role=button] { cursor: pointer; }
a.cal-item:hover, .cal-item[role=button]:hover { background: var(--board-soft); }

/* ---------- نمودار */
.chart { position: relative; width: 100%; direction: ltr; }
.chart svg { display: block; overflow: visible; font-family: inherit; }
.chart-tip { position: absolute; z-index: 5; pointer-events: none; background: #1d2a35; color: #fff; padding: .35rem .6rem; border-radius: 8px; font-size: .78rem;
  line-height: 1.6; white-space: nowrap; direction: rtl; box-shadow: 0 4px 14px rgba(0,0,0,.18); }
.chart-table summary { cursor: pointer; color: var(--ink-soft); }
.chart-table table { max-width: 360px; }
.net-down { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); background: var(--danger); color: #fff; padding: .4rem 1rem; border-radius: 20px; z-index: 3000; font-size: .85rem; box-shadow: var(--shadow); }

/* =====================================================================
   فاز ۳
   ===================================================================== */

/* ---------- قالب چاپی و کارنامه رسمی */
.print-body { background: #e9e8e2; }
.print-toolbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: .75rem; padding: .6rem 1rem; background: rgba(255,255,255,.95); border-bottom: 1px solid var(--line); }
.print-pages { padding: 1rem 0; }
.rc-sheet { position: relative; width: 210mm; min-height: 287mm; margin: 0 auto 1rem; background: #fff; color: #111; padding: 12mm 12mm 10mm; box-shadow: 0 2px 14px rgba(0,0,0,.12); font-size: 10.5pt; overflow: hidden; }
.rc-sheet .text-muted { color: #555 !important; }
.rc-head { display: grid; grid-template-columns: 26mm 1fr 32mm; align-items: center; gap: 4mm; border-bottom: 2px solid #1e5b4f; padding-bottom: 3mm; margin-bottom: 4mm; text-align: center; }
.rc-logo { width: 22mm; height: 22mm; border: 1px solid #ccc; border-radius: 4mm; display: grid; place-items: center; font-size: 12mm; color: #1e5b4f; overflow: hidden; }
.rc-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.rc-title h2 { font-size: 13pt; font-weight: 800; margin: 1.5mm 0 0; }
.rc-code { font-size: 8.5pt; border: 1px dashed #999; border-radius: 2mm; padding: 2mm; }
.rc-code b { font-size: 10pt; letter-spacing: .5px; }
.rc-info, .rc-grades { width: 100%; border-collapse: collapse; margin-bottom: 4mm; }
.rc-info th, .rc-info td, .rc-grades th, .rc-grades td { border: 1px solid #9aa5a1; padding: 1.6mm 2mm; }
.rc-info th { background: #eef4f1; font-weight: 700; white-space: nowrap; width: 1%; }
.rc-grades thead th { background: #1e5b4f; color: #fff; text-align: center; font-weight: 700; }
.rc-grades tbody tr:nth-child(even) td { background: #f8f8f5; }
.rc-grades tr.rc-below td { color: #b3261e; }
.rc-summary { display: flex; flex-wrap: wrap; border: 1px solid #9aa5a1; margin-bottom: 3mm; }
.rc-summary > div { flex: 1 1 0; min-width: 26mm; padding: 2mm; text-align: center; border-left: 1px solid #9aa5a1; }
.rc-summary > div:last-child { border-left: 0; }
.rc-summary span { display: block; font-size: 8.5pt; color: #555; }
.rc-summary b { font-size: 12pt; }
.rc-summary .rc-status { flex: 2 1 0; }
.rc-summary .rc-status b { font-size: 10pt; }
.rc-note, .rc-comments { border: 1px solid #ddd; background: #fafaf7; padding: 2mm 3mm; margin-bottom: 3mm; font-size: 9.5pt; line-height: 1.9; }
.rc-foot { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6mm; margin-top: 8mm; text-align: center; }
.rc-sign { min-height: 30mm; position: relative; }
.rc-sign > div:first-child { font-weight: 700; }
.rc-sign-name { position: absolute; bottom: 0; left: 0; right: 0; border-top: 1px dotted #888; padding-top: 1mm; font-size: 9.5pt; }
.rc-sig-img { max-height: 20mm; max-width: 45mm; margin-top: 1mm; }
.rc-meta { position: absolute; bottom: 5mm; left: 12mm; right: 12mm; font-size: 7.5pt; color: #666; text-align: center; }
.rc-watermark { position: absolute; top: 45%; left: 50%; transform: translate(-50%, -50%) rotate(-28deg); font-size: 44pt; font-weight: 900; color: rgba(194,65,58,.10); white-space: nowrap; pointer-events: none; z-index: 0; }
@media screen and (max-width: 860px) {
  .rc-sheet { width: auto; min-height: 0; margin: 0 .5rem 1rem; padding: 1rem; }
  .rc-head { grid-template-columns: 1fr; }
  .rc-logo { margin: 0 auto; }
  .rc-info, .rc-info tbody, .rc-info tr { display: block; }
  .rc-info th, .rc-info td { display: inline-block; width: auto; border: 0; padding: .2rem .4rem; }
  .rc-grades { font-size: .85rem; }
  .rc-meta { position: static; margin-top: 1rem; }
}
@media print {
  @page { size: A4; margin: 0; }
  body.print-body { background: #fff; }
  .print-pages { padding: 0; }
  .rc-sheet { box-shadow: none; margin: 0; page-break-after: always; break-after: page; width: 210mm; height: 296mm; }
  .rc-sheet:last-child { page-break-after: auto; break-after: auto; }
  .rc-grades thead th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .rc-info th, .rc-grades tbody tr:nth-child(even) td { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
.rc-matrix td, .rc-matrix th { text-align: center; white-space: nowrap; }
.rc-matrix td:first-child, .rc-matrix th:first-child { text-align: right; position: sticky; right: 0; background: var(--surface); z-index: 1; }
.rc-input { width: 74px; text-align: center; direction: ltr; margin: 0 auto; }

/* ---------- آزمون: جورکردنی و جای خالی */
.match-q .match-left { flex: 1 1 35%; min-width: 8rem; background: var(--surface-2, #f6f5f0); }
.match-q .match-sel { flex: 1 1 45%; width: auto; min-width: 10rem; }
.fill-q { line-height: 2.8; }
.fill-q .fill-blank input { text-align: center; }
@media (max-width: 575px) { .match-q .match-left, .match-q .match-sel { flex-basis: 100%; } }

/* ---------- صدای زنده کلاس */
.audio-bar { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; padding: .5rem .75rem; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); }
.audio-bar.on { border-color: #9fd3b6; background: #eef8f2; }
.audio-bar .audio-ico { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--board-soft); color: var(--board); }
.audio-bar.on .audio-ico { background: #2fb36b; color: #fff; animation: pulse-g 1.6s infinite; }
@keyframes pulse-g { 0% { box-shadow: 0 0 0 0 rgba(47,179,107,.5); } 70% { box-shadow: 0 0 0 8px rgba(47,179,107,0); } 100% { box-shadow: 0 0 0 0 rgba(47,179,107,0); } }
.board-body video.board-img { background: #000; width: 100%; }

/* =====================================================================
   حالت تاریک — با data-bs-theme="dark" روی <html> (انتخاب کاربر یا تنظیم سیستم‌عامل)
   ===================================================================== */
:root { --chart-main: #1e5b4f; --chart-warn: #c2413a; --chart-grid: #e7e5dd; --surface-2: #f6f5f0; --hover: #e9e7df; }
.card { --bs-card-bg: var(--surface); }
.list-group { --bs-list-group-bg: var(--surface); }

[data-bs-theme="dark"] {
  color-scheme: dark;
  --ink: #e2e8e5; --ink-soft: #9aaba5; --paper: #0e1513; --surface: #16201d; --surface-2: #1b2723; --line: #283632; --hover: #22302b;
  --board-soft: #1b3a32; --pencil-soft: #3a2f12; --danger: #e5675f;
  --shadow: 0 1px 2px rgba(0,0,0,.35), 0 4px 16px rgba(0,0,0,.25);
  --chart-main: #4fb39a; --chart-warn: #ef7a72; --chart-grid: #2b3a35;
  --bs-body-color: var(--ink); --bs-body-bg: var(--paper); --bs-border-color: var(--line); --bs-border-color-translucent: rgba(255,255,255,.08);
  --bs-secondary-bg: #1b2723; --bs-tertiary-bg: #18231f; --bs-secondary-color: var(--ink-soft); --bs-emphasis-color: #f4f7f6;
  --bs-link-color: #6cc4ad; --bs-link-color-rgb: 108,196,173; --bs-link-hover-color: #93d8c5;
}
[data-bs-theme="dark"] body { background: var(--paper); color: var(--ink); }
[data-bs-theme="dark"] .text-primary { color: #6cc4ad !important; }
[data-bs-theme="dark"] .btn-outline-primary { --bs-btn-color: #6cc4ad; --bs-btn-border-color: #3f8a77; --bs-btn-hover-color: #fff; }
[data-bs-theme="dark"] .btn-light { --bs-btn-bg: #1f2b27; --bs-btn-border-color: var(--line); --bs-btn-color: var(--ink); --bs-btn-hover-bg: #283632; --bs-btn-hover-border-color: #34443f;
  --bs-btn-hover-color: #fff; --bs-btn-active-bg: #2d3c37; --bs-btn-active-color: #fff; --bs-btn-disabled-bg: #1f2b27; }
[data-bs-theme="dark"] .bg-light, [data-bs-theme="dark"] .bg-white { background-color: var(--surface-2) !important; }
[data-bs-theme="dark"] .text-bg-light { background-color: #24322d !important; color: var(--ink) !important; }
[data-bs-theme="dark"] .topbar { background: rgba(14,21,19,.92); }
[data-bs-theme="dark"] .btn-icon { color: var(--ink); }
[data-bs-theme="dark"] .btn-icon:hover, [data-bs-theme="dark"] .btn-user:hover { background: var(--hover); }
[data-bs-theme="dark"] .stat:hover { border-color: #3a4b45; }
[data-bs-theme="dark"] .stat-icon { background: #1b3a32; color: #6cc4ad; }
[data-bs-theme="dark"] .stat-icon.y { background: #3a2f12; color: #f0b847; }
[data-bs-theme="dark"] .stat-icon.r { background: #3d1d1b; color: #ef7a72; }
[data-bs-theme="dark"] .stat-icon.b { background: #1a2a40; color: #7aa7e8; }
[data-bs-theme="dark"] .table thead th { background: var(--surface-2); }
[data-bs-theme="dark"] .table-hover > tbody > tr:hover > * { --bs-table-bg-state: #1d2925; }
[data-bs-theme="dark"] .empty-state > i { color: #45574f; }
[data-bs-theme="dark"] .org-node { background: var(--surface); }
[data-bs-theme="dark"] .org-tree li::before, [data-bs-theme="dark"] .org-tree li::after, [data-bs-theme="dark"] .org-tree ul ul::before,
[data-bs-theme="dark"] .org-tree > li > ul::before { border-color: #34443f; }
[data-bs-theme="dark"] .tt .day { background: var(--surface-2); }
[data-bs-theme="dark"] .tt .slot small { color: rgba(255,255,255,.65); }
[data-bs-theme="dark"] .chat-wrap { background: var(--surface); }
[data-bs-theme="dark"] .chat-g { border-bottom-color: var(--line); }
[data-bs-theme="dark"] .chat-g:hover { background: var(--hover); }
[data-bs-theme="dark"] .chat-msgs, [data-bs-theme="dark"] .room-msgs { background-color: #111a17; background-image: radial-gradient(#1d2925 1px, transparent 1px); }
[data-bs-theme="dark"] .msg .bubble { background: #1e2a26; box-shadow: none; }
[data-bs-theme="dark"] .msg.me .bubble { background: #1d4037; }
[data-bs-theme="dark"] .chat-day span { background: rgba(255,255,255,.08); }
[data-bs-theme="dark"] .matrix td:first-child, [data-bs-theme="dark"] .matrix th:first-child,
[data-bs-theme="dark"] .gradebook td:first-child, [data-bs-theme="dark"] .gradebook th:first-child { background: var(--surface); }
[data-bs-theme="dark"] .matrix .mod td { background: var(--surface-2) !important; color: #6cc4ad; }
[data-bs-theme="dark"] .exam-opt { background: var(--surface); }
[data-bs-theme="dark"] .exam-opt:hover { background: var(--hover); }
[data-bs-theme="dark"] .exam-bar { background: rgba(14,21,19,.96); }
[data-bs-theme="dark"] .q-num { background: #1b3a32; color: #6cc4ad; }
[data-bs-theme="dark"] .exam-timer { color: #6cc4ad; }
[data-bs-theme="dark"] .cal td { background: var(--surface); }
[data-bs-theme="dark"] .cal td.off { background: #121b18; }
[data-bs-theme="dark"] .cal td.today { background: #2f2711; }
[data-bs-theme="dark"] .cal-item { background: var(--surface-2); color: var(--ink); }
[data-bs-theme="dark"] a.cal-item:hover { background: #1b3a32; }
[data-bs-theme="dark"] .audio-bar.on { background: #12291f; border-color: #2a5a44; }
[data-bs-theme="dark"] .print-toolbar { background: rgba(22,32,29,.95); }
[data-bs-theme="dark"] .print-body { background: #0b100e; }
[data-bs-theme="dark"] .login-form { background: var(--paper); }
[data-bs-theme="dark"] .card-header .bi { color: #6cc4ad; }
[data-bs-theme="dark"] .form-control:disabled, [data-bs-theme="dark"] .form-select:disabled { background-color: #131c19; }
[data-bs-theme="dark"] .match-q .match-left { background: var(--surface-2); }
[data-bs-theme="dark"] .alert-light { --bs-alert-bg: var(--surface-2); --bs-alert-color: var(--ink); --bs-alert-border-color: var(--line); }
/* کارنامه و برگه‌های چاپی همیشه روشن (کاغذ) می‌مانند */
[data-bs-theme="dark"] .rc-sheet { color: #111; }
[data-bs-theme="dark"] .rc-sheet .text-muted { color: #555 !important; }

/* ---------- انتخاب حالت نمایش */
.theme-switch .dropdown-item.active { background: var(--board); }

/* ---------- برنامه هفتگی در موبایل (فهرست روزانه) */
.tt-days details { border-bottom: 1px solid var(--line); }
.tt-days details:last-child { border-bottom: 0; }
.tt-days summary { padding: .75rem 1rem; font-weight: 700; cursor: pointer; list-style: none; display: flex; align-items: center; gap: .5rem; }
.tt-days summary::-webkit-details-marker { display: none; }
.tt-days summary::after { content: '\F282'; font-family: 'bootstrap-icons'; margin-inline-start: auto; transition: transform .2s; }
.tt-days details[open] summary::after { transform: rotate(180deg); }
.tt-days .tt-item { display: flex; gap: .75rem; align-items: center; padding: .5rem 1rem; border-top: 1px dashed var(--line); }
.tt-days .tt-item .tm { font-size: .8rem; color: var(--ink-soft); min-width: 80px; text-align: center; }
.tt-days .tt-item.now { background: var(--pencil-soft); }

/* ---------- دفتر نمره: ورود ستونی (مناسب موبایل) */
.col-entry .list-group-item { display: flex; align-items: center; gap: .75rem; }
.col-entry .score-input { width: 96px; font-size: 1.05rem; }
@media (max-width: 575px) {
  .page-actions .btn { font-size: .8rem; padding: .3rem .55rem; }
  .gradebook .score-input { width: 60px; }
  .card-header { padding: .7rem .8rem; }
  .table > :not(caption) > * > * { padding: .5rem .5rem; }
}

/* ===== راهنما، دانلود برنامه و پیام به‌روزرسانی ===== */
.app-links { display: flex; flex-direction: column; gap: .4rem; margin-top: 1.25rem; }
.app-dl { display: flex; align-items: center; justify-content: center; gap: .45rem; padding: .5rem .7rem; border-radius: .6rem;
  border: 1px dashed var(--bs-border-color); color: var(--bs-secondary-color); font-size: .86rem; text-decoration: none; }
.app-dl:hover { background: var(--bs-tertiary-bg); color: var(--bs-body-color); }
.sidebar .app-links { margin: 0; padding: .6rem .8rem 1rem; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar .app-dl { border-color: rgba(255,255,255,.26); color: #d3e2dd; }
.sidebar .app-dl:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar .app-help { border-style: solid; background: rgba(255,255,255,.07); color: #fff; font-weight: 600; }
.upd-overlay { position: fixed; inset: 0; z-index: 9999; background: rgba(10,18,24,.72); display: flex; align-items: center; justify-content: center; padding: 24px; }
.upd-box { width: 100%; max-width: 360px; background: var(--bs-body-bg); color: var(--bs-body-color); border: 1px solid var(--bs-border-color); border-radius: .8rem; padding: 22px 20px; text-align: center; box-shadow: 0 20px 50px rgba(0,0,0,.35); }
.upd-box h3 { font-size: 1.05rem; margin: 0 0 .6rem; }
.upd-box p { font-size: .9rem; line-height: 2; color: var(--bs-secondary-color); margin: 0 0 1rem; }
