/* ==========================================================================
   پنل آموزشگاه رهام — چیدمان و اجزای مخصوص پنل
   پایه (رنگ، دکمه، فرم، جدول، ...) در app.css است.
   دسکتاپ: ساید‌بار ثابت سمت راست — موبایل/تبلت: منوی کشویی + نوار پایین
   ========================================================================== */

:root {
    --sidebar-w: 268px;
    --topbar-h: 64px;
    --bottomnav-h: 64px;
}

body.panel { background: var(--c-bg); min-height: 100vh; }
body.panel.no-scroll { overflow: hidden; }

/* ============================ ساید‌بار ============================ */
.sidebar {
    position: fixed; inset-block: 0; right: 0; z-index: 60;
    width: var(--sidebar-w); max-width: 86vw;
    display: flex; flex-direction: column;
    background: #0f172a; color: #cbd5e1;
    transform: translateX(105%);
    transition: transform .28s var(--ease);
    box-shadow: var(--shadow-lg);
}
.sidebar.open { transform: none; }
.sidebar-overlay {
    position: fixed; inset: 0; z-index: 55;
    background: rgba(15, 23, 42, .45); backdrop-filter: blur(2px);
    opacity: 0; visibility: hidden; transition: opacity .25s, visibility .25s;
}
.sidebar-overlay.active { opacity: 1; visibility: visible; }

