.task-engine-module {
    --tem-c-bg: #f5f6fa;
    --tem-c-surface: #ffffff;
    --tem-c-border: rgba(0,0,0,0.08);
    --tem-c-border-strong: rgba(0,0,0,0.14);
    --tem-c-text: #1a1a2e;
    --tem-c-text-2: #5a5a6e;
    --tem-c-text-3: #9a9aac;
    --tem-c-accent: #2563eb;
    --tem-c-accent-bg: #eff6ff;
    --tem-c-accent-text: #1d4ed8;
    --tem-c-success: #16a34a;
    --tem-c-success-bg: #f0fdf4;
    --tem-c-warning: #d97706;
    --tem-c-warning-bg: #fffbeb;
    --tem-c-danger: #dc2626;
    --tem-c-danger-bg: #fef2f2;
    --tem-transition: 150ms ease;

    direction: rtl;
    font-family: inherit;
    color: var(--tem-c-text);
}

/* ---------- Header ---------- */
.tem-page-hdr {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    margin-bottom: 18px; flex-wrap: wrap;
}
.tem-page-title { font-size: 20px; font-weight: 800; }
.tem-page-desc { font-size: 12.5px; color: var(--tem-c-text-2); margin-top: 4px; }
.tem-meta-badge {
    font-size: 11.5px; color: var(--tem-c-text-3); background: var(--tem-c-bg);
    border: 1px solid var(--tem-c-border); border-radius: 20px; padding: 6px 14px;
    display: inline-flex; align-items: center; gap: 6px;
}

/* ---------- Nav (quick jump) ---------- */
.tem-quick-nav {
    display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 20px;
    background: var(--tem-c-surface); border: 1px solid var(--tem-c-border);
    border-radius: 12px; padding: 10px;
}
.tem-quick-nav a {
    font-size: 11.5px; font-weight: 600; color: var(--tem-c-text-2); text-decoration: none;
    padding: 6px 12px; border-radius: 8px; transition: all var(--tem-transition);
}
.tem-quick-nav a:hover { background: var(--tem-c-accent-bg); color: var(--tem-c-accent-text); }

/* ---------- Section cards ---------- */
.tem-section {
    background: var(--tem-c-surface); border: 1px solid var(--tem-c-border);
    border-radius: 14px; padding: 18px 20px; margin-bottom: 16px;
    scroll-margin-top: 16px;
}
.tem-section-hdr { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.tem-section-title { font-size: 14.5px; font-weight: 800; }
.tem-section-desc { font-size: 11.5px; color: var(--tem-c-text-3); margin-bottom: 14px; }
.tem-section-icon {
    width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center;
    justify-content: center; background: var(--tem-c-accent-bg); color: var(--tem-c-accent-text); font-size: 15px;
}

.tem-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px;
}
.tem-item { display: flex; flex-direction: column; gap: 5px; }
.tem-item label { font-size: 11.5px; font-weight: 700; color: var(--tem-c-text-2); }
.tem-item input[type="number"], .tem-item input[type="text"], .tem-item select {
    border: 1px solid var(--tem-c-border-strong); border-radius: 8px; padding: 8px 10px;
    font-size: 12.5px; font-family: inherit; background: var(--tem-c-bg); color: var(--tem-c-text);
    transition: border-color var(--tem-transition);
}
.tem-item input:focus, .tem-item select:focus { outline: none; border-color: var(--tem-c-accent); background: var(--tem-c-surface); }
.tem-item-hint { font-size: 10.5px; color: var(--tem-c-text-3); }

/* Toggle switch */
.tem-toggle-row {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 9px 12px; border: 1px solid var(--tem-c-border); border-radius: 10px; background: var(--tem-c-bg);
}
.tem-toggle-row .tem-toggle-label { font-size: 12px; font-weight: 700; }
.tem-toggle-row .tem-toggle-hint { font-size: 10.5px; color: var(--tem-c-text-3); margin-top: 2px; }
.tem-switch { position: relative; width: 38px; height: 22px; flex: none; }
.tem-switch input { opacity: 0; width: 0; height: 0; }
.tem-switch .tem-slider {
    position: absolute; inset: 0; background: #d1d5db; border-radius: 22px; cursor: pointer; transition: background var(--tem-transition);
}
.tem-switch .tem-slider::before {
    content: ""; position: absolute; height: 16px; width: 16px; right: 3px; top: 3px;
    background: #fff; border-radius: 50%; transition: transform var(--tem-transition);
}
.tem-switch input:checked + .tem-slider { background: var(--tem-c-accent); }
.tem-switch input:checked + .tem-slider::before { transform: translateX(-16px); }

