:root {
    color-scheme: light;
    --navy: #071b3a;
    --navy-2: #0c2f5f;
    --cyan: #35d8ff;
    --cyan-2: #8ceaff;
    --blue: #2579ff;
    --ink: #10233f;
    --muted: #5c708d;
    --line: rgba(10, 42, 82, .12);
    --surface: rgba(255, 255, 255, .82);
    --surface-strong: #ffffff;
    --surface-border: rgba(255, 255, 255, .78);
    --header-bg: rgba(255, 255, 255, .76);
    --card-bg: rgba(255, 255, 255, .74);
    --soft-bg: rgba(7, 27, 58, .06);
    --table-bg: rgba(255, 255, 255, .74);
    --table-head: rgba(53, 216, 255, .12);
    --input-bg: rgba(255, 255, 255, .88);
    --danger: #d94763;
    --success: #0f946d;
    --warning: #c77b16;
    --shadow: 0 24px 70px rgba(12, 47, 95, .13);
    --primary-gradient: linear-gradient(135deg, #071b3a, #2579ff);
    --brand-gradient: linear-gradient(135deg, #071b3a, #2579ff 58%, #35d8ff);
    --hero-gradient: linear-gradient(145deg, rgba(7, 27, 58, .95), rgba(37, 121, 255, .82));
    --footer-gradient: linear-gradient(135deg, #071b3a, #0c2f5f);
    --placeholder-gradient:
        linear-gradient(135deg, rgba(7, 27, 58, .74), rgba(37, 121, 255, .62)),
        linear-gradient(45deg, #08264f, #35d8ff);
    --body-bg:
        radial-gradient(circle at 15% 15%, rgba(53, 216, 255, .24), transparent 28rem),
        radial-gradient(circle at 82% 6%, rgba(37, 121, 255, .18), transparent 30rem),
        linear-gradient(180deg, #f7fcff 0%, #ecf7ff 48%, #f9fdff 100%);
}

.course-command-title .title-with-filter,
.course-command-title .profile-head {
    align-items: center;
}

.course-hero-panel {
    position: relative;
    overflow: hidden;
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr);
    gap: 24px;
    align-items: center;
    padding: 28px;
    border: 1px solid rgba(53, 216, 255, .24);
    border-radius: 26px;
    color: #fff;
    background:
        linear-gradient(135deg, rgba(7, 27, 58, .98), rgba(37, 121, 255, .84)),
        var(--primary-gradient);
    box-shadow: 0 28px 70px rgba(7, 27, 58, .24);
}

.course-hero-panel::after {
    content: "";
    position: absolute;
    inset: auto -12% -45% auto;
    width: 46%;
    aspect-ratio: 1;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 999px;
    background: radial-gradient(circle, rgba(53, 216, 255, .28), transparent 62%);
}

.course-orbit {
    position: relative;
    z-index: 1;
    display: grid;
    place-items: center;
    width: 154px;
    height: 154px;
    border-radius: 999px;
    background: conic-gradient(var(--cyan) var(--course-progress, 0%), rgba(255, 255, 255, .16) 0);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18), 0 20px 46px rgba(0, 0, 0, .22);
}

.course-orbit::before {
    content: "";
    position: absolute;
    inset: 14px;
    border-radius: inherit;
    background: rgba(7, 27, 58, .92);
}

.course-orbit b {
    position: relative;
    font-size: 2rem;
    font-weight: 900;
}

.course-hero-copy {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 10px;
}

.course-hero-copy h2 {
    margin: 0;
    font-size: clamp(1.6rem, 3vw, 3rem);
    color: #fff;
}

.course-hero-copy p,
.course-hero-meta {
    margin: 0;
    color: rgba(255, 255, 255, .78);
}

.course-timeline {
    overflow: hidden;
    height: 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .18);
}

.course-timeline span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--cyan), #fff);
    box-shadow: 0 0 22px rgba(53, 216, 255, .6);
}

.course-hero-meta,
.course-picker-actions,
.course-mini-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.course-hero-meta span,
.course-mini-metrics span {
    padding: 7px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .14);
}

.course-kpi-grid {
    margin-top: 24px;
}

.course-kpi-card {
    position: relative;
    overflow: hidden;
}

.course-kpi-card::after {
    content: "";
    position: absolute;
    inset: auto -20px -32px auto;
    width: 86px;
    height: 86px;
    border-radius: 999px;
    background: rgba(53, 216, 255, .12);
}

.course-create-panel,
.course-leaders-panel {
    min-height: 100%;
}

.course-activate-toggle {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-height: 44px;
    padding: 10px 13px;
    border: 1px solid var(--surface-border);
    border-radius: 14px;
    background: var(--soft-bg);
    font-weight: 800;
}

.course-student-picker {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 10px;
    max-height: 390px;
    overflow: auto;
    padding: 6px;
}

.course-student-option {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 10px;
    border: 1px solid var(--surface-border);
    border-radius: 16px;
    background: var(--soft-bg);
    cursor: pointer;
}

.course-student-option:has(input:checked) {
    border-color: rgba(53, 216, 255, .72);
    background: rgba(53, 216, 255, .14);
    box-shadow: inset 0 0 0 1px rgba(53, 216, 255, .16);
}

.course-student-option img,
.course-student-option .avatar-fallback {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    border-radius: 12px;
    object-fit: cover;
}

.course-student-option span {
    min-width: 0;
}

.course-student-option strong,
.course-student-option small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.course-student-option small {
    color: var(--muted);
}

.course-leaderboard {
    display: grid;
    gap: 10px;
}

.course-leader-row {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto auto;
    gap: 10px;
    align-items: center;
    padding: 11px;
    border-radius: 16px;
    background: var(--soft-bg);
}

.course-leader-rank {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 12px;
    color: #fff;
    font-weight: 900;
    background: var(--primary-gradient);
}

.course-archive-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 14px;
}

.course-archive-card {
    display: grid;
    gap: 12px;
    padding: 16px;
    border: 1px solid var(--surface-border);
    border-radius: 18px;
    background: var(--soft-bg);
}

.course-archive-card.is-active {
    border-color: rgba(53, 216, 255, .62);
    box-shadow: inset 0 0 0 1px rgba(53, 216, 255, .16), 0 18px 40px rgba(37, 121, 255, .12);
}

.course-archive-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.course-empty-state {
    display: grid;
    place-items: center;
    gap: 12px;
    min-height: 180px;
    text-align: center;
}

.course-empty-icon {
    display: grid;
    place-items: center;
    width: 66px;
    height: 66px;
    border-radius: 22px;
    color: #fff;
    background: var(--primary-gradient);
}

