:root {
    --ink: #091f1b;
    --ink-soft: #1b3832;
    --muted: #465f59;
    --green-950: #052f2a;
    --green-900: #073f37;
    --green-800: #0a5146;
    --green-700: #0f6d5d;
    --green-600: #188374;
    --green-100: #dff2ec;
    --green-50: #eff9f5;
    --gold-700: #97702e;
    --gold: #d4af5c;
    --gold-soft: #f8edcf;
    --cream: #f4f5ef;
    --surface: #ffffff;
    --surface-soft: #fafcf9;
    --line: #dfe8e4;
    --line-strong: #cedbd6;
    --danger: #9d3834;
    --danger-soft: #fae8e7;
    --blue: #2e667d;
    --blue-soft: #e5f0f5;
    --violet: #62446f;
    --violet-soft: #eee7f1;
    --shadow-xs: 0 5px 16px rgba(17, 57, 50, 0.05);
    --shadow-sm: 0 12px 30px rgba(17, 57, 50, 0.07);
    --shadow-md: 0 20px 54px rgba(11, 53, 46, 0.1);
    --shadow-lg: 0 30px 90px rgba(4, 38, 33, 0.22);
    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 22px;
    --radius-xl: 28px;
    --sidebar-width: 282px;
    --content-width: 1480px;
    --transition: 180ms ease;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    background: var(--cream);
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;
    background:
        radial-gradient(circle at 8% 0%, rgba(212, 175, 92, 0.08), transparent 24rem),
        var(--cream);
    color: var(--ink);
    font-family: Tahoma, "Segoe UI", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.7;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

body.page-is-loading {
    cursor: progress;
}

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

button,
input,
select,
textarea {
    max-width: 100%;
    color: inherit;
    font: inherit;
}

button,
select {
    cursor: pointer;
}

button:disabled,
.is-submitting {
    cursor: wait;
    opacity: 0.78;
}

img,
svg {
    display: block;
    max-width: 100%;
}

h1,
h2,
h3,
h4,
p {
    overflow-wrap: anywhere;
}

:focus-visible {
    outline: 3px solid rgba(212, 175, 92, 0.58);
    outline-offset: 3px;
}

::selection {
    background: #cde9df;
    color: var(--green-950);
}

.skip-link {
    position: fixed;
    z-index: 200;
    top: 12px;
    right: 12px;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    background: var(--green-950);
    color: #fff;
    font-weight: 800;
    transform: translateY(-160%);
    transition: transform var(--transition);
}

.skip-link:focus {
    transform: translateY(0);
}

.text-muted { color: var(--muted); }
.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;
}
.desktop-only { display: none; }
.mobile-only { display: block; }
.w-full { width: 100%; }
.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 10px !important; }
.mt-2 { margin-top: 16px !important; }
.mt-3 { margin-top: 24px !important; }
.mb-0 { margin-bottom: 0 !important; }
.text-center { text-align: center; }
.nowrap { white-space: nowrap; }

/* Loader */
.page-loader {
    position: fixed;
    z-index: 1000;
    inset: 0;
    display: none;
    place-items: center;
    padding: 24px;
    background: rgba(245, 247, 241, 0.94);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    backdrop-filter: blur(12px);
    transition: opacity 220ms ease, visibility 220ms ease;
}

.js .page-loader {
    display: grid;
}

.page-loader.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    animation: loader-failsafe 0s linear 10s forwards;
}

.page-loader.is-leaving {
    opacity: 0;
    pointer-events: none;
}

.page-loader-card {
    width: min(100%, 290px);
    padding: 28px 24px 24px;
    border: 1px solid rgba(15, 109, 93, 0.1);
    border-radius: 28px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: var(--shadow-md);
    text-align: center;
}

.loader-logo-wrap {
    position: relative;
    width: 112px;
    height: 112px;
    margin: 0 auto 17px;
    display: grid;
    place-items: center;
}

.loader-logo-wrap img {
    position: relative;
    z-index: 2;
    width: 62px;
    height: 82px;
    object-fit: contain;
    animation: loader-logo-pulse 1.55s ease-in-out infinite;
}

.loader-orbit {
    position: absolute;
    inset: 4px;
    border: 2px solid transparent;
    border-top-color: var(--gold);
    border-right-color: rgba(15, 109, 93, 0.34);
    border-radius: 50%;
    animation: loader-spin 1.5s linear infinite;
}

.loader-orbit-two {
    inset: 15px;
    border-top-color: var(--green-700);
    border-right-color: transparent;
    animation-duration: 1.05s;
    animation-direction: reverse;
}

.loader-copy strong,
.loader-copy span {
    display: block;
}

.loader-copy strong {
    color: var(--green-900);
    font-size: 17px;
}

.loader-copy span {
    margin-top: 2px;
    color: var(--muted);
    font-size: 11px;
}

.loader-progress {
    height: 4px;
    margin-top: 18px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--green-100);
}

.loader-progress span {
    display: block;
    width: 44%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--green-700), var(--gold));
    animation: loader-progress 1.2s ease-in-out infinite;
}

@keyframes loader-spin { to { transform: rotate(360deg); } }
@keyframes loader-logo-pulse { 50% { transform: scale(0.94); opacity: 0.82; } }
@keyframes loader-failsafe { to { opacity: 0; visibility: hidden; pointer-events: none; } }
@keyframes loader-progress {
    from { transform: translateX(145%); }
    to { transform: translateX(-245%); }
}

/* Shared branding */
.brand {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-logo-wrap {
    width: 54px;
    height: 54px;
    flex: 0 0 54px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(226, 195, 124, 0.34);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.08);
}

.brand-logo {
    width: 35px;
    height: 46px;
    object-fit: contain;
}

.brand-copy {
    min-width: 0;
}

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

.brand-copy strong {
    color: #fff;
    font-size: 16px;
    font-weight: 900;
    white-space: nowrap;
}

.brand-copy small {
    margin-top: 1px;
    color: #a9c9c1;
    font-size: 9px;
    white-space: nowrap;
}

/* Application shell */
.app-shell,
.workspace {
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    z-index: 80;
    inset: 0 0 0 auto;
    width: min(88vw, 304px);
    padding: max(20px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom));
    overflow-x: hidden;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    color: #fff;
    background:
        radial-gradient(circle at 5% 10%, rgba(212, 175, 92, 0.14), transparent 15rem),
        linear-gradient(165deg, #0a5146 0%, #073f37 48%, #042f2b 100%);
    box-shadow: -18px 0 52px rgba(2, 28, 25, 0.22);
    transform: translateX(105%);
    transition: transform 280ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.sidebar::before,
.sidebar::after {
    content: "";
    position: absolute;
    pointer-events: none;
    border: 1px solid rgba(226, 195, 124, 0.11);
    border-radius: 42%;
    transform: rotate(26deg);
}

.sidebar::before {
    width: 240px;
    height: 240px;
    top: 70px;
    left: -150px;
}

.sidebar::after {
    width: 170px;
    height: 170px;
    right: -115px;
    bottom: 140px;
}

.sidebar-visible {
    overflow: hidden;
}

.sidebar-visible .sidebar {
    transform: translateX(0);
}

.sidebar-header {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.icon-button {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border: 1px solid var(--line);
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: #fff;
    color: var(--ink);
    box-shadow: var(--shadow-xs);
    transition: transform var(--transition), border-color var(--transition), background var(--transition);
}

.icon-button:hover {
    border-color: #bfd3cc;
    background: var(--green-50);
    transform: translateY(-1px);
}

.close-sidebar {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: none;
    color: #fff;
    font-size: 24px;
}

.side-nav {
    position: relative;
    z-index: 1;
    margin-top: 28px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.nav-heading {
    margin: 16px 12px 5px;
    color: #79a79d;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: 0.06em;
}

.side-nav a {
    position: relative;
    min-height: 48px;
    padding: 0 12px;
    border: 1px solid transparent;
    border-radius: 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: #bed7d1;
    font-size: 12px;
    font-weight: 700;
    transition: color var(--transition), background var(--transition), transform var(--transition);
}

.side-nav a i {
    width: 27px;
    height: 27px;
    display: grid;
    place-items: center;
    color: #d7e7e3;
    font-size: 18px;
    font-style: normal;
}

.side-nav a:hover {
    background: rgba(255, 255, 255, 0.07);
    color: #fff;
    transform: translateX(-2px);
}

.side-nav a.active {
    border-color: rgba(255, 255, 255, 0.08);
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.06));
    color: #fff;
    box-shadow: inset -3px 0 0 var(--gold);
}

.side-nav a.active i {
    color: #f1d48f;
}

.quran-quote {
    position: relative;
    z-index: 1;
    margin-top: auto;
    padding: 18px 14px;
    border: 1px solid rgba(212, 175, 92, 0.21);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.045);
    text-align: center;
}

