/* Riyazi-Bazi v3.1 - استایل زیبا با گرادینت و انیمیشن */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: linear-gradient(135deg, #f5f7fa 0%, #e8eef5 100%);
  --bg-solid: #f5f7fa;
  --card: #ffffff;
  --card-hover: #fafbfc;
  --text: #1a1f36;
  --text-soft: #4a5568;
  --muted: #586465;
  --border: #e1e8ed;
  --primary: #5b6cff;
  --primary-dark: #4252c4;
  --primary-light: #e0e4ff;
  --secondary: #ff6b9d;
  --secondary-light: #ffe0eb;
  --success: #047857;
  --success-light: #d1fae5;
  --warn: #b45309;
  --warn-light: #fef3c7;
  --danger: #c81e1e;
  --danger-light: #fee2e2;
  --info: #1d4ed8;
  --info-light: #dbeafe;
  --gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --gradient-2: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  --gradient-3: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  --gradient-4: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
  --gradient-5: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
  --gradient-6: linear-gradient(135deg, #30cfd0 0%, #330867 100%);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.05);
  --shadow: 0 6px 20px rgba(0,0,0,0.08);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.12);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 24px;
}

[data-theme="dark"] {
  --bg: linear-gradient(135deg, #0f1419 0%, #1a1f2e 100%);
  --bg-solid: #0f1419;
  --card: #1e2530;
  --card-hover: #252c38;
  --text: #e8eaf0;
  --text-soft: #b8bcc8;
  --muted: #9aa4b2;
  --border: #2d3540;
  --primary: #7c8aff;
  --primary-dark: #5b6cff;
  --primary-light: #2d3258;
  --secondary: #ff85b3;
  --secondary-light: #4a2a3a;
  --success: #34d399;
  --success-light: #1a3a2e;
  --warn: #fbbf24;
  --warn-light: #3a2e1a;
  --danger: #f87171;
  --danger-light: #3a1a1a;
  --info: #60a5fa;
  --info-light: #1a2a3a;
  --shadow: 0 6px 20px rgba(0,0,0,0.4);
}

[data-theme="hc"] {
  --bg: #000;
  --bg-solid: #000;
  --card: #000;
  --text: #fff;
  --muted: #fff;
  --border: #fff;
  --primary: #ffff00;
  --secondary: #00ffff;
}

body {
  font-family: 'Vazirmatn','Tahoma',sans-serif;
  background: var(--bg-solid);
  color: var(--text);
  direction: rtl;
  line-height: 1.7;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* ---------- container ---------- */
.container { max-width: 1180px; margin: 0 auto; padding: 16px; }
.container.narrow { max-width: 520px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.flex { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---------- topbar ---------- */
.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(12px);
}
.topbar .row { padding: 12px 20px; }
.brand {
  font-size: 22px; font-weight: bold; color: var(--text);
  display: flex; align-items: center; gap: 8px;
}
.brand img { width: 40px; height: 40px; border-radius: 12px; display: block; }
.brand:hover { text-decoration: none; transform: scale(1.02); }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a {
  padding: 8px 14px; border-radius: 10px;
  color: var(--text-soft); font-weight: 500;
  transition: all 0.2s;
}
.nav a:hover {
  background: var(--primary-light);
  color: var(--primary-dark);
  text-decoration: none;
  transform: translateY(-1px);
}
.nav a.logout { color: var(--danger); }
.nav a.logout:hover { background: var(--danger-light); }
.theme-toggle {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 42px; height: 42px;
  cursor: pointer; font-size: 18px;
  transition: all 0.3s;
}
.theme-toggle:hover { transform: rotate(180deg); background: var(--primary-light); }

/* ---------- hero ---------- */
.hero { text-align: center; padding: 60px 20px; }
.hero h1 {
  font-size: 48px; margin-bottom: 16px;
  background: var(--gradient-1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 900;
  letter-spacing: -1px;
}
.hero .lead { color: var(--text-soft); font-size: 19px; margin-bottom: 28px; max-width: 600px; margin-left: auto; margin-right: auto; }
.cta { display: flex; gap: 14px; justify-content: center; margin: 24px 0 40px; flex-wrap: wrap; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border-radius: 12px; border: 0; cursor: pointer;
  font-size: 15px; font-weight: 600; font-family: inherit;
  text-align: center; transition: all 0.2s;
  position: relative; overflow: hidden;
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0); }
.btn.primary { background: var(--gradient-1); color: #fff; }
/* ۵٫۴۹٫۱۷: گرادینت‌های دکمه برای خوانایی متن سفید تیره‌تر شده‌اند (ممیزی تضاد) */
.btn.secondary { background: linear-gradient(135deg, #d94f86, #b32e63); color: #fff; }
.btn.success { background: linear-gradient(135deg, #0b9163, #076e4a); color: #fff; }
.btn.warn { background: linear-gradient(135deg, #c96a06, #9a4e08); color: #fff; }
.btn.danger { background: var(--danger); color: #fff; }
.btn.ghost { background: transparent; color: var(--text); border: 2px solid var(--border); }
.btn.ghost:hover { background: var(--bg-solid); border-color: var(--primary); }
.btn.large { padding: 16px 32px; font-size: 17px; }
.btn.small { padding: 6px 12px; font-size: 13px; border-radius: 8px; }

/* ---------- cards ---------- */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
  box-shadow: var(--shadow-sm); margin-bottom: 18px;
  transition: all 0.2s;
}
.card:hover { box-shadow: var(--shadow); }
.card.gradient {
  background: var(--gradient-1); color: #fff;
  border: none;
}
.card.gradient h2 { color: #fff; border-color: rgba(255,255,255,0.3); }
.card.gradient .stat strong { color: #fff; }
.card.gradient .stat { background: rgba(255,255,255,0.15); color: #fff; }

h1, h2, h3 { color: var(--text); }
h1 { font-size: 32px; font-weight: 800; margin-bottom: 16px; }
h2 {
  font-size: 22px; font-weight: 700;
  border-bottom: 3px solid var(--primary);
  padding-bottom: 10px; margin-top: 32px; margin-bottom: 18px;
  display: inline-block;
}
h3 { font-size: 18px; font-weight: 600; margin-top: 20px; margin-bottom: 10px; }

/* ---------- grades ---------- */
.grades {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 18px; margin: 24px 0;
}
.grade-card {
  background: var(--card); border: 2px solid var(--border);
  border-radius: var(--radius); padding: 28px 20px;
  text-align: center; transition: all 0.3s;
  position: relative; overflow: hidden;
}
.grade-card::before {
  content: ''; position: absolute; inset: 0;
  background: var(--gradient-1); opacity: 0;
  transition: opacity 0.3s; z-index: 0;
}
.grade-card > * { position: relative; z-index: 1; }
.grade-card:hover {
  transform: translateY(-6px) scale(1.02);
  border-color: var(--primary);
  box-shadow: var(--shadow-lg);
}
.grade-card:hover::before { opacity: 0.1; }
.grade-card:hover .grade-num { transform: scale(1.15); }
.grade-num {
  font-size: 56px; font-weight: 900; color: var(--primary);
  transition: transform 0.3s; line-height: 1;
}
.grade-name { font-size: 16px; color: var(--text-soft); margin-top: 8px; font-weight: 500; }

/* ---------- features ---------- */
.features { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; margin-top: 16px; }
.feature {
  background: var(--card); padding: 18px; border-radius: 12px;
  border-right: 4px solid var(--primary);
  font-weight: 500;
  transition: all 0.2s;
}
.feature:hover { transform: translateX(-4px); box-shadow: var(--shadow-sm); }
.feature:nth-child(2) { border-right-color: var(--secondary); }
.feature:nth-child(3) { border-right-color: var(--success); }
.feature:nth-child(4) { border-right-color: var(--warn); }
.feature:nth-child(5) { border-right-color: var(--info); }
.feature:nth-child(6) { border-right-color: var(--danger); }

/* ---------- forms ---------- */
label { display: block; margin: 14px 0 6px; font-weight: 600; color: var(--text-soft); font-size: 14px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=tel], select, textarea {
  width: 100%; padding: 12px 14px; border: 2px solid var(--border);
  border-radius: 10px; font-size: 15px; font-family: inherit;
  background: var(--card); color: var(--text);
  transition: all 0.2s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-light);
}
small { color: var(--muted); font-size: 13px; }
.muted { color: var(--muted); }
.alert {
  padding: 14px 18px; border-radius: 12px; margin: 14px 0;
  border-right: 4px solid;
  font-weight: 500;
}
.alert.err { background: var(--danger-light); color: var(--danger); border-color: var(--danger); }
.alert.ok { background: var(--success-light); color: var(--success); border-color: var(--success); }
.alert.info { background: var(--info-light); color: var(--info); border-color: var(--info); }
.alert.warn { background: var(--warn-light, #fff8e1); color: var(--warn, #b45309); border-color: var(--warn, #f59f00); }

/* ---------- topics ---------- */
.topics { display: grid; gap: 12px; }
.topic {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 18px;
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 12px;
  transition: all 0.2s;
}
.topic:hover { border-color: var(--primary); transform: translateX(-4px); box-shadow: var(--shadow-sm); }
.topic .meta { color: var(--muted); font-size: 13px; margin-top: 4px; }
.topic .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-block; padding: 3px 10px; border-radius: 12px;
  font-size: 12px; background: var(--bg-solid); border: 1px solid var(--border);
  font-weight: 500;
}
.chip.success { background: var(--success-light); color: var(--success); border-color: var(--success); }
.chip.warn { background: var(--warn-light); color: var(--warn); border-color: var(--warn); }
.chip.primary { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }
.chip.info { background: #e0f2fe; color: #0369a1; border-color: #0284c7; }

/* ---------- lesson ---------- */
.lesson {
  background: var(--card); padding: 32px; border-radius: var(--radius);
  border: 1px solid var(--border);
  line-height: 2;
}
.lesson h1 { display: flex; align-items: center; gap: 12px; }
.lesson h2 { color: var(--primary); }
.lesson h3 { color: var(--secondary); margin-top: 20px; }
.lesson p { margin: 12px 0; }
.lesson ul, .lesson ol { padding-right: 24px; margin: 12px 0; }
.lesson li { margin: 6px 0; }
.lesson code, .lesson .formula {
  background: var(--primary-light);
  color: var(--primary-dark);
  padding: 2px 8px; border-radius: 6px;
  font-family: 'Vazirmatn', monospace; font-weight: 600;
}
.lesson .example {
  background: var(--success-light);
  border-right: 4px solid var(--success);
  padding: 14px 18px; border-radius: 10px; margin: 14px 0;
}
.lesson .note {
  background: var(--warn-light);
  border-right: 4px solid var(--warn);
  padding: 14px 18px; border-radius: 10px; margin: 14px 0;
}

/* ---------- quiz ---------- */
.quiz-question {
  background: var(--card); padding: 28px; border-radius: var(--radius);
  border: 1px solid var(--border); margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.quiz-stem { font-size: 19px; margin-bottom: 18px; line-height: 1.8; font-weight: 600; }
.choices { display: grid; gap: 10px; }
.choice {
  padding: 14px 18px; border: 2px solid var(--border);
  border-radius: 12px; cursor: pointer; background: var(--card);
  transition: all 0.2s; font-weight: 500;
}
.choice:hover { border-color: var(--primary); transform: translateX(-4px); box-shadow: var(--shadow-sm); }
.choice.selected { background: var(--primary); color: #fff; border-color: var(--primary); }
.choice.correct { background: var(--success-light); border-color: var(--success); color: var(--success); }
.choice.wrong { background: var(--danger-light); border-color: var(--danger); color: var(--danger); }
.quiz-progress { height: 10px; background: var(--bg-solid); border-radius: 5px; margin: 16px 0; overflow: hidden; border: 1px solid var(--border); }
.quiz-progress > div { height: 100%; background: var(--gradient-1); transition: width 0.4s; border-radius: 5px; }
.quiz-meta { display: flex; justify-content: space-between; color: var(--text-soft); font-size: 13px; font-weight: 500; margin-bottom: 8px; }

/* ---------- chat ---------- */
.chat {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); max-width: 760px; margin: 0 auto;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.chat-log { height: 420px; overflow-y: auto; padding: 18px; background: var(--bg-solid); }
.chat-msg {
  margin: 8px 0; max-width: 85%; padding: 12px 16px;
  border-radius: 18px; line-height: 1.7;
  animation: msgIn 0.3s ease-out;
  white-space: pre-wrap;
}
@keyframes msgIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.chat-msg.user { background: var(--gradient-1); color: #fff; margin-right: auto; border-bottom-right-radius: 4px; }
.chat-msg.bot { background: var(--card); border: 1px solid var(--border); margin-left: auto; border-bottom-left-radius: 4px; }
.chat-input { display: flex; gap: 8px; padding: 14px; border-top: 1px solid var(--border); background: var(--card); }
.chat-input input { flex: 1; }

/* ---------- report ---------- */
.report { background: var(--card); padding: 28px; border-radius: var(--radius); border: 1px solid var(--border); }
.report ul { padding-right: 22px; line-height: 2.2; }
.report .stat {
  display: inline-flex; flex-direction: column;
  padding: 14px 18px; background: var(--bg-solid);
  border-radius: 12px; margin: 4px;
  border: 1px solid var(--border);
}
.report .stat strong { font-size: 26px; color: var(--primary); font-weight: 800; }

/* ---------- footer ---------- */
.footer {
  background: var(--card); border-top: 1px solid var(--border);
  padding: 24px 0; text-align: center;
  color: var(--muted); margin-top: 60px;
  font-size: 14px;
}

/* ---------- utility ---------- */
.spacer { height: 16px; }
.text-center { text-align: center; }
.badges { display: flex; flex-wrap: wrap; gap: 8px; }
.badge {
  background: var(--card); border: 2px solid var(--border);
  padding: 10px 14px; border-radius: 24px; font-size: 14px;
  display: inline-flex; align-items: center; gap: 6px;
  transition: all 0.2s;
}
.badge:hover { transform: scale(1.05); box-shadow: var(--shadow-sm); }
.badge .icon { font-size: 20px; }
.stat {
  display: inline-flex; flex-direction: column;
  padding: 12px 18px; background: var(--bg-solid);
  border-radius: 12px; margin: 4px;
  border: 1px solid var(--border);
  min-width: 100px;
}
.stat strong { font-size: 24px; color: var(--primary); font-weight: 800; line-height: 1.2; }
table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: 10px; overflow: hidden; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--border); text-align: right; }
th { background: var(--bg-solid); font-weight: 700; color: var(--text-soft); }
tr:hover { background: var(--card-hover); }
tr:last-child td { border-bottom: none; }

/* ---------- games ---------- */
.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-top: 20px; }
.game-card {
  background: var(--card); border: 2px solid var(--border);
  border-radius: var(--radius); padding: 24px;
  text-align: center; cursor: pointer;
  transition: all 0.3s; position: relative; overflow: hidden;
}
.game-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--primary); }
.game-icon { font-size: 56px; margin-bottom: 12px; }
.game-title { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.game-desc { font-size: 13px; color: var(--muted); }

/* ---------- puzzle ---------- */
.puzzle-grid {
  display: grid; grid-template-columns: repeat(3, 90px);
  gap: 8px; margin: 20px auto; max-width: 290px;
}
.puzzle-cell {
  width: 90px; height: 90px;
  background: var(--gradient-1); color: #fff;
  font-size: 32px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  border-radius: 12px; cursor: pointer;
  transition: all 0.2s; user-select: none;
  box-shadow: var(--shadow-sm);
}
.puzzle-cell:hover:not(.empty) { transform: scale(1.05); }
.puzzle-cell.empty { background: var(--bg-solid); border: 2px dashed var(--border); cursor: default; }
.puzzle-cell.movable { box-shadow: 0 0 0 3px var(--warn); animation: pulse 1.5s infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 3px var(--warn); } 50% { box-shadow: 0 0 0 6px var(--warn-light); } }

/* ---------- speed game ---------- */
.speed-area { background: var(--card); padding: 32px; border-radius: var(--radius); border: 1px solid var(--border); text-align: center; }
.speed-q { font-size: 42px; font-weight: 800; color: var(--primary); margin: 20px 0; font-family: 'Vazirmatn', monospace; }
.speed-input { font-size: 28px; text-align: center; max-width: 200px; margin: 0 auto; padding: 14px; }
.speed-meta { display: flex; justify-content: space-around; margin: 20px 0; }
.speed-meta strong { color: var(--primary); font-size: 28px; }

/* ---------- worksheet ---------- */
.worksheet-paper {
  background: #fff; color: #1a1f36; padding: 40px;
  border: 1px solid var(--border); border-radius: var(--radius);
  margin: 20px 0; box-shadow: var(--shadow);
}
.worksheet-paper h2 { border: none; color: #1a1f36; }
.worksheet-paper .ws-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0; border-bottom: 1px dotted #ccc;
  font-size: 16px;
}
.worksheet-paper .ws-ans { border-bottom: 2px solid #1a1f36; min-width: 80px; height: 28px; }
.worksheet-paper .ws-q-num { color: #666; font-weight: 700; min-width: 30px; }
.worksheet-paper .ws-name { text-align: left; font-size: 14px; color: #666; }
.print-btn { margin: 20px 0; }
@media print {
  .topbar, .footer, .print-btn, .nav, .no-print, .admin-sidebar { display: none !important; }
  .admin-shell { display: block !important; }
  body { background: #fff; }
  .worksheet-paper { box-shadow: none; border: none; padding: 20px; }
  .container { max-width: 100%; padding: 0; }
  .card { box-shadow: none; border: 1px solid #ddd; }
}

/* ---------- responsive ---------- */
@media (max-width: 768px) {
  .topbar .row { padding: 8px 12px; }
  .nav a { padding: 4px 8px; font-size: 13px; }
  .hero h1 { font-size: 32px; }
  .hero { padding: 30px 12px; }
  .grade-num { font-size: 40px; }
  .grade-card { padding: 20px 12px; }
  h1 { font-size: 24px; }
  h2 { font-size: 18px; }
  .card { padding: 16px; }
  .lesson { padding: 20px; }
  .puzzle-grid { grid-template-columns: repeat(3, 70px); }
  .puzzle-cell { width: 70px; height: 70px; font-size: 24px; }
  .speed-q { font-size: 28px; }
  .stat { min-width: 80px; padding: 8px 12px; }
  .stat strong { font-size: 18px; }
}

/* ================= Riyazi-Bazi v4 - داشبوردها و اجزای جدید ================= */

/* ---------- چیدمان ---------- */
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 860px) { .grid2, .row2 { grid-template-columns: 1fr; } }
.ltr { direction: ltr; unicode-bidi: embed; font-family: monospace; }
.nowrap { white-space: nowrap; }
.table-wrap { overflow-x: auto; }
textarea { min-height: 90px; resize: vertical; }

/* ---------- ناوبری ---------- */
.nav a.active { background: var(--primary-light); color: var(--primary-dark); font-weight: 700; }

/* ---------- ورود/ثبت‌نام ---------- */
.auth-hero { text-align: center; font-size: 64px; margin: 10px 0 0; animation: float 3s ease-in-out infinite; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

/* ---------- لندینگ ---------- */
.hero-art { display: flex; justify-content: center; gap: 14px; font-size: 34px; margin-bottom: 8px; }
.hero-art span { display: inline-block; animation: float 3s ease-in-out infinite; }
.hero-art span:nth-child(2n) { animation-delay: 0.4s; }
.hero-art span:nth-child(3n) { animation-delay: 0.8s; }
.hero-stats { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; margin: 26px 0 10px; }
.hstat { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 14px 22px; min-width: 130px; box-shadow: var(--shadow-sm); }
.hstat strong { display: block; font-size: 28px; color: var(--primary); font-weight: 800; }
.hstat span { color: var(--text-soft); font-size: 13px; }

/* ---------- کارت دستیارها ---------- */
.agent-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin: 18px 0; }
.agent-card { background: var(--card); border: 2px solid var(--border); border-radius: 14px; padding: 16px 12px; text-align: center; color: var(--text); transition: all 0.2s; display: block; }
.agent-card:hover { transform: translateY(-3px); border-color: var(--primary); box-shadow: var(--shadow); text-decoration: none; }
.agent-card.current { border-color: var(--primary); background: var(--primary-light); box-shadow: var(--shadow); }
.agent-card .aicon { font-size: 36px; margin-bottom: 6px; }
.agent-card small { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }

/* ---------- چیپ‌های پیشنهاد ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.chip-btn { background: var(--primary-light); color: var(--primary-dark); border: 1px solid var(--primary); border-radius: 20px; padding: 7px 14px; cursor: pointer; font-family: inherit; font-size: 13px; transition: all 0.2s; }
.chip-btn:hover { background: var(--primary); color: #fff; }
.msg-tools { margin-top: 8px; }
.chat-msg .btn.small { font-size: 12px; padding: 4px 10px; }

/* ---------- تایپینگ ---------- */
.typing .dot { display: inline-block; width: 8px; height: 8px; margin: 0 2px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing .dot:nth-child(2) { animation-delay: 0.2s; }
.typing .dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }

/* ---------- داشبورد ---------- */
.dash-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.dash-head h1 { margin-bottom: 4px; }
.level-card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 12px 18px; min-width: 200px; box-shadow: var(--shadow-sm); }
.level-num { font-weight: 800; font-size: 17px; margin-bottom: 6px; }
.progress { height: 12px; background: var(--bg-solid); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.progress > div { height: 100%; background: var(--gradient-1); border-radius: 8px; transition: width 0.5s; }
.progress.small { height: 8px; margin-top: 6px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin: 16px 0; }
.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 16px 12px; text-align: center; box-shadow: var(--shadow-sm); position: relative; overflow: hidden; transition: transform 0.2s; }
.stat-card:hover { transform: translateY(-3px); }
.stat-card::after { content: ''; position: absolute; top: 0; right: 0; left: 0; height: 4px; }
.stat-card.c1::after { background: var(--gradient-2); }
.stat-card.c2::after { background: var(--gradient-1); }
.stat-card.c3::after { background: var(--gradient-3); }
.stat-card.c4::after { background: var(--gradient-4); }
.stat-card.c5::after { background: var(--gradient-5); }
.stat-card.c6::after { background: var(--gradient-6); }
.stat-card .sicon { font-size: 28px; }
.stat-card strong { display: block; font-size: 22px; font-weight: 800; color: var(--text); }
.stat-card span { color: var(--muted); font-size: 13px; }
.stat-card a { font-weight: 700; }

.cta-card { background: linear-gradient(135deg, var(--primary-light), var(--card)); border: 2px solid var(--primary); display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.cta-card h2 { border: none; margin-top: 0; padding: 0; }

.quick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.quick { background: var(--bg-solid); border: 1px solid var(--border); border-radius: 12px; padding: 14px 8px; text-align: center; color: var(--text); font-weight: 600; font-size: 14px; transition: all 0.2s; }
.quick:hover { border-color: var(--primary); transform: translateY(-2px); text-decoration: none; box-shadow: var(--shadow-sm); }
.quick span { display: block; font-size: 28px; margin-bottom: 4px; }

.topic-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--border); }
.topic-row:last-child { border-bottom: none; }

.bars { display: grid; gap: 8px; }
.bar-row { display: flex; align-items: center; gap: 10px; }
.bar { flex: 1; height: 14px; background: var(--bg-solid); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.bar > div { height: 100%; background: var(--gradient-4); border-radius: 8px; }
.bar-val { font-weight: 800; min-width: 44px; text-align: left; }

/* ---------- فرزندان (والدین) ---------- */
.child-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; margin: 16px 0; }
.child-card { margin-bottom: 0; }
.child-head { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.avatar { width: 48px; height: 48px; border-radius: 50%; background: var(--gradient-1); color: #fff; font-size: 22px; font-weight: 800; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.avatar.big { width: 68px; height: 68px; font-size: 30px; }
.avatar-img { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; display: block; margin: 0 auto; border: 3px solid var(--primary, #5b6cff); box-shadow: 0 4px 14px rgba(0, 0, 0, .18); background: var(--card, #fff); }
/* آواتار کوچک نوار بالا */
.nav-avatar { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; display: inline-block; vertical-align: middle; margin-left: 6px; border: 2px solid var(--primary, #5b6cff); background: var(--card, #fff); }
.avatar.nav-avatar-letter { width: 26px; height: 26px; font-size: 13px; display: inline-flex; vertical-align: middle; margin-left: 6px; }
/* بخش‌های آموزشی (accordion) */
details.tut { margin: 10px 0; }
details.tut summary { cursor: pointer; font-weight: 800; padding: 14px 16px; list-style: none; }
details.tut summary::-webkit-details-marker { display: none; }
details.tut summary::after { content: ' ▾'; color: var(--muted, #7f8c8d); }
details.tut[open] summary::after { content: ' ▴'; }
details.tut p, details.tut ol.tut-steps { padding-left: 16px; padding-right: 16px; }
ol.tut-steps { padding-left: 28px; padding-right: 28px; }
ol.tut-steps li { margin: 8px 4px; line-height: 1.9; }
.tut-tools { text-align: center; margin: 4px 0 14px; }
/* پیوندهای پاورقی */
.footer-links a { color: inherit; font-weight: 700; margin: 0 6px; }
.footer-links span { margin: 0 2px; opacity: .6; }
.mini-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 10px 0; }
.mini-stats > div { background: var(--bg-solid); border: 1px solid var(--border); border-radius: 10px; padding: 8px 4px; text-align: center; }
.mini-stats strong { display: block; font-size: 16px; color: var(--primary); }
.mini-stats span { font-size: 11px; color: var(--muted); }
.weak-list { padding-right: 18px; margin: 6px 0 12px; font-size: 14px; }
.creds { border: 2px solid var(--success); background: var(--success-light); }
.tips { padding-right: 20px; line-height: 2.2; }

/* ---------- تب‌ها ---------- */
.tabs { display: flex; gap: 8px; margin: 16px 0; flex-wrap: wrap; }
.tabs a { padding: 10px 20px; border-radius: 12px; background: var(--card); border: 1px solid var(--border); color: var(--text-soft); font-weight: 600; }
.tabs a:hover { text-decoration: none; border-color: var(--primary); }
.tabs a.on { background: var(--gradient-1); color: #fff; border-color: transparent; }

/* ---------- فعالیت ---------- */
.activity { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--border); flex-wrap: wrap; }
.activity:last-child { border-bottom: none; }

/* ---------- آزمون ---------- */
.quiz-dots { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--border); }
.qdot { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--border); background: var(--card); color: var(--text); cursor: pointer; font-family: inherit; font-weight: 700; transition: all 0.2s; }
.qdot:hover { border-color: var(--primary); }
.qdot.answered { background: var(--success-light); border-color: var(--success); color: var(--success); }
.qdot.current { background: var(--primary); border-color: var(--primary); color: #fff; }
.quiz-question { animation: msgIn 0.3s ease-out; }
.result-card { animation: msgIn 0.4s ease-out; }
.result-emoji { font-size: 64px; }
.result-ring { position: relative; width: 150px; height: 150px; margin: 16px auto; }
.result-ring.small { width: 110px; height: 110px; margin: 0; }
.result-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--border); stroke-width: 12; }
.ring-fg { fill: none; stroke: url(#ringGrad); stroke: #5b6cff; stroke-width: 12; stroke-linecap: round; }
.ring-num { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 28px; font-weight: 800; color: var(--primary); }
.review-item { border: 2px solid var(--border); border-radius: 12px; padding: 14px; margin: 10px 0; }
.review-item.rok { border-color: var(--success); background: var(--success-light); }
.review-item.rwrong { border-color: var(--danger); }
.explain-box { background: var(--info-light); border-right: 4px solid var(--info); border-radius: 8px; padding: 10px 14px; margin-top: 10px; line-height: 1.9; }
.practice-score { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 10px 16px; margin-bottom: 12px; font-weight: 700; text-align: center; }

/* ---------- گزارش ---------- */
.report-head { display: flex; gap: 16px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.report-head h2 { border: none; margin: 0; padding: 0; }
.report-head .result-ring { margin-right: auto; }
.advice-box { background: var(--warn-light); border: 1px solid var(--warn); border-radius: 12px; padding: 16px 20px; line-height: 2.1; }

/* ---------- کاربرگ ---------- */
.ws-head { display: flex; justify-content: space-between; gap: 16px; border-bottom: 2px solid #1a1f36; padding-bottom: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.ws-head h2 { border: none; display: block; color: #1a1f36; margin: 0; padding: 0; }
.ws-name { text-align: left; font-size: 14px; color: #444; display: grid; gap: 8px; }
.ws-line { display: inline-block; border-bottom: 1px solid #333; min-width: 160px; }
.ws-line.short { min-width: 80px; }
.ws-list { padding-right: 24px; }
.ws-list > li { margin: 14px 0; line-height: 2.2; }
.ws-stem { font-weight: 600; }
.ws-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; margin-top: 8px; padding-right: 18px; }
.ws-key { margin-top: 30px; border-top: 2px dashed #888; padding-top: 14px; }
.ws-key-grid { margin-top: 8px; line-height: 2.4; }
.ws-key-grid span { display: inline-block; margin: 2px 8px; background: #f5f5f5; padding: 4px 10px; border-radius: 6px; }

/* ---------- درس ---------- */
.lesson-actions { margin-top: 10px; }
.lesson-nav { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 24px; padding-top: 18px; border-top: 1px dashed var(--border); }
.lesson h4 { color: var(--primary-dark); margin-top: 16px; }

/* ---------- چاپ ---------- */
@media print {
  .report, .worksheet-paper { box-shadow: none; }
  .report-head .result-ring.small { width: 90px; height: 90px; }
  .cta-card, .no-print { display: none !important; }
  .grid2 { grid-template-columns: 1fr 1fr; }
}

/* ---------- ریسپانسیو ---------- */
@media (max-width: 768px) {
  .quick-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .mini-stats { grid-template-columns: repeat(2, 1fr); }
  .hero-art { font-size: 26px; gap: 8px; }
  .hstat { min-width: 110px; padding: 10px 14px; }
  .cta-card { flex-direction: column; align-items: stretch; }
  .ws-choices { grid-template-columns: 1fr; }
}

/* ============ Riyazi-Bazi v5 ============ */
/* شکل سؤال */
.q-diagram { display: flex; justify-content: center; margin: 14px 0; }
.q-diagram svg { max-width: 100%; height: auto; background: #fff; border: 1px solid #e3eaf3; border-radius: 12px; padding: 8px; }
.ws-diagram { margin: 8px 0; text-align: center; }
.ws-diagram svg { max-width: 280px; height: auto; }

/* تمرین بی‌نهایت */
.mode-toggle { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.fam-row { margin-bottom: 10px; }
.fam-row select { max-width: 320px; }

/* بخش بیشتر بدانیم درس‌ها */
.v5-more { background: linear-gradient(135deg, #fff9e6, #fff3d6); border: 2px dashed #e6a817; border-radius: 14px; padding: 16px 18px; margin-top: 22px; }
.v5-more h3 { margin-top: 0; color: #9a6b00; }
.v5-more ul { padding-right: 20px; }
.v5-more li { margin: 6px 0; }

/* چیپ خانواده‌ها */
.fam-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

/* آزمایشگاه */
.lab-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.lab-card input[type="range"] { width: 100%; }
.lab-out { margin-top: 10px; text-align: center; }
.lab-svg { max-width: 300px; width: 100%; height: auto; }
.pv-wrap { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 10px; }
.pv-col { flex: 1; min-width: 90px; }
.pv-label { font-size: 13px; margin-bottom: 6px; }
.pv-blocks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.pv-b { aspect-ratio: 1; border-radius: 6px; background: #eef2f7; border: 1px solid #d5dde8; }
.pv-b.on { border-color: #1d3551; }
.pv-h .pv-b.on { background: #e63946; }
.pv-t .pv-b.on { background: #457b9d; }
.pv-o .pv-b.on { background: #2a9d8f; }
/* برج ارزش مکانی تا میلیارد: ستون‌های فشرده‌تر + جداکنندهٔ گروه‌های هزار/میلیون/میلیارد */
.pv-gap { flex: 0 0 auto; width: 12px; }
#lab-place .pv-col { flex: 0 1 96px; min-width: 74px; }
#lab-place .pv-label { font-size: 12px; }
#lab-place .pv-blocks { gap: 3px; }
#lab-place .pv-b { border-radius: 5px; }
.mult-table { border-collapse: collapse; margin: 0 auto; font-size: 14px; }
.mult-table th, .mult-table td { border: 1px solid var(--border, #d5dde8); padding: 7px 9px; min-width: 34px; text-align: center; }
.mult-table thead th, .mult-table tbody th { background: var(--primary, #1d3551); color: #fff; }
.mult-table td { cursor: pointer; background: var(--card, #fff); color: var(--text, #1a1f36); }
.mult-table td:hover { background: var(--warn-light, #ffe8a3); }
.mult-table td.pick { background: var(--warn, #ffb703); color: #1a1f36; font-weight: bold; }
.lab-wide { grid-column: 1 / -1; }

/* کتابخانه */
.lib-card h3 { margin: 6px 0; }
.lib-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.lib-meta { margin: 4px 0 8px; }
.video-wrap { position: relative; max-width: 640px; margin: 10px auto; }
.video-wrap iframe, .video-wrap video { width: 100%; border-radius: 12px; border: 1px solid #e3eaf3; background: #000; }
.video-wrap iframe { aspect-ratio: 16/9; height: auto; }
.lib-body summary { cursor: pointer; font-weight: bold; margin: 8px 0; }
.ws-text { background: #f8fafc; border: 1px solid #e3eaf3; border-radius: 10px; padding: 12px; white-space: pre-wrap; text-align: right; }
.lib-actions { margin-top: 10px; align-items: center; }
.lib-class { max-width: 260px; }
#lib-list { display: grid; gap: 14px; margin-top: 14px; }

@media (max-width: 640px) {
  .pv-blocks { grid-template-columns: repeat(3, 1fr); }
  .mult-table th, .mult-table td { padding: 4px 5px; min-width: 26px; font-size: 12px; }
}

/* ============ Riyazi-Bazi v5.1: درس‌های غنی ============ */
.ls-fig { text-align: center; margin: 14px 0; }
.ls-fig svg { max-width: 100%; height: auto; background: #fff; border: 2px solid #e3eaf3; border-radius: 14px; padding: 10px; }
.ls-cap { font-size: 13px; color: #64748b; margin-top: 6px; }
.ls-table { border-collapse: collapse; margin: 10px auto; font-size: 15px; }
.ls-table th, .ls-table td { border: 2px solid #90a4ae; padding: 8px 14px; text-align: center; }
.ls-table th { background: #1d3551; color: #fff; }
.ls-table td { background: #fff; }
.ls-table tr:nth-child(even) td { background: #f1faee; }
.ls-bar { display: flex; gap: 3px; justify-content: center; margin: 10px 0; direction: ltr; }
.ls-bar span { width: 34px; height: 34px; border-radius: 7px; background: #eef2f7; border: 2px solid #90a4ae; }
.ls-bar span.on { background: #ffb703; border-color: #9a6b00; }
.ls-links { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.ls-kid, .kid { background: #f0f9ff; border-radius: 12px; padding: 12px 16px; margin: 12px 0; line-height: 2; }
.story {
  background: linear-gradient(135deg, #fefae0 0%, #faedcd 100%);
  border-right: 5px solid #d4a373;
  border-radius: 14px;
  padding: 14px 18px;
  margin: 14px 0;
  line-height: 2.1;
  font-size: 1.02rem;
  color: #283618;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.example {
  background: #f0fdf4;
  border-right: 4px solid #10b981;
  border-radius: 10px;
  padding: 10px 14px;
  margin: 10px 0;
  line-height: 1.9;
  font-size: 0.98rem;
}
.note {
  background: #eff6ff;
  border-right: 4px solid #3b82f6;
  border-radius: 10px;
  padding: 10px 14px;
  margin: 10px 0;
  line-height: 1.9;
  font-size: 0.98rem;
}

/* v5.2: انواع سؤال */
.blank-wrap { margin: 12px 0; }
.blank-input { width: 100%; max-width: 420px; padding: 10px 14px; font-size: 1.05rem; border: 2px solid #c9d2e0; border-radius: 10px; font-family: inherit; }
.blank-input:focus { outline: none; border-color: #5b6cff; }
.open-input { width: 100%; padding: 10px 14px; font-size: 1rem; border: 2px solid #c9d2e0; border-radius: 10px; font-family: inherit; resize: vertical; }
.sample-box { background: #f0f4ff; border: 1px dashed #5b6cff; border-radius: 10px; padding: 12px 14px; margin: 12px 0; line-height: 2; }
.match-table { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.match-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.match-l { flex: 1; min-width: 140px; font-weight: bold; }
.match-sel { padding: 8px 10px; border-radius: 8px; border: 2px solid #c9d2e0; font-family: inherit; max-width: 260px; }
.ws-type { display: inline-block; background: #eef1ff; color: #4252c4; border-radius: 20px; padding: 2px 12px; font-size: .8rem; margin-bottom: 4px; }
.ws-blank { margin-top: 8px; }
.ws-line { display: inline-block; border-bottom: 2px dotted #94a3b8; min-width: 160px; height: 1.2em; }
.ws-line.short { min-width: 60px; }
.ws-line.wide { min-width: 90%; margin: 6px 0; }
.ws-open .ws-line.wide { display: block; }
.match-cols { display: flex; gap: 24px; margin-top: 8px; line-height: 2.1; }
.match-col { flex: 1; background: #f8fafc; border-radius: 10px; padding: 8px 14px; }
@media print { .sample-box { break-inside: avoid; } .match-col { background: none; border: 1px solid #cbd5e1; } }

/* ============================ Riyazi-Bazi v5.3 ============================ */

/* ---------- چیدمان سه‌ستونه ---------- */
.row3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; }
@media (max-width: 900px) { .row3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 620px) { .row3 { grid-template-columns: 1fr; } }

/* ---------- ابزارهای نوار بالا ---------- */
.topbar-tools { gap: 8px; }

/* ---------- فرم کاربرگ ---------- */
.ws-form label { margin-top: 10px; }
.ws-more { margin-top: 12px; border-top: 1px dashed var(--border); padding-top: 10px; }
.ws-more > summary { cursor: pointer; font-weight: 700; color: var(--primary-dark); padding: 6px 0; }
.ws-tpl-label { margin-top: 12px; }
.ws-tpls { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px,1fr)); gap: 10px; margin: 6px 0 14px; }
.ws-tpl-card { position: relative; border: 2px solid var(--border); border-radius: 14px; padding: 10px;
  background: var(--card); cursor: pointer; display: block; transition: all .18s; text-align: center; }
.ws-tpl-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-sm); }
.ws-tpl-card.on { border-color: var(--primary); background: var(--primary-light); }
.ws-tpl-card input { position: absolute; opacity: 0; pointer-events: none; }
.ws-tpl-card strong { display: block; font-size: 13.5px; margin-top: 6px; }
.ws-tpl-card small { display: block; font-size: 11.5px; color: var(--text-soft); line-height: 1.5; }
.tpl-box { display: flex; align-items: center; justify-content: center; height: 46px; border-radius: 10px;
  font-size: 20px; border: 1px solid var(--border); background: #fff; }
.tpl-box.tpl-kids { background: #fffdf6; border-color: #ff9f1c; }
.tpl-box.tpl-candy { background: #fff8fb; border-color: #f78fb3; }
.tpl-box.tpl-girl { background: #fff7fb; border-color: #e84393; }
.tpl-box.tpl-boy { background: #f5faff; border-color: #0984e3; }
.tpl-box.tpl-teen { background: #fbfaff; border-color: #7c4dff; }
.tpl-box.tpl-formal { background: #fff; border: 3px double #12263f; border-radius: 0; }
.tpl-box.tpl-parent { background: #fbfffe; border-color: #0f766e; }
.ws-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px,1fr)); gap: 6px; margin: 12px 0; }
.ws-checks label { display: flex; gap: 8px; align-items: center; margin: 0; font-weight: 500; font-size: 14px; color: var(--text); }
.ws-checks input[type="checkbox"] { width: 18px; height: 18px; flex: 0 0 auto; }
.ws-mini { display: flex !important; gap: 8px; align-items: center; font-weight: 500; }
.ws-actions { margin-top: 14px; }
.ws-toolbar .flex { gap: 8px; }
.ws-tip { margin: 10px 0 0; font-size: 13px; line-height: 1.9; }
.ws-bottom { margin: 20px 0; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.ls-list { padding-right: 22px; line-height: 2.1; }
.ls-list li { margin: 4px 0; }

/* ---------- وضعیت هوش مصنوعی در صفحهٔ دستیارها ---------- */
.ai-status { border-right: 4px solid var(--primary); }
.ai-status-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.ai-status-row strong { font-size: 16px; }
.ai-status-row small { display: block; margin-top: 4px; line-height: 1.8; }
.ai-switch { display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 700; color: var(--text); }
.ai-switch input { width: 20px; height: 20px; }
.agent-card.ai-card { border-style: dashed; }
.ai-chip { margin-top: 6px; }

/* نشانگر منبع پاسخ در چت */
.src-badge { display: inline-block; font-size: 11.5px; padding: 2px 10px; border-radius: 20px; margin-bottom: 6px; }
.src-badge.ai { background: var(--primary-light); color: var(--primary-dark); border: 1px solid var(--primary); }
.src-badge.local { background: var(--success-light); color: var(--success); border: 1px solid var(--success); }
.typing-label { margin-right: 8px; color: var(--muted); font-size: 13px; }

/* ---------- تمرین با دستیار ---------- */
.drill-card { margin-top: 20px; }
.drill-items { display: grid; gap: 12px; margin-top: 14px; }
.drill-item { border: 2px solid var(--border); border-radius: 14px; padding: 12px 14px; background: var(--card); transition: all .2s; }
.drill-item.is-ok { border-color: var(--success); background: var(--success-light); }
.drill-item.is-no { border-color: var(--danger); }
.drill-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.drill-head b { color: var(--primary-dark); font-size: 17px; }
.drill-stem { font-weight: 700; flex: 1 1 auto; }
.drill-fig { text-align: center; margin: 8px 0; }
.drill-fig svg { max-width: 260px; width: 100%; height: auto; }
.drill-ans { margin-top: 8px; }
.drill-opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px,1fr)); gap: 6px; }
.drill-opts .opt { display: flex; gap: 8px; align-items: center; margin: 0; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 10px; font-weight: 500; cursor: pointer; background: var(--bg-solid); }
.drill-opts .opt:hover { border-color: var(--primary); background: var(--primary-light); }
.drill-opts .opt input { width: 18px; height: 18px; flex: 0 0 auto; }
.drill-match { display: grid; gap: 6px; }
.drill-match .match-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.drill-match .match-l { flex: 1 1 160px; font-weight: 600; }
.drill-match select { max-width: 280px; }
.self-ok { display: flex !important; gap: 8px; align-items: center; margin-top: 8px !important; font-weight: 500; }
.drill-feedback { margin-top: 8px; font-weight: 700; }
.drill-feedback.ok { color: var(--success); }
.drill-feedback.no { color: var(--danger); }
.drill-feedback.hint { color: var(--info); font-weight: 500; }
.drill-feedback .explain-box { font-weight: 400; margin-top: 6px; }
.drill-score { margin-top: 16px; border-radius: 14px; padding: 16px; text-align: center; border: 2px solid var(--border); }
.drill-score.good { background: var(--success-light); border-color: var(--success); }
.drill-score.mid { background: var(--warn-light); border-color: var(--warn); }
.drill-score.low { background: var(--info-light); border-color: var(--info); }
.drill-score strong { font-size: 22px; display: block; }
.drill-score .pct { display: block; font-size: 30px; font-weight: 900; color: var(--primary-dark); }
.drill-score p { margin: 8px 0 4px; line-height: 1.9; }

/* ---------- چاپ: فقط محتوای اصلی ---------- */
@media print {
  .topbar, .footer, .nav, .no-print, .ws-toolbar, .ws-bottom, .skin-pop, .toast, #ws-form { display: none !important; }
  html, body, .app, main, .container, #ws-paper-wrap {
    background: #fff !important;
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
    position: static !important;
    float: none !important;
  }
  .card { box-shadow: none !important; }
}

/* ============ Riyazi-Bazi v5.3: تنظیمات هوش مصنوعی هر سرویس جدا ============ */
.card-inner { background: var(--bg-solid); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; margin: 10px 0; }
.card-inner h3 { margin: 0 0 6px; font-size: 16px; }
.ai-panel { border: 2px solid var(--border); border-radius: 14px; padding: 14px 16px; margin: 12px 0; background: var(--card); transition: border-color .2s; }
.ai-panel.on { border-color: var(--primary); box-shadow: var(--shadow-sm); }
.ai-panel-head { justify-content: space-between; margin-bottom: 4px; }
.ai-panel-head strong { font-size: 15.5px; }
.ai-panel .row2 { margin-top: 6px; }
.ai-links { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.ai-links .ai-test-out { font-size: 12.5px; line-height: 1.7; flex-basis: 100%; word-break: break-word; }
@media (max-width: 620px) { .ai-panel .row2 { grid-template-columns: 1fr; } }

/* ---------- عبارت‌های ریاضی چپ‌به‌راست (ایزوله از فارسی دورش) ---------- */
.lm { direction: ltr; unicode-bidi: isolate; display: inline-block; }
@media print { .lm { unicode-bidi: embed; direction: ltr; display: inline; } }


/* ============ Riyazi-Bazi v5.5.1 — بازی‌ها: دکمهٔ پاسخ و واکنش‌گرایی ============ */
.speed-answer { display: flex; gap: 10px; justify-content: center; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.speed-answer .speed-input { margin: 0; flex: 0 1 200px; }
.speed-check { padding: 14px 22px; font-size: 16px; }

/* شمارش ۱ تا ۱۰۰: جدول واکنش‌گرا که از صفحه بیرون نزند */
.count-grid {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 4px;
  margin-top: 18px;
  max-width: 100%;
}
.count-cell {
  aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center;
  min-width: 0;
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700; font-size: 18px;
  transition: all 0.2s;
}
@media (max-width: 640px) {
  .count-grid { gap: 2px; }
  .count-cell { border-width: 1px; border-radius: 5px; font-size: 12px; }
  .speed-area { padding: 18px 12px; }
  .speed-q { font-size: 30px; }
  .speed-input { font-size: 22px; }
  .speed-check { padding: 12px 16px; font-size: 15px; }
}

/* ============ Riyazi-Bazi v5.5.1 — ویرایشگر متن درس (بدون نمایش کد HTML) ============ */
.rte { border: 2px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--card); }
.rte-toolbar {
  display: flex; flex-wrap: wrap; gap: 4px; align-items: center;
  padding: 8px; border-bottom: 2px solid var(--border); background: var(--bg-solid);
}
.rte-toolbar button {
  min-width: 34px; height: 34px; padding: 0 9px;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--card); color: var(--text);
  cursor: pointer; font-size: 14px; font-weight: 600; line-height: 1;
}
.rte-toolbar button:hover { border-color: var(--primary); background: var(--primary-light); }
.rte-sep { width: 1px; align-self: stretch; background: var(--border); margin: 0 4px; }
.rte-color { display: inline-flex; align-items: center; gap: 3px; font-size: 14px; }
.rte-color input[type="color"] {
  width: 30px; height: 30px; padding: 2px;
  border: 1px solid var(--border); border-radius: 6px; background: var(--card); cursor: pointer;
}
.rte-content {
  min-height: 260px; max-height: 560px; overflow: auto;
  padding: 14px 16px; line-height: 2; text-align: right;
}
.rte-content:focus { outline: none; }
.rte-content img { max-width: 100%; height: auto; }
.rte-content h2 { color: var(--primary); margin: 8px 0; }
.rte-content h3 { color: var(--secondary); margin: 8px 0; }
.rte-content ul, .rte-content ol { padding-right: 24px; }
.rte-content .example {
  background: var(--success-light); border-right: 4px solid var(--success);
  padding: 10px 14px; border-radius: 10px; margin: 10px 0;
}
.rte-content .note {
  background: var(--warn-light); border-right: 4px solid var(--warn);
  padding: 10px 14px; border-radius: 10px; margin: 10px 0;
}
.rte-content .formula {
  background: var(--primary-light); color: var(--primary-dark);
  padding: 2px 8px; border-radius: 6px; font-weight: 600;
}

/* ---------- v5.5.1 ویرایشگر: حالت کد HTML و امکانات پیشرفته ---------- */
.rte-src-btn { background: var(--primary); color: #fff; border-color: var(--primary); font-size: 12.5px; }
.rte-src-btn:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.rte-select { display: inline-flex; align-items: center; }
.rte-select select { width: auto; min-width: 108px; padding: 5px 8px; font-size: 13px; }
.rte-toolbar button:disabled, .rte-toolbar select:disabled, .rte-toolbar input:disabled { opacity: 0.3; cursor: default; pointer-events: none; }
.rte-source {
  display: none;
  width: 100%;
  min-height: 320px;
  max-height: 600px;
  font-family: 'Courier New', Consolas, 'Vazirmatn', monospace;
  font-size: 13px;
  line-height: 1.7;
  direction: ltr;
  text-align: left;
  background: #1e1e2e;
  color: #d6d6e0;
  border: none;
  border-radius: 0;
  padding: 14px 16px;
  resize: vertical;
  tab-size: 2;
}
.rte-source:focus { outline: 2px solid var(--primary); }
.rte-content blockquote {
  border-right: 4px solid var(--primary);
  background: var(--bg-solid);
  margin: 12px 0; padding: 8px 14px; border-radius: 8px;
}
.rte-content table { border-collapse: collapse; width: 100%; margin: 12px 0; }
.rte-content table td, .rte-content table th { border: 1px solid var(--border); padding: 6px 10px; min-width: 30px; }

/* ============ Riyazi-Bazi v5.8: دکمه و پنجرهٔ نصب برنامه ============ */
.install-app-btn {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 6px 14px;
  font-size: 0.9rem;
  font-weight: bold;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  box-shadow: 0 2px 8px rgba(16,185,129,0.3);
  transition: all 0.2s;
  text-decoration: none;
}
.install-app-btn:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16,185,129,0.4);
}
.nav-install-btn {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
  border-radius: var(--radius-sm, 10px);
  padding: 8px 14px;
  font-size: 0.92rem;
  font-weight: bold;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.nav-install-btn:hover {
  background: #10b981;
  color: #fff;
  border-color: #10b981;
}

/* پنجره مدال نصب برنامه */
.install-modal {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.install-modal-overlay {
  position: absolute; inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
}
.install-modal-card {
  position: relative; z-index: 2;
  background: var(--card, #fff);
  color: var(--text, #1e293b);
  border-radius: 20px;
  max-width: 540px; width: 100%;
  padding: 26px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.2);
  border: 1px solid var(--border, #e2e8f0);
  max-height: 90vh; overflow-y: auto;
}
.install-modal-close {
  position: absolute; top: 16px; left: 16px;
  background: #f1f5f9; border: none; border-radius: 50%;
  width: 32px; height: 32px; font-size: 16px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: #64748b; transition: all 0.2s;
}
.install-modal-close:hover { background: #fee2e2; color: #dc2626; }
.install-modal-header { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.install-app-icon { font-size: 40px; background: #e0f2fe; width: 64px; height: 64px; border-radius: 16px; display: flex; align-items: center; justify-content: center; }
.install-modal-header h3 { margin: 0; font-size: 1.25rem; color: #1e3a8a; }
.install-modal-header p { margin: 4px 0 0 0; font-size: 0.88rem; color: #64748b; }
.install-actions { margin: 16px 0; text-align: center; }
.install-now-btn { width: 100%; padding: 14px; font-size: 1.05rem; font-weight: bold; }
.install-guides { display: flex; flex-direction: column; gap: 12px; }
.install-guide-item {
  background: #f8fafc; border: 1px solid #e2e8f0;
  border-radius: 12px; padding: 12px 16px; font-size: 0.92rem;
}
.install-guide-item strong { display: block; margin-bottom: 4px; color: #1e293b; }
.install-guide-item p { margin: 0; color: #475569; line-height: 1.7; font-size: 0.88rem; }
.install-guide-item.db-install-link { background: #fefce8; border-color: #fef08a; }
.install-guide-item.db-install-link strong { color: #854d0e; }
.btn-clean-link { color: #2563eb; font-weight: bold; text-decoration: underline; }

/* ---------- مسیر راهنما: پایه › فصل › بخش ---------- */
.ls-trail {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  font-size: .9rem; margin: 2px 0 10px;
}
.ls-trail a { color: var(--primary); text-decoration: none; }
.ls-trail a:hover { text-decoration: underline; }
.ls-trail .sep { color: var(--muted, #adb5bd); }
.ls-trail strong { color: var(--text, #212529); }
.lesson-hearbox {
  background: var(--primary-light, #eef4ff);
  border: 1px solid var(--primary, #2f6fed);
  border-radius: 14px;
  padding: 14px 16px;
  margin: 12px 0 18px;
}
.lesson-hear-title { font-weight: 800; font-size: 1.15rem; margin-bottom: 8px; }
.lesson-hearbox p { margin: 0 0 10px; color: var(--text, #212529); }
.lesson-hearbox audio { width: 100%; margin: 4px 0 10px; }
.lesson-hear { min-width: 140px; }
.curriculum-example, .curriculum-task, .curriculum-check {
  background: var(--card, #fff);
  color: var(--text, #212529);
  border: 1px solid var(--border, #dbe2ea);
  border-radius: 14px;
  padding: 12px 15px;
  margin: 12px 0;
}
.curriculum-example { border-inline-start: 5px solid #f0ae35; }
.curriculum-task { border-inline-start: 5px solid var(--primary, #5b6cff); }
.curriculum-check { border-inline-start: 5px solid #10b981; }
.curriculum-example p, .curriculum-task p, .curriculum-check p { margin: 6px 0; color: var(--text, #212529); }
.curriculum-story { align-items: start; }
.curriculum-story .lesson-hear-title { margin-bottom: 5px; }
.curriculum-story-play { margin: 2px 0 6px; }
.curriculum-story-text { margin-top: 5px; }
.curriculum-story-text summary { cursor: pointer; color: var(--primary, #5b6cff); font-weight: 700; }
.curriculum-story-text p { margin-top: 6px; }
.lesson .ls-crumb {
  font-size: .85rem; color: var(--muted, #868e96);
  background: var(--primary-light, #eef4ff); border-radius: 8px;
  padding: 4px 10px; display: inline-block; margin-bottom: 6px;
}

/* برچسب «بخش اول / بخش دوم / …» در فهرست فصل‌ها */
.sec-badge {
  display: inline-block; background: var(--primary-light, #eef4ff); color: var(--primary, #2f6fed);
  border-radius: 7px; padding: 1px 8px; font-size: .78em; font-weight: 700; margin-left: 2px;
}
.tts-on { outline: 2px solid var(--primary, #5b6cff); border-radius: 8px; }

/* ---------- هوشی درس: قاب پایه و قفسهٔ کتاب ---------- */
.home { background: #f3efe6; margin: -8px 0 0; padding-bottom: 36px; }
.home-hero {
  background:
    radial-gradient(circle at 80% 0%, rgba(231,163,34,.22), transparent 36%),
    #143d3a;
  color: #f6f1e7;
  padding: 28px 0 36px;
}
.home-hero-inner { text-align: center; }
.home-logo {
  width: min(640px, 100%);
  height: auto;
  background: #f6f1e7;
  border-radius: 28px;
  display: block;
  margin: 0 auto 18px;
  box-shadow: 0 18px 40px rgba(0,0,0,.22);
}
.home-hero .lead {
  color: #d7ebe4;
  font-size: 18px;
  line-height: 2;
  max-width: 38rem;
  margin: 0 auto 16px;
}
.home-hero .btn.light { background: #e7a322; color: #1b2420; border-color: #e7a322; }
.home-hero .btn.light:hover { background: #f0c15a; }
.home-hero .btn.ghost.light { color: #fff8ee; border-color: rgba(255,248,238,.45); background: transparent; }
.home-lock {
  margin: 14px auto 0;
  max-width: 34rem;
  color: #f0d48a;
  font-weight: 700;
}
.home-block { padding-top: 8px; }
.home-block h2, .home-block h1 { display: block; border: 0; }
.pick-lead { color: var(--text-soft); max-width: 40rem; margin: -4px 0 16px; line-height: 1.9; }
.paper {
  background: #fffaf2;
  border: 1px solid #e4d7c3;
  border-radius: 18px;
  padding: 22px 22px 8px;
  box-shadow: 0 10px 0 #e7dcc8;
  margin-top: 22px;
}
.paper p { line-height: 2; color: #3d4a46; margin-bottom: 10px; }
.path { list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 16px 0 18px; padding: 0; }
.path li {
  display: flex; gap: 10px; align-items: flex-start;
  background: #f6f1e7; border-radius: 14px; padding: 12px;
}
.path b {
  flex: 0 0 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center;
  background: #143d3a; color: #f6f1e7; font-size: 14px;
}
.path span { line-height: 1.7; color: #24312e; }
.frames {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin: 8px 0 12px;
}
.frame {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--wood, #8d5a32);
  padding: 12px;
  border-radius: 6px;
  box-shadow: 0 1px 0 rgba(255,255,255,.25) inset, 0 12px 0 var(--wood-dark, #5c3a20), 0 18px 28px rgba(40,24,8,.16);
  transition: transform .16s ease;
}
.frame:hover { transform: translateY(-4px); text-decoration: none; }
.frame-mat {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 168px; text-align: center;
  background: #fffaf2;
  border: 1px solid rgba(90,60,20,.18);
  box-shadow: inset 0 0 0 7px rgba(255,255,255,.55);
  padding: 16px 12px;
}
.frame-num {
  font-size: 52px; line-height: 1; font-weight: 900; color: var(--ink, #143d3a);
}
.frame-mat strong { margin-top: 4px; font-size: 18px; }
.frame-mat small { margin-top: 6px; color: #5c6b66; line-height: 1.6; }
.g1 { --wood: #a15a32; --wood-dark: #6d3b1e; --ink: #a15a32; }
.g2 { --wood: #2f6b4a; --wood-dark: #1c4330; --ink: #1f7a4d; }
.g3 { --wood: #2c5278; --wood-dark: #1a334c; --ink: #1d4e89; }
.g4 { --wood: #6d4460; --wood-dark: #452c3e; --ink: #7a3e6d; }
.g5 { --wood: #8a6230; --wood-dark: #5c401c; --ink: #8a5a12; }
.g6 { --wood: #1f6a66; --wood-dark: #123f3d; --ink: #0f766e; }
.shelf {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 22px 14px;
  align-items: end;
  padding: 8px 8px 26px;
  margin-top: 8px;
  background:
    linear-gradient(#c4aa84, #c4aa84) bottom / 100% 16px no-repeat,
    linear-gradient(#8d6b43, #8d6b43) bottom 16px / 100% 5px no-repeat;
}
.shelf-page { margin-top: 6px; }
.shelf-one { grid-template-columns: 220px; justify-content: center; }
.book {
  display: grid;
  grid-template-columns: 28px 1fr 9px;
  min-height: 214px;
  text-decoration: none;
  color: #fffaf2;
  filter: drop-shadow(6px 10px 0 rgba(20, 30, 24, .14));
  transition: transform .16s ease;
}
.book:hover { transform: translateY(-6px) rotate(-1deg); text-decoration: none; color: #fffaf2; }
.book-spine {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  display: flex; align-items: center; justify-content: center;
  background: var(--spine, #0e2a28);
  border-radius: 3px 0 0 8px;
  font-weight: 800;
  letter-spacing: .08em;
  font-size: 13px;
}
.book-cover {
  position: relative;
  background:
    linear-gradient(180deg, rgba(255,255,255,.14), transparent 28%),
    var(--cloth, #1f6b4a);
  padding: 18px 12px 14px;
  display: flex; flex-direction: column; justify-content: flex-end;
  min-height: 214px;
  overflow: hidden;
}
.book-rule {
  position: absolute; top: 14px; left: 12px; right: 12px; height: 2px;
  background: rgba(255,248,238,.55);
  box-shadow: 0 8px 0 rgba(255,248,238,.28);
}
.book-cover strong { font-size: 20px; line-height: 1.35; position: relative; }
.book-cover small { display: block; margin-top: 6px; color: rgba(255,248,238,.82); line-height: 1.6; position: relative; }
.book-cover em {
  position: relative;
  align-self: flex-start;
  margin-top: 10px;
  font-style: normal;
  font-size: 12px;
  font-weight: 800;
  background: #e7a322;
  color: #1b2420;
  border-radius: 999px;
  padding: 2px 8px;
}
.book.soon .book-cover em { background: rgba(255,248,238,.16); color: #fff8ee; }
.book-pages {
  background: repeating-linear-gradient(#f7f1e6, #f7f1e6 3px, #e4d8c4 4px);
  border-radius: 0 3px 6px 0;
}
.cloth-math { --cloth: #1f6b4a; --spine: #123d2c; }
.cloth-farsi { --cloth: #7a2e3b; --spine: #4c1b24; }
.cloth-science { --cloth: #1d4e89; --spine: #123458; }
.cloth-quran { --cloth: #0f6b4c; --spine: #083828; }
.cloth-hedye { --cloth: #243056; --spine: #141a33; }
.cloth-social { --cloth: #8a5a2b; --spine: #5c3b1c; }
.cloth-art { --cloth: #c45c26; --spine: #8d3e16; }
.soon-panel, .home-notes article, .open-book {
  background: #fffaf2;
  border: 1px solid #e4d7c3;
  border-radius: 18px;
}
.soon-panel { text-align: center; padding: 28px 18px; margin-top: 8px; }
.open-book { padding: 8px 16px 16px; margin-top: 8px; box-shadow: 8px 0 0 #1f6b4a; }
.page-slip { background: transparent; }
.home-notes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 8px; }
.home-notes article { padding: 16px 16px 8px; }
.home-notes h3 { margin-top: 0; border: 0; font-size: 17px; }
.home-notes p, .soon-panel p { line-height: 1.95; color: #3d4a46; }
.home-links { margin-top: 16px; }
[data-theme="dark"] .home { background: #121816; }
[data-theme="dark"] .paper,
[data-theme="dark"] .soon-panel,
[data-theme="dark"] .home-notes article,
[data-theme="dark"] .open-book,
[data-theme="dark"] .frame-mat { background: #1c2420; color: #f4efe4; }
[data-theme="dark"] .paper p,
[data-theme="dark"] .home-notes p,
[data-theme="dark"] .soon-panel p,
[data-theme="dark"] .path span,
[data-theme="dark"] .frame-mat small { color: #d5e0db; }
[data-theme="dark"] .path li { background: #24302c; }
@media (max-width: 900px) {
  .frames, .path, .home-notes { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .frames, .path, .home-notes { grid-template-columns: 1fr; }
  .home-hero { padding-top: 16px; }
}

/* ================= 5.40.0: معرفی، داشبورد و مدیریت واکنش‌گرا ================= */
.dashboard-page { padding-top: clamp(18px, 3vw, 34px); padding-bottom: 44px; }
.dashboard-hero {
  position: relative; isolation: isolate; overflow: hidden;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 22px;
  margin: 8px 0 22px; padding: clamp(22px, 4vw, 38px);
  border: 1px solid var(--border); border-radius: 24px;
  background: linear-gradient(125deg, var(--primary-light), var(--card) 74%);
  box-shadow: var(--shadow-sm);
}
.dashboard-hero::after {
  content: ''; position: absolute; z-index: -1; top: -88px; right: -68px;
  width: 220px; height: 220px; border-radius: 50%;
  border: 26px solid rgba(91, 108, 255, .12);
  pointer-events: none;
}
.dashboard-hero > * { position: relative; z-index: 1; }
.dashboard-hero h1 { margin: 6px 0 5px; font-size: clamp(1.65rem, 3vw, 2.35rem); line-height: 1.45; }
.dashboard-hero p { margin: 0; max-width: 62ch; color: var(--text-soft); }
.dashboard-kicker { color: var(--primary-dark); font-size: .84rem; font-weight: 800; letter-spacing: .02em; }
.dashboard-hero-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-start; gap: 9px; max-width: 440px; }
.dashboard-hero-actions .btn { white-space: nowrap; }
.dashboard-hero-student { background: linear-gradient(120deg, #e5f4ff, var(--card) 72%); }
.dashboard-hero-teacher { background: linear-gradient(120deg, #e7f7ef, var(--card) 72%); }
.dashboard-hero-parent { background: linear-gradient(120deg, #fff0f4, var(--card) 72%); }
.dashboard-hero-admin { background: linear-gradient(120deg, #f0eaff, var(--card) 72%); }
.dashboard-page .card > h2:first-child { margin-top: 0; }
.dashboard-parent .grid2, .dashboard-teacher .grid2 { align-items: start; }

.admin-console { padding-top: 24px; padding-bottom: 48px; }
/* ---------- ۵٫۴۹٫۱۳: سایدبار کنسول مدیریت (سمت راست، جمع‌شونده) ---------- */
.admin-shell {
  display: grid; grid-template-columns: 248px minmax(0, 1fr);
  gap: 20px; align-items: start;
  transition: grid-template-columns .22s ease;
}
.admin-sidebar {
  position: sticky; top: 86px; z-index: 60;
  display: flex; flex-direction: column; gap: 8px;
  background: var(--card); border: 1px solid var(--border); border-radius: 18px;
  padding: 10px; box-shadow: var(--shadow-sm);
  max-height: calc(100vh - 104px); overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin;
}
.admin-sidebar-toggle {
  align-self: flex-end; flex: 0 0 auto;
  width: 34px; height: 34px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--bg-solid, var(--card));
  color: var(--text-soft); font-size: 16px; line-height: 1; cursor: pointer;
  transition: background .18s, border-color .18s, color .18s;
}
.admin-sidebar-toggle:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary-dark); }
.admin-sidebar-nav { display: flex; flex-direction: column; gap: 4px; }
.admin-sb-link {
  position: relative; display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 12px; border: 1px solid transparent;
  color: var(--text-soft); font-weight: 600; font-size: .95rem;
  transition: background .15s, color .15s, border-color .15s;
}
.admin-sb-link:hover { background: var(--primary-light); color: var(--primary-dark); text-decoration: none; border-color: var(--border); }
.admin-sb-link.on { background: var(--gradient-1); color: #fff; border-color: transparent; box-shadow: var(--shadow-sm); font-weight: 800; }
.admin-sb-ico { flex: 0 0 auto; width: 22px; text-align: center; font-size: 17px; line-height: 1.2; }
.admin-sb-txt { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-sb-badge {
  margin-inline-start: auto; flex: 0 0 auto;
  background: var(--danger); color: #fff; border-radius: 999px;
  padding: 2px 8px; font-size: .72rem; font-weight: 800; line-height: 1.3;
}
.admin-sb-link.on .admin-sb-badge { background: rgba(255, 255, 255, .92); color: var(--danger); }
.admin-main { min-width: 0; }
/* حالت جمع‌شده: فقط آیکن‌ها */
.admin-shell.sb-collapsed { grid-template-columns: 62px minmax(0, 1fr); }
.admin-shell.sb-collapsed .admin-sidebar { padding: 8px 6px; }
.admin-shell.sb-collapsed .admin-sidebar-toggle { align-self: center; }
.admin-shell.sb-collapsed .admin-sb-txt { display: none; }
.admin-shell.sb-collapsed .admin-sb-link { justify-content: center; padding: 10px 6px; }
.admin-shell.sb-collapsed .admin-sb-badge {
  position: absolute; top: 3px; inset-inline-end: 3px; margin: 0;
  padding: 1px 5px; font-size: .62rem; min-width: 15px; text-align: center;
}
/* موبایل: سایدبار به نوار افقیِ چسبان تبدیل می‌شود */
@media (max-width: 920px) {
  .admin-shell, .admin-shell.sb-collapsed { grid-template-columns: 1fr; gap: 14px; }
  .admin-sidebar {
    position: sticky; top: 62px; flex-direction: row; align-items: center; gap: 6px;
    max-height: none; overflow-x: auto; overflow-y: hidden;
    padding: 8px; border-radius: 14px;
  }
  .admin-sidebar-toggle { width: 32px; height: 32px; flex: 0 0 auto; }
  .admin-sidebar-nav { flex-direction: row; gap: 4px; }
  .admin-sb-link { white-space: nowrap; padding: 8px 12px; font-size: .88rem; }
  .admin-shell.sb-collapsed .admin-sb-link { padding: 8px 10px; }
}
.admin-console-head { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-bottom: 12px; }
.admin-console-head h1 { margin: 4px 0; }
.admin-console-head p { margin: 0; }
.admin-tabs { display: flex; flex-wrap: nowrap; gap: 8px; overflow-x: auto; margin: 18px 0; padding: 4px 2px 10px; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
.admin-tabs a { flex: 0 0 auto; white-space: nowrap; }
.admin-about-layout { display: grid; grid-template-columns: minmax(220px, .7fr) minmax(0, 1.6fr); align-items: start; gap: 18px; }
.admin-about-intro { background: linear-gradient(145deg, var(--primary-light), var(--card) 76%); }
.admin-about-intro h2 { margin-top: 8px; }
.admin-about-intro .btn { margin-top: 10px; }
.admin-about-form label { margin-top: 12px; }
.admin-about-form input, .admin-about-form textarea { margin-top: 5px; }
.admin-about-team-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 24px 0 12px; }
.admin-about-team-head h3 { margin: 0 0 4px; }
.admin-about-team-head p { margin: 0; font-size: 13px; }
.admin-about-team-head .btn { flex: 0 0 auto; }
.admin-about-team-list { display: grid; gap: 12px; margin-bottom: 18px; }
.about-admin-member { padding: 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--bg-solid); }
.about-admin-member-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.about-admin-member-head strong { color: var(--primary-dark); }
.about-admin-member .row2 { margin-top: 4px; }
.about-admin-member label { margin-bottom: 0; }
#about-add-member:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.about-page { max-width: 1120px; padding-top: 16px; padding-bottom: 48px; }
.about-breadcrumb { display: flex; align-items: center; gap: 9px; margin: 0 0 14px; color: var(--muted); font-size: 14px; }
.about-breadcrumb a { font-weight: 700; }
.about-hero { position: relative; isolation: isolate; overflow: hidden; padding: clamp(28px, 6vw, 58px); border: 1px solid #d5e4fb; border-radius: 28px; background: linear-gradient(130deg, #edf4ff, #fff 68%, #f4eeff); box-shadow: var(--shadow-sm); }
.about-hero > * { position: relative; z-index: 1; }
.about-eyebrow { display: inline-block; color: var(--primary-dark); font-size: 13px; font-weight: 800; }
.about-hero h1 { margin: 8px 0 12px; font-size: clamp(2rem, 5vw, 3.2rem); }
.about-lead { max-width: 720px; color: var(--text-soft); font-size: clamp(1rem, 2vw, 1.2rem); line-height: 2; }
.about-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.about-orbit { position: absolute; z-index: 0; left: 5%; top: 14%; width: clamp(120px, 22vw, 230px); aspect-ratio: 1; display: grid; place-items: center; border: 1px dashed rgba(91,108,255,.28); border-radius: 50%; opacity: .78; }
.about-orbit span { position: absolute; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 18px; background: var(--card); box-shadow: var(--shadow); font-size: 27px; }
.about-orbit span:nth-child(1) { top: -12px; right: 22%; }
.about-orbit span:nth-child(2) { bottom: 7%; right: -13px; }
.about-orbit span:nth-child(3) { bottom: 12%; left: -10px; }
.about-mission { display: grid; grid-template-columns: auto 1fr; align-items: start; gap: 16px; margin: 20px 0 34px; }
.about-section-icon { width: 54px; height: 54px; display: grid; place-items: center; border-radius: 16px; background: var(--primary-light); font-size: 27px; }
.about-mission h2, .about-section-head h2, .about-bottom h2 { margin: 3px 0 8px; }
.about-mission p, .about-bottom p { color: var(--text-soft); line-height: 2; }
.about-team { margin: 28px 0 36px; }
.about-section-head { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 14px; }
.about-section-head h2 { margin-bottom: 0; }
.about-section-head p { color: var(--muted); margin-bottom: 5px; }
.about-team-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(195px, 1fr)); gap: 14px; }
.about-member { min-width: 0; border-top: 4px solid var(--primary); }
.about-member:nth-child(5n+2) { border-top-color: var(--secondary); }
.about-member:nth-child(5n+3) { border-top-color: var(--success); }
.about-member:nth-child(5n+4) { border-top-color: var(--warn); }
.about-member:nth-child(5n+5) { border-top-color: var(--info); }
.about-member-top { display: flex; justify-content: space-between; align-items: center; color: var(--primary-dark); }
.about-member-number { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; background: var(--primary-light); font-weight: 800; }
.about-member-symbol { font-size: 24px; opacity: .65; }
.about-member h3 { margin: 12px 0 8px; font-size: 18px; }
.about-role-list { margin: 0; padding-right: 19px; color: var(--text-soft); }
.about-role-list li { margin: 4px 0; line-height: 1.8; }
.about-bottom { display: flex; align-items: center; justify-content: space-between; gap: 18px; background: linear-gradient(120deg, var(--primary-light), var(--card)); }
.about-bottom h2 { display: block; border: 0; padding: 0; }
.about-bottom p { margin: 0; }

:where(a, button, input, textarea, select):focus-visible { outline: 3px solid var(--info); outline-offset: 3px; }
@media (max-width: 860px) {
  .dashboard-hero { grid-template-columns: 1fr; }
  .dashboard-hero-actions { max-width: none; }
  .admin-about-layout { grid-template-columns: 1fr; }
  .admin-about-intro { position: static; }
  .about-orbit { opacity: .25; left: -2%; }
}
@media (max-width: 600px) {
  .admin-console-head, .about-section-head, .about-bottom { align-items: flex-start; flex-direction: column; }
  .admin-console-head .btn { align-self: flex-start; }
  .admin-tabs { margin-inline: -5px; }
  .admin-tabs a { padding: 8px 12px; font-size: 13px; }
  .dashboard-hero-actions { display: grid; grid-template-columns: 1fr; width: 100%; }
  .dashboard-hero-actions .btn { width: 100%; }
  .about-hero { padding: 27px 20px; }
  .about-orbit { display: none; }
  .about-mission { grid-template-columns: 1fr; }
  .about-team-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .about-member { padding: 14px; }
  .about-member h3 { font-size: 16px; }
  .about-role-list { font-size: 13px; }
}
@media (max-width: 390px) {
  .about-team-grid { grid-template-columns: 1fr; }
  .dashboard-hero { padding: 20px 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* پخش‌کنندهٔ درس و گزارش مستقیم خرابی برای مدیریت */
.kid-lesson .lesson-hearbox {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 14px;
}
.lesson-hear-content { min-width: 0; }
.lesson-hearbox .lesson-native-player { display: block; width: 100%; max-width: 100%; margin: 8px 0; }
.lesson-audio-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; margin-top: 8px; }
.lesson-audio-controls .lesson-hear { min-height: 42px; font-weight: 800; }
.lesson-audio-status { min-height: 1.4em; margin: 7px 0 0; color: var(--text-soft, #637083); font-size: 13px; }
.audio-report-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  min-height: 40px; padding: 8px 12px; border: 1px solid #d38a48; border-radius: 11px;
  background: #fff7ed; color: #7c3f10; font: inherit; font-size: 13px; font-weight: 800;
  line-height: 1.3; cursor: pointer; transition: background-color .18s ease, transform .18s ease;
}
.audio-report-btn:hover { background: #ffedd5; transform: translateY(-1px); }
.audio-report-btn:disabled { cursor: wait; opacity: .72; transform: none; }
.audio-report-btn.is-reported { border-color: #138a57; background: #e9f8ef; color: #11653f; }
.audio-report-compact { min-width: 32px; min-height: 32px; padding: 4px 7px; border-radius: 9px; font-size: 14px; vertical-align: middle; }
.lesson-body .fa-hear-wrap { vertical-align: middle; }

/* چیدمان انتخاب قالب در مدیریت */
.admin-skin-settings { margin-top: 18px; }
.admin-skin-settings h3 { margin: 0; }
.admin-console .admin-skin-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.admin-console .admin-skin-card { cursor: pointer; min-width: 0; }
.admin-console .admin-skin-card.is-disabled { opacity: .68; border-style: dashed; }
.admin-console .admin-skin-card .admin-skin-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 9px; }
.admin-console .admin-skin-card .sw { flex: 1 1 auto; min-width: 0; }
.admin-console .admin-skin-card .admin-skin-enabled { flex: 0 0 22px; width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--primary); }
.admin-console .admin-skin-card .admin-skin-state { margin-inline-start: 4px; font-weight: 800; }
.admin-skin-options { display: grid; grid-template-columns: minmax(220px, .8fr) minmax(260px, 1.2fr); align-items: end; gap: 14px; margin: 18px 0; }
.admin-skin-options > label { margin: 0; }
.admin-skin-seasonal { display: flex; align-items: center; gap: 9px; }
.admin-skin-seasonal input[type="hidden"] { display: none; }
.admin-skin-seasonal input[type="checkbox"] { flex: 0 0 auto; width: 18px; height: 18px; margin: 0; accent-color: var(--primary); }
@media (max-width: 620px) {
  .kid-lesson .lesson-hearbox { grid-template-columns: 1fr; }
  .kid-lesson .lesson-hearbox .hear-owl { width: 44px !important; height: 44px !important; }
  .admin-skin-options { grid-template-columns: 1fr; align-items: start; }
  .lesson-audio-controls { align-items: stretch; }
  .lesson-audio-controls .lesson-hear, .lesson-audio-controls > .audio-report-btn { flex: 1 1 100%; }
}
.lesson-title-audio-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 4px 0 12px; }
.kid-lesson .lesson-body .fa-hear-wrap .fa-hear,
.kid-lesson .lesson-body .fa-hear-wrap .audio-report-btn { margin: 0; }

/* ================= 5.41.0: منوی همبرگری، تصویر اعضا و صفحهٔ معرفی ================= */
.nav-section { display: contents; }
.nav-section-title { display: none; }

/* ---------- ۵٫۴۹٫۱۲: منوی گروهی با زیرمنو (دسکتاپ) ---------- */
.nav-group { position: relative; display: inline-flex; }
.nav-group-toggle {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 13px; border-radius: 10px; border: 1px solid transparent;
  background: transparent; color: var(--text-soft); font: inherit; font-weight: 500;
  cursor: pointer; transition: background .18s, color .18s, border-color .18s;
  white-space: nowrap;
}
.nav-group-toggle:hover { background: var(--primary-light); color: var(--primary-dark); }
.nav-group.open .nav-group-toggle { background: var(--primary-light); color: var(--primary-dark); font-weight: 700; }
.nav-caret {
  width: 7px; height: 7px; margin-top: -4px; flex: 0 0 auto;
  border: solid currentColor; border-width: 0 2px 2px 0;
  transform: rotate(45deg); transition: transform .18s;
}
.nav-group.open .nav-caret { transform: rotate(225deg); margin-top: 2px; }
.nav-menu {
  display: none; position: absolute; top: calc(100% + 10px); inset-inline-start: 0;
  min-width: 216px; z-index: 340; padding: 8px;
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 18px 48px rgba(15, 23, 42, .22);
}
.nav-group.open .nav-menu { display: block; animation: navMenuDrop .15s ease-out; }
/* ۵٫۴۹٫۱۷: پل نامرئی روی شکاف ۱۰ پیکسلی بین دکمه و منو؛ بدون آن، ماوس در
   فاصله «خارج از گروه» می‌شد و منو پیش از رسیدن به گزینه‌ها بسته می‌شد. */
.nav-menu::before { content: ''; position: absolute; top: -12px; inset-inline-start: 0; width: 100%; height: 12px; }
@keyframes navMenuDrop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.nav-menu a {
  display: flex; align-items: center; gap: 8px; padding: 9px 12px;
  border-radius: 10px; color: var(--text); font-weight: 600; white-space: nowrap;
}
.nav-menu a:hover { background: var(--primary-light); color: var(--primary-dark); text-decoration: none; transform: none; }
.nav-menu a.active { background: var(--primary-light); color: var(--primary-dark); }
.nav-menu a.logout { color: var(--danger); }
.nav-menu a.logout:hover { background: var(--danger-light); color: var(--danger); }
/* خنثی‌سازی رنگِ قالب‌ها داخل منوی بازشده: پس‌زمینهٔ منو همیشه --card است،
   پس متن باید رنگِ عادی صفحه باشد — نه سفیدِ نوارهای گرادینتی قالب‌ها */
html[data-skin] .topbar .nav .nav-menu a { color: var(--text); background: transparent; }
html[data-skin] .topbar .nav .nav-menu a:hover,
html[data-skin] .topbar .nav .nav-menu a.active { background: var(--primary-light); color: var(--primary-dark); }
html[data-skin] .topbar .nav .nav-menu a.logout { color: var(--danger); background: transparent; }
html[data-skin] .topbar .nav .nav-menu a.logout:hover { background: var(--danger-light); }
.nav-group-account .nav-group-toggle { font-weight: 700; }
.nav-group-account .nav-avatar { margin-left: 2px; }
.nav-toggle {
  display: none; align-items: center; justify-content: center; flex-direction: column; gap: 5px;
  width: 44px; height: 44px; padding: 9px; border: 1px solid var(--border);
  border-radius: 13px; background: var(--card); color: var(--text); cursor: pointer;
  box-shadow: var(--shadow-sm); transition: background .18s, border-color .18s, transform .18s;
}
.nav-toggle:hover { background: var(--primary-light); border-color: var(--primary); transform: translateY(-1px); }
.nav-toggle span { display: block; width: 21px; height: 2.5px; border-radius: 9px; background: var(--text); transition: transform .18s, opacity .18s; }
.topbar.nav-open .nav-toggle span:nth-child(1) { transform: translateY(7.5px) rotate(45deg); }
.topbar.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
.topbar.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-7.5px) rotate(-45deg); }
@media (max-width: 1120px) {
  .topbar .row { position: relative; flex-wrap: nowrap; }
  .topbar-tools { margin-inline-start: auto; flex: 0 0 auto; }
  .nav-toggle { display: inline-flex; }
  .topbar .nav {
    display: none; position: absolute; z-index: 2; top: calc(100% + 8px);
    inset-inline: 12px; max-height: min(78vh, 690px); overflow-y: auto; overscroll-behavior: contain;
    flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 10px;
    padding: 14px; border: 1px solid var(--border); border-radius: 20px;
    background: var(--card); box-shadow: 0 18px 48px rgba(15, 23, 42, .22);
  }
  .topbar.nav-open .nav { display: flex; }
  .nav-section {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px;
    padding: 10px; border: 1px solid var(--border); border-radius: 15px;
    background: var(--bg-solid, var(--card));
  }
  /* گروه‌های منو در کشوی موبایل: آکاردئون با عنوانِ بزرگ */
  .nav-group { display: block; padding: 8px 10px; border: 1px solid var(--border);
    border-radius: 15px; background: var(--bg-solid, var(--card)); }
  .nav-group-toggle { width: 100%; justify-content: space-between; padding: 8px 6px;
    color: var(--text); font-weight: 800; font-size: .95rem; background: transparent; }
  .nav-group.collapsed .nav-caret { transform: rotate(-135deg); margin-top: 2px; }
  .nav-group .nav-menu { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px;
    position: static; min-width: 0; padding: 8px 2px 2px; margin-top: 4px;
    background: transparent; border: 0; border-top: 1px dashed var(--border);
    border-radius: 0; box-shadow: none; animation: none; }
  .nav-group.collapsed .nav-menu { display: none; }
  .nav-group.open .nav-menu { display: grid; }
  .nav-group .nav-menu a { min-height: 42px; border: 1px solid transparent; font-size: .92rem; }
  .nav-section-title {
    display: block; grid-column: 1 / -1; padding: 0 5px 6px;
    color: var(--muted); font-size: .78rem; font-weight: 900;
  }
  .topbar .nav a {
    display: flex; align-items: center; min-height: 42px; padding: 8px 11px;
    border: 1px solid transparent; border-radius: 11px; background: var(--card);
    color: var(--text-soft); font-size: .92rem; font-weight: 700; line-height: 1.5;
  }
  .topbar .nav a:hover { transform: none; border-color: var(--border); background: var(--primary-light); }
  .topbar .nav a.active { border-color: var(--primary); background: var(--primary-light); color: var(--primary-dark); }
  .topbar .nav a.logout { color: var(--danger); }
  .topbar .nav .nav-install-btn { width: 100%; min-height: 45px; justify-content: center; }
}
@media (max-width: 480px) {
  .topbar .row { gap: 7px; }
  .brand { font-size: 18px; }
  .brand img { width: 36px; height: 36px; }
  .topbar-tools { gap: 5px; }
  .topbar-tools .skin-toggle, .topbar-tools .theme-toggle { width: 38px; height: 38px; }
  .nav-toggle { width: 40px; height: 40px; }
  .topbar .nav { inset-inline: 8px; padding: 10px; }
  .nav-section { grid-template-columns: 1fr; }
  .nav-section-title { padding-bottom: 2px; }
}

.about-member { overflow: hidden; }
.about-member-photo {
  display: grid; place-items: center; width: min(148px, 74%); aspect-ratio: 1;
  margin: 8px auto 14px; overflow: hidden; border: 5px solid var(--card);
  border-radius: 50%; background: linear-gradient(145deg, var(--primary-light), var(--secondary-light, #e0f2fe));
  box-shadow: 0 0 0 2px var(--border), 0 8px 20px rgba(15, 23, 42, .12);
}
.about-member-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.about-member-placeholder { display: grid; place-items: center; width: 100%; height: 100%; font-size: clamp(40px, 8vw, 68px); }
.about-member h3 { text-align: center; }
.about-admin-photo-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 78px auto; align-items: center; gap: 12px;
  margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border);
}
.about-admin-photo-row > label { min-width: 0; margin: 0; }
.about-admin-photo-row input[type="file"] { width: 100%; min-width: 0; padding: 8px; }
.about-admin-photo-preview {
  display: grid; place-items: center; width: 72px; height: 72px; overflow: hidden;
  border: 2px solid var(--border); border-radius: 50%; background: var(--primary-light); font-size: 28px;
}
.about-admin-photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.about-photo-remove { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; color: var(--danger); font-size: .84rem; }
.about-photo-remove input[type="checkbox"] { flex: 0 0 auto; width: 18px; height: 18px; margin: 0; accent-color: var(--danger); }
@media (max-width: 620px) {
  .about-admin-photo-row { grid-template-columns: minmax(0, 1fr) 64px; }
  .about-admin-photo-preview { width: 60px; height: 60px; grid-column: 2; grid-row: 1; }
  .about-admin-photo-row > label { grid-column: 1; grid-row: 1; }
  .about-photo-remove { grid-column: 1 / -1; }
}
[data-theme="dark"] .about-member-photo { border-color: #241e18; box-shadow: 0 0 0 2px #6b5428, 0 8px 20px rgba(0, 0, 0, .35); }
[data-theme="dark"] .about-admin-photo-preview { background: #3a2e22; border-color: #6b5428; }
[data-theme="dark"] .nav-section { background: #1a1713; border-color: #6b5428; }
[data-theme="dark"] .topbar .nav { background: #221c16; border-color: #6b5428; }
[data-theme="dark"] .topbar .nav a { background: #2c241c; color: #f6efe4; }
[data-theme="dark"] .topbar .nav a.active, [data-theme="dark"] .topbar .nav a:hover { background: #3a2e22; color: #ffd27a; }
[data-theme="dark"] .nav-toggle { background: #2c241c; border-color: #6b5428; }
[data-theme="dark"] .nav-toggle span { background: #fff8e8; }

/* ============================================================
   ۵٫۴۹٫۱۷: بازطراحی صفحهٔ پروفایل (pf-*)
   ============================================================ */
.pf-page { display: grid; gap: 16px; }
.pf-hero { display: flex; gap: 18px; align-items: center; flex-wrap: wrap;
  background: linear-gradient(120deg, var(--primary-light) 0%, var(--card) 55%); }
.pf-hero-side { position: relative; flex: 0 0 auto; }
.pf-avatar { width: 110px; height: 110px; border-radius: 50%; object-fit: cover;
  border: 4px solid var(--card); box-shadow: var(--shadow); }
.pf-avatar-edit { position: absolute; bottom: 0; inset-inline-end: 0; width: 34px; height: 34px;
  border-radius: 50%; border: 1px solid var(--border); background: var(--card);
  box-shadow: var(--shadow-sm); font-size: 15px; padding: 0; display: flex;
  align-items: center; justify-content: center; cursor: pointer; }
.pf-avatar-edit:hover { transform: scale(1.08); }
.pf-hero-main { flex: 1 1 240px; min-width: 0; }
.pf-name { margin: 0 0 8px; font-size: 1.5rem; color: var(--text); }
.pf-chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 12px; }
.pf-chips .chip { margin: 0; }
.muted-chip { background: transparent; border-color: var(--border); color: var(--text-soft); }
.pf-level-row { display: flex; justify-content: space-between; gap: 10px; font-size: .9rem; margin-bottom: 6px; }
.pf-bar { height: 10px; border-radius: 999px; background: var(--border); overflow: hidden; }
.pf-bar span { display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  transition: width .4s ease; min-width: 4px; }
.pf-complete-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.pf-complete-head h2 { margin: 0; }
.pf-complete .pf-bar { margin-bottom: 10px; }
.pf-stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.pf-stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 12px; text-align: center; box-shadow: var(--shadow-sm); }
.pf-stat strong { display: block; font-size: 1.35rem; color: var(--primary-dark); margin-bottom: 4px; }
.pf-stat span { font-size: .8rem; color: var(--text-soft); }
.pf-activity { display: grid; gap: 10px; }
.pf-activity-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--card-hover); }
.pf-activity-pct { flex: 0 0 58px; text-align: center; font-weight: 800; font-size: .95rem;
  padding: 8px 4px; border-radius: 10px; }
.pf-activity-pct.good { background: var(--success-light); color: var(--success); }
.pf-activity-pct.mid { background: var(--warn-light); color: var(--warn); }
.pf-activity-pct.low { background: var(--danger-light); color: var(--danger); }
.pf-activity-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pf-activity-body strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-activity-row time { flex: 0 0 auto; font-size: .75rem; }
.pf-badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
.pf-badge { text-align: center; padding: 14px 10px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--card-hover); display: grid; gap: 4px; }
.pf-badge-ico { font-size: 2rem; }
.pf-badge-name { font-weight: 700; font-size: .85rem; }
.pf-badge small { color: var(--text-soft); font-size: .72rem; }
.pf-badge.locked { opacity: .55; filter: grayscale(.8); }
.pf-links { display: flex; gap: 10px; flex-wrap: wrap; }
.pf-links .chip { text-decoration: none; padding: 10px 16px; font-size: .95rem; }
.pf-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 18px; }
.pf-tab { border: 1px solid var(--border); background: var(--card-hover); color: var(--text-soft);
  border-radius: 999px; padding: 9px 18px; font: inherit; font-weight: 700; cursor: pointer;
  transition: all .18s; }
.pf-tab:hover { border-color: var(--primary); color: var(--primary-dark); }
.pf-tab.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.pf-panel { display: none; }
.pf-panel.on { display: block; animation: navMenuDrop .18s ease-out; }
.pf-avatar-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 14px; }
.pf-settings .btn.primary[type="submit"] { margin-top: 18px; }
[data-theme="dark"] .pf-hero { background: linear-gradient(120deg, var(--primary-light) 0%, var(--card) 60%); }
[data-theme="dark"] .pf-tab.on { color: #0f1419; background: var(--primary); border-color: var(--primary); }
[data-theme="hc"] .pf-bar { border: 1px solid #fff; }
@media (max-width: 640px) {
  .pf-hero { flex-direction: column; text-align: center; }
  .pf-chips { justify-content: center; }
  .pf-activity-row { flex-wrap: wrap; }
}

/* ============================================================
   ۵٫۴۹٫۱۸: بازطراحی داشبورد دانش‌آموز/معلم/والدین/مدیر
   یک لایهٔ طراحی واحد روی کلاس‌های موجود هر چهار داشبورد.
   ============================================================ */
.dashboard-page { display: grid; gap: 18px; }

/* سربرگ قهرمانی: گرادیان لایه‌ای + بافت نقطه‌ای */
.dashboard-hero {
  display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap;
  padding: 26px 28px; border-radius: var(--radius-lg); border: 0;
  background:
    radial-gradient(circle at 88% 18%, rgba(255, 255, 255, .5) 0, transparent 42%),
    linear-gradient(120deg, var(--primary-light) 0%, var(--card) 62%);
  box-shadow: var(--shadow);
  position: relative; overflow: hidden;
}
.dashboard-hero::before {
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .35;
  background-image: radial-gradient(var(--border) 1.2px, transparent 1.2px);
  background-size: 18px 18px;
}
.dashboard-hero-student { background:
    radial-gradient(circle at 88% 18%, rgba(255, 214, 102, .35) 0, transparent 45%),
    linear-gradient(120deg, #fff3d6 0%, var(--card) 60%); }
.dashboard-hero-teacher { background:
    radial-gradient(circle at 88% 18%, rgba(16, 185, 129, .16) 0, transparent 45%),
    linear-gradient(120deg, var(--success-light) 0%, var(--card) 60%); }
.dashboard-hero-parent { background:
    radial-gradient(circle at 88% 18%, rgba(255, 107, 157, .14) 0, transparent 45%),
    linear-gradient(120deg, var(--secondary-light) 0%, var(--card) 60%); }
.dashboard-hero-admin { background:
    radial-gradient(circle at 88% 18%, rgba(91, 108, 255, .18) 0, transparent 45%),
    linear-gradient(120deg, var(--primary-light) 0%, var(--card) 60%); }
.dashboard-kicker {
  display: inline-block; font-size: .78rem; font-weight: 800; color: var(--primary-dark);
  background: var(--card); border: 1px solid var(--border); border-radius: 999px;
  padding: 4px 12px; margin-bottom: 8px;
}
.dashboard-hero h1 { margin: 4px 0 6px; font-size: 1.55rem; }
.dashboard-hero p { margin: 0; color: var(--text-soft); }
.dashboard-hero-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.dashboard-hero-actions .btn { white-space: nowrap; }

/* کاشی‌های آمار: آیکون شناور + نوار رنگی بالا */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); gap: 12px; }
.stat-card {
  display: grid; gap: 4px; text-align: center; padding: 20px 12px 16px;
  border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--card); box-shadow: var(--shadow-sm);
  transition: transform .18s, box-shadow .18s; position: relative; overflow: hidden;
}
.stat-card::before { content: ''; position: absolute; top: 0; inset-inline: 0; height: 4px; background: var(--primary); }
.stat-card.c2::before { background: var(--secondary); }
.stat-card.c3::before { background: var(--success); }
.stat-card.c4::before { background: var(--warn); }
.stat-card.c5::before { background: var(--info); }
.stat-card.c6::before { background: #a855f7; }
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.stat-card .sicon {
  width: 42px; height: 42px; margin: 0 auto 6px; display: flex; align-items: center; justify-content: center;
  font-size: 22px; border-radius: 14px; background: var(--primary-light);
}
.stat-card strong { font-size: 1.3rem; color: var(--text); }
.stat-card span { font-size: .78rem; color: var(--text-soft); }

/* دعوت به اقدام: درخشش مورب */
.cta-card { position: relative; overflow: hidden; border-width: 1px; }
.cta-card::after {
  content: ''; position: absolute; top: -40%; bottom: -40%; width: 90px; inset-inline-start: -120px;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .5), transparent);
  transform: skewX(-18deg); animation: dbxShine 5.5s ease-in-out infinite; pointer-events: none;
}
@keyframes dbxShine { 0%, 60% { inset-inline-start: -140px; } 100% { inset-inline-start: 130%; } }

/* شروع سریع: دکمه‌های قرصی */
.quick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(105px, 1fr)); gap: 10px; }
.quick {
  display: grid; justify-items: center; gap: 6px; padding: 14px 8px; text-decoration: none;
  border-radius: 14px; border: 1px solid var(--border); background: var(--card-hover);
  color: var(--text); font-weight: 700; font-size: .85rem; transition: all .18s;
}
.quick span { font-size: 1.5rem; }
.quick:hover { border-color: var(--primary); background: var(--primary-light); color: var(--primary-dark); transform: translateY(-2px); text-decoration: none; }

/* ردیف‌های فهرست (نیازمند تمرین، کلاس‌ها، فرزندان) */
.topic-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px; margin-bottom: 8px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--card-hover);
}
.topic-row:last-child { margin-bottom: 0; }

/* نمودار میله‌ای آزمون‌های اخیر */
.bars { display: grid; gap: 10px; }
.bar-row { display: flex; align-items: center; gap: 10px; }
.bar-row .bar { flex: 1; height: 12px; background: var(--border); border-radius: 999px; overflow: hidden; }
.bar-row .bar div { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--primary), var(--secondary)); }
.bar-val { min-width: 44px; text-align: center; font-weight: 800; font-size: .85rem; color: var(--primary-dark); }

/* مدال‌های نشان */
.badges { display: flex; flex-wrap: wrap; gap: 10px; }
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; font-size: .82rem; font-weight: 700;
  border-radius: 999px; background: linear-gradient(135deg, #fff7e0, #ffe9b3);
  border: 1px solid #f2d38a; color: #7a5200; box-shadow: var(--shadow-sm);
}
.badge .icon { font-size: 1.05rem; }

/* خط زمانٔ فعالیت‌ها (مدیر/معلم) */
.activity {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-bottom: 8px;
  border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--card-hover);
  position: relative; padding-inline-start: 24px;
}
.activity::before {
  content: ''; position: absolute; inset-inline-start: 12px; top: 50%; width: 8px; height: 8px;
  transform: translateY(-50%); border-radius: 50%; background: var(--primary);
}
.activity small { margin-inline-start: auto; }

/* کارت سطح دانش‌آموز در سربرگ */
.level-card {
  min-width: 210px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow-sm); display: grid; gap: 8px;
}
.level-num { font-weight: 800; color: var(--primary-dark); }
.level-card .progress, .progress.small { height: 10px; background: var(--border); border-radius: 999px; overflow: hidden; }
.level-card .progress div, .progress.small div { height: 100%; background: linear-gradient(90deg, var(--primary), var(--secondary)); border-radius: 999px; }

/* کارت اطلاعات ورود */
.card.creds { border-inline-start: 5px solid var(--warn); background: var(--warn-light); }

/* تم تاریک و پرتضاد */
[data-theme="dark"] .dashboard-hero,
[data-theme="dark"] .dashboard-hero-student,
[data-theme="dark"] .dashboard-hero-teacher,
[data-theme="dark"] .dashboard-hero-parent,
[data-theme="dark"] .dashboard-hero-admin {
  background: linear-gradient(120deg, var(--primary-light) 0%, var(--card) 65%);
}
[data-theme="dark"] .dashboard-kicker { background: var(--card-hover); }
[data-theme="dark"] .badge { background: linear-gradient(135deg, #3a2e10, #4a3a14); border-color: #6b5518; color: #ffd76e; }
[data-theme="hc"] .stat-card::before { background: #fff; }
[data-theme="hc"] .quick:hover { outline: 2px solid #fff; }

@media (max-width: 640px) {
  .dashboard-hero { padding: 20px 18px; flex-direction: column; align-items: flex-start; }
  .level-card { width: 100%; }
}
@media print { .cta-card::after { display: none; } }

/* دکمه‌ها و یادداشتِ پنجرهٔ نصب برنامه */
.install-cta-note { margin: 8px 0 0; font-size: .82rem; color: #6b7280; }
.install-now-btn[disabled] { opacity: .55; cursor: wait; }
.install-dl-btn {
  display: inline-block; margin-top: 6px; padding: 8px 14px; border-radius: 10px;
  background: #16a34a; color: #fff; text-decoration: none; font-weight: 700; font-size: .88rem;
}
.install-dl-btn:hover { background: #15803d; color: #fff; }

/* دکمهٔ نصب: همیشه در نوار ابزار بالا دیده می‌شود (نه تهِ منو) */
.topbar-install-btn {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  border: 1px solid rgba(37, 99, 235, .35);
  background: linear-gradient(180deg, #eef4ff, #dbe7ff);
  color: #1d4ed8;
  font-weight: 800;
  font-size: .92rem;
  border-radius: 999px;
  padding: .42rem .85rem;
  cursor: pointer;
  white-space: nowrap;
  line-height: 1.2;
}
.topbar-install-btn.ready { box-shadow: 0 0 0 3px rgba(37, 99, 235, .18); }
.topbar-install-btn:hover { background: linear-gradient(180deg, #e3edff, #cfe0ff); }
@media (max-width: 560px) {
  .topbar-install-btn { padding: .42rem .62rem; font-size: 1.08rem; }
  .topbar-install-btn .install-label { display: none; }
}

/* اطلاعات ورود دانش‌آموز در داشبورد والدین */
.login-info {
  margin-top: .65rem;
  padding: .65rem .8rem;
  border: 1px dashed rgba(37, 99, 235, .35);
  border-radius: 12px;
  background: rgba(37, 99, 235, .05);
  font-size: .92rem;
}
.login-info strong { display: block; margin-bottom: .35rem; }
.login-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .5rem;
  padding: .18rem 0;
}
.login-info-row code {
  direction: ltr;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: rgba(0, 0, 0, .06);
  border-radius: 8px;
  padding: .12rem .5rem;
  font-size: .95rem;
}
.inline-form { display: inline-block; margin: 0 0 0 .25rem; vertical-align: middle; }

/* ============================================================
   بازطراحی سراسری v5.49.47 — لایهٔ تازه روی سیستم طراحی
   (ناوبری، دکمه‌ها، کارت‌ها، قهرمان داشبوردها، جدول‌ها، فرم‌ها)
   ============================================================ */
:root {
  --bg: linear-gradient(160deg, #eef2fb 0%, #e7edf9 45%, #f3f1fa 100%);
  --bg-solid: #eef2fb;
  --card: #ffffff;
  --text: #141a2e;
  --text-soft: #41506e;
  --muted: #5d6b86;
  --border: #dde5f2;
  --primary: #4a5ef0;
  --primary-dark: #2f3fc4;
  --primary-light: #e3e7ff;
  --radius: 18px;
  --radius-sm: 12px;
  --radius-lg: 26px;
  --shadow-sm: 0 2px 10px rgba(30, 48, 120, .07);
  --shadow: 0 10px 28px rgba(30, 48, 120, .10);
  --shadow-lg: 0 22px 48px rgba(30, 48, 120, .16);
}

body { background: var(--bg); background-attachment: fixed; color: var(--text); }

/* ---- سربرگ و ناوبری: شیشه‌ای مدرن ---- */
.site-header, header.site-header, .site-header .bar {
  background: rgba(255, 255, 255, .82) !important;
  backdrop-filter: blur(14px) saturate(1.25);
  -webkit-backdrop-filter: blur(14px) saturate(1.25);
  border-bottom: 1px solid rgba(74, 94, 240, .12);
  box-shadow: 0 6px 22px rgba(30, 48, 120, .07);
}
.site-nav a, .nav-links a, .site-header nav a {
  border-radius: 999px !important;
  padding: 8px 14px !important;
  font-weight: 700;
  transition: background .18s ease, color .18s ease, transform .18s ease;
}
.site-nav a:hover, .nav-links a:hover, .site-header nav a:hover {
  background: var(--primary-light);
  color: var(--primary-dark) !important;
  transform: translateY(-1px);
}
.site-nav a.active, .nav-links a.active { background: var(--primary); color: #fff !important; }

/* ---- دکمه‌ها ---- */
.btn {
  border-radius: 14px !important;
  font-weight: 800;
  padding: 11px 20px !important;
  border: 1px solid transparent;
  transition: transform .16s ease, box-shadow .16s ease, filter .16s ease;
  will-change: transform;
}
.btn:hover { transform: translateY(-2px); filter: brightness(1.03); }
.btn:active { transform: translateY(0); }
.btn.primary, .btn.success, .btn.secondary, .btn.warn, .btn.danger {
  color: #fff !important;
  box-shadow: 0 8px 18px rgba(30, 48, 120, .18);
}
.btn.primary { background: linear-gradient(135deg, #4a5ef0 0%, #6f4ef0 100%) !important; }
.btn.success { background: linear-gradient(135deg, #0e9f6e 0%, #067a55 100%) !important; }
.btn.secondary { background: linear-gradient(135deg, #0ea5e9 0%, #2563eb 100%) !important; }
.btn.warn, .btn.warning { background: linear-gradient(135deg, #f59e0b 0%, #ea580c 100%) !important; }
.btn.danger { background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%) !important; }
.btn.ghost {
  background: var(--card) !important;
  color: var(--primary-dark) !important;
  border: 1.5px solid var(--border) !important;
  box-shadow: var(--shadow-sm);
}
.btn.ghost:hover { border-color: var(--primary) !important; background: var(--primary-light) !important; }
.btn.small { padding: 7px 13px !important; font-size: .82rem; border-radius: 11px !important; }

/* ---- کارت‌ها ---- */
.card, .stat-card, .child-card, .creds {
  background: var(--card);
  border-radius: var(--radius) !important;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease;
}
.card:hover, .child-card:hover { box-shadow: var(--shadow); }
.card h2, .card h3 { letter-spacing: -.01em; }
.card > h2:first-child { margin-top: 2px; }

/* ---- قهرمان داشبوردها ---- */
.dashboard-hero {
  position: relative;
  border-radius: var(--radius-lg) !important;
  background:
    radial-gradient(720px 280px at 92% -20%, rgba(255, 183, 3, .20), transparent 60%),
    radial-gradient(560px 260px at 2% 120%, rgba(74, 94, 240, .22), transparent 62%),
    linear-gradient(135deg, #24306e 0%, #3b4fd8 58%, #6f4ef0 100%) !important;
  color: #fff !important;
  box-shadow: 0 22px 46px rgba(36, 48, 110, .32);
  overflow: hidden;
}
.dashboard-hero::after {
  content: "";
  position: absolute;
  inset-inline-end: -60px;
  top: -70px;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, .16), transparent 70%);
  pointer-events: none;
}
.dashboard-hero h1 { color: #fff !important; font-size: 1.72rem; letter-spacing: -.02em; }
.dashboard-hero p, .dashboard-hero .muted { color: rgba(255, 255, 255, .85) !important; }
.dashboard-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, .16) !important;
  border: 1px solid rgba(255, 255, 255, .28);
  color: #fff !important;
  padding: 6px 13px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .02em;
}
.dashboard-hero-actions .btn { backdrop-filter: blur(6px); }
.dashboard-hero-actions .btn.primary { background: #fff !important; color: var(--primary-dark) !important; box-shadow: 0 10px 24px rgba(0, 0, 0, .18); }
.dashboard-hero-actions .btn.ghost { background: rgba(255, 255, 255, .12) !important; color: #fff !important; border-color: rgba(255, 255, 255, .35) !important; }
.dashboard-hero-actions .btn.ghost:hover { background: rgba(255, 255, 255, .22) !important; }

/* ---- کارت‌های آمار ---- */
.stat-card { text-align: center; padding: 18px 12px; border-radius: var(--radius) !important; }
.stat-card .sicon {
  width: 46px; height: 46px; margin: 0 auto 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.35rem;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary-light), #fff);
  box-shadow: inset 0 0 0 1px rgba(74, 94, 240, .14);
}
.stat-card strong { display: block; font-size: 1.55rem; letter-spacing: -.02em; }
.stat-card span { color: var(--muted); font-size: .82rem; font-weight: 700; }
.stat-card.c1 { background: linear-gradient(180deg, #fff, #f2f5ff); }
.stat-card.c2 { background: linear-gradient(180deg, #fff, #f0fbf6); }
.stat-card.c3 { background: linear-gradient(180deg, #fff, #fff7ec); }
.stat-card.c4 { background: linear-gradient(180deg, #fff, #fdeff5); }
.stat-card.c5 { background: linear-gradient(180deg, #fff, #eefaff); }
.stat-card.c6 { background: linear-gradient(180deg, #fff, #f4f0ff); }
.mini-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: 8px; }
.mini-stats > div {
  background: linear-gradient(180deg, #f8faff, #fff);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 9px 6px;
  text-align: center;
}
.mini-stats strong { display: block; font-size: 1.12rem; color: var(--primary-dark); }
.mini-stats span { font-size: .72rem; color: var(--muted); font-weight: 700; }

/* ---- دسترسی سریع ---- */
.quick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.quick {
  display: flex; align-items: center; gap: 11px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 15px;
  padding: 14px 15px;
  font-weight: 800;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.quick:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--primary); color: var(--primary-dark); }
.quick span {
  width: 40px; height: 40px; flex: 0 0 40px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.22rem;
  background: var(--primary-light);
  border-radius: 12px;
}

/* ---- برچسب‌ها ---- */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: .76rem;
  font-weight: 800;
  border: 1px solid transparent;
}
.chip.success { background: var(--success-light); color: var(--success); border-color: rgba(4, 120, 87, .18); }
.chip.warn { background: var(--warn-light); color: var(--warn); border-color: rgba(180, 83, 9, .18); }
.chip.primary, .chip.info { background: var(--primary-light); color: var(--primary-dark); border-color: rgba(74, 94, 240, .18); }
.chip.err, .chip.danger { background: var(--danger-light); color: var(--danger); border-color: rgba(200, 30, 30, .18); }

/* ---- جدول‌ها ---- */
.table-wrap table { border-radius: 14px; overflow: hidden; }
.table-wrap thead th {
  background: linear-gradient(135deg, #eef1ff, #e6ecff);
  color: var(--primary-dark);
  font-weight: 800;
  border-bottom: 2px solid var(--primary-light);
}
.table-wrap tbody tr { transition: background .14s ease; }
.table-wrap tbody tr:hover { background: #f6f8ff; }
.table-wrap td, .table-wrap th { padding: 10px 12px; }

/* ---- فرم‌ها ---- */
input[type="text"], input[type="number"], input[type="password"], input[type="email"],
input[type="date"], input[type="time"], input[type="search"], select, textarea {
  border: 1.5px solid var(--border) !important;
  border-radius: 12px !important;
  padding: 10px 13px !important;
  background: #fff !important;
  font-family: inherit;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none !important;
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 4px rgba(74, 94, 240, .16) !important;
}
label { font-weight: 800; color: var(--text-soft); font-size: .88rem; }

/* ---- هشدارها ---- */
.alert {
  border-radius: 14px;
  border: 1px solid var(--border);
  border-inline-start-width: 5px;
  padding: 13px 16px;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}
.alert.ok { background: var(--success-light); border-inline-start-color: var(--success); color: var(--success); }
.alert.err { background: var(--danger-light); border-inline-start-color: var(--danger); color: var(--danger); }
.alert.info { background: var(--info-light); border-inline-start-color: var(--info); color: var(--info); }

/* ---- تایپوگرافی ---- */
h1 { letter-spacing: -.02em; }
h2 { letter-spacing: -.015em; }
.muted { color: var(--muted); }
.topic-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 9px 4px;
  border-bottom: 1px dashed var(--border);
}
.topic-row:last-child { border-bottom: 0; }

/* ---- نوار پیشرفت ---- */
.progress {
  height: 10px;
  background: var(--primary-light);
  border-radius: 999px;
  overflow: hidden;
}
.progress > div {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), #7c5cf0);
  transition: width .5s ease;
}
.progress.small { height: 7px; }

/* ---- دسترس‌پذیری ---- */
:focus-visible { outline: 3px solid rgba(74, 94, 240, .55); outline-offset: 2px; border-radius: 6px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---- سربرگِ صفحهٔ آموزش (kid-hero) ---- */
.kid-hero {
  position: relative;
  border-radius: 22px;
  padding: 26px 24px;
  margin: 6px 0 22px;
  background:
    radial-gradient(560px 220px at 92% -20%, rgba(255, 183, 3, .20), transparent 60%),
    linear-gradient(140deg, #24306e 0%, #4a5ef0 100%);
  color: #fff;
  box-shadow: 0 18px 40px rgba(36, 48, 110, .28);
  overflow: hidden;
}
.kid-hero h1 { color: #fff; letter-spacing: -.02em; margin: 8px 0 6px; }
.kid-hero .muted { color: rgba(255, 255, 255, .85); }
.kid-hero-kicker {
  display: inline-flex;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .28);
  font-size: .78rem;
  font-weight: 800;
}
.kid-hero-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.kid-hero-inline {
  background: none;
  box-shadow: none;
  padding: 0;
  margin: -8px 0 16px;
}
.kid-hero-inline .chip { background: var(--card); }

/* ---- نوار اعتماد صفحهٔ اصلی + سربرگِ کنسول مدیریت ---- */
.home-trust {
  display: flex; flex-wrap: wrap; gap: 8px 16px;
  list-style: none;
  margin-top: 14px;
  color: var(--text-soft);
  font-size: .84rem;
  font-weight: 700;
}
.admin-hero, .admin-console > header, .admin-console .admin-head {
  border-radius: var(--radius-lg);
  background:
    radial-gradient(620px 240px at 90% -20%, rgba(255, 183, 3, .18), transparent 60%),
    linear-gradient(135deg, #1f2a66 0%, #3b4fd8 100%) !important;
  color: #fff !important;
  box-shadow: 0 18px 42px rgba(31, 42, 102, .3);
  padding: 24px 26px !important;
}
.admin-hero h1, .admin-console > header h1, .admin-console .admin-head h1 { color: #fff !important; }
.admin-hero p, .admin-console > header p, .admin-console .admin-head p { color: rgba(255, 255, 255, .85) !important; }
.admin-console .card { border-radius: 16px; }

/* ============================================================
   بازطراحی صفحهٔ دستیارها v5.49.48
   مدل‌های فشرده در ستون کناری + چت بزرگ + حالت تمام‌صفحه
   ============================================================ */
.agents-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  margin: 6px 0 12px;
}
.agents-layout {
  display: grid;
  grid-template-columns: minmax(220px, 270px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  margin: 14px 0 22px;
}
.agents-side {
  display: flex; flex-direction: column; gap: 12px;
  position: sticky; top: 78px;
  min-width: 0;
}

/* مدل‌های کوچک */
.agents-page .agent-cards-compact { display: flex; flex-direction: column; gap: 8px; margin: 0; }
.agents-page .agent-cards-compact .agent-card {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  border-width: 1.5px;
  text-align: right;
}
.agents-page .agent-cards-compact .agent-card .aicon {
  font-size: 18px; margin: 0; flex: 0 0 34px;
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-light); border-radius: 10px;
}
.agents-page .agent-card-body { min-width: 0; flex: 1; }
.agents-page .agent-card-body strong { display: block; font-size: .83rem; line-height: 1.5; }
.agents-page .agent-card-body small {
  display: block; font-size: .68rem; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.agents-page .agent-cards-compact .ai-chip { display: none; }
.agents-page .agent-cards-compact .agent-card.current .aicon { background: var(--primary); }
.agents-page .agent-cards-compact .agent-card.current .aicon { filter: none; }
.agents-settings label { margin-top: 6px; }
.agents-settings select { width: 100%; }

/* چت بزرگ */
.agents-chat-col { min-width: 0; }
.chat-shell {
  display: flex; flex-direction: column;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.chat-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap;
  padding: 11px 16px;
  background: linear-gradient(135deg, #eef1ff, #f6f2ff);
  border-bottom: 1px solid var(--border);
}
.chat-head-title { font-size: .95rem; }
.agents-page .chat { border: 0; border-radius: 0; box-shadow: none; background: transparent; }
.agents-page .chat-log {
  height: clamp(430px, calc(100vh - 330px), 760px);
  background: var(--bg-solid);
}
.agents-page .chat-input { padding: 13px 14px; }

/* تمام‌صفحه */
body.fs-lock { overflow: hidden; }
.agents-page.fs .chat-shell {
  position: fixed; inset: 0; z-index: 300;
  height: 100vh; height: 100dvh;
  border: 0; border-radius: 0;
  box-shadow: none;
}
.agents-page.fs .chat { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.agents-page.fs .chat-log { height: auto; flex: 1; }
.agents-page.fs .chat-head { padding: 13px 18px; }
.agents-page.fs .chat-input { padding: 15px 18px calc(15px + env(safe-area-inset-bottom)); }

/* ============================================================
   ریسپانسیو — داشبوردها و همهٔ صفحه‌ها
   ============================================================ */
@media (max-width: 1020px) {
  .agents-layout { grid-template-columns: 1fr; }
  .agents-side { position: static; }
  .agents-page .agent-cards-compact {
    flex-direction: row;
    overflow-x: auto;
    padding: 2px 2px 8px;
    scrollbar-width: thin;
  }
  .agents-page .agent-cards-compact .agent-card { min-width: 190px; flex: 0 0 auto; }
}
@media (max-width: 980px) {
  .dashboard-hero {
    display: flex !important;
    flex-direction: column;
    align-items: flex-start !important;
    gap: 12px;
  }
  .grid2, .row2, .row3 { grid-template-columns: 1fr !important; }
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
  .child-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}
@media (max-width: 640px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .quick-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .mini-stats { grid-template-columns: repeat(2, 1fr); }
  .dashboard-hero-actions { width: 100%; display: flex; flex-wrap: wrap; gap: 8px; }
  .dashboard-hero-actions .btn { flex: 1 1 46%; justify-content: center; }
  .dashboard-hero h1 { font-size: 1.35rem; }
  .topic-row { flex-wrap: wrap; }
  .row, .flex { flex-wrap: wrap; }
  .table-wrap table { min-width: 520px; }
  .home-stats { grid-template-columns: repeat(2, 1fr); }
  .home-hero { grid-template-columns: 1fr; padding: 26px 18px; }
  .kid-hero { padding: 20px 16px; }
  .agents-page .agent-cards-compact .agent-card { min-width: 165px; }
  .agents-page .chat-log { height: 58vh; }
  .chat-input { flex-wrap: wrap; }
  .chat-input input[type="text"] { flex: 1 1 100%; }
  .chat-input .btn { flex: 1 1 100%; justify-content: center; }
  .login-info-row { flex-wrap: wrap; }
  .table-wrap td, .table-wrap th { padding: 8px 9px; font-size: .8rem; }
}

/* ---- تاریخچهٔ گفتگو + عکس + دکمه‌های ریز (v5.49.49) ---- */
.chat-history { padding: 12px 12px 8px; }
.chat-history-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.chat-history-head strong { font-size: .85rem; }
.chat-history-list { display: flex; flex-direction: column; gap: 4px; max-height: 260px; overflow-y: auto; }
.chat-history-item {
  display: flex; align-items: center; gap: 4px;
  border-radius: 10px;
  padding: 2px 2px 2px 6px;
}
.chat-history-item:hover { background: var(--primary-light); }
.chat-history-item.current { background: var(--primary-light); }
.chat-history-open {
  flex: 1; min-width: 0;
  text-align: right;
  background: none; border: 0; cursor: pointer;
  font: inherit; font-size: .78rem; font-weight: 700; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  padding: 6px 2px;
}
.chat-history-del {
  flex: 0 0 22px; width: 22px; height: 22px;
  border: 0; border-radius: 7px;
  background: none; color: var(--muted); cursor: pointer;
  font-size: .68rem;
}
.chat-history-del:hover { background: var(--danger-light); color: var(--danger); }

/* دکمه‌های ریزِ سرِ چت */
.chat-head-actions { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; min-width: 0; }
.chat-head-actions #agent-status { font-size: .72rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
.btn.chat-mini {
  padding: 4px 9px !important;
  font-size: .74rem !important;
  border-radius: 9px !important;
  line-height: 1.7;
}
.chat-head { flex-wrap: nowrap; }
.chat-head-title { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ================= ۵٫۴۹٫۵۰: رفع سرریز افقی داشبورد موبایل =================
   ستون‌های grid صفحهٔ داشبورد با حداقل محتوای فرزندان (مثلاً دکمه‌های nowrap
   سربرگ) عرض می‌گرفتند و کل کارت قهرمانی از لبهٔ چپ صفحه بیرون می‌زد.
   حالا ستون صفحه همیشه به عرض viewport محدود است و فرزندان قابلیت کوچک‌شدن دارند. */
.dashboard-page,
.dashboard-admin,
.dashboard-student,
.dashboard-teacher,
.dashboard-parent { grid-template-columns: minmax(0, 1fr); min-width: 0; max-width: 100%; }
.dashboard-page > *,
.dashboard-page .card,
.dashboard-page .dashboard-hero { min-width: 0; max-width: 100%; box-sizing: border-box; }
.dashboard-hero > div:first-child { min-width: 0; flex: 1 1 260px; }
.dashboard-hero h1 { overflow-wrap: anywhere; }
@media (max-width: 600px) {
  .dashboard-hero { display: grid; grid-template-columns: minmax(0, 1fr); width: 100%; }
  .dashboard-hero-actions { display: grid; grid-template-columns: minmax(0, 1fr); width: 100%; max-width: 100%; }
  .dashboard-hero-actions .btn { width: 100%; min-width: 0; white-space: normal; text-align: center; }
}

/* ================= ۵٫۴۹٫۵۴: راهنمای سایت (دکمهٔ شناور + صفحهٔ گفتگو) ================= */
.guide-fab {
  position: fixed; z-index: 900; bottom: calc(14px + env(safe-area-inset-bottom)); inset-inline-start: 14px;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: 999px; font-size: .78rem; font-weight: 800; line-height: 1.4;
  color: #fff; text-decoration: none; background: var(--primary, #5b6cff);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .18); opacity: .92;
}
.guide-fab:hover, .guide-fab:focus-visible { opacity: 1; }
.guide-page { display: grid; gap: 14px; padding-bottom: 40px; }
.guide-shell { display: flex; flex-direction: column; gap: 10px; padding: 14px; }
.guide-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.guide-chip { cursor: pointer; }
.guide-log { height: 56vh; min-height: 260px; overflow-y: auto; }
.guide-input { display: flex; gap: 8px; }
.guide-input input { flex: 1; min-width: 0; }
@media (max-width: 600px) {
  .guide-log { height: 52vh; }
  .guide-fab { bottom: calc(10px + env(safe-area-inset-bottom)); inset-inline-start: 10px; font-size: .74rem; padding: 6px 10px; }
}

/* ================= ۵٫۴۹٫۵۵: مشاهدهٔ نقش توسط مدیر ================= */
.role-view-banner {
  position: sticky; top: 0; z-index: 950; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px;
  padding: 10px 14px; background: #fff4d6; color: #5b3a00; border-bottom: 2px solid #f5b400; font-size: .86rem;
}
[data-theme="dark"] .role-view-banner { background: #3b2e10; color: #ffe9a8; }
.role-view-banner .rv-text { flex: 1 1 260px; line-height: 1.8; }
.role-view-banner .rv-note { display: block; font-size: .76rem; opacity: .85; }
.role-view-banner .rv-links { display: flex; flex-wrap: wrap; gap: 6px; flex: 2 1 320px; }
.role-view-banner .rv-links a { padding: 3px 9px; border-radius: 999px; background: rgba(255, 255, 255, .7); color: inherit; text-decoration: none; font-weight: 700; font-size: .78rem; }
[data-theme="dark"] .role-view-banner .rv-links a { background: rgba(255, 255, 255, .12); }
.role-view-banner .rv-form { margin: 0; }
.rv-card { display: grid; gap: 12px; }
.rv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.rv-col { border: 1px solid var(--border); border-radius: 14px; padding: 12px; display: grid; gap: 8px; align-content: start; }
.rv-col h3 { margin: 0; font-size: 1rem; }
.rv-form { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.rv-form select { flex: 1 1 160px; min-width: 0; max-width: 100%; }
.rv-pages { margin: 0; padding-inline-start: 18px; color: var(--text-soft); font-size: .8rem; line-height: 1.9; }
.rv-error { color: var(--danger); font-weight: 700; margin: 0; }

/* ---------- v5.49.69: طراحی تازهٔ گفتگو (چت) ---------- */
.chat-shell {
  background: linear-gradient(180deg, var(--card), var(--bg-solid));
}
.chat-head {
  background: linear-gradient(135deg, rgba(99,102,241,.12), rgba(168,85,247,.10));
  backdrop-filter: blur(6px);
}
.chat-head-title { font-weight: 700; }
.agents-page .chat-log {
  padding: 22px clamp(12px, 3vw, 28px);
  background:
    radial-gradient(circle at 12% 0%, rgba(99,102,241,.06), transparent 40%),
    radial-gradient(circle at 88% 100%, rgba(168,85,247,.06), transparent 40%),
    var(--bg-solid);
  scroll-behavior: smooth;
}
.chat-log .chat-msg {
  position: relative;
  max-width: min(78%, 620px);
  margin: 14px 0;
  padding: 12px 16px 22px;
  border-radius: 18px;
  box-shadow: 0 1px 2px rgba(15,23,42,.06), 0 4px 14px rgba(15,23,42,.04);
  font-size: .97rem;
}
.chat-log .chat-msg.bot {
  padding-inline-start: 52px;
  border-color: rgba(99,102,241,.14);
}
.chat-log .chat-msg.bot::before {
  content: '🤖';
  position: absolute; inset-inline-start: 10px; top: 10px;
  width: 30px; height: 30px; line-height: 30px; text-align: center;
  border-radius: 50%;
  background: var(--primary-light, #eef2ff);
  font-size: 16px;
}
.chat-log .chat-msg.user {
  box-shadow: 0 6px 18px rgba(99,102,241,.25);
}
/* زمان پیام */
.chat-log .chat-msg[data-time]::after {
  content: attr(data-time);
  position: absolute; bottom: 4px; inset-inline-end: 12px;
  font-size: 11px; opacity: .6; font-variant-numeric: tabular-nums;
}
.chat-log .chat-msg.user[data-time]::after { color: rgba(255,255,255,.85); opacity: .85; }
.chat-log .chat-msg.bot .msg-tools { margin-top: 10px; gap: 6px; flex-wrap: wrap; }
.chat-log .chat-msg.typing { padding-inline-start: 52px; }
.chat-log .chat-msg.typing::before { content: '🧠'; }
.chat-log .chat-msg.typing .dot { animation-duration: 1s; }
/* ورودی */
.agents-page .chat-input {
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--card);
  border-top: 1px solid var(--border);
}
.agents-page .chat-input input {
  border-radius: 999px;
  padding: 12px 18px;
  border: 1.5px solid var(--border);
  background: var(--bg-solid);
  transition: border-color .2s, box-shadow .2s;
}
.agents-page .chat-input input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(99,102,241,.15);
}
.agents-page .chat-input .btn {
  border-radius: 999px;
  padding-inline: 20px;
  white-space: nowrap;
}
/* پیشنهادهای آماده */
.agents-settings .chips .chip-btn {
  border-radius: 999px;
  transition: transform .15s, background .15s;
}
.agents-settings .chips .chip-btn:hover { transform: translateY(-1px); }
/* حالت موبایل */
@media (max-width: 640px) {
  .chat-log .chat-msg { max-width: 92%; }
  .agents-page .chat-input .btn { padding-inline: 14px; }
}

/* ---------- v5.49.69: صفحهٔ راهنما (بازطراحی) ---------- */
.guide-page { display: flex; flex-direction: column; gap: 18px; }
.guide-hero {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: clamp(18px, 3vw, 28px);
  border-radius: 22px;
  background: linear-gradient(135deg, #5b6cff, #a855f7);
  color: #fff;
  box-shadow: 0 14px 40px rgba(91,108,255,.25);
}
.guide-hero h1 { margin: 6px 0 4px; font-size: clamp(1.3rem, 2.6vw, 1.7rem); color: #fff; }
.guide-hero .muted { color: rgba(255,255,255,.85); margin: 0; }
.guide-kicker {
  display: inline-block; font-size: .78rem; padding: 3px 10px; border-radius: 999px;
  background: rgba(255,255,255,.18);
}
.guide-hero-orb {
  flex: 0 0 auto; width: 74px; height: 74px; border-radius: 50%;
  display: grid; place-items: center; font-size: 36px;
  background: rgba(255,255,255,.16); backdrop-filter: blur(4px);
  animation: guideFloat 3.2s ease-in-out infinite;
}
@keyframes guideFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.guide-features {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}
.guide-feature {
  display: flex; flex-direction: column; gap: 6px;
  padding: 16px; border-radius: 18px; text-decoration: none; color: inherit;
  background: var(--card); border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: transform .18s, border-color .18s, box-shadow .18s;
}
.guide-feature:hover { transform: translateY(-3px); border-color: var(--primary); box-shadow: 0 10px 26px rgba(91,108,255,.18); }
.guide-feature-icon {
  width: 42px; height: 42px; display: grid; place-items: center; font-size: 22px;
  border-radius: 14px; background: var(--primary-light, #eef2ff);
}
.guide-feature small { font-size: .82rem; line-height: 1.6; }
.guide-shell { padding: 16px; border-radius: 22px; }
.guide-starters-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.guide-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.guide-chip { border-radius: 999px; transition: transform .15s; }
.guide-chip:hover { transform: translateY(-1px); }
.guide-log { height: clamp(320px, 50vh, 520px); border-radius: 16px; border: 1px solid var(--border); }
.guide-input { display: flex; gap: 10px; margin-top: 12px; }
.guide-input input {
  flex: 1; border-radius: 999px; padding: 12px 18px;
  border: 1.5px solid var(--border); background: var(--bg-solid);
}
.guide-input input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(99,102,241,.15); }
.guide-input .btn { border-radius: 999px; padding-inline: 20px; }
@media (max-width: 560px) {
  .guide-hero-orb { width: 56px; height: 56px; font-size: 26px; }
  .guide-input { flex-wrap: wrap; }
  .guide-input .btn { flex: 1 1 100%; }
}

/* ---------- v5.49.72: مدیریت مدرسه (مدیر مدرسه) ---------- */
.principal-page { display: flex; flex-direction: column; gap: 16px; padding-bottom: 40px; }
.principal-form {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  align-items: end;
}
.principal-form label, .principal-filter label { display: flex; flex-direction: column; gap: 4px; font-size: .9rem; }
.principal-form input, .principal-form select,
.principal-filter input, .principal-filter select {
  padding: 9px 12px; border-radius: 12px; border: 1.5px solid var(--border); background: var(--bg-solid);
}
.principal-form-actions { grid-column: 1 / -1; }
.principal-filter { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 12px; }
.principal-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.principal-table th, .principal-table td { padding: 10px 8px; border-bottom: 1px solid var(--border); text-align: start; vertical-align: middle; }
.principal-table th { color: var(--muted); font-weight: 600; font-size: .85rem; }

/* v5.49.75: جدول کاربران در موبایل — دکمه‌ها بشکنند و فرم «ویرایش کامل» تمام‌عرض شود */
.user-actions { min-width: 220px; }
.user-actions .btn { margin: 2px 0; }
@media (max-width: 640px) {
  .user-edit-form { grid-template-columns: 1fr !important; width: 100% !important; }
}

/* v5.49.78: منوی موبایل زیر دکمهٔ «راهنما» پنهان نشود */
@media (max-width: 900px) {
  .topbar .nav { padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
}