.course-empty-icon svg {
    width: 30px;
    height: 30px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.course-selector {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 8px;
    border: 1px solid var(--surface-border);
    border-radius: 16px;
    background: var(--surface);
}

.course-selector label {
    font-weight: 900;
    color: var(--navy);
}

.course-selector select {
    min-width: 180px;
}

.course-podium-row td:first-child {
    position: relative;
}

.course-podium-row td:first-child::after {
    content: "★";
    margin-inline-start: 8px;
    color: var(--warning);
}

@media (prefers-reduced-motion: no-preference) {
    .course-hero-panel,
    .course-kpi-card,
    .course-archive-card,
    .course-leader-row,
    .course-student-option {
        animation: himma-rise .34s ease both;
    }

    .course-orbit {
        animation: course-orbit-pop .5s ease both;
    }
}

@keyframes course-orbit-pop {
    from {
        opacity: 0;
        transform: scale(.92) rotate(-8deg);
    }

    to {
        opacity: 1;
        transform: scale(1) rotate(0);
    }
}

@media (max-width: 820px) {
    .course-hero-panel {
        grid-template-columns: 1fr;
        justify-items: center;
        text-align: center;
    }

    .course-hero-meta,
    .course-picker-actions,
    .course-mini-metrics,
    .course-archive-head {
        justify-content: center;
    }

    .course-leader-row {
        grid-template-columns: 36px minmax(0, 1fr);
    }

    .course-leader-row span:not(.course-leader-rank),
    .course-leader-row b {
        grid-column: 2;
    }

    .course-selector {
        align-items: stretch;
        flex-direction: column;
        width: 100%;
    }

    .course-selector select {
        width: 100%;
    }
}

@media (max-width: 980px) {
    .quran-exam-type-grid {
        grid-template-columns: 1fr;
    }

    .quran-exam-live-summary,
    .quran-exam-filter-summary {
        align-items: stretch;
        flex-direction: column;
    }

    .quran-exam-live-summary p {
        max-width: none;
    }
}

@media (max-width: 720px) {
    .quran-exam-panel-head,
    .quran-exam-archive-head {
        align-items: stretch;
    }

    .quran-exam-filter-toolbar {
        display: grid;
        grid-template-columns: 1fr;
        width: 100%;
    }

    .quran-exam-filter-button {
        width: 100%;
    }

    .table-auth-logs td:nth-child(1)::before { content: "الحالة"; }
    .table-auth-logs td:nth-child(2)::before { content: "الحساب"; }
    .table-auth-logs td:nth-child(3)::before { content: "الجهاز والنظام"; }
    .table-auth-logs td:nth-child(4)::before { content: "المتصفح"; }
    .table-auth-logs td:nth-child(5)::before { content: "IP"; }
    .table-auth-logs td:nth-child(6)::before { content: "التاريخ والوقت"; }
}

html[data-theme="dark"] {
    color-scheme: dark;
    --navy: #d9f3ff;
    --navy-2: #9bdfff;
    --cyan: #55e1ff;
    --cyan-2: #b5f4ff;
    --blue: #6fa6ff;
    --ink: #e9f6ff;
    --muted: #a6bdd4;
    --line: rgba(176, 230, 255, .16);
    --surface: rgba(8, 26, 54, .82);
    --surface-strong: #0b1d3d;
    --surface-border: rgba(124, 208, 255, .18);
    --header-bg: rgba(8, 24, 49, .78);
    --card-bg: rgba(12, 35, 70, .78);
    --soft-bg: rgba(111, 166, 255, .14);
    --table-bg: rgba(10, 30, 60, .72);
    --table-head: rgba(85, 225, 255, .16);
    --input-bg: rgba(7, 21, 44, .86);
    --danger: #ff7a96;
    --success: #57d9af;
    --warning: #ffc266;
    --shadow: 0 24px 70px rgba(0, 10, 28, .38);
    --primary-gradient: linear-gradient(135deg, #0d2f62, #2f83ff);
    --brand-gradient: linear-gradient(135deg, #092147, #2f83ff 58%, #55e1ff);
    --hero-gradient: linear-gradient(145deg, rgba(4, 16, 35, .98), rgba(18, 64, 124, .86));
    --footer-gradient: linear-gradient(135deg, #061125, #0b2f62);
    --placeholder-gradient:
        linear-gradient(135deg, rgba(4, 16, 35, .86), rgba(47, 131, 255, .54)),
        linear-gradient(45deg, #061125, #1d7ea9);
    --body-bg:
        radial-gradient(circle at 14% 12%, rgba(85, 225, 255, .14), transparent 26rem),
        radial-gradient(circle at 82% 8%, rgba(111, 166, 255, .14), transparent 30rem),
        linear-gradient(180deg, #061125 0%, #091b36 48%, #071326 100%);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Tajawal, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--body-bg);
    min-height: 100vh;
    overflow-x: hidden;
}

html {
    min-height: 100%;
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

img,
video {
    max-width: 100%;
}

button,
input,
textarea,
select {
    font: inherit;
}

.page-shell {
    width: min(1280px, calc(100% - 56px));
    min-height: 100vh;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

.site-header {
    position: sticky;
    top: 14px;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin: 14px 0 18px;
    padding: 10px 12px;
    background: var(--header-bg);
    border: 1px solid var(--surface-border);
    border-radius: 22px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

@media (min-width: 721px) {
    .page-shell {
        padding-top: 92px;
    }

    .site-header {
        position: fixed;
        top: 14px;
        left: 50%;
        width: min(1280px, calc(100% - 56px));
        margin: 0;
        transform: translateX(-50%);
    }
}

.brand,
.mobile-brand,
.header-actions,
.main-nav,
.dashboard-nav,
.row-actions,
.filter-tabs,
.quick-stats {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-actions {
    flex: 0 0 auto;
    flex-wrap: nowrap;
}

.mobile-topbar {
    display: none;
}

.mobile-bottom-tabs {
    display: none;
}

.brand,
.mobile-brand {
    flex: 0 0 auto;
    min-width: max-content;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 15px;
    color: #fff;
    font-weight: 900;
    font-size: 1.25rem;
    background: var(--brand-gradient);
    box-shadow: 0 0 0 6px rgba(53, 216, 255, .12), 0 16px 32px rgba(37, 121, 255, .25);
}

.brand-mark img {
    width: 76%;
    height: 76%;
    display: block;
    object-fit: contain;
}

.main-nav a,
.dashboard-nav a,
.btn {
    white-space: nowrap;
}

.main-nav a,
.dashboard-nav a {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.main-nav a span,
.dashboard-nav a span {
    white-space: nowrap;
}

.main-nav svg,
.dashboard-nav svg,
.btn svg {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.mobile-menu-toggle {
    display: none;
}

.brand strong,
.brand small,
.mobile-brand strong,
.mobile-brand small {
    display: block;
}

.brand small,
.mobile-brand small {
    color: var(--muted);
    margin-top: 2px;
}

.main-nav {
    flex: 1 1 auto;
    min-width: 0;
    flex-wrap: nowrap;
    justify-content: center;
    gap: 5px;
}

.main-nav a,
.dashboard-nav a,
.filter-tabs a {
    padding: 9px 12px;
    border-radius: 999px;
    color: var(--navy-2);
    font-weight: 700;
}

.main-nav a:hover,
.dashboard-nav a:hover,
.filter-tabs a:hover,
.filter-tabs .is-active {
    background: var(--soft-bg);
    color: var(--blue);
}

.main-nav a.is-active,
.dashboard-nav a.is-active,
.filter-tabs .is-active {
    color: #fff;
    background: var(--primary-gradient);
    box-shadow: 0 12px 26px rgba(37, 121, 255, .24);
}

.dashboard-nav a.is-active {
    background: rgba(53, 216, 255, .24);
    box-shadow: inset 0 0 0 1px rgba(140, 234, 255, .22), 0 10px 24px rgba(0, 0, 0, .16);
}

.dashboard-nav {
    flex-wrap: wrap;
    margin: 0 0 20px;
    padding: 10px;
    background: rgba(7, 27, 58, .96);
    color: #e8f8ff;
    border-radius: 20px;
    box-shadow: var(--shadow);
}

.dashboard-nav a {
    color: #e8f8ff;
}

.dashboard-nav a:hover {
    background: rgba(53, 216, 255, .18);
    color: #fff;
}

.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--navy);
    font-weight: 800;
    white-space: nowrap;
    padding: 6px 10px;
    border-radius: 14px;
    background: var(--soft-bg);
}

.user-chip-avatar {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    border-radius: 8px;
    color: #fff;
    font-size: .9rem;
    font-weight: 900;
    line-height: 1;
    object-fit: cover;
    background: var(--brand-gradient);
}

.mobile-user-chip {
    display: none;
}

.btn,
.icon-btn {
    border: 0;
    cursor: pointer;
    font-weight: 800;
    transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 10px 16px;
    border-radius: 14px;
}

.btn:hover,
.icon-btn:hover {
    transform: translateY(-1px);
}

@media (prefers-reduced-motion: no-preference) {
    .panel,
    .album-card,
    .student-card,
    .stat-card,
    .lesson-preview,
    .alert,
    .media-tile {
        animation: himma-rise .28s ease both;
    }

    .main-nav a,
    .dashboard-nav a,
    .filter-tabs a,
    .mobile-tab,
    .upload-mode-tabs button,
    .album-card,
    .student-card,
    .stat-card,
    .lesson-preview,
    .media-tile,
    .table-wrap tbody tr,
    .hero-feature-card,
    .hero-feature-icon,
    input,
    textarea,
    select {
        transition: transform .16s ease, box-shadow .16s ease, background .16s ease, border-color .16s ease, color .16s ease, opacity .16s ease;
    }

    .album-card:hover,
    .student-card:hover,
    .stat-card:hover,
    .lesson-preview:hover,
    .media-tile:hover {
        transform: translateY(-3px);
    }

    .hero-feature-card:hover {
        transform: translateY(-4px);
        box-shadow: 0 22px 48px rgba(37, 121, 255, .16);
    }

    .hero-feature-card:hover .hero-feature-icon {
        transform: rotate(-3deg) scale(1.04);
    }

    .table-wrap tbody tr:hover {
        background: rgba(53, 216, 255, .07);
    }

    .hero-copy > .eyebrow,
    .hero-identity-title,
    .hero-copy > p,
    .hero-feature-card,
    .hero-visual {
        animation: himma-rise .42s ease both;
    }

    .hero-identity-title { animation-delay: .04s; }
    .hero-copy > p { animation-delay: .08s; }
    .hero-feature-card:nth-child(1) { animation-delay: .12s; }
    .hero-feature-card:nth-child(2) { animation-delay: .18s; }
    .hero-feature-card:nth-child(3) { animation-delay: .24s; }
    .hero-visual { animation-delay: .16s; }
}

@keyframes himma-rise {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.btn-primary {
    color: #fff;
    background: var(--primary-gradient);
    box-shadow: 0 16px 34px rgba(37, 121, 255, .25);
}

.btn-cyan {
    color: var(--navy);
    background: linear-gradient(135deg, var(--cyan), var(--cyan-2));
}

html[data-theme="dark"] .btn-cyan {
    color: #061125;
}

.btn-ghost {
    color: var(--navy);
    background: var(--soft-bg);
}

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 42px;
    height: 42px;
    min-width: 42px;
    min-height: 42px;
    padding: 0;
    border: 0;
    border-radius: 14px;
    cursor: pointer;
    color: var(--navy);
    font-weight: 900;
    background: var(--soft-bg);
    transition: transform .18s ease, background .18s ease;
}

.theme-toggle:hover {
    transform: translateY(-1px);
}

.theme-toggle-icon {
    position: relative;
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
}

.theme-icon {
    position: absolute;
    inset: 0;
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: opacity .16s ease, transform .16s ease;
}

.theme-icon-sun {
    opacity: 0;
    transform: rotate(-20deg) scale(.82);
}

.theme-icon-moon {
    opacity: 1;
    transform: rotate(0) scale(1);
}

html[data-theme="dark"] .theme-icon-sun {
    opacity: 1;
    transform: rotate(0) scale(1);
}

html[data-theme="dark"] .theme-icon-moon {
    opacity: 0;
    transform: rotate(18deg) scale(.82);
}

.theme-toggle [data-theme-toggle-label] {
    display: none;
}

.logout-button {
    width: 42px;
    min-width: 42px;
    padding-inline: 0;
}

.logout-button svg {
    color: var(--danger);
}

.logout-label {
    display: none;
}

.btn-danger {
    color: #fff;
    background: var(--danger);
}

.hero {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, .84fr) minmax(420px, 1.16fr);
    gap: 24px;
    align-items: stretch;
    min-height: 560px;
    padding: 34px 0 22px;
}

.hero-copy {
    align-self: center;
    padding: 34px 0;
}

.eyebrow {
    display: inline-flex;
    padding: 8px 13px;
    border-radius: 999px;
    background: rgba(53, 216, 255, .18);
    color: var(--blue);
    font-weight: 900;
}

.hero h1,
.page-title h1 {
    margin: 18px 0 12px;
    color: var(--navy);
    font-size: clamp(1.95rem, 4vw, 3.8rem);
    line-height: 1.08;
    letter-spacing: 0;
}

.hero p,
.page-title p {
    color: var(--muted);
    font-size: 1.15rem;
    line-height: 1.9;
    max-width: 640px;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 24px;
}

.hero-feature-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 26px;
}

.hero-feature-card {
    position: relative;
    overflow: hidden;
    display: grid;
    gap: 7px;
    padding: 14px;
    border: 1px solid var(--surface-border);
    border-radius: 20px;
    background: linear-gradient(145deg, rgba(255, 255, 255, .72), rgba(53, 216, 255, .12));
    box-shadow: 0 18px 40px rgba(12, 47, 95, .1);
    backdrop-filter: blur(14px);
}

html[data-theme="dark"] .hero-feature-card {
    background: linear-gradient(145deg, rgba(12, 35, 70, .76), rgba(85, 225, 255, .1));
}

.hero-feature-card::after {
    content: "";
    position: absolute;
    inset: auto -22px -26px auto;
    width: 74px;
    height: 74px;
    border-radius: 999px;
    background: rgba(37, 121, 255, .12);
}

.hero-feature-icon {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 15px;
    color: #fff;
    background: var(--primary-gradient);
    box-shadow: 0 14px 28px rgba(37, 121, 255, .2);
}

.hero-feature-icon svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.hero-feature-card strong,
.hero-feature-card small {
    position: relative;
    z-index: 1;
}

.hero-feature-card strong {
    color: var(--navy);
}

.hero-feature-card small {
    color: var(--muted);
    line-height: 1.6;
}

.mobile-hero-links {
    display: none;
}

.hero-visual {
    position: relative;
    overflow: hidden;
    min-height: 480px;
    border-radius: 30px;
    background: var(--hero-gradient);
    box-shadow: 0 34px 80px rgba(7, 27, 58, .24);
}

.hero-slider-frame {
    position: absolute;
    inset: 0;
    overflow: hidden;
    border-radius: inherit;
}

.slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity .7s ease;
}

.slide.is-active {
    opacity: 1;
}

.slide img,
.slide-placeholder {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.slide-placeholder,
.media-placeholder,
.cover-placeholder,
.avatar-fallback {
    display: grid;
    place-items: center;
    color: #fff;
    background: var(--placeholder-gradient);
}

.hero-glass {
    position: absolute;
    inset-inline: 20px;
    bottom: 20px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.hero-stat {
    padding: 10px 12px;
    color: #fff;
    background: rgba(255, 255, 255, .14);
    border: 1px solid rgba(255, 255, 255, .26);
    border-radius: 16px;
    backdrop-filter: blur(12px);
}

.hero-stat strong {
    display: block;
    font-size: 1.25rem;
}

.section {
    margin: 54px 0;
}

.section-head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.section-head h2,
.panel h2,
.panel h3 {
    margin: 0;
    color: var(--navy);
}

.section-head p {
    margin: 6px 0 0;
    color: var(--muted);
}

.title-with-filter {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.lesson-series-filter {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border-radius: 16px;
    background: var(--surface);
    border: 1px solid var(--surface-border);
}

.lesson-series-filter label {
    white-space: nowrap;
}

.lesson-series-filter select {
    min-width: 170px;
}

.grid {
    display: grid;
    gap: 22px;
}

.grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.quran-student-grid {
    grid-template-columns: minmax(300px, .78fr) minmax(680px, 1.22fr);
    align-items: start;
}

.grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.panel,
.album-card,
.student-card,
.stat-card,
.lesson-preview {
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: 22px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
}

.panel {
    padding: 22px;
}

.album-card {
    overflow: hidden;
}

.album-cover,
.media-tile {
    position: relative;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: var(--soft-bg);
}

.media-open {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    cursor: pointer;
    background: transparent;
    color: inherit;
}

.album-cover img,
.media-tile img,
.media-tile video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-cover {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    gap: 10px;
    color: #fff;
    background: var(--placeholder-gradient);
}

.play-mark {
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    padding-inline-start: 4px;
    border-radius: 999px;
    color: #fff;
    font-size: 1.25rem;
    font-weight: 900;
    background: rgba(7, 27, 58, .78);
    box-shadow: 0 0 0 8px rgba(53, 216, 255, .16), 0 18px 40px rgba(7, 27, 58, .28);
}

.media-open > .play-mark {
    position: absolute;
    inset: 50% auto auto 50%;
    transform: translate(-50%, -50%);
}

.gallery-locked-panel {
    display: grid;
    place-items: center;
    max-width: 720px;
    margin-inline: auto;
    text-align: center;
}

.gallery-locked-icon {
    display: grid;
    place-items: center;
    width: 76px;
    height: 76px;
    margin-bottom: 12px;
    border-radius: 24px;
    color: #fff;
    background: var(--primary-gradient);
    box-shadow: 0 20px 42px rgba(37, 121, 255, .24);
}

.gallery-locked-icon svg {
    width: 34px;
    height: 34px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.gallery-locked-panel h2 {
    margin: 0;
    color: var(--navy);
}

.gallery-locked-panel p {
    max-width: 520px;
    margin: 8px 0 18px;
    color: var(--muted);
    line-height: 1.8;
}

.album-body,
.student-card,
.stat-card,
.lesson-preview {
    padding: 18px;
}

.meta {
    color: var(--muted);
    font-size: .94rem;
}

.student-card {
    display: flex;
    align-items: center;
    gap: 14px;
}

.student-table-person {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 900;
}

.student-mini-avatar {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border-radius: 10px;
    object-fit: cover;
    color: #fff;
    font-size: .9rem;
    font-weight: 900;
    background: var(--brand-gradient);
}

.stars-block {
    margin-bottom: 28px;
}

.weekly-stars {
    direction: rtl;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: stretch;
    gap: 18px;
}

.star-card {
    direction: rtl;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 18px;
    border-radius: 22px;
    background: var(--surface);
    border: 1px solid var(--surface-border);
    box-shadow: var(--shadow);
}

.star-rank-1 {
    grid-column: auto;
    transform: none;
}

.star-rank-2 {
    grid-column: auto;
}

.star-rank-3 {
    grid-column: auto;
    opacity: 1;
}

.rank-badge {
    display: inline-flex;
    margin-bottom: 12px;
    padding: 7px 12px;
    border-radius: 999px;
    color: #fff;
    font-weight: 900;
    background: var(--primary-gradient);
}

.star-avatar {
    width: 136px;
    height: 136px;
    margin: 0 auto 14px;
    border-radius: 32px;
    overflow: hidden;
    background: var(--soft-bg);
    box-shadow: 0 18px 38px rgba(37, 121, 255, .18);
}

.star-rank-1 .star-avatar {
    width: 136px;
    height: 136px;
    border-radius: 32px;
}

.star-rank-3 .star-avatar {
    width: 136px;
    height: 136px;
}

.star-avatar img,
.star-avatar .avatar-fallback {
    width: 100%;
    height: 100%;
    border-radius: inherit;
    object-fit: cover;
    font-size: 2rem;
}

.star-card h3 {
    margin: 0 0 6px;
    color: var(--navy);
}

.latest-lesson-row {
    max-width: none;
    margin: 0;
}

.home-lessons-section {
    margin-top: 34px;
}

.home-section-title {
    position: relative;
    display: grid;
    place-items: center;
    gap: 8px;
    margin-bottom: 18px;
    text-align: center;
}

.home-section-title h2 {
    margin: 0;
    color: var(--navy);
}

.home-section-title p {
    max-width: 620px;
    margin: 0;
    color: var(--muted);
    line-height: 1.8;
}

.home-section-title .btn {
    margin-top: 4px;
}

.identity-inline-label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.hero-identity-title {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    width: fit-content;
    margin-top: 14px;
}

.identity-mask-logo,
.identity-logo {
    display: inline-block;
    width: calc(1em * var(--logo-ratio, 1));
    height: 1em;
    flex: 0 0 auto;
}

.identity-mask-logo {
    background: currentColor;
    -webkit-mask: var(--logo-url) center / contain no-repeat;
    mask: var(--logo-url) center / contain no-repeat;
}

.identity-logo {
    object-fit: contain;
}

.identity-mask-logo-sm,
.identity-logo-sm {
    width: calc(.95em * var(--logo-ratio, 1));
    height: .95em;
}

.loop-logo-frame {
    display: inline-grid;
    place-items: center;
    width: max(1.2em, calc((.86em * var(--logo-ratio, 1)) + .32em));
    height: 1.2em;
    flex: 0 0 auto;
    border: .08em solid currentColor;
    border-radius: .18em;
}

.loop-logo-frame .identity-mask-logo,
.loop-logo-frame .identity-logo {
    width: calc(.86em * var(--logo-ratio, 1));
    max-width: calc(100% - .24em);
    height: .86em;
}

.home-section-title--with-action {
    padding-inline: 150px;
}

.home-section-title--with-action .btn {
    position: absolute;
    left: 0;
    top: 50%;
    margin-top: 0;
    transform: translateY(-50%);
}

.latest-lessons-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.home-lesson-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.home-lesson-card h3 {
    margin: 0;
    color: var(--navy);
    font-size: 1.2rem;
}

.home-lesson-card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.8;
}

.lesson-read-more {
    align-self: flex-start;
    margin-top: 12px;
}

.home-lesson-card .lesson-read-more {
    margin-top: auto;
}

.lesson-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

.lesson-meta-row span {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 6px 10px;
    border-radius: 999px;
    color: var(--blue);
    font-size: .9rem;
    font-weight: 900;
    background: rgba(53, 216, 255, .14);
}

.avatar,
.avatar-fallback {
    width: 58px;
    height: 58px;
    flex: 0 0 auto;
    border-radius: 18px;
    object-fit: cover;
}

.avatar-lg {
    width: 104px;
    height: 104px;
    border-radius: 28px;
}

.stat-card strong {
    display: block;
    color: var(--navy);
    font-size: 2rem;
    line-height: 1.1;
}

.stat-card strong small {
    font-size: 1rem;
}

.progress-panel {
    margin-top: 18px;
}

.quran-progress {
    overflow: hidden;
    height: 18px;
    border-radius: 999px;
    background: var(--soft-bg);
    box-shadow: inset 0 1px 4px rgba(7, 27, 58, .12);
}

.quran-progress span {
    display: block;
    height: 100%;
    min-width: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--blue), var(--cyan));
    box-shadow: 0 0 24px rgba(53, 216, 255, .32);
}

.finance-balance-card {
    display: grid;
    place-items: center;
    align-content: center;
    text-align: center;
    min-height: 100%;
}

.finance-action-panel,
.finance-action-panel form {
    display: flex;
    flex-direction: column;
}

.finance-action-panel form {
    flex: 1;
}

.finance-action-panel .field.full {
    margin-top: auto;
}

.finance-action-panel .btn {
    width: 100%;
}

.finance-summary-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px;
}

.finance-summary-total {
    grid-column: 1 / -1;
}

.course-context-banner {
    padding: 18px 24px;
    border-radius: 24px;
    background: rgba(5, 28, 63, .08);
    border: 1px solid rgba(53, 216, 255, .18);
    margin-top: 24px;
    margin-bottom: 24px;
}

.course-context-banner.warning {
    background: rgba(199, 123, 22, .08);
    border-color: rgba(199, 123, 22, .25);
}

.course-context-panel {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
}

.course-context-panel div {
    min-width: 220px;
}

.course-context-panel strong {
    display: block;
    font-size: 1.2rem;
    margin-top: 6px;
}

.course-context-meta {
    display: grid;
    gap: 8px;
    text-align: right;
}

.quran-exam-layout {
    align-items: stretch;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.quran-exam-title {
    padding-bottom: 8px;
}

.quran-exam-panel {
    position: relative;
    overflow: hidden;
}

.quran-exam-panel::after {
    content: "";
    position: absolute;
    inset: auto -34px -36px auto;
    width: 110px;
    height: 110px;
    border-radius: 999px;
    background: rgba(53, 216, 255, .09);
    pointer-events: none;
}

.quran-exam-panel-head {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.quran-exam-panel-head p {
    margin: 6px 0 0;
    color: var(--muted);
}

.quran-exam-live-badge {
    min-width: 92px;
    align-self: start;
}

.quran-exam-form {
    position: relative;
    z-index: 1;
}

.quran-exam-type-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.quran-exam-type-option,
.quran-exam-filter-button {
    border: 1px solid var(--line);
    background: var(--card-bg);
    color: var(--ink);
}

.quran-exam-type-option {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 82px;
    padding: 14px;
    text-align: start;
    border-radius: 18px;
    cursor: pointer;
    box-shadow: 0 14px 34px rgba(12, 47, 95, .07);
}

.quran-exam-type-option.is-active {
    color: #fff;
    border-color: transparent;
    background: var(--primary-gradient);
    box-shadow: 0 18px 36px rgba(37, 121, 255, .22);
}

.quran-exam-type-icon,
.quran-exam-field-icon,
.quran-exam-rule-icon {
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
}

.quran-exam-type-icon,
.quran-exam-rule-icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: rgba(37, 121, 255, .12);
    color: var(--blue);
}

.quran-exam-type-option.is-active .quran-exam-type-icon {
    color: #fff;
    background: rgba(255, 255, 255, .18);
}

.quran-exam-type-icon svg,
.quran-exam-field-icon svg,
.quran-exam-rule-icon svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.quran-exam-type-copy {
    display: grid;
    gap: 4px;
}

.quran-exam-type-copy strong,
.quran-exam-type-copy small {
    display: block;
}

.quran-exam-type-copy small,
.quran-exam-live-summary p,
.quran-exam-rule-card p,
.quran-exam-filter-summary .meta {
    color: var(--muted);
}

.quran-exam-type-option.is-active .quran-exam-type-copy small {
    color: rgba(255, 255, 255, .82);
}

.quran-exam-live-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(37, 121, 255, .12), rgba(53, 216, 255, .08));
}

.quran-exam-live-summary strong,
.quran-exam-rule-card strong {
    color: var(--navy);
}

.quran-exam-live-summary p {
    max-width: 420px;
    margin: 0;
    line-height: 1.8;
}

.quran-exam-conditional.is-hidden {
    display: none;
}

.quran-exam-field-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 16px;
    background: var(--soft-bg);
}

.quran-exam-field-card > :last-child {
    flex: 1;
}

.quran-exam-field-icon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    color: var(--blue);
    background: rgba(37, 121, 255, .12);
}

.quran-exam-help {
    gap: 12px;
}

.quran-exam-filter {
    min-width: min(280px, 100%);
}

.quran-exam-rule-grid {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 14px;
}

.quran-exam-rule-card {
    display: grid;
    gap: 8px;
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--card-bg);
    box-shadow: 0 14px 34px rgba(12, 47, 95, .07);
}

.quran-exam-rule-card b {
    color: var(--success);
}

.quran-exam-archive-head {
    align-items: center;
}

.quran-exam-archive {
    grid-column: 1 / -1;
}

.quran-exam-filter-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.quran-exam-filter-button {
    min-height: 42px;
    padding: 9px 14px;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 800;
    transition: transform .18s ease, background .18s ease, color .18s ease, box-shadow .18s ease;
}

.quran-exam-filter-button.is-active {
    color: #fff;
    border-color: transparent;
    background: var(--primary-gradient);
    box-shadow: 0 16px 32px rgba(37, 121, 255, .2);
}

.quran-exam-filter-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.rank-fraction {
    display: flex !important;
    flex-direction: row;
    align-items: baseline;
    justify-content: flex-start;
    gap: 8px;
    width: 100%;
    margin-bottom: 6px;
    direction: rtl;
    text-align: right;
    white-space: nowrap;
}

.rank-number {
    display: block;
    width: 100%;
    margin-bottom: 6px;
    text-align: right;
}

.rank-metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.rank-metric-card {
    box-shadow: none;
}

.student-sort-filter {
    margin-top: 12px;
}

.student-search-filter {
    flex-wrap: wrap;
}

.student-search-filter input {
    min-width: 230px;
}

.table-students-summary tr[data-student-row][hidden],
.table-students-summary tr[data-student-empty-row][hidden],
.table-students-summary tr.is-filtered-out {
    display: none !important;
}

.student-table-actions {
    display: flex;
    justify-content: center;
    margin-top: 18px;
}

.setting-checkbox-card {
    min-height: 48px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--soft-bg);
}

.lesson-preview {
    min-height: 100%;
}

.page-title {
    padding: 38px 0 12px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.field {
    display: grid;
    gap: 7px;
}

.field.full {
    grid-column: 1 / -1;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 16px;
}

.is-hidden {
    display: none !important;
}

.upload-mode-tabs {
    display: inline-flex;
    gap: 8px;
    padding: 6px;
    margin: 14px 0 18px;
    border-radius: 16px;
    background: var(--soft-bg);
}

.upload-mode-tabs button {
    border: 0;
    cursor: pointer;
    padding: 10px 14px;
    border-radius: 12px;
    color: var(--navy);
    font-weight: 900;
    background: transparent;
}

.upload-mode-tabs button.is-active {
    color: #fff;
    background: var(--primary-gradient);
    box-shadow: 0 12px 26px rgba(37, 121, 255, .22);
}

label {
    color: var(--navy);
    font-weight: 800;
}

label.is-required::after {
    content: "*";
    color: var(--danger);
    font-size: .85em;
    margin-inline-start: 4px;
}

input,
textarea,
select,
.rich-editor {
    width: 100%;
    border: 1px solid var(--line);
    outline: none;
    border-radius: 15px;
    background: var(--input-bg);
    color: var(--ink);
    padding: 12px 14px;
}

select {
    appearance: none;
    padding-inline-start: 42px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2310233f' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: 16px 16px;
    background-position: left 16px center;
}

html[data-theme="dark"] select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23e9f6ff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

textarea,
.rich-editor {
    min-height: 150px;
    resize: vertical;
    line-height: 1.8;
}

input:focus,
textarea:focus,
select:focus,
.rich-editor:focus {
    border-color: rgba(53, 216, 255, .88);
    box-shadow: 0 0 0 4px rgba(53, 216, 255, .15);
}

.rich-toolbar {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.icon-btn {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    color: var(--navy);
    background: var(--soft-bg);
}

.table-wrap {
    overflow-x: auto;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: var(--table-bg);
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
    background: var(--table-bg);
}

table.compact-table {
    min-width: 0;
}

.table-quran-students,
.table-lessons,
.table-quran-pages,
.table-student-quran,
.table-quran-exams,
.table-student-exams,
.table-student-points,
.table-student-donations,
.table-points-standings,
.table-auth-logs,
.table-activity-logs {
    min-width: 0;
}

.table-quran-pages {
    table-layout: fixed;
}

.table-quran-pages th:first-child,
.table-quran-pages td:first-child {
    width: 50%;
    min-width: 300px;
    white-space: nowrap;
}

.table-quran-pages th:nth-child(2),
.table-quran-pages td:nth-child(2) {
    width: 18%;
}

.table-quran-pages th:nth-child(3),
.table-quran-pages td:nth-child(3) {
    width: 22%;
    white-space: nowrap;
}

.table-quran-pages th:nth-child(4),
.table-quran-pages td:nth-child(4) {
    width: 10%;
}

.table-student-quran th:first-child,
.table-student-quran td:first-child {
    width: 46%;
    white-space: nowrap;
}

.compact-table th {
    width: 42%;
}

th,
td {
    padding: 14px;
    text-align: right;
    border-bottom: 1px solid var(--line);
}

th {
    color: var(--navy);
    background: var(--table-head);
    font-weight: 900;
}

tr:last-child td {
    border-bottom: 0;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 5px 10px;
    border-radius: 999px;
    font-weight: 800;
    background: rgba(37, 121, 255, .12);
    color: var(--blue);
}

.badge.success {
    color: var(--success);
    background: rgba(15, 148, 109, .12);
}

.badge.danger {
    color: var(--danger);
    background: rgba(217, 71, 99, .12);
}

.badge.warning {
    color: var(--warning);
    background: rgba(199, 123, 22, .13);
}

.logs-title {
    padding-bottom: 4px;
}

.logs-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin: 12px 0 22px;
}

.logs-stats .stat-card {
    position: relative;
    overflow: hidden;
    display: grid;
    gap: 10px;
    min-height: 138px;
}

.logs-stats .stat-card::after {
    content: "";
    position: absolute;
    inset: auto -28px -36px auto;
    width: 96px;
    height: 96px;
    border-radius: 999px;
    background: rgba(53, 216, 255, .13);
}

.stat-icon,
.log-mark svg {
    display: inline-grid;
    place-items: center;
}

.stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    color: var(--blue);
    background: rgba(37, 121, 255, .12);
}

.stat-icon svg,
.log-mark svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.stat-icon.success,
.log-mark.success {
    color: var(--success);
    background: rgba(15, 148, 109, .12);
}

.stat-icon.danger,
.log-mark.danger {
    color: var(--danger);
    background: rgba(217, 71, 99, .12);
}

.stat-icon.warning,
.log-mark.warning {
    color: var(--warning);
    background: rgba(199, 123, 22, .13);
}

.logs-panel + .logs-panel {
    margin-top: 22px;
}

.panel-heading,
.logs-filter-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.logs-filter {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: min(320px, 100%);
    padding: 8px;
    border-radius: 16px;
    background: var(--soft-bg);
}

.logs-filter label {
    white-space: nowrap;
}

.log-mark {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    padding: 6px 10px;
    border-radius: 999px;
    color: var(--blue);
    font-weight: 900;
    background: rgba(37, 121, 255, .12);
}

.table-auth-logs td strong,
.table-auth-logs td small,
.table-activity-logs td strong,
.table-activity-logs td small {
    display: block;
}

.table-auth-logs td small,
.table-activity-logs td small {
    margin-top: 2px;
    color: var(--muted);
    font-weight: 700;
}

.device-details {
    line-height: 1.5;
}

code {
    direction: ltr;
    display: inline-block;
    padding: 4px 7px;
    border-radius: 8px;
    color: var(--navy);
    background: var(--soft-bg);
}

.plain-name {
    display: inline;
    color: var(--ink);
    font-weight: 700;
}

.plain-name + .plain-name::before {
    content: "، ";
    color: var(--muted);
}

.alert {
    margin: 16px 0;
    padding: 14px 16px;
    border-radius: 16px;
    font-weight: 800;
}

.alert-success {
    color: var(--success);
    background: rgba(15, 148, 109, .12);
}

.alert-danger {
    color: var(--danger);
    background: rgba(217, 71, 99, .12);
}

.auth-wrap {
    display: grid;
    place-items: center;
    min-height: calc(100vh - 150px);
}

.auth-card {
    width: min(460px, 100%);
}

.drop-zone {
    display: grid;
    place-items: center;
    min-height: 170px;
    padding: 22px;
    border: 2px dashed rgba(37, 121, 255, .34);
    border-radius: 22px;
    background: var(--soft-bg);
    text-align: center;
    cursor: pointer;
}

.drop-zone.is-dragging {
    border-color: var(--cyan);
    background: rgba(53, 216, 255, .18);
}

.drop-zone input {
    display: none;
}

.attendance-options {
    direction: rtl;
    display: grid;
    grid-template-columns: repeat(3, minmax(88px, 1fr));
    gap: 8px;
}

.attendance-options label {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    flex-direction: row-reverse;
    gap: 6px;
    min-width: 0;
    padding: 8px 10px;
    border-radius: 999px;
    background: var(--soft-bg);
    overflow-wrap: normal;
    white-space: nowrap;
}

.attendance-options input {
    width: auto;
    flex: 0 0 auto;
    margin: 0;
}

.attendance-options input[value="present"] {
    accent-color: var(--success);
}

.attendance-options input[value="late"] {
    accent-color: var(--warning);
}

.attendance-options input[value="absent"] {
    accent-color: var(--danger);
}

.attendance-save-actions {
    margin-top: 16px;
}

.archive-day {
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--card-bg);
}

.archive-day + .archive-day {
    margin-top: 12px;
}

.archive-day-head,
.archive-chips,
.quran-page-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.archive-chips {
    justify-content: flex-start;
    margin-top: 12px;
}

.quran-pages-grid {
    display: grid;
    gap: 10px;
}

.assignment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.assignment-card {
    display: grid;
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--card-bg);
}

