/* =============================================================
   سِدا | پرتالِ وبِ دبیر — سیستمِ طراحیِ مشترک
   الهام از کاشی‌کاریِ سنتیِ ایرانی: لاجوردیِ تیره + طلاییِ گرم،
   رويِ زمینه‌یِ کرمِ گرم به‌جایِ سفیدِ خالص.
   فونتِ ساحل (همون فونتِ نسخه‌ی دسکتاپ) به‌صورتِ فایلِ محلی از خودِ
   سرورِ سِدا سرو می‌شود (نه از CDNِ آنلاین)، پس نیازی به اینترنت
   ندارد و آفلاین‌بودنِ سِدا حفظ می‌ماند.
   ============================================================= */

@font-face {
    font-family: "Sahel";
    src: url("fonts/Sahel.ttf") format("truetype");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "Sahel";
    src: url("fonts/Sahel-SemiBold.ttf") format("truetype");
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "Sahel";
    src: url("fonts/Sahel-Bold.ttf") format("truetype");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

:root {
    --teal-900: #0B4A45;
    --teal-800: #0F5C55;
    --teal-700: #146B62;
    --gold-600: #C79A45;
    --gold-100: #F5E9D3;
    --bg: #FAF7F2;
    --surface: #FFFFFF;
    --text: #1F2A2E;
    --muted: #6B7280;
    --border: #E7E2D8;
    --green: #3E8914;
    --green-soft: #EAF4E3;
    --red: #B23A2E;
    --red-soft: #FBEAE7;
    --radius: 12px;
}

* { box-sizing: border-box; }

body {
    font-family: "Sahel", Tahoma, "Segoe UI", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    margin: 0;
    min-height: 100vh;
}

/* کادرهایِ فرم به‌طورِ پیش‌فرض فونتِ صفحه رو ارث نمی‌برن (رفتارِ
   پیش‌فرضِ مرورگرها) — این قانون همه‌جایِ سایت (همه‌ی کشوها/کادرها/
   دکمه‌ها) رو مجبور می‌کنه از همون فونتِ ساحل استفاده کنن. */
select, option, input, textarea, button {
    font-family: inherit;
}

/* ---------- سربرگ ---------- */
header.app-header {
    background: var(--teal-900);
    color: white;
    padding: 14px 16px;
    position: sticky;
    top: 0;
    z-index: 20;
}
header.app-header .row {
    display: flex;
    align-items: center;
    gap: 10px;
}
header.app-header .row-start {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}
header.app-header h1 {
    font-size: 15px;
    margin: 0;
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
header.app-header .icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 9px;
    background: rgba(255,255,255,0.12);
    color: white;
    text-decoration: none;
    flex-shrink: 0;
    border: none;
    cursor: pointer;
    font-size: 18px;
}
header.app-header .icon-btn:active { background: rgba(255,255,255,0.24); }
header.app-header .icon-btn svg { width: 18px; height: 18px; }

/* ---------- منویِ کشویی (همبرگری) ---------- */
.nav-drawer {
    position: fixed;
    top: 0; right: 0; left: 0;
    background: var(--teal-900);
    z-index: 30;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.22s ease;
    box-shadow: 0 8px 20px rgba(0,0,0,0.18);
}
.nav-drawer.open { max-height: 480px; }
.nav-drawer .drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
}
.nav-drawer .drawer-header span { color: white; font-weight: bold; font-size: 15px; }
.nav-drawer .drawer-links { padding: 4px 10px 10px; }
.nav-drawer a.drawer-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 10px;
    color: white;
    text-decoration: none;
    font-size: 14px;
    border-radius: 8px;
}
.nav-drawer a.drawer-link:active { background: rgba(255,255,255,0.1); }
.nav-drawer a.drawer-link svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-drawer .drawer-divider {
    height: 1px;
    background: rgba(255,255,255,0.15);
    margin: 6px 10px;
}
.nav-drawer a.drawer-link.logout { color: #FCA5A5; }
.drawer-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: 25;
}
.drawer-backdrop.open { display: block; }

/* ---------- سایدبارِ ثابت برایِ صفحه‌نمایش‌هایِ عریض — دقیقاً همون
   منویِ کشویی، ولی به‌جایِ باز/بسته‌شدن، همیشه سمتِ راست ثابت می‌مونه
   (مثلِ سایدبارِ نسخه‌ی دسکتاپ). تويِ موبایل/صفحه‌ی باریک همون رفتارِ
   کشویی و همبرگریِ قبلی دست‌نخورده می‌مونه. */
@media (min-width: 860px) {
    .nav-drawer {
        left: auto;
        width: 240px;
        max-height: none;
        height: 100vh;
        overflow-y: auto;
        border-radius: 0;
        transition: none;
        box-shadow: 2px 0 12px rgba(0,0,0,0.12);
    }
    .drawer-backdrop { display: none !important; }
    header.app-header button.icon-btn[onclick="openDrawer()"] { display: none; }
    .nav-drawer button.icon-btn[onclick="closeDrawer()"] { display: none; }
    body { margin-right: 240px; }
}

/* نوارِ نازکِ الهام‌گرفته از حاشیه‌یِ کاشی‌کاری */
.tile-strip {
    height: 5px;
    background: repeating-linear-gradient(
        135deg,
        var(--gold-600) 0px, var(--gold-600) 5px,
        var(--teal-900) 5px, var(--teal-900) 10px
    );
}

main.container {
    padding: 20px 16px 96px;
    max-width: 480px;
    margin: 0 auto;
}
main.container-wide {
    max-width: 1500px;
}
@media (min-width: 700px) {
    main.container-wide { padding: 24px 32px 96px; }
}

/* ---------- پیام‌ها ---------- */
.flash {
    background: var(--green-soft);
    color: #235913;
    border: 1px solid #cde6bd;
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 14px;
    margin-bottom: 16px;
    text-align: center;
}
.flash.error {
    background: var(--red-soft);
    color: var(--red);
    border-color: #f2c9c3;
}

/* ---------- کارت‌ها ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}
.context-bar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 13px;
    color: var(--muted);
}
.context-bar b { color: var(--teal-800); }

/* ---------- منویِ پیشخوان ---------- */
.greet {
    font-size: 16px;
    margin-bottom: 18px;
}
/* ---------- خوش‌آمدگویی + آواتار (سبکِ پنلِ مرجع) ---------- */
.welcome-block {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 22px;
}
.avatar {
    width: 52px; height: 52px;
    border-radius: 50%;
    background: var(--gold-100);
    color: var(--teal-900);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.avatar svg { width: 26px; height: 26px; }
.welcome-block .hello { font-size: 12px; color: var(--muted); }
.welcome-block .name { font-size: 16px; font-weight: bold; color: var(--text); }

/* ---------- گریدِ تایل‌هایِ رنگی (میزِ کار) — چهار تا در هر ردیف ---------- */
.tile-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}
.tile {
    aspect-ratio: 1 / 0.85;
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    color: white;
    background: var(--tile-color, var(--teal-700));
}
.tile:active { filter: brightness(0.92); }
.tile svg { width: 24px; height: 24px; }
.tile .tile-label { font-size: 11px; font-weight: bold; text-align: center; padding: 0 4px; }
.tile.disabled { opacity: 0.45; pointer-events: none; }

/* رويِ صفحه‌نمایشِ گوشی، ۴ ستون خیلی باریکه — متنِ کاشی‌هایِ طولانی
   (مثلِ «مدیریتِ حضور و غیاب (همه‌یِ کلاس‌ها)») ۴-۵ خط می‌شه و کلِ
   ردیف رو غول‌پیکر و نامتناسب می‌کنه. با ۲ ستون، هر کاشی تقریباً
   دوبرابرِ عریض‌تره، پس متن کمتر می‌شکنه و ارتفاع‌ها یکدست‌تر می‌مونه. */
