/* ==========================================================================
   ظ…ط¯ط±ط³ظ‡ غŒط§ط± â€” ط³غŒط³طھظ… ط·ط±ط§ط­غŒ
   ط±ط§ط³طھâ€Œط¨ظ‡â€Œع†ظ¾طŒ ط§ظ¾ظ„غŒع©غŒط´ظ†غŒ ظˆ ع©ط§ط±طھâ€Œظ…ط­ظˆط±طŒ ط¨ط§ ظ¾ط§ظ„طھ ط³ط¨ط² ط§ظ¾ظ„غŒع©غŒط´ظ† ط´ط§ط¯.
   ط¨ط¯ظˆظ† ظ†غŒط§ط² ط¨ظ‡ ط§ط¨ط²ط§ط± build.
   ========================================================================== */

/* فونت محلی Vazirmatn (نسخهٔ متغیر) — بدون وابستگی به CDN و آماده برای آفلاین */
@font-face {
    font-family: Vazirmatn;
    src: url('../fonts/vazirmatn/Vazirmatn-Variable.woff2') format('woff2');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

/*
 * ظ¾ط§ظ„طھ ط±ظ†ع¯غŒ ط¨ط± ظ¾ط§غŒظ‡ظ” ط§ظ¾ظ„غŒع©غŒط´ظ† ط´ط§ط¯: ط³ط¨ط² ط§ظ¾ظ„غŒع©غŒط´ظ†غŒ + ط³ظپغŒط¯ + ط®ط§ع©ط³طھط±غŒ ط±ظˆط´ظ†.
 * ظ‡ظ…ظ‡ظ” ط§ط¬ط²ط§ ط§ط² ظ‡ظ…غŒظ† ظ…طھط؛غŒط±ظ‡ط§ ط±ظ†ع¯ ظ…غŒâ€Œع¯غŒط±ظ†ط¯طŒ ظ¾ط³ طھط؛غŒغŒط± ط¨ط±ظ†ط¯ طھظ†ظ‡ط§ ط§ط² ظ‡ظ…غŒظ†â€Œط¬ط§ ط§ظ†ط¬ط§ظ… ظ…غŒâ€Œط´ظˆط¯.
 */
:root {
    --bg: #f2f5f7;
    --surface: #ffffff;
    --surface-2: #f6f8fa;
    --border: #e8edf1;
    --border-strong: #dce3e9;

    --text: #16232e;
    --text-2: #4a5b68;
    --muted: #65737f;

    --primary: #12b76a;
    --primary-2: #0b9e5c;
    --primary-strong: #097f49;
    --accent-text: #097f49;
    --primary-soft: #e7f8ef;
    --gradient: linear-gradient(135deg, #14c078 0%, #0d9f61 100%);
    --gradient-strong: linear-gradient(135deg, #097f49 0%, #066b3c 100%);
    --gradient-soft: linear-gradient(135deg, #eafaf1 0%, #f4fdf8 100%);
    --ring: rgba(18, 183, 106, .18);
    --shadow-brand: 0 10px 24px rgba(18, 183, 106, .26);

    --blue: #2e90fa;
    --blue-soft: #e7f2ff;
    --green: #12b76a;
    --green-soft: #e7f8ef;
    --amber: #f79009;
    --amber-soft: #fff4e5;
    --red: #f04438;
    --red-soft: #feeceb;

    --radius: 20px;
    --radius-sm: 14px;
    --radius-pill: 999px;
    --shadow: 0 2px 10px rgba(16, 32, 48, .05);
    --shadow-lg: 0 16px 40px rgba(16, 32, 48, .12);
    --sidebar-w: 264px;

    /* ط§ظ†ط¯ط§ط²ظ‡ظ” ظ†ظˆط§ط± ط¨ط§ظ„ط§/ظ¾ط§غŒغŒظ† ط§ظ¾ظ„غŒع©غŒط´ظ†غŒ */
    --topbar-h: 62px;
    --bottomnav-h: 62px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Vazirmatn, 'Segoe UI', Tahoma, sans-serif;
    font-size: 14px;
    line-height: 1.8;
    direction: rtl;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
h1, h2, h3, h4, h5 { margin: 0 0 .4rem; font-weight: 700; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .6rem; }
img { max-width: 100%; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #cfd6e4; border-radius: 8px; }

/* ------------------------------------------------------------ ع†غŒط¯ظ…ط§ظ† ع©ظ„غŒ */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    flex: 0 0 var(--sidebar-w);
    background: var(--surface);
    border-left: 1px solid var(--border);
    padding: 18px 14px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 40;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px 18px;
}

.brand-logo {
    width: 42px; height: 42px;
    border-radius: 14px;
    background: var(--gradient-strong);
    display: grid; place-items: center;
    color: #fff; font-weight: 800; font-size: 18px;
    box-shadow: var(--shadow-brand);
}

.brand-name { font-weight: 800; font-size: 1rem; }
.brand-sub { font-size: .72rem; color: var(--muted); }

.nav-group { margin-bottom: 14px; }
.nav-group-title {
    font-size: .7rem; color: var(--muted);
    padding: 6px 12px; font-weight: 700; letter-spacing: .2px;
}

.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-2);
    font-weight: 600; font-size: .86rem;
    transition: .18s;
    margin-bottom: 2px;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--gradient-soft); color: var(--primary); }
.nav-item .ico { width: 20px; text-align: center; font-size: 15px; opacity: .9; }
.nav-item .count {
    margin-inline-start: auto;
    background: var(--red-soft); color: var(--red);
    border-radius: var(--radius-pill);
    padding: 0 8px; font-size: .7rem; font-weight: 700;
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    position: sticky; top: 0; z-index: 30;
    background: rgba(244, 246, 251, .88);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    padding: 12px 22px;
    display: flex; align-items: center; gap: 14px;
}
.topbar-title { font-weight: 800; font-size: 1.05rem; }
.topbar-sub { font-size: .74rem; color: var(--muted); }

.content { padding: 20px 22px 90px; flex: 1; }

.burger {
    display: none;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: 12px;
    width: 40px; height: 40px;
    font-size: 18px; cursor: pointer;
}

/* ---------------------------------------------------------------- ع©ط§ط±طھâ€Œظ‡ط§ */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.card + .card { margin-top: 16px; }
.card-head {
    padding: 14px 18px;
    display: flex; align-items: center; gap: 10px;
    border-bottom: 1px solid var(--border);
}
.card-head h2, .card-head h3 { margin: 0; }
.card-head .spacer { margin-inline-start: auto; }
.card-body { padding: 18px; }
.card-body.tight { padding: 12px; }

/* --------------------------------------------------------- ع©ط§ط±طھ ط¢ظ…ط§ط±غŒ */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
}
.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px;
    display: flex; align-items: center; gap: 12px;
}
.stat-ico {
    width: 46px; height: 46px; flex: 0 0 46px;
    border-radius: 14px;
    display: grid; place-items: center;
    background: var(--surface-2); color: var(--primary);
}
/* کاشی آیکون تک‌رنگ: زمینهٔ ملایم همان تن + آیکون یک‌رنگ همان تن (بدون گرادیان) */
.stat-ico.grad { background: var(--primary-soft); color: var(--primary); }
.stat-ico.blue { background: var(--blue-soft); color: var(--blue); }
.stat-ico.green { background: var(--green-soft); color: var(--green); }
.stat-ico.amber { background: var(--amber-soft); color: var(--amber); }
.stat-ico.red { background: var(--red-soft); color: var(--red); }
.stat-ico.muted { background: var(--surface-2); color: var(--muted); }
.stat-value { font-size: 1.35rem; font-weight: 800; line-height: 1.3; }
.stat-label { font-size: .76rem; color: var(--muted); }