.assignment-card strong {
    color: var(--navy);
}

.quran-page-card {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--card-bg);
}

.student-ledger-wrap {
    overflow-x: visible;
}

.table-student-points th,
.table-student-points td,
.table-student-donations th,
.table-student-donations td {
    padding: 9px 12px;
}

.table-student-points .badge {
    min-height: 24px;
    padding: 3px 9px;
}

.quran-page-card strong,
.quran-page-card span {
    display: block;
}

.series-list {
    display: grid;
    gap: 10px;
    margin-top: 18px;
}

.series-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 10px;
    align-items: center;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--card-bg);
}

.checkbox-field {
    display: inline-flex;
    grid-template-columns: none;
    align-items: center;
    justify-content: flex-start;
    flex-direction: row;
    gap: 8px;
}

.checkbox-field input {
    width: auto;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.profile-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.profile-id {
    display: flex;
    align-items: center;
    gap: 16px;
}

.media-actions {
    position: absolute;
    inset-inline: 10px;
    bottom: 10px;
    z-index: 2;
}

.media-lightbox[hidden],
.lesson-modal[hidden] {
    display: none;
}

.media-lightbox,
.lesson-modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: 28px;
    background: rgba(4, 18, 39, .86);
    backdrop-filter: blur(12px);
}