@media (max-width: 480px) {
    .tile-grid { grid-template-columns: repeat(2, 1fr); }
    .tile { aspect-ratio: auto; min-height: 84px; padding: 10px 4px; }
    .tile .tile-label { font-size: 12px; line-height: 1.4; }
}

/* ---------- منویِ سطری (استفاده در صفحاتِ فهرست) ---------- */
.menu-item {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-right: 4px solid var(--accent, var(--teal-700));
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 12px;
    text-decoration: none;
    color: var(--text);
}
.menu-item:active { background: #F7F4EE; }
.menu-item .icon {
    width: 40px; height: 40px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    background: var(--gold-100);
    color: var(--teal-900);
    flex-shrink: 0;
}
.menu-item .icon svg { width: 20px; height: 20px; }
.menu-item .title { font-size: 15px; font-weight: bold; }
.menu-item .subtitle { font-size: 12px; color: var(--muted); margin-top: 2px; }
.menu-item.disabled { opacity: 0.5; pointer-events: none; }

/* ---------- فهرست‌هایِ قابلِ‌کلیک (انتخابِ کلاس/درس) ---------- */
.pick-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-inline-end: 5px solid var(--pick-color, var(--teal-700));
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 10px;
    text-decoration: none;
    color: var(--text);
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.pick-item:active { background: #F7F4EE; transform: scale(0.99); }
.pick-item .pick-icon {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--pick-color, var(--teal-700));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}
.pick-item .pick-icon svg { width: 20px; height: 20px; }
.pick-item .pick-text { flex: 1 1 auto; min-width: 0; }
.pick-item .subject { font-size: 15px; font-weight: bold; color: var(--teal-900); }
.pick-item .class {
    display: inline-block;
    font-size: 12px;
    font-weight: bold;
    color: var(--pick-color, var(--teal-700));
    background: color-mix(in srgb, var(--pick-color, var(--teal-700)) 12%, white);
    border-radius: 999px;
    padding: 2px 9px;
    margin-top: 5px;
}
.pick-item .pick-chevron {
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 18px;
}

.empty-state {
    text-align: center;
    color: var(--muted);
    font-size: 14px;
    margin-top: 48px;
    padding: 0 20px;
}

/* ---------- گزینه‌هایِ بزرگ (نوعِ نمره) ---------- */
.option {
    display: block;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 18px;
    margin-bottom: 12px;
    text-decoration: none;
    color: var(--text);
    text-align: center;
    font-size: 15px;
    font-weight: bold;
}
.option:active { background: #F7F4EE; }
.option.disabled { opacity: 0.5; pointer-events: none; }
.option .sub { font-size: 12px; font-weight: normal; color: var(--muted); margin-top: 4px; }

/* ---------- فرم‌ها ---------- */
label {
    display: block;
    font-size: 14px;
    color: var(--text);
    margin-bottom: 6px;
}
input[type="text"], input[type="date"], input[type="number"], input[type="password"] {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 16px;
    margin-bottom: 16px;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
}
input:focus { outline: none; border-color: var(--teal-700); }

.jalali-date-row {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}
.jalali-date-row select {
    flex: 1 1 0;
    padding: 12px 8px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
}
.jalali-date-row select:focus { outline: none; border-color: var(--teal-700); }

button, .btn-primary {
    width: 100%;
    padding: 13px;
    background: var(--teal-800);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    display: block;
}
button:active, .btn-primary:active { background: var(--teal-900); }

/* ---------- جدولِ نمرات ---------- */
table.score-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}
table.score-table th, table.score-table td {
    padding: 12px 10px;
    text-align: right;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
}
table.score-table th {
    background: var(--gold-100);
    color: var(--teal-900);
    font-size: 12px;
}
table.score-table tr:last-child td { border-bottom: none; }
.student-name-cell { font-weight: 600; }
.final-score-cell {
    color: var(--gold-600);
    font-weight: 900;
}
input.score {
    width: 92px;
    padding: 10px 6px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 16px;
    text-align: center;
    font-family: inherit;
    -moz-appearance: textfield;
}
input.score:focus { outline: none; border-color: var(--teal-700); }
input.score::-webkit-outer-spin-button,
input.score::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* ---------- ردیف‌هایِ حضور و غیاب ---------- */
.attendance-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 10px;
}
.attendance-row .name { font-size: 14px; font-weight: 600; }
.toggle { display: flex; gap: 6px; }
.toggle input { display: none; }
.toggle label {
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    border: 1px solid var(--border);
    color: var(--muted);
    background: var(--bg);
}
.toggle input:checked + label.present { background: var(--green); color: white; border-color: var(--green); }
.toggle input:checked + label.absent { background: var(--red); color: white; border-color: var(--red); }