.sidebar-header {
    display: flex; align-items: center; justify-content: space-between; gap: .5rem;
    padding: 1.1rem 1.1rem .9rem;
    border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.sidebar .logo, .brand {
    display: flex; align-items: center; gap: .6rem;
    color: #fff; font-weight: 800; font-size: 1.05rem; text-decoration: none;
}
.brand-mark {
    width: 38px; height: 38px; border-radius: 12px; flex: none;
    display: grid; place-items: center; color: #fff; font-size: 1.05rem;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    box-shadow: 0 8px 18px -8px rgba(99, 102, 241, .8);
}
.brand small { display: block; font-weight: 400; font-size: .72rem; color: #94a3b8; line-height: 1.3; }
.sidebar-close {
    width: 38px; height: 38px; border-radius: 10px; border: 0;
    background: rgba(255, 255, 255, .06); color: #e2e8f0;
}

.sidebar-user {
    display: flex; align-items: center; gap: .7rem;
    margin: .9rem .9rem .2rem; padding: .7rem .8rem;
    border-radius: var(--radius); background: rgba(255, 255, 255, .05);
}
.sidebar-user .avatar { width: 38px; height: 38px; background: rgba(59, 130, 246, .18); color: #93c5fd; }
.sidebar-user strong { display: block; color: #f1f5f9; font-size: .92rem; line-height: 1.5; }
.sidebar-user span { font-size: .78rem; color: #94a3b8; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: .6rem .7rem 1rem; }
.sidebar-nav ul { list-style: none; margin: 0; padding: 0; }
.sidebar-nav .nav-label {
    margin: 1rem .6rem .35rem; font-size: .72rem; font-weight: 800; letter-spacing: .02em;
    color: #64748b;
}
.sidebar-nav a {
    display: flex; align-items: center; gap: .75rem;
    min-height: var(--tap); padding: .45rem .8rem; margin-bottom: 2px;
    border-radius: 11px; color: #cbd5e1; font-weight: 600; font-size: .94rem;
    cursor: pointer; transition: background .15s, color .15s;
}
.sidebar-nav a i { width: 20px; text-align: center; color: #64748b; transition: color .15s; }
.sidebar-nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.sidebar-nav a:hover i { color: #cbd5e1; }
.sidebar-nav a.active {
    background: linear-gradient(90deg, rgba(37, 99, 235, .25), rgba(37, 99, 235, .45));
    color: #fff;
}
.sidebar-nav a.active i { color: #93c5fd; }
.sidebar-nav a.danger:hover { background: rgba(220, 38, 38, .15); color: #fecaca; }
.sidebar-footer {
    padding: .8rem 1.1rem; border-top: 1px solid rgba(255, 255, 255, .06);
    font-size: .78rem; color: #64748b; display: flex; justify-content: space-between; gap: .5rem;
}
.sidebar-footer a { color: #94a3b8; }
.sidebar-footer a:hover { color: #fff; }

/* ============================ نوار بالا ============================ */
.topbar, .header-nav {
    position: sticky; top: 0; z-index: 40;
    height: var(--topbar-h);
    display: flex; align-items: center; justify-content: space-between; gap: .75rem;
    padding: 0 1rem;
    background: rgba(255, 255, 255, .88);
    backdrop-filter: saturate(1.6) blur(10px);
    border-bottom: 1px solid var(--c-border-2);
}
.topbar-start, .header-left { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.topbar-title {
    margin: 0; font-size: 1.05rem; font-weight: 800;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar-end, .header-actions { display: flex; align-items: center; gap: .5rem; }
.menu-toggle {
    width: 42px; height: 42px; flex: none; border-radius: 12px;
    border: 1px solid var(--c-border); background: var(--c-surface); color: var(--c-text-2);
    display: grid; place-items: center; font-size: 1.05rem;
}
.role-badge {
    display: inline-flex; align-items: center; gap: .35rem;
    padding: .2rem .75rem; border-radius: var(--radius-pill);
    background: var(--c-primary-50); color: var(--c-primary-600);
    font-size: .8rem; font-weight: 800; white-space: nowrap;
}
.topbar .btn-logout span { display: none; }
@media (min-width: 640px) { .topbar .btn-logout span { display: inline; } }

/* ============================ محتوا ============================ */
.main {
    padding: 1rem 1rem calc(var(--bottomnav-h) + 1.5rem + env(safe-area-inset-bottom));
    max-width: 1280px; margin: 0 auto;
}
@media (min-width: 768px) { .main { padding: 1.5rem 1.5rem calc(var(--bottomnav-h) + 2rem); } }

.page { max-width: 1100px; margin: 0 auto; }
.page-narrow { max-width: 760px; margin: 0 auto; }
.page-head, .page-header {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .8rem;
    margin-bottom: 1.1rem;
}
.page-title, .page-header h2, .page-header .title h2 {
    margin: 0; font-size: 1.3rem; font-weight: 800; display: flex; align-items: center; gap: .55rem;
}
.page-title i, .page-header i { color: var(--c-primary); }
.page-header .title { display: flex; align-items: center; gap: .55rem; }
.page-sub { margin: .2rem 0 0; color: var(--c-muted); font-size: .92rem; }
.page-actions, .page-header .actions { display: flex; flex-wrap: wrap; gap: .5rem; }

/* بخش‌های صفحه اصلی پنل */
.section-container { display: none; animation: fadeUp .25s var(--ease); }
.section-container.active { display: block; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.table-card { overflow: hidden; margin-bottom: 1.2rem; }
.table-card .table-header { padding: 1rem 1.1rem; border-bottom: 1px solid var(--c-border-2); }
.table-card .table-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.table-card .table-responsive { padding: 0; }
@media (max-width: 900px) {
    .table-card.table-cards { background: transparent; border: 0; box-shadow: none; overflow: visible; }
    .table-card.table-cards .table-header {
        background: var(--c-surface); border: 1px solid var(--c-border-2);
        border-radius: var(--radius-lg); margin-bottom: .75rem;
    }
    .table-header .btn { flex: 1; }
}

/* ============================ خوش‌آمد و آمار ============================ */
.welcome-card {
    position: relative; overflow: hidden;
    padding: 1.6rem 1.3rem; border-radius: var(--radius-xl);
    color: #fff;
    background: radial-gradient(120% 140% at 100% 0%, #3b82f6 0%, #1d4ed8 45%, #312e81 100%);
    box-shadow: 0 20px 40px -24px rgba(29, 78, 216, .7);
}
.welcome-card::after {
    content: ""; position: absolute; inset: auto -60px -80px auto; width: 240px; height: 240px;
    border-radius: 50%; background: rgba(255, 255, 255, .08);
}
.welcome-card .icon {
    width: 54px; height: 54px; border-radius: 16px; margin-bottom: .9rem;
    display: grid; place-items: center; font-size: 1.5rem; background: rgba(255, 255, 255, .15);
}
.welcome-card h1 { color: #fff; font-size: 1.35rem; margin-bottom: .4rem; }
.welcome-card h1 span { color: #fde68a; }
.welcome-card p { color: rgba(255, 255, 255, .85); max-width: 640px; margin-bottom: 1.1rem; }
.welcome-card .features { display: flex; flex-wrap: wrap; gap: .5rem; position: relative; z-index: 1; }
.feature-item {
    display: inline-flex; align-items: center; gap: .45rem;
    padding: .35rem .85rem; border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, .14); font-size: .86rem; font-weight: 700;
}
@media (min-width: 768px) { .welcome-card { padding: 2.2rem 2rem; } .welcome-card h1 { font-size: 1.7rem; } }

.quick-actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; margin-top: 1rem; }
@media (min-width: 768px) { .quick-actions { grid-template-columns: repeat(4, 1fr); } }
.quick-action {
    display: flex; flex-direction: column; gap: .5rem;
    padding: 1rem; border-radius: var(--radius-lg);
    background: var(--c-surface); border: 1px solid var(--c-border-2); box-shadow: var(--shadow-sm);
    color: var(--c-text); font-weight: 800; font-size: .95rem; cursor: pointer;
    transition: transform .15s, box-shadow .15s, border-color .15s;
}
.quick-action:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--c-primary-100); color: var(--c-text); }
.quick-action i {
    width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
    background: var(--c-primary-50); color: var(--c-primary); font-size: 1.05rem;
}
.quick-action small { color: var(--c-muted); font-weight: 400; font-size: .8rem; line-height: 1.5; }
.quick-action.success i { background: var(--c-success-50); color: var(--c-success); }
.quick-action.warning i { background: var(--c-warning-50); color: var(--c-warning); }
.quick-action.info i { background: var(--c-info-50); color: var(--c-info); }
.quick-action.danger i { background: var(--c-danger-50); color: var(--c-danger); }

/* ===== نشان «منتظر تایید» (منوی کنار و نوار بالا) ===== */
.nav-count {
    min-width: 20px; height: 20px; padding: 0 6px; margin-inline-start: auto;
    display: inline-grid; place-items: center;
    border-radius: 999px; background: var(--c-danger); color: #fff;
    font-size: .72rem; font-weight: 700; line-height: 1;
}
.topbar-alert {
    position: relative; display: grid; place-items: center;
    width: 38px; height: 38px; border-radius: 12px;
    background: var(--c-danger-50); color: var(--c-danger-600);
}
.topbar-alert:hover { background: var(--c-danger); color: #fff; }
.topbar-alert .nav-count {
    position: absolute; top: -4px; inset-inline-end: -4px; margin: 0;
    border: 2px solid var(--c-surface);
    height: 20px; min-width: 20px;
}

/* چند دکمه در یک خانه جدول */
.row-actions { display: flex; flex-wrap: wrap; gap: .4rem; }

.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; margin: 1rem 0; }
.stat-card {
    position: relative; overflow: hidden;
    padding: 1rem 1.1rem; border-radius: var(--radius-lg);
    background: var(--c-surface); border: 1px solid var(--c-border-2); box-shadow: var(--shadow-sm);
}
.stat-card .stat-icon {
    position: absolute; left: 1rem; top: 1rem;
    width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
    background: var(--c-primary-50); color: var(--c-primary);
}
.stat-value { font-size: 1.6rem; font-weight: 800; line-height: 1.3; color: var(--c-text); }
.stat-label { color: var(--c-muted); font-size: .85rem; font-weight: 700; }
.stat-card.success .stat-icon { background: var(--c-success-50); color: var(--c-success); }
.stat-card.warning .stat-icon { background: var(--c-warning-50); color: var(--c-warning); }
.stat-card.danger .stat-icon { background: var(--c-danger-50); color: var(--c-danger); }

/* ============================ منوی سه‌نقطه ============================ */
.dropdown-container { position: relative; display: inline-block; }
.dropdown-toggle {
    width: 36px; height: 36px; border-radius: 10px;
    border: 1px solid var(--c-border); background: var(--c-surface); color: var(--c-muted);
    display: grid; place-items: center;
}
.dropdown-toggle:hover { background: var(--c-surface-2); color: var(--c-text); }
.dropdown-menu {
    display: none;
    position: absolute; top: calc(100% + 6px); left: 0; z-index: 70;
    min-width: 210px; margin: 0; padding: .35rem; list-style: none;
    background: var(--c-surface); border: 1px solid var(--c-border-2);
    border-radius: var(--radius); box-shadow: var(--shadow-lg);
    text-align: right;
}
.dropdown-menu.show { display: block; animation: fadeUp .15s var(--ease); }
.dropdown-menu li > form { margin: 0; }
.dropdown-menu li > button, .dropdown-menu li > a, .dropdown-menu li > span, .dropdown-menu li > form > button {
    display: flex; align-items: center; gap: .6rem; width: 100%;
    min-height: 40px; padding: .4rem .7rem; border: 0; border-radius: 9px;
    background: none; color: var(--c-text-2); font-size: .92rem; font-weight: 600; text-align: right;
}
.dropdown-menu li > button:hover, .dropdown-menu li > a:hover, .dropdown-menu li > form > button:hover { background: var(--c-surface-2); color: var(--c-text); }
.dropdown-menu li > form > button { cursor: pointer; }
.dropdown-menu li > form > button:hover { background: var(--c-danger-50); color: var(--c-danger); }
.dropdown-menu li > button i, .dropdown-menu li > a i { width: 18px; text-align: center; color: var(--c-muted); }
.dropdown-menu li.divider { height: 1px; margin: .3rem .2rem; background: var(--c-border-2); }
.dropdown-menu li.disabled > button { color: var(--c-muted); cursor: default; }
.dropdown-menu li.disabled > button:hover { background: none; }
.dropdown-menu li > button[onclick*="delete" i]:hover,
.dropdown-menu li > button[onclick*="remove" i]:hover { background: var(--c-danger-50); color: var(--c-danger); }
.dropdown-backdrop { display: none; }

/* موبایل: منو به شکل برگه پایین صفحه */
@media (max-width: 760px) {
    .dropdown-backdrop { position: fixed; inset: 0; z-index: 65; background: rgba(15, 23, 42, .4); }
    .dropdown-backdrop.show { display: block; }
    .dropdown-menu {
        position: fixed; inset: auto 0 0 0; top: auto; min-width: 0;
        max-height: 75vh; overflow-y: auto;
        padding: .6rem .6rem calc(.8rem + env(safe-area-inset-bottom));
        border-radius: 20px 20px 0 0; border: 0;
    }
    .dropdown-menu.show { animation: sheetUp .22s var(--ease); }
    .dropdown-menu::before {
        content: ""; display: block; width: 40px; height: 4px; margin: .1rem auto .5rem;
        border-radius: 4px; background: var(--c-border);
    }
    .dropdown-menu li > button, .dropdown-menu li > a, .dropdown-menu li > form > button { min-height: 48px; font-size: 1rem; }
}
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }

/* ============================ مودال ============================ */
.modal-overlay {
    position: fixed; inset: 0; z-index: 80;
    display: none; align-items: center; justify-content: center;
    padding: 1rem;
    background: rgba(15, 23, 42, .5); backdrop-filter: blur(3px);
}
.modal-overlay.show { display: flex; animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal-glass {
    position: relative;
    width: 100%; max-width: 560px; max-height: calc(100vh - 2rem); overflow-y: auto;
    padding: 1.3rem 1.3rem 0;
    background: var(--c-surface); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg);
    animation: pop .22s var(--ease);
}
.modal-glass.modal-lg, .modal-glass[style*="700px"] { max-width: 760px; }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-glass > h3 {
    display: flex; align-items: center; gap: .55rem;
    margin: 0 0 1.1rem; padding-bottom: .9rem; padding-left: 2.6rem;
    border-bottom: 1px solid var(--c-border-2); font-size: 1.1rem;
}
.modal-glass > h3 i { color: var(--c-primary); }
.modal-close {
    position: absolute; top: 1rem; left: 1rem;
    width: 36px; height: 36px; border-radius: 10px; border: 0;
    background: var(--c-surface-2); color: var(--c-muted); font-size: 1rem;
}
.modal-close:hover { background: var(--c-border-2); color: var(--c-text); }
/* دکمه‌های پایین مودال همیشه در دید می‌مانند */
.modal-glass .btn-row:last-child, .modal-glass > .btn-row {
    position: sticky; bottom: 0; z-index: 2;
    margin: 1rem -1.3rem 0; padding: .9rem 1.3rem calc(.9rem + env(safe-area-inset-bottom));
    background: linear-gradient(to top, var(--c-surface) 75%, rgba(255, 255, 255, 0));
    border-top: 1px solid var(--c-border-2);
}
.modal-glass > :last-child:not(.btn-row) { margin-bottom: 1.3rem; }

/* موبایل: مودال از پایین صفحه */
@media (max-width: 640px) {
    .modal-overlay { align-items: flex-end; padding: 0; }
    .modal-glass {
        max-width: none; max-height: 92vh; border-radius: 22px 22px 0 0;
        padding: 1rem 1rem 0; animation: sheetUp .25s var(--ease);
    }
    .modal-glass::before {
        content: ""; display: block; width: 40px; height: 4px; margin: -.2rem auto .7rem;
        border-radius: 4px; background: var(--c-border);
    }
    .modal-glass .btn-row:last-child, .modal-glass > .btn-row { margin-inline: -1rem; padding-inline: 1rem; }
    .modal-glass .btn-row .btn { flex: 1; }
    .modal-close { top: .9rem; }
}

/* ============================ ورود و ثبت‌نام ============================ */
.login-screen {
    position: fixed; inset: 0; z-index: 90;
    display: flex; align-items: center; justify-content: center;
    padding: 1rem; overflow-y: auto;
    background:
        radial-gradient(60% 50% at 100% 0%, rgba(99, 102, 241, .35), transparent 70%),
        radial-gradient(50% 50% at 0% 100%, rgba(14, 165, 233, .3), transparent 70%),
        #0f172a;
}
.login-box {
    width: 100%; max-width: 420px;
    padding: 1.6rem 1.3rem 1.3rem;
    background: var(--c-surface); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg);
}
.login-brand { display: flex; flex-direction: column; align-items: center; gap: .6rem; margin-bottom: 1.1rem; text-align: center; }
.login-brand .brand-mark { width: 56px; height: 56px; border-radius: 18px; font-size: 1.5rem; }
.login-box h3 { margin: 0; font-size: 1.25rem; text-align: center; }
.login-box .login-sub { margin: 0; color: var(--c-muted); font-size: .88rem; }
.login-tabs {
    display: grid; grid-template-columns: 1fr 1fr; gap: .3rem;
    padding: .3rem; margin-bottom: 1.1rem;
    border-radius: 14px; background: var(--c-surface-2); border: 1px solid var(--c-border-2);
}
.login-tabs button {
    min-height: 40px; border: 0; border-radius: 11px; background: none;
    font-weight: 800; color: var(--c-muted);
}
.login-tabs button.active { background: var(--c-surface); color: var(--c-primary-600); box-shadow: var(--shadow-sm); }
.login-form, .register-form { display: flex; flex-direction: column; gap: .7rem; }
.login-form input, .register-form input {
    width: 100%; min-height: 48px; padding: .6em 1em;
    border: 1px solid var(--c-border); border-radius: var(--radius);
    background: var(--c-surface-2); font-size: 16px;
    transition: border-color .15s, box-shadow .15s, background .15s;
}
.login-form input:focus, .register-form input:focus { outline: none; background: #fff; border-color: var(--c-primary); box-shadow: var(--ring); }
.login-form .btn, .register-form .btn { min-height: 48px; font-size: 1rem; }
.auth-hint { margin: 0; color: var(--c-muted); font-size: .88rem; line-height: 1.8; }
.auth-links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem; font-size: .88rem; }
.auth-links a { display: inline-flex; align-items: center; gap: .35rem; font-weight: 700; }
.auth-resend { border: 0; background: none; color: var(--c-primary); font-weight: 700; font-size: .88rem; }
.auth-resend:disabled { color: var(--c-muted); }
.login-return-notice {
    display: flex; gap: .5rem; align-items: flex-start;
    padding: .7rem .9rem; margin-bottom: 1rem; border-radius: var(--radius);
    background: var(--c-warning-50); color: #78350f; font-size: .88rem; border: 1px solid #fde68a;
}
.login-back { display: block; margin-top: 1rem; text-align: center; font-size: .88rem; color: var(--c-muted); }

/* ============================ جستجو و انتخاب ============================ */
.search-results {
    max-height: 240px; overflow-y: auto; margin-top: .35rem;
    border-radius: var(--radius); background: var(--c-surface);
}
.search-results:not(:empty) { border: 1px solid var(--c-border); box-shadow: var(--shadow); }
.result-item { padding: .6rem .85rem; cursor: pointer; border-bottom: 1px solid var(--c-border-2); font-size: .93rem; }
.result-item:last-child { border-bottom: 0; }
.result-item:hover { background: var(--c-primary-50); }
.selected-courses:not(:empty) { margin-top: .5rem; }

.day-picker { display: flex; flex-wrap: wrap; gap: .4rem; }
.day-btn {
    min-height: 38px; padding: .3rem .85rem; border-radius: var(--radius-pill);
    border: 1px solid var(--c-border); background: var(--c-surface); color: var(--c-text-2);
    font-weight: 700; font-size: .88rem;
}
.day-btn.active { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }

.capacity-indicator { display: inline-block; padding: .1rem .6rem; border-radius: var(--radius-pill); font-weight: 800; font-size: .82rem; }
.capacity-available { background: var(--c-success-50); color: var(--c-success-600); }
.capacity-full { background: var(--c-danger-50); color: var(--c-danger-600); }

.bulk-user-list { max-height: 50vh; overflow-y: auto; border: 1px solid var(--c-border-2); border-radius: var(--radius); }
.bulk-user-list .user-item, .bulk-user-list > div {
    display: flex; align-items: center; gap: .6rem; padding: .6rem .8rem; border-bottom: 1px solid var(--c-border-2);
}
.bulk-user-list .user-item:last-child { border-bottom: 0; }
.bulk-user-list label { flex: 1; cursor: pointer; font-size: .92rem; line-height: 1.7; }

/* ============================ شخص / مبلغ ============================ */
.person { display: flex; gap: .8rem; align-items: center; padding-bottom: 1rem; margin-bottom: 1rem; border-bottom: 1px solid var(--c-border-2); }
.person-avatar, .person .avatar { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--c-primary-50); color: var(--c-primary); font-size: 1.1rem; flex: none; }
.person-name { font-weight: 800; font-size: 1.05rem; }
.person-meta { color: var(--c-muted); font-size: .85rem; text-align: right; }

.balance { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin: -.2rem 0 1rem; }
.balance > div { padding: .6rem .5rem; border-radius: var(--radius); text-align: center; background: var(--c-surface-2); border: 1px solid var(--c-border-2); }
.balance span { display: block; font-size: .75rem; color: var(--c-muted); }
.balance strong { font-size: .88rem; }
.balance .is-due { background: #fff7ed; border-color: #fed7aa; }
.balance .is-due strong { color: #c2410c; }
.amount-input { font-size: 1.2rem !important; font-weight: 800; letter-spacing: .5px; direction: ltr; text-align: right; }

.info-list { display: grid; gap: .1rem; margin: 0; }
.info-list > div { display: flex; justify-content: space-between; gap: 1rem; padding: .55rem 0; border-bottom: 1px dashed var(--c-border-2); }
.info-list > div:last-child { border-bottom: 0; }
.info-list dt, .info-list .k { color: var(--c-muted); font-size: .9rem; }
.info-list dd, .info-list .v { margin: 0; font-weight: 700; text-align: left; }

.money-due { color: var(--c-danger); font-weight: 800; }
.money-ok { color: var(--c-success); font-weight: 800; }

/* ============================ ویرایشگر توضیحات کامل ============================ */
.fd-modal { max-width: 900px !important; }
.fd-modal .ck-editor__editable { min-height: 320px; max-height: 60vh; }
.fd-hint { color: var(--c-muted); font-size: .85rem; margin-bottom: .6rem; }

/* ============================ نوار پایین موبایل ============================ */
.bottom-nav {
    position: fixed; inset-inline: 0; bottom: 0; z-index: 45;
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    height: calc(var(--bottomnav-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: rgba(255, 255, 255, .96); backdrop-filter: blur(12px);
    border-top: 1px solid var(--c-border-2);
    box-shadow: 0 -6px 20px rgba(15, 23, 42, .06);
}
.bottom-nav a, .bottom-nav button {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .15rem;
    border: 0; background: none; color: var(--c-muted);
    font-size: .7rem; font-weight: 700; text-decoration: none; cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.bottom-nav i { font-size: 1.15rem; transition: transform .15s; }
.bottom-nav .active { color: var(--c-primary); }
.bottom-nav .active i { transform: translateY(-2px); }

/* ============================ دسکتاپ ============================ */
@media (min-width: 1024px) {
    .sidebar { transform: none; box-shadow: none; }
    .sidebar-overlay, .sidebar-close, .menu-toggle, .bottom-nav { display: none !important; }
    .topbar, .header-nav, .main, .site-footer-panel { margin-right: var(--sidebar-w); }
    .main { max-width: none; padding: 1.8rem 2rem 2.5rem; }
    .main > * { max-width: 1240px; margin-inline: auto; }
    .topbar { padding: 0 2rem; }
}

/* نمایشگرهای بزرگ: جدول‌ها و کارت‌ها از عرض صفحه بیشتر استفاده کنند */
@media (min-width: 1600px) {
    .main > * { max-width: 1480px; }
}

/* پوشش‌های تمام‌صفحه (ورود، مودال، پس‌زمینه منو) داخل .main قرار دارند؛
   قاعده بالا عرضشان را محدود می‌کرد و در نمایشگر بزرگ، ساید‌بار و نوار بالا
   از کنارشان بیرون می‌زد. این‌ها همیشه باید کل صفحه را بپوشانند. */
.login-screen, .modal-overlay, .dropdown-backdrop {
    max-width: none;
    margin: 0;
}

/* ============================ تقویم جلسات (پنل استاد) ============================ */
.cal-header { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .8rem; }
.cal-title { font-weight: 800; font-size: 1.05rem; }
.cal-nav-btn { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--c-border); background: var(--c-surface); }
.cal-weekdays, .cal-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: .35rem; }
.cal-weekday { text-align: center; font-size: .75rem; font-weight: 800; color: var(--c-muted); padding: .3rem 0; }
.cal-day {
    position: relative; aspect-ratio: 1 / 1; min-height: 40px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    border-radius: 12px; border: 1px solid var(--c-border-2); background: var(--c-surface);
    font-weight: 700; font-size: .9rem; cursor: pointer; transition: background .15s, border-color .15s;
}
.cal-day:hover { border-color: var(--c-primary-100); background: var(--c-primary-50); }
.cal-day.empty { visibility: hidden; }
.cal-day.course-day { border-color: var(--c-primary-100); background: var(--c-primary-50); color: var(--c-primary-700); }
.cal-day.held, .cal-day.green { background: var(--c-success-50); border-color: #bbf7d0; color: var(--c-success-600); }
.cal-day.red { background: var(--c-danger-50); border-color: #fecaca; color: var(--c-danger-600); }
.cal-day.today { box-shadow: inset 0 0 0 2px var(--c-primary); }
.cal-day-num { line-height: 1.2; }
.cal-day-badge { font-size: .6rem; font-weight: 800; line-height: 1.2; }
.cal-legend { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: .8rem; font-size: .8rem; color: var(--c-muted); }
.cal-legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-left: .3rem; vertical-align: middle; }
.course-completed-banner {
    display: flex; align-items: center; gap: .6rem; padding: .9rem 1rem; margin-bottom: 1rem;
    border-radius: var(--radius); background: var(--c-success-50); color: #14532d; border: 1px solid #bbf7d0; font-weight: 700;
}

/* ============================ چاپ ============================ */
@media print {
    .sidebar, .sidebar-overlay, .topbar, .header-nav, .bottom-nav, .dropdown-container, .btn { display: none !important; }
    .main { margin: 0 !important; padding: 0 !important; }
    body { background: #fff; }
}

/* ============================ برنامه کلاسی (مودال) ============================ */
.week-list { display: grid; gap: .75rem; }
@media (min-width: 640px) { .week-list { grid-template-columns: repeat(2, 1fr); } }
.week-day { padding: .8rem; border-radius: var(--radius); background: var(--c-surface-2); border: 1px solid var(--c-border-2); }
.week-day h4 { margin: 0 0 .5rem; font-size: .95rem; color: var(--c-primary-700); }
.week-item { display: flex; justify-content: space-between; gap: .5rem; padding: .45rem .6rem; margin-top: .35rem; border-radius: 10px; background: var(--c-surface); font-size: .9rem; }
.week-item span { color: var(--c-muted); white-space: nowrap; }

/* ============================ دو ستونه (پرونده، فرم + جزئیات) ============================ */
.split { display: grid; gap: 1rem; align-items: start; }
.split > div > .card + .card { margin-top: 1rem; }
@media (min-width: 960px) { .split { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); } }
.form-group input[readonly] { background: var(--c-surface-2); color: var(--c-text-2); }