.media-lightbox {
    grid-template-rows: minmax(0, 1fr) auto;
    align-items: center;
    gap: 18px;
}

.lesson-modal-card {
    position: relative;
    width: min(760px, calc(100vw - 38px));
    max-height: min(78vh, 680px);
    overflow: auto;
    padding: 28px;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: 24px;
    box-shadow: 0 28px 90px rgba(0, 0, 0, .34);
}

.lesson-modal-card .lesson-meta-row {
    padding-inline-end: 96px;
    margin-bottom: 18px;
}

.lesson-modal-card h2 {
    margin: 0 0 14px;
    color: var(--navy);
}

.lesson-modal-card p {
    margin: 0;
    color: var(--ink);
    line-height: 2;
    white-space: pre-line;
}

.lesson-modal-close {
    color: var(--navy);
    background: var(--soft-bg);
}

body.lightbox-open {
    overflow: hidden;
}

.lightbox-stage {
    display: grid;
    place-items: center;
    width: min(1040px, calc(100vw - 110px));
    height: min(76vh, 720px);
    min-height: 220px;
    margin: auto;
}

.lightbox-stage img,
.lightbox-stage video,
.lightbox-stage iframe {
    max-width: 100%;
    max-height: 100%;
    border: 0;
    border-radius: 22px;
    background: #000;
    box-shadow: 0 28px 90px rgba(0, 0, 0, .38);
}