.discipline-row { cursor: pointer; }
.discipline-row .check {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: 2px solid var(--border);
    flex-shrink: 0;
    display: inline-block;
    position: relative;
}
.discipline-row input[type="checkbox"] { display: none; }
.discipline-row input[type="checkbox"]:checked + .check {
    background: var(--teal-800);
    border-color: var(--teal-800);
}
.discipline-row input[type="checkbox"]:checked + .check::after {
    content: "";
    position: absolute;
    left: 7px; top: 3px;
    width: 6px; height: 11px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
.discipline-select-all {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 13px;
    color: var(--muted);
    cursor: pointer;
}

/* ---------- نوارِ ذخیره‌یِ ثابت ---------- */
.save-bar {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 14px 16px;
}
.save-bar button {
    max-width: 480px;
    margin: 0 auto;
}

/* ---------- برنامه‌یِ سالانه‌یِ دبیر ---------- */
.month-block {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 10px;
    overflow: hidden;
}
.month-block summary {
    padding: 14px 16px;
    font-size: 14px;
    font-weight: bold;
    color: var(--teal-900);
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.month-block summary::-webkit-details-marker { display: none; }
.month-block summary::after {
    content: "+";
    font-size: 18px;
    color: var(--muted);
}
.month-block[open] summary::after { content: "−"; }
.month-block .month-body {
    padding: 4px 16px 16px;
    border-top: 1px solid var(--border);
}
.month-block select.status-select {
    width: 100%;
    max-width: 320px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    margin: 12px 0 16px;
    background: var(--surface);
    color: var(--text);
}
.category-columns {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
}
@media (min-width: 700px) {
    .category-columns { grid-template-columns: 1fr 1fr 1fr; }
}
.category-title {
    font-size: 13px;
    font-weight: bold;
    color: var(--gold-600);
    margin: 0 0 8px;
}
.annual-table {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.cat-badge {
    font-size: 11px;
    font-weight: bold;
    padding: 3px 8px;
    border-radius: 6px;
    flex-shrink: 0;
    white-space: nowrap;
}
.cat-teaching { background: var(--gold-100); color: var(--teal-900); }
.cat-exam { background: #FBEAE7; color: var(--red); }
.cat-homework { background: #EAF4E3; color: var(--green); }
.week-row {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 8px;
    overflow: hidden;
}
.week-summary {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    cursor: pointer;
    list-style: none;
    font-size: 13px;
}
.week-summary::-webkit-details-marker { display: none; }
.week-summary .week-label {
    font-weight: bold;
    color: var(--teal-900);
    flex-shrink: 0;
    font-size: 12px;
    color: var(--muted);
}
.week-summary .week-preview {
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}
.week-summary .week-preview.done { color: var(--green); }
.week-row .week-body {
    padding: 10px 12px 12px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.week-row .week-body select {
    flex: 1 1 160px;
    min-width: 130px;
}
.week-row .week-body input.wide-input {
    flex: 2 1 240px;
}
.week-row .week-body .done-check {
    flex-basis: 100%;
    margin: 4px 0 0;
    border-top: none;
    padding-top: 0;
}
.week-row select, .week-row input[type="text"] {
    padding: 9px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
}
.inline-status-form {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 12px 0 16px;
}
.mini-label {
    font-size: 12px;
    color: var(--muted);
    white-space: nowrap;
}
.add-row-card {
    background: var(--gold-100);
    border: 1px dashed var(--gold-600);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 16px;
}
.row-form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 8px;
}
.row-form select, .row-form input.wide-input {
    height: 38px;
    line-height: 36px;
    padding: 0 10px;
    margin: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
    box-sizing: border-box;
    vertical-align: middle;
    width: auto;
}
.row-form select { flex: 1 1 140px; min-width: 120px; -webkit-appearance: menulist; }
.row-form input.wide-input { flex: 2 1 220px; }
.row-form textarea.wide-input {
    flex: 1 1 100%;
    height: auto;
    min-height: 70px;
    line-height: 1.6;
    padding: 8px 10px;
    margin: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
    box-sizing: border-box;
    resize: vertical;
}
.add-btn {
    height: 38px;
    line-height: 36px;
    margin: 0;
    background: var(--teal-800);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0 18px;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    width: auto;
    box-sizing: border-box;
    flex-shrink: 0;
    vertical-align: middle;
}
.note-inline-form {
    display: flex;
    gap: 6px;
    align-items: center;
}
table.annual-table-real input.actual-note-input {
    width: 100%;
    box-sizing: border-box;
    height: 32px;
    padding: 0 8px;
    margin: 0;
    border: 1px solid var(--border);
    border-radius: 7px;
    font-size: 12px;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
}
.edit-link-btn {
    border: 0;
    background: transparent;
    padding: 0;
    font-family: inherit;
    cursor: pointer;
}
.delete-btn {
    background: var(--red-soft);
    color: var(--red);
    border: 1px solid #f2c9c3;
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    width: auto;
    margin-top: 8px;
}
.row-actions { flex-basis: 100%; }
.week-row-outer {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 8px;
}
.week-row-outer > .week-row {
    flex: 1;
    min-width: 0;
    margin-bottom: 0;
}
.quick-toggle-form { flex-shrink: 0; margin-top: 2px; }
.fulfillment-form { display: inline-block; }
.fulfillment-select {
    height: 32px;
    padding: 0 8px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    box-sizing: border-box;
    font-family: inherit;
}
.fulfillment-select.is-complete {
    background: var(--green-soft);
    border: 1px solid var(--green);
    color: var(--green);
}
.fulfillment-select.is-incomplete {
    background: var(--red-soft);
    border: 1px solid var(--red);
    color: var(--red);
}

/* ---------- جدولِ واقعیِ برنامه‌یِ سالانه ---------- */
.annual-table-wrap { overflow-x: auto; }
table.annual-table-real {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 12px;
}
table.annual-table-real th, table.annual-table-real td {
    padding: 8px 10px;
    text-align: right;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    vertical-align: middle;
}
table.annual-table-real th {
    background: var(--gold-100);
    color: var(--teal-900);
    font-size: 11px;
}
table.annual-table-real tr:last-child td { border-bottom: none; }
.filter-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.filter-row select.gm-filter { max-width: 280px; margin: 0; width: auto; }
tr.gm-group-header {
    cursor: pointer;
    user-select: none;
}
tr.gm-group-header td {
    background: var(--teal-900);
    color: white;
    font-weight: bold;
    font-size: 12px;
    padding: 8px 12px;
}
tr.gm-group-header:hover td { background: var(--teal-800, var(--teal-900)); }
.gm-toggle-arrow {
    display: inline-block;
    margin-left: 6px;
    transition: transform 0.15s ease;
    transform: rotate(-90deg);
}
tr.gm-group-header.is-open .gm-toggle-arrow {
    transform: rotate(0deg);
}
.actions-cell { white-space: nowrap; }
.edit-link, .delete-link {
    display: inline;
    padding: 0;
    margin: 0;
    border: 0;
    background: transparent;
    font-family: inherit;
    font-size: 12px;
    font-weight: bold;
    line-height: inherit;
    vertical-align: baseline;
    cursor: pointer;
    text-decoration: none;
    width: auto;
}
.edit-link { color: var(--teal-700); margin-left: 12px; }
.delete-form { display: inline; }
.delete-link { color: var(--red); }
.tile-link-btn {
    display: inline-block;
    padding: 6px 12px;
    border: 1px solid var(--teal-700);
    border-radius: 8px;
    background: var(--surface);
    color: var(--teal-700);
    font-family: inherit;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    text-decoration: none;
}
.tile-link-btn:hover { background: var(--teal-700); color: white; }
tr.editing-row td { background: var(--bg); white-space: normal; }
.edit-inline-form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.edit-inline-form select, .edit-inline-form input.wide-input {
    height: 38px;
    line-height: 36px;
    margin: 0;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 12px;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
    box-sizing: border-box;
    vertical-align: middle;
    width: auto;
}
.edit-inline-form input.wide-input { flex: 1 1 180px; }
.cancel-link {
    display: inline-flex;
    align-items: center;
    height: 38px;
    font-size: 12px;
    color: var(--muted);
    text-decoration: none;
}
.week-row select:last-of-type, .week-row input:last-child { margin-bottom: 0; }
.done-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--green);
    font-weight: bold;
    margin: 8px 0 6px;
    padding-top: 6px;
    border-top: 1px dashed var(--border);
}
.done-check input[type="checkbox"] {
    width: 18px; height: 18px;
    accent-color: var(--green);
    flex-shrink: 0;
}

.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: var(--teal-900);
    background-image:
        repeating-linear-gradient(45deg, rgba(199,154,69,0.08) 0, rgba(199,154,69,0.08) 2px, transparent 2px, transparent 22px),
        repeating-linear-gradient(-45deg, rgba(199,154,69,0.08) 0, rgba(199,154,69,0.08) 2px, transparent 2px, transparent 22px);
}
.login-card {
    background: var(--surface);
    border-radius: 16px;
    padding: 32px 24px;
    width: 100%;
    max-width: 380px;
}
.login-card h1 {
    text-align: center;
    color: var(--teal-900);
    font-size: 22px;
    margin: 0 0 4px;
}
.login-card p.subtitle {
    text-align: center;
    color: var(--muted);
    font-size: 13px;
    margin: 0 0 24px;
}
.login-card .hint {
    text-align: center;
    font-size: 12px;
    color: #9CA3AF;
    margin-top: 18px;
}

/* -------------------------------------------------------------
   برنامه‌یِ هفتگیِ کلاسی (میزِ کار + پروفایل) — تمایزِ درسِ
   تک‌زنگ (۱ ساعته) از دو‌زنگی (۲ ساعته) داخلِ هر خونه‌ی جدول
   ------------------------------------------------------------- */
.lesson-chip {
    border-radius: 8px;
    padding: 5px 7px;
    margin-bottom: 4px;
    font-size: 12px;
    line-height: 1.6;
}
.lesson-chip:last-child { margin-bottom: 0; }

/* جدولِ برنامه‌ی هفتگی، به‌سبکِ دسکتاپ: افقی = زنگ‌ها، عمودی = روزها.
   عمداً عرضِ جدول کاملاً به اندازه‌یِ کانتینر (بدونِ نیاز به اسکرولِ
   افقی) نگه داشته می‌شه: ستونِ روز عرضِ ثابتِ کوچیک داره، بقیه‌ی
   ستون‌ها (زنگ‌ها) با table-layout:fixed به‌طورِ خودکار و مساوی
   فضایِ باقی‌مونده رو بین خودشون تقسیم می‌کنن. */
table.schedule-table-big {
    width: 100%;
    table-layout: fixed;
}
table.schedule-table-big th, table.schedule-table-big td {
    padding: 8px 6px;
    font-size: 12.5px;
    white-space: normal;
    overflow-wrap: break-word;
}
table.schedule-table-big th:first-child, table.schedule-table-big td:first-child {
    width: 62px;
}
table.schedule-table-big th {
    font-size: 12.5px;
}
table.schedule-table-big .lesson-chip {
    font-size: 11px;
    padding: 6px 6px;
    line-height: 1.4;
}
table.schedule-table-big .lesson-chip .chip-badge {
    display: block;
    width: fit-content;
    margin-inline-start: 0;
    margin-top: 3px;
    font-size: 9.5px;
}
.lesson-chip .chip-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: bold;
    border-radius: 999px;
    padding: 1px 7px;
    margin-inline-start: 4px;
}
.lesson-chip .chip-text { font-weight: bold; }
.lesson-chip.single {
    background: #E9F1F0;
    background: color-mix(in srgb, var(--teal-900) 8%, white);
    color: var(--teal-900);
}
.lesson-chip.single .chip-badge {
    background: var(--teal-900);
    color: white;
}
.lesson-chip.double {
    background: var(--gold-100);
    color: #7A5A15;
}
.lesson-chip.double .chip-badge {
    background: var(--gold-600);
    color: white;
}

/* -------------------------------------------------------------
   فرمِ جوابِ پیشنهاد و انتقاد — کادرِ متن باید بیشترِ جا رو بگیره و
   دکمه‌ها فقط به‌اندازه‌ی متنِ خودشون عرض داشته باشن (نه ۱۰۰٪ عرضِ
   سایت، که قانونِ کلیِ دکمه‌ها تويِ بقیه‌ی صفحات همینه).
   ------------------------------------------------------------- */
.feedback-reply-form {
    flex: 1;
    display: flex;
    gap: 8px;
}
.feedback-reply-form input {
    flex: 1;
    min-width: 0;
    width: auto;
}
.feedback-reply-form button,
.feedback-markread-form button {
    width: auto;
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 10px 16px;
}
.feedback-delete-form {
    display: inline-block;
    margin-top: 6px;
}
.feedback-delete-form button {
    width: auto;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: normal;
    background: transparent;
    color: var(--red);
    border: 1px solid var(--red);
}
.feedback-delete-form button:active { background: var(--red); color: white; }

/* -------------------------------------------------------------
   انتخابِ زنگ (attendance_meta.html) — به‌جایِ کشوی سادهُ مرورگر،
   ردیفی از دکمه‌هایِ قابلِ‌کلیک
   ------------------------------------------------------------- */
.period-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
}
.period-picker input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.period-picker .period-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 64px;
    padding: 9px 12px;
    border-radius: 10px;
    border: 1.5px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    user-select: none;
    transition: background 0.08s ease, border-color 0.08s ease, color 0.08s ease;
}
.period-picker input[type="radio"]:checked + .period-chip {
    background: var(--teal-900);
    border-color: var(--teal-900);
    color: white;
}
.period-picker input[type="radio"]:focus-visible + .period-chip {
    outline: 2px solid var(--gold-600);
    outline-offset: 2px;
}

