/* 🆕 (Update 31 — مسیر E) دستیارِ حرفه‌ایِ رفعِ اشکال — پیشوندهایِ qai- / qa-ai- / qf-ai- */
:root { --qai-violet: #7c3aed; --qai-violet-2: #6d28d9; --qai-violet-bg: #f5f3ff; --qai-violet-border: #ddd6fe; }

/* بنرِ فرمِ ثبتِ سؤال */
.qa-ai-banner { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; margin-bottom: 14px; border-radius: 14px;
    background: linear-gradient(135deg, #f5f3ff, #eef2ff); border: 1px solid var(--qai-violet-border); font-size: 12.5px; line-height: 1.9; }
.qa-ai-banner > i { font-size: 22px; color: var(--qai-violet); margin-top: 2px; }
.qa-ai-banner strong { display: block; color: #4c1d95; font-size: 13px; }
.qa-ai-banner span { color: #4b5563; }

/* کارتِ پاسخِ دستیار (متمایز از پاسخِ معلم) */
.qf-public-answer.ai { border-color: var(--qai-violet-border); background: linear-gradient(180deg, #faf8ff, #fff 60%); }
.qf-public-answer.teacher { border-inline-start: 4px solid #2563eb; }
.qf-ai-avatar { width: 26px; height: 26px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #8b5cf6, #6366f1); color: #fff; font-size: 14px; margin-inline-end: 6px; }
.qf-b-ai { background: var(--qai-violet-bg); color: var(--qai-violet-2); border-color: var(--qai-violet-border); }
.qf-ai-note { margin-top: 10px; padding: 8px 10px; border-radius: 10px; background: var(--qai-violet-bg); color: #5b21b6; font-size: 11.5px; line-height: 1.8; display: flex; gap: 6px; }

/* بنرِ وضعیتِ زنده در صفحه‌ی سؤال */
.qai-banner { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-radius: 14px; margin: 12px 0 16px; font-size: 12.5px; line-height: 1.9; }
.qai-banner strong { display: block; font-size: 13.5px; }
.qai-banner.working { background: var(--qai-violet-bg); border: 1px solid var(--qai-violet-border); color: #4c1d95; }
.qai-banner.teacher { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e3a8a; }
.qai-banner > i { font-size: 24px; }
.qai-dots { display: inline-flex; gap: 4px; }
.qai-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--qai-violet); animation: qai-bounce 1.2s infinite ease-in-out; }
.qai-dots i:nth-child(2) { animation-delay: .15s; }
.qai-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes qai-bounce { 0%, 80%, 100% { transform: scale(.6); opacity: .5; } 40% { transform: scale(1); opacity: 1; } }

/* صفحه‌ی ادمین */
.qai-page { max-width: 1100px; margin: 0 auto; padding: 16px; font-family: 'Vazirmatn', system-ui, sans-serif; color: #111827; }
.qai-hdr { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.qai-hdr h1 { font-size: 20px; font-weight: 800; margin: 0 0 4px; display: flex; gap: 8px; align-items: center; }
.qai-hdr h1 i { color: var(--qai-violet); }
.qai-hdr p { margin: 0; font-size: 12.5px; color: #4b5563; }
.qai-tabs { display: inline-flex; gap: 4px; background: #f6f7fb; border: 1px solid #e5e7eb; border-radius: 12px; padding: 4px; }
.qai-tab { border: none; background: transparent; padding: 8px 14px; border-radius: 9px; font: inherit; font-size: 13px; color: #4b5563; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.qai-tab.on { background: #fff; color: var(--qai-violet); font-weight: 700; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.qai-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 14px; padding: 18px; margin-bottom: 16px; }
.qai-card h2 { font-size: 15px; font-weight: 800; margin: 0 0 12px; }
.qai-card h2 small { font-weight: 400; color: #6b7280; font-size: 12px; }
.qai-denied { text-align: center; color: #4b5563; padding: 40px; }
.qai-alert { padding: 10px 12px; border-radius: 10px; font-size: 12.5px; margin-bottom: 12px; display: flex; gap: 6px; align-items: center; }
.qai-alert.warn { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.qai-global { display: grid; gap: 16px; }
.qai-toggle-row { display: flex; gap: 12px; align-items: center; cursor: pointer; }
.qai-toggle-row small { display: block; color: #6b7280; font-size: 12px; }
.qai-switch { width: 48px; height: 28px; border-radius: 999px; border: none; background: #d1d5db; position: relative; cursor: pointer; padding: 0; flex: none; transition: background .15s; }
.qai-switch span { position: absolute; top: 4px; inset-inline-start: 4px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: inset-inline-start .15s; }
.qai-switch.on { background: var(--qai-violet); }
.qai-switch.on span { inset-inline-start: 24px; }
.qai-field { display: grid; gap: 6px; max-width: 520px; font-size: 13px; }
.qai-field small { color: #6b7280; font-size: 11.5px; line-height: 1.8; }
.qai-field input[type=range] { accent-color: var(--qai-violet); }
.qai-input { border: 1px solid #e5e7eb; border-radius: 10px; padding: 8px 12px; font: inherit; font-size: 13px; width: 100%; box-sizing: border-box; background: #fff; }
.qai-input:focus { outline: none; border-color: var(--qai-violet); box-shadow: 0 0 0 3px rgba(124,58,237,.15); }
.qai-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 16px; border-radius: 10px; border: 1px solid #e5e7eb; background: #fff; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.qai-btn.primary { background: var(--qai-violet); border-color: var(--qai-violet); color: #fff; }
.qai-btn:disabled { opacity: .5; cursor: not-allowed; }
.qai-btn:focus-visible, .qai-tab:focus-visible, .qai-switch:focus-visible, .qai-seg button:focus-visible, .qai-job-hdr:focus-visible { outline: 3px solid rgba(124,58,237,.35); outline-offset: 2px; }
.qai-row-hdr { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.qai-row-hdr h2 { margin: 0; }
.qai-search { position: relative; min-width: 220px; }
.qai-search i { position: absolute; inset-inline-start: 10px; top: 50%; transform: translateY(-50%); color: #9ca3af; }
.qai-search .qai-input { padding-inline-start: 32px; }
.qai-schools { display: grid; gap: 6px; }
.qai-school { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid #f3f4f6; border-radius: 10px; flex-wrap: wrap; }
.qai-school-name { font-weight: 600; font-size: 13px; }
.qai-seg { display: inline-flex; background: #f6f7fb; border-radius: 10px; padding: 3px; gap: 3px; }
.qai-seg button { border: none; background: transparent; padding: 6px 12px; border-radius: 8px; font: inherit; font-size: 12px; cursor: pointer; color: #4b5563; display: inline-flex; gap: 4px; align-items: center; }
.qai-seg button.on { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.08); font-weight: 700; color: #111827; }
.qai-seg button.on.ai { color: var(--qai-violet); }
.qai-seg button.on.teacher { color: #1d4ed8; }
.qai-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.qai-kpi { background: #f6f7fb; border-radius: 12px; padding: 14px; display: grid; gap: 4px; }
.qai-kpi .v { font-size: 20px; font-weight: 800; color: var(--qai-violet); }
.qai-kpi.ok .v { color: #15803d; }
.qai-kpi.warn .v { color: #b45309; }
.qai-kpi .l { font-size: 12px; color: #4b5563; }
.qai-audit { display: grid; gap: 8px; }
.qai-job { border: 1px solid #e5e7eb; border-radius: 12px; overflow: hidden; }
.qai-job-hdr { width: 100%; display: flex; gap: 10px; align-items: center; padding: 10px 12px; background: #fff; border: none; font: inherit; font-size: 12.5px; cursor: pointer; text-align: right; }
.qai-job-hdr:hover { background: #fafafa; }
.qai-job-q { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qai-job-meta { display: inline-flex; gap: 10px; color: #6b7280; font-size: 11.5px; white-space: nowrap; }
.qai-status { border-radius: 999px; padding: 2px 10px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.qai-status.s0, .qai-status.s1 { background: #f3f4f6; color: #4b5563; }
.qai-status.s2 { background: #f0fdf4; color: #15803d; }
.qai-status.s3 { background: #fffbeb; color: #b45309; }
.qai-job-body { padding: 12px; border-top: 1px solid #f3f4f6; background: #fcfcfd; font-size: 12.5px; }
.qai-job-body dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 0 0 10px; }
.qai-job-body dt { color: #6b7280; }
.qai-job-body dd { margin: 0; word-break: break-word; }
.qai-job-body dd.warn { color: #b45309; font-weight: 600; }
.qai-pre-lbl { font-weight: 700; margin: 8px 0 4px; color: #374151; }
.qai-pre { white-space: pre-wrap; word-break: break-word; background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; padding: 10px; max-height: 280px; overflow: auto; font-family: inherit; font-size: 12px; margin: 0; }
.qai-pager { display: flex; justify-content: center; align-items: center; gap: 10px; margin-top: 12px; font-size: 12.5px; }
.qai-empty { padding: 30px; text-align: center; color: #9ca3af; }
.qai-skel { height: 48px; border-radius: 10px; margin-bottom: 8px; background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 37%, #f3f4f6 63%); background-size: 400% 100%; animation: qai-skel 1.3s ease infinite; }
@keyframes qai-skel { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.qai-spin { animation: qai-spin 1s linear infinite; display: inline-block; }
@keyframes qai-spin { to { transform: rotate(360deg); } }
.qai-toast { position: fixed; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); background: #065f46; color: #fff; padding: 10px 18px; border-radius: 12px; font-size: 13px; z-index: 10001; }
.qai-toast.error { background: #b91c1c; }
@media (max-width: 760px) {
    .qai-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .qai-job-meta { display: none; }
}
@media (prefers-reduced-motion: reduce) { .qai-dots i, .qai-skel, .qai-spin { animation: none; } }