.lightbox-stage img {
    width: auto;
    height: auto;
    object-fit: contain;
}

.lightbox-stage video {
    width: min(100%, 980px);
}

.lightbox-stage iframe {
    width: min(100%, 980px);
    height: min(100%, 552px);
}

.lightbox-thumbs {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: min(720px, calc(100vw - 42px));
    max-width: 100%;
    padding: 8px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 22px;
    background: rgba(3, 13, 29, .72);
    box-shadow: 0 18px 50px rgba(0, 0, 0, .28);
}

.lightbox-thumbs[hidden] {
    display: none;
}

.lightbox-thumb {
    position: relative;
    display: grid;
    place-items: center;
    flex: 0 0 58px;
    width: 58px;
    height: 58px;
    padding: 0;
    overflow: hidden;
    border: 2px solid transparent;
    border-radius: 14px;
    cursor: pointer;
    color: #fff;
    background: rgba(255, 255, 255, .12);
    opacity: .74;
    transition: border-color .18s ease, opacity .18s ease, transform .18s ease;
}

.lightbox-thumb img,
.lightbox-thumb video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.lightbox-thumb span {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    font-size: 1.15rem;
    font-weight: 900;
    background: var(--placeholder-gradient);
}

.lightbox-thumb.is-active {
    border-color: var(--cyan);
    opacity: 1;
    transform: translateY(-2px);
}