/* -------------------------------------------------------------
   تحلیل و گزارشِ ریزِ نمرات (پروفایلِ دبیر) — فقط دروسِ خودِ دبیر
   ------------------------------------------------------------- */
.grade-summary-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 10px;
    overflow: hidden;
}
.grade-summary-card > summary {
    list-style: none;
    cursor: pointer;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.grade-summary-card > summary::-webkit-details-marker { display: none; }
.grade-summary-card .gs-title { flex: 1 1 auto; min-width: 0; }
.grade-summary-card .gs-subject { font-size: 14px; font-weight: bold; color: var(--teal-900); }
.grade-summary-card .gs-class {
    display: inline-block;
    font-size: 11px;
    font-weight: bold;
    color: var(--teal-700);
    background: var(--gold-100);
    border-radius: 999px;
    padding: 2px 8px;
    margin-top: 4px;
}
.grade-summary-card .gs-avg {
    flex: 0 0 auto;
    text-align: center;
    background: var(--teal-900);
    color: white;
    border-radius: 10px;
    padding: 5px 10px;
    font-size: 15px;
    font-weight: bold;
}
.grade-summary-card .gs-avg small { display: block; font-size: 9px; font-weight: normal; opacity: 0.85; }
.grade-summary-card .gs-chevron { flex: 0 0 auto; color: var(--muted); font-size: 14px; }
.grade-summary-card[open] .gs-chevron { transform: rotate(-90deg); }
.grade-summary-card .gs-body {
    border-top: 1px solid var(--border);
    padding: 10px 14px 4px;
}
.grade-summary-card .gs-minmax {
    display: flex;
    gap: 8px;
    font-size: 11px;
    color: var(--muted);
    margin-bottom: 10px;
}
.grade-exam-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    padding: 6px 0;
    border-bottom: 1px dashed var(--border);
}
.grade-exam-row:last-child { border-bottom: none; }
.grade-exam-row .ge-title { flex: 1 1 auto; font-weight: bold; color: var(--text); }
.grade-exam-row .ge-date { flex: 0 0 auto; color: var(--muted); font-size: 11px; }
.grade-exam-row .ge-avg { flex: 0 0 auto; font-weight: bold; color: var(--teal-700); min-width: 28px; text-align: center; }

/* -------------------------------------------------------------
   تحلیلِ درسِ دبیر + تحلیلِ درسِ دانش‌آموز (grades_report.html)
   ------------------------------------------------------------- */
.subject-report-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 14px;
    padding: 14px;
}
.subject-report-card .sr-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}
.subject-report-card .sr-subject { flex: 1 1 auto; font-size: 15px; font-weight: bold; color: var(--teal-900); }
.subject-report-card .sr-avg {
    flex: 0 0 auto;
    background: var(--teal-900);
    color: white;
    border-radius: 10px;
    padding: 5px 10px;
    font-size: 15px;
    font-weight: bold;
    text-align: center;
}
.subject-report-card .sr-avg small { display: block; font-size: 9px; font-weight: normal; opacity: 0.85; }

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin-bottom: 12px;
}
.kpi-box {
    background: #F7F4EE;
    border-radius: 9px;
    padding: 8px 4px;
    text-align: center;
}
.kpi-box .kpi-value { font-size: 15px; font-weight: bold; color: var(--teal-900); }
.kpi-box .kpi-label { font-size: 10px; color: var(--muted); margin-top: 2px; }