/* ------------------------------------------------------------- ط¯ع©ظ…ظ‡â€Œظ‡ط§ */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    border: 1px solid transparent;
    border-radius: var(--radius-pill);
    padding: 9px 18px;
    font-family: inherit; font-size: .84rem; font-weight: 700;
    cursor: pointer; transition: .18s; white-space: nowrap;
}
.btn-primary { background: var(--gradient-strong); color: #fff; box-shadow: var(--shadow-brand); }
.btn-primary:hover { filter: brightness(1.05); transform: translateY(-1px); }
.btn-light { background: var(--surface); border-color: var(--border); color: var(--text-2); }
.btn-light:hover { border-color: var(--primary); color: var(--primary); }
.btn-blue { background: var(--blue-soft); color: var(--blue); }
.btn-green { background: var(--green-soft); color: var(--green); }
.btn-danger { background: var(--red-soft); color: var(--red); }
.btn-sm { padding: 6px 13px; font-size: .76rem; }
.btn-icon { width: 38px; height: 38px; padding: 0; border-radius: 12px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* --------------------------------------------------------------- ط¨ط±ع†ط³ط¨ */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    border-radius: var(--radius-pill);
    padding: 2px 11px;
    font-size: .72rem; font-weight: 700;
    background: var(--surface-2); color: var(--text-2);
}
.badge.success { background: var(--green-soft); color: #047857; }
.badge.danger { background: var(--red-soft); color: #b91c1c; }
.badge.warning { background: var(--amber-soft); color: #b45309; }
.badge.info { background: var(--blue-soft); color: #0369a1; }
.badge.grad { background: var(--gradient-strong); color: #fff; }
.badge.muted { background: #eef1f7; color: var(--muted); }

/* ------------------------------------------------------- ع†غŒظ¾ ظ…ظ‡ط§ط±طھâ€Œظ‡ط§ */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    border-radius: var(--radius-pill);
    padding: 7px 16px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    font-size: .78rem; font-weight: 700; color: var(--text-2);
}
.chip.active { background: var(--primary-soft); border-color: transparent; color: var(--primary); }

/* ------------------------------------------------------------- ظ„غŒط³طھâ€Œظ‡ط§ */
.list { display: flex; flex-direction: column; }
.list-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 4px;
    border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: 0; }
.list-item .title { font-weight: 700; font-size: .88rem; }
.list-item .sub { font-size: .74rem; color: var(--muted); }
.list-item .trail { margin-inline-start: auto; text-align: left; }

.avatar {
    width: 42px; height: 42px; flex: 0 0 42px;
    border-radius: 50%;
    background: var(--gradient-soft);
    color: var(--primary);
    display: grid; place-items: center;
    font-weight: 800; font-size: .85rem;
    border: 1px solid var(--border);
}
.avatar.big { width: 64px; height: 64px; flex-basis: 64px; font-size: 1.2rem; }

/* ---------------------------------------------------------------- ط¬ط¯ظˆظ„ */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); }
table.tbl { width: 100%; border-collapse: collapse; font-size: .84rem; }
table.tbl thead th {
    background: var(--surface-2);
    color: var(--text-2);
    text-align: right;
    font-weight: 700; font-size: .78rem;
    padding: 11px 12px;
    white-space: nowrap;
    border-bottom: 1px solid var(--border);
}
table.tbl tbody td {
    padding: 11px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
table.tbl tbody tr:hover { background: var(--surface-2); }
table.tbl tbody tr:last-child td { border-bottom: 0; }
table.tbl .num { font-variant-numeric: tabular-nums; }
.actions { display: flex; gap: 5px; justify-content: flex-start; }
.m-open,
.m-more,
.m-avatar { display: none; }

/* ------------------------------------------------------------ ظپط±ظ…â€Œظ‡ط§ */
.form-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 14px; }

/* فرم‌های بلند: فیلدهای اختیاری اضافی در موبایل جمع می‌شوند */
.form-extra {
    margin-top: var(--sp-4);
    padding-top: var(--sp-3);
    border-top: 1px solid var(--border);
}
.form-extra > summary {
    display: flex;
    align-items: center;
    gap: 7px;
    min-height: 44px;
    color: var(--text-2);
    font-size: var(--fs-sm);
    font-weight: 700;
    cursor: pointer;
    list-style: none;
    -webkit-user-select: none;
    user-select: none;
}
.form-extra > summary::-webkit-details-marker { display: none; }
.form-extra > summary .mico { flex: 0 0 auto; color: var(--primary); transition: transform .18s; }
.form-extra[open] > summary .mico { transform: rotate(180deg); }
.form-extra > summary .badge { margin-inline-start: auto; }
.form-extra > .form-grid { margin-top: var(--sp-3); }
.col-1 { grid-column: span 1; } .col-2 { grid-column: span 2; }
.col-3 { grid-column: span 3; } .col-4 { grid-column: span 4; }
.col-5 { grid-column: span 5; } .col-6 { grid-column: span 6; }
.col-7 { grid-column: span 7; } .col-8 { grid-column: span 8; }
.col-9 { grid-column: span 9; } .col-10 { grid-column: span 10; }
.col-12 { grid-column: span 12; }

.field { display: flex; flex-direction: column; gap: 5px; }
.field > label { font-size: .78rem; font-weight: 700; color: var(--text-2); }
.field .hint { font-size: .72rem; color: var(--muted); }
.req { color: var(--red); }

input[type=text], input[type=number], input[type=email], input[type=password],
input[type=date], input[type=time], input[type=tel], input[type=url], input[type=color],
select, textarea {
    width: 100%;
    font-family: inherit; font-size: .85rem;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 9px 12px;
    transition: .16s;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--ring);
}
input[type=color] { padding: 3px; height: 40px; }
.invalid { border-color: var(--red) !important; }
.error-text { color: var(--red); font-size: .73rem; font-weight: 600; }

.check { display: flex; align-items: center; gap: 8px; font-size: .84rem; }
.check input { width: auto; }

/* ------------------------------------------------------------ ظ‡ط´ط¯ط§ط±ظ‡ط§ */
.alert {
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    font-size: .84rem; font-weight: 600;
    margin-bottom: 14px;
    border: 1px solid transparent;
}
.alert.success { background: var(--green-soft); color: #065f46; }
.alert.error { background: var(--red-soft); color: #991b1b; }
.alert.info { background: var(--blue-soft); color: #075985; }
.alert.warning { background: var(--amber-soft); color: #92400e; }

/* ----------------------------------------------------------- ظ†ط§ظˆط¨ط±غŒ طھط¨ */
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.tab {
    padding: 8px 16px; border-radius: var(--radius-pill);
    background: var(--surface); border: 1px solid var(--border);
    font-size: .8rem; font-weight: 700; color: var(--text-2); cursor: pointer;
    white-space: nowrap;
}
.tab.active { background: var(--gradient-strong); color: #fff; border-color: transparent; }

/* ------------------------------------------------------------- ظ¾غŒط´ط±ظپطھ */
.progress { height: 8px; background: #eef1f7; border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--gradient-strong); border-radius: 999px; }

/* ------------------------------------------------------------ طµظپط­ظ‡â€Œط¨ظ†ط¯غŒ */
.pagination-wrap { margin-top: 14px; display: flex; justify-content: center; }
.pagination-wrap nav { width: 100%; }
.pagination-wrap .pager-block { width: 100%; }
.pager-block { width: 100%; }
.pagination-wrap ul, .pagination {
    display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0; justify-content: center;
}
.pagination li span, .pagination li a, .pagination a, .pagination span {
    display: inline-block;
    min-width: 34px; text-align: center;
    padding: 5px 10px;
    border-radius: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    font-size: .8rem; color: var(--text-2);
}
.pagination .active span, .pagination span[aria-current=page] {
    background: var(--gradient-strong); color: #fff; border-color: transparent;
}

/* ------------------------------------------------------- ط­ط§ظ„طھ ط®ط§ظ„غŒ */
.empty { text-align: center; padding: 44px 18px; color: var(--muted); }
.empty .big { font-size: 40px; opacity: .5; margin-bottom: 8px; }

/* ------------------------------------------------------ ظ…ظ†ظˆغŒ ع©ط§ط±ط¨ط± */
.dropdown { position: relative; }
.dropdown-toggle { cursor: pointer; border: 0; background: transparent; font-family: inherit; }
.dropdown-menu {
    position: absolute; top: calc(100% + 8px); inset-inline-end: 0;
    min-width: 210px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    display: none;
    z-index: 50;
}
.dropdown.open .dropdown-menu { display: block; }
.dropdown-menu a, .dropdown-menu button {
    display: flex; align-items: center; gap: 8px;
    width: 100%; padding: 9px 11px;
    border: 0; background: transparent; font-family: inherit;
    border-radius: 10px; font-size: .82rem; font-weight: 600; color: var(--text-2);
    cursor: pointer; text-align: right;
}
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--surface-2); color: var(--text); }
.dropdown-menu .sep { height: 1px; background: var(--border); margin: 5px 0; }

/* ------------------------------------------------ ظ†ط§ظˆط¨ط±غŒ ظ¾ط§غŒغŒظ† (ظ…ظˆط¨ط§غŒظ„) */
.bottom-nav {
    display: none;
    position: fixed; bottom: 0; inset-inline: 0; z-index: 60;
    background: var(--surface);
    border-top: 1px solid var(--border);
    box-shadow: 0 -6px 20px rgba(15, 23, 42, .06);
    padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
}
.bottom-nav ul {
    display: flex; list-style: none; margin: 0; padding: 0;
}
.bottom-nav li { flex: 1; }
.bottom-nav a {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    font-size: .66rem; font-weight: 700; color: var(--muted);
    padding: 4px 0;
}
.bottom-nav a .ico { font-size: 17px; }
.bottom-nav a.active { color: var(--primary); }

/* ---------------------------------------------------------- ط§ط¨ط²ط§ط±ظ‡ط§ */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.text-sm { font-size: .78rem; }
.text-xs { font-size: .72rem; }
.bold { font-weight: 800; }
.big-num { font-size: 1.6rem; font-weight: 800; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 20px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 6px; } .mb-2 { margin-bottom: 12px; }
.mb-3 { margin-bottom: 20px; }
.grow { flex: 1; }
.hero {
    background: var(--gradient-strong);
    color: #fff;
    border-radius: var(--radius);
    padding: 20px 22px;
    box-shadow: var(--shadow-brand);
}
.hero h1 { font-size: 1.25rem; margin-bottom: 2px; }
.hero p { opacity: .9; margin: 0; font-size: .84rem; }
.hero .badge { background: rgba(255, 255, 255, .2); color: #fff; }

.grade-pill {
    display: inline-grid; place-items: center;
    min-width: 46px;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    font-weight: 800; font-size: .82rem;
    background: var(--green-soft); color: #047857;
}
.grade-pill.mid { background: var(--amber-soft); color: #b45309; }
.grade-pill.low { background: var(--red-soft); color: #b91c1c; }

/*
 * طھطµط­غŒط­ ط¯ط³طھغŒ ط¢ط²ظ…ظˆظ† (طµظپط­ظ‡ظ” quizzes/grading).
 * ظ‡ط± ظ¾ط§ط³ط® طھط´ط±غŒط­غŒ ط¯ط± غŒع© ط¬ط¹ط¨ظ‡ظ” ط¬ط¯ط§ ط¨ط§ ظ†ظ…ط±ظ‡ ظˆ ط¨ط§ط²ط®ظˆط±ط¯ ظ†ظ…ط§غŒط´ ط¯ط§ط¯ظ‡ ظ…غŒâ€Œط´ظˆط¯.
 */
.grade-box {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    margin-bottom: 12px;
    background: var(--surface-2);
}
.answer-text {
    border-inline-start: 3px solid var(--primary);
    background: #fff;
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    font-size: .86rem;
    line-height: 1.9;
    white-space: pre-wrap;
    word-break: break-word;
}
.ok { color: #047857; font-weight: 700; }
.bad { color: #b91c1c; font-weight: 700; }

/* ------------------------------------------- نوار حالت سخت‌گیرانهٔ آزمون */
.proctor-bar {
    display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
    background: #fff7ed;
    border: 1px solid #fdba74;
    border-inline-start: 4px solid #f97316;
    border-radius: var(--radius-sm);
    padding: 9px 13px;
    margin-bottom: 14px;
    font-size: .8rem;
    color: #7c2d12;
}
.proctor-bar b { color: #9a3412; }
.proctor-note {
    display: inline-block;
    background: #fee2e2; color: #991b1b;
    border-radius: var(--radius-pill);
    padding: 3px 10px; font-weight: 700;
}

/* ------------------------------------------------ پاسخ تشریحی: عکس برگه */.essay-upload {
    display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
    margin-top: 10px; padding: 10px 12px;
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
}
.essay-previews { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; }
.essay-chip {
    display: flex; align-items: center; gap: 7px;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: #fff; padding: 5px 8px; max-width: 100%;
}
.essay-chip img {
    width: 42px; height: 42px; object-fit: cover;
    border-radius: 8px; display: block;
}
.essay-chip > span:last-child {
    max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* نمایش عکس برگه در صفحهٔ تصحیح و کارنامه */
.answer-files { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.answer-file {
    display: block; border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: #fff; overflow: hidden; text-decoration: none; color: inherit;
}
.answer-file img {
    display: block; width: 148px; height: 110px; object-fit: cover;
}
.answer-file .cap {
    display: block; padding: 5px 8px; font-size: .7rem;
    max-width: 148px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.answer-file .ico {
    display: block; width: 148px; height: 110px;
    display: flex; align-items: center; justify-content: center;
    font-size: 34px; background: var(--surface-2);
}

.timeline { position: relative; padding-inline-start: 18px; }
.timeline::before {
    content: ''; position: absolute; inset-inline-start: 5px; top: 6px; bottom: 6px;
    width: 2px; background: var(--border);
}
.timeline .tl-item { position: relative; padding: 0 0 16px; }
.timeline .tl-item::before {
    content: ''; position: absolute; inset-inline-start: -18px; top: 9px;
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--primary); border: 2px solid #fff;
}

/* ط§ظ†طھط®ط§ط¨â€Œع¯ط± ط¬ط³طھâ€Œظˆط¬ظˆظ¾ط°غŒط± */
.searchable { position: relative; }
.searchable input { padding-inline-start: 12px; }
.searchable-list {
    position: absolute; z-index: 45; inset-inline: 0; top: calc(100% + 4px);
    max-height: 240px; overflow-y: auto;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
    display: none;
}
.searchable.open .searchable-list { display: block; }
.searchable-list button {
    display: block; width: 100%; text-align: right;
    padding: 8px 12px; border: 0; background: transparent;
    font-family: inherit; font-size: .82rem; cursor: pointer;
}
.searchable-list button:hover { background: var(--surface-2); }

/* ع†ط§ظ¾ (ع©ط§ط±ظ†ط§ظ…ظ‡طŒ ع¯ظˆط§ظ‡غŒطŒ طµظˆط±طھâ€Œط­ط³ط§ط¨) */
@media print {
    .sidebar, .topbar, .bottom-nav, .no-print { display: none !important; }
    .content { padding: 0; }
    body { background: #fff; }
    .card { box-shadow: none; border-color: #ddd; }
    .app-shell { display: block; }
}

/* ------------------------------------------------------------- ظˆط§ع©ظ†ط´â€Œع¯ط±ط§ */
@media (max-width: 1100px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
    .sidebar {
        position: fixed; inset-block: 0; inset-inline-start: 0;
        transform: translateX(100%);
        transition: transform .22s ease;
        box-shadow: var(--shadow-lg);
    }
    body.nav-open .sidebar { transform: translateX(0); }
    body.nav-open { overflow: hidden; }
    body.nav-open::after {
        content: ''; position: fixed; inset: 0; z-index: 35;
        background: rgba(15, 23, 42, .35);
    }
    .burger { display: grid; place-items: center; }
    .content { padding: 16px 14px 96px; }
    .topbar { padding: 10px 14px; }
    .bottom-nav { display: block; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }

    /*
     * ط¯ط± ظ…ظˆط¨ط§غŒظ„ ظ‡ط± ظپغŒظ„ط¯ ظپط±ظ… طھظ…ط§ظ…â€Œط¹ط±ط¶ ظ…غŒâ€Œط´ظˆط¯.
     * ظ†ع©طھظ‡: ع©ظ„ط§ط³ ظˆط§ظ‚ط¹غŒ ظپغŒظ„ط¯ظ‡ط§ آ«field col-6آ» ط§ط³طھطŒ ظ¾ط³ ط§ظ†طھط®ط§ط¨ع¯ط± ط¨ط§غŒط¯
     * [class*="col-"] ط¨ط§ط´ط¯ ظˆ ظ†ظ‡ [class^=col-] (ظˆع¯ط±ظ†ظ‡ ظ‚ط§ط¹ط¯ظ‡ ط§ط¹ظ…ط§ظ„ ظ†ظ…غŒâ€Œط´ظˆط¯).
     */
    .form-grid > [class*="col-"] { grid-column: span 12; }
    .form-grid { gap: 12px; }
}

/* ==========================================================================
   ط§طµظ„ط§ط­ ع†غŒط¯ظ…ط§ظ† ظ‡ط¯ط± (ط¯ط³ع©طھط§ظ¾ ظˆ ظ…ظˆط¨ط§غŒظ„)
   ========================================================================== */
.topbar { min-height: 64px; gap: 10px; }

/* ط¨ط®ط´ ط¹ظ†ظˆط§ظ† ط¨ط§غŒط¯ ط¨طھظˆط§ظ†ط¯ ع©ظˆع†ع© ط´ظˆط¯ طھط§ ط¨ظ‚غŒظ‡ظ” ط§ط¬ط²ط§ ط¯ط± ط¹ط±ط¶ ع©ظ… ط¬ط§ ط´ظˆظ†ط¯ */
.topbar > .grow { min-width: 0; }
.topbar-title,
.topbar-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.topbar .avatar { width: 36px; height: 36px; flex-basis: 36px; font-size: .78rem; }
.topbar .school-badge { max-width: 200px; overflow: hidden; text-overflow: ellipsis; }
.topbar .dropdown-toggle.btn { padding: 7px 12px; }

/* ==========================================================================
   ظ¾غŒط§ظ…â€Œط±ط³ط§ظ†
   ========================================================================== */

/* طµظپط­ظ‡ظ” ع¯ظپطھع¯ظˆ: طھظ…ط§ظ…â€Œظ‚ط¯ ظˆ ط¨ط¯ظˆظ† ط§ط³ع©ط±ظˆظ„ طµظپط­ظ‡ (ط§ط³ع©ط±ظˆظ„ ط¯ط§ط®ظ„ ط¨ط¯ظ†ظ‡ظ” ع¯ظپطھع¯ظˆ) */
body.chat-page .app-shell { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
body.chat-page .content {
    display: flex; flex-direction: column;
    min-height: 0; padding: 18px 22px 20px;
}
body.chat-page .content > .chat-page-wrap {
    flex: 1; min-height: 0;
    display: flex; flex-direction: column;
}

.chat {
    flex: 1; min-height: 0;
    display: flex; flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

/* ---------------------------------------------------- ط³ط±طµظپط­ظ‡ظ” ع¯ظپطھع¯ظˆ */
.chat-head {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.chat-back {
    width: 38px; height: 38px; flex: 0 0 38px;
    display: grid; place-items: center;
    border-radius: 50%; border: 1px solid var(--border);
    background: var(--surface); color: var(--text-2);
    font-size: 20px; line-height: 1; cursor: pointer;
}
.chat-back:hover { border-color: var(--primary); color: var(--primary); }
.chat-head .avatar { width: 40px; height: 40px; flex-basis: 40px; }
.chat-name { font-weight: 800; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-status { font-size: .72rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-status.online { color: var(--green); font-weight: 600; }

/* ------------------------------------------------------- ط¨ط¯ظ†ظ‡ظ” ع¯ظپطھع¯ظˆ */
.chat-body {
    flex: 1; min-height: 0; overflow-y: auto;
    padding: 16px 14px 10px;
    overscroll-behavior: contain;
    background:
        radial-gradient(circle at 18% 26%, rgba(18, 183, 106, .06) 0 2px, transparent 3px) 0 0 / 30px 30px,
        radial-gradient(circle at 72% 68%, rgba(46, 144, 250, .05) 0 2px, transparent 3px) 15px 15px / 30px 30px,
        var(--surface-2);
}

/* ط¬ط¯ط§ع©ظ†ظ†ط¯ظ‡ظ” ط±ظˆط² */
.chat-day { display: flex; justify-content: center; margin: 14px 0 10px; }
.chat-day span {
    background: rgba(255, 255, 255, .94);
    border: 1px solid var(--border);
    color: var(--muted);
    font-size: .68rem; font-weight: 700;
    padding: 2px 14px; border-radius: var(--radius-pill);
    box-shadow: 0 1px 3px rgba(15, 23, 42, .05);
}

/* --------------------------------------------------------- ط­ط¨ط§ط¨ ظ¾غŒط§ظ… */
.msg { display: flex; align-items: flex-end; gap: 8px; margin-bottom: 4px; }
.msg.mine { justify-content: flex-end; }
.msg .avatar { width: 30px; height: 30px; flex-basis: 30px; font-size: .62rem; margin-bottom: 2px; }
.msg.mine .avatar { display: none; }

.msg .bubble {
    position: relative;
    max-width: min(78%, 560px);
    padding: 8px 13px 5px;
    border-radius: 18px;
    border-end-start-radius: 6px;
    font-size: .85rem; line-height: 1.9;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
    overflow-wrap: anywhere;
}
.msg.mine .bubble {
    border-end-start-radius: 18px;
    border-end-end-radius: 6px;
    background: var(--gradient-strong);
    border-color: transparent;
    color: #fff;
    box-shadow: var(--shadow-brand);
}
.msg .who { font-size: .7rem; font-weight: 800; color: var(--primary); margin-bottom: 1px; }
.msg .text { white-space: pre-wrap; }
.msg .meta {
    display: flex; align-items: center; gap: 5px;
    justify-content: flex-start;
    margin-top: 1px; font-size: .63rem; color: var(--muted);
}
.msg.mine .meta { justify-content: flex-end; color: rgba(255, 255, 255, .85); }
.msg .ticks { font-size: .72rem; letter-spacing: -3px; }
.msg .ticks.read { color: #d7fbe9; }

.msg .attach { display: block; margin: 4px 0 2px; }
.msg .attach img { max-width: 240px; width: 100%; border-radius: 12px; display: block; }
.msg .attach a { font-size: .75rem; text-decoration: underline; }

.msg .del {
    position: absolute; inset-block-start: -7px; inset-inline-start: -7px;
    width: 22px; height: 22px; border-radius: 50%;
    display: grid; place-items: center;
    border: 1px solid var(--border); background: var(--surface);
    color: var(--red); font-size: .7rem; font-weight: 800;
    cursor: pointer; opacity: 0; transition: opacity .16s;
}
.msg:hover .del, .msg:focus-within .del { opacity: 1; }

/* ظ¾غŒط§ظ… ط¯ط± ط­ط§ظ„ ط§ط±ط³ط§ظ„ (ظ†ظ…ط§غŒط´ ط®ظˆط´â€Œط¨غŒظ†ط§ظ†ظ‡) */
.msg.pending .bubble { opacity: .6; }

/* ط­ط§ظ„طھ ط®ط§ظ„غŒ */
.chat-empty { text-align: center; padding: 48px 18px; color: var(--muted); }
.chat-empty .big { font-size: 42px; opacity: .45; margin-bottom: 6px; }

/* -------------------------------------------------------- ظ†ظˆط§ط± ظ†ظˆط´طھظ† */
.chat-compose {
    display: flex; align-items: flex-end; gap: 8px;
    padding: 8px 10px;
    background: var(--surface);
    border-top: 1px solid var(--border);
}
.chat-compose textarea {
    min-height: 42px; max-height: 132px;
    resize: none; border-radius: 21px;
    padding: 9px 15px;
    background: var(--surface-2);
}
.chat-compose .compose-btn {
    width: 42px; height: 42px; flex: 0 0 42px;
    display: grid; place-items: center;
    border-radius: 50%; border: 1px solid var(--border);
    background: var(--surface-2); color: var(--text-2);
    font-size: 17px; cursor: pointer; transition: .16s;
}
.chat-compose .compose-btn:hover { border-color: var(--primary); color: var(--primary); }
.chat-compose .compose-send {
    width: 46px; height: 46px; flex: 0 0 46px;
    display: grid; place-items: center;
    border: 0; border-radius: 50%;
    background: var(--gradient-strong); color: #fff;
    font-size: 18px; cursor: pointer;
    box-shadow: var(--shadow-brand);
    transition: .16s;
}
.chat-compose .compose-send:hover { transform: translateY(-1px); }
.chat-compose .compose-send:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* طھط±ط§ط´ظ‡ظ” ظ¾غŒظˆط³طھ ط¢ظ…ط§ط¯ظ‡ظ” ط§ط±ط³ط§ظ„ */
.attach-chip {
    display: flex; align-items: center; gap: 8px;
    background: var(--gradient-soft); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 6px 10px;
    font-size: .74rem; font-weight: 600; color: var(--primary);
    margin-bottom: 8px;
}
/* طµظپطھ hidden ط¨ط§غŒط¯ ط¨ط± display ط¨ط§ظ„ط§ ط؛ظ„ط¨ظ‡ ع©ظ†ط¯ */
.attach-chip[hidden] { display: none; }
.attach-chip button {
    border: 0; background: transparent; cursor: pointer;
    color: var(--red); font-weight: 800; font-size: .8rem;
}

/* ط¯ع©ظ…ظ‡ظ” ظ¾ط±ط´ ط¨ظ‡ ط¢ط®ط±غŒظ† ظ¾غŒط§ظ… */
.chat-jump {
    position: absolute; inset-block-end: 86px; inset-inline-end: 20px;
    width: 40px; height: 40px; border-radius: 50%;
    display: none; place-items: center;
    background: var(--surface); border: 1px solid var(--border);
    box-shadow: var(--shadow-lg); cursor: pointer; z-index: 5;
    font-size: 15px; color: var(--text-2);
}
.chat-wrap-inner { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.chat-jump.show { display: grid; }

/* --------------------------------------------------- ظپظ‡ط±ط³طھ ع¯ظپطھع¯ظˆظ‡ط§ */
.conv-list { display: flex; flex-direction: column; }
.conv {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    transition: background .16s;
}
.conv:hover { background: var(--surface-2); }
.conv:last-child { border-bottom: 0; }
.conv .avatar { width: 48px; height: 48px; flex-basis: 48px; font-size: .95rem; }
.conv-main { flex: 1; min-width: 0; }
.conv-top { display: flex; align-items: center; gap: 8px; }
.conv-name { font-weight: 700; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-time { margin-inline-start: auto; font-size: .68rem; color: var(--muted); white-space: nowrap; }
.conv-bottom { display: flex; align-items: center; gap: 8px; }
.conv-preview { flex: 1; min-width: 0; font-size: .76rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-preview.mine::before { content: 'شما: '; color: var(--text-2); font-weight: 600; }
.conv-unread {
    flex: 0 0 auto; min-width: 21px; height: 21px; padding: 0 6px;
    border-radius: var(--radius-pill);
    background: var(--gradient-strong); color: #fff;
    font-size: .68rem; font-weight: 800;
    display: grid; place-items: center;
}
.conv-head-search { padding: 12px 16px; border-bottom: 1px solid var(--border); }
.conv-head-search input { border-radius: var(--radius-pill); background: var(--surface-2); }

/* ط¢ظˆط§طھط§ط± ط±ظ†ع¯غŒ: ط±ظ†ع¯ ط«ط§ط¨طھ ط¨ط±ط§غŒ ظ‡ط± ع©ط§ط±ط¨ط± */
.avatar.av-0 { background: #ede9fe; color: #6d28d9; border-color: #ddd6fe; }
.avatar.av-1 { background: #dbeafe; color: #1d4ed8; border-color: #bfdbfe; }
.avatar.av-2 { background: #d1fae5; color: #047857; border-color: #a7f3d0; }
.avatar.av-3 { background: #fef3c7; color: #b45309; border-color: #fde68a; }
.avatar.av-4 { background: #fee2e2; color: #b91c1c; border-color: #fecaca; }
.avatar.av-5 { background: #cffafe; color: #0e7490; border-color: #a5f3fc; }

/* ط§ظ†طھط®ط§ط¨ ظ…ط®ط§ط·ط¨ (ع¯ظپطھع¯ظˆغŒ ط¬ط¯غŒط¯) */
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.person {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px;
    background: var(--surface-2);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer; transition: .16s;
}
.person:hover { border-color: var(--primary); }
.person input { width: auto; flex: 0 0 auto; }
.person.on { background: var(--primary-soft); border-color: var(--primary); }
.person .who { font-weight: 700; font-size: .82rem; }
.person .role { font-size: .68rem; color: var(--muted); }
.selected-chips { display: flex; flex-wrap: wrap; gap: 6px; min-height: 0; }

/* ==========================================================================
   طھظ‚ظˆغŒظ… ط´ظ…ط³غŒ (Date picker)
   ========================================================================== */
.dp-wrap { position: relative; }
.dp-wrap > input { padding-inline-end: 42px; }
.dp-toggle {
    position: absolute; inset-block-start: 0; inset-inline-end: 0;
    width: 38px; height: 38px;
    display: grid; place-items: center;
    border: 0; background: transparent; cursor: pointer;
    font-size: 15px; color: var(--muted);
}
.dp-toggle:hover { color: var(--primary); }

.dp-panel {
    position: fixed; z-index: 80;
    width: 306px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    padding: 10px;
    display: none;
}
.dp-wrap.open .dp-panel { display: block; }

/* ظ¾ط±ط¯ظ‡ظ” طھط§ط±غŒع© ظ¾ط´طھ طھظ‚ظˆغŒظ… ط¯ط± ظ…ظˆط¨ط§غŒظ„ */
.dp-wrap.open::before {
    content: ''; position: fixed; inset: 0; z-index: 79;
    background: rgba(15, 23, 42, .35);
}
@media (min-width: 601px) { .dp-wrap.open::before { display: none; } }

.dp-head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.dp-nav {
    width: 30px; height: 30px; flex: 0 0 30px;
    display: grid; place-items: center;
    border: 1px solid var(--border); border-radius: 50%;
    background: var(--surface); color: var(--text-2);
    font-size: 16px; line-height: 1; cursor: pointer;
}
.dp-nav:hover { border-color: var(--primary); color: var(--primary); }
.dp-title { display: flex; flex: 1; gap: 6px; }
.dp-title select { font-size: .76rem; padding: 5px 6px; border-radius: 9px; }
.dp-week {
    display: grid; grid-template-columns: repeat(7, 1fr);
    text-align: center; font-size: .68rem; font-weight: 700;
    color: var(--muted); margin-bottom: 4px;
}
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.dp-day {
    aspect-ratio: 1;
    border: 1px solid transparent; border-radius: 50%;
    background: transparent; font-family: inherit;
    font-size: .78rem; font-weight: 700; color: var(--text-2);
    cursor: pointer; transition: .14s;
}
.dp-day:hover { background: var(--surface-2); color: var(--text); }
.dp-day.today { border-color: var(--primary); color: var(--primary); }
.dp-day.active { background: var(--gradient-strong); color: #fff; border-color: transparent; }
.dp-empty { aspect-ratio: 1; }
.dp-foot {
    display: flex; justify-content: space-between; gap: 6px;
    margin-top: 8px; padding-top: 8px;
    border-top: 1px solid var(--border);
}

/* ط¯ط± ظ…ظˆط¨ط§غŒظ„ طھظ‚ظˆغŒظ… ط§ط² ظ¾ط§غŒغŒظ† طµظپط­ظ‡ ط¨ط§ط² ظ…غŒâ€Œط´ظˆط¯ */
@media (max-width: 600px) {
    .dp-panel {
        inset: auto 0 0 0;
        width: auto;
        border-radius: 20px 20px 0 0;
        padding: 14px 14px calc(14px + env(safe-area-inset-bottom));
    }
    .dp-day { font-size: .84rem; }
    .dp-toggle { width: 42px; height: 42px; }
    .dp-wrap > input { padding-inline-end: 46px; }
}

/* -------------------------------------------- ظˆط§ع©ظ†ط´â€Œع¯ط±ط§غŒغŒ ظ¾غŒط§ظ…â€Œط±ط³ط§ظ† */
@media (max-width: 900px) {
    .hide-sm { display: none; }
    .only-mobile { display: inline-flex; }
    .only-desktop { display: none !important; }

    /* ظ‡ط¯ط±: ط¹ظ†ظˆط§ظ† ظ‚ط§ط¨ظ„ ع©ظˆع†ع©â€Œط´ط¯ظ†طŒ ط§ط¹ظ„ط§ظ† ظپظ‚ط· ط¢غŒع©ظˆظ†طŒ ظ†ط´ط§ظ† ظ…ط¯ط±ط³ظ‡ ظ¾ظ†ظ‡ط§ظ† */
    .topbar { min-height: 56px; padding: 8px 12px; gap: 8px; }
    .topbar-title { font-size: .92rem; }
    .topbar-sub { font-size: .68rem; }
    .topbar .school-badge { display: none; }
    .topbar .dropdown-toggle.btn { padding: 6px 10px; }
    .burger { width: 38px; height: 38px; }
    h1 { font-size: 1.25rem; }
    .card-body { padding: 14px; }
    .card-head { padding: 12px 14px; }
    .content { padding: 14px 12px 96px; }
    .between { gap: 8px; }
    .avatar { width: 40px; height: 40px; flex-basis: 40px; font-size: .8rem; }
    .stat { padding: 13px; }
    .stat-ico { width: 40px; height: 40px; flex-basis: 40px; font-size: 17px; }

    /* ظ¾غŒط§ظ…â€Œط±ط³ط§ظ† طھظ…ط§ظ…â€Œطµظپط­ظ‡: ظ†ظˆط§ط± ط¨ط§ظ„ط§ ظˆ ظ†ط§ظˆط¨ط±غŒ ظ¾ط§غŒغŒظ† ظ¾ظ†ظ‡ط§ظ† ظ…غŒâ€Œط´ظˆظ†ط¯ */
    body.chat-page .topbar,
    body.chat-page .bottom-nav,
    body.chat-page .chat-page-head { display: none; }
    body.chat-page .content { padding: 0; }
    .chat { border: 0; border-radius: 0; box-shadow: none; }
    .chat-head { padding: 8px 10px; }
    .chat-body { padding: 12px 10px 6px; }
    .msg .bubble { max-width: 86%; }
    .msg .del { opacity: 1; inset-block-start: 4px; inset-inline-start: 4px; width: 20px; height: 20px; }
    .chat-compose { padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); }
    .chat-jump { inset-block-end: 78px; inset-inline-end: 14px; }
    .people { grid-template-columns: 1fr; }
    .conv { padding: 11px 12px; }
    .conv .avatar { width: 44px; height: 44px; flex-basis: 44px; }
}

/* دکمه‌های مخصوص موبایل/دسکتاپ */
.only-mobile { display: none; }

@media (max-width: 420px) {
    .topbar-title { font-size: .86rem; }
    .topbar-sub { display: none; }
    .chat-compose textarea { font-size: .82rem; }
    .msg .bubble { max-width: 90%; font-size: .83rem; }
}

/* ==========================================================================
   ط³ط¨ع© ط§ظ¾ظ„غŒع©غŒط´ظ†غŒ (ط¨ط± ظ¾ط§غŒظ‡ظ” ط§ظ¾ظ„غŒع©غŒط´ظ† ط¢ظ…ظˆط²ط´غŒ ط´ط§ط¯)
   ط³ط±طµظپط­ظ‡ظ” ط³ط¨ط²طŒ ع©ط§ط±طھâ€Œظ‡ط§غŒ ط³ظپغŒط¯ ط¨ط§ ع¯ظˆط´ظ‡ظ” ع¯ط±ط¯طŒ ظ†ظˆط§ط± ظ¾ط§غŒغŒظ† ط§ظ¾ظ„غŒع©غŒط´ظ†غŒ ظˆ
   ط§ط¬ط²ط§غŒ ظ„ظ…ط³غŒ ط¨ط²ط±ع¯â€Œطھط±. ط§غŒظ† ط¨ط®ط´ ط±ظˆغŒ ظ‚ظˆط§ط¹ط¯ ط¨ط§ظ„ط§طھط± ط¨ط§ط²ظ†ظˆغŒط³غŒ ظ…غŒâ€Œط´ظˆط¯.
   ========================================================================== */

/* ------------------------------------------------- ط³ط±طµظپط­ظ‡ظ” ط³ط¨ط² ط§ظ¾ظ„غŒع©غŒط´ظ† */
.topbar {
    background: var(--gradient-strong);
    border-bottom: 0;
    box-shadow: 0 8px 22px rgba(11, 143, 82, .18);
}
.topbar-title { color: #fff; font-weight: 800; letter-spacing: .1px; }
.topbar-sub { color: rgba(255, 255, 255, .82); }
.topbar .burger {
    background: rgba(255, 255, 255, .18);
    border-color: transparent;
    color: #fff;
}
.topbar .burger:hover { background: rgba(255, 255, 255, .28); }
.topbar .btn-light {
    background: rgba(255, 255, 255, .18);
    border-color: transparent;
    color: #fff;
}
.topbar .btn-light:hover { background: rgba(255, 255, 255, .3); color: #fff; }
.topbar .badge.grad { background: rgba(255, 255, 255, .2); color: #fff; }
.topbar .avatar {
    background: #fff;
    color: var(--primary);
    border-color: transparent;
    box-shadow: 0 3px 10px rgba(0, 0, 0, .12);
}

/* ------------------------------------------------------ ظ…ظ†ظˆغŒ ع©ظ†ط§ط±غŒ ط§ظ¾ظ„غŒع©غŒط´ظ†غŒ */
.sidebar { display: flex; flex-direction: column; }
.side-close {
    display: none;
    width: 34px; height: 34px; flex: 0 0 34px;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--surface-2);
    color: var(--text-2);
    font-size: 14px; cursor: pointer;
}
.side-user {
    margin-top: auto;
    display: flex; align-items: center; gap: 10px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
}

.side-year {
    display: none;
    margin-bottom: var(--sp-4);
    padding: var(--sp-3);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--surface-2);
}
.side-year-label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: var(--fs-xs);
    font-weight: 700;
}
.side-year select { width: 100%; min-height: var(--ctl-sm); }
.side-user .avatar { width: 36px; height: 36px; flex-basis: 36px; font-size: .76rem; }
.su-name { font-weight: 700; font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.su-role { font-size: .68rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-logout {
    border: 0; background: transparent; cursor: pointer;
    font-size: 15px; padding: 4px;
    border-radius: 10px;
}
.side-logout:hover { background: var(--red-soft); }
@media (max-width: 900px) {
    .side-close { display: grid; }
    .side-user { margin-top: 16px; }
    .side-year { display: block; }
}

.nav-item { border-radius: var(--radius-sm); padding: 9px 11px; }
.nav-item .ico {
    width: 32px; height: 32px; flex: 0 0 32px;
    display: grid; place-items: center;
    border-radius: 11px;
    background: var(--surface-2);
    font-size: 15px; opacity: 1;
    transition: .16s;
}
.nav-item:hover { background: var(--surface-2); }
.nav-item:hover .ico { background: #fff; }
.nav-item.active {
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 800;
}
.nav-item.active .ico { background: #fff; box-shadow: 0 2px 8px rgba(18, 183, 106, .18); }

/* ------------------------------------------------- ظ†ط§ظˆط¨ط±غŒ ظ¾ط§غŒغŒظ† ط§ظ¾ظ„غŒع©غŒط´ظ†غŒ */
.bottom-nav {
    border-top: 0;
    box-shadow: 0 -8px 26px rgba(16, 32, 48, .08);
    padding: 5px 4px calc(5px + env(safe-area-inset-bottom));
}
.bottom-nav a,
.bottom-nav button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    width: 100%;
    min-height: var(--tap);
    padding: 3px 0 2px;
    border: 0;
    border-radius: 14px;
    background: transparent;
    color: var(--muted);
    font-family: inherit;
    font-size: var(--fs-xs);
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.bottom-nav a .ico,
.bottom-nav button .ico {
    width: 38px; height: 30px;
    display: grid; place-items: center;
    border-radius: 11px; font-size: 16px;
    transition: .16s;
}
.bottom-nav a.active,
.bottom-nav button.active,
body.nav-open .bottom-nav [data-burger] { color: var(--primary); }
.bottom-nav a.active .ico,
.bottom-nav button.active .ico,
body.nav-open .bottom-nav [data-burger] .ico { background: var(--primary-soft); transform: translateY(-1px); }

/* ------------------------------------------------------ ع©ط§ط±طھâ€Œظ‡ط§غŒ ط§ظ¾ظ„غŒع©غŒط´ظ†غŒ */
.card { border-radius: var(--radius); }
.card-head { padding: 14px 17px; }
.card-head h2, .card-head h3 { font-size: 1rem; }
.card-body { padding: 17px; }

.stat {
    border-radius: var(--radius);
    padding: 15px 16px;
    gap: 13px;
    transition: .18s;
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat > div { min-width: 0; }
.stat-ico { border-radius: 16px; width: 48px; height: 48px; flex-basis: 48px; }
.stat-value { font-size: 1.4rem; letter-spacing: -.2px; }
.stat-label { font-size: .74rem; }

/* ------------------------------------------------------------ ط¯ع©ظ…ظ‡â€Œظ‡ط§غŒ ظ„ظ…ط³غŒ */
.btn { min-height: 40px; padding: 10px 20px; }
.btn-sm { min-height: 32px; padding: 6px 14px; }
.btn-icon { min-height: 0; }
.btn-light { background: var(--surface-2); }
.btn-green { background: var(--primary-soft); color: var(--primary); }
.btn-blue { background: var(--blue-soft); color: var(--blue); }

/* ------------------------------------------------------------ ظˆط±ظˆط¯غŒâ€Œظ‡ط§غŒ ظ¾ط±ط´ط¯ظ‡ */
input[type=text], input[type=number], input[type=email], input[type=password],
input[type=date], input[type=time], input[type=tel], input[type=url], input[type=color],
select, textarea {
    background: var(--surface-2);
    border-color: var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 13px;
}
input[type=text]:focus, input[type=number]:focus, input[type=email]:focus,
input[type=password]:focus, input[type=tel]:focus, input[type=url]:focus,
select:focus, textarea:focus {
    background: var(--surface);
}

/* ------------------------------------------------------------ طھط¨â€Œظ‡ط§غŒ ط§ظ¾ظ„غŒع©غŒط´ظ†غŒ */
.tabs {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    padding: 4px;
    gap: 4px;
}
.tab { border: 0; background: transparent; padding: 7px 15px; }
.tab.active { background: var(--primary-strong); box-shadow: var(--shadow-brand); }

/* ---------------------------------------------------- ط´ط¨ع©ظ‡ظ” ط¯ط³طھط±ط³غŒ ط³ط±غŒط¹ */
.tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
    gap: 10px;
}
.tile {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 7px;
    padding: 14px 8px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: .78rem; font-weight: 700; color: var(--text-2);
    text-align: center; transition: .16s;
}
.tile .ico {
    width: 44px; height: 44px;
    display: grid; place-items: center;
    border-radius: 15px;
    background: #fff; font-size: 20px;
    box-shadow: var(--shadow);
}
.tile:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-2px); }
.tile:hover .ico { background: var(--primary-soft); }

/* ------------------------------------------------------------ ط±ط¯غŒظپâ€Œظ‡ط§غŒ ظپظ‡ط±ط³طھ */
.list-item { padding: 13px 6px; gap: 13px; }
.list-item .chev { color: var(--muted); font-size: 14px; }
.list-item:hover { background: var(--surface-2); border-radius: var(--radius-sm); }

/* ------------------------------------------------------------ ط¬ط¯ظˆظ„ ط§ظ¾ظ„غŒع©غŒط´ظ†غŒ */
table.tbl { font-size: .82rem; }
table.tbl thead th { font-size: .75rem; padding: 12px; background: var(--surface-2); }
table.tbl tbody td { padding: 12px; }

/* ------------------------------------------------------------ ع©ط§ط±طھ ط®ظˆط´â€Œط¢ظ…ط¯ */
.hero { border-radius: 24px; padding: 22px; }
.hero h1 { font-size: 1.32rem; font-weight: 800; }

/* ------------------------------------------------------------- ط¨ط±ع†ط³ط¨ ط¨ط®ط´ */
.section-title {
    display: flex; align-items: center; gap: 9px;
    font-weight: 800; font-size: 1rem;
    margin: 4px 0 10px;
}
.section-title .ico {
    width: 32px; height: 32px;
    display: grid; place-items: center;
    border-radius: 11px;
    background: var(--primary-soft); font-size: 15px;
}
.section-title .link { margin-inline-start: auto; font-size: .76rem; color: var(--primary); font-weight: 700; }

/* ------------------------------------------------------------- ظ¾غŒط§ظ…â€Œط±ط³ط§ظ† */
.chat-head { border-radius: 0; }
.chat-back { color: var(--primary); border-color: var(--border); }
.chat-back:hover { background: var(--primary-soft); }
.chat-compose textarea { border-color: transparent; }
.chat-day span { border-color: transparent; box-shadow: var(--shadow); }

/* ------------------------------------------------------------ طھظ‚ظˆغŒظ… ط´ظ…ط³غŒ */
.dp-day.active { box-shadow: var(--shadow-brand); }
.dp-nav:hover { background: var(--primary-soft); }

/* -------------------------------------------- ع†غŒط¯ظ…ط§ظ† ط§ظ¾ظ„غŒع©غŒط´ظ†غŒ ظ…ظˆط¨ط§غŒظ„ */
@media (max-width: 900px) {
    .content { padding: 14px 12px calc(var(--bottomnav-h) + 28px); }
    .card { border-radius: 18px; }
    .card-head { padding: 13px 15px; }
    .card-body { padding: 15px; }
    .hero { border-radius: 20px; padding: 18px; }
    .hero h1 { font-size: 1.15rem; }

    /* ع©ط§ط±طھâ€Œظ‡ط§غŒ ط¢ظ…ط§ط±غŒ ط¯ظˆ ط³طھظˆظ†ظ‡ ظ…ط«ظ„ ط§ظ¾ظ„غŒع©غŒط´ظ† */
    .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .stat { padding: 12px; gap: 10px; border-radius: 18px; }
    .stat-ico { width: 38px; height: 38px; flex-basis: 38px; font-size: 16px; border-radius: 13px; }
    .stat-value { font-size: 1.12rem; }
    .stat-label { font-size: .68rem; line-height: 1.6; }

    /* ط¯ط³طھط±ط³غŒ ط³ط±غŒط¹ ط³ظ‡ ط³طھظˆظ†ظ‡ */
    .tiles { grid-template-columns: repeat(3, 1fr); gap: 8px; }
    .tile { padding: 12px 4px; font-size: .72rem; border-radius: 16px; }
    .tile .ico { width: 40px; height: 40px; font-size: 18px; border-radius: 14px; }

    .btn { min-height: 42px; }
    .list-item { padding: 12px 4px; }
}

@media (max-width: 420px) {
    .stat-grid { gap: 8px; }
    .stat { padding: 11px; gap: 9px; }
    .stat-value { font-size: 1.02rem; }
    .tile { font-size: .68rem; }
    .tile .ico { width: 36px; height: 36px; font-size: 17px; }
}

/* ==========================================================================
   ظ¾غŒط§ظ…â€Œط±ط³ط§ظ† ط­ط±ظپظ‡â€Œط§غŒ â€” ط±ط³ط§ظ†ظ‡طŒ ط¶ط¨ط· طµط¯ط§/طھطµظˆغŒط± ظˆ ظ…ط¯غŒط±غŒطھ ع¯ظپطھع¯ظˆ
   ========================================================================== */

/* ---------------------------------------------------- ظ¾غŒط§ظ… ط³غŒط³طھظ…غŒ */
.msg-system {
    display: flex; justify-content: center;
    margin: 6px 0 10px;
}
.msg-system span {
    background: var(--primary-soft);
    color: var(--primary-dark, #0b8f52);
    border-radius: var(--radius-pill);
    padding: 4px 14px;
    font-size: .72rem; font-weight: 700;
    text-align: center;
    max-width: 88%;
}

/* ---------------------------------------------------- ظ†ط´ط§ظ† ظ‚ظپظ„ ظˆ ظ†ظˆط¹ ظ¾غŒط§ظ… */
.lock-ico { font-size: .78rem; margin-inline-start: 4px; }
.ico-tag { display: inline-block; margin-inline-end: 3px; }

/* ---------------------------------------------------- ظ…ظ†ظˆغŒ ظ¾غŒظˆط³طھ */
.attach-menu {
    position: absolute;
    inset-block-end: calc(100% + 10px);
    inset-inline-start: 10px;
    z-index: 70;
    width: 190px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    display: grid; gap: 2px;
}
.attach-menu[hidden] { display: none; }
.attach-menu button {
    display: flex; align-items: center; gap: 9px;
    width: 100%; padding: 9px 10px;
    border: 0; background: transparent;
    border-radius: 11px;
    font-family: inherit; font-size: .82rem; font-weight: 600;
    color: var(--text-2); cursor: pointer; text-align: right;
}
.attach-menu button:hover { background: var(--primary-soft); color: var(--primary); }
.attach-menu .ico { font-size: 16px; }

/* ---------------------------------------------------- ط³غŒظ†غŒ ظ¾غŒظˆط³طھâ€Œظ‡ط§غŒ ط¢ظ…ط§ط¯ظ‡ */
.attach-tray {
    display: flex; flex-wrap: wrap; gap: 8px;
    margin-bottom: 8px;
}
.attach-tray[hidden] { display: none; }
.tray-item {
    position: relative;
    display: flex; align-items: center; gap: 8px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 9px;
    font-size: .74rem; font-weight: 600;
    max-width: 100%;
}
.tray-item img { width: 38px; height: 38px; object-fit: cover; border-radius: 9px; }
.tray-item .ti-name {
    max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tray-item .ti-size { color: var(--muted); font-weight: 500; }
.tray-item .ti-del {
    border: 0; background: transparent; cursor: pointer;
    color: var(--red); font-weight: 800; font-size: .8rem;
}
.tray-item.is-audio .ti-ico { font-size: 18px; }

/* ---------------------------------------------------- ظ†ظˆط§ط± ط¶ط¨ط· طµط¯ط§/طھطµظˆغŒط± */
.rec-bar {
    display: flex; align-items: center; gap: 9px;
    background: var(--red-soft);
    border-radius: var(--radius-sm);
    padding: 7px 11px;
    margin-bottom: 8px;
    font-size: .78rem; font-weight: 700; color: #b91c1c;
}
.rec-bar[hidden] { display: none; }
.rec-dot {
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--red);
    animation: rec-pulse 1s infinite;
}
@keyframes rec-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: .35; transform: scale(.8); }
}
.rec-time { font-variant-numeric: tabular-nums; }
.rec-hint { color: #991b1b; font-weight: 600; }
.rec-bar .btn { margin-inline-start: auto; }
.rec-bar .btn + .btn { margin-inline-start: 4px; }

/* ---------------------------------------------------- ظ¾غŒظˆط³طھâ€Œظ‡ط§ ط¯ط± ط­ط¨ط§ط¨ */
.attach { display: block; margin: 4px 0 2px; }

.att-img img {
    max-width: min(280px, 62vw);
    width: 100%; display: block;
    border-radius: 14px;
    cursor: zoom-in;
}
.att-video {
    width: min(300px, 66vw);
    max-height: 320px;
    border-radius: 14px;
    background: #000;
    display: block;
}
.att-audio { width: min(260px, 60vw); height: 38px; }

.att-file {
    display: flex; align-items: center; gap: 10px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 9px 11px;
    min-width: min(230px, 58vw);
    max-width: 100%;
    transition: .16s;
}
.msg.mine .att-file { background: rgba(255, 255, 255, .18); border-color: transparent; }
.att-file:hover { border-color: var(--primary); }
.af-ico { font-size: 22px; }
.af-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.af-name {
    font-size: .78rem; font-weight: 700;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.af-size { font-size: .68rem; color: var(--muted); }
.msg.mine .af-size { color: rgba(255, 255, 255, .85); }
.af-dl { font-size: 15px; opacity: .75; }

/* ---------------------------------------------------- ظ¾ط®ط´â€Œع©ظ†ظ†ط¯ظ‡ظ” ظ¾غŒط§ظ… طµظˆطھغŒ */
.att-voice {
    display: flex; align-items: center; gap: 9px;
    min-width: min(220px, 56vw);
}
.att-voice .v-play {
    width: 36px; height: 36px; flex: 0 0 36px;
    border-radius: 50%; border: 0;
    background: var(--primary-strong); color: #fff;
    font-size: 14px; cursor: pointer;
    display: grid; place-items: center;
}
.att-voice .v-wave {
    display: flex; align-items: center; gap: 2px;
    height: 26px; flex: 1; min-width: 0;
    overflow: hidden;
}
.att-voice .v-wave i {
    flex: 1 1 2px;
    min-width: 2px; max-width: 3px;
    background: var(--border-strong);
    border-radius: 2px;
    transition: background .1s;
}
.att-voice.is-playing .v-wave i.played { background: var(--primary); }
.att-voice .v-time {
    font-size: .7rem; font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--muted);
}
.msg.mine .att-voice .v-play { background: #fff; color: var(--primary); }
.msg.mine .att-voice .v-wave i { background: rgba(255, 255, 255, .45); }
.msg.mine .att-voice .v-wave i.played { background: #fff; }
.msg.mine .att-voice .v-time { color: rgba(255, 255, 255, .9); }

/* ---------------------------------------------------- ظ¾ظ†ظ„ ظ…ط¯غŒط±غŒطھ ع¯ظپطھع¯ظˆ */
.mod-panel {
    position: absolute;
    inset-block-start: 0; inset-inline: 0;
    z-index: 65;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    padding: 14px 16px 18px;
    max-height: 78%;
    overflow-y: auto;
}
.mod-panel[hidden] { display: none; }
.mod-member {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 0;
    border-bottom: 1px solid var(--border);
}
.mod-member:last-child { border-bottom: 0; }
.mod-member .title { font-weight: 700; font-size: .84rem; }
.mod-member .sub { font-size: .7rem; color: var(--muted); }

/* ---------------------------------------------------- ع¯ظپطھع¯ظˆ ط¨ط³طھظ‡â€Œط´ط¯ظ‡ */
.compose-locked {
    display: flex; align-items: center; gap: 9px;
    background: var(--amber-soft);
    color: #92400e;
    border-top: 1px solid var(--border);
    padding: 13px 16px calc(13px + env(safe-area-inset-bottom));
    font-size: .8rem; font-weight: 700;
}

/* ---------------------------------------------------- ظ†ظ…ط§غŒط´ طھظ…ط§ظ…â€Œطµظپط­ظ‡ظ” طھطµظˆغŒط± */
.lightbox {
    position: fixed; inset: 0; z-index: 200;
    background: rgba(6, 16, 12, .92);
    display: grid; place-items: center;
    padding: 20px;
}
.lightbox[hidden] { display: none; }
.lightbox img {
    max-width: 96vw; max-height: 88vh;
    border-radius: 14px;
}
.lightbox button {
    position: absolute; inset-block-start: 18px; inset-inline-end: 18px;
    width: 42px; height: 42px; border-radius: 50%;
    border: 0; background: rgba(255, 255, 255, .18);
    color: #fff; font-size: 16px; cursor: pointer;
}

/* ---------------------------------------------------- ظ†ظˆط§ط± ظ†ظˆط´طھظ† ط§ظ¾ظ„غŒع©غŒط´ظ†غŒ */
.chat-compose { position: relative; background: var(--surface-2); border-top: 0; }
.chat-compose textarea { background: var(--surface); }
@media (max-width: 900px) {
    .attach-menu { inset-inline-start: 6px; }
    .att-img img { max-width: 68vw; }
}

/* ==========================================================================
   ع©ظ„ط§ط³ ط²ظ†ط¯ظ‡ظ” ط¯ط§ط®ظ„غŒ â€” ط±ط§ط¨ط· ط¨ط§ط²ط·ط±ط§ط­غŒâ€Œط´ط¯ظ‡ (ظ„ط§ط¨غŒ + طµط­ظ†ظ‡ + ط¯ط§ع© + ظ¾ظ†ظ„)
   ط§غŒظ† ط¨ط®ط´ ط±ظˆغŒ ظ‚ظˆط§ط¹ط¯ ظ‚ط¯غŒظ…غŒ ع©ظ„ط§ط³ ط²ظ†ط¯ظ‡ ط¨ط§ط²ظ†ظˆغŒط³غŒ ظ…غŒâ€Œط´ظˆط¯.
   ========================================================================== */
body.live-page { background: #0b1512; }
body.live-page { overflow: hidden; }
body.live-page .app-shell { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
body.live-page .sidebar { display: none !important; }
body.live-page .content {
    display: flex; flex-direction: column;
    min-height: 0; padding: 0; overflow: hidden;
}
.live-wrap { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
/* اتاق کلاس تمام‌صفحه است: سربرگ و نوار پایین اپلیکیشن پنهان می‌شوند */
body.live-page .topbar,
body.live-page .bottom-nav { display: none; }

/* â•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گ طµظپط­ظ‡ظ” ظ¾غŒط´â€Œظˆط±ظˆط¯ */
.lobby {
    flex: 1; min-height: 0; overflow-y: auto;
    display: grid; place-items: center;
    padding: 18px;
    background: radial-gradient(1200px 600px at 70% -10%, #123c2e 0%, #0b1512 60%);
}
.lobby[hidden] { display: none; }
.lobby-card {
    width: 100%; max-width: 460px;
    background: var(--surface);
    border-radius: 24px;
    padding: 18px;
    box-shadow: var(--shadow-lg);
}
.lobby-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.lobby-head h1 { font-size: 1.1rem; margin: 0; }
.lobby-ico {
    width: 46px; height: 46px; flex: 0 0 46px;
    display: grid; place-items: center;
    border-radius: 15px;
    background: var(--gradient-strong); color: #fff; font-size: 20px;
}
.lobby-preview {
    position: relative;
    aspect-ratio: 4 / 3;
    border-radius: 18px;
    overflow: hidden;
    background: #0d1b16;
}
.lobby-preview video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.preview-off {
    position: absolute; inset: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 6px; color: rgba(255, 255, 255, .7); font-size: .82rem;
}
.preview-off[hidden] { display: none; }
.preview-off .big { font-size: 34px; opacity: .6; }
.preview-name {
    position: absolute; inset-block-end: 10px; inset-inline-start: 12px;
    background: rgba(0, 0, 0, .5); color: #fff;
    border-radius: var(--radius-pill); padding: 3px 12px;
    font-size: .78rem; font-weight: 700;
}
.preview-mic {
    position: absolute; inset-block-end: 10px; inset-inline-end: 12px;
    display: flex; align-items: center; gap: 7px;
    background: rgba(0, 0, 0, .5); color: #fff;
    border-radius: var(--radius-pill); padding: 4px 10px;
}
.mic-meter { width: 40px; height: 6px; border-radius: 99px; background: rgba(255, 255, 255, .3); overflow: hidden; }
.mic-meter i { display: block; height: 100%; width: 0; background: var(--primary); transition: width .1s; }
.lobby-devices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.lobby-note {
    margin: 10px 2px 0; padding: 8px 11px;
    background: rgba(34, 197, 94, .1);
    border: 1px solid rgba(34, 197, 94, .28);
    border-radius: 12px;
    font-size: .74rem; line-height: 1.9; color: #29503f;
}
.lobby-actions { display: flex; gap: 8px; margin-top: 10px; }
.lobby-actions .btn { flex: 1; }
.lobby-enter { margin-top: 12px; min-height: 48px; font-size: .92rem; }

/* â•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گ ط§طھط§ظ‚ */
.room { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; padding: 10px; }
.room[hidden] { display: none; }

.room-top {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    background: rgba(255, 255, 255, .06);
    border: 1px solid rgba(255, 255, 255, .09);
    border-radius: 16px;
    padding: 8px 12px;
    color: #eaf3ee;
}
.room-top-main { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.room-dot {
    width: 10px; height: 10px; flex: 0 0 10px; border-radius: 50%;
    background: #ff4d4f; box-shadow: 0 0 0 0 rgba(255, 77, 79, .6);
    animation: live-pulse 1.6s infinite;
}
@keyframes live-pulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 77, 79, .5); }
    70% { box-shadow: 0 0 0 9px rgba(255, 77, 79, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 77, 79, 0); }
}
.room-title { font-weight: 800; font-size: .95rem; display: flex; align-items: center; gap: 7px; }
.room-meta { font-size: .72rem; color: rgba(234, 243, 238, .7); }
.room-top .badge { font-size: .66rem; }
.room-top-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.room-top .btn-light { background: rgba(255, 255, 255, .1); color: #fff; border-color: transparent; }
.room-top .btn-light:hover { background: rgba(255, 255, 255, .2); color: #fff; }
.q-good { color: #4ade80; } .q-fair { color: #fbbf24; } .q-bad { color: #f87171; } .q-wait { color: rgba(234, 243, 238, .6); }

.hand-banner {
    display: flex; align-items: center; gap: 9px;
    background: #422006; color: #fde68a;
    border: 1px solid #78350f;
    border-radius: 12px; padding: 7px 12px;
    font-size: .8rem; font-weight: 700;
}
.hand-banner[hidden] { display: none; }

.connection-banner {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 12px;
    border-radius: 12px;
    background: rgba(245, 158, 11, .13);
    border: 1px solid rgba(245, 158, 11, .35);
    color: #fde68a;
    font-size: .78rem;
    font-weight: 700;
}
.connection-banner[hidden] { display: none; }
.connection-banner .connection-dot {
    width: 8px;
    height: 8px;
    flex: 0 0 8px;
    border-radius: 50%;
    background: #fbbf24;
    box-shadow: 0 0 0 4px rgba(251, 191, 36, .12);
}
.connection-banner .btn {
    min-height: 31px;
    padding: 3px 10px;
    font-size: .7rem;
}
.connection-banner:not(.can-retry) .btn { visibility: hidden; }

.room-body { flex: 1; min-height: 0; display: flex; gap: 8px; }

/* --------------------------------------------------------------- طµط­ظ†ظ‡ */
.stage {
    position: relative;
    flex: 1; min-width: 0;
    border-radius: 18px;
    background: #0d1b16;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.stage-empty {
    position: absolute; inset: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 4px; color: rgba(255, 255, 255, .72); text-align: center; padding: 20px;
}
.stage-empty .big { font-size: 44px; opacity: .45; }

.tiles {
    flex: 1; min-height: 0;
    display: grid;
    gap: 8px;
    padding: 8px;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    align-content: center;
    overflow-y: auto;
}
.tiles:empty { display: none; }
.tiles.solo { grid-template-columns: 1fr; }
.tiles.hide { display: none; }

.live-tile {
    position: relative;
    border-radius: 14px;
    overflow: hidden;
    background: #10231c;
    min-height: 120px;
    display: flex; align-items: center; justify-content: center;
    aspect-ratio: 16 / 10;
}
.live-tile video {
    width: 100%; height: 100%;
    object-fit: cover;
    background: #0d1b16;
    transform: scaleX(-1);
}
.live-tile.remote video { transform: none; }
.live-tile.screen video { transform: none; object-fit: contain; background: #000; }
.live-tile.speaking { outline: 3px solid var(--primary); outline-offset: -3px; }
.live-tile.needs-playback::after {
    content: 'برای شنیدن صدا بزنید';
    position: absolute;
    inset-block-start: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, .76);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 999px;
    padding: 7px 12px;
    font-size: .7rem;
    font-weight: 800;
    pointer-events: none;
    white-space: nowrap;
}
.live-tile-ph {
    position: absolute; inset: 0;
    display: grid; place-items: center;
    font-size: 2.1rem; font-weight: 800;
    color: rgba(255, 255, 255, .35);
}
.live-tile-ph[hidden] { display: none; }
.live-tile-name {
    position: absolute; inset-block-end: 7px; inset-inline-start: 8px;
    display: flex; align-items: center; gap: 5px;
    font-size: .7rem; font-weight: 700; color: #fff;
    background: rgba(0, 0, 0, .5);
    border-radius: var(--radius-pill);
    padding: 2px 10px;
    max-width: 78%;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.live-tile-badges {
    position: absolute; inset-block-start: 7px; inset-inline-end: 8px;
    font-size: .72rem;
    background: rgba(0, 0, 0, .45);
    border-radius: var(--radius-pill);
    padding: 2px 8px;
    letter-spacing: 1px;
}
.film-strip {
    display: flex; gap: 6px;
    padding: 6px 8px;
    overflow-x: auto;
    background: rgba(0, 0, 0, .35);
}
.film-strip[hidden] { display: none; }
.film-strip .live-tile { width: 132px; min-height: 0; aspect-ratio: 16/10; flex: 0 0 auto; }

/* ------------------------------------------------------------ طھط®طھظ‡/ظپغŒظ„ظ… */
.board, .movie {
    position: absolute; inset: 0;
    z-index: 20;
    background: #fff;
    display: flex; flex-direction: column;
}
.movie { background: #000; }
.board[hidden], .movie[hidden] { display: none; }
.board-top {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}
.board-canvas-wrap { flex: 1; min-height: 0; }
.board canvas {
    width: 100%; height: 100%;
    display: block;
    touch-action: none;
    cursor: crosshair;
}
.movie-player { position: relative; flex: 1; min-height: 0; display: grid; place-items: center; overflow: hidden; }
.movie video { max-width: 100%; max-height: 100%; background: #000; }
.movie video[hidden],
.movie iframe[hidden],
.movie img[hidden],
.movie-empty[hidden] { display: none !important; }
.board-tools .tool[hidden] { display: none !important; }
.movie iframe {
    width: 100%;
    height: 100%;
    border: 0;
    background: #fff;
}
.movie img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    background: #fff;
}
.movie-empty {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    color: rgba(234, 243, 238, .76);
    text-align: center;
    padding: 20px;
}
.movie-empty .big { font-size: 42px; opacity: .45; }
.board-tools {
    display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
    padding: 7px 10px;
    background: var(--surface-2);
    border-top: 1px solid var(--border);
}
.board-tools .tool {
    display: inline-flex; align-items: center; gap: 5px;
    min-height: 34px; padding: 5px 11px;
    border-radius: 11px;
    border: 1px solid var(--border);
    background: var(--surface);
    font-family: inherit; font-size: .76rem; font-weight: 700;
    color: var(--text-2); cursor: pointer;
}
.board-tools .tool:hover { border-color: var(--primary); color: var(--primary); }
.board-tools .tool.on { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.board-tools .tool-sep { width: 1px; height: 22px; background: var(--border); margin: 0 2px; }
.board-tools .dot {
    width: 26px; height: 26px; border-radius: 50%;
    border: 2px solid transparent;
    background: var(--c); cursor: pointer;
}
.board-tools .dot.on { border-color: var(--text); box-shadow: 0 0 0 2px #fff inset; }

/* --------------------------------------------------------------- ظ¾ظ†ظ„ */
.panel {
    width: 320px; flex: 0 0 320px;
    display: flex; flex-direction: column;
    min-height: 0; overflow: hidden;
    background: rgba(255, 255, 255, .05);
    border: 1px solid rgba(255, 255, 255, .09);
    border-radius: 18px;
}
.panel-tabs {
    display: flex; align-items: center; gap: 4px;
    padding: 7px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.ptab {
    border: 0; background: transparent;
    color: rgba(234, 243, 238, .72);
    font-family: inherit; font-size: .76rem; font-weight: 700;
    padding: 6px 10px; border-radius: 10px; cursor: pointer;
}
.ptab.active { background: rgba(255, 255, 255, .14); color: #fff; }
.panel-close {
    width: 30px; height: 30px; border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, .14);
    background: transparent; color: #fff; cursor: pointer;
}
.pane { flex: 1; min-height: 0; overflow-y: auto; padding: 10px; }
.pane[hidden] { display: none; }

.people-list { display: flex; flex-direction: column; gap: 4px; }
.live-person {
    display: flex; align-items: center; gap: 9px;
    padding: 7px 8px; border-radius: 12px;
    background: rgba(255, 255, 255, .04);
}
.live-person .name { font-size: .8rem; font-weight: 700; color: #eaf3ee; }
.live-person .sub { font-size: .66rem; color: rgba(234, 243, 238, .6); }
.live-person .acts { margin-inline-start: auto; display: flex; gap: 4px; }
.live-person .mini {
    border: 0; background: rgba(255, 255, 255, .1);
    color: #fff; cursor: pointer;
    border-radius: 9px; padding: 4px 8px; font-size: .72rem; font-family: inherit;
}
.live-person .mini:hover { background: rgba(255, 255, 255, .2); }
.live-person .mini.ok { background: rgba(34, 197, 94, .24); color: #d7f7e3; }
.live-person .mini.danger { background: rgba(248, 113, 113, .22); }
.live-person .acts { flex-wrap: wrap; justify-content: flex-end; }

.chat-log { display: flex; flex-direction: column; gap: 7px; min-height: 100%; justify-content: flex-end; }
.live-msg { max-width: 92%; }
.live-msg.system {
    align-self: center; text-align: center;
    font-size: .66rem; color: rgba(234, 243, 238, .6);
    background: rgba(255, 255, 255, .07);
    border-radius: var(--radius-pill); padding: 3px 11px;
}
.live-msg-head { font-size: .63rem; color: rgba(234, 243, 238, .55); margin-bottom: 1px; }
.live-msg-body {
    background: rgba(255, 255, 255, .09);
    color: #eaf3ee;
    border-radius: 12px; padding: 6px 10px;
    font-size: .78rem; line-height: 1.8; overflow-wrap: anywhere;
}
.live-msg.mine { align-self: flex-end; }
.live-msg.mine .live-msg-body { background: var(--primary-strong); color: #fff; }
.live-msg.mine .live-msg-head { text-align: left; }
.chat-form { display: flex; gap: 7px; padding: 8px 10px; border-top: 1px solid rgba(255, 255, 255, .08); }
.chat-form input {
    background: rgba(255, 255, 255, .08);
    border-color: transparent; color: #eaf3ee;
}
.chat-form input::placeholder { color: rgba(234, 243, 238, .5); }
.chat-send {
    width: 40px; height: 40px; flex: 0 0 40px;
    border: 0; border-radius: 50%; cursor: pointer;
    background: var(--primary-strong); color: #fff; font-size: 15px;
}

.manage-block { margin-bottom: 16px; }
.manage-title { font-size: .78rem; font-weight: 800; color: #eaf3ee; margin-bottom: 8px; }
.manage-hints { margin: 0; padding-inline-start: 16px; font-size: .74rem; color: rgba(234, 243, 238, .75); line-height: 2; }

/* ------------------------------------------------------------- ط¯ط§ع© ط§ط¨ط²ط§ط± */
.dock {
    display: flex; align-items: center; gap: 6px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, .06);
    border: 1px solid rgba(255, 255, 255, .09);
    border-radius: 18px;
    overflow-x: auto;
}
.dock-btn {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    min-width: 78px; padding: 7px 8px;
    border: 1px solid transparent;
    border-radius: 14px;
    background: rgba(255, 255, 255, .07);
    color: rgba(234, 243, 238, .85);
    font-family: inherit; cursor: pointer;
    transition: .15s;
}
.dock-btn .di { font-size: 18px; }
.dock-btn .dl { font-size: .68rem; font-weight: 700; }
.dock-btn:hover { background: rgba(255, 255, 255, .14); }
.dock-btn.on { background: var(--primary-strong); border-color: var(--primary-strong); color: #fff; }
.dock-btn.off { background: rgba(248, 113, 113, .18); color: #fecaca; }
.dock-btn.danger { background: rgba(248, 113, 113, .22); color: #fecaca; }
.dock-btn.locked { opacity: .82; border-style: dashed; border-color: rgba(255, 255, 255, .22); }
.dock-btn.active-pane { background: rgba(255, 255, 255, .18); color: #fff; }

/* چیپ‌های «در نوبت صحبت» برای معلم */
.hand-chip {
    border: 0; cursor: pointer;
    background: rgba(34, 197, 94, .28); color: #eafff2;
    font-family: inherit; font-size: .72rem; font-weight: 700;
    border-radius: var(--radius-pill); padding: 3px 10px;
    margin-inline-start: 6px;
}
.hand-chip:hover { background: rgba(34, 197, 94, .45); }

/* ------------------------------------------------------------- ط§ط¹ظ„ط§ظ†â€Œظ‡ط§ */
.toasts {
    position: absolute; inset-block-end: 84px; inset-inline-start: 14px;
    display: flex; flex-direction: column; gap: 6px;
    z-index: 60; pointer-events: none;
}
.toast {
    background: rgba(9, 20, 16, .92);
    color: #eaf3ee;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 12px;
    padding: 7px 13px;
    font-size: .76rem; font-weight: 600;
    animation: toast-in .2s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.live-resume-widget {
    position: fixed;
    inset-inline-start: 18px;
    inset-block-end: 22px;
    z-index: 90;
    display: flex;
    align-items: stretch;
    border-radius: 18px;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
}
.live-resume-link {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 190px;
    padding: 10px 13px;
    color: var(--text);
    text-decoration: none;
}
.live-resume-link:hover { background: var(--surface-2); }
.live-resume-icon {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    background: var(--gradient-strong);
    position: relative;
}
.live-resume-icon::before {
    content: '';
    width: 14px;
    height: 10px;
    border-radius: 3px;
    border: 2px solid #fff;
    box-sizing: border-box;
}
.live-resume-icon::after {
    content: '';
    position: absolute;
    width: 7px;
    height: 2px;
    border-radius: 99px;
    background: #fff;
    box-shadow: 0 -3px 0 #fff, 0 3px 0 #fff;
}
.live-resume-copy { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.live-resume-copy strong { font-size: .78rem; }
.live-resume-copy small {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--muted);
    font-size: .65rem;
}
.live-resume-close {
    border: 0;
    border-inline-start: 1px solid var(--border);
    background: transparent;
    color: var(--muted);
    width: 31px;
    cursor: pointer;
    font-size: 18px;
}
.live-resume-close:hover { background: var(--surface-2); color: var(--danger); }

/* â•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گâ•گ ظ…ظˆط¨ط§غŒظ„ */
@media (max-width: 900px) {
    body.live-page .topbar,
    body.live-page .bottom-nav { display: none; }

    .room { padding: 6px; gap: 6px; }
    .room-top { border-radius: 14px; padding: 7px 10px; }
    .room-title { font-size: .86rem; }
    .room-meta { font-size: .66rem; }
    .room-top-actions .btn { min-height: 34px; padding: 5px 10px; font-size: .72rem; }

    .tiles { grid-template-columns: 1fr; gap: 6px; padding: 6px; }
    .tiles.many:not(.hide) { grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: start; }
    .live-tile { aspect-ratio: 16 / 10; }
    .live-tile-name { max-width: 88%; }
    .connection-banner { padding: 6px 8px; font-size: .7rem; }

    /* ظ¾ظ†ظ„ ط¯ط± ظ…ظˆط¨ط§غŒظ„ ط´غŒطھ ظ¾ط§غŒغŒظ† ظ…غŒâ€Œط´ظˆط¯ */
    .panel {
        position: absolute;
        inset-inline: 6px; inset-block-end: 116px;
        width: auto; flex-basis: auto;
        max-height: 66%;
        min-height: min(330px, 44vh);
        border-radius: 18px;
        background: #10231c;
        transform: translateY(calc(100% + 96px));
        visibility: hidden;
        pointer-events: none;
        transition: transform .2s ease, visibility .2s ease;
        z-index: 50;
        box-shadow: var(--shadow-lg);
    }
    .panel.open {
        transform: translateY(0);
        visibility: visible;
        pointer-events: auto;
    }
    .dock {
        display: grid;
        grid-template-columns: repeat(6, minmax(0, 1fr));
        gap: 5px;
        padding: 6px;
        border-radius: 16px;
        overflow: visible;
    }
    .dock-btn { min-width: 0; padding: 5px 2px; border-radius: 12px; }
    .dock-btn .di { font-size: 16px; }
    .dock-btn .dl { font-size: .58rem; }
    .dock-btn.live-secondary { display: none; }
    .toasts { inset-block-start: 86px; inset-block-end: auto; inset-inline: 10px; }
    .lobby-devices { grid-template-columns: 1fr; }
    .live-resume-widget {
        inset-inline: 10px;
        inset-block-end: 78px;
    }
    .live-resume-link { min-width: 0; flex: 1; }
}

/* ==========================================================================
   ط§ط¬ط²ط§غŒ ط§ظ¾ظ„غŒع©غŒط´ظ†غŒ â€” ع©ط§ط¯ط±ظ‡ط§طŒ ظپظ‡ط±ط³طھâ€Œظ‡ط§ ظˆ ع†غŒط¯ظ…ط§ظ†
   ========================================================================== */

/* --------------------------------------------- ط³ط±طµظپط­ظ‡ظ” ظ¾ط±ظˆظ†ط¯ظ‡ (طµظپط­ظ‡ظ” ط¬ط²ط¦غŒط§طھ) */
.profile-head {
    display: flex; align-items: center; gap: 14px;
    background: var(--gradient-strong);
    color: #fff;
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow-brand);
    margin-bottom: 16px;
}
.profile-head .avatar {
    width: 58px; height: 58px; flex-basis: 58px;
    background: rgba(255, 255, 255, .22);
    color: #fff; border-color: transparent;
    font-size: 1.3rem;
}
.profile-head .ph-name { font-size: 1.15rem; font-weight: 800; line-height: 1.6; }
.profile-head .ph-sub { font-size: .76rem; color: rgba(255, 255, 255, .88); }
.profile-head .btn-light {
    background: rgba(255, 255, 255, .2);
    border-color: transparent; color: #fff;
}
.profile-head .btn-light:hover { background: rgba(255, 255, 255, .32); color: #fff; }

/* ---------------------------------------------------- ط¯ع©ظ…ظ‡ظ” ط´ظ†ط§ظˆط± (ظ…ظˆط¨ط§غŒظ„) */
.fab {
    display: none;
    position: fixed;
    inset-block-end: calc(var(--bottomnav-h) + 16px);
    inset-inline-start: 16px;
    width: 56px; height: 56px;
    border-radius: 50%;
    place-items: center;
    background: var(--gradient-strong);
    color: #fff; font-size: 26px; font-weight: 700; line-height: 1;
    box-shadow: 0 12px 26px rgba(11, 143, 82, .34);
    z-index: 55;
}
.fab:hover { transform: translateY(-2px); }
@media (max-width: 900px) { .fab { display: grid; } }
@media print { .fab { display: none !important; } }

/* ---------------------------------------------------- ظ†ظˆط§ط± ط¬ط³طھâ€Œظˆط¬ظˆغŒ ط§ظ¾ظ„غŒع©غŒط´ظ†غŒ */
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.filter-bar input[type=text] { border-radius: var(--radius-pill); padding-inline-start: 16px; }
.filter-bar .filter-field { min-width: 170px; }
.filter-label { display: none; }

/* ------------------------------------------------- Bottom sheet موبایل */
.bottom-sheet {
    position: fixed;
    inset: auto 0 0 0;
    width: 100%;
    max-width: 100%;
    max-height: 86vh;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}
.bottom-sheet::backdrop {
    background: rgba(15, 23, 42, .42);
}
.bottom-sheet[open] { animation: sheet-up .2s ease; }
@keyframes sheet-up {
    from { transform: translateY(24px); opacity: .7; }
    to { transform: none; opacity: 1; }
}
.bottom-sheet form { display: flex; flex-direction: column; max-height: 86vh; }
.sheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-2);
    padding: var(--sp-3) var(--sp-4);
    border-bottom: 1px solid var(--border);
}
.sheet-head strong { display: inline-flex; align-items: center; gap: 7px; font-size: var(--fs-lg); }
.sheet-head .mico { color: var(--primary); }
.sheet-close {
    width: var(--tap, 44px);
    height: var(--tap, 44px);
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}
.sheet-close:active { background: var(--surface-2); }
.sheet-body {
    display: grid;
    gap: var(--sp-3);
    padding: var(--sp-4);
    overflow-y: auto;
}
.sheet-body .filter-field { min-width: 0; }
.sheet-body .filter-label { display: block; }
.sheet-body .field > label { font-size: var(--fs-sm); }
.sheet-actions {
    display: flex;
    gap: var(--sp-2);
    padding: var(--sp-3) var(--sp-4) calc(var(--sp-3) + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border);
    background: var(--surface);
}
.sheet-actions .btn { flex: 1; min-height: var(--ctl-md, 44px); }
body:has(dialog[open]) { overflow: hidden; }

/* --------------------------------------------------- ط¬ط²ط¦غŒط§طھ ع©ظ„غŒط¯/ظ…ظ‚ط¯ط§ط± */
table.kv tbody th {
    width: 200px;
    background: var(--surface-2);
    color: var(--text-2);
    font-weight: 700;
}

/* ------------------------------------------------------- ظ†ظˆط§ط± ط§ظ‚ط¯ط§ظ… ظپط±ظ… */
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* ------------------------------------------------------------- ط¨ط¬ ط±ظ†ع¯غŒ ط§ظ¾ */
.pill-soft {
    display: inline-flex; align-items: center; gap: 5px;
    background: var(--primary-soft); color: var(--primary);
    border-radius: var(--radius-pill);
    padding: 4px 12px; font-size: .74rem; font-weight: 700;
}

/* ==========================================================================
   ظ…ظˆط¨ط§غŒظ„: ظپظ‡ط±ط³طھ ط¬ط¯ظˆظ„غŒ ط¨ظ‡ ع©ط§ط±طھâ€Œظ‡ط§غŒ ط§ظ¾ظ„غŒع©غŒط´ظ†غŒ طھط¨ط¯غŒظ„ ظ…غŒâ€Œط´ظˆط¯
   (ظ‡ط± ط±ع©ظˆط±ط¯ غŒع© ع©ط§ط±طھ ط³ظپغŒط¯ ظ…ط³طھظ‚ظ„طŒ ظ…ط«ظ„ طµظپط­ظ‡ظ” آ«ط¯ط§ظ†ط´â€Œط¢ظ…ظˆط²ط§ظ†آ» ط§ظ¾ظ„غŒع©غŒط´ظ† ط´ط§ط¯)
   ========================================================================== */
@media (max-width: 700px) {
    .table-card { background: transparent; border: 0; box-shadow: none; overflow: visible; }
    .table-card > .table-wrap, .table-card .table-wrap { overflow: visible; border-radius: 0; }

    table.tbl.responsive { display: block; }
    table.tbl.responsive thead { display: none; }
    table.tbl.responsive tbody { display: block; }

    table.tbl.responsive tbody tr {
        display: block;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: 18px;
        box-shadow: var(--shadow);
        padding: 6px 13px;
        margin-bottom: 10px;
    }
    table.tbl.responsive tbody tr:hover { background: var(--surface); }

    table.tbl.responsive tbody td {
        display: flex; align-items: center; justify-content: space-between;
        gap: 12px;
        padding: 8px 0;
        border-bottom: 1px dashed var(--border);
        text-align: left;
    }
    table.tbl.responsive tbody td:last-child { border-bottom: 0; }
    table.tbl.responsive tbody td::before {
        content: attr(data-label);
        font-size: .72rem; font-weight: 700; color: var(--muted);
        flex: 0 0 auto;
    }
    /* ط³طھظˆظ† ط±ط¯غŒظپ ظˆ ط¨ط±ع†ط³ط¨ آ«عملیاتآ» ط¯ط± ع©ط§ط±طھ ظ†ظ…ط§غŒط´ ط¯ط§ط¯ظ‡ ظ†ظ…غŒâ€Œط´ظˆظ†ط¯ */
    table.tbl.responsive tbody td[data-label="#"] { display: none; }
    table.tbl.responsive tbody td[data-label="عملیات"] { justify-content: flex-end; border-bottom: 0; }
    table.tbl.responsive tbody td[data-label="عملیات"]::before { display: none; }
    table.tbl.responsive tbody td.grow-cell { justify-content: flex-start; padding-top: 11px; }
    table.tbl.responsive tbody td.grow-cell::before { display: none; }
    table.tbl.responsive .actions { width: 100%; }
    table.tbl.responsive .actions .btn { flex: 1; }

    .empty-cell { display: block !important; }
    .empty-cell::before { display: none !important; }

    /*
     * ط¬ط¯ظˆظ„â€Œظ‡ط§غŒ آ«ع©ظ„غŒط¯/ظ…ظ‚ط¯ط§ط±آ» â€” غŒط¹ظ†غŒ ط¬ط¯ظˆظ„â€Œظ‡ط§غŒغŒ ع©ظ‡ ط¯ط± ط¨ط¯ظ†ظ‡â€Œط´ط§ظ† `th` ط¯ط§ط±ظ†ط¯ â€”
     * ط¯ط± ظ…ظˆط¨ط§غŒظ„ ظ¾ط´طھظ‡â€Œط§غŒ ظ…غŒâ€Œط´ظˆظ†ط¯: ط¨ط±ع†ط³ط¨ ط¨ط§ظ„ط§طŒ ظ…ظ‚ط¯ط§ط± ظ¾ط§غŒغŒظ†.
     * ظ…ط«ظ„ طµظپط­ظ‡ظ” آ«ظ¾ط±ظˆظ†ط¯ظ‡ظ” ط¯ط§ظ†ط´â€Œط¢ظ…ظˆط²آ» ط¯ط± ط§ظ¾ظ„غŒع©غŒط´ظ†.
     * ط¬ط¯ظˆظ„â€Œظ‡ط§غŒ ط¯ط§ط¯ظ‡â€Œط§غŒ (ط¨ط§ `thead`) ظˆ ط¬ط¯ظˆظ„â€Œظ‡ط§غŒ `responsive` ط¯ط³طھâ€Œظ†ط®ظˆط±ط¯ظ‡ ظ…غŒâ€Œظ…ط§ظ†ظ†ط¯.
     */
    table.tbl:has(tbody th) { display: block; }
    table.tbl:has(tbody th) tbody { display: block; }
    table.tbl:has(tbody th) tbody tr {
        display: block;
        padding: 9px 0;
        border-bottom: 1px solid var(--border);
    }
    table.tbl:has(tbody th) tbody tr:last-child { border-bottom: 0; }
    table.tbl:has(tbody th) tbody th {
        display: block; width: auto !important;
        background: transparent !important;
        padding: 0 0 2px;
        border: 0;
        font-size: .72rem; font-weight: 700; color: var(--muted);
    }
    table.tbl:has(tbody th) tbody td {
        display: block;
        border: 0;
        padding: 0;
        font-weight: 600;
        font-size: .86rem;
    }

    /* ظ†ظˆط§ط± ط§ظ‚ط¯ط§ظ… ظپط±ظ… ع†ط³ط¨غŒط¯ظ‡ ط¨ظ‡ ظ¾ط§غŒغŒظ†طŒ ظ…ط«ظ„ ط§ظ¾ظ„غŒع©غŒط´ظ†â€Œظ‡ط§ */
    .form-actions {
        position: sticky;
        inset-block-end: calc(var(--bottomnav-h) + 8px);
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: var(--radius-pill);
        padding: 8px;
        box-shadow: var(--shadow-lg);
        z-index: 20;
    }
    .form-actions .btn { flex: 1; }

    /* ط¹ظ†ظˆط§ظ† طµظپط­ظ‡ ط¯ط± ظ…ظˆط¨ط§غŒظ„ ط¯ط§ط®ظ„ ظ†ظˆط§ط± ط³ط¨ط² ط¨ط§ظ„ط§ط³طھط› طھع©ط±ط§ط± ط¢ظ† ط­ط°ظپ ظ…غŒâ€Œط´ظˆط¯ */
    .page-title { display: none; }

    /* ظ†ظˆط§ط± ط¬ط³طھâ€Œظˆط¬ظˆ ظˆ ظپغŒظ„طھط±: ظ‡ط± ظپغŒظ„ط¯ غŒع© ط±ط¯غŒظپ طھظ…ط§ظ…â€Œط¹ط±ط¶ */
    .filter-bar { display: grid; gap: 9px; }
    .filter-bar > div { min-width: 0 !important; }
    .filter-bar .btn { width: 100%; }
    .profile-head { padding: 15px; border-radius: 20px; }
    .profile-head .avatar { width: 48px; height: 48px; flex-basis: 48px; font-size: 1.1rem; }
    .profile-head .ph-name { font-size: 1.02rem; }
    body.chat-page .form-actions { position: static; }
}

/* ------------------------------------------------ اعلان‌های زنده (زنگ بالای صفحه) */
.notif-badge {
    position: absolute;
    top: -4px;
    inset-inline-end: -4px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: var(--radius-pill);
    background: #ef4444;
    color: #fff;
    font-size: .62rem;
    font-weight: 700;
    line-height: 17px;
    text-align: center;
    box-shadow: 0 0 0 2px #fff;
}

[data-notify-bell] { position: relative; }

.notify-menu { min-width: 260px; }

.notify-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 11px 4px;
    font-size: .74rem;
    color: var(--muted);
}

.notify-act {
    margin-inline-start: auto;
    border: 0;
    background: transparent;
    color: var(--primary);
    font-family: inherit;
    font-size: .72rem;
    font-weight: 600;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: var(--radius-pill);
}

.notify-act:hover { background: var(--surface-2); }

.notify-live { display: grid; gap: 2px; padding: 4px 0; }

/* اسکلت بارگذاری اعلان‌ها (پیش از اولین پاسخ نبض) */
.notify-skeleton { display: grid; gap: 9px; padding: 9px 11px; }
.skeleton-row { display: flex; align-items: center; gap: 8px; }
.skeleton-lines { display: grid; flex: 1; gap: 5px; }
.skeleton {
    display: block;
    border-radius: 7px;
    background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 50%, var(--surface-2) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.2s linear infinite;
}
.skeleton-avatar { width: 30px; height: 30px; flex: 0 0 30px; border-radius: 50%; }
.skeleton-line { height: 9px; }
.skeleton-line.w-60 { width: 60%; }
.skeleton-line.w-70 { width: 70%; }
.skeleton-line.w-90 { width: 90%; }
@keyframes skeleton-shimmer {
    from { background-position: 200% 0; }
    to { background-position: -200% 0; }
}
@media (prefers-reduced-motion: reduce) {
    .skeleton { animation: none; }
}

.notify-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 7px 11px;
    border-radius: var(--radius-sm);
}

.notify-item:hover { background: var(--surface-2); }

.notify-title {
    display: block;
    font-size: .8rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notify-body {
    display: block;
    font-size: .72rem;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 210px;
}

@media (max-width: 640px) {
    .notify-menu { min-width: 0; width: min(88vw, 300px); }
    .notify-body { max-width: none; }
}

/* ------------------------------------------------ لوگو در سرصفحه و صفحهٔ ورود */
.brand-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: inherit;
    display: block;
}

/* سربرگ چاپی مشترک اسناد (کارنامه، صورت‌حساب، گواهی‌نامه، گزارش‌ها) */
.letterhead img { border-radius: 10px; }
.letterhead-body { line-height: 1.6; }

@media print {
    .letterhead { border-bottom-color: #16a34a !important; }
}

/* ==========================================================================
   حالت شب (پوستهٔ تاریک) — کلید data-theme="dark" روی <html>
   همهٔ اجزای سامانه رنگ خود را از متغیرهای :root می‌گیرند؛ این بخش فقط همان
   متغیرها را بازنویسی می‌کند و چند موردی که رنگ ثابت داشتند (بج‌ها، هشدارها،
   آواتارها، اسکرول‌بار، کارت‌های سفید و خط زمانی).
   انتخاب کاربر در localStorage نگه داشته می‌شود و در <head> پیش از رسم صفحه
   اعمال می‌گردد تا «فلش روشن» نداشته باشیم.
   ========================================================================== */
[data-theme="dark"] {
    color-scheme: dark;

    --bg: #0f151a;
    --surface: #161d24;
    --surface-2: #1c242c;
    --border: #26313a;
    --border-strong: #35424d;

    --text: #e9eff5;
    --text-2: #b6c3cf;
    --muted: #9aa8b5;

    --primary: #21c46f;
    --primary-2: #16a35c;
    --primary-strong: #0e804a;
    --accent-text: #6ee7b7;
    --primary-soft: #12301f;
    --gradient: linear-gradient(135deg, #1fbd6c 0%, #10874f 100%);
    --gradient-strong: linear-gradient(135deg, #0e804a 0%, #0a6238 100%);
    --gradient-soft: linear-gradient(135deg, #122318 0%, #0f1c15 100%);
    --ring: rgba(33, 196, 111, .3);
    --shadow-brand: 0 10px 24px rgba(0, 0, 0, .5);

    --blue: #58a6ff;
    --blue-soft: #152a3d;
    --green: #21c46f;
    --green-soft: #12301f;
    --amber: #f0a626;
    --amber-soft: #382a14;
    --red: #f4736a;
    --red-soft: #3a1e1c;

    --shadow: 0 2px 10px rgba(0, 0, 0, .4);
    --shadow-lg: 0 18px 44px rgba(0, 0, 0, .55);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb,
[data-theme="dark"]::-webkit-scrollbar-thumb { background: #3c4a57; }

/* متن بج‌ها و هشدارها روی زمینهٔ تیره روشن‌تر شود */
[data-theme="dark"] .badge.success,
[data-theme="dark"] .alert.success,
[data-theme="dark"] .grade-pill,
[data-theme="dark"] .ok { color: #5fe0a0; }
[data-theme="dark"] .badge.danger,
[data-theme="dark"] .alert.error,
[data-theme="dark"] .grade-pill.low,
[data-theme="dark"] .bad,
[data-theme="dark"] .rec-hint { color: #fca5a5; }
[data-theme="dark"] .badge.warning,
[data-theme="dark"] .alert.warning,
[data-theme="dark"] .grade-pill.mid { color: #fcd34d; }
[data-theme="dark"] .badge.info,
[data-theme="dark"] .alert.info { color: #93c5fd; }
[data-theme="dark"] .badge.muted,
[data-theme="dark"] .progress { background: #232c35; }

/* کارت‌های سفید داخل برگهٔ آزمون و کاشی‌های دسترسی سریع */
[data-theme="dark"] .answer-text,
[data-theme="dark"] .essay-chip,
[data-theme="dark"] .answer-file { background: var(--surface); }
[data-theme="dark"] .tile .ico { background: var(--surface-2); }
[data-theme="dark"] .timeline .tl-item::before { border-color: var(--surface); }

/* نوار حالت سخت‌گیرانهٔ آزمون (کهربایی روشن ← کهربایی تیره) */
[data-theme="dark"] .proctor-bar {
    background: #382a14; color: #fbd9a5;
    border-color: #6b4a13; border-inline-start-color: #f97316;
}
[data-theme="dark"] .proctor-bar b { color: #fdba74; }
[data-theme="dark"] .proctor-note { background: #3a1e1c; color: #fca5a5; }

/* آواتارهای رنگی (پاستل روشن ← تیره) */
[data-theme="dark"] .avatar.av-0 { background: #2b2350; color: #c4b5fd; border-color: #3b3168; }
[data-theme="dark"] .avatar.av-1 { background: #16304f; color: #93c5fd; border-color: #1e3f66; }
[data-theme="dark"] .avatar.av-2 { background: #123a2a; color: #6ee7b7; border-color: #1a4d38; }
[data-theme="dark"] .avatar.av-3 { background: #3a2c12; color: #fcd34d; border-color: #4d3a17; }
[data-theme="dark"] .avatar.av-4 { background: #3a1e1c; color: #fca5a5; border-color: #4d2825; }
[data-theme="dark"] .avatar.av-5 { background: #12333a; color: #67e8f9; border-color: #184650; }

/* پس‌زمینهٔ صفحهٔ ورود (به‌جای استایل درون‌خطی، تا حالت شب را هم پوشش دهد) */
.guest-bg { background: linear-gradient(140deg, #e7f8ef 0%, #f4fdf8 55%, #f2f5f7 100%); }
[data-theme="dark"] .guest-bg { background: linear-gradient(140deg, #11201a 0%, #0f1b16 55%, #0f151a 100%); }

/* چاپ همیشه روشن باشد، حتی وقتی حالت شب روشن است */
@media print {
    html[data-theme="dark"] {
        --bg: #fff; --surface: #fff; --surface-2: #fff;
        --border: #ddd; --border-strong: #ccc;
        --text: #111; --text-2: #333; --muted: #666;
        --primary-soft: #e7f8ef; --shadow: none; --shadow-lg: none;
    }
    html[data-theme="dark"] body { background: #fff; color: #111; }
}

/* ═══════════════════════════ آیکون فلت تک‌رنگ سراسری (.mico) ═══════════════════════
   همهٔ آیکون‌های سامانه از کامپوننت <x-icon> می‌آیند: آیکون خطی تک‌رنگ که رنگش را
   از متن می‌گیرد (currentColor) ⇒ حالت شب و زمینه‌های سبز خودکار درست است.
   نگهبان: tests/Unit/IconSetTest.php (هیچ ایموجی در ویوها/اسکریپت‌ها نماند).
   ══════════════════════════════════════════════════════════════════════════════ */
.mico {
    display: inline-block;
    vertical-align: -.18em;
    flex: none;
}
/* اسپرایت آیکون‌ها هرگز نباید جای بگیرد (‌مستقل از ترتیب بارگذاری CSS) */
.visually-hidden {
    position: absolute !important;
    width: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
    clip-path: inset(50%);
}
/* آیکون وابسته به روشنایی (کلید حالت شب و صفحهٔ خانگی) */
.only-dark { display: none !important; }
[data-theme="dark"] .only-light { display: none !important; }
[data-theme="dark"] .only-dark { display: inline-block !important; }
.btn .mico,
.card-head .mico,
.tile .mico,
.stat-ico .mico,
.nav-item .mico,
.bottom-nav .mico {
    pointer-events: none;
}
.card-head .mico { color: var(--primary); }
.tile .mico,
.stat-ico .mico { color: inherit; }
.alert .mico { vertical-align: -.22em; margin-inline-end: 6px; }
.badge .mico { vertical-align: -.24em; }
.dropdown-menu .mico { color: var(--muted); }
.dropdown-menu a:hover .mico,
.dropdown-menu button:hover .mico { color: var(--primary); }
.stat-ico .mico,
.nav-item .ico .mico,
.bottom-nav a .ico .mico { display: block; }
[data-theme="dark"] .stat-ico,
[data-theme="dark"] .stat-ico.grad { background: var(--surface-2); }

/* --------- عناصر پویا (JS) که آیکون SVG دارند: هم‌ترازی و فاصلهٔ یکدست ---------
   این عناصر پیش‌تر ایموجی متنی داشتند؛ اکنون آیکون SVG درون‌شان می‌نشیند و
   باید خودشان مرکزچین باشند (فاصلهٔ متن از آیکون هم از gap می‌آید). */
.bulk-bar .bulk-btn,
.live-person .mini,
.hand-chip { display: inline-flex; align-items: center; gap: 5px; }
.reply-bar .reply-cancel,
.msg-menu .msg-menu-item .ico,
.chat-compose .compose-btn,
.dp-wrap .dp-toggle,
.pwa-actions .pwa-close,
.att-file .af-ico,
.att-file .af-dl,
.tray-item .ti-ico,
.tray-item .ti-del,
.attach-ico,
.notify-item > span:first-child { display: grid; place-items: center; }
.att-file .af-ico { width: 26px; flex: none; }
.reply-bar .reply-cancel { width: 26px; height: 26px; }
.pwa-actions .pwa-close { width: 26px; height: 26px; }
.notify-item > span:first-child { color: var(--primary); }
.tray-item .attach-ico { width: 26px; height: 26px; }
.attach-ico { display: grid; place-items: center; }

/* ═══════════════════════════════════════════════════════════════════════════
   طراحی سیستمی v2 — مقیاس‌ها، پوستهٔ اپلیکیشنی و مؤلفه‌های پایه
   ───────────────────────────────────────────────────────────────────────────
   هدف: «اپلیکیشن native در موبایل، تمیز و جادار در دسکتاپ».
   ۱) همهٔ اندازه‌ها از توکن‌ها می‌آیند (فاصله/شعاع/فونت/ارتفاع کنترل/آیکون)
   ۲) واحدها rem هستند و ریشهٔ فونت ۱۶px است ⇒ rem = px طراحی، بدون کوچک‌شدن
      تدریجی (پیش‌تر ریشه ۱۴px بود و همهٔ remها ۱۴٪ کوچک‌تر درمی‌آمدند).
   ۳) موبایل‌اول: قاعدهٔ پایه برای موبایل، سپس @media (min-width: 901px).
   ═══════════════════════════════════════════════════════════════════════════ */
:root {
    /* فاصله‌ها (ریتم ۴px) */
    --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
    --sp-5: 20px; --sp-6: 24px; --sp-7: 32px;
    --gutter: 14px;          /* حاشیهٔ افقی محتوا در موبایل */

    /* شعاع */
    --r-xs: 10px; --r-sm: 14px; --r-md: 18px; --r-lg: 24px; --r-full: 999px;

    /* تایپوگرافی */
    --fs-xs: .72rem;    /* ۱۱٫۵px — برچسب‌های ریز */
    --fs-sm: .8rem;     /* ۱۲٫۸px — متن کمکی */
    --fs-md: .875rem;   /* ۱۴px   — متن پایه */
    --fs-lg: .95rem;    /* ۱۵٫۲px — عنوان کارت */
    --fs-xl: 1.05rem;   /* ۱۶٫۸px */
    --fs-2xl: 1.25rem;  /* ۲۰px   — عنوان صفحه */
    --fs-3xl: 1.45rem;  /* ۲۳px   — عدد بزرگ */

    /* ارتفاع کنترل و اندازهٔ آیکون (--ctl-sm در موبایل بزرگ‌تر است تا لمس راحت باشد) */
    --ctl-sm: 36px; --ctl-md: 40px; --ctl-lg: 46px;
    --ico-sm: 16px; --ico-md: 18px; --ico-lg: 22px;

    --topbar-h: 58px;
    --bottomnav-h: 60px;
    --sidebar-w: 268px;
    --shell-max: 1180px;
}

html { font-size: 16px; }
body { font-size: var(--fs-md); line-height: 1.75; -webkit-tap-highlight-color: transparent; }

/* فوکوس واضح برای کیبورد و صفحه‌خوان (بدون تغییر ظاهر کلیک موس) */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}
.topbar :focus-visible,
.bottom-nav :focus-visible { outline-color: #fff; }
.btn-primary:focus-visible,
.fab:focus-visible { outline-color: var(--text); }

/* نوار پیشرفت ناوبری — بازخورد فوری مثل اپ‌های نیتیو */
.nav-progress {
    position: fixed;
    inset-inline: 0;
    top: 0;
    z-index: 1000;
    height: 3px;
    pointer-events: none;
    opacity: 0;
}
.nav-progress::after {
    content: '';
    display: block;
    width: 0;
    height: 100%;
    background: var(--primary-strong);
    box-shadow: 0 0 8px var(--ring);
}
.nav-progress.on { opacity: 1; }
.nav-progress.on::after { animation: nav-progress 2.2s ease-out forwards; }
@keyframes nav-progress {
    0% { width: 0; }
    45% { width: 55%; }
    100% { width: 88%; }
}
@media (prefers-reduced-motion: reduce) {
    .nav-progress.on::after { animation: none; width: 100%; }
}

/* حس اپلیکیشن native: بدون تأخیر لمس و بدون برجسته‌سازی آبی */
a, button, .btn, .tile, .nav-item, .chip, .tab, .bottom-nav a,
input, select, textarea { touch-action: manipulation; }
.sidebar { overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.list-item, .nav-item, .tile { -webkit-user-select: none; user-select: none; }

/* ------------------------------------------------------------------ پوسته */
.app-shell { display: flex; min-height: 100vh; min-height: 100dvh; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.content {
    padding: var(--sp-4) var(--gutter) calc(var(--bottomnav-h) + var(--sp-6));
    flex: 1;
    width: 100%;
}
.content > h1,
.page-head h1 { font-size: var(--fs-2xl); font-weight: 800; line-height: 1.4; }
.content h2 { font-size: var(--fs-xl); }
.content h3 { font-size: var(--fs-lg); }

/* نوار بالا: همیشه سبز و اپلیکیشنی، همهٔ کنترل‌ها هم‌قد */
.topbar {
    min-height: var(--topbar-h);
    padding: var(--sp-2) var(--gutter);
    gap: var(--sp-2);
    background: var(--gradient-strong);
    border-bottom: 0;
    box-shadow: 0 6px 18px rgba(11, 143, 82, .16);
}
.topbar-title { color: #fff; font-weight: 800; font-size: var(--fs-md); line-height: 1.3; }
.topbar-sub { color: rgba(255, 255, 255, .82); font-size: var(--fs-xs); }
.topbar .burger,
.topbar .btn,
.topbar .dropdown-toggle {
    min-height: var(--ctl-md);
    height: var(--ctl-md);
    padding: 0 var(--sp-3);
    border-radius: var(--r-sm);
    font-size: var(--fs-sm);
    background: rgba(255, 255, 255, .16);
    border-color: transparent;
    color: #fff;
}
.topbar .burger { width: var(--ctl-md); padding: 0; display: grid; place-items: center; }
.topbar .burger:hover,
.topbar .btn:hover,
.topbar .dropdown-toggle:hover { background: rgba(255, 255, 255, .28); }
.topbar .avatar { width: var(--ctl-md); height: var(--ctl-md); flex-basis: var(--ctl-md); font-size: var(--fs-sm); }
.topbar .bonus,
.topbar .school-badge { font-size: var(--fs-xs); }

/* نوار پایین (فقط موبایل): آیکون بزرگ‌تر، برچسب خوانا، ناحیهٔ لمس راحت */
.bottom-nav {
    padding: 6px var(--sp-2) calc(6px + env(safe-area-inset-bottom));
    box-shadow: 0 -6px 22px rgba(16, 32, 48, .08);
}
.bottom-nav a {
    min-height: 46px;
    padding: 3px 0 2px;
    gap: 2px;
    font-size: var(--fs-xs);
    border-radius: var(--r-sm);
}
.bottom-nav a .ico {
    width: 42px; height: 28px;
    border-radius: 12px;
}
.bottom-nav a .mico,
.bottom-nav button .mico { width: var(--ico-lg); height: var(--ico-lg); }
.bottom-nav button .ico .mico { display: block; }

/* ----------------------------------------------------------- کارت‌ها */
.card { border-radius: var(--r-md); }
.card + .card { margin-top: var(--sp-3); }
.card-head {
    padding: var(--sp-3) var(--sp-4);
    min-height: 54px;
    gap: var(--sp-2);
    border-bottom: 1px solid var(--border);
}
.card-head h2, .card-head h3 { font-size: var(--fs-lg); }
.card-head .mico { color: var(--primary); }
.card-body { padding: var(--sp-4); }
.card-body.tight { padding: var(--sp-2); }

/* ---------------------------------------------------- کارت‌های آماری */
.stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); }
.stat { padding: var(--sp-3); gap: var(--sp-3); border-radius: var(--r-md); }
.stat-ico { width: 42px; height: 42px; flex: 0 0 42px; border-radius: var(--r-sm); }
.stat-ico .mico { width: var(--ico-lg); height: var(--ico-lg); }
.stat-value { font-size: var(--fs-2xl); line-height: 1.35; }
.stat-label { font-size: var(--fs-sm); line-height: 1.6; }

/* --------------------------------------------------- شبکهٔ دسترسی سریع */
.tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-2); }
.tile { padding: var(--sp-3) var(--sp-1); gap: var(--sp-2); font-size: var(--fs-sm); border-radius: var(--r-sm); }
.tile .ico { width: 42px; height: 42px; border-radius: var(--r-sm); }
.tile .ico .mico { width: var(--ico-lg); height: var(--ico-lg); }

/* -------------------------------------------------------------- دکمه‌ها */
.btn {
    min-height: var(--ctl-lg);
    padding: 10px 18px;
    gap: 6px;
    font-size: var(--fs-md);
    border-radius: var(--r-full);
}
.btn-sm { min-height: var(--ctl-sm); padding: 6px 13px; font-size: var(--fs-sm); }
.btn-icon { width: var(--ctl-md); min-height: var(--ctl-md); padding: 0; }
.btn-block { width: 100%; }
.btn .mico { width: var(--ico-md); height: var(--ico-md); }

/* ---------------------------------------------------------- فرم‌ها */
label, .field > label, .form-grid label { font-size: var(--fs-sm); font-weight: 700; }
input[type=text], input[type=number], input[type=email], input[type=password],
input[type=date], input[type=time], input[type=tel], input[type=url], input[type=search],
select, textarea {
    min-height: var(--ctl-lg);
    padding: 10px 14px;
    font-size: var(--fs-md);
    font-family: inherit;
    border-radius: var(--r-sm);
}
textarea { min-height: 96px; }
.form-grid { gap: var(--sp-4); }

/* ---------------------------------------------------------- جدول‌ها */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl { font-size: var(--fs-sm); }
.tbl thead th { padding: 11px var(--sp-3); font-size: var(--fs-xs); }
.tbl tbody td { padding: 11px var(--sp-3); }
.tbl td .btn-sm { min-height: var(--ctl-sm); }

/* ------------------------------------------------- ردیف فهرست و چیپ و بج */
.list-item { min-height: 58px; padding: var(--sp-3) var(--sp-1); gap: var(--sp-3); font-size: var(--fs-md); }
.list-item .mico { width: var(--ico-md); height: var(--ico-md); }
.chip { min-height: 36px; padding: 6px 14px; font-size: var(--fs-sm); border-radius: var(--r-full); }
.chip .mico { width: var(--ico-sm); height: var(--ico-sm); }
.badge { font-size: var(--fs-xs); padding: 3px 10px; border-radius: var(--r-full); line-height: 1.7; }
.alert { padding: var(--sp-3) var(--sp-4); font-size: var(--fs-md); border-radius: var(--r-sm); }
.empty { padding: var(--sp-7) var(--sp-4); font-size: var(--fs-md); }
.empty .big { font-size: 2rem; }
.section-title { font-size: var(--fs-lg); gap: var(--sp-2); margin: var(--sp-2) 0 var(--sp-3); }
.section-title .ico { width: 34px; height: 34px; border-radius: 12px; }
.section-title .ico .mico { width: var(--ico-md); height: var(--ico-md); }

/* --------------------------------------------------------- تب و منو */
.tabs { padding: 4px; gap: 4px; }
.tab { min-height: 36px; padding: 6px 15px; font-size: var(--fs-sm); }
.dropdown-menu { min-width: 236px; padding: 6px; border-radius: var(--r-md); }
.dropdown-menu a, .dropdown-menu button {
    min-height: 44px;
    padding: 10px var(--sp-3);
    gap: var(--sp-2);
    font-size: var(--fs-md);
    border-radius: var(--r-xs);
}
.dropdown-menu .mico { width: var(--ico-md); height: var(--ico-md); }
.fab { width: 56px; height: 56px; }
.progress { height: 8px; border-radius: var(--r-full); }

/* --------------------------------------------------- منوی کناری (اپ) */
.sidebar { padding: var(--sp-4) var(--sp-3); }
.brand { padding: var(--sp-1) var(--sp-2) var(--sp-4); gap: var(--sp-3); }
.brand-logo { width: 44px; height: 44px; border-radius: var(--r-sm); font-size: var(--fs-xl); }
.brand-name { font-size: var(--fs-lg); }
.brand-sub { font-size: var(--fs-xs); }
.nav-group { margin-bottom: var(--sp-4); }
.nav-group-title { font-size: var(--fs-xs); padding: 6px var(--sp-3); margin-bottom: var(--sp-1); }
.nav-item { min-height: 44px; padding: var(--sp-2) var(--sp-3); gap: var(--sp-3); font-size: var(--fs-sm); border-radius: var(--r-sm); }
.nav-item .ico { width: 32px; height: 32px; flex: 0 0 32px; border-radius: var(--r-xs); }
.nav-item .ico .mico { width: var(--ico-md); height: var(--ico-md); }
.nav-item.active .ico { background: #fff; box-shadow: 0 2px 8px var(--ring); }
.side-user { padding: var(--sp-3); gap: var(--sp-3); border-radius: var(--r-sm); }
.su-name { font-size: var(--fs-md); }
.su-role { font-size: var(--fs-xs); }

/* --------------------------------------------------- دروازهٔ صفحه */
.hero { border-radius: var(--r-lg); padding: var(--sp-5); gap: var(--sp-2); }
.hero h1 { font-size: var(--fs-2xl); font-weight: 800; line-height: 1.45; }
.hero p { font-size: var(--fs-md); }
.page-title { font-size: var(--fs-2xl); font-weight: 800; }
.page-sub { font-size: var(--fs-sm); color: var(--muted); }

/* ═══════════════════════════════════════════════ دسکتاپ (≥ ۹۰۱px) ═══════════ */
@media (min-width: 901px) {
    :root { --gutter: 26px; --ctl-sm: 34px; --ctl-lg: 42px; }
    .content { padding: var(--sp-6) var(--sp-7) var(--sp-7); max-width: var(--shell-max); margin-inline: auto; }
    .topbar { padding: 0 var(--sp-6); gap: var(--sp-3); }
    .topbar .burger { display: none; }
    .stat-grid { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: var(--sp-3); }
    .stat { padding: var(--sp-4); }
    .stat-ico { width: 46px; height: 46px; flex-basis: 46px; }
    .tiles { grid-template-columns: repeat(auto-fill, minmax(134px, 1fr)); gap: var(--sp-3); }
    .tile { padding: var(--sp-4) var(--sp-2); }
    .tile .ico { width: 46px; height: 46px; }
    .card-head { padding: var(--sp-3) var(--sp-5); }
    .card-body { padding: var(--sp-5); }
    .card + .card { margin-top: var(--sp-4); }
    .btn { min-height: var(--ctl-md); }
    .tbl { font-size: var(--fs-md); }
    .tbl thead th, .tbl tbody td { padding: 12px var(--sp-4); }
    .dropdown-menu a, .dropdown-menu button { min-height: 42px; }
    .sidebar { padding: var(--sp-5) var(--sp-4); }
    .nav-item { min-height: 42px; }
    .content > h1, .page-head h1, .hero h1 { font-size: var(--fs-3xl); }
    .hero { padding: var(--sp-6); }
}

@media (max-width: 640px) {
    .topbar .school-badge { display: none; }
    .topbar .btn .nowrap { display: none; }
    .topbar .btn { padding: 0 var(--sp-2); }
}

/* چاپ: پوسته پنهان و اندازه‌ها بدون حاشیهٔ اپ */
@media print {
    .content { padding: 0; max-width: none; margin: 0; }
    .sidebar, .topbar, .bottom-nav, .fab, .no-print { display: none !important; }
    .card, .stat, .tile, .hero { box-shadow: none; border-radius: 0; }
    .card-head, .card-body { padding: 8px 0; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   طراحی سیستمی v3 — «حس اپلیکیشن native در موبایل»
   ───────────────────────────────────────────────────────────────────────────
   این بلوک در انتهای فایل است تا قواعد موبایل را روی لایه‌های قبلی تنظیم کند و
   چیدمان دسکتاپ (≥ ۹۰۱px) دست‌نخورده بماند. معیارها، همان‌طور که در اپ‌های بومی:

   ۱) ناحیهٔ لمس ≥ ۴۴px  (استاندارد Apple HIG / Google Material)
   ۲) کف فونت ۱۲px و متن پایه ۱۵px (کف خوانایی روی گوشی)
   ۳) ورودی‌های فرم ۱۶px ⇒ iOS هنگام فوکوس دیگر صفحه را زوم نمی‌کند
   ۴) فیدبک فوری لمس (:active) — بدون آن، لمس «مرده» حس می‌شود
   ۵) احترام به safe-area (نُچ بالای صفحه و نوار خانهٔ پایین آیفون)
   ۶) بدون انتخاب‌شدن متنِ کنترل‌ها و بدون تأخیر لمس
   ═══════════════════════════════════════════════════════════════════════════ */

/* فونت در چرخش گوشی باد نمی‌کند (مثل اپ بومی) و کل صفحه کشیده نمی‌شود */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { overscroll-behavior-y: none; }

/* کنترل‌ها را نمی‌توان انتخاب/کپی کرد (مثل دکمه‌های اپ بومی) */
.btn, .btn-sm, .chip, .badge, .tab, .dropdown-toggle,
.bottom-nav, .bottom-nav a, .topbar, .fab, .pagination-wrap, .actions {
    -webkit-user-select: none;
    user-select: none;
}

/* ------------------------------------------------- ۱) فیدبک فوری لمس */
.btn, .nav-item, .bottom-nav a, .tile, .chip, .tab, .list-item, .fab,
.dropdown-menu a, .dropdown-menu button, .icon-btn,
.side-close, .side-logout, .card-head .btn, summary {
    transition: transform .1s ease, background-color .1s ease, box-shadow .1s ease, opacity .1s ease;
}

.btn:active, .nav-item:active, .tile:active, .chip:active, .tab:active,
.bottom-nav a:active, .dropdown-menu a:active, .dropdown-menu button:active,
.icon-btn:active, .side-close:active, .side-logout:active,
.card-head .btn:active, summary:active {
    transform: scale(.96);
}

.list-item:active { background: var(--surface-2); }
.bottom-nav a:active { transform: scale(.92); }
.fab:active { transform: scale(.9); box-shadow: var(--shadow-brand); }

/* ورود ملایم صفحه (فقط محو شدن — بدون transform تا عناصر fixed نشکنند) */
@keyframes app-enter { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: no-preference) {
    .content { animation: app-enter .18s ease-out both; }
}

/* ------------------------------------------------- ۲) تنظیمات موبایل */
@media (max-width: 900px) {

    /* توکن‌های موبایل — ناحیهٔ لمس و مقیاس تایپوگرافی */
    :root {
        /* کف ۱۳px، متن پایه ۱۶px، عنوان کارت ۱۷px (مقیاس خوانا و نیتیو) */
        --fs-xs: .8125rem;    /* ۱۳px */
        --fs-sm: .875rem;     /* ۱۴px */
        --fs-md: 1rem;        /* ۱۶px */
        --fs-lg: 1.0625rem;   /* ۱۷px */
        --fs-xl: 1.175rem;    /* ۱۸٫۸px */
        --fs-2xl: 1.5rem;     /* ۲۴px — عنوان صفحه */
        --fs-3xl: 1.75rem;    /* ۲۸px */

        --ctl-sm: 44px;       /* کنترل کوچک: ناحیهٔ لمس راحت */
        --ctl-md: 44px;
        --ctl-lg: 48px;
        --gutter: 16px;       /* حاشیهٔ افقی محتوا (استاندارد اپ) */
        --tap: 44px;          /* کمینهٔ ناحیهٔ لمس */
    }

    /* ورودی‌ها ۱۶px ⇒ جلوگیری از زوم خودکار iOS روی فوکوس */
    input[type=text], input[type=number], input[type=email], input[type=password],
    input[type=date], input[type=time], input[type=tel], input[type=url],
    input[type=search], input[type=file], select, textarea {
        font-size: 16px;
    }

    /* ناحیهٔ لمس: دکمهٔ کوچک، تب، چیپ کلیک‌شدنی و آیکون‌دکمه‌ها */
    .btn-sm { min-height: var(--ctl-sm); padding: 8px 14px; }
    .btn-icon { width: var(--ctl-sm); min-height: var(--ctl-sm); }
    .tab { min-height: var(--ctl-sm); }
    a.chip, button.chip, .chip-row a.chip { min-height: var(--ctl-sm); padding: 8px 15px; }
    .actions { gap: var(--sp-2); }
    .actions .btn { min-height: var(--ctl-sm); }
    .side-close, .side-logout { width: var(--tap); height: var(--tap); min-height: var(--tap); }
    .side-logout { border-radius: var(--r-sm); }
    .dropdown-menu a, .dropdown-menu button { min-height: var(--tap); }

    /* انتخاب فایل: دکمهٔ درشت و خوانا (پیش‌فرض مرورگر خیلی ریز است) */
    input[type=file] { min-height: var(--ctl-lg); padding: 8px 12px; line-height: 1.6; }
    input[type=file]::file-selector-button {
        min-height: 34px;
        margin-inline-end: 10px;
        padding: 6px 14px;
        border: 1px solid var(--border-strong);
        border-radius: var(--r-full);
        background: var(--surface-2);
        color: var(--text);
        font-family: inherit;
        font-size: var(--fs-sm);
    }

    /* ریتم کارت‌ها و فهرست‌ها (اپ‌ها جادارتر از وب‌اند) */
    .card + .card { margin-top: var(--sp-4); }
    .card-head { min-height: 56px; padding: var(--sp-3) var(--sp-4); }
    .card-body { padding: var(--sp-4); }
    .list-item { min-height: 64px; padding: var(--sp-3) var(--sp-2); }
    .list-item .mico { width: 20px; height: 20px; }
    .stat { padding: var(--sp-4) var(--sp-3); gap: var(--sp-2); }
    .stat-ico { width: 44px; height: 44px; flex: 0 0 44px; }
    .tile { padding: var(--sp-4) var(--sp-2); }
    .section-title { margin: var(--sp-3) 0; }
    .form-grid { gap: var(--sp-5); }
    .alert { padding: var(--sp-3) var(--sp-4); }

    /* safe-area: نُچ بالای صفحه + نوار خانهٔ پایین آیفون */
    .topbar { padding-top: calc(var(--sp-2) + env(safe-area-inset-top)); }
    .sidebar { padding-top: calc(var(--sp-4) + env(safe-area-inset-top)); }
    .content { padding-bottom: calc(var(--bottomnav-h) + env(safe-area-inset-bottom) + var(--sp-4)); }

    /* جدول‌های بلند: اسکرول افقی نرم با ناحیهٔ لمسی بزرگ‌تر */
    .table-wrap { margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter); }

    /* ------------------------------------------------ ۳) کف فونت روی گوشی
       در فایل قواعد ریز زیادی با اندازه‌های ثابت (۰٫۶۸rem … ۰٫۷۸rem) هست که روی
       گوشی زیر ۱۲px درمی‌آمد. اینجا فقط برای موبایل کفِ خوانایی تعیین می‌شود:
       متن ریز ⇒ ۱۲px و متن کمکی ⇒ ۱۳٫۱px (بدون تغییر چیدمان دسکتاپ). */
    .text-xs, .hint, .field .hint, .error-text, .brand-sub, .topbar-sub,
    .nav-group-title, .su-role, .stat-label, .list-item .sub, .list-item .meta,
    .conv-time, .conv-unread, .person .role, .chat-status, .msg .ticks,
    .tbl thead th, .date-sep, .filters .hint, .badge, .chip, .tab {
        font-size: var(--fs-xs);
    }

    .text-sm, .conv-preview, .btn-sm, .tbl tbody td, .field > label,
    .card-head .hint, .alert, .empty {
        font-size: var(--fs-sm);
    }

    /* نشانگر عددی روی زنگ اعلان: کوچک ولی خوانا */
    .notif-badge { font-size: 11px; min-width: 18px; height: 18px; line-height: 18px; }

    /* چک‌باکس و رادیو: ناحیهٔ لمس راحت (پیش‌فرض مرورگر ۱۳px است) */
    input[type=checkbox], input[type=radio] { width: 20px; height: 20px; flex: 0 0 20px; }
    label:has(> input[type=checkbox]), label:has(> input[type=radio]) { min-height: var(--tap); display: inline-flex; align-items: center; gap: var(--sp-2); }
    .switch { min-height: var(--tap); }
}/* v3-end */

/* v3.1: plan cards (subscription) */
.plans-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: stretch; }
.plan-card { display: flex; flex-direction: column; }
.plan-card.featured { border: 1px solid var(--primary); box-shadow: var(--shadow-brand); }
.plan-price { font-size: 1.45rem; font-weight: 800; color: var(--text); }
.plan-list { list-style: none; margin: .6rem 0 .9rem; padding: 0; display: grid; gap: .4rem; font-size: .82rem; }
.plan-list li { display: flex; align-items: center; gap: .45rem; color: var(--text-2); }
.plan-list svg { width: 16px; height: 16px; flex: 0 0 16px; color: var(--primary); }
.w-full { width: 100%; }
@media (max-width: 1000px) { .plans-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 720px) { .plans-grid { grid-template-columns: 1fr; } }

/* v3.2: جزئیات پلن — نکته‌های کلیدی، ویژگی‌های گروه‌بندی‌شده و جدول مقایسه */
.plan-highlights li { color: var(--text); font-weight: 600; }
.plan-highlights { margin-bottom: .5rem; }
.plan-actions { display: grid; gap: .4rem; margin-top: auto; }
.plan-actions form { margin: 0; }
.plan-features { display: grid; gap: .35rem; margin: .4rem 0 .6rem; }
.plan-features details, .plan-more {
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: .45rem .6rem; background: var(--surface-2);
}
.plan-features summary, .plan-more summary {
    display: flex; align-items: center; gap: .4rem; cursor: pointer;
    font-size: .82rem; font-weight: 700; list-style: none; min-height: 32px;
}
.plan-features summary::-webkit-details-marker, .plan-more summary::-webkit-details-marker { display: none; }
.plan-features summary svg, .plan-more summary svg { width: 17px; height: 17px; flex: 0 0 17px; color: var(--primary); }
.plan-features .grow { flex: 1 1 auto; }
.plan-features summary .chip { font-size: .7rem; }
.plan-features .plan-list { margin: .3rem 0 .1rem; gap: .3rem; }
.plan-features .plan-list li { align-items: flex-start; }
.plan-features .plan-list li span { display: block; }
.plan-features .plan-list li strong { display: block; font-size: .8rem; }
.plan-features .plan-list li.off { opacity: .45; }
.plan-features .plan-list li.off svg { color: var(--muted); }
.plan-more summary { justify-content: space-between; }
.plan-more .plan-list { margin-top: .35rem; }

.plan-compare { min-width: 640px; }
.plan-compare th, .plan-compare td { vertical-align: top; }
.plan-compare thead th { background: var(--surface-2); font-size: .82rem; text-align: center; }
.plan-compare thead th.plan-col { min-width: 130px; }
.plan-compare thead th.plan-col.featured { box-shadow: inset 0 2px 0 var(--primary); }
.plan-compare thead th.plan-col.current { background: var(--primary-soft); }
.plan-compare tr.group-row th {
    background: var(--surface-2); text-align: start; font-size: .82rem;
    border-top: 1px solid var(--border);
}
.plan-compare tr.group-row .group-title { display: inline-flex; align-items: center; gap: .35rem; margin-inline-end: .5rem; }
.plan-compare tr.group-row svg { width: 16px; height: 16px; color: var(--primary); }
.plan-compare .feature-col { text-align: start; font-weight: 600; background: transparent; min-width: 210px; }
.plan-compare .feature-title { display: block; font-size: .82rem; }
.plan-compare .mark-cell { text-align: center; }
.plan-compare .mark-cell.current { background: var(--primary-soft); }
.plan-compare .mark {
    display: inline-flex; align-items: center; justify-content: center;
    width: 26px; height: 26px; border-radius: var(--r-full);
}
.plan-compare .mark svg { width: 15px; height: 15px; }
.plan-compare .mark.yes { background: var(--green-soft); color: #047857; }
.plan-compare .mark.no { background: var(--surface-2); color: var(--muted); }
[data-theme="dark"] .plan-compare .mark.yes { background: rgba(16, 185, 129, .16); color: #6ee7b7; }
[data-theme="dark"] .plan-compare .mark.no { background: var(--surface-2); color: var(--muted); }

/* انتخاب پلن در فرم ثبت‌نام: کارت‌های رادیویی */
.plan-choice { display: block; position: relative; cursor: pointer; }
.plan-choice-radio { position: absolute; top: 16px; inset-inline-start: 14px; z-index: 2; }
.plan-choice-radio input[type=radio] { width: 20px; height: 20px; margin: 0; }
.plan-choice .plan-card { height: 100%; }
.plan-choice .plan-card .card-head h3 { padding-inline-start: 26px; }
.plan-choice.on .plan-card,
.plan-choice:has(input:checked) .plan-card { border-color: var(--primary); box-shadow: var(--shadow-brand); }
.plan-choice .plan-card .card-head { flex-wrap: wrap; gap: .35rem; }

/* گروه‌های ویژگی در صفحهٔ اشتراک مدرسه */
.plan-group { border-bottom: 1px solid var(--border); padding: .5rem .75rem; }
.plan-group:last-child { border-bottom: 0; }
.plan-group-head {
    display: flex; align-items: center; gap: .5rem; cursor: pointer; list-style: none;
    min-height: 44px;
}
.plan-group-head::-webkit-details-marker { display: none; }
.plan-group-head svg { width: 18px; height: 18px; flex: 0 0 18px; color: var(--primary); }
.plan-group-head .grow { flex: 1 1 auto; }
.plan-group-head .grow strong { display: block; font-size: .86rem; }
.plan-group .list-item { padding-inline: 0; }
.plan-group .list-item .grow .sub { display: block; margin-top: 2px; }
/* v3.2-end */
/* v3.1-end */

/* ═══════════════════════════════════════════════════════════════════════════
   v3.3 — بومی‌سازی موبایل: ریتم، کارت فشردهٔ فهرست و فیلتر دوستونی
   ───────────────────────────────────────────────────────────────────────────
   هدف: موبایل مثل اپلیکیشن بومی، «فشرده و قابل اسکن» باشد:
     ۱) هر رکورد فهرست = کارت کوتاه: [عنوان ... نشان وضعیت] / [زیرعنوان ... دکمه‌ها]
        (پیش‌تر هر سطر کارتی با همهٔ ستون‌ها و ۴۳۰px ارتفاع بود!)
     ۲) فیلترها دوستونی و هم‌قد (۴۴px) و جست‌وجو + دکمهٔ فیلتر در یک ردیف.
     ۳) ریتم عمودی یکنواخت و گوشه‌های استاندارد.
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 700px) {
    /* ------------------------------------------------------- ریتم عمودی */
    .content { padding: 12px var(--gutter) calc(var(--bottomnav-h) + var(--sp-4)); }
    .mb-3 { margin-bottom: var(--sp-3); }
    .card + .card { margin-top: var(--sp-3); }
    .card-head { min-height: 48px; padding: var(--sp-2) var(--sp-3); }
    .card-body { padding: var(--sp-3); }
    .between { gap: var(--sp-2); flex-wrap: wrap; }

    /* فرم‌ها: فاصلهٔ یکنواخت و کمتر (ریتم ۱۲px) */
    .form-grid { gap: var(--sp-3); }
    .form-grid > .field { gap: var(--sp-1); }
    textarea { min-height: 88px; }

    /* توضیح زیر عنوان صفحه: حداکثر دو خط (کاهش شلوغی) */
    .content > .between p.muted {
        display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
        overflow: hidden; line-height: 1.6;
    }

    /* ----------------------------------------------------------- فیلترها */
    .filter-bar { grid-template-columns: minmax(0, 1fr) auto; gap: var(--sp-2); }
    .filter-bar > .grow { grid-column: 1; grid-row: 1; }
    .filter-bar > .btn[type=submit] { display: none !important; }
    .filter-bar .filter-field { display: none !important; }
    .filter-bar .filter-toggle { grid-column: 2; grid-row: 1; width: auto; min-height: 44px; white-space: nowrap; }
    .filter-bar > div { min-width: 0 !important; }
    .filter-bar select,
    .filter-bar input[type=text] { min-height: 44px; font-size: var(--fs-md); padding: 8px 12px; }
    .filter-bar .btn { min-height: 44px; padding: 8px 12px; }

    /* نوار ابزار سرصفحه: فشرده (اکشن اصلی همان FAB است) */
    .content > .between > .row { gap: var(--sp-2); }
    .content > .between .btn,
    .content > .between .btn-sm { min-height: var(--ctl-sm); padding: 6px 12px; font-size: var(--fs-sm); }

    /* ------------------------------------ کارت فشردهٔ فهرست‌ها (m-list)
       همهٔ ستون‌ها پنهان می‌شوند؛ فقط عنوان، زیرعنوان و نشان وضعیت می‌ماند. */
    table.tbl.responsive.m-list { display: block; }
    table.tbl.responsive.m-list thead { display: none; }
    table.tbl.responsive.m-list tbody { display: block; }

    table.tbl.responsive.m-list tbody tr {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        gap: 0 var(--sp-3);
        padding: 10px var(--sp-3);
        margin-bottom: var(--sp-2);
        border: 1px solid var(--border);
        border-radius: var(--r-md);
        background: var(--surface);
        box-shadow: var(--shadow);
    }

    table.tbl.responsive.m-list tbody td {
        display: none !important;
        border: 0 !important;
        padding: 0 !important;
        text-align: start;
    }
    table.tbl.responsive.m-list tbody td::before { display: none !important; content: none !important; }

    table.tbl.responsive.m-list tbody td.m-title {
        display: flex !important;
        align-items: center;
        gap: 10px;
        grid-column: 1; grid-row: 1;
        font-weight: 700;
        font-size: var(--fs-md);
        color: var(--text);
        line-height: 1.55;
    }
    table.tbl.responsive.m-list tbody td.m-title .m-avatar {
        width: 40px;
        height: 40px;
        flex: 0 0 40px;
        display: grid;
        place-items: center;
        border-radius: 13px;
        background: var(--primary-soft);
        color: var(--primary-2);
        font-size: var(--fs-md);
        font-weight: 800;
    }
    table.tbl.responsive.m-list tbody td.m-title .m-title-text {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    table.tbl.responsive.m-list tbody td.m-badge {
        display: block !important;
        grid-column: 2; grid-row: 1;
        justify-self: end;
    }
    table.tbl.responsive.m-list tbody td.m-sub {
        display: block !important;
        grid-column: 1; grid-row: 2;
        padding-inline-start: 50px !important;
        font-size: var(--fs-sm);
        color: var(--muted);
        line-height: 1.7;
        overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    }
    /* عملیات: هم‌ردیف زیرعنوان، پایان‌چین، دکمهٔ مربعی ۴۴px (استاندارد لمس) */
    table.tbl.responsive.m-list tbody td[data-label="عملیات"],
    table.tbl.responsive.m-list tbody td.m-actions {
        display: flex !important;
        grid-column: 2; grid-row: 2;
        justify-content: flex-end;
        gap: var(--sp-2);
    }
    table.tbl.responsive.m-list tbody td[data-label="عملیات"] .actions,
    table.tbl.responsive.m-list tbody td.m-actions .actions { gap: var(--sp-2); }
    table.tbl.responsive.m-list tbody td[data-label="عملیات"] .btn,
    table.tbl.responsive.m-list tbody td.m-actions .btn {
        width: 44px; min-height: 44px; padding: 0;
        display: inline-grid; place-items: center;
    }
    table.tbl.responsive.m-list tbody td[data-label="عملیات"] .btn .mico,
    table.tbl.responsive.m-list tbody td.m-actions .btn .mico { width: var(--ico-sm); height: var(--ico-sm); }

    /* موبایل: یک دکمهٔ «رفتن به پرونده» به‌جای سه دکمهٔ ریز/شلوغ */
    table.tbl.responsive.m-list tbody td[data-label="عملیات"]:has(.m-open) .actions,
    table.tbl.responsive.m-list tbody td[data-label="عملیات"]:has(.m-more) .actions,
    table.tbl.responsive.m-list tbody td.m-actions:has(.m-open) .actions,
    table.tbl.responsive.m-list tbody td.m-actions:has(.m-more) .actions { display: none !important; }
    table.tbl.responsive.m-list tbody td[data-label="عملیات"] .m-open,
    table.tbl.responsive.m-list tbody td.m-actions .m-open,
    table.tbl.responsive.m-list tbody td[data-label="عملیات"] .m-more,
    table.tbl.responsive.m-list tbody td.m-actions .m-more {
        display: grid;
        place-items: center;
        width: 44px;
        min-height: 44px;
        border-radius: 12px;
        color: var(--muted);
    }
    table.tbl.responsive.m-list tbody td[data-label="عملیات"] .m-open:active,
    table.tbl.responsive.m-list tbody td.m-actions .m-open:active,
    table.tbl.responsive.m-list tbody td[data-label="عملیات"] .m-more:active,
    table.tbl.responsive.m-list tbody td.m-actions .m-more:active {
        background: var(--surface-2);
        color: var(--primary);
    }

    /* جدول‌های «برچسب/مقدار» غیرمحرک (رهگیری تغییرات، کاربران، نقش‌ها):
       همین سبک می‌ماند ولی فشرده‌تر تا فهرست قابل اسکن باشد. */
    table.tbl.responsive:not(.m-list) tbody tr {
        padding: 8px var(--sp-3);
        margin-bottom: var(--sp-2);
        border-radius: var(--r-md);
    }
    table.tbl.responsive:not(.m-list) tbody td {
        padding: 6px 0;
        gap: var(--sp-3);
        font-size: var(--fs-sm);
    }
    table.tbl.responsive:not(.m-list) tbody td::before { font-size: var(--fs-xs); }

    /* --------------------------------------------------- هشدار و نشان وضعیت */
    .alert { padding: var(--sp-2) var(--sp-3); gap: var(--sp-2); }
    .alert .btn { min-height: var(--ctl-sm); padding: 6px 12px; }

    /* نوار وضعیت اشتراک: فشرده و یک‌خطی‌تر روی گوشی */
    .sub-banner { padding: 9px var(--sp-3); font-size: var(--fs-sm); line-height: 1.55; }
    .sub-banner > svg { width: 18px; height: 18px; flex: 0 0 18px; }
    .sub-banner > div { min-width: 0; }
    .sub-banner > div > div { margin-top: 6px !important; }
    .sub-banner .btn { min-height: 34px; padding: 4px 12px; font-size: var(--fs-sm); }
    .sub-banner strong { font-size: var(--fs-md); }

    /* فضای انتهای صفحه برای FAB (دکمهٔ شناور افزودن) */
    .content:has(.fab) { padding-bottom: calc(var(--bottomnav-h) + 76px); }

    /* ------------------------------------------------------- کارت‌های آماری */
    .stat-grid { gap: var(--sp-2); }
    .stat { padding: var(--sp-3); gap: var(--sp-2); }
    .stat-ico { width: 38px; height: 38px; flex: 0 0 38px; }
    .stat-value { font-size: var(--fs-xl); }

    /* ------------------------------------------------------------- جدول‌ها */
    .tbl thead th { padding: 9px var(--sp-2); }
    .tbl tbody td { padding: 9px var(--sp-2); }
    .pagination-wrap { margin-top: var(--sp-3); }

    /* ------------------------------------------- نوار پایین و کارت پلن */
    .bottom-nav { padding: 5px var(--sp-2) calc(5px + env(safe-area-inset-bottom)); }
    .bottom-nav a { min-height: 44px; gap: 1px; }
    .bottom-nav a .ico { width: 40px; height: 26px; border-radius: 11px; }
    .plan-card .card-body { padding: var(--sp-3); }
    .plan-price { font-size: 1.3rem; }
}
/* v3.3-end */

/* ============================================================================
   v3.4 — قفل اشتراک (مدرسهٔ بدون طرح فعال)
   ---------------------------------------------------------------------------
   قانون سامانه: مدرسه‌ای که طرح فعال ندارد، اجازهٔ «تغییر» ندارد و فقط
   می‌تواند اطلاعات را ببیند. میدل‌ور `subscription` درخواست‌های ثبت/ویرایش/حذف
   را رد می‌کند؛ این بخش فقط رابط را با همان قانون هم‌راستا می‌کند تا کاربر
   دکمه‌ای نبیند که کار نمی‌کند.
   ========================================================================= */
body.sub-locked .fab { display: none !important; }
body.sub-locked .sub-locked-badge { text-decoration: none; gap: 5px; }
body.sub-locked .sub-locked-badge svg { width: 14px; height: 14px; }
body.sub-locked .no-locked { display: none !important; }

/* رنگ تأکیدی متن/آیکون روی سطوح روشن و تیره (کنتراست AA) */
.nav-item.active,
.nav-item.active .ico,
.bottom-nav a.active,
.bottom-nav a.active .ico,
body.nav-open .bottom-nav [data-burger],
.btn-light:hover,
.btn-green,
.chip.active,
.section-title .link,
.msg .who,
.card-head .mico,
.form-extra > summary .mico,
.sheet-head .mico,
.chat-back,
.chat-back:hover,
.chat-compose .compose-btn:hover,
.dp-toggle:hover,
.dp-nav:hover,
.dp-day.today,
.person.on,
.board-tools .tool:hover,
.board-tools .tool.on,
.attach-menu button:hover,
.notify-item > span:first-child,
.plan-list svg,
.plan-features summary svg,
.plan-more summary svg,
.plan-compare tr.group-row svg,
.plan-group-head svg,
table.tbl.responsive.m-list tbody td[data-label="عملیات"] .m-open:active,
table.tbl.responsive.m-list tbody td.m-actions .m-open:active,
table.tbl.responsive.m-list tbody td.m-title .m-avatar {
    color: var(--accent-text);
}

/* نمایش/پنهان‌سازی کنترل‌های مخصوص موبایل (پس از همهٔ لایه‌های قبلی) */
@media (max-width: 900px) {
    .only-mobile { display: inline-flex !important; }
    .only-desktop { display: none !important; }
}
/* v3.4-end */

/* انتقال نرم صفحه‌ها در مرورگرهای دارای View Transitions (Progressive Enhancement) */
@view-transition {
    navigation: auto;
}

@media (prefers-reduced-motion: no-preference) {
    ::view-transition-old(root),
    ::view-transition-new(root) {
        animation-duration: .18s;
        animation-timing-function: ease;
    }
}