.lightbox-close,
.lightbox-arrow {
    position: absolute;
    border: 0;
    cursor: pointer;
    color: #fff;
    background: rgba(255, 255, 255, .14);
    backdrop-filter: blur(10px);
}

.lightbox-close {
    top: 20px;
    inset-inline-end: 20px;
    min-height: 42px;
    padding: 9px 16px;
    border-radius: 999px;
    font-weight: 900;
}

.lightbox-arrow {
    top: 50%;
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    border-radius: 999px;
    font-size: 2.4rem;
    line-height: 1;
    transform: translateY(-50%);
}

.lightbox-next {
    inset-inline-end: 20px;
}

.lightbox-prev {
    inset-inline-start: 20px;
}

.lesson-modal-card .lesson-modal-close {
    color: var(--navy);
    background: var(--soft-bg);
}

.pagination {
    margin-top: 18px;
}

.pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 18px;
}

.pager-pages {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
}

.pager-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    min-height: 38px;
    padding: 8px 12px;
    border-radius: 999px;
    color: var(--navy);
    font-weight: 900;
    background: var(--soft-bg);
}

.pager-link.is-active {
    color: #fff;
    background: var(--primary-gradient);
    box-shadow: 0 12px 26px rgba(37, 121, 255, .22);
}

.pager-link.is-disabled {
    color: var(--muted);
    opacity: .52;
}

.site-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    margin: 48px 0 0;
    padding: 22px;
    color: #e8f8ff;
    background: var(--footer-gradient);
    border-radius: 22px 22px 0 0;
}

.site-footer span {
    color: rgba(232, 248, 255, .82);
}