.trend-bars {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 70px;
    margin-bottom: 14px;
    padding: 0 2px;
}
.trend-bars .tb-col { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.trend-bars .tb-bar { width: 100%; max-width: 22px; background: var(--gold-600); border-radius: 4px 4px 0 0; }
.trend-bars .tb-val { font-size: 9px; color: var(--muted); margin-bottom: 2px; }
.trend-bars .tb-month { font-size: 9px; color: var(--muted); margin-top: 4px; }

.subject-report-card .sr-section-label {
    font-size: 11px;
    font-weight: bold;
    color: var(--gold-600);
    text-transform: none;
    margin-bottom: 4px;
}
.subject-report-card .sr-subsection-title {
    font-size: 12px;
    font-weight: bold;
    color: var(--teal-900);
    margin: 12px 0 8px;
}
.sr-status {
    display: inline-block;
    min-width: 34px;
    text-align: center;
    border-radius: 999px;
    padding: 3px 10px;
    font-size: 11px;
    font-weight: bold;
}
.sr-status.good { background: var(--green-soft); color: var(--green); }
.sr-status.mid { background: var(--gold-100); color: #7A5A15; }
.sr-status.weak { background: var(--red-soft); color: var(--red); }

/* KPIِ ردیفِ دوم + اقداماتِ جبرانی */
.trend-word {
    display: inline-block;
    font-size: 10px;
    font-weight: normal;
    margin-top: 2px;
}
.trend-word.up { color: var(--green); }
.trend-word.down { color: var(--red); }
.trend-word.flat { color: var(--muted); }

.remedial-box {
    background: var(--gold-100);
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 12px;
}
.remedial-box .rb-title {
    font-size: 12px;
    font-weight: bold;
    color: #7A5A15;
    margin-bottom: 6px;
}
.remedial-box .rb-item {
    font-size: 12px;
    color: var(--text);
    line-height: 1.7;
    padding-inline-start: 12px;
    position: relative;
}
.remedial-box .rb-item::before {
    content: "•";
    position: absolute;
    inset-inline-start: 0;
    color: var(--gold-600);
}

/* کارنامه‌یِ کلاسی (ریزِ آزمون‌هایِ هر دانش‌آموز، فقط همین درس) */
.student-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 8px;
    overflow: hidden;
}
.student-card > summary {
    list-style: none;
    cursor: pointer;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.student-card > summary::-webkit-details-marker { display: none; }
.student-card .sc-name { flex: 1 1 auto; min-width: 0; }
.student-card .sc-name .n { font-weight: bold; color: var(--text); font-size: 13px; }
.student-card .sc-name .c { font-size: 10px; color: var(--muted); }
.student-card .sc-count { flex: 0 0 auto; font-size: 10px; color: var(--muted); }
.student-card .sc-chevron { flex: 0 0 auto; color: var(--muted); font-size: 13px; }
.student-card[open] .sc-chevron { transform: rotate(-90deg); }
.student-card .sc-body { border-top: 1px solid var(--border); padding: 8px 4px 2px; }
.student-card .sc-body table { width: 100%; border-collapse: collapse; }
.student-card .sc-body th, .student-card .sc-body td {
    padding: 6px 6px;
    font-size: 11px;
    text-align: right;
    border-bottom: 1px dashed var(--border);
}
.student-card .sc-body th { color: var(--muted); font-weight: bold; }
.student-card .sc-body tr:last-child td { border-bottom: none; }

/* بازه‌یِ زمانیِ نمراتِ کلاسی (grades_classroom_view.html) */
.date-filter-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 16px 6px;
    margin-bottom: 18px;
}
.date-filter-group { flex: 1 1 260px; min-width: 220px; }
.date-filter-group label { font-size: 12px; }
.date-filter-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
}
.btn-clear-filter {
    font-size: 12px;
    color: var(--muted);
    text-decoration: underline;
}

/* -------------------------------------------------------------
   انتخابِ فعالیتِ مثبت/منفی (discipline_new.html) — دو کارتِ
   رنگیِ کنارِ هم به‌جایِ دو کشویِ سادهُ زیرِ هم
   ------------------------------------------------------------- */
.discipline-activity-grid {
    display: flex;
    gap: 10px;
    margin-bottom: 18px;
}
.discipline-activity-card {
    flex: 1 1 0;
    min-width: 0;
    border-radius: 12px;
    padding: 12px;
    border: 1.5px solid var(--border);
}
.discipline-activity-card label {
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 8px;
}
.discipline-activity-card select {
    width: 100%;
    padding: 10px 8px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    font-size: 13px;
    font-family: inherit;
    color: var(--text);
}
.discipline-activity-card select:focus { outline: none; border-color: var(--teal-700); }
.discipline-activity-card.positive {
    background: var(--green-soft);
    border-color: #C9E6B8;
}
.discipline-activity-card.positive label { color: var(--green); }
.discipline-activity-card.negative {
    background: var(--red-soft);
    border-color: #F3C7C0;
}
.discipline-activity-card.negative label { color: var(--red); }

/* بجِ ضریبِ نوبت (term_entry.html) */
.weight-badge {
    background: #E6F1FB;
    color: #185FA5;
    border-radius: 10px;
    padding: 10px 14px;
    margin-bottom: 16px;
    font-size: 12px;
    font-weight: bold;
    line-height: 1.7;
}

/* یادداشتِ منبعِ گزارش + درس‌هایِ بدونِ نمره (grades_report.html) */
.report-source-note {
    background: #E6F1FB;
    color: #185FA5;
    border-radius: 10px;
    padding: 10px 14px;
    margin-bottom: 12px;
    font-size: 12px;
    line-height: 1.8;
}
.report-missing-note {
    background: var(--gold-100);
    color: #7A5A15;
    border-radius: 10px;
    padding: 10px 14px;
    margin-bottom: 16px;
    font-size: 12px;
    line-height: 1.8;
}

/* -------------------------------------------------------------
   انتخابِ منبعِ تحلیل (grades_report_subject.html) — چک‌باکس‌هایِ
   چندانتخابی به‌شکلِ چیپ، مثلِ انتخابِ زنگ
   ------------------------------------------------------------- */
.source-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}
.source-picker input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.source-picker .source-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 16px;
    border-radius: 10px;
    border: 1.5px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    user-select: none;
}
.source-picker input[type="checkbox"]:checked + .source-chip {
    background: var(--teal-900);
    border-color: var(--teal-900);
    color: white;
}

/* -------------------------------------------------------------
   طراحیِ گروه‌بندی‌شده‌یِ منابعِ تحلیل (grades_report_subject.html)
   ------------------------------------------------------------- */
.source-section-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 16px 16px;
    margin-bottom: 16px;
}
.source-group-title {
    font-size: 12px;
    font-weight: bold;
    color: var(--teal-900);
    margin: 14px 0 8px;
}
.source-group-title:first-child { margin-top: 0; }
.source-quick-actions {
    display: flex;
    gap: 14px;
    margin-bottom: 8px;
}
.source-quick-actions a {
    font-size: 11px;
    color: var(--teal-700);
    text-decoration: underline;
}
.source-chip .chip-count {
    font-size: 10px;
    font-weight: normal;
    opacity: 0.8;
    margin-inline-start: 3px;
}
.source-chip.no-data {
    border-style: dashed;
    opacity: 0.7;
}

/* نمودارِ موج‌مانندِ روندِ نمره‌یِ هر دانش‌آموز (grades_report_subject.html) */
.spark { display: block; }
.spark-up { color: var(--green); }
.spark-down { color: var(--red); }
.spark-flat { color: var(--muted); }

.login-card .hint a { color: var(--teal-700); font-weight: bold; }

/* نمودارِ موجیِ روندِ نمرات (student_grades.html) */
.wave-chart { display: block; }
.wave-up { color: var(--green); }
.wave-down { color: var(--red); }
.wave-flat { color: var(--muted); }

/* دکمه‌یِ چاپ/ذخیره‌یِ PDF (مثلاً کارنامه) — از window.print() مرورگر
   استفاده می‌کند؛ نیازی به کتابخانه‌یِ تولیدِ PDF رويِ سرور نیست. */