/* Duration template mini-table */
.tem-template-table { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 6px; }
.tem-template-table th, .tem-template-table td { padding: 7px 10px; border-bottom: 1px solid var(--tem-c-border); text-align: center; }
.tem-template-table th { color: var(--tem-c-text-3); font-weight: 700; font-size: 11px; }

/* ── نمودارِ «نتایجِ شرکت در تسکِ کلاس» (حضور + رضایت) — طبق درخواستِ صریحِ کاربر،
   هم‌الگو با .sam-pop-* در school-admin-module.css برایِ زبانِ بصریِ یکسان در کلِ پروژه. ── */
.tem-pop-chart { display: flex; flex-direction: column; gap: 18px; }
.tem-pop-row { display: grid; grid-template-columns: 140px 1fr 1fr 110px; align-items: center; gap: 14px; }
.tem-pop-name {
    font-size: 12.5px; font-weight: 700; color: var(--tem-c-text); display: flex; align-items: center;
    gap: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tem-pop-metric { display: flex; flex-direction: column; gap: 3px; }
.tem-pop-metric-label { font-size: 10px; color: var(--tem-c-text-3); }
.tem-pop-bar-track { height: 22px; background: var(--tem-c-bg); border-radius: 20px; overflow: hidden; position: relative; }
.tem-pop-bar-fill {
    height: 100%; border-radius: 20px; display: flex; align-items: center; justify-content: flex-end;
    padding-inline-end: 8px; min-width: 30px; transition: width 0.6s cubic-bezier(.4,0,.2,1);
}
.tem-pop-bar-attendance { background: linear-gradient(90deg, var(--tem-c-success), #4ade80); }
.tem-pop-bar-rating { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.tem-pop-bar-value { font-size: 10.5px; font-weight: 700; color: #fff; }
.tem-pop-count { font-size: 10.5px; color: var(--tem-c-text-3); text-align: left; }
@media (max-width: 700px) {
    .tem-pop-row { grid-template-columns: 1fr; gap: 6px; }
    .tem-pop-count { text-align: right; }
}

/* ---------- Actions bar ---------- */
.tem-actions-bar {
    position: sticky; bottom: 0; display: flex; gap: 10px; justify-content: flex-end;
    background: var(--tem-c-surface); border: 1px solid var(--tem-c-border); border-radius: 12px;
    padding: 12px 16px; margin-top: 8px; box-shadow: 0 -4px 14px rgba(0,0,0,0.05);
}
.tem-btn {
    display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700;
    border-radius: 9px; padding: 9px 18px; border: 1px solid var(--tem-c-border-strong);
    background: var(--tem-c-surface); color: var(--tem-c-text-2); cursor: pointer; transition: all var(--tem-transition);
}
.tem-btn:hover { background: var(--tem-c-bg); }
.tem-btn-primary { background: var(--tem-c-accent); border-color: var(--tem-c-accent); color: #fff; }
.tem-btn-primary:hover { filter: brightness(1.08); }
.tem-btn:disabled { opacity: .6; cursor: not-allowed; }

/* ---------- Access-denied banner ---------- */
.tem-denied {
    display: flex; align-items: center; gap: 10px; background: var(--tem-c-danger-bg);
    color: var(--tem-c-danger); border: 1px solid var(--tem-c-danger); border-radius: 12px; padding: 16px 20px; font-size: 13px; font-weight: 700;
}

/* ---------- Toasts ---------- */
.tem-toast-wrap { position: fixed; top: 18px; left: 18px; z-index: 10000; display: flex; flex-direction: column; gap: 8px; }
.tem-toast {
    display: flex; align-items: center; gap: 8px; background: var(--tem-c-surface); border: 1px solid var(--tem-c-border-strong);
    border-radius: 10px; padding: 10px 16px; font-size: 12.5px; font-weight: 600; box-shadow: 0 6px 20px rgba(0,0,0,0.12);
    cursor: pointer; min-width: 220px; direction: rtl;
}
.tem-toast-success { border-color: var(--tem-c-success); color: var(--tem-c-success); }
.tem-toast-error { border-color: var(--tem-c-danger); color: var(--tem-c-danger); }
.tem-toast-warning { border-color: var(--tem-c-warning); color: var(--tem-c-warning); }
.tem-toast-info { border-color: var(--tem-c-accent); color: var(--tem-c-accent-text); }

@media (max-width: 640px) {
    .tem-grid { grid-template-columns: 1fr 1fr; }
}

/* ---------- Weekly day-grouped view (بازطراحی ۴ سپتامبر ۲۰۲۶، طبق درخواست صریح کاربر) ----------
   قبلاً هر دو صفحه‌ی برنامه‌ریزی دستی/تولید برنامه، نتیجه را در یک جدول تخت و متراکم (۸ ستون
   ریز، بدون گروه‌بندی روزانه) نشان می‌دادند. طبق تحلیل نیاز سه نقش (ادمین/مدیر مدرسه/معلم)،
   بزرگ‌ترین بهبود ممکن، نمای هفتگیِ گروه‌بندی‌شده بر اساس روز بود — هر روز یک کارت جدا با
   عنوان روز هفته + تاریخ شمسی، و هر تسک به‌صورت یک ردیفِ کارتیِ رنگی (بر اساس نوع)، نه یک
   سطر جدول. */
.tem-week {
    display: flex; flex-direction: column; gap: 12px;
}
.tem-day-card {
    background: var(--tem-c-surface); border: 1px solid var(--tem-c-border);
    border-radius: 14px; overflow: hidden;
}
.tem-day-hdr {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 10px 16px; background: var(--tem-c-bg); border-bottom: 1px solid var(--tem-c-border);
}
.tem-day-hdr-title { font-size: 13px; font-weight: 800; }
.tem-day-hdr-date { font-size: 11px; color: var(--tem-c-text-3); }
.tem-day-hdr-count {
    font-size: 10.5px; font-weight: 700; color: var(--tem-c-text-2);
    background: var(--tem-c-surface); border: 1px solid var(--tem-c-border-strong);
    border-radius: 20px; padding: 3px 10px;
}
.tem-day-empty { padding: 16px; text-align: center; font-size: 11.5px; color: var(--tem-c-text-3); }
.tem-day-add-btn {
    display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%;
    padding: 8px; font-size: 11.5px; font-weight: 700; color: var(--tem-c-accent-text);
    background: none; border: none; border-top: 1px dashed var(--tem-c-border-strong); cursor: pointer;
    transition: background var(--tem-transition);
}
.tem-day-add-btn:hover { background: var(--tem-c-accent-bg); }

.tem-task-card {
    display: flex; align-items: center; gap: 10px; padding: 10px 16px;
    border-bottom: 1px solid var(--tem-c-border); transition: background var(--tem-transition);
}
.tem-task-card:last-of-type { border-bottom: none; }
.tem-task-card:hover { background: var(--tem-c-bg); }
.tem-task-type-bar { width: 4px; align-self: stretch; border-radius: 4px; flex: none; }
.tem-task-time { font-size: 11px; color: var(--tem-c-text-3); font-family: inherit; white-space: nowrap; flex: none; width: 74px; }
.tem-task-time input[type="time"] {
    border: 1px solid var(--tem-c-border-strong); border-radius: 6px; padding: 3px 4px;
    font-size: 10.5px; width: 66px; background: var(--tem-c-bg);
}
.tem-task-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tem-task-goal-input {
    border: 1px solid transparent; border-radius: 6px; padding: 3px 6px; font-size: 12.5px;
    font-weight: 600; background: transparent; width: 100%; transition: all var(--tem-transition);
}
.tem-task-goal-input:hover, .tem-task-goal-input:focus { border-color: var(--tem-c-border-strong); background: var(--tem-c-surface); outline: none; }
.tem-task-sub { font-size: 10.5px; color: var(--tem-c-text-3); }
.tem-type-badge {
    font-size: 10px; font-weight: 800; border-radius: 6px; padding: 3px 9px; white-space: nowrap; flex: none;
}
.tem-type-Study, .tem-task-type-bar.type-Study { background: var(--tem-c-accent-bg); color: var(--tem-c-accent-text); }
.tem-task-type-bar.type-Study { background: var(--tem-c-accent); }
.tem-type-Test, .tem-task-type-bar.type-Test { background: var(--tem-c-warning-bg); color: var(--tem-c-warning); }
.tem-task-type-bar.type-Test { background: var(--tem-c-warning); }
.tem-type-TimedTest, .tem-task-type-bar.type-TimedTest { background: var(--tem-c-danger-bg); color: var(--tem-c-danger); }
.tem-task-type-bar.type-TimedTest { background: var(--tem-c-danger); }
.tem-type-Review, .tem-task-type-bar.type-Review { background: var(--tem-c-success-bg); color: var(--tem-c-success); }
.tem-task-type-bar.type-Review { background: var(--tem-c-success); }
.tem-type-Vocabulary, .tem-task-type-bar.type-Vocabulary { background: #f3e8ff; color: #7e22ce; }
.tem-task-type-bar.type-Vocabulary { background: #a855f7; }
.tem-type-MockExam, .tem-task-type-bar.type-MockExam { background: #ffe4e6; color: #be123c; }
.tem-task-type-bar.type-MockExam { background: #fb7185; }
.tem-type-default, .tem-task-type-bar.type-default { background: var(--tem-c-bg); color: var(--tem-c-text-3); }
.tem-task-type-bar.type-default { background: var(--tem-c-text-3); }

.tem-task-status-select {
    font-size: 10.5px; border: 1px solid var(--tem-c-border-strong); border-radius: 6px;
    padding: 3px 6px; background: var(--tem-c-bg); flex: none;
}
.tem-task-actions { display: flex; gap: 4px; flex: none; }
.tem-task-actions .tem-btn { padding: 5px 8px; font-size: 11px; }

/* فرم افزودن تسکِ درجا — بازشونده داخل خودِ کارت روز، نه یک فرم جدا و بی‌ربط بالای صفحه */
.tem-inline-add {
    padding: 12px 16px; background: var(--tem-c-accent-bg); border-top: 1px dashed var(--tem-c-border-strong);
    display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end;
}
.tem-inline-add .tem-item { flex: 1; min-width: 110px; }
.tem-inline-add .tem-item label { font-size: 10px; }

/* نتیجه‌ی «قابل‌اجرا/غیرقابل‌اجرا» — نوار وضعیت بزرگ و واضح به‌جای متن ساده داخل جدول */
.tem-result-banner {
    display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-radius: 14px;
    font-size: 14px; font-weight: 800; margin-bottom: 16px;
}
.tem-result-banner.feasible { background: var(--tem-c-success-bg); color: var(--tem-c-success); border: 1px solid var(--tem-c-success); }
.tem-result-banner.infeasible { background: var(--tem-c-danger-bg); color: var(--tem-c-danger); border: 1px solid var(--tem-c-danger); }
.tem-result-banner-icon { font-size: 22px; }
.tem-result-banner-sub { font-size: 11.5px; font-weight: 500; opacity: .85; margin-top: 2px; }

/* ============================================================================
   🆕 ادغام صفحه‌ی /plans و /task-engine/completion-dashboard (۵ سپتامبر ۲۰۲۶، طبق
   درخواست صریح کاربر) — این بخش برای PlansDashboardPage.razor است. صفحه‌ی قدیمی
   /plans کاملاً ساختگی بود (PlansMockService)؛ این صفحه‌ی جدید کاملاً روی داده‌ی
   واقعی dbo.PlanTasks ساخته شده و هر دو مسیر (/plans و
   /task-engine/completion-dashboard) را همزمان سرویس می‌دهد.
   ============================================================================ */

/* ---------- KPI cards ---------- */
.tem-kpi-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 18px;
}
.tem-kpi-card {
    background: var(--tem-c-surface); border: 1px solid var(--tem-c-border); border-radius: 16px;
    padding: 18px 20px; display: flex; flex-direction: column; gap: 10px;
    transition: transform var(--tem-transition), box-shadow var(--tem-transition);
}
.tem-kpi-card:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(0,0,0,0.07); }
.tem-kpi-icon {
    width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 19px;
}
.tem-kpi-icon.accent { background: var(--tem-c-accent-bg); color: var(--tem-c-accent-text); }
.tem-kpi-icon.success { background: var(--tem-c-success-bg); color: var(--tem-c-success); }
.tem-kpi-icon.danger { background: var(--tem-c-danger-bg); color: var(--tem-c-danger); }
.tem-kpi-icon.warning { background: var(--tem-c-warning-bg); color: var(--tem-c-warning); }
.tem-kpi-value { font-size: 26px; font-weight: 800; line-height: 1; }
.tem-kpi-label { font-size: 12px; color: var(--tem-c-text-2); font-weight: 600; }

/* ---------- Progress bar + badge (بدون وابستگی به ماژول Plans که حذف شد) ---------- */
.tem-progress-track { width: 100%; height: 8px; border-radius: 20px; background: var(--tem-c-bg); overflow: hidden; }
.tem-progress-fill { height: 100%; border-radius: 20px; transition: width .35s ease; }
.tem-progress-fill.success { background: var(--tem-c-success); }
.tem-progress-fill.warning { background: var(--tem-c-warning); }
.tem-progress-fill.danger { background: var(--tem-c-danger); }

.tem-badge {
    display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700;
    border-radius: 20px; padding: 4px 12px; white-space: nowrap;
}
.tem-badge.success { background: var(--tem-c-success-bg); color: var(--tem-c-success); }
.tem-badge.warning { background: var(--tem-c-warning-bg); color: var(--tem-c-warning); }
.tem-badge.danger { background: var(--tem-c-danger-bg); color: var(--tem-c-danger); }

.tem-avatar {
    width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 12px; font-weight: 800; flex: none;
}

/* ---------- Student progress table ---------- */
.tem-student-table-wrap { overflow-x: auto; }
.tem-student-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tem-student-table th {
    text-align: right; font-size: 11px; color: var(--tem-c-text-3); font-weight: 700;
    padding: 8px 12px; border-bottom: 1px solid var(--tem-c-border); white-space: nowrap;
}
.tem-student-table td { padding: 10px 12px; border-bottom: 1px solid var(--tem-c-border); vertical-align: middle; }
.tem-student-table tr:last-child td { border-bottom: none; }
.tem-student-table tr:hover td { background: var(--tem-c-bg); }
.tem-student-name-cell { display: flex; align-items: center; gap: 8px; font-weight: 600; }

/* ---------- Daily trend chart ---------- */
.tem-trend-chart { display: flex; align-items: flex-end; gap: 3px; height: 140px; overflow-x: auto; padding-bottom: 6px; }
.tem-trend-bar { display: flex; flex-direction: column-reverse; min-width: 14px; height: 110px; border-radius: 3px; overflow: hidden; }
.tem-trend-legend { display: flex; gap: 16px; margin-top: 10px; font-size: 11px; color: var(--tem-c-text-3); }
.tem-trend-legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-left: 4px; }

@media (max-width: 720px) {
    .tem-student-table thead { display: none; }
    .tem-student-table, .tem-student-table tbody, .tem-student-table tr, .tem-student-table td { display: block; width: 100%; }
    .tem-student-table tr { border-bottom: 1px solid var(--tem-c-border); padding: 10px 0; }
    .tem-student-table td { border-bottom: none; padding: 4px 0; }
    .tem-student-table td::before {
        content: attr(data-label); font-size: 10.5px; color: var(--tem-c-text-3); display: block; margin-bottom: 2px;
    }
}

/* ───────────── 🆕 (Update 27) صفحه‌ی «روتین‌ها و دروسِ عمومی» ───────────── */
.task-engine-module .rt-group-summary { display: flex; align-items: center; gap: 8px; margin-top: 10px; padding: 8px 12px; border-radius: 10px; background: var(--tem-c-accent-bg); color: var(--tem-c-accent-text); font-size: 12.5px; }
.task-engine-module .rt-empty { padding: 36px 16px; text-align: center; color: var(--tem-c-text-3); font-size: 13px; }
.task-engine-module .rt-empty.small { padding: 14px; }
.task-engine-module .rt-tabs { display: flex; gap: 6px; padding: 4px; background: var(--tem-c-bg); border-radius: 12px; margin: 14px 0 10px; }
.task-engine-module .rt-tabs button { flex: 1; border: 0; background: transparent; padding: 9px 12px; border-radius: 9px; font: inherit; font-size: 13px; font-weight: 600; color: var(--tem-c-text-2); cursor: pointer; display: inline-flex; gap: 6px; align-items: center; justify-content: center; }
.task-engine-module .rt-tabs button.active { background: var(--tem-c-surface); color: var(--tem-c-accent-text); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.task-engine-module .rt-count { min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--tem-c-bg); font-size: 11px; }
.task-engine-module .rt-help { font-size: 12px; line-height: 1.9; color: var(--tem-c-text-2); background: var(--tem-c-surface); border: 1px dashed var(--tem-c-border-strong); border-radius: 12px; padding: 10px 14px; margin-bottom: 12px; }
.task-engine-module .rt-card { background: var(--tem-c-surface); border: 1px solid var(--tem-c-border); border-inline-start: 4px solid #7c3aed; border-radius: 14px; padding: 14px; margin-bottom: 12px; box-shadow: 0 1px 2px rgba(0,0,0,.03); }
.task-engine-module .rt-card.inactive { opacity: .6; border-inline-start-color: var(--tem-c-text-3); }
.task-engine-module .rt-card-hdr { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; margin-bottom: 10px; }
.task-engine-module .rt-slot-pick { min-width: 140px; }
.task-engine-module .rt-check { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; cursor: pointer; padding-bottom: 8px; }
.task-engine-module .rt-meter { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--tem-c-text-2); padding-bottom: 8px; }
.task-engine-module .rt-meter-bar { width: 120px; height: 8px; border-radius: 999px; background: var(--tem-c-bg); overflow: hidden; }
.task-engine-module .rt-meter-bar span { display: block; height: 100%; background: #7c3aed; border-radius: 999px; transition: width .2s; }
.task-engine-module .rt-meter.over { color: var(--tem-c-danger); font-weight: 700; }
.task-engine-module .rt-meter.over .rt-meter-bar span { background: var(--tem-c-danger); }
.task-engine-module .rt-item { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; padding: 10px 0; border-top: 1px solid var(--tem-c-border); }
.task-engine-module .rt-item-no { width: 26px; height: 26px; border-radius: 50%; background: #ede9fe; color: #5b21b6; display: grid; place-items: center; font-weight: 800; font-size: 12px; margin-bottom: 6px; flex-shrink: 0; }
.task-engine-module .rt-duration { width: 120px; }
.task-engine-module .rt-books { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 6px; }
.task-engine-module .rt-books > label { font-size: 11.5px; color: var(--tem-c-text-2); font-weight: 600; }
.task-engine-module .rt-book-name { font-weight: 700; font-size: 13px; padding: 8px 0; }
.task-engine-module .rt-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.task-engine-module .rt-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px; border-radius: 999px; background: #f5f3ff; border: 1px solid #ddd6fe; color: #4c1d95; font-size: 12px; }
.task-engine-module .rt-chip b { font-size: 10px; background: #7c3aed; color: #fff; border-radius: 999px; min-width: 16px; height: 16px; display: grid; place-items: center; }
.task-engine-module .rt-chip button { border: 0; background: transparent; cursor: pointer; color: inherit; padding: 0 2px; line-height: 1; }
.task-engine-module .rt-add-book { border: 1px dashed var(--tem-c-border-strong); border-radius: 999px; padding: 5px 10px; font: inherit; font-size: 12px; background: var(--tem-c-surface); color: var(--tem-c-accent-text); cursor: pointer; }
.task-engine-module .rt-card-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding-top: 12px; border-top: 1px solid var(--tem-c-border); }
.task-engine-module .rt-spacer { flex: 1; }
.task-engine-module .rt-icon-btn { padding: 6px 9px; }
.task-engine-module .rt-order-btns { display: flex; gap: 4px; padding-bottom: 4px; }
.task-engine-module .rt-danger { color: var(--tem-c-danger); }
.task-engine-module .rt-add-window { width: 100%; padding: 14px; border: 2px dashed #c4b5fd; border-radius: 14px; background: #faf5ff; color: #6d28d9; font: inherit; font-weight: 700; cursor: pointer; transition: background .15s; }
.task-engine-module .rt-add-window:hover:not(:disabled) { background: #f3e8ff; }
.task-engine-module .rt-add-window:disabled { opacity: .5; cursor: not-allowed; }
/* 🆕 (Update 78) روتین‌ها با «مخزنِ مشترکِ کتاب‌ها» + پیش‌نمایشِ چرخش */
.task-engine-module .rt-routines { display: flex; flex-wrap: wrap; gap: 10px; padding: 10px 0; border-top: 1px solid var(--tem-c-border); }
.task-engine-module .rt-routine { display: flex; align-items: flex-end; gap: 8px; padding: 8px 10px; border: 1px solid var(--tem-c-border); border-radius: 12px; background: var(--tem-c-bg); }
.task-engine-module .rt-routine .rt-duration { width: 130px; }
.task-engine-module .rt-pool { padding: 12px 0; border-top: 1px solid var(--tem-c-border); display: flex; flex-direction: column; gap: 8px; }
.task-engine-module .rt-pool-hdr { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; font-size: 12.5px; font-weight: 700; color: var(--tem-c-text-2); }
.task-engine-module .rt-pool-hdr i { color: #7c3aed; }
.task-engine-module .rt-pool-stat { font-weight: 600; color: var(--tem-c-text-3); }
.task-engine-module .rt-pool-stat.bad { color: var(--tem-c-danger); }
.task-engine-module .rt-pool .rt-chip button:disabled { opacity: .3; cursor: default; }
.task-engine-module .rt-pool .rt-chip button:focus-visible { outline: 2px solid #7c3aed; outline-offset: 1px; border-radius: 4px; }
.task-engine-module .rt-pool-warn { font-size: 12px; color: var(--tem-c-danger); display: flex; align-items: center; gap: 6px; }
.task-engine-module .rt-preview { margin: 4px 0 10px; border: 1px solid var(--tem-c-border); border-radius: 12px; background: var(--tem-c-bg); }
.task-engine-module .rt-preview > summary { cursor: pointer; padding: 9px 12px; font-size: 12.5px; font-weight: 700; color: var(--tem-c-accent-text); display: flex; align-items: center; gap: 6px; }
.task-engine-module .rt-preview-wrap { overflow-x: auto; padding: 0 10px 10px; }
.task-engine-module .rt-preview-table { width: 100%; border-collapse: collapse; font-size: 12px; min-width: 360px; }
.task-engine-module .rt-preview-table th, .task-engine-module .rt-preview-table td { padding: 6px 8px; border-top: 1px solid var(--tem-c-border); text-align: start; white-space: nowrap; }
.task-engine-module .rt-preview-table thead th { border-top: 0; color: var(--tem-c-text-3); font-weight: 600; }
.task-engine-module .rt-preview-table tbody th { font-weight: 700; }
.task-engine-module .rt-preview-table small { color: var(--tem-c-text-3); font-weight: 400; margin-inline-start: 4px; }
.task-engine-module .rt-spin { display: inline-block; animation: rtSpin .8s linear infinite; }
@keyframes rtSpin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .task-engine-module .rt-spin { animation: none; } }
@media (max-width: 640px) {
    .task-engine-module .rt-meter { margin-inline-start: 0; width: 100%; }
    .task-engine-module .rt-duration { width: 100%; }
    .task-engine-module .rt-routine { width: 100%; }
    .task-engine-module .rt-routine .rt-duration { flex: 1; width: auto; }
}