@media (max-width: 900px) {
    .site-header,
    .hero,
    .section-head,
    .profile-head {
        display: block;
    }

    .main-nav,
    .header-actions {
        flex-wrap: wrap;
        justify-content: flex-start;
        margin-top: 12px;
    }

    .hero {
        min-height: auto;
    }

    .hero-visual {
        min-height: 360px;
    }

    .grid-2,
    .grid-3,
    .grid-4,
    .rank-metrics-grid,
    .form-grid {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 721px) and (max-width: 1040px) {
    .page-shell {
        width: min(100% - 36px, 1180px);
        padding-top: 154px;
    }

    .site-header {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas:
            "brand actions"
            "nav nav";
        align-items: center;
        row-gap: 10px;
        width: min(1180px, calc(100% - 36px));
        padding: 10px 12px 12px;
    }

    .site-header > .brand {
        grid-area: brand;
        min-width: 0;
    }

    .site-header > .brand > span:not(.brand-mark) {
        min-width: 0;
    }

    .site-header > .brand strong,
    .site-header > .brand small {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .main-nav {
        grid-area: nav;
        justify-content: center;
        flex-wrap: wrap;
        gap: 6px;
        width: 100%;
        margin-top: 0;
    }

    .main-nav a {
        padding: 8px 10px;
        font-size: .94rem;
    }

    .header-actions {
        grid-area: actions;
        justify-content: flex-end;
        flex-wrap: nowrap;
        gap: 7px;
        min-width: 0;
        margin-top: 0;
    }

    .header-actions .theme-toggle,
    .header-actions .logout-button {
        min-height: 38px;
        padding: 8px 10px;
    }

    .header-actions .user-chip {
        max-width: 176px;
        min-width: 0;
    }

    .header-actions .user-chip > span:last-child {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .header-actions .logout-label {
        display: none;
    }
}

@media (max-width: 560px) {
    .page-shell {
        width: min(100% - 30px, 1180px);
    }

    .hero h1,
    .page-title h1 {
        font-size: 1.9rem;
    }

    .attendance-options {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 6px;
    }

    .attendance-options label {
        padding-inline: 8px;
    }
}

@media (max-width: 720px) {
    .page-shell {
        width: min(100% - 32px, 1180px);
        padding-top: 82px;
        padding-bottom: calc(84px + env(safe-area-inset-bottom));
    }

    main > .section:last-of-type {
        margin-bottom: 22px;
    }

    .hero {
        display: flex;
        flex-direction: column;
        gap: 14px;
        padding-top: 8px;
        padding-bottom: 8px;
    }

    .hero-copy {
        padding: 0;
        display: contents;
    }

    .hero-copy > .hero-feature-grid {
        order: 4;
        margin-top: 0;
    }

    .hero p,
    .page-title p {
        font-size: 1rem;
    }

    .hero-feature-grid {
        grid-template-columns: 1fr;
        gap: 9px;
        margin-top: 18px;
    }

    .hero-feature-card {
        grid-template-columns: auto minmax(0, 1fr);
        align-items: center;
        column-gap: 12px;
        padding: 12px;
    }

    .hero-feature-card small {
        grid-column: 2;
    }

    .mobile-hero-links {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .mobile-hero-links a {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        min-height: 44px;
        padding: 9px 10px;
        border-radius: 14px;
        color: var(--navy);
        font-weight: 900;
        background: var(--surface);
        border: 1px solid var(--surface-border);
        box-shadow: 0 10px 24px rgba(12, 47, 95, .08);
    }

    .mobile-hero-links svg {
        width: 20px;
        height: 20px;
        fill: none;
        stroke: currentColor;
        stroke-width: 2;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

    .hero-visual {
        display: grid;
        gap: 10px;
        min-height: 0;
        overflow: visible;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
    }

    .hero-slider-frame {
        position: relative;
        inset: auto;
        aspect-ratio: 16 / 9;
        min-height: 0;
        border-radius: 22px;
        background: var(--hero-gradient);
        box-shadow: 0 22px 48px rgba(7, 27, 58, .2);
    }

    .hero-glass {
        position: static;
        inset: auto;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .hero-stat {
        color: var(--ink);
        background: var(--surface);
        border-color: var(--surface-border);
        box-shadow: 0 10px 24px rgba(12, 47, 95, .08);
    }

    .hero-stat strong {
        color: var(--navy);
    }

    .quran-exam-studio {
        order: 1;
    }

    .quran-exam-archive {
        order: 2;
    }

    .quran-exam-overview {
        order: 3;
    }

    .quran-exam-type-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .quran-exam-type-option {
        min-height: 68px;
        padding: 12px 14px;
    }

    .quran-exam-type-copy {
        min-width: 0;
    }

    .quran-exam-type-copy strong {
        line-height: 1.35;
        white-space: normal;
    }

    .quran-exam-type-copy small {
        white-space: nowrap;
    }

    .weekly-stars {
        grid-template-columns: 1fr;
        direction: rtl;
        gap: 16px;
    }

    .star-rank-1,
    .star-rank-2,
    .star-rank-3 {
        grid-column: auto;
        transform: none;
    }

    .star-rank-1 {
        order: 1;
    }

    .star-rank-2 {
        order: 2;
    }

    .star-rank-3 {
        order: 3;
    }

    .star-card {
        width: 100%;
        padding: 18px;
        border-radius: 20px;
    }

    .rank-badge {
        margin-bottom: 12px;
        padding: 7px 12px;
        font-size: .92rem;
    }

    .star-avatar,
    .star-rank-1 .star-avatar,
    .star-rank-3 .star-avatar {
        width: 112px;
        height: 112px;
        margin-bottom: 12px;
        border-radius: 28px;
    }

    .star-card h3 {
        font-size: 1.15rem;
    }

    .star-card .meta {
        font-size: .92rem;
    }

    .latest-lessons-grid {
        grid-template-columns: 1fr;
    }

    .home-lessons-section {
        margin-top: 26px;
    }

    .section {
        margin: 58px 0;
    }

    .home-section-title {
        padding-inline: 0;
    }

    .home-section-title--with-action .btn {
        position: static;
        transform: none;
    }

    .lesson-modal-card {
        width: calc(100vw - 32px);
        max-height: calc(100dvh - 132px);
        padding: 22px;
        margin: auto;
    }

    .lesson-modal-card .lesson-meta-row {
        padding-inline-end: 0;
        padding-top: 46px;
    }

    .table-wrap {
        overflow-x: visible;
        border: 0;
        border-radius: 0;
    }

    table.responsive-table {
        display: block;
        min-width: 0;
        background: transparent;
    }

    table.responsive-table thead {
        display: none;
    }

    table.responsive-table tbody,
    table.responsive-table tr {
        display: block;
        width: 100%;
    }

    table.responsive-table tr {
        margin-bottom: 12px;
        padding: 12px;
        border: 1px solid var(--line);
        border-radius: 18px;
        background: var(--card-bg);
        box-shadow: 0 12px 32px rgba(12, 47, 95, .08);
    }

    table.responsive-table td {
        display: grid;
        grid-template-columns: minmax(108px, .86fr) minmax(0, 1.14fr);
        align-items: center;
        column-gap: 12px;
        min-width: 0;
        padding: 9px 0;
        border-bottom: 1px solid var(--line);
        text-align: start;
        overflow-wrap: anywhere;
    }

    table.responsive-table td > * {
        min-width: 0;
        max-width: 100%;
        justify-self: start;
    }

    table.responsive-table td > :where(.row-actions, form, .btn, button) {
        justify-self: stretch;
    }

    .table-attendance-form td:nth-child(2) {
        grid-template-columns: 1fr;
        row-gap: 10px;
    }

    .table-attendance-form td:nth-child(2) > .attendance-options {
        width: 100%;
        justify-self: stretch;
    }

    .table-attendance-form .attendance-options {
        grid-template-columns: repeat(3, minmax(76px, 1fr));
    }

    .table-attendance-form .attendance-options label {
        justify-content: center;
        min-height: 46px;
        padding-inline: 9px;
    }

    table.responsive-table td:last-child {
        border-bottom: 0;
    }

    .table-quran-pages td:first-child {
        min-width: 0;
        width: 100%;
        white-space: normal;
    }

    .table-student-quran td:first-child {
        width: 100%;
        white-space: normal;
    }

    .table-quran-pages td:nth-child(3) {
        white-space: normal;
    }

    table.responsive-table td::before {
        display: block;
        margin: 0;
        color: var(--navy);
        font-weight: 900;
        line-height: 1.45;
        text-align: start;
    }

    .table-transactions td:nth-child(1)::before { content: "النوع"; }
    .table-transactions td:nth-child(2)::before { content: "المبلغ"; }
    .table-transactions td:nth-child(3)::before { content: "المصدر/السبب"; }
    .table-transactions td:nth-child(4)::before { content: "المشرف"; }
    .table-transactions td:nth-child(5)::before { content: "التاريخ"; }
    .table-transactions td:nth-child(6)::before { content: "إجراءات"; }

    .table-points td:nth-child(1)::before { content: "الطالب"; }
    .table-points td:nth-child(2)::before { content: "القيمة"; }
    .table-points td:nth-child(3)::before { content: "المشرف"; }
    .table-points td:nth-child(4)::before { content: "التاريخ"; }
    .table-points td:nth-child(5)::before { content: "إجراءات"; }

    .table-points-standings td:nth-child(1)::before { content: "الطالب"; }
    .table-points-standings td:nth-child(2)::before { content: "رصيد النقاط"; }

    .table-lessons td:nth-child(1)::before { content: "العنوان"; }
    .table-lessons td:nth-child(2)::before { content: "السلسلة"; }
    .table-lessons td:nth-child(3)::before { content: "التاريخ"; }
    .table-lessons td:nth-child(4)::before { content: "إجراءات"; }

    .table-quran-students td:nth-child(1)::before { content: "الطالب"; }
    .table-quran-students td:nth-child(2)::before { content: "إجمالي الحفظ"; }
    .table-quran-students td:nth-child(3)::before { content: "عرض"; }

    .table-quran-pages td:nth-child(1)::before { content: "رقم الصفحات"; }
    .table-quran-pages td:nth-child(2)::before { content: "تاريخ التسميع"; }
    .table-quran-pages td:nth-child(3)::before { content: "نقاط التسميع"; }
    .table-quran-pages td:nth-child(4)::before { content: "إجراءات"; }

    .table-student-quran td:nth-child(1)::before { content: "رقم الصفحات"; }
    .table-student-quran td:nth-child(2)::before { content: "تاريخ التسميع"; }
    .table-student-quran td:nth-child(3)::before { content: "نقاط التسميع"; }

    .table-quran-exams td:nth-child(1)::before { content: "الطالب"; }
    .table-quran-exams td:nth-child(2)::before { content: "نوع السبر"; }
    .table-quran-exams td:nth-child(3)::before { content: "الجزء"; }
    .table-quran-exams td:nth-child(4)::before { content: "الربع"; }
    .table-quran-exams td:nth-child(5)::before { content: "العلامة"; }
    .table-quran-exams td:nth-child(6)::before { content: "التاريخ"; }
    .table-quran-exams td:nth-child(7)::before { content: "النقاط"; }
    .table-quran-exams td:nth-child(8)::before { content: "المشرف"; }
    .table-quran-exams td:nth-child(9)::before { content: "إجراءات"; }

    .table-student-exams td:nth-child(1)::before { content: "نوع السبر"; }
    .table-student-exams td:nth-child(2)::before { content: "الجزء"; }
    .table-student-exams td:nth-child(3)::before { content: "الربع"; }
    .table-student-exams td:nth-child(4)::before { content: "العلامة"; }
    .table-student-exams td:nth-child(5)::before { content: "التاريخ"; }
    .table-student-exams td:nth-child(6)::before { content: "النقاط"; }
    .table-student-exams td:nth-child(7)::before { content: "المشرف"; }

    .table-attendance-form td:nth-child(1)::before { content: "الطالب"; }
    .table-attendance-form td:nth-child(2)::before { content: "الحالة"; }

    .table-attendance-archive td:nth-child(1)::before { content: "التاريخ"; }
    .table-attendance-archive td:nth-child(2)::before { content: "الحضور"; }
    .table-attendance-archive td:nth-child(3)::before { content: "التأخر"; }
    .table-attendance-archive td:nth-child(4)::before { content: "الغياب"; }
    .table-attendance-archive td:nth-child(5)::before { content: "تعديل"; }
    .table-attendance-archive td:nth-child(6)::before { content: "حذف"; }

    .table-students-summary td:nth-child(1)::before { content: ""; }
    .table-students-summary td:nth-child(2)::before { content: "الحفظ"; }
    .table-students-summary td:nth-child(3)::before { content: "الدوام"; }
    .table-students-summary td:nth-child(4)::before { content: "الحضور"; }
    .table-students-summary td:nth-child(5)::before { content: "التأخر"; }
    .table-students-summary td:nth-child(6)::before { content: "الغياب"; }
    .table-students-summary td:nth-child(7)::before { content: "التبرع"; }
    .table-students-summary td:nth-child(8)::before { content: "النقاط"; }
    .table-students-summary td:nth-child(9)::before { content: "تفاصيل"; }

    .table-students-summary td:first-child {
        grid-template-columns: 1fr;
        padding-top: 4px;
        padding-bottom: 12px;
    }

    .table-students-summary td:first-child::before {
        display: none;
    }

    .table-students-summary .student-table-person {
        justify-content: center;
        justify-self: center;
        text-align: center;
    }

    .table-student-points td:nth-child(1)::before { content: "التاريخ"; }
    .table-student-points td:nth-child(2)::before { content: "القيمة"; }

    .table-student-donations td:nth-child(1)::before { content: "التاريخ"; }
    .table-student-donations td:nth-child(2)::before { content: "المبلغ"; }

    .table-committee-assignments td:nth-child(1)::before { content: "اللجنة"; }
    .table-committee-assignments td:nth-child(2)::before { content: "رئيس اللجنة"; }
    .table-committee-assignments td:nth-child(3)::before { content: "نائب رئيس اللجنة"; }

    .table-created-admins td:nth-child(1)::before { content: "المشرف"; }
    .table-created-admins td:nth-child(2)::before { content: "اسم المستخدم"; }
    .table-created-admins td:nth-child(3)::before { content: "المنصب"; }
    .table-created-admins td:nth-child(4)::before { content: "الصلاحيات"; }
    .table-created-admins td:nth-child(5)::before { content: "إجراءات"; }

    .table-auth-logs td:nth-child(1)::before { content: "الحالة"; }
    .table-auth-logs td:nth-child(2)::before { content: "الحساب"; }
    .table-auth-logs td:nth-child(3)::before { content: "الجهاز والنظام"; }
    .table-auth-logs td:nth-child(4)::before { content: "المتصفح"; }
    .table-auth-logs td:nth-child(5)::before { content: "IP"; }
    .table-auth-logs td:nth-child(6)::before { content: "التاريخ والوقت"; }

    .table-activity-logs td:nth-child(1)::before { content: "النوع"; }
    .table-activity-logs td:nth-child(2)::before { content: "العملية"; }
    .table-activity-logs td:nth-child(3)::before { content: "الوصف"; }
    .table-activity-logs td:nth-child(4)::before { content: "المنفذ"; }
    .table-activity-logs td:nth-child(5)::before { content: "IP"; }
    .table-activity-logs td:nth-child(6)::before { content: "التاريخ والوقت"; }

    .row-actions {
        align-items: stretch;
        flex-direction: column;
        justify-self: stretch;
        min-width: 0;
    }

    .row-actions .btn,
    .row-actions form,
    .row-actions button {
        width: 100%;
        white-space: normal;
    }

    .title-with-filter,
    .lesson-series-filter {
        align-items: stretch;
        width: 100%;
    }

    .lesson-series-filter,
    .series-row {
        display: grid;
        grid-template-columns: 1fr;
    }

    .student-search-filter input {
        min-width: 0;
        width: 100%;
    }

    .lesson-series-filter {
        gap: 9px;
        justify-items: stretch;
    }

    .lesson-series-filter label {
        justify-self: start;
        margin-inline-start: 4px;
    }

    .lesson-series-filter select,
    .series-row .btn {
        width: 100%;
    }

    .site-footer {
        display: none;
    }

    .upload-mode-tabs {
        display: grid;
        width: 100%;
    }

    .logs-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .logs-filter {
        width: 100%;
        align-items: stretch;
        flex-direction: column;
    }

    .logs-filter label {
        align-self: flex-start;
        margin-inline-start: 4px;
    }

    .media-lightbox {
        grid-template-rows: minmax(0, 1fr) auto;
        align-items: center;
        justify-items: center;
        gap: 12px;
        padding: 64px 12px calc(14px + env(safe-area-inset-bottom));
    }

    .lesson-modal {
        align-items: center;
        justify-items: center;
        padding: 74px 14px calc(92px + env(safe-area-inset-bottom));
    }

    .lightbox-stage {
        width: calc(100vw - 34px);
        height: calc(100dvh - 176px - env(safe-area-inset-bottom));
        min-height: 260px;
    }

    .lightbox-stage img,
    .lightbox-stage video,
    .lightbox-stage iframe {
        border-radius: 18px;
    }

    .lightbox-stage iframe {
        height: auto;
        aspect-ratio: 16 / 9;
    }

    .lightbox-thumbs {
        justify-content: flex-start;
        width: calc(100vw - 24px);
        padding: 7px;
        border-radius: 18px;
        scroll-padding-inline: 8px;
    }

    .lightbox-thumb {
        flex-basis: 52px;
        width: 52px;
        height: 52px;
        border-radius: 12px;
    }

    .lightbox-arrow {
        width: 44px;
        height: 44px;
        font-size: 2rem;
    }

    .lightbox-next {
        inset-inline-end: 8px;
    }

    .lightbox-prev {
        inset-inline-start: 8px;
    }

    .lightbox-close {
        top: 10px;
        inset-inline-end: 10px;
    }
}

@media (max-width: 720px) {
    .mobile-topbar {
        position: fixed;
        top: 12px;
        inset-inline: 16px;
        z-index: 80;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        min-height: 58px;
        padding: 8px 10px;
        border: 1px solid var(--surface-border);
        border-radius: 20px;
        background: var(--header-bg);
        box-shadow: var(--shadow);
        backdrop-filter: blur(18px);
    }

    .mobile-bottom-tabs {
        position: fixed;
        right: 12px;
        left: 12px;
        bottom: calc(10px + env(safe-area-inset-bottom));
        z-index: 70;
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 4px;
        padding: 8px;
        border: 1px solid rgba(93, 214, 255, .18);
        border-radius: 22px;
        color: #bfeeff;
        background: rgba(7, 27, 58, .96);
        box-shadow: 0 20px 46px rgba(2, 13, 31, .28);
        backdrop-filter: blur(18px);
    }

    .mobile-tab {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex-direction: column;
        gap: 3px;
        min-width: 0;
        min-height: 54px;
        padding: 7px 3px 6px;
        border-radius: 16px;
        color: inherit;
        font-size: .68rem;
        line-height: 1.05;
        font-weight: 900;
        text-align: center;
        white-space: nowrap;
        transition: background .18s ease, color .18s ease, transform .18s ease;
    }

    .mobile-tab svg {
        width: 21px;
        height: 21px;
        flex: 0 0 21px;
        fill: none;
        stroke: currentColor;
        stroke-width: 2;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

    .mobile-tab span {
        display: block;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .mobile-tab.is-active {
        color: #fff;
        background: rgba(37, 121, 255, .34);
        box-shadow: inset 0 0 0 1px rgba(98, 219, 255, .2);
    }

    .mobile-tab:active {
        transform: translateY(1px);
    }

    .mobile-brand {
        display: inline-flex;
        align-items: center;
        gap: 10px;
    }

    .mobile-brand .brand-mark {
        width: 42px;
        height: 42px;
        border-radius: 14px;
    }

    .mobile-brand strong {
        color: var(--navy);
        line-height: 1.1;
    }

    .mobile-brand small {
        font-size: .86rem;
    }

    .mobile-menu-toggle {
        position: static;
        z-index: 1;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex-direction: column;
        gap: 4px;
        width: 48px;
        height: 48px;
        border: 0;
        border-radius: 16px;
        background: var(--primary-gradient);
        box-shadow: 0 14px 34px rgba(7, 27, 58, .2);
        opacity: 1;
        pointer-events: auto;
        transform: translateY(0);
        transition: opacity .2s ease, transform .2s ease;
    }

    .mobile-menu-toggle span {
        display: block;
        width: 24px;
        height: 2px;
        border-radius: 999px;
        background: #fff;
        transform-origin: center;
    }

    .site-header {
        position: fixed;
        top: 82px;
        inset-inline: 16px;
        z-index: 79;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-areas:
            "user user"
            "nav nav"
            "theme logout";
        align-items: stretch;
        gap: 8px;
        direction: ltr;
        overflow: hidden;
        transition:
            max-height .32s ease,
            padding .32s ease,
            border-color .32s ease,
            opacity .2s ease,
            transform .32s ease;
    }

    .site-header {
        max-height: 0;
        margin: 0;
        padding-top: 0;
        padding-bottom: 0;
        border-color: transparent;
        opacity: 0;
        pointer-events: none;
        transform: translateY(-16px);
    }

    .site-header > .brand {
        display: none;
    }

    .site-header > *,
    .header-actions > * {
        direction: rtl;
    }

    .site-header .mobile-user-chip {
        grid-area: user;
        display: inline-flex;
        width: 100%;
        min-height: 54px;
        justify-content: flex-start;
        padding: 9px 12px;
        border-radius: 16px;
        font-size: 1.05rem;
    }

    .site-header .mobile-user-chip .user-chip-avatar {
        width: 38px;
        height: 38px;
        flex-basis: 38px;
        border-radius: 10px;
    }

    .main-nav {
        grid-area: nav;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        width: 100%;
        margin-top: 0;
    }

    .header-actions {
        display: contents;
        margin-top: 0;
        margin-bottom: 0;
    }

    .header-actions .user-chip {
        display: none;
    }

    .header-actions .theme-toggle {
        grid-area: theme;
        align-self: start;
        justify-self: stretch;
        width: 100%;
        height: 46px;
        min-width: 0;
        min-height: 46px;
    }

    .site-header.is-guest .header-actions .theme-toggle {
        grid-area: auto;
        grid-column: 1 / -1;
        justify-self: stretch;
        width: 100%;
    }

    .header-actions .logout-form {
        grid-area: logout;
        align-self: stretch;
        justify-self: stretch;
    }

    .header-actions .logout-button {
        width: 100%;
        height: 46px;
        min-width: 0;
        min-height: 46px;
        padding: 0;
        border-radius: 16px;
    }

    .header-actions .login-button {
        grid-column: 1 / -1;
        grid-row: 1;
        width: 100%;
        min-height: 54px;
        justify-self: stretch;
        border-radius: 16px;
    }

    .main-nav a {
        justify-content: flex-start;
        min-width: 0;
        min-height: 46px;
        padding: 10px 11px;
        text-align: start;
        font-size: .9rem;
        gap: 6px;
        white-space: normal;
    }

    .main-nav a span {
        white-space: normal;
        line-height: 1.15;
    }

    .main-nav svg {
        width: 16px;
        height: 16px;
        flex-basis: 16px;
    }

    .dashboard-nav {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        position: static;
        margin: 0 0 18px;
        padding: 12px;
        border-radius: 18px;
    }

    .dashboard-nav a {
        justify-content: flex-start;
        min-height: 44px;
        padding: 10px 8px;
        text-align: start;
        font-size: .96rem;
        white-space: normal;
    }

    .dashboard-nav a span {
        white-space: normal;
        line-height: 1.2;
    }

    body.mobile-menu-open .site-header {
        max-height: calc(100dvh - 104px);
        margin: 0;
        padding: 12px;
        border-color: var(--surface-border);
        opacity: 1;
        pointer-events: auto;
        overflow-y: auto;
        transform: translateY(0);
    }

    .site-footer {
        display: none;
    }
}