.print-btn {
    display: inline-block; background: var(--teal-800); color: #fff;
    border: none; border-radius: var(--radius); padding: 10px 18px;
    font-family: inherit; font-size: 13px; font-weight: bold; cursor: pointer;
    margin-bottom: 14px;
}
@media print {
    header.app-header, .nav-drawer, .drawer-backdrop, .print-btn, .flash { display: none !important; }
    body { background: #fff; }
    main.container { max-width: none; padding: 0; }
}

/* -------------------------------------------------------------
   برنامه‌یِ مطالعاتیِ دانش‌آموزان (student_study_plan.html) —
   تب‌هایِ «رسمی/شخصی» + جدولِ هفتگیِ ویرایش‌پذیر + چک‌مارکِ روزانه
   ------------------------------------------------------------- */
.sp-tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.sp-tab {
    flex: 1; text-align: center; padding: 10px 8px; border-radius: var(--radius);
    font-size: 13px; font-weight: bold; text-decoration: none;
    background: color-mix(in srgb, var(--teal-900) 6%, white);
    color: var(--teal-900);
}
.sp-tab.active { background: var(--teal-900); color: #fff; }

.sp-locked-note {
    font-size: 12px; color: #7A5A15; background: var(--gold-100);
    border-radius: var(--radius); padding: 8px 10px; margin-bottom: 12px;
}

.sp-cell { min-width: 120px; vertical-align: top; }
.sp-cell-content {
    border-radius: 8px; padding: 6px 8px; margin-bottom: 6px;
    background: color-mix(in srgb, var(--teal-900) 8%, white);
}
.sp-cell.is-today .sp-cell-content { border: 1px solid var(--gold-600); }
.sp-cell-subject { font-weight: bold; font-size: 12px; color: var(--teal-900); }
.sp-cell-note { font-size: 11px; color: var(--muted); margin-top: 2px; }
.sp-cell-empty { font-size: 12px; color: #B7BEC9; text-align: center; padding: 8px 0; }

.sp-progress-form { margin-bottom: 4px; }
.sp-status-select {
    width: 100%; font-size: 11px; font-weight: bold; border-radius: 999px;
    border: 1px solid var(--border); background: #fff; color: var(--muted);
    padding: 4px 6px; cursor: pointer; font-family: inherit;
}
.sp-status-select.sp-status-done { background: var(--green-soft); border-color: var(--green); color: var(--green); }
.sp-status-select.sp-status-partial { background: var(--gold-100); border-color: var(--gold-600); color: #7A5A15; }
.sp-status-select.sp-status-not_done { background: var(--red-soft); border-color: var(--red); color: var(--red); }

.sp-reason-input {
    width: 100%; margin-top: 4px; font-family: inherit; font-size: 11px;
    color: var(--muted); background: color-mix(in srgb, var(--muted) 6%, white);
    border: 1px dashed var(--border); border-radius: 8px; padding: 4px 6px;
    resize: vertical;
}
.sp-reason-input::placeholder { color: #B7BEC9; }
.sp-reason-save {
    width: 100%; margin-top: 4px; font-size: 10px; font-weight: bold;
    border: none; border-radius: 8px; background: var(--teal-800); color: #fff;
    padding: 3px 6px; cursor: pointer; font-family: inherit;
}

.sp-edit-details summary { font-size: 11px; color: var(--teal-700); cursor: pointer; }
.sp-edit-details summary::-webkit-details-marker { display: none; }
.sp-edit-form { margin-top: 6px; }
.sp-edit-form input, .sp-edit-form textarea {
    width: 100%; margin-bottom: 6px; font-family: inherit; font-size: 12px;
}

/* -------------------------------------------------------------
   مشاهده‌ی مدیر/معاون از برنامه‌ی مطالعاتیِ یک دانش‌آموز — فقط
   نمایش (admin_study_plan_student.html)
   ------------------------------------------------------------- */
.sp-admin-cell.sp-status-bg-done { background: color-mix(in srgb, var(--green) 10%, white); }
.sp-admin-cell.sp-status-bg-partial { background: var(--gold-100); }
.sp-admin-cell.sp-status-bg-not_done { background: var(--red-soft); }
.sp-admin-status { font-size: 10px; font-weight: bold; margin-top: 4px; color: var(--teal-900); }
.sp-admin-reason { font-size: 10px; color: var(--muted); margin-top: 2px; }

/* -------------------------------------------------------------
   ردیفِ رنگی برایِ لیستِ دانش‌آموزانِ یک کلاس در گزارشِ کلیِ
   برنامه‌ی مطالعاتی (admin_study_plan_overview.html)
   ------------------------------------------------------------- */
tr.sp-status-bg-done td { background: color-mix(in srgb, var(--green) 8%, white); }
tr.sp-status-bg-partial td { background: var(--gold-100); }
tr.sp-status-bg-not_done td { background: var(--red-soft); }


/* =============================================================
   ظاهرِ جدیدِ سِدا (نسخه‌یِ ۲) — فونتِ وزیرمتن + دو تمِ روشن و تیره
   همه‌یِ رنگ‌ها از متغیرهایِ بالا خوانده می‌شوند؛ این بخش فقط
   مقدارِ آن‌ها را عوض می‌کند. تم با ویژگیِ data-theme رویِ <html>
   تعیین می‌شود (light یا dark) و انتخابِ کاربر در مرورگر می‌ماند.
   ============================================================= */
@font-face {
    font-family: "Vazirmatn";
    src: url("fonts/Vazirmatn.woff2") format("woff2-variations"),
         url("fonts/Vazirmatn.woff2") format("woff2");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

:root, :root[data-theme="light"] {
    color-scheme: light;
    --teal-900: #0B6E66;
    --teal-800: #0D7F75;
    --teal-700: #0F9488;
    --accent: #14B8A6;
    --accent-soft: #E3F6F3;
    --gold-600: #B7862F;
    --gold-100: #FBF3E2;
    --bg: #F4F6F8;
    --surface: #FFFFFF;
    --surface-2: #F1F4F6;
    --text: #141A21;
    --muted: #66717D;
    --border: #E3E8ED;
    --green: #2F8A3B;
    --green-soft: #E6F4E8;
    --red: #C2413A;
    --red-soft: #FCEBEA;
    --header-bg: rgba(255,255,255,0.86);
    --chip: #EEF2F5;
    --shadow: 0 1px 2px rgba(16,24,40,0.04), 0 4px 14px rgba(16,24,40,0.05);
    --radius: 16px;
}
:root[data-theme="dark"] {
    color-scheme: dark;
    --teal-900: #0E9384;
    --teal-800: #0F9D8F;
    --teal-700: #12A596;
    --accent: #2DD4BF;
    --accent-soft: #0F2E2C;
    --gold-600: #D9AE5A;
    --gold-100: #262115;
    --bg: #0A0E13;
    --surface: #131920;
    --surface-2: #1A2129;
    --text: #E8EDF2;
    --muted: #8D99A6;
    --border: #232C36;
    --green: #3FB873;
    --green-soft: #12291C;
    --red: #F07167;
    --red-soft: #2E1716;
    --header-bg: rgba(19,25,32,0.88);
    --chip: #1C242D;
    --shadow: none;
}

body {
    font-family: "Vazirmatn", "Sahel", Tahoma, "Segoe UI", Arial, sans-serif;
    font-feature-settings: "ss01";
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

/* ---------- سربرگ: شیشه‌ایِ ساده به‌جایِ نوارِ سبزِ پررنگ ---------- */
header.app-header {
    background: var(--header-bg);
    color: var(--text);
    border-bottom: 1px solid var(--border);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    padding: 12px 16px;
}
header.app-header h1 { font-size: 17px; font-weight: 800; }
header.app-header .icon-btn {
    background: transparent;
    color: var(--muted);
    border-radius: 12px;
    width: 40px; height: 40px;
}
header.app-header .icon-btn:hover { background: var(--chip); color: var(--text); }
header.app-header .icon-btn:active { background: var(--chip); }
header.app-header .icon-btn svg { width: 22px; height: 22px; flex-shrink: 0; }
.theme-toggle svg { width: 22px !important; height: 22px !important; }
.tile-strip { display: none; }

/* دکمه‌یِ تغییرِ تم: در تمِ روشن ماه، در تمِ تیره خورشید */
.theme-toggle .ico-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .ico-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .ico-moon { display: none; }

/* ---------- منویِ کناری ---------- */
.nav-drawer {
    background: var(--surface);
    border-left: 1px solid var(--border);
}
.nav-drawer .drawer-header {
    border-bottom: 1px solid var(--border);
    padding: 16px;
}
.nav-drawer .drawer-header span { color: var(--text); }
.nav-drawer .drawer-header .icon-btn {
    width: 40px; height: 40px; border-radius: 12px;
    background: transparent; color: var(--muted); font-size: 20px; padding: 0;
}
.drawer-brand { display: flex; align-items: center; gap: 12px; }
.drawer-brand .brand-logo {
    width: 46px; height: 46px; border-radius: 50%;
    background: var(--accent); color: #062521;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.drawer-brand .brand-logo svg { width: 24px; height: 24px; }
.drawer-brand .brand-name { font-size: 20px; font-weight: 900; color: var(--text); line-height: 1.2; }
.drawer-brand .brand-sub { font-size: 12px; color: var(--muted); }
.nav-drawer .drawer-links { padding: 12px 12px 16px; }
.nav-drawer a.drawer-link {
    color: var(--text);
    padding: 12px 14px;
    border-radius: 14px;
    font-size: 14.5px;
    margin-bottom: 2px;
    position: relative;
}
.nav-drawer a.drawer-link svg { width: 20px; height: 20px; color: var(--muted); }
.nav-drawer a.drawer-link:hover { background: var(--chip); }
.nav-drawer a.drawer-link:active { background: var(--chip); }
.nav-drawer a.drawer-link.active {
    background: var(--accent-soft);
    color: var(--teal-900);
    font-weight: 700;
}
:root[data-theme="dark"] .nav-drawer a.drawer-link.active { color: var(--accent); }
.nav-drawer a.drawer-link.active svg { color: inherit; }
.nav-drawer a.drawer-link.active::before {
    content: ""; position: absolute; right: -12px; top: 10px; bottom: 10px;
    width: 4px; border-radius: 4px 0 0 4px; background: var(--accent);
}
.nav-drawer .drawer-divider { background: var(--border); margin: 8px 6px; }
.nav-drawer a.drawer-link.logout, .nav-drawer a.drawer-link.logout svg { color: var(--red); }
.drawer-backdrop { background: rgba(0,0,0,0.5); }
@media (min-width: 860px) {
    .nav-drawer { width: 260px; box-shadow: none; }
    body { margin-right: 260px; }
}

/* ---------- کارت‌ها، کادرها و دکمه‌ها ---------- */
.card, .context-bar, .menu-item, .pick-item, .option, .attendance-row,
table.score-table {
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.menu-item { border-right-width: 1px; }
.menu-item .icon, .avatar { background: var(--accent-soft); color: var(--teal-900); border-radius: 14px; }
:root[data-theme="dark"] .menu-item .icon, :root[data-theme="dark"] .avatar { color: var(--accent); }
.avatar { border-radius: 50%; }
.menu-item:active, .pick-item:active, .option:active { background: var(--surface-2); }
.pick-item .subject { color: var(--text); }
.pick-item .pick-icon { border-radius: 14px; }
.pick-item .class { background: color-mix(in srgb, var(--pick-color, var(--teal-700)) 14%, transparent); }
.tile { border-radius: 18px; }

input[type="text"], input[type="date"], input[type="number"], input[type="password"],
input[type="email"], input[type="tel"], input[type="search"], input:not([type]),
select, textarea, input.score, .jalali-date-row select {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 14px;
}
input:focus, select:focus, textarea:focus, input.score:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
}
::placeholder { color: var(--muted); opacity: 0.8; }

button, .btn-primary { border-radius: 14px; background: var(--teal-800); }
button:hover, .btn-primary:hover { filter: brightness(1.06); }

table.score-table th { background: var(--surface-2); color: var(--muted); font-weight: 700; }
.final-score-cell { color: var(--gold-600); }
.kpi-box { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px 6px; }
.kpi-box .kpi-value { font-size: 18px; font-weight: 800; color: var(--text); }
.kpi-box .kpi-label { font-size: 11px; }
.flash { border-radius: 14px; color: var(--green); border-color: color-mix(in srgb, var(--green) 30%, transparent); }
.flash.error { border-color: color-mix(in srgb, var(--red) 30%, transparent); }

/* ---------- صفحه‌یِ ورود ---------- */
.login-wrap { background: var(--bg); background-image: none; }
.login-card {
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: var(--shadow);
    padding: 36px 26px;
}
.login-card h1 { color: var(--text); font-size: 30px; font-weight: 900; }
.login-card .hint { color: var(--muted); }
.login-card button { background: var(--accent); color: #062521; font-size: 17px; padding: 15px; }
.login-theme-btn {
    position: fixed; top: 14px; left: 14px; width: 44px; height: 44px;
    border-radius: 14px; padding: 0; display: flex; align-items: center; justify-content: center;
    background: var(--surface); color: var(--muted); border: 1px solid var(--border);
}
.login-theme-btn svg { width: 22px; height: 22px; }

/* ---------- تمِ تیره: اصلاحِ رنگ‌هایِ ثابتی که داخلِ صفحه‌ها نوشته شده‌اند ---------- */
:root[data-theme="dark"] .kpi-box,
:root[data-theme="dark"] .menu-item:active,
:root[data-theme="dark"] .option:active { background: var(--surface); }

:root[data-theme="dark"] .sr-status.mid,
:root[data-theme="dark"] .sp-status-select.sp-status-partial { color: var(--gold-600); }
:root[data-theme="dark"] .sp-tab, :root[data-theme="dark"] .sp-reason-input,
:root[data-theme="dark"] .sp-status-select { background: var(--surface-2); color: var(--text); }
:root[data-theme="dark"] .sp-tab.active { background: var(--teal-800); color: #fff; }
:root[data-theme="dark"] .cat-exam { background: var(--red-soft); }
:root[data-theme="dark"] .cat-homework { background: var(--green-soft); }
:root[data-theme="dark"] .pick-item .subject { color: var(--text); }
:root[data-theme="dark"] .context-bar b { color: var(--accent); }
:root[data-theme="dark"] a { color: inherit; }
:root[data-theme="dark"] main a:not([class]) { color: var(--accent); }
:root[data-theme="dark"] img { opacity: 0.95; }
@media print {
    :root[data-theme="dark"] { --bg:#fff; --surface:#fff; --text:#000; }
}
/* فاصله‌یِ منویِ کناری فقط در صفحه‌هایی که منو دارند (نه صفحه‌یِ ورود) */
@media (min-width: 860px) {
    body { margin-right: 0; }
    body.with-drawer { margin-right: 260px; }
}

/* =============================================================
   میزِ کار به سبکِ کارت (نسخه‌یِ ۲ — قدمِ دوم)
   کاشی‌هایِ رنگیِ پُر جایشان را به کارت‌هایِ ساده با یک نمادِ رنگی
   داده‌اند؛ فقط در میزِ کارِ کادر (.dash-layout) و دانش‌آموز (.card-tiles).
   ============================================================= */
.tile-group-title { font-size: 14px; font-weight: 800; color: var(--muted); margin: 22px 4px 10px; }
.dash-layout .tile-grid, .tile-grid.card-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 12px;
}
.dash-layout .tile, .card-tiles .tile {
    aspect-ratio: auto;
    min-height: 0;
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text);
    box-shadow: var(--shadow);
    position: relative;
    transition: border-color .15s, transform .1s;
}
.dash-layout .tile:hover, .card-tiles .tile:hover { border-color: color-mix(in srgb, var(--tile-color) 45%, var(--border)); }
.dash-layout .tile:active, .card-tiles .tile:active { transform: scale(0.985); filter: none; }
.dash-layout .tile > svg, .card-tiles .tile > svg {
    width: 50px; height: 50px; padding: 13px; flex-shrink: 0;
    border-radius: 16px;
    color: var(--tile-color);
    background: color-mix(in srgb, var(--tile-color) 13%, transparent);
}
:root[data-theme="dark"] .dash-layout .tile > svg, :root[data-theme="dark"] .card-tiles .tile > svg {
    color: color-mix(in srgb, var(--tile-color) 55%, white);
    background: color-mix(in srgb, var(--tile-color) 26%, transparent);
}
.dash-layout .tile .tile-text, .card-tiles .tile .tile-text { flex: 1; min-width: 0; text-align: right; }
.dash-layout .tile .tile-label, .card-tiles .tile .tile-label {
    font-size: 15px; font-weight: 800; text-align: right; padding: 0; line-height: 1.5;
}
.tile .tile-sub { font-size: 12px; color: var(--muted); margin-top: 2px; line-height: 1.6; font-weight: 400; }
.dash-layout .tile::after, .card-tiles .tile::after {
    content: ""; width: 9px; height: 9px; flex-shrink: 0; margin-left: 2px;
    border-left: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
    transform: rotate(45deg); opacity: .7;
}
/* شمارنده‌یِ قرمز (پیامِ نخوانده و...) کنارِ فلش */
.dash-layout .tile > span, .card-tiles .tile > span {
    position: static !important; order: 3; flex-shrink: 0;
    padding: 1px 9px !important; font-size: 12px !important; border-radius: 999px !important;
}
.dash-layout .tile::after, .card-tiles .tile::after { order: 4; }
@media (max-width: 600px) {
    .dash-layout .tile-grid, .tile-grid.card-tiles { grid-template-columns: 1fr; gap: 10px; }
}

/* کارت‌هایِ آماری (رتبه، درس‌هایِ قوی و ضعیف) */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; margin-bottom: 8px; }
.stat-card {
    display: flex; align-items: flex-start; gap: 14px; padding: 16px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 20px;
    box-shadow: var(--shadow); color: var(--text); text-decoration: none;
}
.stat-card .stat-ico {
    width: 50px; height: 50px; border-radius: 16px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent);
}
:root[data-theme="dark"] .stat-card .stat-ico { color: color-mix(in srgb, var(--c) 60%, white); background: color-mix(in srgb, var(--c) 24%, transparent); }
.stat-card .stat-ico svg { width: 24px; height: 24px; }
.stat-card .stat-body { flex: 1; min-width: 0; }
.stat-card .stat-label { font-size: 13px; color: var(--muted); }
.stat-card .stat-value { font-size: 30px; font-weight: 900; line-height: 1.3; }
.stat-card .stat-value small { font-size: 13px; font-weight: 400; color: var(--muted); }
.stat-card .stat-sub { font-size: 12.5px; color: var(--muted); }
.stat-card .stat-sub b { color: var(--text); }
.stat-card .stat-line { font-size: 13.5px; display: flex; justify-content: space-between; gap: 8px; padding: 2px 0; }

/* ---------- نوارِ پایینِ گوشی (پنلِ دانش‌آموز) ---------- */
.bottom-nav { display: none; }
@media (max-width: 859px) {
    .bottom-nav {
        display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 22;
        background: var(--header-bg); border-top: 1px solid var(--border);
        -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
        padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    }
    .bottom-nav a, .bottom-nav button {
        flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
        background: none; border: none; padding: 4px 0; width: auto; border-radius: 0;
        color: var(--muted); text-decoration: none; font-size: 11.5px; font-weight: 500; cursor: pointer;
    }
    .bottom-nav .bn-ico {
        width: 56px; height: 32px; border-radius: 16px;
        display: flex; align-items: center; justify-content: center; position: relative;
    }
    .bottom-nav svg { width: 22px; height: 22px; }
    .bottom-nav .active { color: var(--teal-900); font-weight: 700; }
    :root[data-theme="dark"] .bottom-nav .active { color: var(--accent); }
    .bottom-nav .active .bn-ico { background: var(--accent-soft); }
    .bottom-nav .bn-badge {
        position: absolute; top: -2px; left: 8px; background: var(--red); color: #fff;
        font-size: 10px; border-radius: 999px; padding: 0 5px; line-height: 16px;
    }
    body.with-bottom-nav main.container { padding-bottom: 110px; }
}

/* کارتِ طلاییِ رتبه (دانش‌آموز) */
.stat-card.stat-gold {
    background: linear-gradient(135deg, #C79A45, #E8C67A);
    border-color: transparent; color: #2E2306;
    box-shadow: 0 6px 20px rgba(199,154,69,0.28);
}
.stat-card.stat-gold .stat-ico,
:root[data-theme="dark"] .stat-card.stat-gold .stat-ico { background: rgba(255,255,255,0.35); color: #5A4210; }
.stat-card.stat-gold .stat-label, .stat-card.stat-gold .stat-sub,
.stat-card.stat-gold .stat-value small { color: #4A3A0F; }
.stat-card.stat-gold .stat-sub b { color: #2E2306; }
/* زبانه‌هایِ میزِ کار (گوشی) — مشترکِ کادر و دانش‌آموز */
.dash-tabs { display: none; }
@media (max-width: 859px) {
    .dash-tabs { display: flex; gap: 8px; overflow-x: auto; padding: 2px 16px 10px; margin: 0 -16px 4px;
                 scrollbar-width: none; position: sticky; top: 64px; z-index: 5; background: var(--bg); }
    .dash-tabs::-webkit-scrollbar { display: none; }
    .dash-tabs button { width: auto; flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
                        padding: 9px 14px; border-radius: 999px; font-size: 13.5px; font-weight: 600;
                        background: var(--surface); color: var(--muted); border: 1px solid var(--border); }
    .dash-tabs button.on { background: var(--accent-soft); color: var(--teal-900); border-color: transparent; font-weight: 800; }
    :root[data-theme="dark"] .dash-tabs button.on { color: var(--accent); }
    .dash-tab-n { font-size: 11px; background: var(--chip); border-radius: 999px; padding: 0 7px; color: var(--muted); }
    .dash-tabs button.on .dash-tab-n { background: var(--surface); }
    .tab-mode .tile-group-title { display: none; }
}

/* دکمه‌یِ «ذخیره / ثبت» (نوارِ پایینِ صفحه) نباید زیرِ نوارِ میانبرِ گوشی پنهان شود */
.save-bar { z-index: 21; box-shadow: 0 -4px 14px rgba(0,0,0,.06); }
@media (max-width: 859px) {
    body.with-bottom-nav .save-bar { bottom: var(--bn-h, 74px); }
    body.with-bottom-nav main.container { padding-bottom: 190px; }
}
@media (min-width: 860px) {
    body.with-drawer .save-bar { right: 260px; }
}