.quran-quote span {
    color: var(--gold);
    font-size: 21px;
}

.quran-quote p {
    margin: 1px 0 6px;
    color: #f8edd3;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 14px;
}

.quran-quote small {
    color: #8fb5ac;
    font-size: 9px;
}

.user-panel {
    position: relative;
    z-index: 1;
    min-width: 0;
    margin-top: 16px;
    padding: 15px 5px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar,
.student-avatar {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    background: linear-gradient(145deg, #d9b865, #c89e49);
    color: var(--green-950);
    font-weight: 900;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 14px;
}

.user-panel > div {
    min-width: 0;
}

.user-panel strong,
.user-panel small {
    display: block;
    max-width: 145px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-panel strong { font-size: 11px; }
.user-panel small { margin-top: 1px; color: #8eb2a9; font-size: 8px; }
.user-panel form { margin-right: auto; }

.logout-button {
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    font-size: 19px;
    transition: background var(--transition);
}

.logout-button:hover { background: rgba(255, 255, 255, 0.13); }

.sidebar-overlay {
    position: fixed;
    z-index: 70;
    inset: 0;
    display: block;
    border: 0;
    background: rgba(3, 28, 25, 0.57);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    backdrop-filter: blur(4px);
    transition: opacity 230ms ease, visibility 230ms ease;
}

.sidebar-visible .sidebar-overlay {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.topbar {
    position: sticky;
    z-index: 50;
    top: 0;
    min-height: 68px;
    padding: 10px max(14px, env(safe-area-inset-left)) 10px max(14px, env(safe-area-inset-right));
    border-bottom: 1px solid rgba(7, 63, 55, 0.08);
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(248, 249, 244, 0.9);
    backdrop-filter: blur(18px);
}

.mobile-brand {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 9px;
}

.mobile-brand-logo {
    width: 38px;
    height: 42px;
    flex: 0 0 38px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(15, 109, 93, 0.1);
    border-radius: 13px;
    background: #fff;
    box-shadow: var(--shadow-xs);
}

.mobile-brand-logo img {
    width: 24px;
    height: 32px;
    object-fit: contain;
}

.mobile-brand-copy {
    min-width: 0;
}

.mobile-brand-copy b,
.mobile-brand-copy small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mobile-brand-copy b { font-size: 11px; }
.mobile-brand-copy small { color: var(--muted); font-size: 8px; }

.top-actions {
    min-width: 0;
    margin-right: auto;
    display: flex;
    align-items: center;
    gap: 7px;
}

.top-actions .icon-button {
    display: none;
}

.today-label {
    display: none;
    color: var(--muted);
    font-size: 11px;
}

.role-chip,
.type-badge,
.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    font-weight: 900;
    white-space: nowrap;
}

.role-chip {
    max-width: 90px;
    padding: 6px 9px;
    overflow: hidden;
    background: var(--green-100);
    color: var(--green-700);
    font-size: 8px;
    text-overflow: ellipsis;
}

.page-content {
    width: min(100%, var(--content-width));
    margin-inline: auto;
    padding: 18px 14px calc(96px + env(safe-area-inset-bottom));
}

.bottom-nav {
    position: fixed;
    z-index: 60;
    right: 10px;
    bottom: max(9px, env(safe-area-inset-bottom));
    left: 10px;
    height: 68px;
    padding: 7px;
    border: 1px solid rgba(7, 63, 55, 0.1);
    border-radius: 22px;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 18px 48px rgba(11, 53, 46, 0.18);
    backdrop-filter: blur(18px);
}

.bottom-nav a {
    position: relative;
    min-width: 0;
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: #7b8e89;
}

.bottom-nav a::after {
    content: "";
    position: absolute;
    bottom: 4px;
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: transparent;
}

.bottom-nav i {
    font-size: 18px;
    font-style: normal;
    line-height: 1;
}

.bottom-nav small {
    max-width: 100%;
    overflow: hidden;
    font-size: 8px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bottom-nav a.active {
    background: var(--green-50);
    color: var(--green-700);
}

.bottom-nav a.active::after { background: var(--gold); }

/* Page headers and surfaces */
.page-heading {
    min-width: 0;
    margin: 3px 0 18px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
}

.page-heading > div:first-child {
    min-width: 0;
}

.page-heading h1 {
    margin: 0;
    color: var(--ink);
    font-size: clamp(24px, 7vw, 37px);
    font-weight: 900;
    line-height: 1.35;
    letter-spacing: -0.025em;
}

.page-heading p {
    max-width: 780px;
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.8;
}

.eyebrow {
    display: block;
    margin-bottom: 6px;
    color: var(--gold-700);
    font-size: 9px;
    font-weight: 900;
    letter-spacing: 0.055em;
}

.page-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.page-actions > :only-child {
    grid-column: 1 / -1;
}

.panel,
.circle-card,
.stat-card {
    border: 1px solid rgba(15, 109, 93, 0.085);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: var(--shadow-sm);
}

.panel {
    min-width: 0;
    padding: clamp(16px, 4.5vw, 25px);
    border-radius: var(--radius-lg);
}

.panel-heading {
    min-width: 0;
    margin-bottom: 17px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.panel-heading > div {
    min-width: 0;
}

.panel-heading h2,
.section-title {
    margin: 0;
    color: var(--ink);
    font-size: 17px;
    font-weight: 900;
    line-height: 1.45;
}

.panel-heading p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 9px;
}

.panel-heading-compact {
    padding: 12px 5px 0;
}

.section-title { margin-bottom: 15px; }

.empty-state {
    width: 100%;
    padding: 38px 16px;
    color: var(--muted);
    text-align: center;
}

.empty-state .empty-icon {
    width: 62px;
    height: 62px;
    margin: 0 auto 13px;
    border-radius: 20px;
    display: grid;
    place-items: center;
    background: linear-gradient(145deg, var(--green-50), var(--green-100));
    color: var(--green-700);
    font-size: 27px;
}

.empty-state h3 {
    margin: 0 0 5px;
    color: var(--ink);
    font-size: 15px;
}

.empty-state p {
    margin: 0;
    font-size: 10px;
}

/* Buttons and alerts */
.button {
    min-height: 46px;
    padding: 0 17px;
    border: 1px solid transparent;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 10px;
    font-weight: 900;
    line-height: 1.25;
    text-align: center;
    white-space: nowrap;
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition), background var(--transition);
}

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

.button-primary {
    background: linear-gradient(135deg, var(--green-600), var(--green-900));
    color: #fff;
    box-shadow: 0 10px 22px rgba(15, 109, 93, 0.18);
}

.button-primary:hover {
    box-shadow: 0 14px 28px rgba(15, 109, 93, 0.25);
}

.button-secondary {
    border-color: #cce1da;
    background: var(--green-50);
    color: var(--green-700);
}

.button-ghost {
    border-color: var(--line);
    background: #fff;
    color: var(--ink-soft);
}

.button-danger {
    border-color: #efc8c6;
    background: var(--danger-soft);
    color: var(--danger);
}

.button-sm {
    min-height: 38px;
    padding: 0 12px;
    border-radius: 12px;
    font-size: 9px;
}

.button-lg {
    min-height: 54px;
    border-radius: 16px;
    font-size: 12px;
}

.link-button {
    min-height: 34px;
    padding: 5px 7px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--green-700);
    font-size: 9px;
    font-weight: 900;
    white-space: nowrap;
}

.link-button:hover { background: var(--green-50); }
.danger-link { color: var(--danger); }

.icon-link {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    border: 1px solid var(--line);
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: #fff;
    color: var(--green-700);
}

.alert {
    position: relative;
    margin-bottom: 15px;
    padding: 14px;
    border: 1px solid transparent;
    border-radius: 16px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 10px;
    box-shadow: var(--shadow-xs);
    transition: opacity 160ms ease, transform 160ms ease;
}

.alert.is-dismissing {
    opacity: 0;
    transform: translateY(-6px);
}

.alert > span {
    width: 27px;
    height: 27px;
    flex: 0 0 27px;
    border-radius: 9px;
    display: grid;
    place-items: center;
    font-weight: 900;
}

.alert p { margin: 3px 0; flex: 1; }
.alert button { margin-right: auto; border: 0; background: transparent; color: inherit; font-size: 18px; }
.alert ul { margin: 7px 0 0; padding-right: 18px; }
.alert-success { border-color: #cce7df; background: #e7f5f0; color: #126657; }
.alert-success > span { background: #c9e8de; }
.alert-danger { border-color: #f0cfcd; background: var(--danger-soft); color: #9d403d; }
.alert-danger > span { background: #f1cecc; }

/* Dashboard */
.hero {
    position: relative;
    min-height: 226px;
    padding: 25px 21px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 26px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 20px;
    background:
        radial-gradient(circle at 10% 10%, rgba(212, 175, 92, 0.15), transparent 18rem),
        linear-gradient(132deg, #0f6d5d 0%, #08483f 52%, #05352f 100%);
    color: #fff;
    box-shadow: 0 24px 52px rgba(6, 68, 59, 0.2);
}

.hero::before,
.hero::after {
    content: "";
    position: absolute;
    pointer-events: none;
    border: 1px solid rgba(226, 195, 124, 0.16);
    border-radius: 44%;
    transform: rotate(28deg);
}

.hero::before {
    width: 290px;
    height: 290px;
    top: -160px;
    left: -120px;
}

.hero::after {
    width: 170px;
    height: 170px;
    right: -100px;
    bottom: -120px;
}

.hero-copy,
.hero-side {
    position: relative;
    z-index: 1;
}

.hero .eyebrow { color: #f0d592; }

.hero h1 {
    max-width: 760px;
    margin: 0;
    color: #fff;
    font-size: clamp(23px, 6vw, 39px);
    font-weight: 900;
    line-height: 1.5;
}

.hero p {
    max-width: 650px;
    margin: 7px 0 0;
    color: #c4dcd6;
    font-size: 11px;
    line-height: 1.9;
}

.hero-side {
    align-self: flex-end;
    display: flex;
    align-items: flex-end;
    gap: 10px;
}

.hero-logo {
    width: 45px;
    height: 60px;
    object-fit: contain;
    opacity: 0.78;
    filter: saturate(0.9) brightness(1.35);
}

.hero-date {
    width: 82px;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 18px 18px 7px 18px;
    background: rgba(255, 255, 255, 0.08);
    text-align: center;
    backdrop-filter: blur(8px);
}

.hero-date span,
.hero-date small {
    display: block;
    color: #afd0c8;
    font-size: 8px;
}

.hero-date strong {
    display: block;
    color: #f1d38d;
    font-family: Georgia, serif;
    font-size: 28px;
    line-height: 1.15;
}

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

.stat-card {
    min-width: 0;
    min-height: 108px;
    padding: 15px 12px;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 9px;
}

.stat-card > div:last-child { min-width: 0; width: 100%; }

.stat-icon {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: var(--green-100);
    color: var(--green-700);
    font-size: 18px;
}

.stat-card:nth-child(2) .stat-icon { background: var(--blue-soft); color: var(--blue); }
.stat-card:nth-child(3) .stat-icon { background: var(--gold-soft); color: var(--gold-700); }
.stat-card:nth-child(4) .stat-icon { background: var(--violet-soft); color: var(--violet); }

.stat-card span,
.stat-card strong,
.stat-card small {
    display: block;
}

.stat-card span {
    color: var(--muted);
    font-size: 8px;
    white-space: nowrap;
}

.stat-card strong {
    font-size: 22px;
    line-height: 1.25;
}

.stat-card .stat-text-value {
    font-size: 14px;
    line-height: 1.55;
}

.stat-card small {
    overflow: hidden;
    color: #91a09c;
    font-size: 7px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-grid,
.detail-grid,
.cards-grid {
    min-width: 0;
    display: grid;
    gap: 13px;
}

.dashboard-grid { margin-top: 13px; }
.cards-grid { grid-template-columns: minmax(0, 1fr); }

.circle-card {
    min-width: 0;
    padding: 18px;
    border-radius: 22px;
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.circle-card:hover {
    border-color: rgba(15, 109, 93, 0.2);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.circle-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.circle-emblem {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    border-radius: 15px;
    display: grid;
    place-items: center;
    background: linear-gradient(145deg, var(--green-50), var(--green-100));
    color: var(--green-700);
    font-family: Georgia, serif;
    font-size: 15px;
    font-weight: 900;
}

.circle-card h2 {
    margin: 15px 0 4px;
    font-size: 15px;
    line-height: 1.5;
}

.circle-card > p {
    margin: 0;
    color: var(--muted);
    font-size: 9px;
}

.circle-meta {
    margin-top: 16px;
    padding: 12px 0;
    border-top: 1px solid #edf1ef;
    border-bottom: 1px solid #edf1ef;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.circle-meta span {
    min-width: 0;
    border-left: 1px solid #edf1ef;
    text-align: center;
}

.circle-meta span:last-child { border-left: 0; }
.circle-meta b,
.circle-meta small { display: block; }
.circle-meta b { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.circle-meta small { color: var(--muted); font-size: 8px; }

.progress-bar {
    height: 7px;
    overflow: hidden;
    border-radius: 999px;
    background: #eaf0ed;
    direction: ltr;
}

.progress-bar span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--green-700), #4aaa93);
}

.type-badge,
.status-badge {
    padding: 6px 10px;
    background: var(--green-50);
    color: var(--green-700);
    font-size: 8px;
}

.type-badge.special { background: var(--gold-soft); color: var(--gold-700); }
.status-badge.present { background: var(--green-100); color: var(--green-700); }
.status-badge.absent { background: var(--danger-soft); color: var(--danger); }
.status-badge.late { background: var(--gold-soft); color: var(--gold-700); }
.status-badge.excused { background: var(--blue-soft); color: var(--blue); }
.status-badge.inactive { background: #edf0ef; color: #6f817d; }

/* Forms and filters */
.toolbar {
    margin-bottom: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.filter-form {
    min-width: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.filter-form > *,
.filter-form > .form-control,
.filter-form > .field {
    width: 100%;
    min-width: 0;
}

.search-field {
    position: relative;
    min-width: 0;
    flex: 1;
}

.search-field::before {
    content: "⌕";
    position: absolute;
    z-index: 1;
    top: 50%;
    right: 14px;
    color: var(--muted);
    font-size: 18px;
    transform: translateY(-50%);
    pointer-events: none;
}

.search-field input { padding-right: 43px; }

.form-control {
    width: 100%;
    min-height: 49px;
    padding: 11px 13px;
    border: 1px solid var(--line-strong);
    border-radius: 14px;
    background: #fff;
    color: var(--ink);
    outline: 0;
    font-size: 13px;
    line-height: 1.35;
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.form-control::placeholder { color: #9ba9a5; }

.form-control:hover { border-color: #b8ccc5; }

.form-control:focus {
    border-color: #4b9988;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(15, 109, 93, 0.1);
}

textarea.form-control {
    min-height: 118px;
    resize: vertical;
    line-height: 1.75;
}

select.form-control {
    appearance: auto;
}

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

.form-section {
    min-width: 0;
    padding: 17px;
    border: 1px solid var(--line);
    border-radius: 19px;
    background: var(--surface-soft);
}

.form-section h3 {
    margin: 0 0 14px;
    font-size: 14px;
}

.form-section-note {
    margin: -5px 0 14px;
    color: var(--muted);
    font-size: 9px;
}

.field {
    min-width: 0;
}

.field label {
    display: block;
    margin-bottom: 7px;
    color: var(--ink-soft);
    font-size: 10px;
    font-weight: 900;
}

.field .hint,
.hint {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    font-size: 8px;
    line-height: 1.7;
}

.required::after {
    content: " *";
    color: var(--danger);
}

.checkbox-line {
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--ink-soft);
    font-size: 10px;
}

.checkbox-line input {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    accent-color: var(--green-700);
}

.form-actions {
    margin-top: 19px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
}

.form-note {
    align-self: center;
    color: var(--muted);
    font-size: 9px;
    line-height: 1.7;
}

.days-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.check-chip {
    position: relative;
}

.check-chip input {
    position: absolute;
    opacity: 0;
}

.check-chip span {
    min-height: 38px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: #fff;
    color: var(--muted);
    font-size: 9px;
}

.check-chip input:focus-visible + span {
    outline: 3px solid rgba(212, 175, 92, 0.45);
    outline-offset: 2px;
}

.check-chip input:checked + span {
    border-color: var(--green-700);
    background: var(--green-50);
    color: var(--green-700);
    font-weight: 900;
}

.password-wrap,
.input-with-icon {
    position: relative;
}

.input-with-icon > span:first-child {
    position: absolute;
    z-index: 1;
    top: 50%;
    right: 15px;
    color: #8da09b;
    font-size: 12px;
    transform: translateY(-50%);
    pointer-events: none;
}

.input-with-icon .form-control {
    padding-right: 42px;
}

.password-wrap .form-control {
    padding-left: 66px;
}

.password-toggle {
    position: absolute;
    z-index: 2;
    top: 50%;
    left: 9px;
    min-width: 48px;
    min-height: 34px;
    border: 0;
    border-radius: 10px;
    background: var(--green-50);
    color: var(--green-700);
    font-size: 9px;
    font-weight: 900;
    transform: translateY(-50%);
}

/* Lists and responsive tables */
.data-list {
    display: grid;
    gap: 8px;
}

.data-row {
    min-width: 0;
    padding: 12px 0;
    border-bottom: 1px solid #edf1ef;
    display: flex;
    align-items: center;
    gap: 11px;
}

.data-row:last-child { border-bottom: 0; }

.data-row-plain,
a.data-row-plain,
a.data-row-plain:hover {
    padding: 0;
    border: 0;
    background: transparent;
}

a.data-row {
    border-radius: 13px;
    transition: background var(--transition), padding var(--transition);
}

a.data-row:hover {
    padding-inline: 8px;
    background: var(--green-50);
}

.data-row-content {
    min-width: 0;
    flex: 1;
}

.data-row strong,
.data-row small {
    display: block;
}

.data-row strong {
    overflow: hidden;
    font-size: 11px;
    text-overflow: ellipsis;
}

.data-row small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 8px;
    line-height: 1.65;
}

.data-row-value {
    flex: 0 0 auto;
    margin-right: auto;
    text-align: left;
}

.data-row-value strong { color: var(--green-700); }

.student-avatar {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: linear-gradient(145deg, var(--green-50), var(--green-100));
    color: var(--green-700);
}

.table-panel {
    padding: 9px 12px;
    overflow: hidden;
}

.table-head {
    display: none;
}

.table-row {
    min-width: 0;
    padding: 15px 3px;
    border-bottom: 1px solid #e9efec;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 11px 14px;
}

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

.mobile-label {
    min-width: 0;
    color: var(--ink-soft);
    font-size: 9px;
}

.mobile-label::before {
    content: attr(data-label) ": ";
    color: #93a39f;
}

.row-actions {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 6px;
}

.table-row > .row-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
}

.inline-progress {
    grid-column: 1 / -1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 9px;
}

.inline-progress > .progress-bar { flex: 1; }
.inline-progress b { flex: 0 0 auto; color: var(--green-700); font-size: 9px; }

/* Details and progress */
.profile-card {
    text-align: center;
}

.profile-card .student-avatar {
    width: 78px;
    height: 78px;
    margin: 0 auto 13px;
    border-radius: 25px;
    font-size: 25px;
}

.profile-card h2 { margin: 0; font-size: 19px; }
.profile-card > p { margin: 5px 0 14px; color: var(--muted); font-size: 9px; }

.info-list {
    margin-top: 14px;
    border-top: 1px solid var(--line);
}

.info-list div {
    min-width: 0;
    padding: 11px 0;
    border-bottom: 1px solid #edf1ef;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    font-size: 9px;
}

.info-list span { flex: 0 0 auto; color: var(--muted); }
.info-list b { min-width: 0; text-align: left; overflow-wrap: anywhere; }

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

.progress-tile {
    min-width: 0;
    min-height: 83px;
    padding: 13px;
    border: 1px solid #eaf0ed;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: var(--surface-soft);
}

.progress-tile span,
.progress-tile strong { display: block; }
.progress-tile span { color: var(--muted); font-size: 8px; }
.progress-tile strong { margin-top: 4px; font-size: 12px; line-height: 1.55; }

.details-summary,
details.panel > summary {
    min-height: 42px;
    display: flex;
    align-items: center;
    color: var(--green-900);
    cursor: pointer;
    font-weight: 900;
}

.timeline {
    position: relative;
    padding-right: 18px;
}

.timeline::before {
    content: "";
    position: absolute;
    top: 8px;
    right: 4px;
    bottom: 8px;
    width: 1px;
    background: #d7e6e1;
}

.timeline-item {
    position: relative;
    padding: 0 12px 20px 0;
}

.timeline-item::before {
    content: "";
    position: absolute;
    top: 5px;
    right: -18px;
    width: 10px;
    height: 10px;
    border: 3px solid #d7eee7;
    border-radius: 50%;
    background: var(--green-700);
}

.timeline-item:last-child { padding-bottom: 0; }
.timeline-item h4 { margin: 0; font-size: 11px; }
.timeline-item p { margin: 5px 0 0; color: var(--muted); font-size: 9px; line-height: 1.8; }

.timeline-meta {
    margin-top: 7px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px 11px;
    color: #849994;
    font-size: 8px;
}

/* Attendance */
.attendance-list {
    display: grid;
}

.attendance-student {
    min-width: 0;
    padding: 16px 0;
    border-bottom: 1px solid #edf1ef;
}

.attendance-student:last-child { border-bottom: 0; }

.attendance-options {
    margin-top: 12px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
}

.attendance-choice {
    position: relative;
    min-width: 0;
}

.attendance-choice input {
    position: absolute;
    opacity: 0;
}

.attendance-choice span {
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: #fff;
    color: var(--muted);
    font-size: 8px;
    transition: border-color var(--transition), background var(--transition), transform var(--transition);
}

.attendance-choice input:focus-visible + span {
    outline: 3px solid rgba(212, 175, 92, 0.45);
    outline-offset: 2px;
}

.attendance-choice input:checked + span,
.attendance-choice.is-selected span {
    border-color: var(--green-700);
    background: var(--green-100);
    color: var(--green-700);
    font-weight: 900;
    transform: translateY(-1px);
}

.attendance-choice.status-absent input:checked + span { border-color: #e6bdbb; background: var(--danger-soft); color: var(--danger); }
.attendance-choice.status-late input:checked + span { border-color: #ead3a0; background: var(--gold-soft); color: var(--gold-700); }
.attendance-choice.status-excused input:checked + span { border-color: #bfd8e2; background: var(--blue-soft); color: var(--blue); }

/* Pagination */
.pagination-wrap {
    margin-top: 18px;
    display: flex;
    justify-content: center;
}

.pagination {
    max-width: 100%;
    margin: 0;
    padding: 0;
    overflow-x: auto;
    display: flex;
    gap: 5px;
    direction: ltr;
    list-style: none;
    scrollbar-width: thin;
}

.page-link {
    min-width: 38px;
    height: 38px;
    padding: 0 9px;
    border: 1px solid var(--line) !important;
    border-radius: 11px !important;
    display: grid;
    place-items: center;
    background: #fff !important;
    color: var(--muted) !important;
    font-size: 9px;
    box-shadow: none !important;
}

.page-item.active .page-link {
    border-color: var(--green-700) !important;
    background: var(--green-700) !important;
    color: #fff !important;
}

.page-item.disabled .page-link { opacity: 0.42; }

/* Login */
.guest-body {
    min-height: 100vh;
    min-height: 100svh;
    padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at 10% 10%, rgba(212, 175, 92, 0.19), transparent 18rem),
        radial-gradient(circle at 90% 90%, rgba(15, 109, 93, 0.18), transparent 24rem),
        #eef2ea;
}

.login-shell {
    width: min(100%, 1080px);
    min-height: min(720px, calc(100svh - 24px));
    overflow: hidden;
    border: 1px solid rgba(7, 63, 55, 0.08);
    border-radius: 26px;
    display: grid;
    background: #fff;
    box-shadow: var(--shadow-lg);
}

.login-art {
    display: none;
}

.login-form-wrap {
    position: relative;
    min-width: 0;
    padding: 22px 18px 17px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background:
        linear-gradient(180deg, rgba(239, 249, 245, 0.56), transparent 14rem),
        #fff;
}

.login-form-wrap::before {
    content: "";
    position: absolute;
    top: -85px;
    left: -85px;
    width: 180px;
    height: 180px;
    border: 1px solid rgba(15, 109, 93, 0.08);
    border-radius: 42%;
    transform: rotate(28deg);
    pointer-events: none;
}

.login-form-card {
    position: relative;
    z-index: 1;
    width: min(100%, 450px);
    margin-inline: auto;
}

.login-mobile-brand {
    margin-bottom: 28px;
    display: flex;
    align-items: center;
    gap: 11px;
}

.login-mobile-logo {
    width: 58px;
    height: 64px;
    flex: 0 0 58px;
    border: 1px solid #d6e6e0;
    border-radius: 18px;
    display: grid;
    place-items: center;
    background: #fff;
    box-shadow: var(--shadow-sm);
}

.login-mobile-logo img {
    width: 37px;
    height: 49px;
    object-fit: contain;
}

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

.login-mobile-brand strong { color: var(--green-900); font-size: 15px; }
.login-mobile-brand small { margin-top: 2px; color: var(--muted); font-size: 8px; }

.login-form-heading h1 {
    margin: 0;
    color: var(--green-950);
    font-size: clamp(28px, 8vw, 37px);
    font-weight: 900;
    line-height: 1.3;
}

.login-form-heading p {
    margin: 8px 0 24px;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.8;
}

.login-form .form-control {
    min-height: 54px;
    border-radius: 16px;
    font-size: 16px;
}

.login-remember {
    margin: 10px 0 13px;
}

.login-security-note {
    margin-top: 18px;
    padding: 11px 13px;
    border: 1px solid #e2ebe7;
    border-radius: 14px;
    display: flex;
    align-items: center;
    gap: 9px;
    background: var(--surface-soft);
    color: var(--muted);
}

.login-security-note > span {
    color: var(--gold-700);
    font-size: 10px;
}

.login-security-note p {
    margin: 0;
    font-size: 8px;
}

.login-footer {
    position: relative;
    z-index: 1;
    margin: 22px 0 0;
    color: #94a39f;
    font-size: 8px;
    text-align: center;
}

.login-art-content {
    position: relative;
    z-index: 2;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.login-verse {
    margin: auto 0 30px;
    text-align: center;
}

.login-verse > span {
    color: var(--gold);
    font-size: 30px;
}

.login-verse blockquote {
    margin: 7px 0;
    color: #fff6df;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(24px, 3vw, 32px);
    line-height: 1.9;
}

.login-verse small { color: #a5c8c0; font-size: 9px; }

.login-feature-list {
    display: grid;
    gap: 10px;
}

.login-feature-list div {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #c9ded9;
    font-size: 10px;
}

.login-feature-list i {
    width: 25px;
    height: 25px;
    flex: 0 0 25px;
    border-radius: 9px;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.08);
    color: #f0d38d;
    font-style: normal;
}

.login-note {
    margin: 28px 0 0;
    color: #8fb8ae;
    font-size: 9px;
}

/* Error pages */
.error-page {
    min-height: 70vh;
    padding: 30px 14px;
    display: grid;
    place-items: center;
    text-align: center;
}

.error-code {
    color: var(--green-100);
    font-family: Georgia, serif;
    font-size: clamp(68px, 22vw, 100px);
    font-weight: 700;
    line-height: 1;
    text-shadow: 0 1px 0 var(--green-700);
}

.error-page h1 { margin: -12px 0 7px; }
.error-page p { margin: 0 0 18px; color: var(--muted); font-size: 10px; }

@media (max-width: 350px) {
    .stats-grid { grid-template-columns: minmax(0, 1fr); }
    .stat-card { min-height: 90px; flex-direction: row; align-items: center; }
    .page-actions,
    .form-actions { grid-template-columns: minmax(0, 1fr); }
    .page-actions > :only-child { grid-column: auto; }
    .progress-summary { grid-template-columns: minmax(0, 1fr); }
}

@media (min-width: 430px) {
    .attendance-options { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .stat-card { flex-direction: row; align-items: center; }
}

@media (min-width: 560px) {
    .page-content { padding-inline: 22px; }

    .page-heading {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .page-actions {
        width: auto;
        display: flex;
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .page-actions > :only-child { grid-column: auto; }

    .form-actions {
        display: flex;
        flex-wrap: wrap;
    }

    .form-actions .button { min-width: 130px; }

    .filter-form {
        flex-direction: row;
        align-items: flex-end;
        flex-wrap: wrap;
    }

    .filter-form > *,
    .filter-form > .form-control,
    .filter-form > .field {
        width: auto;
        min-width: 150px;
    }

    .filter-form > .search-field {
        min-width: 240px;
        flex: 1;
    }

    .filter-form > .button { min-width: 88px; }

    .cards-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .login-form-wrap { padding: 38px 34px 24px; }
}

@media (min-width: 720px) {
    .page-content { padding: 26px 26px 102px; }
    .topbar { padding-inline: 24px; }
    .top-actions .icon-button { display: grid; }
    .today-label { display: inline; }

    .hero {
        min-height: 210px;
        padding: 31px;
        flex-direction: row;
        align-items: center;
    }

    .hero-side { align-self: auto; }
    .hero-logo { width: 60px; height: 80px; }

    .stats-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .stat-card { min-height: 112px; padding: 17px 14px; }

    .form-grid.two-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .form-grid.three-columns { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .form-section.span-full,
    .field.span-full { grid-column: 1 / -1; }

    .detail-grid { grid-template-columns: minmax(230px, 0.7fr) minmax(0, 1.3fr); }

    .attendance-student {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 20px;
    }

    .attendance-student > .data-row { flex: 1; }
    .attendance-options { width: min(48%, 370px); margin-top: 0; }
}

@media (min-width: 960px) {
    .guest-body { padding: 24px; }

    .login-shell {
        min-height: min(700px, calc(100svh - 48px));
        grid-template-columns: minmax(0, 1.06fr) minmax(420px, 0.94fr);
        border-radius: 32px;
    }

    .login-art {
        position: relative;
        overflow: hidden;
        padding: 46px;
        display: block;
        color: #fff;
        background:
            radial-gradient(circle at 10% 10%, rgba(212, 175, 92, 0.15), transparent 21rem),
            linear-gradient(150deg, #0c5f51, #073f37 56%, #042e29);
    }

    .login-art::before,
    .login-art::after,
    .login-art-pattern::before {
        content: "";
        position: absolute;
        border: 1px solid rgba(221, 185, 103, 0.15);
        border-radius: 42%;
        transform: rotate(25deg);
        pointer-events: none;
    }

    .login-art::before { width: 380px; height: 380px; top: -185px; left: -185px; }
    .login-art::after { width: 270px; height: 270px; right: -175px; bottom: -120px; }
    .login-art-pattern::before { width: 180px; height: 180px; top: 40%; right: -115px; }
    .login-mobile-brand { display: none; }
    .login-form-wrap { padding: 55px 52px 28px; }
}

@media (min-width: 1020px) {
    .sidebar {
        width: var(--sidebar-width);
        padding: 25px 19px;
        box-shadow: none;
        transform: none;
    }

    .workspace { margin-right: var(--sidebar-width); }
    .sidebar-overlay,
    .close-sidebar,
    .menu-button,
    .mobile-brand,
    .bottom-nav { display: none !important; }

    .topbar {
        min-height: 74px;
        padding-inline: 32px;
    }

    .page-content { padding: 31px 32px 48px; }
    .dashboard-grid { grid-template-columns: minmax(0, 1.12fr) minmax(0, 0.88fr); }
    .cards-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .desktop-only { display: block; }
    .mobile-only { display: none; }

    .table-head,
    .table-row {
        display: grid;
        grid-template-columns: minmax(200px, 1.35fr) minmax(120px, 1fr) minmax(130px, 1fr) minmax(110px, 0.9fr) minmax(120px, 0.8fr);
        align-items: center;
        gap: 15px;
    }

    .table-head {
        padding: 13px 9px;
        border-bottom: 1px solid #e7eeeb;
        color: #879a95;
        font-size: 8px;
        font-weight: 900;
    }

    .table-row { padding: 15px 9px; }
    .mobile-label::before { display: none; }
    .inline-progress { grid-column: auto; }
    .table-row > .row-actions { grid-column: auto; justify-content: flex-end; }
}

@media (min-width: 1320px) {
    :root { --sidebar-width: 294px; }
    .sidebar { padding: 28px 22px; }
    .page-content { padding: 35px 40px 52px; }
    .cards-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .stat-card { padding: 19px 17px; }
    .stat-icon { width: 46px; height: 46px; flex-basis: 46px; }
    .stat-card strong { font-size: 25px; }
}

/* Larger, more readable typography scale */
body { font-size: 16px; }

.brand-copy strong { font-size: 18px; }
.brand-copy small { font-size: 11px; }
.nav-heading { font-size: 11px; }
.side-nav a { font-size: 14px; }
.quran-quote p { font-size: 16px; }
.quran-quote small { font-size: 11px; }
.user-panel strong { font-size: 13px; }
.user-panel small { font-size: 10px; }
.mobile-brand-copy b { font-size: 13px; }
.mobile-brand-copy small { font-size: 10px; }
.today-label { font-size: 13px; }
.role-chip { font-size: 10px; }
.bottom-nav small { font-size: 10px; }

.page-heading h1 { font-size: clamp(28px, 7vw, 42px); }
.page-heading p { font-size: 14px; }
.eyebrow { font-size: 12px; }
.panel-heading h2,
.section-title { font-size: 20px; }
.panel-heading p { font-size: 12px; }
.empty-state h3 { font-size: 18px; }
.empty-state p { font-size: 12px; }

.button {
    padding-block: 10px;
    font-size: 13px;
    line-height: 1.45;
    white-space: normal;
}

.button-sm { font-size: 11px; }
.button-lg { font-size: 14px; }
.link-button { font-size: 12px; }
.alert { font-size: 13px; }

.hero h1 { font-size: clamp(28px, 6vw, 43px); }
.hero p { font-size: 14px; }
.hero-date span,
.hero-date small { font-size: 10px; }
.hero-date strong { font-size: 31px; }

.stat-card span { font-size: 11px; }
.stat-card strong { font-size: 27px; }
.stat-card small { font-size: 10px; }
.stat-card .stat-text-value { font-size: 16px; }

.circle-card h2 { font-size: 18px; }
.circle-card > p { font-size: 12px; }
.circle-meta b { font-size: 16px; }
.circle-meta small { font-size: 10px; }
.type-badge,
.status-badge { font-size: 10px; }

.form-control { font-size: 15px; }
.form-section h3 { font-size: 17px; }
.form-section-note { font-size: 12px; }
.field label { font-size: 13px; }
.field .hint,
.hint { font-size: 11px; }
.checkbox-line { font-size: 13px; }
.check-chip span { font-size: 12px; }
.password-toggle { font-size: 11px; }
.form-note { font-size: 12px; }

.data-row strong { font-size: 14px; }
.data-row small { font-size: 11px; }
.mobile-label { font-size: 12px; }
.inline-progress b { font-size: 11px; }

.profile-card h2 { font-size: 22px; }
.profile-card > p { font-size: 12px; }
.info-list div { font-size: 12px; }
.progress-tile span { font-size: 11px; }
.progress-tile strong { font-size: 15px; }
.timeline-item h4 { font-size: 14px; }
.timeline-item p { font-size: 12px; }
.timeline-meta { font-size: 10px; }
.attendance-choice span { font-size: 11px; }
.page-link { font-size: 12px; }

.login-mobile-brand strong { font-size: 18px; }
.login-mobile-brand small { font-size: 11px; }
.login-form-heading h1 { font-size: clamp(31px, 8vw, 41px); }
.login-form-heading p { font-size: 13px; }
.login-security-note p { font-size: 11px; }
.login-footer { font-size: 10px; }
.login-verse small { font-size: 11px; }
.login-feature-list div { font-size: 12px; }
.login-note { font-size: 11px; }

/* Monthly attendance, teacher attendance, and exams */
.month-switcher {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
}

.month-switcher .form-control { min-width: 0; }

.month-navigation {
    margin: -4px 0 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

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

.attendance-summary-card {
    min-width: 0;
    min-height: 94px;
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: 17px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: var(--surface-soft);
}

.attendance-summary-card span,
.attendance-summary-card strong { display: block; }
.attendance-summary-card span { color: var(--muted); font-size: 12px; }
.attendance-summary-card strong { margin-top: 3px; font-size: 28px; line-height: 1.2; }
.attendance-summary-card.present { border-color: #cce7df; background: #eff9f5; color: var(--green-700); }
.attendance-summary-card.absent { border-color: #efcecc; background: #fff7f6; color: var(--danger); }
.attendance-summary-card.late { border-color: #ead8ad; background: #fffbf1; color: var(--gold-700); }
.attendance-summary-card.excused { border-color: #cfe1e8; background: #f5fafc; color: var(--blue); }
.attendance-summary-card.total { grid-column: 1 / -1; background: #f6f2fa; color: var(--violet); }

.teacher-attendance-controls {
    min-width: 0;
    width: 100%;
    margin-top: 12px;
    display: grid;
    gap: 8px;
}

.teacher-attendance-controls .attendance-options {
    width: 100%;
    margin-top: 0;
}

.attendance-note {
    min-height: 42px;
    padding-block: 8px;
}

.exam-card-footer {
    margin-top: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.exam-card-footer small {
    min-width: 0;
    overflow: hidden;
    color: var(--muted);
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.status-badge.exam-draft,
.status-badge.result-pending { background: #edf0ef; color: #667a75; }
.status-badge.exam-open { background: var(--green-100); color: var(--green-700); }
.status-badge.exam-completed,
.status-badge.result-passed { background: var(--blue-soft); color: var(--blue); }
.status-badge.result-failed { background: var(--danger-soft); color: var(--danger); }
.status-badge.result-absent { background: var(--gold-soft); color: var(--gold-700); }

.exam-notes {
    margin-top: 15px;
    padding: 14px;
    border: 1px solid #e7eee9;
    border-radius: 15px;
    background: var(--surface-soft);
}

.exam-notes strong { font-size: 13px; }
.exam-notes p { margin: 5px 0 0; color: var(--muted); font-size: 12px; white-space: pre-line; }
.empty-state.compact { padding-block: 18px; }

.nominee-grid {
    display: grid;
    gap: 8px;
}

.nominee-card {
    min-width: 0;
    padding: 12px;
    border: 1px solid #e8efec;
    border-radius: 16px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    background: var(--surface-soft);
}

.nominee-card > div { min-width: 0; }
.nominee-card strong,
.nominee-card small { display: block; }
.nominee-card strong { overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.nominee-card small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.nominee-card > .status-badge { grid-column: 1 / -1; justify-self: start; }

.exam-results-list { display: grid; gap: 10px; }

.exam-result-card {
    min-width: 0;
    padding: 15px;
    border: 1px solid #e5eeea;
    border-radius: 18px;
    background: var(--surface-soft);
}

.exam-result-head {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 11px;
}

.result-score {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
}

.result-score strong { color: var(--ink); font-size: 14px; }
.result-score small { color: var(--muted); font-size: 11px; }
.candidate-note { margin: 12px 0 0; color: var(--ink-soft); font-size: 12px; }
.grading-meta { display: block; margin-top: 7px; color: var(--muted); font-size: 10px; }

.result-editor {
    margin-top: 13px;
    padding-top: 11px;
    border-top: 1px solid var(--line);
}

.result-editor > summary {
    min-height: 38px;
    color: var(--green-700);
    font-size: 12px;
    font-weight: 900;
    cursor: pointer;
}

.result-form { margin-top: 10px; }
.candidate-remove { margin-top: 10px; }

@media (min-width: 560px) {
    .month-switcher { width: auto; min-width: 300px; }
    .attendance-summary-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
    .attendance-summary-card.total { grid-column: auto; }
    .nominee-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .nominee-card { grid-template-columns: auto minmax(0, 1fr) auto; }
    .nominee-card > .status-badge { grid-column: auto; justify-self: end; }
    .exam-result-head { flex-direction: row; align-items: center; justify-content: space-between; }
    .result-form { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 720px) {
    .teacher-attendance-row { align-items: flex-start; }
    .teacher-attendance-controls { width: min(62%, 640px); margin-top: 0; }
}

@media (min-width: 1020px) {
    .exam-overview-grid { grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); }
    .nominee-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 1020px) {
    .table-head { font-size: 11px; }
}

@media (min-width: 1020px) and (max-width: 1199px) {
    .table-head { display: none; }

    .table-row {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 11px 14px;
    }

    .mobile-label::before { display: inline; }
    .inline-progress { grid-column: 1 / -1; }
    .table-row > .row-actions {
        grid-column: 1 / -1;
        justify-content: flex-start;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}

/* V3.1 — Extra-large, high-contrast readability scale */
:root {
    --sidebar-width: 318px;
}

body {
    color: var(--ink);
    font-size: 18px;
    font-weight: 600;
    line-height: 1.82;
}

p,
small,
.text-muted,
.hint,
.form-note {
    color: var(--muted);
}

small { font-weight: 600; }
strong,
b,
h1,
h2,
h3,
h4,
label { font-weight: 850; }

.brand-copy strong { font-size: 21px; }
.brand-copy small { color: #c0d8d2; font-size: 13px; }
.nav-heading { color: #9bc1b8; font-size: 13px; }
.side-nav { gap: 7px; }
.side-nav a { min-height: 56px; font-size: 16px; }
.side-nav a i { font-size: 21px; }
.quran-quote p { font-size: 18px; }
.quran-quote small { color: #afd0c8; font-size: 13px; }
.user-panel strong { font-size: 15px; }
.user-panel small { color: #a9cbc3; font-size: 12px; }

.mobile-brand-copy b { font-size: 15px; }
.mobile-brand-copy small { font-size: 12px; }
.today-label { font-size: 15px; }
.role-chip { padding: 7px 11px; font-size: 12px; }
.bottom-nav i { font-size: 21px; }
.bottom-nav small { font-size: 11.5px; font-weight: 800; }

.page-heading h1 { font-size: clamp(32px, 8vw, 50px); line-height: 1.3; }
.page-heading p { color: var(--ink-soft); font-size: 17px; line-height: 1.9; }
.eyebrow { font-size: 14px; }
.panel-heading h2,
.section-title { font-size: 24px; }
.panel-heading p { color: var(--ink-soft); font-size: 15px; }
.empty-state h3 { font-size: 21px; }
.empty-state p { font-size: 15px; }

.button {
    min-height: 52px;
    padding: 11px 19px;
    font-size: 15px;
    font-weight: 900;
}

.button-sm { min-height: 44px; font-size: 14px; }
.button-lg { min-height: 58px; font-size: 17px; }
.link-button { font-size: 14px; }
.alert { font-size: 15px; }

.hero h1 { font-size: clamp(32px, 7vw, 48px); }
.hero p { color: #e0eeea; font-size: 17px; }
.hero-date span,
.hero-date small { color: #d0e4df; font-size: 13px; }
.hero-date strong { font-size: 35px; }

.stat-card { min-height: 126px; }
.stat-card span { color: var(--ink-soft); font-size: 14px; }
.stat-card strong { font-size: 32px; }
.stat-card small { color: var(--muted); font-size: 13px; }
.stat-card .stat-text-value { font-size: 19px; }

.circle-card h2 { font-size: 21px; }
.circle-card > p { color: var(--ink-soft); font-size: 15px; }
.circle-meta b { font-size: 18px; }
.circle-meta small { font-size: 13px; }
.type-badge,
.status-badge { padding: 7px 11px; font-size: 13px; }

.form-control {
    min-height: 56px;
    padding: 12px 15px;
    color: var(--ink);
    font-size: 17px;
    font-weight: 650;
}

.form-control::placeholder { color: #71847f; opacity: 1; }
textarea.form-control { min-height: 132px; }
.form-section h3 { font-size: 20px; }
.form-section-note { color: var(--ink-soft); font-size: 15px; }
.field label { color: var(--ink); font-size: 15px; }
.field .hint,
.hint { color: var(--muted); font-size: 13px; }
.checkbox-line { color: var(--ink-soft); font-size: 15px; }
.check-chip span { color: var(--ink-soft); font-size: 14px; }
.password-toggle { font-size: 13px; }
.form-note { font-size: 14px; }

.data-row strong { font-size: 17px; }
.data-row small { color: var(--muted); font-size: 14px; }
.mobile-label { color: var(--ink-soft); font-size: 15px; }
.mobile-label::before { color: var(--muted); font-weight: 700; }
.inline-progress b { font-size: 14px; }
.table-head { color: var(--ink-soft); font-size: 14px; }

.profile-card h2 { font-size: 26px; }
.profile-card > p { color: var(--ink-soft); font-size: 15px; }
.info-list div { font-size: 15px; }
.info-list span { color: var(--muted); }
.progress-tile span { color: var(--muted); font-size: 14px; }
.progress-tile strong { font-size: 18px; }
.timeline-item h4 { font-size: 17px; }
.timeline-item p { color: var(--ink-soft); font-size: 15px; }
.timeline-meta { color: var(--muted); font-size: 13px; }
.attendance-choice span { min-height: 46px; color: var(--ink-soft); font-size: 14px; }
.page-link { font-size: 14px; }

.login-mobile-brand strong { font-size: 22px; }
.login-mobile-brand small { font-size: 14px; }
.login-form-heading h1 { font-size: clamp(36px, 9vw, 48px); }
.login-form-heading p { color: var(--ink-soft); font-size: 16px; }
.login-form .form-control { font-size: 18px; }
.login-security-note p { font-size: 14px; }
.login-footer { color: var(--muted); font-size: 13px; }
.login-verse small { color: #c4dbd5; font-size: 14px; }
.login-feature-list div { color: #e0eeea; font-size: 15px; }
.login-note { color: #b5d2cb; font-size: 14px; }

.attendance-summary-card span { color: inherit; font-size: 14px; }
.attendance-summary-card strong { font-size: 35px; }
.exam-card-footer small { font-size: 13px; }
.exam-notes strong { font-size: 16px; }
.exam-notes p { color: var(--ink-soft); font-size: 15px; }
.nominee-card strong { font-size: 17px; }
.nominee-card small { color: var(--muted); font-size: 14px; }
.result-score strong { font-size: 17px; }
.result-score small { font-size: 14px; }
.candidate-note { color: var(--ink-soft); font-size: 15px; }
.grading-meta { color: var(--muted); font-size: 13px; }
.result-editor > summary { font-size: 15px; }

.status-badge.present,
.status-badge.exam-open { color: #075e4e; }
.status-badge.absent,
.status-badge.result-failed { color: #8d2f2b; }
.status-badge.late,
.status-badge.result-absent { color: #765019; }
.status-badge.excused,
.status-badge.exam-completed,
.status-badge.result-passed { color: #245b72; }
.status-badge.inactive,
.status-badge.exam-draft,
.status-badge.result-pending { color: #4f625d; }

@media (max-width: 1019px) {
    .sidebar { width: min(92vw, 336px); }
    .topbar { min-height: 76px; }
    .page-content { padding-bottom: calc(106px + env(safe-area-inset-bottom)); }
    .bottom-nav { height: 76px; }
}

@media (min-width: 720px) {
    .stat-card { min-height: 132px; }
}

@media (min-width: 1020px) {
    .table-head { font-size: 14px; }
    .page-content { padding-inline: 38px; }
}

/* V4.0 — Support roles, library, programs, and public-site management */
.sidebar { overflow-y: auto; overscroll-behavior: contain; }
.bottom-nav { grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); }
.field-span-2 { grid-column: 1 / -1; }
.long-copy { margin: 0; color: var(--ink-soft); font-size: 16px; line-height: 2; white-space: pre-line; overflow-wrap: anywhere; }
.module-actions { display: grid; gap: 10px; }
.dashboard-grid.single-column { grid-template-columns: minmax(0, 1fr); }
.stat-card-link { color: inherit; transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition); }
.stat-card-link:hover { transform: translateY(-3px); border-color: #b8d4cc; box-shadow: 0 14px 32px rgba(7, 63, 55, .12); }
.content-editor { min-height: 310px; line-height: 1.9; }
.form-control[type="file"] { min-height: 62px; padding-block: 11px; }
.form-control[type="file"]::file-selector-button { margin-inline: 0 12px; padding: 9px 13px; color: var(--green-700); border: 0; border-radius: 10px; background: var(--green-50); font: inherit; font-weight: 900; cursor: pointer; }

.staff-card .info-list b,
.library-card .info-list b,
.program-card .info-list b,
.cms-card .info-list b { white-space: normal; text-align: start; overflow-wrap: anywhere; }

.library-card-cover,
.cms-card-cover {
    height: 180px;
    margin: -17px -17px 16px;
    display: grid;
    place-items: center;
    overflow: hidden;
    color: var(--green-700);
    border-radius: 20px 20px 11px 11px;
    background: linear-gradient(145deg, var(--green-50), var(--gold-soft));
    font-size: 54px;
}

.library-card-cover img,
.cms-card-cover img { width: 100%; height: 100%; object-fit: cover; }
.library-detail-cover { width: min(180px, 60%); max-height: 250px; margin: 0 auto 18px; object-fit: cover; border-radius: 16px; box-shadow: 0 14px 32px rgba(9, 31, 27, .14); }

.media-admin-grid { display: grid; gap: 12px; }
.media-admin-card { min-width: 0; padding: 12px; display: grid; grid-template-columns: 68px minmax(0, 1fr); align-items: center; gap: 11px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-soft); }
.media-admin-card > img,
.media-file-icon { width: 68px; height: 68px; border-radius: 12px; object-fit: cover; }
.media-file-icon { display: grid; place-items: center; color: #fff; background: var(--green-700); font-size: 17px; font-weight: 900; }
.media-admin-card > div:not(.media-file-icon) { min-width: 0; }
.media-admin-card strong,
.media-admin-card small { display: block; }
.media-admin-card strong { overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.media-admin-card small { color: var(--muted); font-size: 12px; }
.media-admin-card form { grid-column: 1 / -1; }

a[aria-disabled="true"] { opacity: .55; pointer-events: none; }

@media (min-width: 560px) {
    .module-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .media-admin-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 720px) {
    .module-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .media-admin-card { grid-template-columns: 74px minmax(0, 1fr) auto; }
    .media-admin-card > img,
    .media-file-icon { width: 74px; height: 74px; }
    .media-admin-card form { grid-column: auto; }
}

@media (min-width: 1020px) {
    .library-card-cover,
    .cms-card-cover { height: 210px; }
    .media-admin-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .media-admin-card { grid-template-columns: 62px minmax(0, 1fr); }
    .media-admin-card > img,
    .media-file-icon { width: 62px; height: 62px; }
    .media-admin-card form { grid-column: 1 / -1; }
}
