@import url('https://cdn.jsdelivr.net/gh/rastikerdar/vazir-font@v30.1.0/dist/font-face.css');

:root {
    --teal: #1F6F5C;
    --teal-dark: #14483C;
    --teal-light: #2E9E6F;
    --amber: #E8A33D;
    --amber-dark: #C9822A;
    --cream: #FAF7F0;
    --cream-2: #F1ECDF;
    --ink: #2B2B26;
    --danger: #D64545;
    --info: #4A7FBF;
    --card-radius: 18px;
    --shadow: 0 8px 24px rgba(31, 111, 92, 0.10);
    --shadow-lg: 0 16px 40px rgba(31, 111, 92, 0.18);

    /* پیش‌فرض تم روزانه = همان رنگ برند (وقتی تم روزانه از تنظیمات خاموش باشد همین باقی می‌ماند) */
    --day-deep: var(--teal-dark);
    --day-strong: var(--teal);
    --day-soft: var(--teal-light);
}

/* ============ تم رنگی روزانه (شنبه=۰ ... جمعه=۶) ============ */
html[data-weekday="0"] { --day-deep:#14483C; --day-strong:#1F6F5C; --day-soft:#2E9E6F; } /* شنبه - سبزآبی */
html[data-weekday="1"] { --day-deep:#1B3B6F; --day-strong:#2F5C96; --day-soft:#5C8AC9; } /* یکشنبه - آبی */
html[data-weekday="2"] { --day-deep:#4B2E83; --day-strong:#6C46B3; --day-soft:#9B7BD1; } /* دوشنبه - بنفش */
html[data-weekday="3"] { --day-deep:#7A1F4B; --day-strong:#B23A6B; --day-soft:#D98CAE; } /* سه‌شنبه - رز */
html[data-weekday="4"] { --day-deep:#8A4B12; --day-strong:#C9822A; --day-soft:#F3B65C; } /* چهارشنبه - کهربایی */
html[data-weekday="5"] { --day-deep:#0F5C5C; --day-strong:#1B8A8A; --day-soft:#4DBEBE; } /* پنجشنبه - فیروزه‌ای */
html[data-weekday="6"] { --day-deep:#1A2A6C; --day-strong:#2E4C9E; --day-soft:#6C87D9; } /* جمعه - نیلی */

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: 'Vazir', Tahoma, sans-serif;
    background: var(--cream);
    color: var(--ink);
    direction: rtl;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; }

/* ============ صفحات ورود/نصب ============ */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, var(--day-strong) 0%, var(--day-deep) 55%, #0E2E27 100%);
    background-size: 200% 200%;
    animation: gradientShift 12s ease infinite;
}
@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
.auth-card {
    background: #fff;
    border-radius: 24px;
    box-shadow: var(--shadow-lg);
    padding: 36px 30px;
    width: 100%;
    max-width: 400px;
    text-align: center;
}
.auth-logo { font-size: 48px; margin-bottom: 6px; }
.auth-card h1 { font-size: 20px; margin: 6px 0 2px; color: var(--teal-dark); }
.auth-subtitle { color: #8a8578; font-size: 14px; margin-bottom: 18px; }
.auth-form { display: flex; flex-direction: column; gap: 14px; text-align: right; margin-top: 10px; }
.auth-form label { font-size: 13px; color: #6b6759; display: flex; flex-direction: column; gap: 6px; }

input, select, textarea {
    font-family: inherit;
    font-size: 15px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1.5px solid #E5E1D8;
    background: #fff;
    color: var(--ink);
    width: 100%;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--teal-light);
    box-shadow: 0 0 0 3px rgba(46,158,111,0.15);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 12px;
    border: none;
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: transform .12s ease, box-shadow .12s ease, opacity .12s ease;
}
.btn:active { transform: scale(0.97); }
.btn-block { width: 100%; }
.btn-primary { background: linear-gradient(135deg, var(--day-soft), var(--day-strong)); color: #fff; box-shadow: 0 6px 16px rgba(31,111,92,0.35); }
.btn-amber { background: linear-gradient(135deg, #F3B65C, var(--amber-dark)); color: #fff; box-shadow: 0 6px 16px rgba(201,130,42,0.35); }
.btn-danger { background: linear-gradient(135deg, #E86A6A, var(--danger)); color: #fff; }
.btn-outline { background: #fff; color: var(--teal); border: 1.5px solid var(--teal-light); }
.btn-sm { padding: 8px 14px; font-size: 13px; border-radius: 10px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.alert { padding: 12px 14px; border-radius: 12px; font-size: 14px; margin-bottom: 14px; text-align: right; }
.alert-success { background: #E4F5EC; color: #1E7A4C; }
.alert-error { background: #FBE7E7; color: #B23A3A; }
.alert-warning { background: #FDF1DC; color: #96650F; }
.alert-info { background: #E9F0FA; color: #2F5C96; }

/* ============ چارچوب اپ (بعد از ورود) ============ */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
html, body { background: linear-gradient(180deg, color-mix(in srgb, var(--day-soft) 14%, var(--cream)), var(--cream) 420px); }
.app-header {
    background: linear-gradient(120deg, var(--day-deep), var(--day-strong));
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    border-bottom: 1px solid rgba(255,255,255,0.18);
    color: #fff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    box-shadow: 0 4px 14px rgba(0,0,0,0.12);
    position: sticky;
    top: 0;
    z-index: 20;
}
.app-header .brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; }
.app-header .brand .emoji { font-size: 24px; }
.app-header .user-chip {
    background: rgba(255,255,255,0.15);
    padding: 7px 14px;
    border-radius: 999px;
    font-size: 13px;
    display: flex; align-items: center; gap: 8px;
}
.app-nav {
    display: flex;
    gap: 6px;
    padding: 10px 16px;
    background: rgba(255,255,255,0.65);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    overflow-x: auto;
    box-shadow: var(--shadow);
    position: sticky;
    top: 64px;
    z-index: 15;
}
.app-nav a {
    padding: 9px 16px;
    border-radius: 999px;
    font-size: 13.5px;
    font-weight: 700;
    color: #6b6759;
    white-space: nowrap;
}
.app-nav a.active, .app-nav a:hover { background: var(--cream-2); color: var(--day-deep); }

.app-main { flex: 1; padding: 18px; max-width: 1100px; margin: 0 auto; width: 100%; }

.card {
    background: rgba(255,255,255,0.68);
    backdrop-filter: blur(16px) saturate(150%);
    -webkit-backdrop-filter: blur(16px) saturate(150%);
    border: 1px solid rgba(255,255,255,0.6);
    border-radius: var(--card-radius);
    box-shadow: var(--shadow);
    padding: 18px;
    margin-bottom: 16px;
}
.card h2 { margin: 0 0 14px; font-size: 17px; color: var(--day-deep); }
.card h3 { margin: 0 0 10px; font-size: 15px; color: var(--day-deep); }

.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

.stat-card {
    border-radius: 16px;
    padding: 16px;
    color: #fff;
    box-shadow: var(--shadow);
}
.stat-card .num { font-size: 26px; font-weight: 800; }
.stat-card .lbl { font-size: 13px; opacity: .9; }
.stat-present { background: linear-gradient(135deg, #40B37F, var(--teal-light)); }
.stat-late { background: linear-gradient(135deg, #F3B65C, var(--amber)); }
.stat-excused { background: linear-gradient(135deg, #6FA0DA, var(--info)); }
.stat-unexcused { background: linear-gradient(135deg, #E88888, var(--danger)); }

/* ============ لیست دانش‌آموزان / ثبت حضور ============ */
.date-banner {
    background: linear-gradient(120deg, var(--amber-dark), var(--amber));
    color: #fff;
    border-radius: var(--card-radius);
    padding: 16px 18px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    box-shadow: var(--shadow);
}
.date-banner .date-main { font-size: 18px; font-weight: 800; }
.date-banner .date-sub { font-size: 12.5px; opacity: .9; }

.window-locked {
    background: linear-gradient(120deg, #C94545, #E86A6A);
    color: #fff;
    border-radius: var(--card-radius);
    padding: 18px;
    text-align: center;
    font-weight: 700;
    box-shadow: var(--shadow);
}

.student-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 14px;
    background: var(--cream-2);
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.student-row .student-name {
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    color: var(--teal-dark);
    display: flex;
    align-items: center;
    gap: 6px;
}
.student-row .student-name:hover { text-decoration: underline; }

.status-buttons { display: flex; gap: 6px; flex-wrap: wrap; }
.status-btn {
    border: 2px solid transparent;
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    color: #fff;
    opacity: .55;
    transition: opacity .15s, transform .1s;
}
.status-btn:active { transform: scale(0.95); }
.status-btn.active { opacity: 1; box-shadow: 0 4px 10px rgba(0,0,0,0.18); border-color: rgba(255,255,255,0.6); }
.status-present { background: var(--teal-light); }
.status-late { background: var(--amber); }
.status-excused_absent { background: var(--info); }
.status-unexcused_absent { background: var(--danger); }

.save-bar {
    position: sticky;
    bottom: 0;
    background: #fff;
    padding: 14px;
    box-shadow: 0 -6px 20px rgba(0,0,0,0.08);
    border-radius: 18px 18px 0 0;
    display: flex;
    justify-content: center;
    z-index: 10;
    margin-top: 10px;
}

/* ============ تقویم سالانه/ماهانه ============ */
.year-grid { display: flex; flex-direction: column; gap: 16px; }
.month-block h4 { margin: 0 0 8px; font-size: 14px; color: var(--teal-dark); }
.day-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(26px, 1fr));
    gap: 4px;
}
.day-cell {
    aspect-ratio: 1;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: #fff;
    font-weight: 700;
}
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; margin-top: 10px; }
.legend .dot { display: inline-block; width: 12px; height: 12px; border-radius: 4px; margin-left: 5px; vertical-align: middle; }

/* ============ جدول‌ها ============ */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 8px; text-align: right; border-bottom: 1px solid var(--cream-2); }
th { color: #8a8578; font-weight: 700; font-size: 12.5px; }
.table-wrap { overflow-x: auto; }

.badge { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; color: #fff; }
.badge-teal { background: var(--teal-light); }
.badge-amber { background: var(--amber); }
.badge-gray { background: #B8B2A2; }

.tabs { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.tab-btn { padding: 8px 16px; border-radius: 999px; border: 1.5px solid var(--cream-2); background: #fff; font-family: inherit; font-weight: 700; font-size: 13px; cursor: pointer; color: #8a8578; }
.tab-btn.active { background: var(--teal); color: #fff; border-color: var(--teal); }

.class-list { display: flex; flex-direction: column; gap: 8px; }
.class-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px; border-radius: 14px; background: var(--cream-2);
    cursor: pointer; transition: background .15s;
}
.class-item:hover { background: #E9E3D3; }
.class-item .cname { font-weight: 800; color: var(--teal-dark); }
.class-item .cteacher { font-size: 12.5px; color: #8a8578; }

.modal-overlay {
    position: fixed; inset: 0; background: rgba(20,30,25,0.55);
    display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px;
}
.modal-box {
    background: rgba(255,255,255,0.85); backdrop-filter: blur(18px) saturate(160%); -webkit-backdrop-filter: blur(18px) saturate(160%);
    border: 1px solid rgba(255,255,255,0.6);
    border-radius: 20px; max-width: 520px; width: 100%;
    max-height: 88vh; overflow-y: auto; padding: 20px; box-shadow: var(--shadow-lg);
}
.modal-close { float: left; background: none; border: none; font-size: 20px; cursor: pointer; color: #8a8578; }

.empty-state { text-align: center; padding: 40px 20px; color: #a39d8c; }
.empty-state .e-emoji { font-size: 40px; margin-bottom: 10px; }

.form-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); }
.form-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.date-select-group { display: flex; gap: 6px; }
.date-select-group select { width: auto; flex: 1; min-width: 0; padding: 10px 6px; }

.btn-install-app {
    display: inline-flex; align-items: center; gap: 5px;
    border: 1px solid rgba(255,255,255,.5);
    background: rgba(255,255,255,0.18); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    color: #fff; font-size: 12.5px; font-weight: 700;
    padding: 6px 12px; border-radius: 999px; cursor: pointer; white-space: nowrap;
}
.btn-install-app:active { transform: scale(0.96); background: rgba(255,255,255,0.3); }

/* ============ جستجوی زنده ============ */
.live-search-box { position: relative; margin-bottom: 14px; }
.live-search-box input {
    padding-inline-start: 38px;
}
.live-search-box::before {
    content: '🔍'; position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%);
    font-size: 14px; opacity: .6; pointer-events: none;
}

/* ============ نشان روزهای بدون غیبت ============ */
.no-absence-badge {
    display: inline-flex; align-items: center; gap: 3px;
    font-size: 12px; font-weight: 800; padding: 2px 8px; border-radius: 999px;
    color: #fff; vertical-align: middle; margin-inline-start: 6px; white-space: nowrap;
}
.no-absence-badge.tier-bronze  { background: linear-gradient(135deg, #C97A45, #8A4B12); }
.no-absence-badge.tier-silver  { background: linear-gradient(135deg, #C7CCD4, #8A93A0); }
.no-absence-badge.tier-gold    { background: linear-gradient(135deg, #F3D06B, #C9822A); }
.no-absence-badge.tier-diamond { background: linear-gradient(135deg, #7FE3E3, #1B8A8A); }

.toast {
    position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
    background: var(--teal-dark); color: #fff; padding: 12px 22px; border-radius: 999px;
    font-size: 14px; box-shadow: var(--shadow-lg); z-index: 200; opacity: 0; transition: opacity .3s, transform .3s;
    pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-6px); }

/* ============ صفحه پاسخ والدین ============ */
.respond-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--info), #2F5C96);
    padding: 20px;
}
.respond-card { background: #fff; border-radius: 24px; padding: 30px 24px; max-width: 420px; width: 100%; text-align: center; box-shadow: var(--shadow-lg); }
.respond-options { display: flex; flex-direction: column; gap: 12px; margin-top: 18px; }
.respond-btn {
    padding: 16px; border-radius: 14px; border: 2px solid var(--cream-2); background: var(--cream-2);
    font-family: inherit; font-size: 15px; font-weight: 700; cursor: pointer; color: var(--ink);
}
.respond-btn:hover { border-color: var(--teal-light); }

@media (max-width: 640px) {
    .class-item { flex-wrap: wrap; }
    .class-item > a { margin-inline-start: 0 !important; }
    .app-main { padding: 12px; }
    .app-header { padding: 12px 14px; }
    .app-header .brand { font-size: 15px; }
    .app-header .user-chip { font-size: 12px; padding: 6px 10px; }
    .card { padding: 14px; }
    .card h2 { font-size: 15.5px; }
    .student-row { flex-direction: column; align-items: stretch; }
    .student-row > form { width: 100%; }
    .status-buttons { justify-content: stretch; }
    .status-btn { flex: 1 1 45%; min-width: 45%; }
    table { font-size: 12.5px; }
    th, td { padding: 8px 5px; }
    .modal-box { padding: 14px; border-radius: 16px; }
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-2 { grid-template-columns: 1fr; }
    .date-banner { flex-direction: column; align-items: flex-start; }
    .form-grid { grid-template-columns: 1fr; }
}

@media (max-width: 380px) {
    .status-btn { flex: 1 1 100%; }
    .stat-card .num { font-size: 21px; }
}


/* ===== فاز ۱: فرم‌ها، منو، داشبورد، کارت‌های انضباطی ===== */
.form-grid { align-items: end; }
.form-grid > label, .form-grid > div { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.form-grid > label > input, .form-grid > label > select, .form-grid > label > textarea { width: 100%; box-sizing: border-box; }
.field-hint { display: block; font-size: 11.5px; color: #a39d8c; font-weight: 400; line-height: 1.6; }

.app-subnav { display: flex; gap: 6px; padding: 8px 16px; background: rgba(255,255,255,0.85); overflow-x: auto; border-bottom: 1px solid var(--cream-2); }
.app-subnav a { padding: 6px 14px; border-radius: 999px; font-size: 13px; font-weight: 700; color: #6b6759; white-space: nowrap; background: var(--cream-2); }
.app-subnav a.active { background: var(--teal); color: #fff; }
.nav-badge { display: inline-block; min-width: 18px; padding: 1px 6px; margin-inline-start: 5px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 11.5px; font-weight: 800; text-align: center; line-height: 1.5; }

.counter-row { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 14px; }
.counter-card { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border-radius: 16px; background: #fff; box-shadow: var(--shadow); text-decoration: none; color: inherit; border-inline-start: 5px solid var(--danger); }
.counter-card .cnum { font-size: 26px; font-weight: 800; color: var(--danger); }
.counter-card .clbl { font-size: 13px; font-weight: 700; color: #4a463c; }
.counter-card.is-zero { border-inline-start-color: #cfd8d3; opacity: .75; }
.counter-card.is-zero .cnum { color: #8aa59b; }

.cls-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
.cls-tile { position: relative; display: block; padding: 8px 8px 8px 8px; border-radius: 12px; background: #fff; border: 1.5px solid var(--cream-2); border-top: 5px solid var(--gc, #8a8578); text-decoration: none; color: inherit; text-align: center; min-height: 58px; }
.cls-tile .cn { font-weight: 800; font-size: 14px; }
.cls-tile .ct { font-size: 11px; color: #8a8578; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cls-tile .cs { position: absolute; top: 4px; inset-inline-start: 6px; font-size: 13px; }
.cls-tile.st-done { opacity: .7; }
.cls-tile.st-wait { background: #f3f1ea; opacity: .85; }
.cls-tile.st-late { background: #fdecec; border-color: var(--danger); box-shadow: 0 3px 10px rgba(214,69,69,.25); }
.cls-tile.st-late .cn { color: var(--danger); }
.grade-legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: 11.5px; color: #8a8578; margin-top: 10px; }
.grade-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: 4px; vertical-align: middle; }

.abs-cards { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.abs-card { display: block; padding: 12px 14px; border-radius: 14px; background: #fff; box-shadow: var(--shadow); text-decoration: none; color: inherit; border-inline-start: 5px solid var(--danger); }
.abs-card .an { font-weight: 800; font-size: 14.5px; }
.abs-card .ac { font-size: 12px; color: #8a8578; margin: 2px 0 8px; }
.abs-card .ab { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; margin-inline-end: 6px; }
.abs-card .ab.a { background: #fdecec; color: var(--danger); }
.abs-card .ab.l { background: #fff4de; color: #b77a0c; }

.stu-chip { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 10px 14px; background: var(--cream-2); border-radius: 12px; font-size: 14px; }
.stu-chip b { font-size: 15.5px; }

.sev-list { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-top: 8px; }
.sev-card { position: relative; display: flex; align-items: center; justify-content: center; text-align: center; gap: 6px; padding: 12px 10px; border-radius: 14px; font-weight: 700; font-size: 14px; cursor: pointer; border: 2.5px solid transparent; background: var(--sev-bg); color: var(--sev-fg); user-select: none; transition: transform .12s, box-shadow .12s; }
.sev-card input { position: absolute; opacity: 0; pointer-events: none; }
.sev-card .tick { display: none; font-size: 16px; }
.sev-card:has(input:checked) { border-color: var(--sev-fg); box-shadow: 0 4px 12px rgba(0,0,0,.18); transform: translateY(-1px); }
.sev-card:has(input:checked) .tick { display: inline; }
.sev-card:not(:has(input:checked)) { opacity: .82; }
.sev-0 { --sev-bg: #e3f4e8; --sev-fg: #1d7a45; }
.sev-1 { --sev-bg: #fff3cf; --sev-fg: #9a6b00; }
.sev-2 { --sev-bg: #ffe2c9; --sev-fg: #b4540a; }
.sev-3 { --sev-bg: #fbd9d9; --sev-fg: #b02a2a; }


/* ===== فاز ۲: بررسی غایب‌ها و کلاس‌ها ===== */
.tabs-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs-row .tab-btn.active { background: var(--teal); color: #fff; border-color: var(--teal); }
.tabs-row .tab-btn .nav-badge { background: #fff; color: var(--danger); }
.tabs-row .tab-btn:not(.active) .nav-badge { background: var(--danger); color: #fff; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.sec-title { font-size: 15px; font-weight: 800; margin: 16px 0 8px; display: flex; align-items: center; gap: 8px; }
.sec-hint { font-size: 12.5px; color: #8a8578; margin: -4px 0 10px; }

.ab-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.ab-item { background: #fff; border-radius: 14px; box-shadow: var(--shadow); padding: 12px 14px; border-inline-start: 5px solid var(--danger); display: flex; flex-direction: column; gap: 8px; }
.ab-item:has(input:checked) { border-inline-start-color: #3A86C8; background: #f1f7fd; }
.ab-item .ab-name { font-weight: 800; font-size: 15px; }
.ab-item .ab-meta { font-size: 12.5px; color: #8a8578; }
.ab-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; background: var(--cream-2); color: #6b6759; }
.chip.warn { background: #fdecec; color: var(--danger); }
.chip.info { background: #e6f0fb; color: #25609c; }
.chip.amber { background: #fff4de; color: #b77a0c; }
.chip.ok { background: #e3f4e8; color: #1d7a45; }

.seg { display: flex; border-radius: 10px; overflow: hidden; border: 1.5px solid var(--cream-2); cursor: pointer; user-select: none; margin-top: auto; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { flex: 1; text-align: center; padding: 8px 6px; font-size: 13px; font-weight: 700; background: #fff; color: #a39d8c; }
.seg .s-un { background: #fdecec; color: var(--danger); }
.seg:has(input:checked) .s-un { background: #fff; color: #a39d8c; }
.seg:has(input:checked) .s-ex { background: #3A86C8; color: #fff; }

.req-card { background: #fffaf0; border: 1.5px solid #f2d9a6; border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.req-card .row { display: flex; gap: 6px; flex-wrap: wrap; }
.req-card select, .req-card input[type=text] { flex: 1; min-width: 120px; }

.act-bar { position: sticky; bottom: 0; z-index: 12; margin-top: 14px; padding: 12px 14px; background: rgba(255,255,255,.96); backdrop-filter: blur(8px); border-radius: 14px; box-shadow: 0 -6px 20px rgba(0,0,0,.10); display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; }
.act-bar .sum { font-size: 13.5px; font-weight: 700; }
.act-bar .sum .u { color: var(--danger); } .act-bar .sum .e { color: #25609c; }
.mini-links { display: flex; gap: 12px; font-size: 12.5px; margin-bottom: 8px; }
.mini-links a { color: #25609c; cursor: pointer; text-decoration: underline; }

.sent-list { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.sent-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: #fff; padding: 10px 12px; border-radius: 12px; box-shadow: var(--shadow); }

.cgrade-title { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 15px; margin: 18px 0 8px; }
.cgrade-title i { display: inline-block; width: 14px; height: 14px; border-radius: 4px; background: var(--gc); }
.ccard-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.ccard { position: relative; background: #fff; border-radius: 14px; box-shadow: var(--shadow); border-top: 6px solid var(--gc); padding: 12px 12px 10px; display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: inherit; }
.ccard .cc-name { font-size: 16px; font-weight: 800; }
.ccard .cc-teacher { font-size: 12.5px; color: #6b6759; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ccard .cc-meta { font-size: 11.5px; color: #8a8578; }
.ccard .cc-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; gap: 6px; }
.ccard .cc-count { font-size: 12px; font-weight: 700; background: var(--cream-2); border-radius: 999px; padding: 2px 10px; }
.ccard .cc-print { font-size: 12px; color: #25609c; }
.ccard .cc-st { position: absolute; top: 8px; inset-inline-start: 10px; font-size: 14px; }


/* ===== فاز ۳: تم زنده‌تر (گرادیانت و شیشه‌ای) ===== */
:root {
    --teal: #0FA38A; --teal-dark: #0B6E5E; --teal-light: #2FD6B3;
    --amber: #FFA726; --amber-dark: #FB8C00;
    --cream: #F3F6FF; --cream-2: #E8EEFF;
    --ink: #1B2340; --danger: #E5384F; --info: #3B82F6;
    --shadow: 0 10px 28px rgba(40, 70, 160, 0.14);
    --shadow-lg: 0 18px 44px rgba(40, 70, 160, 0.24);
    --day-deep: #0B6E5E; --day-strong: #0FA38A; --day-soft: #2FD6B3;
}
html[data-weekday="0"] { --day-deep:#0A6B5B; --day-strong:#0FB095; --day-soft:#3EE3C0; } /* شنبه - سبز زمردی */
html[data-weekday="1"] { --day-deep:#1740B0; --day-strong:#2F6BFF; --day-soft:#74A2FF; } /* یکشنبه - آبی */
html[data-weekday="2"] { --day-deep:#5420B0; --day-strong:#8B3DFF; --day-soft:#B994FF; } /* دوشنبه - بنفش */
html[data-weekday="3"] { --day-deep:#A8115A; --day-strong:#E8387F; --day-soft:#FF86B6; } /* سه‌شنبه - صورتی */
html[data-weekday="4"] { --day-deep:#B8500A; --day-strong:#FF8A1F; --day-soft:#FFBE55; } /* چهارشنبه - نارنجی */
html[data-weekday="5"] { --day-deep:#09717B; --day-strong:#12B5C2; --day-soft:#62E3E8; } /* پنجشنبه - فیروزه‌ای */
html[data-weekday="6"] { --day-deep:#2A2EA0; --day-strong:#4B5BFF; --day-soft:#8E9BFF; } /* جمعه - نیلی */
html[data-weekday] { --teal: var(--day-strong); --teal-dark: var(--day-deep); --teal-light: var(--day-soft);
    --cream-2: color-mix(in srgb, var(--day-soft) 20%, #fff);
    --shadow: 0 10px 28px color-mix(in srgb, var(--day-strong) 22%, transparent);
    --shadow-lg: 0 18px 44px color-mix(in srgb, var(--day-strong) 32%, transparent); }

html, body { background: #F3F6FF; }
body { position: relative; min-height: 100vh; }
body::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
    background:
        radial-gradient(520px 420px at 92% 6%, color-mix(in srgb, var(--day-soft) 42%, transparent), transparent 70%),
        radial-gradient(560px 460px at 6% 38%, color-mix(in srgb, var(--day-strong) 22%, transparent), transparent 70%),
        radial-gradient(520px 420px at 80% 92%, color-mix(in srgb, var(--day-soft) 30%, transparent), transparent 70%),
        linear-gradient(180deg, color-mix(in srgb, var(--day-soft) 12%, #F6F8FF), #F3F6FF); }

.auth-page { background: linear-gradient(135deg, var(--day-soft) 0%, var(--day-strong) 48%, var(--day-deep) 100%); background-size: 200% 200%; }
.auth-card { background: rgba(255,255,255,.92); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }

.app-header { background: linear-gradient(115deg, var(--day-deep) 0%, var(--day-strong) 62%, var(--day-soft) 100%); box-shadow: 0 8px 24px color-mix(in srgb, var(--day-strong) 35%, transparent); }
.app-header .user-chip { background: rgba(255,255,255,.22); border: 1px solid rgba(255,255,255,.35); backdrop-filter: blur(8px); }

.app-nav { background: rgba(255,255,255,.72); backdrop-filter: blur(16px) saturate(160%); -webkit-backdrop-filter: blur(16px) saturate(160%); border-bottom: 1px solid rgba(255,255,255,.7); }
.app-nav a { color: color-mix(in srgb, var(--day-deep) 80%, #333); transition: background .15s, transform .12s; }
.app-nav a:hover { background: color-mix(in srgb, var(--day-soft) 28%, #fff); color: var(--day-deep); }
.app-nav a.active { background: linear-gradient(135deg, var(--day-strong), var(--day-soft)); color: #fff; box-shadow: 0 6px 14px color-mix(in srgb, var(--day-strong) 40%, transparent); }
.app-subnav { background: rgba(255,255,255,.6); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid rgba(255,255,255,.7); }
.app-subnav a { background: color-mix(in srgb, var(--day-soft) 22%, #fff); color: var(--day-deep); }
.app-subnav a.active { background: linear-gradient(135deg, var(--day-deep), var(--day-strong)); color: #fff; }

.card { background: rgba(255,255,255,.62); border: 1px solid rgba(255,255,255,.85); box-shadow: var(--shadow); }
.card h2, .card h3 { color: var(--day-deep); }

.btn-primary { background: linear-gradient(135deg, var(--day-soft), var(--day-strong)); box-shadow: 0 8px 18px color-mix(in srgb, var(--day-strong) 42%, transparent); }
.btn-primary:hover { filter: brightness(1.06); }
.btn-amber { background: linear-gradient(135deg, #FFC857, #FF8A1F); box-shadow: 0 8px 18px rgba(255,138,31,.38); }
.btn-danger { background: linear-gradient(135deg, #FF7A8A, #E5384F); box-shadow: 0 8px 18px rgba(229,56,79,.32); }
.btn-outline { background: rgba(255,255,255,.85); color: var(--day-strong); border: 1.5px solid var(--day-soft); }
.btn-outline:hover { background: color-mix(in srgb, var(--day-soft) 22%, #fff); }
.btn-secondary { background: color-mix(in srgb, var(--day-soft) 24%, #fff); color: var(--day-deep); border: 1px solid color-mix(in srgb, var(--day-strong) 35%, transparent); }

input:focus, select:focus, textarea:focus { outline: none; border-color: var(--day-strong); box-shadow: 0 0 0 3px color-mix(in srgb, var(--day-strong) 24%, transparent); }

.stat-card { position: relative; overflow: hidden; }
.stat-card::after { content: ""; position: absolute; inset: -40% -20% auto auto; width: 120px; height: 120px; border-radius: 50%; background: rgba(255,255,255,.22); }
.stat-present { background: linear-gradient(135deg, #34E5A4, #00AE7B); box-shadow: 0 10px 22px rgba(0,174,123,.32); }
.stat-late { background: linear-gradient(135deg, #FFD15C, #FF9F1C); box-shadow: 0 10px 22px rgba(255,159,28,.34); }
.stat-excused { background: linear-gradient(135deg, #63B6FF, #2F7BFF); box-shadow: 0 10px 22px rgba(47,123,255,.32); }
.stat-unexcused { background: linear-gradient(135deg, #FF8595, #EE3550); box-shadow: 0 10px 22px rgba(238,53,80,.32); }

.badge-teal { background: linear-gradient(135deg, var(--day-soft), var(--day-strong)); }
.badge-amber { background: linear-gradient(135deg, #FFC857, #FF9F1C); }
.badge-gray { background: #9AA3C4; }

th { color: var(--day-deep); background: color-mix(in srgb, var(--day-soft) 16%, #fff); }
tbody tr:hover td, table tr:hover td { background: color-mix(in srgb, var(--day-soft) 10%, transparent); }

.alert-success { background: #D9F8E9; color: #077A4B; }
.alert-error, .alert-danger { background: #FFE1E5; color: #C21F39; }
.alert-warning { background: #FFF0CC; color: #9A5B00; }
.alert-info { background: #DCEBFF; color: #1D56B8; }

.student-row { background: rgba(255,255,255,.7); border: 1px solid rgba(255,255,255,.9); box-shadow: 0 4px 12px color-mix(in srgb, var(--day-strong) 10%, transparent); }
.date-banner { background: linear-gradient(120deg, #FF8A1F, #FFC857); }
.tab-btn { background: rgba(255,255,255,.8); color: var(--day-deep); }

/* اجزای فاز ۱ و ۲ */
.abs-card, .ab-item, .sent-row, .ccard { background: rgba(255,255,255,.82); }
.nav-badge { background: linear-gradient(135deg, #FF7A8A, #E5384F); box-shadow: 0 2px 6px rgba(229,56,79,.4); }
.chip.info { background: #DCEBFF; color: #1D56B8; }
.chip.warn { background: #FFE1E5; color: #C21F39; }
.chip.amber { background: #FFF0CC; color: #9A5B00; }
.chip.ok { background: #D9F8E9; color: #077A4B; }
.sev-0 { --sev-bg: #CFF7E2; --sev-fg: #07803F; }
.sev-1 { --sev-bg: #FFEFB8; --sev-fg: #8F6100; }
.sev-2 { --sev-bg: #FFD9B5; --sev-fg: #B24A00; }
.sev-3 { --sev-bg: #FFC9D0; --sev-fg: #C21F39; }
.cls-tile.st-late { background: linear-gradient(135deg, #FFE5E9, #fff); }
.rank-no { display: inline-block; min-width: 24px; text-align: center; font-weight: 800; color: var(--day-deep); }
