/* ==========================================================================
   Design System — madrassa-ms
   مصدر التوكنات: docs/ui-ux-design-system.md (نسخة مرجعية عامة)
   قاعدة: لا تُستخدم قيم لون/مسافة/زاوية خارج هذه التوكنات.
   ========================================================================== */

:root {
    /* Brand */
    --c-navy: #1F3552;
    --c-teal: #14876F;
    --c-amber: #F2B72E;

    /* Surfaces */
    --c-bg: #F2F5F8;
    --c-card: #FFFFFF;

    /* Text */
    --c-text: #1F3552;
    --c-muted: #7A8798;
    --c-danger: #C0392B;

    /* Lines */
    --c-line: #D7DEE8;
    --c-line-soft: #E7ECF3;
    --c-line-softer: #EEF2F7;

    /* Feedback */
    --c-ok-bg: #E4F2EE;
    --c-ok-text: #14876F;
    --c-warn-bg: #FDEECC;
    --c-warn-text: #8A6111;
    --c-info-bg: #E3ECF6;
    --c-danger-bg: #FDECEA;

    /* Shape */
    --radius: 16px;
    --radius-lg: 24px;
    --radius-pill: 999px;

    /* Elevation */
    --shadow-1: 0 1px 4px rgba(31, 53, 82, .08);
    --shadow-2: 0 -2px 12px rgba(31, 53, 82, .10);

    /* Bootstrap bridge (keeps existing markup on the same tokens) */
    --bs-body-bg: var(--c-bg);
    --bs-body-color: var(--c-text);
    --bs-border-color: var(--c-line);
    --bs-border-radius: var(--radius);
    --bs-border-radius-lg: var(--radius-lg);
    --bs-link-color: var(--c-teal);
    --bs-link-hover-color: #117A65;
    --bs-font-sans-serif: 'Cairo', 'Tajawal', system-ui, sans-serif;
    --primary: var(--c-navy);
    --secondary: var(--c-teal);
    --accent: var(--c-amber);
}

/* ---------- Base ---------- */
html { -webkit-text-size-adjust: 100%; }

body {
    background-color: var(--c-bg) !important;
    color: var(--c-text) !important;
    font-family: 'Cairo', 'Tajawal', system-ui, sans-serif !important;
    font-size: 16px !important;
    line-height: 1.6 !important;
    padding-bottom: 40px;
}

h1, h2, h3, h4, h5, h6 { color: var(--c-navy); margin-top: 0; }
h1 { font-size: 22px !important; font-weight: 800 !important; line-height: 1.3; }
h2 { font-size: 17px !important; font-weight: 800 !important; line-height: 1.3; }
h3 { font-size: 17px !important; font-weight: 800 !important; }
h4 { font-size: 16px !important; font-weight: 800 !important; }
h5 { font-size: 15px !important; font-weight: 800 !important; }
h6 { font-size: 14px !important; font-weight: 800 !important; }

p, li, td, th, .form-control, .form-select { font-size: 16px; }
small, .small, .text-muted { color: var(--c-muted) !important; }
a { color: var(--c-teal); text-decoration: none; }
a:hover { color: #117A65; }

.container,
.container-fluid {
    max-width: 1080px !important;
    padding-inline: 16px !important;
}

/* ---------- Cards ---------- */
.card {
    background: var(--c-card) !important;
    border: 0 !important;
    border-radius: var(--radius) !important;
    box-shadow: var(--shadow-1) !important;
    margin-bottom: 12px;
    color: var(--c-text);
}
.card:hover { transform: none !important; }
.card-header,
.card-footer { background: transparent !important; border-color: var(--c-line-softer) !important; }
.card .border,
.card .border-top { border-color: var(--c-line-softer) !important; }
.rounded-4 { border-radius: var(--radius) !important; }
.rounded-3 { border-radius: 12px !important; }

/* ---------- Buttons ----------
   نمط موحّد لكل أزرار المنصة، مطابق لبطاقات الوصول السريع:
   أبيض بإطار كحلي، وعند التمرير تعبئة كحلية + رفع + ظل */
.btn,
.ds-btn,
.settings-btn,
.tertiary-btn {
    --bs-btn-focus-box-shadow: none;
    background: #fff !important;
    border: 1.5px solid var(--c-navy) !important;
    border-radius: var(--radius) !important;
    color: var(--c-navy) !important;
    padding: 11px 18px !important;
    font-weight: 700 !important;
    font-size: 15px !important;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    box-shadow: none !important;
    transition: transform .18s ease, box-shadow .18s ease, background-color .18s ease,
                border-color .18s ease, color .18s ease;
}

.btn:hover,
.ds-btn:hover,
.settings-btn:hover,
.tertiary-btn:hover {
    background-color: var(--c-navy) !important;
    border-color: var(--c-navy) !important;
    color: #fff !important;
    transform: translateY(-3px) scale(1.01) !important;
    box-shadow: 0 10px 22px rgba(31, 53, 82, .18) !important;
}

.btn:focus-visible,
.ds-btn:focus-visible,
.settings-btn:focus-visible,
.tertiary-btn:focus-visible {
    background-color: var(--c-navy) !important;
    border-color: var(--c-navy) !important;
    color: #fff !important;
    transform: translateY(-3px) scale(1.01) !important;
    box-shadow: 0 10px 22px rgba(31, 53, 82, .18) !important;
    outline: 2px solid var(--c-teal) !important;
    outline-offset: 2px;
}

.btn:active,
.ds-btn:active,
.settings-btn:active,
.tertiary-btn:active {
    background-color: #16273D !important;
    border-color: #16273D !important;
    color: #fff !important;
    transform: translateY(-1px) scale(1) !important;
}

.btn:disabled,
.btn.disabled,
.ds-btn:disabled { opacity: .5; pointer-events: none; }

.btn-sm { min-height: 36px; padding: 6px 14px !important; font-size: 13px !important; border-radius: var(--radius-pill) !important; }
.btn-lg { min-height: 52px; padding: 14px 24px !important; font-size: 16px !important; }

/* حالة التحديد (فلاتر الصفحات) — نفس تعبئة التمرير حتى يظهر الفلتر النشط */
.btn.active,
.btn-primary.active,
.btn-outline-primary.active,
.btn-secondary.active,
.btn-outline-secondary.active,
.btn-success.active,
.btn-outline-success.active,
.btn-dark.active,
.btn-outline-info.active {
    background-color: var(--c-navy) !important;
    border-color: var(--c-navy) !important;
    color: #fff !important;
    transform: none !important;
    box-shadow: none !important;
}
.btn-warning.active,
.btn-outline-warning.active {
    background-color: var(--c-amber) !important;
    border-color: var(--c-amber) !important;
    color: var(--c-navy) !important;
}
.btn-danger.active,
.btn-outline-danger.active {
    background-color: var(--c-danger) !important;
    border-color: var(--c-danger) !important;
    color: #fff !important;
}

/* أزرار الخطر والتحذير: نفس النمط مع الحفاظ على دلالة اللون */
.btn-danger,
.btn-outline-danger,
.ds-btn-danger {
    background: #fff !important;
    border-color: var(--c-danger) !important;
    color: var(--c-danger) !important;
}
.btn-danger:hover,
.btn-outline-danger:hover,
.btn-danger:focus-visible,
.btn-outline-danger:focus-visible,
.ds-btn-danger:hover,
.ds-btn-danger:focus-visible {
    background-color: var(--c-danger) !important;
    border-color: var(--c-danger) !important;
    color: #fff !important;
}

.btn-warning,
.btn-amber,
.btn-outline-warning,
.ds-btn-amber {
    background: #fff !important;
    border-color: var(--c-amber) !important;
    color: var(--c-warn-text) !important;
    font-weight: 800 !important;
}
.btn-warning:hover,
.btn-amber:hover,
.btn-outline-warning:hover,
.btn-warning:focus-visible,
.btn-outline-warning:focus-visible,
.ds-btn-amber:focus-visible {
    background-color: var(--c-amber) !important;
    border-color: var(--c-amber) !important;
    color: var(--c-navy) !important;
}

/* الأزرار النصية داخل الجداول تبقى بلا إطار */
.btn-link {
    background: transparent !important;
    border-color: transparent !important;
    color: var(--c-teal) !important;
    box-shadow: none !important;
}
.btn-link:hover,
.btn-link:focus-visible {
    background: transparent !important;
    border-color: transparent !important;
    color: #117A65 !important;
    transform: none !important;
    box-shadow: none !important;
}

.btn:focus { outline: 2px solid var(--c-teal) !important; outline-offset: 2px; }

.text-primary,
.text-success { color: var(--c-teal) !important; }
.text-warning { color: var(--c-warn-text) !important; }
.text-danger { color: var(--c-danger) !important; }
.text-dark { color: var(--c-navy) !important; }
.bg-primary { background-color: var(--c-navy) !important; }
.bg-success { background-color: var(--c-teal) !important; }
.bg-info {
    background-color: var(--c-info-bg) !important;
    color: var(--c-navy) !important;
}
.text-info { color: var(--c-navy) !important; }
.border-primary { border-color: var(--c-navy) !important; }

/* ---------- Fields ---------- */
.form-control,
.form-select,
.form-control-login,
input[type="date"],
input[type="time"] {
    border: 1.5px solid var(--c-line) !important;
    border-radius: var(--radius) !important;
    padding: 12px 16px !important;
    font-size: 16px !important;
    color: var(--c-text) !important;
    background-color: #fff !important;
    min-height: 44px;
}
.form-control::placeholder { color: var(--c-muted) !important; opacity: .9; }
.form-control:focus,
.form-select:focus,
.form-control-login:focus {
    border-color: transparent !important;
    outline: 2px solid var(--c-teal) !important;
    outline-offset: 0;
    box-shadow: none !important;
}
.form-control:disabled,
.form-select:disabled { background: #F5F7FA !important; color: var(--c-muted) !important; }

label,
.form-label,
.label {
    font-size: 13px !important;
    font-weight: 700 !important;
    color: var(--c-muted) !important;
    margin-bottom: 6px;
    display: inline-block;
}
.form-text, .text-muted.small { color: var(--c-muted) !important; }

/* ---------- Badges ---------- */
.badge {
    border-radius: var(--radius-pill) !important;
    padding: 4px 12px !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    min-width: 0;
}
.badge-soft,
.bg-success-subtle { background: var(--c-ok-bg) !important; color: var(--c-ok-text) !important; }
.badge-warn,
.bg-warning-subtle { background: var(--c-warn-bg) !important; color: var(--c-warn-text) !important; }
.badge-blue,
.bg-primary-subtle,
.bg-info-subtle { background: var(--c-info-bg) !important; color: var(--c-navy) !important; }
.badge-danger,
.bg-danger-subtle { background: var(--c-danger-bg) !important; color: var(--c-danger) !important; }
.bg-secondary-subtle { background: var(--c-line-softer) !important; color: var(--c-muted) !important; }
.badge.bg-success { background: var(--c-teal) !important; color: #fff !important; }
.badge.bg-danger { background: var(--c-danger) !important; color: #fff !important; }
.badge.bg-warning { background: var(--c-amber) !important; color: var(--c-navy) !important; }
.badge.bg-primary { background: var(--c-navy) !important; color: #fff !important; }

/* ---------- Alerts & notes ---------- */
.alert {
    border: 0 !important;
    border-radius: var(--radius) !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    padding: 10px 14px !important;
}
.alert-success { background: var(--c-ok-bg) !important; color: var(--c-ok-text) !important; }
.alert-warning { background: var(--c-warn-bg) !important; color: var(--c-warn-text) !important; }
.alert-danger { background: var(--c-danger-bg) !important; color: var(--c-danger) !important; }
.alert-info { background: var(--c-info-bg) !important; color: var(--c-navy) !important; }
.alert-light { background: var(--c-card) !important; color: var(--c-text) !important; border: 1px solid var(--c-line-soft) !important; }

/* ---------- Tables ---------- */
.table { color: var(--c-text) !important; border-color: var(--c-line-softer) !important; }
.table > :not(caption) > * > * { padding: 8px 10px; border-color: var(--c-line-softer) !important; }
.table thead th {
    background: #F7FAFC !important;
    color: var(--c-muted) !important;
    font-size: 12px !important;
    font-weight: 800 !important;
}
.table-hover > tbody > tr:hover > * { background: var(--c-line-softer) !important; }

/* ---------- Progress ---------- */
.progress { height: 8px !important; background: var(--c-line-soft) !important; border-radius: var(--radius-pill) !important; }
.progress-bar { background-color: var(--c-teal) !important; }
.progress-bar.bg-success { background-color: var(--c-teal) !important; }
.progress-bar.bg-warning { background-color: var(--c-amber) !important; }
.progress-bar.bg-danger { background-color: var(--c-danger) !important; }
.progress-bar.bar-strong { background-color: var(--c-teal) !important; }
.progress-bar.bar-mid { background-color: var(--c-amber) !important; }
.progress-bar.bar-weak { background-color: var(--c-danger) !important; }

/* ---------- Top bar (navbar) ---------- */
nav.navbar {
    position: sticky !important;
    top: 0;
    z-index: 20;
    background: var(--c-navy) !important;
    color: #fff !important;
    padding: 10px 16px !important;
    margin-bottom: 16px !important;
    box-shadow: none !important;
    border-bottom: 0 !important;
}
nav.navbar .container-fluid { max-width: 1080px !important; }
nav.navbar .navbar-brand,
nav.navbar .navbar-brand .logo,
nav.navbar .logo { color: #fff !important; font-size: 17px !important; font-weight: 800 !important; }
nav.navbar .navbar-toggler { border-color: rgba(255, 255, 255, .4) !important; }
nav.navbar .navbar-toggler-icon { filter: invert(1) brightness(2); }
nav.navbar .btn {
    background: rgba(255, 255, 255, .12) !important;
    border: 0 !important;
    color: #fff !important;
    border-radius: var(--radius-pill) !important;
    min-height: 36px;
    padding: 6px 14px !important;
    font-size: 13px !important;
    font-weight: 700 !important;
}
nav.navbar .btn:hover { background: rgba(255, 255, 255, .2) !important; }
nav.navbar .btn-outline-secondary,
nav.navbar .btn-outline-primary,
nav.navbar .btn-outline-light { color: #fff !important; border: 0 !important; }
nav.navbar .dropdown-menu { border: 1px solid var(--c-line-soft); border-radius: var(--radius); box-shadow: var(--shadow-1); }
nav.navbar .dropdown-item { color: var(--c-navy); font-size: 14px; }
nav.navbar .dropdown-item:hover { background: var(--c-line-softer); }

/* ---------- DS components ---------- */
.ds-page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin: 4px 0 12px;
}
.ds-page-head h1 { margin-bottom: 2px; }
.ds-page-head p { margin: 0; color: var(--c-muted); font-size: 13px; }
.ds-back { font-size: 20px; color: var(--c-navy); line-height: 1; }

.ds-card { background: var(--c-card); border-radius: var(--radius); box-shadow: var(--shadow-1); padding: 16px; margin-bottom: 12px; }
.ds-card-title { font-size: 15px; font-weight: 800; color: var(--c-navy); margin-bottom: 8px; }
.ds-divider { height: 1px; background: var(--c-line-soft); margin: 8px 0; }

.ds-btn { cursor: pointer; }
.ds-btn:disabled { opacity: .5; cursor: not-allowed; }

.ds-badge { display: inline-block; padding: 4px 12px; border-radius: var(--radius-pill); font-size: 13px; font-weight: 700; }
.ds-badge-soft { background: var(--c-ok-bg); color: var(--c-ok-text); }
.ds-badge-warn { background: var(--c-warn-bg); color: var(--c-warn-text); }
.ds-badge-blue { background: var(--c-info-bg); color: var(--c-navy); }
.ds-badge-danger { background: var(--c-danger-bg); color: var(--c-danger); }

.ds-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.ds-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.ds-pill {
    padding: 8px 14px;
    border-radius: var(--radius-pill);
    font-size: 14px;
    font-weight: 700;
    background: #fff;
    border: 1.5px solid var(--c-line);
    color: var(--c-navy);
    text-decoration: none;
}
.ds-pill:hover { background: #F7FAFC; color: var(--c-navy); }
.ds-pill.active { background: var(--c-teal); border-color: var(--c-teal); color: #fff; }

.ds-stat { text-align: center; }
.ds-stat i { font-size: 20px; color: var(--c-teal); }
.ds-stat .ds-stat-value { font-size: 22px; font-weight: 800; color: var(--c-navy); }
.ds-stat .ds-stat-label { font-size: 11px; color: var(--c-muted); }

.ds-note {
    background: var(--c-warn-bg);
    color: var(--c-warn-text);
    border-radius: var(--radius);
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 700;
}

/* Quick access tiles (admin dashboard) */
.quick-access-btn {
    position: relative;
    width: 100%;
    min-height: 44px;
    padding: 20px 12px;
    background: #fff;
    border: 1.5px solid var(--c-navy) !important;
    border-radius: var(--radius) !important;
    color: var(--c-navy) !important;
    transition: transform .18s ease, box-shadow .18s ease, background-color .18s ease,
                border-color .18s ease, color .18s ease;
}
.quick-access-btn i { color: var(--c-navy); transition: color .18s ease; }

/* Compact inline version of the quick-access tile (used in action rows) */
.quick-access-btn.qa-inline {
    width: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 18px;
    font-size: 15px;
    font-weight: 700;
}

.quick-access-btn:hover,
.quick-access-btn:focus-visible {
    background-color: var(--c-navy) !important;
    border-color: var(--c-navy) !important;
    color: #fff !important;
    transform: translateY(-3px) scale(1.01);
    box-shadow: 0 10px 22px rgba(31, 53, 82, .18) !important;
    outline: none;
}
.quick-access-btn:hover i,
.quick-access-btn:hover span,
.quick-access-btn:focus-visible i,
.quick-access-btn:focus-visible span { color: #fff !important; }

/* Settings / tertiary actions now share the unified button style (see top) */

/* Page action row — same interaction as the quick-access tiles */
.page-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}
.page-actions > .btn,
.page-actions > .settings-btn,
.page-actions > .tertiary-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    margin: 0 !important;
}

@media (max-width: 575.98px) {
    .page-actions { width: 100%; }
    .page-actions > .btn,
    .page-actions > .settings-btn,
    .page-actions > .tertiary-btn { flex: 1 1 100%; }
}

/* Compact icon-only row actions inside tables */
.row-actions {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: nowrap;
}
.row-actions .btn {
    width: 34px;
    height: 34px;
    min-height: 34px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-pill) !important;
    transition: transform .18s ease, box-shadow .18s ease;
}
.row-actions .btn:hover,
.row-actions .btn:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(31, 53, 82, .16);
}
.row-actions .btn i { font-size: 15px; }

/* ---------- Bottom navigation ---------- */
.ds-bottom-nav {
    position: fixed;
    top: auto;
    inset-inline: 0;
    bottom: 0;
    z-index: 50;
    justify-content: space-between;
    align-items: stretch;
    background: var(--c-card);
    border-top: 1px solid #E3E8EF;
    box-shadow: var(--shadow-2);
    display: flex;
    padding-bottom: calc(6px + env(safe-area-inset-bottom));
}
.ds-bottom-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 44px;
    padding: 8px 4px;
    color: var(--c-muted);
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
}
.ds-bottom-nav a i { font-size: 20px; line-height: 1; }
.ds-nav-emoji { font-size: 19px; line-height: 1; display: block; }
.ds-bottom-nav a.active {
    color: var(--c-teal);
    font-weight: 800;
    background: var(--c-ok-bg);
    border-radius: var(--radius);
    margin: 4px 2px;
    box-shadow: none;
}
.ds-bottom-nav a:focus-visible { outline: 2px solid var(--c-teal); outline-offset: -2px; }

body:has(.ds-bottom-nav),
body:has(.ds-bottom-nav-teacher),
body:has(.ds-bottom-nav-student),
body:has(.ds-bottom-nav-admin) { padding-bottom: 96px; }
body:has(.ds-bottom-nav) .mobile-quick-nav { display: none !important; }
@media (min-width: 992px) {
    body:has(.ds-bottom-nav),
    body:has(.ds-bottom-nav-teacher),
    body:has(.ds-bottom-nav-student),
    body:has(.ds-bottom-nav-admin) { padding-bottom: 40px !important; }
}

/* ---------- Login screen ---------- */
body.login-page {
    min-height: 100vh;
    margin: 0;
    padding: clamp(14px, 3.5vw, 36px) !important;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--c-text);
    font-family: 'Cairo', 'Segoe UI', Tahoma, sans-serif;
    background:
        radial-gradient(circle at 10% 6%, #dce9ff 0, transparent 42%),
        radial-gradient(circle at 92% 94%, #d8f6ff 0, transparent 40%),
        linear-gradient(160deg, #eef4ff, #f8fbff 55%, #eef6ff) !important;
}

.login-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.02fr) minmax(0, .98fr);
    grid-template-areas: "form visual";
    width: min(1000px, 100%);
    min-height: min(640px, calc(100vh - 48px));
    overflow: hidden;
    background: #fff;
    border: 1px solid rgb(213 225 246 / 85%);
    border-radius: 30px;
    box-shadow: 0 30px 80px rgb(10 30 90 / 18%);
}

.login-visual {
    grid-area: visual;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 1.25rem;
    padding: clamp(22px, 3.4vw, 40px);
    overflow: hidden;
    isolation: isolate;
    color: #fff;
    background-color: #071a5c;
    background-image: url('/images/student-hero.png');
    background-size: cover;
    background-position: 34% center;
    background-repeat: no-repeat;
}

.login-visual::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    background:
        linear-gradient(180deg, rgb(4 16 64 / 68%) 0%, rgb(4 16 64 / 30%) 36%, rgb(4 16 64 / 52%) 66%, rgb(4 16 64 / 94%) 100%),
        linear-gradient(90deg, rgb(4 16 64 / 12%), rgb(4 16 64 / 50%));
    pointer-events: none;
}

.login-visual > * {
    position: relative;
    z-index: 2;
}

.login-visual__brand {
    display: inline-flex;
    align-items: center;
    gap: .7rem;
    width: fit-content;
    color: #fff;
    text-decoration: none;
}

.login-visual__official {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 0;
    box-shadow: none;
}

.login-visual__official img {
    display: block;
    block-size: clamp(58px, 7vw, 104px);
    inline-size: auto;
    max-inline-size: 260px;
    filter: brightness(1.75) saturate(1.12) drop-shadow(0 0 1.5px rgb(255 255 255 / 75%)) drop-shadow(0 8px 20px rgb(0 10 50 / 45%));
}

.login-visual__copy {
    max-inline-size: 30ch;
    margin-block-start: auto;
}

.login-visual__eyebrow {
    display: inline-block;
    color: #8fe9ff;
    font-size: clamp(.6rem, 1.2vw, .7rem);
    font-weight: 800;
    letter-spacing: .08em;
}

.login-visual__copy h2 {
    margin: .35rem 0 .55rem;
    color: #fff;
    font-size: clamp(1.6rem, 3.2vw, 2.25rem);
    font-weight: 800;
    line-height: 1.3;
    text-shadow: 0 4px 18px rgb(2 10 40 / 45%);
}

.login-visual__copy p {
    margin: 0;
    color: rgb(226 240 255 / 90%);
    font-size: clamp(.8rem, 1.4vw, .95rem);
    font-weight: 600;
    line-height: 1.8;
}

.login-visual__features {
    display: grid;
    gap: .5rem;
    margin: 1.1rem 0 0;
    padding: 0;
    list-style: none;
}

.login-visual__features li {
    display: flex;
    align-items: center;
    gap: .5rem;
    color: #eaf4ff;
    font-size: clamp(.68rem, 1.2vw, .78rem);
    font-weight: 700;
}

.login-visual__feature-icon {
    display: inline-grid;
    place-items: center;
    flex: none;
    inline-size: 28px;
    block-size: 28px;
    color: #fff;
    background: rgb(255 255 255 / 14%);
    border: 1px solid rgb(255 255 255 / 20%);
    border-radius: 9px;
}

.login-visual__feature-icon .student-line-icon {
    inline-size: 15px;
    block-size: 15px;
}

.login-visual__foot {
    margin: 0;
    color: rgb(213 235 255 / 62%);
    font-size: .64rem;
    font-weight: 700;
}

.login-panel {
    grid-area: form;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(24px, 4vw, 52px);
    background: linear-gradient(180deg, #fff, #f7faff);
}

.login-card {
    width: 100%;
    max-inline-size: 360px;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.login-brand {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: 1.5rem;
    text-align: start;
}

.login-brand img {
    flex: none;
    inline-size: 54px;
    block-size: 54px;
    margin: 0;
    object-fit: cover;
    background: #fff;
    border: 1px solid #e3ebfa;
    border-radius: 16px;
    box-shadow: 0 8px 20px rgb(20 50 120 / 10%);
}

.login-brand__text {
    min-inline-size: 0;
}

.login-brand__school {
    display: block;
    color: #1e6bff;
    font-size: .68rem;
    font-weight: 800;
    line-height: 1.4;
}

.login-brand h1 {
    margin: .12rem 0 0;
    color: #101b4a;
    font-size: clamp(1.2rem, 4vw, 1.45rem) !important;
    font-weight: 800 !important;
    line-height: 1.3;
}

.login-brand p {
    margin: .15rem 0 0;
    color: #8a97b5;
    font-size: .74rem;
    font-weight: 700;
}

.login-field {
    margin-bottom: .8rem;
}

.login-field label {
    display: block;
    margin-bottom: .32rem;
    color: #5b6b8f !important;
    font-size: .78rem !important;
    font-weight: 800 !important;
}

.login-card .form-control-login {
    inline-size: 100%;
    min-height: 48px;
    padding: .7rem .9rem !important;
    color: #101b4a !important;
    background: #f8fbff !important;
    border: 1.5px solid #dbe6fb !important;
    border-radius: 14px !important;
    font-family: inherit;
    font-size: .9rem !important;
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.login-card .form-control-login::placeholder {
    color: #9aa7c2 !important;
    opacity: 1;
}

.login-card .form-control-login:focus {
    background: #fff !important;
    border-color: #1e6bff !important;
    outline: none !important;
    box-shadow: 0 0 0 4px rgb(30 107 255 / 12%) !important;
}

.login-hint {
    margin-top: .35rem;
    color: #8a97b5;
    font-size: .72rem;
    font-weight: 700;
}

.login-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    inline-size: 100%;
    min-height: 50px;
    margin-top: .5rem;
    padding: .7rem 1rem;
    color: #fff;
    background: linear-gradient(145deg, #2f86ff, #0b46d8);
    border: 0;
    border-radius: 999px;
    box-shadow: 0 12px 24px rgb(17 80 220 / 28%);
    font-family: inherit;
    font-size: .95rem !important;
    font-weight: 800;
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease;
}

.login-submit:hover,
.login-submit:focus-visible {
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 16px 30px rgb(17 80 220 / 34%);
}

.login-submit .student-line-icon {
    inline-size: 18px;
    block-size: 18px;
}

.login-alert {
    margin-bottom: 1rem;
    padding: .7rem .9rem;
    color: #b81f4b;
    background: #ffe4ea;
    border: 1px solid #ffd0da;
    border-radius: 14px;
    font-size: .82rem;
    font-weight: 700;
}

.login-foot {
    margin-top: 1.2rem;
    color: #9aa7c2;
    font-size: .66rem;
    font-weight: 700;
    line-height: 1.7;
    text-align: center;
}

.login-card .alert {
    margin-bottom: 1rem;
}

@media (max-width: 860px) {
    .login-shell {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas: "visual" "form";
        min-height: 0;
        border-radius: 24px;
    }

    .login-visual {
        min-block-size: 190px;
        padding: 18px;
    }

    .login-visual__copy {
        max-inline-size: 70%;
    }

    .login-visual__copy h2 {
        font-size: clamp(1.3rem, 5.6vw, 1.75rem);
    }

    .login-visual__copy p {
        display: none;
    }

    .login-visual__features,
    .login-visual__foot {
        display: none;
    }

    .login-panel {
        padding: 20px 16px 24px;
    }

    .login-brand {
        margin-bottom: 1.1rem;
    }

    .login-field {
        margin-bottom: .7rem;
    }
}

@media (max-width: 860px) and (max-height: 760px) {
    body.login-page {
        display: block !important;
    }
}

@media (max-width: 420px) {
    .login-visual {
        min-block-size: 180px;
    }

    .login-visual__official img {
        block-size: 62px;
    }

    .login-brand img {
        inline-size: 48px;
        block-size: 48px;
    }

    .login-brand h1 {
        font-size: 1.2rem !important;
    }

    .login-brand p {
        font-size: .7rem;
    }
}

/* ---------- Books: PDF upload & reader ---------- */
.book-part-option {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #fff;
    border: 1.5px solid var(--c-line);
    border-radius: var(--radius);
    color: var(--c-navy);
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease;
}
.book-part-option input {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--c-teal);
    cursor: pointer;
}
.book-part-option:hover,
.book-part-option:has(input:checked) {
    border-color: var(--c-navy);
    background: var(--c-line-softer);
}
.book-part-option:has(input:checked) { box-shadow: 0 0 0 3px rgba(31, 53, 82, .10); }

.book-upload-drop {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 28px 16px;
    text-align: center;
    cursor: pointer;
    background: #fff;
    border: 2px dashed var(--c-line);
    border-radius: var(--radius-lg);
    transition: border-color .18s ease, background-color .18s ease, box-shadow .18s ease;
}
.book-upload-drop:hover,
.book-upload-drop:focus-within,
.book-upload-drop.is-dragover {
    border-color: var(--c-navy);
    background: var(--c-line-softer);
    box-shadow: 0 8px 18px rgba(31, 53, 82, .10);
}
.book-upload-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.book-part-row { padding: 14px 0; }
.book-part-row:first-child { padding-top: 0; }
.book-part-row:last-child { padding-bottom: 0; }

.book-reader-frame {
    width: 100%;
    height: calc(100vh - 210px);
    min-height: 480px;
    border: 0;
    border-radius: var(--radius);
    background: #fff;
}
@media (max-width: 767.98px) {
    .book-reader-frame { height: calc(100vh - 250px); min-height: 400px; }
}

/* رابط كتاب المادة داخل خلية الجدول */
.period-book-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    margin-top: 4px;
    border-radius: var(--radius-pill);
    background: #fff;
    border: 1.5px solid var(--c-navy);
    color: var(--c-navy);
    font-size: 12px;
    line-height: 1;
    text-decoration: none;
    transition: background-color .18s ease, color .18s ease;
}
.period-book-link:hover,
.period-book-link:focus-visible {
    background: var(--c-navy);
    color: #fff;
}

/* ---------- Modals ---------- */
.modal-backdrop.show { background: rgba(15, 23, 42, .45); }
.modal-content { border: 0 !important; border-radius: var(--radius-lg) !important; box-shadow: 0 4px 16px rgba(15, 23, 42, .18) !important; }
.modal-header, .modal-footer { border-color: var(--c-line-softer) !important; }

/* ---------- Misc ---------- */
.dropdown-menu { border-radius: var(--radius); border-color: var(--c-line-soft); box-shadow: var(--shadow-1); }
.list-group-item { border-color: var(--c-line-softer); }
.breadcrumb { font-size: 13px; }
.pagination .page-link { color: var(--c-navy); }
.pagination .active > .page-link { background: var(--c-teal); border-color: var(--c-teal); }

:focus-visible { outline: 2px solid var(--c-teal); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

@media (max-width: 480px) {
    .card, .ds-card { padding: 12px; }
    h1 { font-size: 20px !important; }
    .btn { font-size: 15px !important; padding: 10px 16px !important; }
    .container, .container-fluid { padding-inline: 12px !important; }
}

/* ==========================================================================
   غرفة البث الصوتي المباشر للدرس (lesson_room_live.ejs)
   ========================================================================== */
.ds-room {
    position: relative;
    background: var(--c-card);
    border: 1px solid var(--c-line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-1);
    overflow: hidden;
}

/* CLASSROOM-TEACHER-PRESENCE-03: إشعار مغادرة المعلم المؤقتة (يظهر ويختفي من حالة V71) */
.ds-room-away {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 12px;
    margin-bottom: 12px;
    padding: 12px 16px;
    background: var(--c-warn-bg);
    color: var(--c-warn-text);
    border: 1.5px solid var(--c-amber);
    border-radius: var(--radius);
    font-weight: 600;
}

.ds-room-away[hidden] { display: none; }
.ds-room-away .ds-room-away-time {
    font-weight: 400;
    font-size: .85rem;
}

.ds-room-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: var(--c-navy);
    color: #fff;
}

.ds-room-live {
    width: 10px;
    height: 10px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--c-danger);
    animation: ds-room-pulse 1.8s infinite;
}

@keyframes ds-room-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(255, 255, 255, .55); }
    70%  { box-shadow: 0 0 0 9px rgba(255, 255, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}

.ds-room-title { font-weight: 700; line-height: 1.35; }
.ds-room-sub { font-size: 12.5px; opacity: .78; }

.ds-room-count {
    margin-inline-start: auto;
    background: rgba(255, 255, 255, .16);
    border-radius: var(--radius-pill);
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.ds-room-icon {
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, .45);
    background: transparent;
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 16px;
    transition: background .15s ease, border-color .15s ease;
}

.ds-room-icon:hover,
.ds-room-icon:focus-visible { background: rgba(255, 255, 255, .18); border-color: #fff; }

.ds-room-content {
    border-bottom: 1px solid var(--c-line-soft);
    background: var(--c-card);
    padding: 12px 16px;
}

.ds-room-content-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.ds-room-content-tab {
    border: 1px solid var(--c-line-soft);
    background: transparent;
    border-radius: 999px;
    padding: 4px 14px;
    font-size: .9rem;
    color: var(--c-muted, #7A8798);
    cursor: pointer;
}

.ds-room-content-tab.is-active {
    background: var(--c-navy, #1F3552);
    border-color: var(--c-navy, #1F3552);
    color: #fff;
}

.ds-room-content-video {
    display: block;
    width: 100%;
    max-height: 360px;
    border-radius: 12px;
    background: #000;
}

.ds-room-content-panel[hidden],
.ds-room-stage .ds-room-content-panel[hidden] {
    display: none !important;
}

.ds-room-people {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 4px 0;
}

.ds-room-people-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: var(--radius-pill);
    border: 1.5px solid rgba(255, 255, 255, .45);
    background: transparent;
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
}

.ds-room-people-pop {
    position: absolute;
    top: 64px;
    inset-inline-end: 16px;
    z-index: 20;
    width: min(320px, calc(100% - 32px));
    padding: 14px;
    border-radius: var(--radius-lg, 16px);
    background: var(--c-card);
    box-shadow: var(--shadow-2, 0 12px 32px rgba(0, 0, 0, .25));
}

.ds-room-people-pop[hidden] { display: none; }

.ds-room-people-pop-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.ds-room-people-invite {
    width: 100%;
    margin-top: 12px;
    padding: 10px;
    border-radius: var(--radius-pill);
    border: 0;
    background: var(--c-navy, #1F3552);
    color: #fff;
    font-weight: 700;
}

.ds-room-people-invite:disabled { opacity: .55; cursor: not-allowed; }

.ds-room-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: var(--radius-pill);
    background: var(--c-info-bg);
    color: var(--c-navy);
    font-size: 13px;
    font-weight: 600;
    max-width: 100%;
}

.ds-room-chip .bi { font-size: 12px; }
.ds-room-chip.is-live { background: var(--c-ok-bg); color: var(--c-ok-text); }
.ds-room-chip.is-me { box-shadow: inset 0 0 0 1.5px var(--c-navy); }

.ds-room-log {
    height: min(56vh, 480px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 10px 14px;
    background: var(--c-card);
}

.ds-room-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 12px;
    border-inline-start: 3px solid transparent;
}

.ds-room-row + .ds-room-row { margin-top: 4px; }

.ds-room-row.is-join { background: var(--c-ok-bg); border-inline-start-color: var(--c-teal); }
.ds-room-row.is-leave { background: var(--c-danger-bg); border-inline-start-color: var(--c-danger); }
.ds-room-row.is-chat { background: var(--c-line-softer); border-inline-start-color: var(--c-navy); }
.ds-room-row.is-system { background: var(--c-warn-bg); border-inline-start-color: var(--c-amber); }

.ds-room-avatar {
    width: 32px;
    height: 32px;
    flex: 0 0 auto;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--c-ok-bg);
    color: var(--c-teal);
    font-size: 13px;
    font-weight: 700;
    overflow: hidden;
}

.ds-room-row.is-leave .ds-room-avatar { background: var(--c-danger-bg); color: var(--c-danger); }
.ds-room-row.is-chat .ds-room-avatar { background: var(--c-info-bg); color: var(--c-navy); }

.ds-room-body { min-width: 0; flex: 1 1 auto; }
.ds-room-name { font-weight: 700; color: var(--c-text); font-size: 14px; }
.ds-room-text { color: var(--c-text); font-size: 14px; word-break: break-word; }
.ds-room-verb { font-weight: 600; color: var(--c-muted); }
.ds-room-time {
    margin-inline-start: auto;
    flex: 0 0 auto;
    color: var(--c-muted);
    font-size: 11.5px;
    font-variant-numeric: tabular-nums;
}

.ds-room-empty {
    padding: 26px 10px;
    text-align: center;
    color: var(--c-muted);
    font-size: 14px;
}

.ds-room-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-top: 1px solid var(--c-line-soft);
    background: var(--c-bg);
}

.ds-room-mic {
    width: 54px;
    height: 54px;
    flex: 0 0 auto;
    border-radius: 50%;
    border: 1.5px solid var(--c-navy);
    background: var(--c-card);
    color: var(--c-navy);
    font-size: 21px;
    display: grid;
    place-items: center;
    transition: background .15s ease, color .15s ease, transform .15s ease;
}

.ds-room-mic:hover { background: var(--c-navy); color: #fff; }

.ds-room-mic.is-live {
    background: var(--c-teal);
    border-color: var(--c-teal);
    color: #fff;
    animation: ds-room-pulse 1.8s infinite;
}

.ds-room-input {
    flex: 1 1 auto;
    min-width: 0;
    height: 46px;
    border: 1px solid var(--c-line);
    border-radius: var(--radius-pill);
    background: var(--c-card);
    color: var(--c-text);
    padding: 0 16px;
    font-size: 14.5px;
}

.ds-room-input:focus { outline: none; border-color: var(--c-teal); }

.ds-room-send {
    width: 46px;
    height: 46px;
    flex: 0 0 auto;
    border: none;
    border-radius: 50%;
    background: var(--c-teal);
    color: #fff;
    font-size: 18px;
    display: grid;
    place-items: center;
}

.ds-room-send:hover { background: var(--c-navy); }
.ds-room-send:disabled { opacity: .55; }

.ds-room-hint {
    padding: 10px 18px 14px;
    margin: 0;
    font-size: 12.5px;
    color: var(--c-muted);
    background: var(--c-bg);
}

.ds-room-hint.is-warn { color: var(--c-danger); }

/* ── LIVE-03: رفع اليد وطلب المشاركة ── */
.ds-room-chip-hand {
    margin-inline-start: 6px;
    font-size: 12px;
    color: var(--c-amber);
    animation: ds-room-pulse 1.8s infinite;
}

.ds-room-mic.is-locked {
    border-style: dashed;
    border-color: var(--c-muted);
    color: var(--c-muted);
    background: var(--c-bg);
}

.ds-room-mic.is-locked:hover { background: var(--c-bg); color: var(--c-muted); }

.ds-room-hand {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 46px;
    flex: 0 0 auto;
    padding: 0 14px;
    border-radius: var(--radius-pill);
    border: 1.5px solid var(--c-navy);
    background: var(--c-card);
    color: var(--c-navy);
    font-size: 13.5px;
    font-weight: 700;
    white-space: nowrap;
    transition: background .15s ease, color .15s ease, transform .15s ease;
}

.ds-room-hand:hover { background: var(--c-navy); color: #fff; }
.ds-room-hand.is-waiting { border-color: var(--c-amber); color: var(--c-warn-text); background: var(--c-warn-bg); }
.ds-room-hand.is-granted { border-color: var(--c-teal); background: var(--c-teal); color: #fff; }

.ds-room-hand-label { display: inline-block; }

.ds-room-floor {
    border-top: 1px solid var(--c-line-soft);
    background: var(--c-card);
    padding: 10px 16px 12px;
}

.ds-room-floor-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.ds-room-floor-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 13.5px;
    color: var(--c-navy);
}

.ds-room-floor-count {
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    border-radius: var(--radius-pill);
    background: var(--c-navy);
    color: #fff;
    font-size: 12px;
    display: inline-grid;
    place-items: center;
}

.ds-room-floor-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 12px;
    border-radius: var(--radius);
    border: 1.5px solid var(--c-navy);
    background: var(--c-card);
    color: var(--c-navy);
    font-size: 12.5px;
    font-weight: 600;
}

.ds-room-floor-action:hover { background: var(--c-navy); color: #fff; }

.ds-room-queue { display: grid; gap: 6px; }
.ds-room-floor-empty { color: var(--c-muted); font-size: 12.5px; padding: 4px 0; }

.ds-room-queue-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border: 1px solid var(--c-line-soft);
    border-radius: var(--radius);
    background: var(--c-bg);
} 

.ds-room-queue-row.is-active { border-color: var(--c-teal); background: var(--c-ok-bg); }

/* حضور الطلاب اللحظي داخل الغرفة (للمعلم، قراءة فقط) */
.ds-room-attendance {
    border-top: 1px solid var(--c-line-soft);
    background: var(--c-card);
    padding: 10px 16px 12px;
}

.ds-room-attendance-hint {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--c-muted);
}

.ds-room-attendance-list {
    display: grid;
    gap: 6px;
    max-height: 220px;
    overflow-y: auto;
}

.ds-room-att-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    border: 1px solid var(--c-line-soft);
    border-radius: var(--radius);
    background: var(--c-bg);
    font-size: 13px;
}

.ds-room-att-row.is-online { border-color: var(--c-teal); background: var(--c-ok-bg); }
.ds-room-att-row.is-left { opacity: .72; }

.ds-room-att-name { flex: 1 1 auto; font-weight: 600; color: var(--c-text); }

.ds-room-att-class {
    margin-inline-start: 6px;
    font-size: 11.5px;
    font-weight: 500;
    color: var(--c-muted);
}

.ds-room-att-state { font-size: 11.5px; font-weight: 700; color: var(--c-muted); }
.ds-room-att-row.is-online .ds-room-att-state { color: var(--c-teal); }

.ds-room-att-min {
    min-width: 46px;
    text-align: end;
    font-size: 12px;
    font-weight: 700;
    color: var(--c-navy);
}

.ds-room-queue-pos {
    width: 24px;
    height: 24px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--c-navy);
    color: #fff;
    font-size: 12px;
    display: inline-grid;
    place-items: center;
}

.ds-room-queue-name { flex: 1 1 auto; font-weight: 600; font-size: 13.5px; color: var(--c-text); }
.ds-room-queue-time { font-size: 11.5px; color: var(--c-muted); }
.ds-room-queue-actions { display: inline-flex; gap: 6px; }

.ds-room-queue-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 30px;
    padding: 0 10px;
    border-radius: var(--radius-pill);
    border: 1.5px solid var(--c-navy);
    background: var(--c-card);
    color: var(--c-navy);
    font-size: 12px;
    font-weight: 600;
}

.ds-room-queue-btn:hover { background: var(--c-navy); color: #fff; }
.ds-room-queue-btn.is-ok { border-color: var(--c-teal); color: var(--c-teal); }
.ds-room-queue-btn.is-ok:hover { background: var(--c-teal); color: #fff; }

@media (max-width: 576px) {
    .ds-room-head { flex-wrap: wrap; padding: 12px 14px; gap: 8px; }
    .ds-room-count { order: 3; }
    .ds-room-log { height: min(48vh, 380px); padding: 8px 10px; }
    .ds-room-mic { width: 48px; height: 48px; font-size: 19px; }
    .ds-room-bar { padding: 10px 12px; gap: 8px; }
    .ds-room-time { font-size: 11px; }
    .ds-room-hand-label { display: none; }
    .ds-room-hand { padding: 0; width: 46px; justify-content: center; }
    .ds-room-floor { padding: 8px 12px 10px; }
    .ds-room-attendance { padding: 8px 12px 10px; }
    .ds-room-attendance-list { max-height: 180px; }
    .ds-room-queue-name { font-size: 12.5px; }
}

/* ══════════════════════════════════════════════════════════════════════════
   CLASSROOM-UI-01-B2: Unified Desktop Classroom Layout (CSS Grid >= 992px)
   ══════════════════════════════════════════════════════════════════════════ */
.ds-room-workspace {
    display: flex;
    flex-direction: column;
    background: var(--c-bg);
}

.ds-room-stage {
    min-width: 0;
    width: 100%;
}

.ds-room-sidebar {
    min-width: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    background: var(--c-card);
}

.ds-room-chat-pane {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 280px;
    background: var(--c-card);
}

.ds-room-chat-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-top: 1px solid var(--c-line-soft);
    background: var(--c-bg);
}

.ds-room-dock {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 18px;
    background: var(--c-card);
    border-top: 1px solid var(--c-line-soft);
}

.ds-room-dock-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
}

.ds-room-dock-info {
    flex: 1 1 auto;
    min-width: 0;
}

.ds-room-dock-meta {
    flex: 0 0 auto;
}

.ds-room-dock-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    background: var(--c-bg);
    border: 1px solid var(--c-line-soft);
    font-size: 12px;
    font-weight: 600;
    color: var(--c-muted);
}

@media (min-width: 992px) {
    .ds-room-workspace {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 340px;
        grid-template-areas: "stage sidebar";
        align-items: stretch;
        min-height: 600px;
    }

    [dir="rtl"] .ds-room-workspace,
    html[lang="ar"] .ds-room-workspace,
    html[lang="ur"] .ds-room-workspace {
        grid-template-columns: 340px minmax(0, 1fr);
        grid-template-areas: "sidebar stage";
    }

    .ds-room-stage {
        grid-area: stage;
        display: flex;
        flex-direction: column;
        border-inline-end: 1px solid var(--c-line-soft);
        background: var(--c-card);
    }

    [dir="rtl"] .ds-room-stage,
    html[lang="ar"] .ds-room-stage,
    html[lang="ur"] .ds-room-stage {
        border-inline-end: none;
        border-inline-start: 1px solid var(--c-line-soft);
    }

    .ds-room-stage .ds-room-content,
    .ds-room-stage .ds-room-whiteboard-standalone {
        margin-bottom: 0;
        border: none;
        border-radius: 0;
        flex: 1 1 auto;
        display: flex;
        flex-direction: column;
    }

    .ds-room-stage .ds-room-content-panel[data-content-panel="whiteboard"],
    .ds-room-stage .ds-whiteboard-wrap {
        flex: 1 1 auto;
        display: flex;
        flex-direction: column;
        height: 100%;
    }

    .ds-room-stage .ds-whiteboard-canvas-box {
        flex: 1 1 auto;
        height: 100%;
        min-height: 520px;
    }

    .ds-room-sidebar {
        grid-area: sidebar;
        border-top: none;
        border-radius: 0;
        overflow: hidden;
    }

    .ds-room-sidebar .ds-room-floor {
        border-top: none;
        border-bottom: 1px solid var(--c-line-soft);
        padding: 8px 12px;
        max-height: 220px;
        overflow-y: auto;
    }

    .ds-room-sidebar .ds-room-attendance {
        border-top: none;
        border-bottom: 1px solid var(--c-line-soft);
        padding: 8px 12px;
        max-height: 220px;
        overflow-y: auto;
    }

    .ds-room-sidebar .ds-room-log {
        flex: 1 1 auto;
        height: 100%;
        max-height: 440px;
        min-height: 240px;
        border-top: none;
    }
}

/* ══════════════════════════════════════════════════════════════════════════
   CLASSROOM-UI-01-B3: Responsive Mobile Classroom Layout (< 992px)
   ══════════════════════════════════════════════════════════════════════════ */
.ds-room-mobile-switcher {
    display: none;
}

@media (max-width: 991.98px) {
    .ds-room-mobile-switcher {
        display: flex;
        gap: 8px;
        padding: 8px 12px;
        background: var(--c-bg);
        border-bottom: 1px solid var(--c-line-soft);
    }

    .ds-room-mobile-tab {
        flex: 1 1 50%;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        height: 40px;
        padding: 0 14px;
        border: 1.5px solid var(--c-line-soft);
        border-radius: var(--radius-pill);
        background: var(--c-card);
        color: var(--c-navy);
        font-size: 13.5px;
        font-weight: 700;
        cursor: pointer;
        transition: all 0.15s ease;
    }

    .ds-room-mobile-tab:hover {
        background: var(--c-line-soft);
    }

    .ds-room-mobile-tab.is-active {
        background: var(--c-teal);
        border-color: var(--c-teal);
        color: #fff;
    }

    /* التبديل بين اللوحتين دون إزالة العناصر من شجرة DOM لتفادي انقطاع LiveKit أو WebSocket */
    .ds-room-workspace[data-mobile-view="stage"] .ds-room-sidebar {
        display: none !important;
    }

    .ds-room-workspace[data-mobile-view="stage"] .ds-room-stage {
        display: flex !important;
    }

    .ds-room-workspace[data-mobile-view="interaction"] .ds-room-stage {
        display: none !important;
    }

    .ds-room-workspace[data-mobile-view="interaction"] .ds-room-sidebar {
        display: flex !important;
    }

    /* أبعاد الكانفاس المتجاوبة على شاشات الجوال */
    .ds-whiteboard-canvas-box {
        height: 380px;
        min-height: 280px;
    }

    .ds-whiteboard-toolbar {
        gap: 4px;
        padding: 6px 8px;
    }

    .ds-whiteboard-btn {
        width: 30px;
        height: 30px;
        font-size: 13px;
    }

    /* رصيف التحكم السفلي الثابت لشاشات اللمس (Thumb Zone) */
    .ds-room-dock {
        position: sticky;
        bottom: 0;
        z-index: 30;
        padding: 8px 12px;
        background: var(--c-card);
        border-top: 1.5px solid var(--c-line-soft);
        box-shadow: 0 -3px 12px rgba(0, 0, 0, 0.08);
    }

    .ds-room-dock-actions {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: space-around;
        gap: 10px;
    }

    .ds-room-dock-info,
    .ds-room-dock-meta {
        display: none;
    }

    .ds-room-mic {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }

    .ds-room-hand {
        height: 48px;
        padding: 0 16px;
        font-size: 13.5px;
    }

    /* حماية من أي تجاوز أفقي (No Horizontal Overflow) */
    .ds-room,
    .ds-room-workspace,
    .ds-room-stage,
    .ds-room-sidebar {
        overflow-x: hidden;
        max-width: 100vw;
    }
}

/* ══════════════════════════════════════════════════════════════════════════
   Whiteboard (السبورة التفاعلية)
   ══════════════════════════════════════════════════════════════════════════ */
.ds-room-whiteboard-standalone {
    background: var(--c-card);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 14px;
    overflow: hidden;
}

.ds-whiteboard-wrap {
    display: flex;
    flex-direction: column;
    width: 100%;
    background: #ffffff;
    border-radius: var(--radius-md);
    overflow: hidden;
    position: relative;
}

.ds-whiteboard-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 12px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    user-select: none;
}

.ds-whiteboard-group {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.ds-whiteboard-divider {
    width: 1px;
    height: 22px;
    background: #cbd5e1;
    margin: 0 4px;
}

.ds-whiteboard-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: #475569;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.ds-whiteboard-btn:hover:not(:disabled) {
    background: #e2e8f0;
    color: #0f172a;
}

.ds-whiteboard-btn.is-active {
    background: #0284c7;
    color: #ffffff;
    border-color: #0284c7;
    box-shadow: 0 1px 2px rgba(2, 132, 199, 0.25);
}

.ds-whiteboard-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.ds-whiteboard-btn-danger:hover:not(:disabled) {
    background: #fee2e2;
    color: #dc2626;
    border-color: #fca5a5;
}

.ds-whiteboard-color {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid #ffffff;
    background: var(--wb-swatch, #000);
    box-shadow: 0 0 0 1px #cbd5e1;
    padding: 0;
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.15s ease;
}

.ds-whiteboard-color:hover {
    transform: scale(1.15);
}

.ds-whiteboard-color.is-active {
    transform: scale(1.18);
    box-shadow: 0 0 0 2px #0284c7, 0 2px 4px rgba(0,0,0,0.15);
}

.ds-whiteboard-color-picker-label {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    color: #64748b;
    font-size: 14px;
    margin-right: 2px;
}

.ds-whiteboard-color-picker-label:hover {
    color: #0284c7;
}

.ds-whiteboard-color-picker {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    left: 0;
    top: 0;
    cursor: pointer;
}

.ds-whiteboard-width-btn {
    width: 30px;
    height: 30px;
}

.ds-wb-dot {
    display: inline-block;
    background: currentColor;
    border-radius: 50%;
}
.ds-wb-dot-sm { width: 4px; height: 4px; }
.ds-wb-dot-md { width: 8px; height: 8px; }
.ds-wb-dot-lg { width: 14px; height: 14px; }

.ds-whiteboard-readonly-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: #f1f5f9;
    color: #475569;
    font-size: 13px;
    font-weight: 500;
    border-bottom: 1px solid #e2e8f0;
}

.ds-whiteboard-readonly-banner i {
    color: #0284c7;
    font-size: 16px;
}

.ds-whiteboard-status {
    font-size: 11.5px;
    color: #64748b;
    margin-right: auto;
    padding: 0 6px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: opacity 0.2s ease;
}
.ds-whiteboard-status.is-saving { color: #0284c7; }
.ds-whiteboard-status.is-error { color: #dc2626; }

.ds-whiteboard-canvas-box {
    position: relative;
    width: 100%;
    height: 520px;
    min-height: 360px;
    background: #ffffff;
    touch-action: none;
    overflow: hidden;
}

.ds-whiteboard-canvas {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
}

.ds-whiteboard-inline-text {
    position: absolute;
    box-sizing: border-box;
    outline: none;
    background: rgba(255, 255, 255, 0.95);
    border: 1.5px dashed #0284c7;
    border-radius: 6px;
    padding: 4px 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    font-family: inherit;
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-word;
    resize: none;
    z-index: 20;
}

@media (max-width: 768px) {
    .ds-whiteboard-canvas-box {
        height: 380px;
        min-height: 300px;
    }
    .ds-whiteboard-toolbar {
        gap: 6px;
        padding: 6px 8px;
    }
}

/* CLASSROOM-UI-01-B4: Visual Enhancements */
.ds-room-conn-status {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.2;
    transition: all 0.2s ease;
}
.ds-room-conn-status.is-connected {
    background: rgba(16, 185, 129, 0.12);
    color: #059669;
    border: 1px solid rgba(16, 185, 129, 0.3);
}
.ds-room-conn-status.is-reconnecting {
    background: rgba(245, 158, 11, 0.15);
    color: #d97706;
    border: 1px solid rgba(245, 158, 11, 0.35);
}
.ds-room-conn-status.is-offline,
.ds-room-conn-status.is-disconnected {
    background: rgba(107, 114, 128, 0.12);
    color: #4b5563;
    border: 1px solid rgba(107, 114, 128, 0.3);
}
.ds-room-conn-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}
.ds-room-conn-status.is-reconnecting .ds-room-conn-dot {
    animation: ds-room-pulse 0.9s infinite;
}

.ds-room-speaker-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.65rem;
    background: rgba(37, 99, 235, 0.1);
    color: #1d4ed8;
    border: 1px solid rgba(37, 99, 235, 0.25);
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.2;
    animation: ds-room-fade-in 0.2s ease;
}
.ds-soundwave-anim {
    color: #2563eb;
    animation: ds-room-pulse 0.6s infinite alternate;
}
.ds-room-mic.is-speaking {
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.35), 0 0 12px rgba(37, 99, 235, 0.5);
    animation: ds-room-pulse 0.7s infinite alternate;
}

.ds-room-unread-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.35rem;
    border-radius: 9999px;
    background: #dc2626;
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1;
    margin-inline-start: 0.4rem;
}

.ds-whiteboard-wrap.is-fullscreen {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    z-index: 99999 !important;
    margin: 0 !important;
    padding: 0.75rem !important;
    background: #0f172a !important;
    box-sizing: border-box !important;
    display: flex !important;
    flex-direction: column !important;
    border-radius: 0 !important;
}
.ds-whiteboard-wrap.is-fullscreen .ds-whiteboard-canvas-box {
    flex: 1 1 0 !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: calc(100vh - 80px) !important;
}
.ds-whiteboard-wrap.is-fullscreen .ds-whiteboard-toolbar {
    margin-bottom: 0.5rem;
}
.ds-whiteboard-wrap.is-fullscreen .ds-whiteboard-readonly-banner {
    margin-bottom: 0.5rem;
}



/* Student dashboard */
body:has(.ds-bottom-nav-student) {
    --student-ink: #101b4a;
    --student-blue: #0759f2;
    --student-cyan: #00bcd4;
    --student-purple: #7449e8;
    --student-surface: #f8fbff;
    --student-line: #d5e1f6;
    --student-shadow: 0 5px 14px rgb(35 79 163 / 14%);
    background: linear-gradient(180deg, #e0eaff, #f3f7ff);
}

body:has(.ds-bottom-nav-student) nav.navbar {
    background: linear-gradient(120deg, #122760, #173a94 65%, #39308e) !important;
}

.student-mobile-datesheet {
    display: none !important;
}

@media screen and (max-width: 1023px) {
    body:has(.ds-bottom-nav-student) nav.navbar :is(.navbar-toggler, #navbarNav) {
        display: none !important;
    }

    body:has(.ds-bottom-nav-student) .student-mobile-datesheet {
        display: inline-flex !important;
    }
}

.student-line-icon {
    display: inline-block;
    inline-size: 1.25em;
    block-size: 1.25em;
    flex: none;
    vertical-align: -.2em;
}

.student-dashboard {
    display: grid;
    gap: 1rem;
    overflow-wrap: anywhere;
}

.student-dashboard > *,
.student-card-grid > * {
    min-inline-size: 0;
}

.date-filter-range {
    display: inline-block;
    font-family: monospace;
    font-size: .95rem;
}

.student-dashboard .date-filter-week {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    inline-size: 100%;
}

.student-dashboard .date-filter-range {
    grid-column: 1 / -1;
    grid-row: 1;
    padding-inline: 0 !important;
    font-size: .75rem;
    text-align: center;
    white-space: nowrap;
}

.student-dashboard .date-filter-week a {
    justify-content: center;
    padding-inline: .35rem !important;
    font-size: .75rem !important;
    white-space: normal;
}

.student-masthead {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: .75rem;
    padding: clamp(.875rem, 2vw, 1.5rem);
    color: white;
    background: linear-gradient(125deg, #10205c, #173d9b 62%, #4834ad);
    box-shadow: var(--student-shadow);
    border-radius: var(--radius);
}

nav.navbar:has(.student-masthead) {
    flex-wrap: wrap;
}

nav.navbar .student-masthead {
    flex: 0 0 100%;
    grid-template-columns: minmax(0, 1fr) auto auto;
    margin-block-start: .5rem;
    padding: .5rem 0 0;
    background: transparent;
    box-shadow: none;
    border-block-start: 1px solid rgb(255 255 255 / 20%);
    border-radius: 0;
}

.student-header-logout {
    grid-column: 3;
    grid-row: 1;
    display: grid;
    place-items: center;
    inline-size: 44px;
    block-size: 44px;
    color: white;
    background: rgb(255 255 255 / 18%);
    border-radius: .75rem;
}

.student-header-logout:hover {
    color: white;
    background: rgb(255 255 255 / 30%);
}

nav.navbar .student-identity h1 {
    font-size: clamp(1rem, 2.7vw, 1.4rem) !important;
}

nav.navbar .student-identity p {
    font-size: .75rem;
}

.student-identity {
    display: flex;
    align-items: center;
    gap: .75rem;
    min-inline-size: 0;
}

.student-identity > div {
    min-inline-size: 0;
}

.student-identity img {
    flex: none;
    inline-size: 3rem;
    block-size: 3rem;
    background: white;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #bdf6ff;
    box-shadow: 0 0 0 3px rgb(0 188 212 / 32%);
}

.student-identity h1 {
    color: inherit;
    font-size: clamp(1.25rem, 3vw, 1.75rem) !important;
    margin-block-end: .25rem;
}

.student-identity p {
    margin: 0;
}

.student-notifications {
    padding: .5rem;
    color: var(--c-text);
    background: var(--c-card);
    border-radius: var(--radius);
}

.student-notifications summary .student-line-icon {
    color: var(--student-blue);
}

.student-notifications[open] {
    grid-column: 1 / -1;
}

.student-notifications summary {
    cursor: pointer;
    min-block-size: 2rem;
}

.student-notifications summary .ds-badge {
    white-space: nowrap;
}

@media (max-width: 599px) {
    .student-notification-label {
        position: absolute;
        inline-size: 1px;
        block-size: 1px;
        overflow: hidden;
        clip-path: inset(50%);
    }
}

.student-search {
    display: flex;
    gap: .5rem;
    padding: .375rem;
    background: var(--student-surface);
    border: 1px solid var(--student-line);
    border-radius: 2rem;
    box-shadow: var(--student-shadow);
}

.student-search input {
    flex: 1;
    min-inline-size: 0;
    padding-inline: .75rem;
    color: var(--c-text);
    background: transparent;
    border: 0;
    border-radius: 2rem;
}

.student-search button,
.student-welcome a {
    color: white;
    background: linear-gradient(145deg, #008cf4, #0642d9);
    border: 0;
    border-radius: 2rem;
}

.student-search button {
    min-inline-size: 44px;
    min-block-size: 44px;
}

.student-welcome {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: .75rem;
    padding: clamp(1rem, 3vw, 2rem);
    color: white;
    background:
        radial-gradient(ellipse at 8% 72%, rgb(0 188 212 / 65%), transparent 52%),
        radial-gradient(ellipse at 95% 0%, #244cc6, transparent 57%),
        linear-gradient(120deg, #081c54, #10286f);
    border: 1px solid #4ba4ef;
    border-radius: var(--radius);
    box-shadow: var(--student-shadow);
}

.student-welcome h2 {
    color: inherit;
}

.student-welcome a {
    display: inline-block;
    padding: .45rem .75rem;
    text-decoration: none;
}

.student-welcome-art {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: .375rem;
    inline-size: clamp(4.5rem, 20vw, 11rem);
    color: white;
    font-size: clamp(1rem, 4vw, 2rem);
    text-align: center;
}

.student-welcome-art .student-line-icon {
    inline-size: 100%;
    block-size: auto;
    aspect-ratio: 1.35;
    padding: .35em;
    background: linear-gradient(150deg, rgb(72 177 255 / 35%), rgb(21 51 148 / 70%));
    border: 1px solid #73dfff;
    border-radius: .65rem;
}

.student-welcome-art .student-line-icon:first-child {
    grid-column: 1 / -1;
    aspect-ratio: 2.2;
    padding: .55em;
}

.student-dashboard :is([id^="student-period-"], [id^="student-book-"], [id^="student-session-"], #student-timetable) {
    scroll-margin-block: 1rem 6rem;
}

.student-dashboard :target {
    outline: 2px solid var(--c-teal);
    outline-offset: 2px;
}

.student-panel {
    background: var(--student-surface, var(--c-card));
    border: 1px solid var(--student-line, var(--c-line-soft));
    border-radius: var(--radius);
    box-shadow: var(--student-shadow, var(--shadow-1));
}

.student-dashboard :is(h2, h3),
.student-week-day h2 {
    color: var(--student-ink);
}

.student-dashboard :is(h2, h3) > .bi {
    color: var(--student-blue);
}

.student-dashboard .student-welcome h2 {
    color: white;
}

.student-section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .5rem;
    padding: 1rem;
    background: transparent;
    border: 0;
}

.student-card-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: .75rem;
}

.student-period {
    padding: .875rem;
    background: linear-gradient(145deg, #fff, #eaf2ff);
    border: 1px solid var(--student-line);
    border-radius: var(--radius);
}

.student-period.is-current {
    background: linear-gradient(145deg, #f0fffc, #e3f3ff);
    border-color: #12bda5;
}

.student-card-icon {
    display: inline-grid;
    place-items: center;
    inline-size: 2rem;
    block-size: 2rem;
    border-radius: .65rem;
    color: white;
    background: linear-gradient(145deg, #a88cff, var(--student-purple) 65%, #482dc4);
    box-shadow: 0 3px 8px rgb(61 68 170 / 22%);
}

.student-icon-science {
    background: linear-gradient(145deg, #63e9eb, #00a6bf 65%, #007e9c);
}

.student-book-card {
    background: linear-gradient(145deg, #fff, #edf4ff) !important;
    border-color: var(--student-line) !important;
    box-shadow: var(--student-shadow);
}

.student-card-icon {
    float: inline-start;
    margin-inline-end: .5rem;
    margin-block-end: .25rem;
}

.student-progress-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .75rem 1.5rem;
}

.student-attendance-ring {
    display: grid;
    place-items: center;
    inline-size: 4.5rem;
    block-size: 4.5rem;
    border-radius: 50%;
    background: conic-gradient(var(--student-cyan), #0086cc var(--student-attendance), #d9e7fc 0);
}

.student-attendance-ring strong {
    display: grid;
    place-items: center;
    inline-size: 3.5rem;
    block-size: 3.5rem;
    border-radius: 50%;
    background: var(--c-card);
}

.ds-bottom-nav-student {
    margin-inline: .375rem;
    border-radius: var(--radius) var(--radius) 0 0;
    background: #f4f8ff;
    border-color: var(--student-line);
}

.ds-bottom-nav-student a.active {
    color: white;
    background: linear-gradient(145deg, #128cf9, #0643d9);
}

.ds-bottom-nav-student .student-line-icon {
    font-size: 1rem;
}

.student-week-cards {
    display: none;
}

.student-week-heading {
    margin-inline: 0;
    padding: 1rem;
    border-radius: var(--radius);
    background: var(--c-card);
    box-shadow: var(--shadow-1);
}

.student-week-heading > div {
    padding-inline: 0;
}

.student-week-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: end;
    gap: .5rem;
}

.student-week-actions .btn {
    margin: 0 !important;
    padding-inline: .85rem !important;
}

@media screen and (max-width: 767px) {
    .student-week-actions { justify-content: start; }
    .student-week-table { display: none; }
    .student-week-cards { display: grid; gap: .75rem; }
    .student-week-day { padding: .875rem; }
    .student-week-day h2 { font-size: 1.1rem; color: var(--c-teal); }
    .student-week-day ul { margin: 0; padding: 0; list-style: none; }
    .student-week-day li {
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
        align-items: center;
        gap: .5rem;
        padding: .65rem;
        background: var(--c-info-bg);
        border-radius: .65rem;
        overflow-wrap: anywhere;
    }
    .student-week-day li + li { margin-block-start: .5rem; }
    .student-week-day li small,
    .student-week-day li bdi { display: block; color: var(--c-muted); }
}

@media (prefers-reduced-motion: no-preference) {
    .ds-bottom-nav-student { transition: transform .2s ease, visibility .2s; }
}

@media screen and (max-width: 1023px) {
    .ds-bottom-nav-student.is-scrolled-away {
        transform: translateY(110%);
        visibility: hidden;
    }
}

@media print {
    .ds-bottom-nav-student,
    .student-week-cards { display: none !important; }
}

.ds-bottom-nav-student a {
    min-inline-size: 0;
    padding-inline: 2px;
    font-size: clamp(.625rem, 2.8vw, .75rem);
    text-align: center;
}

.student-dashboard .last-no-border:last-child {
    border-bottom: 0 !important;
}

.student-book-progress {
    inline-size: 100%;
    block-size: .5rem;
    appearance: none;
    border: 0;
    border-radius: 1rem;
    background: #d9e7fa;
}

.student-book-progress::-webkit-progress-bar {
    border-radius: 1rem;
    background: #d9e7fa;
}

.student-book-progress::-webkit-progress-value {
    border-radius: 1rem;
    background: linear-gradient(90deg, #0086bd, #00c5ce);
}

.student-book-progress::-moz-progress-bar {
    border-radius: 1rem;
    background: linear-gradient(90deg, #0086bd, #00c5ce);
}

@media (max-width: 1023px) {
    body:has(.ds-bottom-nav-student) {
        padding-block-end: calc(96px + env(safe-area-inset-bottom));
    }
}

@media (min-width: 600px) {
    .student-card-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 768px) {
    .student-card-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .student-detail-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .student-detail-grid {
        align-items: start;
    }
}

/* ============================================================
   Student portal — design replica (app bar, cards, icons)
   ============================================================ */
body:has(.ds-bottom-nav-student) {
    --student-ink: #101b4a;
    --student-blue: #1e6bff;
    --student-cyan: #17c3c9;
    --student-purple: #7b5cf0;
    --student-surface: #ffffff;
    --student-line: #e3ebfa;
    --student-shadow: 0 10px 26px rgb(20 50 120 / 8%);
    font-family: 'Cairo', 'Segoe UI', Tahoma, sans-serif;
    color: var(--student-ink);
    background:
        radial-gradient(circle at 50% 0, #e8f0ff 0, transparent 55%),
        linear-gradient(180deg, #eef3ff, #f8fbff 42%, #f4f8ff);
}

body:has(.ds-bottom-nav-student) nav.navbar {
    background: transparent !important;
}

/* ---------- App bar ---------- */
.student-appbar {
    position: relative;
    z-index: 5;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: .75rem;
    padding: calc(14px + env(safe-area-inset-top)) max(14px, calc((100vw - 812px) / 2)) 46px;
    color: #fff;
    background:
        radial-gradient(circle at 12% 8%, rgb(96 92 255 / 55%), transparent 46%),
        radial-gradient(circle at 88% 0%, rgb(0 196 255 / 38%), transparent 52%),
        linear-gradient(118deg, #091550, #152a86 55%, #3b2b8f);
    border-radius: 0 0 30px 30px;
    box-shadow: 0 14px 34px rgb(10 25 80 / 28%);
}

.student-appbar__profile {
    display: flex;
    align-items: center;
    gap: .65rem;
    min-inline-size: 0;
    justify-self: start;
}

.student-appbar__avatar {
    position: relative;
    display: inline-grid;
    place-items: center;
    flex: none;
    inline-size: 52px;
    block-size: 52px;
    border-radius: 50%;
    background: #dff2ff;
    border: 2px solid rgb(255 255 255 / 85%);
    box-shadow: 0 0 0 3px rgb(45 208 192 / 55%);
    overflow: visible;
}

.student-appbar__avatar img,
.student-appbar__avatar svg {
    inline-size: 100%;
    block-size: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    overflow: hidden;
}

.student-appbar__online {
    position: absolute;
    inset-block-end: -1px;
    inset-inline-start: -1px;
    inline-size: 13px;
    block-size: 13px;
    border-radius: 50%;
    background: #2fe08a;
    border: 2px solid #0d1c63;
}

.student-appbar__greeting {
    display: flex;
    flex-direction: column;
    min-inline-size: 0;
    line-height: 1.25;
}

.student-appbar__hello {
    font-size: clamp(.95rem, 3.2vw, 1.15rem);
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.student-appbar__sub {
    font-size: clamp(.62rem, 2.2vw, .75rem);
    color: rgb(219 236 255 / 85%);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.student-appbar__brand {
    display: grid;
    justify-items: center;
    gap: .1rem;
    color: #fff;
    text-decoration: none;
    justify-self: center;
    min-inline-size: 0;
}

.student-appbar__logo {
    display: grid;
    place-items: center;
    inline-size: clamp(34px, 8vw, 44px);
    block-size: clamp(34px, 8vw, 44px);
    filter: drop-shadow(0 6px 12px rgb(0 40 130 / 45%));
}

.student-appbar__logo svg,
.student-appbar__logo img {
    inline-size: 100%;
    block-size: 100%;
    object-fit: contain;
    display: block;
}

.student-appbar__wordmark {
    font-size: clamp(.82rem, 2.6vw, 1.05rem);
    font-weight: 800;
    letter-spacing: -.02em;
    white-space: nowrap;
    line-height: 1;
}

.student-appbar__wordmark span {
    color: #6fe6ff;
}

.student-appbar__tagline {
    font-size: clamp(.5rem, 1.8vw, .66rem);
    letter-spacing: .04em;
    color: rgb(213 235 255 / 85%);
    white-space: nowrap;
    line-height: 1;
}

.student-appbar__actions {
    display: flex;
    align-items: center;
    gap: .45rem;
    justify-self: end;
}

.student-appbar__action {
    display: inline-grid;
    place-items: center;
    position: relative;
    inline-size: clamp(34px, 9vw, 42px);
    block-size: clamp(34px, 9vw, 42px);
    color: #e6f3ff;
    background: rgb(255 255 255 / 12%);
    border: 1px solid rgb(255 255 255 / 22%);
    border-radius: 13px;
    text-decoration: none;
    cursor: pointer;
    transition: background .18s ease, transform .18s ease;
}

.student-appbar__action:hover,
.student-appbar__action:focus-visible {
    color: #fff;
    background: rgb(255 255 255 / 24%);
    transform: translateY(-1px);
}

.student-appbar__action .student-line-icon {
    inline-size: 21px;
    block-size: 21px;
}

.student-appbar__action--ai {
    background: linear-gradient(145deg, #6a6bff, #3b2bd0);
    border-color: rgb(160 190 255 / 55%);
    box-shadow: 0 6px 16px rgb(45 40 180 / 40%);
}

.student-appbar__action--bell .student-line-icon {
    color: #e6f3ff;
}

.student-appbar__dot {
    position: absolute;
    inset-block-start: 5px;
    inset-inline-end: 5px;
    inline-size: 9px;
    block-size: 9px;
    border-radius: 50%;
    background: #ff3d6e;
    border: 2px solid #1a2a7a;
}

.student-notifications {
    position: relative;
    padding: 0;
    color: inherit;
    background: transparent;
    border-radius: 0;
}

.student-notifications summary {
    list-style: none;
}

.student-notifications summary::-webkit-details-marker {
    display: none;
}

.student-notifications__panel {
    position: absolute;
    inset-block-start: calc(100% + 12px);
    left: 0;
    z-index: 30;
    inline-size: min(330px, calc(100vw - 28px));
    max-block-size: 62vh;
    overflow: auto;
    padding: .9rem;
    color: var(--student-ink);
    background: #fff;
    border: 1px solid var(--student-line);
    border-radius: 20px;
    box-shadow: 0 22px 50px rgb(10 25 80 / 24%);
    text-align: start;
}

.student-notifications__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    padding-block-end: .6rem;
    margin-block-end: .6rem;
    border-block-end: 1px solid #eef3fc;
    font-size: .95rem;
}

.student-notifications__count {
    display: inline-grid;
    place-items: center;
    min-inline-size: 24px;
    block-size: 24px;
    padding-inline: .4rem;
    border-radius: 999px;
    color: #1e6bff;
    background: #eaf1ff;
    font-size: .72rem;
    font-weight: 800;
}

.student-notifications__list {
    display: grid;
    gap: .55rem;
}

.student-notifications__item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .6rem;
    padding: .7rem;
    background: #f7faff;
    border: 1px solid #eaf1fd;
    border-radius: 14px;
}

.student-notifications__item.is-read {
    opacity: .68;
}

.student-notifications__title {
    font-weight: 800;
    font-size: .85rem;
}

.student-notifications__message {
    color: #5b6b8f;
    font-size: .78rem;
    line-height: 1.5;
}

.student-notifications__time {
    display: block;
    color: #8a97b5;
    font-size: .68rem;
    margin-block-start: .2rem;
}

.student-notifications__read {
    flex: none;
    padding: .3rem .65rem;
    color: #0d9b64;
    background: #ddf9ec;
    border: 0;
    border-radius: 999px;
    font-size: .68rem;
    font-weight: 800;
}

.student-notifications__read.is-done {
    color: #0d9b64;
    background: #e8f8f1;
}

.student-notifications__empty {
    margin: 0;
    padding: .5rem 0;
    color: #8a97b5;
    font-size: .82rem;
}

/* ---------- Page shell ---------- */
.student-app {
    display: grid;
    gap: 1.35rem;
    max-inline-size: 780px;
    margin-inline: auto;
    padding: 0 0 1rem;
}

.student-app > *,
.student-class-grid > *,
.student-subject-grid > * {
    min-inline-size: 0;
}

/* ---------- Search ---------- */
.student-search {
    position: relative;
    z-index: 6;
    display: flex;
    align-items: center;
    gap: .45rem;
    margin-block-start: -32px;
    padding: .38rem .42rem;
    background: #fff;
    border: 1px solid #e6eefc;
    border-radius: 999px;
    box-shadow: 0 14px 30px rgb(16 42 110 / 14%);
}

.student-search input {
    flex: 1;
    min-inline-size: 0;
    padding-inline: .35rem;
    color: var(--student-ink);
    background: transparent;
    border: 0;
    font-size: clamp(.85rem, 2.6vw, 1rem);
    font-family: inherit;
}

.student-search input::placeholder {
    color: #9aa7c2;
}

.student-search input:focus {
    outline: none;
}

.student-search__go,
.student-search__mic {
    display: inline-grid;
    place-items: center;
    flex: none;
    border: 0;
    border-radius: 50%;
}

.student-search__go {
    inline-size: 46px;
    block-size: 46px;
    color: #fff;
    background: linear-gradient(145deg, #2f86ff, #0b46d8);
    box-shadow: 0 8px 18px rgb(17 80 220 / 32%);
}

.student-search__go .student-line-icon {
    inline-size: 21px;
    block-size: 21px;
}

.student-search__mic {
    inline-size: 40px;
    block-size: 40px;
    color: #33507f;
    background: #eef3ff;
}

.student-search__mic .student-line-icon {
    inline-size: 19px;
    block-size: 19px;
}

.student-search-results {
    padding: .9rem 1rem;
    background: #fff;
    border: 1px solid var(--student-line);
    border-radius: 18px;
    box-shadow: var(--student-shadow);
}

.student-search-results__status {
    color: #5b6b8f;
    font-size: .82rem;
}

.student-search-results__list {
    display: grid;
    gap: .35rem;
    padding: 0;
    list-style: none;
}

.student-search-results__list a {
    color: #1e6bff;
    font-size: .85rem;
    text-decoration: none;
}

/* ---------- Hero ---------- */
.student-hero {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    isolation: isolate;
    min-block-size: clamp(200px, 52vw, 280px);
    padding: clamp(18px, 4vw, 30px);
    overflow: hidden;
    color: #fff;
    background-color: #071a5c;
    background-image: url('/images/student-hero.png');
    background-size: cover;
    background-position: 26% center;
    background-repeat: no-repeat;
    border: 1px solid rgb(94 220 255 / 42%);
    border-radius: 26px;
    box-shadow: 0 16px 36px rgb(13 34 110 / 28%);
}

.student-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    background:
        linear-gradient(90deg, rgb(4 16 64 / 4%) 0%, rgb(4 16 64 / 16%) 38%, rgb(4 16 64 / 82%) 66%, rgb(4 16 64 / 98%) 100%),
        linear-gradient(180deg, rgb(4 16 64 / 12%), rgb(4 16 64 / 42%));
    pointer-events: none;
}

.student-hero__copy {
    position: relative;
    z-index: 2;
    flex: 0 1 auto;
    inline-size: min(60%, 360px);
    min-inline-size: 0;
    display: flex;
    flex-direction: column;
    gap: .4rem;
    text-align: start;
}

@media (max-width: 767.98px) {
    .student-hero {
        min-block-size: 0;
        align-items: flex-end;
        background-position: 78% top;
    }

    .student-hero::before {
        background:
            linear-gradient(180deg, rgb(4 16 64 / 35%) 0%, rgb(4 16 64 / 88%) 42%, rgb(4 16 64 / 96%) 100%);
    }

    .student-hero__copy {
        inline-size: 100%;
    }

    .student-hero__copy .btn {
        inline-size: 100%;
        justify-content: center;
    }
}

.action-icon-btn {
  width: 30px;
  height: 30px;
  white-space: nowrap;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
}

.action-icon-btn + .action-icon-btn {
  margin-inline-start: 6px;
}

.classes-table td .action-icon-btn {
  display: inline-flex !important;
}

.classes-table td.text-center.text-nowrap {
  display: table-cell;
  white-space: nowrap;
}

.student-hero--full-art {
    min-block-size: clamp(220px, 60vw, 300px);
    background-size: auto 100%;
    background-position: center;
    align-items: flex-end;
}

.student-hero--full-art::before {
    background: linear-gradient(180deg, rgb(4 16 64 / 0%) 35%, rgb(4 16 64 / 85%) 100%);
}

.student-hero__slides {
    display: grid;
    align-items: start;
}

.student-hero__slide {
    grid-area: 1 / 1;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity .45s ease, transform .45s ease, visibility .45s ease;
    pointer-events: none;
}

.student-hero__slide.is-active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.student-hero__copy h2 {
    margin: 0;
    color: #fff;
    font-size: clamp(1.3rem, 5vw, 1.75rem);
    font-weight: 800;
    text-shadow: 0 2px 12px rgb(2 10 40 / 50%);
}

.student-hero__copy p {
    margin: 0;
    color: rgb(232 244 255 / 92%);
    font-size: clamp(.8rem, 2.9vw, .98rem);
    line-height: 1.7;
    text-shadow: 0 2px 10px rgb(2 10 40 / 45%);
}

.student-hero__dots {
    display: flex;
    gap: .35rem;
    margin-block-start: .6rem;
}

.student-hero__dots button {
    inline-size: 7px;
    block-size: 7px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgb(255 255 255 / 35%);
    cursor: pointer;
    transition: inline-size .3s ease, background .3s ease;
}

.student-hero__dots button.is-active {
    inline-size: 20px;
    border-radius: 999px;
    background: #6fe6ff;
}

.student-hero__dots button:focus-visible {
    outline: 2px solid #6fe6ff;
    outline-offset: 3px;
}

/* ---------- Section headings ---------- */
.student-section {
    display: grid;
    gap: .8rem;
}

.student-section__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
}

.student-section__head h2 {
    display: flex;
    align-items: center;
    gap: .45rem;
    margin: 0;
    color: var(--student-ink);
    font-size: clamp(1rem, 3.2vw, 1.18rem);
    font-weight: 800;
}

.student-section__head h2 .student-line-icon {
    inline-size: 22px;
    block-size: 22px;
    color: #1e6bff;
}

.student-section__head a {
    display: inline-flex;
    align-items: center;
    gap: .15rem;
    flex: none;
    color: #1e6bff;
    font-size: clamp(.66rem, 2.2vw, .78rem);
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.student-section__head a .student-line-icon {
    inline-size: 13px;
    block-size: 13px;
}

.student-section__count {
    display: inline-grid;
    place-items: center;
    min-inline-size: 26px;
    block-size: 26px;
    padding-inline: .4rem;
    color: #1e6bff;
    background: #eaf1ff;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 800;
}

/* ---------- Tones ---------- */
.tone-blue { background: linear-gradient(145deg, #4aa8ff, #1a63ff); }
.tone-purple { background: linear-gradient(145deg, #a17cff, #6a3df0); }
.tone-violet { background: linear-gradient(145deg, #b06bff, #7a35e8); }
.tone-teal { background: linear-gradient(145deg, #39e0d6, #0aa9c4); }
.tone-green { background: linear-gradient(145deg, #4fe08d, #12b26a); }
.tone-pink { background: linear-gradient(145deg, #ff7aa8, #ef3f78); }
.tone-orange { background: linear-gradient(145deg, #ffc04d, #f59300); }

/* ---------- Today's classes ---------- */
.student-class-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .6rem;
}

.student-class-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .4rem;
    padding: .7rem .35rem .6rem;
    text-align: center;
    background: linear-gradient(180deg, #fff, #f5f9ff);
    border: 1px solid var(--student-line);
    border-radius: 18px;
    box-shadow: 0 8px 20px rgb(20 50 120 / 7%);
}

.student-class-card.is-current {
    background: linear-gradient(180deg, #f2fffb, #fff);
    border-color: #18c79a;
    box-shadow: 0 0 0 1px #18c79a inset, 0 10px 24px rgb(24 199 154 / 16%);
}

.student-class-card__time {
    display: inline-flex;
    align-items: center;
    gap: .2rem;
    color: #5b6b8f;
    font-size: clamp(.6rem, 2vw, .72rem);
    font-weight: 700;
}

.student-class-card__time .student-line-icon {
    inline-size: 13px;
    block-size: 13px;
}

.student-class-card__body {
    display: flex;
    align-items: center;
    gap: .3rem;
    min-inline-size: 0;
}

.student-class-card__icon,
.student-subject-card__icon,
.student-quick__icon,
.student-empty__icon,
.student-live-card__icon {
    display: inline-grid;
    place-items: center;
    flex: none;
    color: #fff;
    border-radius: 13px;
    box-shadow: 0 5px 12px rgb(45 60 160 / 22%);
}

.student-class-card__icon {
    inline-size: 32px;
    block-size: 32px;
    border-radius: 10px;
}

.student-class-card__icon .student-line-icon {
    inline-size: 20px;
    block-size: 20px;
}

.student-class-card__body h3 {
    margin: 0;
    color: var(--student-ink);
    font-size: clamp(.7rem, 2.6vw, .88rem) !important;
    font-weight: 800;
    line-height: 1.25;
    overflow-wrap: break-word;
    word-break: normal;
    hyphens: none;
}

.student-class-card__status {
    display: inline-flex;
    align-items: center;
    gap: .2rem;
    padding: .18rem .5rem;
    border-radius: 999px;
    font-size: clamp(.56rem, 1.9vw, .66rem);
    font-weight: 800;
    white-space: nowrap;
}

.student-class-card__status .student-line-icon {
    inline-size: 11px;
    block-size: 11px;
}

.student-class-card__status.is-live {
    color: #0d9b64;
    background: #d8f8e8;
}

.student-class-card__status.is-live::before {
    content: "";
    inline-size: 6px;
    block-size: 6px;
    border-radius: 50%;
    background: #12b26a;
    box-shadow: 0 0 0 3px rgb(18 178 106 / 22%);
}

.student-class-card__status.is-next {
    color: #4b5c82;
    background: #eef2ff;
}

.student-class-card__status.is-upcoming {
    color: #1e6bff;
    background: #eaf1ff;
}

.student-class-card__status.is-warn { color: #b7791f; background: #fff4dc; }
.student-class-card__status.is-danger { color: #d92d5c; background: #ffe4ea; }
.student-class-card__status.is-info { color: #1e6bff; background: #e6f0ff; }

.student-class-card__countdown {
    color: #8a97b5;
    font-size: .62rem;
    font-weight: 700;
}

/* ---------- Subjects ---------- */
.student-subject-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .6rem;
}

.student-subject-card {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    padding: .65rem .55rem;
    background: linear-gradient(180deg, #fff, #f6faff);
    border: 1px solid var(--student-line);
    border-radius: 18px;
    box-shadow: 0 8px 20px rgb(20 50 120 / 7%);
}

.student-subject-card__top {
    display: flex;
    align-items: flex-start;
    gap: .35rem;
    min-inline-size: 0;
}

.student-subject-card__icon {
    inline-size: 30px;
    block-size: 30px;
    border-radius: 10px;
}

.student-subject-card__icon .student-line-icon {
    inline-size: 18px;
    block-size: 18px;
}

.student-subject-card__text {
    min-inline-size: 0;
}

.student-subject-card__text h3 {
    margin: 0;
    color: var(--student-ink);
    font-size: clamp(.7rem, 2.5vw, .88rem) !important;
    font-weight: 800;
    line-height: 1.25;
    overflow-wrap: break-word;
    word-break: normal;
    hyphens: none;
}

.student-subject-card__text p {
    margin: .1rem 0 0;
    color: #8a97b5;
    font-size: clamp(.55rem, 1.9vw, .68rem);
}

.student-subject-card__progress {
    display: flex;
    align-items: center;
    gap: .45rem;
}

.student-subject-card__pct {
    flex: none;
    color: #0d9b64;
    font-size: clamp(.62rem, 2.1vw, .74rem);
    font-weight: 800;
}

.student-subject-card__bar {
    flex: 1;
    block-size: 6px;
    background: #e3ecfa;
    border-radius: 999px;
    overflow: hidden;
}

.student-subject-card__bar span {
    display: block;
    block-size: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #16c9c4, #1e6bff);
}

.student-subject-card__toggle {
    display: inline-flex;
    align-items: center;
    gap: .15rem;
    align-self: flex-start;
    padding: 0;
    color: #1e6bff;
    background: none;
    border: 0;
    font-size: clamp(.6rem, 2vw, .7rem);
    font-weight: 700;
    font-family: inherit;
}

.student-subject-card__toggle .student-line-icon {
    inline-size: 12px;
    block-size: 12px;
}

.student-book-details__inner {
    margin-block-start: .5rem;
    padding-block-start: .6rem;
    border-block-start: 1px dashed #dbe6fb;
    font-size: .72rem;
}

.student-book-details__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .45rem;
    margin-block-end: .5rem;
}

.student-book-details__grid > div,
.student-book-details__lesson > div {
    display: flex;
    flex-direction: column;
    gap: .1rem;
    padding: .45rem .5rem;
    background: #f3f8ff;
    border-radius: 10px;
}

.student-book-details__grid span,
.student-book-details__lesson span {
    color: #8a97b5;
    font-size: .62rem;
}

.student-book-details__grid strong,
.student-book-details__lesson strong {
    color: var(--student-ink);
    font-size: .72rem;
}

.student-book-details__lesson {
    display: grid;
    gap: .4rem;
}

.student-book-details__lesson .is-good {
    color: #0d9b64;
}

.student-book-details__empty {
    margin: 0;
    color: #8a97b5;
    font-size: .7rem;
}

.student-book-details__parts {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    margin-block-start: .5rem;
}

.student-book-details__parts a {
    padding: .3rem .6rem;
    color: #1e6bff;
    background: #eaf1ff;
    border-radius: 999px;
    font-size: .66rem;
    font-weight: 700;
    text-decoration: none;
}

/* ---------- Empty states ---------- */
.student-empty {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .9rem 1rem;
    background: linear-gradient(180deg, #fff, #f6faff);
    border: 1px solid var(--student-line);
    border-radius: 18px;
    box-shadow: 0 8px 20px rgb(20 50 120 / 6%);
}

.student-empty--soft {
    background: #f7faff;
    box-shadow: none;
}

.student-empty__icon {
    inline-size: 46px;
    block-size: 46px;
}

.student-empty__icon .student-line-icon {
    inline-size: 25px;
    block-size: 25px;
}

.student-empty strong {
    display: block;
    color: var(--student-ink);
    font-size: .9rem;
}

.student-empty p {
    margin: .1rem 0 0;
    color: #8a97b5;
    font-size: .76rem;
}

/* ---------- Progress ---------- */
.student-progress-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem;
    background:
        radial-gradient(circle at 6% 90%, rgb(88 220 255 / 16%), transparent 45%),
        linear-gradient(180deg, #fff, #f3f8ff);
    border: 1px solid var(--student-line);
    border-radius: 22px;
    box-shadow: var(--student-shadow);
}

.classes-table {
    min-width: 620px;
}
.classes-table th,
.classes-table td.fw-bold {
    white-space: nowrap;
}

.student-progress-card__stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    flex: 1;
    gap: .35rem;
}

.student-progress-card__stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .15rem;
    padding-inline: .35rem;
    text-align: center;
    border-inline-start: 1px solid #e8effb;
}

.student-progress-card__stat:first-child {
    border-inline-start: 0;
}

.student-progress-card__stat-icon {
    inline-size: 26px;
    block-size: 26px;
    display: inline-grid;
    place-items: center;
}

.student-progress-card__stat-icon .student-line-icon {
    inline-size: 22px;
    block-size: 22px;
}

.student-progress-card__stat-icon.tone-blue { background: none; color: #1e6bff; }
.student-progress-card__stat-icon.tone-orange { background: none; color: #f59300; }
.student-progress-card__stat-icon.tone-green { background: none; color: #12b26a; }

.student-progress-card__stat-label {
    color: #8a97b5;
    font-size: clamp(.55rem, 1.9vw, .68rem);
    line-height: 1.35;
}

.student-progress-card__stat strong {
    color: var(--student-ink);
    font-size: clamp(.9rem, 3vw, 1.08rem);
    font-weight: 800;
}

.student-progress-card__stat strong small {
    color: #8a97b5;
    font-size: .6em;
    font-weight: 700;
}

.student-progress-card__ring {
    display: grid;
    place-items: center;
    flex: none;
    inline-size: 84px;
    block-size: 84px;
    border-radius: 50%;
    background: conic-gradient(#22d3c5, #1e6bff var(--student-progress), #e3ecfa 0);
}

.student-progress-card__ring strong {
    display: grid;
    place-items: center;
    inline-size: 64px;
    block-size: 64px;
    border-radius: 50%;
    background: #fff;
    color: var(--student-ink);
    font-size: 1.02rem;
    font-weight: 800;
}

/* ---------- Quick access ---------- */
.student-quick-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .55rem;
}

.student-quick {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    padding: .62rem .7rem;
    color: var(--student-ink);
    background: #fff;
    border: 1px solid var(--student-line);
    border-radius: 16px;
    box-shadow: 0 6px 16px rgb(20 50 120 / 6%);
    font-size: clamp(.78rem, 2.8vw, .92rem);
    font-weight: 800;
    text-decoration: none;
    transition: transform .18s ease, box-shadow .18s ease;
}

.student-quick:hover,
.student-quick:focus-visible {
    color: var(--student-ink);
    transform: translateY(-2px);
    box-shadow: 0 10px 22px rgb(20 50 120 / 12%);
}

.student-quick__icon {
    inline-size: 38px;
    block-size: 38px;
    order: 2;
}

.student-quick__icon .student-line-icon {
    inline-size: 22px;
    block-size: 22px;
}

/* ---------- Live sessions ---------- */
.student-live-list {
    display: grid;
    gap: .55rem;
}

.student-live-card {
    display: flex;
    align-items: center;
    gap: .6rem;
    flex-wrap: wrap;
    padding: .8rem;
    background: #fff;
    border: 1px solid var(--student-line);
    border-radius: 18px;
    box-shadow: var(--student-shadow);
}

.student-live-card__icon {
    inline-size: 40px;
    block-size: 40px;
}

.student-live-card__icon .student-line-icon {
    inline-size: 22px;
    block-size: 22px;
}

.student-live-card__body {
    flex: 1;
    min-inline-size: 0;
}

.student-live-card__body h3 {
    margin: 0;
    color: var(--student-ink);
    font-size: .9rem !important;
    font-weight: 800;
}

.student-live-card__body p {
    margin: .1rem 0 0;
    color: #8a97b5;
    font-size: .72rem;
}

.student-live-card__join {
    padding: .35rem .75rem;
    color: #fff;
    background: linear-gradient(145deg, #2f86ff, #0b46d8);
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 800;
    text-decoration: none;
}

.student-live-card__reason {
    color: #8a97b5;
    font-size: .7rem;
}

/* ---------- Attendance ---------- */
.student-attendance {
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--student-line);
    border-radius: 20px;
    box-shadow: var(--student-shadow);
}

.student-attendance__summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: 1rem;
    cursor: pointer;
    list-style: none;
}

.student-attendance__summary::-webkit-details-marker {
    display: none;
}

.student-attendance__title {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    color: var(--student-ink);
    font-size: 1rem;
    font-weight: 800;
}

.student-attendance__title .student-line-icon {
    inline-size: 21px;
    block-size: 21px;
    color: #1e6bff;
}

.student-attendance__hint {
    display: inline-flex;
    align-items: center;
    gap: .15rem;
    color: #1e6bff;
    font-size: .75rem;
    font-weight: 700;
}

.student-attendance__hint .student-line-icon {
    inline-size: 13px;
    block-size: 13px;
    transition: transform .2s ease;
}

.student-attendance[open] .student-attendance__hint .student-line-icon {
    transform: rotate(-90deg);
}

.student-attendance__body {
    padding: 0 1rem 1rem;
}

.student-attendance__toolbar {
    margin-block-end: .7rem;
}

.student-pill-btn {
    padding: .35rem .8rem;
    color: #33507f;
    background: #f4f8ff;
    border: 1px solid #dbe6fb;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 700;
    font-family: inherit;
}

.student-table-wrap {
    border: 1px solid #e8effb;
    border-radius: 14px;
}

.student-table {
    margin: 0;
    font-size: .8rem;
}

.student-table th,
.student-table td {
    padding: .6rem .8rem;
    border-color: #eef3fc;
}

.student-table thead th {
    color: #8a97b5;
    background: #f7faff;
    font-size: .72rem;
    font-weight: 800;
}

.student-status-pill {
    display: inline-block;
    padding: .2rem .6rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 800;
}

.student-status-pill.status-present { color: #0d9b64; background: #d8f8e8; }
.student-status-pill.status-absent { color: #d92d5c; background: #ffe4ea; }
.student-status-pill.status-leave { color: #b7791f; background: #fff4dc; }
.student-status-pill.status-online { color: #1e6bff; background: #e6f0ff; }

.student-logout {
    display: inline-flex;
    align-items: center;
    justify-self: center;
    padding: .5rem 1rem;
    color: #7b88a8;
    font-size: .8rem;
    font-weight: 700;
    text-decoration: none;
}

.student-logout:hover {
    color: #d92d5c;
}

/* ---------- Unified Responsive Navigation (Bottom on Mobile -> Top Pill on Desktop) ---------- */
/* Global override against style.css generic nav */
nav.ds-bottom-nav,
.ds-bottom-nav,
.ds-bottom-nav-student,
.ds-bottom-nav-teacher,
.ds-bottom-nav-admin {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border-bottom: none !important;
}

/* Mobile (< 992px): Fixed Bottom Navigation Bar */
.ds-bottom-nav,
.ds-bottom-nav-student,
.ds-bottom-nav-teacher,
.ds-bottom-nav-admin {
    position: fixed !important;
    inset-inline: 0 !important;
    bottom: 0 !important;
    top: auto !important;
    margin: 0 !important;
    padding: .45rem .55rem calc(.45rem + env(safe-area-inset-bottom)) !important;
    gap: .15rem !important;
    background: #ffffff !important;
    border-top: 1px solid #e6eefc !important;
    border-radius: 24px 24px 0 0 !important;
    box-shadow: 0 -8px 24px rgb(16 42 110 / 10%) !important;
    z-index: 1040 !important;
    display: flex !important;
    justify-content: space-around !important;
    align-items: center !important;
    transition: transform 0.25s ease, visibility 0.25s ease !important;
}

.ds-bottom-nav a,
.ds-bottom-nav-student a,
.ds-bottom-nav-teacher a,
.ds-bottom-nav-admin a {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: .15rem !important;
    min-inline-size: 0 !important;
    min-block-size: 54px !important;
    padding: .35rem .15rem !important;
    color: #64748b !important;
    border-radius: 14px !important;
    font-size: clamp(.62rem, 2.5vw, .72rem) !important;
    font-weight: 700 !important;
    text-align: center !important;
    text-decoration: none !important;
    transition: all .18s ease !important;
    background: transparent !important;
    border: none !important;
}

.ds-bottom-nav a .student-line-icon,
.ds-bottom-nav-student a .student-line-icon,
.ds-bottom-nav-teacher a .student-line-icon,
.ds-bottom-nav-admin a .student-line-icon {
    inline-size: 22px !important;
    block-size: 22px !important;
    color: #64748b !important;
    transition: transform 0.18s ease, color 0.18s ease !important;
}

.ds-bottom-nav a:hover,
.ds-bottom-nav-student a:hover,
.ds-bottom-nav-teacher a:hover,
.ds-bottom-nav-admin a:hover {
    color: #0f172a !important;
}

.ds-bottom-nav a.active,
.ds-bottom-nav-student a.active,
.ds-bottom-nav-teacher a.active,
.ds-bottom-nav-admin a.active {
    color: #ffffff !important;
    background: linear-gradient(145deg, #2f86ff, #0b46d8) !important;
    border-radius: 14px !important;
    box-shadow: 0 4px 14px rgb(17 80 220 / 35%) !important;
}

.ds-bottom-nav a.active .student-line-icon,
.ds-bottom-nav-student a.active .student-line-icon,
.ds-bottom-nav-teacher a.active .student-line-icon,
.ds-bottom-nav-admin a.active .student-line-icon {
    color: #ffffff !important;
}

/* Desktop (>= 992px): Floating Top Pill Bar Inside Header */
@media (min-width: 992px) {
    .role-appbar__nav-container,
    .student-appbar__nav-container {
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        width: 100% !important;
        margin-top: 14px !important;
        grid-column: 1 / -1 !important;
    }

    .ds-bottom-nav,
    .ds-bottom-nav-student,
    .ds-bottom-nav-teacher,
    .ds-bottom-nav-admin {
        position: static !important;
        inset-inline: auto !important;
        bottom: auto !important;
        top: auto !important;
        z-index: 10 !important;
        display: inline-flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: center !important;
        width: fit-content !important;
        max-width: 100% !important;
        background: #ffffff !important;
        border: 1px solid rgba(255, 255, 255, 0.4) !important;
        border-radius: 999px !important;
        padding: 5px 8px !important;
        margin: 0 auto !important;
        box-shadow: 0 8px 24px rgba(10, 25, 80, 0.18), 0 2px 6px rgba(0, 0, 0, 0.08) !important;
        gap: 4px !important;
        backdrop-filter: none !important;
        transform: none !important;
        visibility: visible !important;
    }

    .ds-bottom-nav.is-scrolled-away,
    .ds-bottom-nav-student.is-scrolled-away,
    .ds-bottom-nav-teacher.is-scrolled-away,
    .ds-bottom-nav-admin.is-scrolled-away {
        transform: none !important;
        visibility: visible !important;
    }

    .ds-bottom-nav a,
    .ds-bottom-nav-student a,
    .ds-bottom-nav-teacher a,
    .ds-bottom-nav-admin a {
        flex: 0 0 auto !important;
        display: inline-flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 7px !important;
        min-block-size: auto !important;
        padding: 7px 18px !important;
        color: #334155 !important;
        font-weight: 700 !important;
        font-size: 0.9rem !important;
        border-radius: 999px !important;
        background: transparent !important;
        text-decoration: none !important;
        white-space: nowrap !important;
        transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    }

    .ds-bottom-nav a .student-line-icon,
    .ds-bottom-nav-student a .student-line-icon,
    .ds-bottom-nav-teacher a .student-line-icon,
    .ds-bottom-nav-admin a .student-line-icon {
        inline-size: 19px !important;
        block-size: 19px !important;
        color: #475569 !important;
    }

    .ds-bottom-nav a:hover,
    .ds-bottom-nav-student a:hover,
    .ds-bottom-nav-teacher a:hover,
    .ds-bottom-nav-admin a:hover {
        background: #f1f5f9 !important;
        color: #0f172a !important;
        transform: translateY(-1px) !important;
    }

    .ds-bottom-nav a:hover .student-line-icon,
    .ds-bottom-nav-student a:hover .student-line-icon,
    .ds-bottom-nav-teacher a:hover .student-line-icon,
    .ds-bottom-nav-admin a:hover .student-line-icon {
        color: #0f172a !important;
        transform: scale(1.08) !important;
    }

    .ds-bottom-nav a.active,
    .ds-bottom-nav-student a.active,
    .ds-bottom-nav-teacher a.active,
    .ds-bottom-nav-admin a.active {
        background: linear-gradient(145deg, #2f86ff, #0b46d8) !important;
        color: #ffffff !important;
        box-shadow: 0 4px 14px rgba(17, 80, 220, 0.35) !important;
        transform: none !important;
    }

    .ds-bottom-nav a.active .student-line-icon,
    .ds-bottom-nav-student a.active .student-line-icon,
    .ds-bottom-nav-teacher a.active .student-line-icon,
    .ds-bottom-nav-admin a.active .student-line-icon {
        color: #ffffff !important;
    }
}

/* ---------- Role Masthead / Appbar (Teacher & Admin) ---------- */
.role-appbar {
    position: relative;
    z-index: 100;
    color: #fff;
    background:
        radial-gradient(circle at 12% 8%, rgb(96 92 255 / 45%), transparent 46%),
        radial-gradient(circle at 88% 0%, rgb(0 196 255 / 32%), transparent 52%),
        linear-gradient(118deg, #091550, #152a86 55%, #3b2b8f);
    border-radius: 0 0 28px 28px;
    box-shadow: 0 12px 30px rgb(10 25 80 / 22%);
    padding: calc(12px + env(safe-area-inset-top)) max(16px, calc((100vw - 1180px) / 2)) 16px;
    margin-bottom: 24px;
}

.role-appbar__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.role-appbar__brand-wrap {
    display: flex;
    align-items: center;
    gap: .75rem;
    text-decoration: none;
    color: #fff;
}

.role-appbar__logo {
    display: grid;
    place-items: center;
    inline-size: 40px;
    block-size: 40px;
    filter: drop-shadow(0 4px 10px rgb(0 40 130 / 40%));
}

.role-appbar__logo svg {
    inline-size: 100%;
    block-size: 100%;
}

.role-appbar__brand-title {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.role-appbar__school {
    font-size: 1rem;
    font-weight: 800;
    color: #fff;
}

.role-appbar__product {
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .02em;
    color: #6fe6ff;
}

.role-appbar__product span {
    color: #5fdcff;
}

.role-appbar__user {
    display: flex;
    align-items: center;
    gap: .65rem;
}

.role-appbar__avatar {
    position: relative;
    display: inline-grid;
    place-items: center;
    inline-size: 44px;
    block-size: 44px;
    border-radius: 50%;
    background: #dff2ff;
    border: 2px solid rgb(255 255 255 / 85%);
    box-shadow: 0 0 0 2px rgb(45 208 192 / 55%);
}

.role-appbar__avatar svg,
.role-appbar__avatar img {
    inline-size: 100%;
    block-size: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.role-appbar__online {
    position: absolute;
    bottom: -1px;
    left: -1px;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #2fe08a;
    border: 2px solid #0d1c63;
}

.role-appbar__meta {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.role-appbar__greeting {
    font-size: .95rem;
    font-weight: 800;
    white-space: nowrap;
}

.role-appbar__role-badge {
    font-size: .7rem;
    font-weight: 700;
    color: rgb(219 236 255 / 85%);
}

.role-appbar__actions {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.role-appbar__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    min-height: 38px;
    padding: .4rem .85rem;
    color: #e6f3ff;
    background: rgb(255 255 255 / 12%);
    border: 1px solid rgb(255 255 255 / 22%);
    border-radius: 999px;
    text-decoration: none;
    font-size: .85rem;
    font-weight: 700;
    transition: all .2s ease;
    white-space: nowrap;
    cursor: pointer;
}

.role-appbar__btn:hover,
.role-appbar__btn:focus-visible {
    color: #fff;
    background: rgb(255 255 255 / 24%);
    transform: translateY(-1px);
}

.role-appbar__btn.is-danger {
    background: rgb(220 53 69 / 25%);
    border-color: rgb(248 113 113 / 40%);
    color: #fca5a5;
}

.role-appbar__btn.is-danger:hover {
    background: rgb(220 53 69 / 45%);
    color: #fff;
}

.role-appbar__desktop-nav {
    display: flex;
    align-items: center;
    gap: .45rem;
    flex-wrap: wrap;
    margin-top: .75rem;
    padding-top: .75rem;
    border-top: 1px solid rgb(255 255 255 / 15%);
}

.role-nav-pill {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .38rem .85rem;
    border-radius: 999px;
    font-size: .82rem;
    font-weight: 700;
    color: rgb(235 245 255 / 90%);
    background: rgb(255 255 255 / 8%);
    border: 1px solid rgb(255 255 255 / 16%);
    text-decoration: none;
    transition: all .18s ease;
}

.role-nav-pill:hover {
    color: #fff;
    background: rgb(255 255 255 / 22%);
    transform: translateY(-1px);
}

.role-nav-pill.active {
    color: #fff;
    background: linear-gradient(145deg, #2f86ff, #0b46d8);
    border-color: transparent;
    box-shadow: 0 4px 14px rgb(17 80 220 / 40%);
}

.role-nav-pill .student-line-icon {
    inline-size: 17px;
    block-size: 17px;
}

@media (max-width: 991.98px) {
    .role-appbar__desktop-nav {
        display: none !important;
    }
    .role-appbar {
        border-radius: 0 0 24px 24px;
        padding-bottom: 12px;
        margin-bottom: 16px;
    }
}

/* ---------- Responsive ---------- */
@media (max-width: 599px) {
    .student-appbar {
        grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
        padding-inline: 10px;
        gap: .25rem;
    }

    .student-appbar__avatar {
        inline-size: 44px;
        block-size: 44px;
    }

    .student-appbar__hello {
        font-size: .9rem;
    }

    .student-appbar__sub {
        font-size: .58rem;
    }

    .student-appbar__action {
        inline-size: 32px;
        block-size: 32px;
        border-radius: 11px;
    }

    .student-appbar__action .student-line-icon {
        inline-size: 18px;
        block-size: 18px;
    }

    .student-appbar__actions {
        gap: .3rem;
    }

    .student-appbar__logo {
        inline-size: 30px;
        block-size: 30px;
    }

    .student-appbar__wordmark {
        font-size: .78rem;
    }

    .student-appbar__tagline {
        display: none;
    }

    .student-progress-card {
        flex-direction: column;
        align-items: stretch;
        gap: .8rem;
    }

    .student-progress-card__ring {
        align-self: center;
        order: -1;
    }
}

@media (max-width: 339px) {
    .student-appbar__brand {
        display: none;
    }

    .student-appbar {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .student-class-grid,
    .student-subject-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 768px) {
    .student-quick-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* ============================================================
   Student sub-pages — shared layout (lessons, account, leaves)
   ============================================================ */
.student-app--wide {
    max-inline-size: 1180px;
}

.student-page {
    padding-block-start: 0;
}

.student-page > .student-search {
    margin-block-start: 0;
}

/* Page hero */
.student-page__hero {
    position: relative;
    z-index: 6;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-block-start: -30px;
    padding: clamp(14px, 3.5vw, 20px);
    overflow: hidden;
    color: #fff;
    background:
        radial-gradient(circle at 12% 90%, rgb(0 214 255 / 42%), transparent 52%),
        linear-gradient(120deg, #071a5c, #112d86 58%, #2436a8);
    border: 1px solid rgb(94 220 255 / 42%);
    border-radius: 24px;
    box-shadow: 0 16px 36px rgb(13 34 110 / 24%);
}

.student-page__hero-copy {
    position: relative;
    z-index: 2;
    flex: 1 1 auto;
    min-inline-size: 0;
}

.student-page__eyebrow {
    display: inline-block;
    margin-block-end: .25rem;
    color: #8fe9ff;
    font-size: clamp(.58rem, 2vw, .68rem);
    font-weight: 800;
    letter-spacing: .06em;
}

.student-page__hero h1 {
    margin: 0;
    color: #fff !important;
    font-size: clamp(1.2rem, 4.5vw, 1.6rem) !important;
    font-weight: 800 !important;
    line-height: 1.25;
    overflow-wrap: break-word;
}

.student-page__hero p {
    margin: .2rem 0 0;
    color: rgb(226 240 255 / 88%);
    font-size: clamp(.72rem, 2.6vw, .84rem);
    line-height: 1.6;
}

.student-page__hero-icon {
    display: inline-grid;
    place-items: center;
    flex: none;
    inline-size: clamp(46px, 13vw, 58px);
    block-size: clamp(46px, 13vw, 58px);
    color: #fff;
    border-radius: 18px;
    box-shadow: 0 8px 20px rgb(0 20 80 / 32%);
}

.student-page__hero-icon .student-line-icon {
    inline-size: 55%;
    block-size: 55%;
}

.student-page__badges {
    display: flex;
    flex-wrap: wrap;
    gap: .3rem;
    margin-block-start: .5rem;
}

/* Chips */
.student-chip {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    padding: .22rem .55rem;
    color: #1e6bff;
    background: #eaf1ff;
    border-radius: 999px;
    font-size: clamp(.6rem, 2vw, .7rem);
    font-weight: 800;
    line-height: 1.4;
    white-space: nowrap;
}

.student-chip .student-line-icon {
    inline-size: 12px;
    block-size: 12px;
}

.student-chip.is-soft { color: #4b5c82; background: #eef2ff; }
.student-chip.is-warn { color: #b7791f; background: #fff4dc; }
.student-chip.is-success { color: #0d9b64; background: #d8f8e8; }
.student-chip.is-danger { color: #d92d5c; background: #ffe4ea; }

/* Cards */
.student-card {
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--student-line);
    border-radius: 20px;
    box-shadow: var(--student-shadow);
}

.student-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .6rem;
    padding: .95rem 1rem;
    border-block-end: 1px solid #eef3fc;
}

.student-card__head h2 {
    display: flex;
    align-items: center;
    gap: .45rem;
    margin: 0;
    color: var(--student-ink);
    font-size: clamp(.92rem, 3vw, 1.05rem) !important;
    font-weight: 800;
    line-height: 1.35;
}

.student-card__head h2 .student-line-icon {
    inline-size: 20px;
    block-size: 20px;
    color: #1e6bff;
}

.student-card__body {
    padding: 1rem;
}

.student-muted {
    color: #8a97b5;
    font-size: .8rem;
}

/* Buttons */
.student-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .3rem;
    padding: .5rem .85rem;
    color: #33507f;
    background: #f2f7ff;
    border: 1px solid #dbe6fb;
    border-radius: 999px;
    font-family: inherit;
    font-size: clamp(.7rem, 2.4vw, .8rem);
    font-weight: 800;
    line-height: 1.4;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: background .18s ease, color .18s ease, transform .18s ease;
}

.student-btn .student-line-icon {
    inline-size: 15px;
    block-size: 15px;
}

.student-btn:hover,
.student-btn:focus-visible {
    color: #0b46d8;
    background: #e6f0ff;
    transform: translateY(-1px);
}

.student-btn--primary {
    color: #fff;
    background: linear-gradient(145deg, #2f86ff, #0b46d8);
    border-color: transparent;
    box-shadow: 0 8px 18px rgb(17 80 220 / 28%);
}

.student-btn--primary:hover,
.student-btn--primary:focus-visible {
    color: #fff;
    background: linear-gradient(145deg, #2f86ff, #0b46d8);
}

.student-btn--danger {
    color: #d92d5c;
    background: #ffe4ea;
    border-color: #ffd0da;
}

.student-btn--danger:hover,
.student-btn--danger:focus-visible {
    color: #b81f4b;
    background: #ffd7e1;
}

.student-btn--sm {
    padding: .35rem .65rem;
    font-size: .7rem;
}

.student-btn--block {
    inline-size: 100%;
}

.student-btn:disabled {
    opacity: .62;
    cursor: default;
    transform: none;
}

/* Detail grid */
.student-detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: .9rem;
    align-items: start;
}

.student-detail-main,
.student-detail-side {
    display: grid;
    gap: .9rem;
    align-content: start;
    min-inline-size: 0;
}

@media (min-width: 768px) {
    .student-detail-grid {
        grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
    }
}

.student-lesson-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    align-items: center;
}

/* Lesson cards */
.student-lesson-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: .7rem;
}

@media (min-width: 700px) {
    .student-lesson-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.student-lesson-card {
    display: flex;
    flex-direction: column;
    gap: .6rem;
    padding: .85rem;
    background: linear-gradient(180deg, #fff, #f6faff);
    border: 1px solid var(--student-line);
    border-radius: 18px;
    box-shadow: 0 8px 20px rgb(20 50 120 / 7%);
}

.student-lesson-card[hidden] {
    display: none;
}

.student-lesson-card__head {
    display: flex;
    align-items: flex-start;
    gap: .5rem;
    min-inline-size: 0;
}

.student-lesson-card__title {
    flex: 1;
    min-inline-size: 0;
}

.student-lesson-card__title h3 {
    margin: 0;
    color: var(--student-ink);
    font-size: clamp(.82rem, 3vw, .96rem) !important;
    font-weight: 800;
    line-height: 1.3;
    overflow-wrap: break-word;
}

.student-lesson-card__title p {
    margin: .15rem 0 0;
    color: #8a97b5;
    font-size: clamp(.62rem, 2.2vw, .72rem);
}

.student-lesson-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
}

.student-lesson-card__meta > span {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    padding: .22rem .55rem;
    color: #3c5688;
    background: #eef4ff;
    border-radius: 999px;
    font-size: clamp(.58rem, 2vw, .66rem);
    font-weight: 700;
}

.student-lesson-card__meta .student-line-icon {
    inline-size: 12px;
    block-size: 12px;
}

.student-lesson-card__actions {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin-block-start: auto;
}

/* Lesson content */
.student-mini-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: .55rem;
}

@media (min-width: 600px) {
    .student-mini-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.student-mini-card {
    padding: .7rem;
    background: #f5f9ff;
    border: 1px solid #e8effb;
    border-radius: 14px;
}

.student-mini-card__title {
    margin-block-end: .25rem;
    color: var(--student-ink);
    font-size: .85rem;
    font-weight: 800;
}

.student-mini-card ul {
    margin: 0;
    padding-inline-start: 1.1rem;
    color: #5b6b8f;
    font-size: .76rem;
}

.student-mini-card p {
    color: #5b6b8f;
    font-size: .76rem;
}

.student-media {
    inline-size: 100%;
    max-block-size: 380px;
    margin-block-end: .6rem;
    border-radius: 14px;
}

.student-activity-list {
    display: grid;
    gap: .75rem;
}

.activity-item {
    padding-block-end: .75rem;
    border-block-end: 1px dashed #e0e9fa;
}

.activity-item:last-child {
    padding-block-end: 0;
    border-block-end: 0;
}

.student-activity-item__title {
    margin-block-end: .45rem;
    color: var(--student-ink);
    font-size: .85rem;
    font-weight: 800;
    line-height: 1.5;
}

.student-options {
    display: grid;
    gap: .35rem;
    margin-block-end: .5rem;
}

.opt-row {
    display: flex;
    gap: .5rem;
    align-items: flex-start;
    padding: .45rem .6rem;
    background: #fff;
    border: 1px solid #dbe6fb;
    border-radius: 12px;
    font-size: .8rem;
    cursor: pointer;
}

.opt-row:hover {
    border-color: #1e6bff;
    background: #f7faff;
}

/* Forms */
.student-form {
    display: grid;
    gap: .75rem;
}

.student-form__field {
    display: grid;
    gap: .25rem;
}

.student-form__field label {
    color: #5b6b8f;
    font-size: .75rem;
    font-weight: 700;
}

.student-form__field input,
.student-form__field textarea,
.student-textarea {
    inline-size: 100%;
    padding: .55rem .7rem;
    color: var(--student-ink);
    background: #f8fbff;
    border: 1px solid #dbe6fb;
    border-radius: 12px;
    font-family: inherit;
    font-size: .85rem;
}

.student-form__field input:focus,
.student-form__field textarea:focus,
.student-textarea:focus {
    outline: 2px solid rgb(30 107 255 / 22%);
    border-color: #1e6bff;
}

/* Alerts */
.student-alert {
    padding: .7rem .9rem;
    border-radius: 14px;
    font-size: .82rem;
    font-weight: 700;
}

.student-alert.is-success {
    color: #0d9b64;
    background: #ddf9ec;
    border: 1px solid #bdf0d6;
}

/* Account */
.student-account-card {
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--student-line);
    border-radius: 22px;
    box-shadow: var(--student-shadow);
}

.student-account-card__profile {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 1rem;
    background:
        radial-gradient(circle at 10% 90%, rgb(88 220 255 / 22%), transparent 50%),
        linear-gradient(120deg, #eef5ff, #e4eeff);
    border-block-end: 1px solid #e8effb;
}

.student-account-card__avatar {
    flex: none;
    inline-size: 58px;
    block-size: 58px;
    overflow: hidden;
    background: #dff2ff;
    border: 3px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 0 3px rgb(45 208 192 / 35%);
}

.student-account-card__avatar img {
    inline-size: 100%;
    block-size: 100%;
    object-fit: cover;
    display: block;
}

.student-account-card__identity {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-inline-size: 0;
}

.student-account-card__identity strong {
    color: var(--student-ink);
    font-size: .95rem;
    font-weight: 800;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.student-account-card__identity span {
    color: #8a97b5;
    font-size: .72rem;
}

.student-account-list {
    display: grid;
}

.student-account-link {
    display: flex;
    align-items: center;
    gap: .65rem;
    inline-size: 100%;
    padding: .8rem 1rem;
    color: var(--student-ink);
    background: #fff;
    border: 0;
    border-block-end: 1px solid #f0f4fc;
    font-family: inherit;
    text-align: start;
    text-decoration: none;
    cursor: pointer;
}

.student-account-link:last-child {
    border-block-end: 0;
}

.student-account-link:hover,
.student-account-link:focus-visible {
    background: #f7faff;
}

.student-account-link__icon {
    display: inline-grid;
    place-items: center;
    flex: none;
    inline-size: 40px;
    block-size: 40px;
    color: #fff;
    border-radius: 12px;
}

.student-account-link__icon .student-line-icon {
    inline-size: 22px;
    block-size: 22px;
}

.student-account-link__text {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-inline-size: 0;
}

.student-account-link__text strong {
    font-size: .86rem;
    font-weight: 800;
}

.student-account-link__text small {
    color: #8a97b5;
    font-size: .7rem;
}

.student-account-link__arrow {
    flex: none;
    color: #b3c0d8;
}

.student-account-link__arrow .student-line-icon {
    inline-size: 16px;
    block-size: 16px;
}

.student-account-link.is-danger .student-account-link__text strong {
    color: #d92d5c;
}

.student-account-details summary {
    list-style: none;
}

.student-account-details summary::-webkit-details-marker {
    display: none;
}

.student-account-details[open] > summary {
    background: #f7faff;
}

.student-account-languages {
    display: flex;
    gap: .4rem;
    padding: .2rem 1rem .8rem;
}

.student-account-languages a {
    flex: 1;
    padding: .4rem;
    color: #1e6bff;
    background: #eef4ff;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 800;
    text-align: center;
    text-decoration: none;
}

.student-account-languages a:hover {
    background: #e0ebff;
}

/* Leaves */
.student-leave-list {
    display: grid;
    gap: .6rem;
}

.student-leave-card {
    padding: .75rem;
    background: #f8fbff;
    border: 1px solid #e8effb;
    border-radius: 14px;
}

.student-leave-card__top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
}

.student-leave-card__dates {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    color: #33507f;
    font-size: .78rem;
    font-weight: 800;
}

.student-leave-card__reason {
    margin: .45rem 0 0;
    color: #5b6b8f;
    font-size: .78rem;
    line-height: 1.6;
}

.student-leave-card .student-btn {
    margin-block-start: .55rem;
}

@media (min-width: 900px) {
    .student-leaves-grid {
        grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr);
    }
}

/* Student modal */
.student-modal {
    border: 0;
    border-radius: 20px;
    box-shadow: 0 24px 60px rgb(10 25 80 / 28%);
}

.student-modal .modal-header,
.student-modal .modal-footer {
    border-color: #eef3fc;
}

/* Timetable heading */
.student-app--wide .student-week-heading {
    margin-block: 1rem .4rem;
}

.student-app--wide .student-week-heading h1 {
    color: var(--student-ink) !important;
    font-size: clamp(1.15rem, 3vw, 1.4rem) !important;
}

.student-app--wide .student-week-heading p {
    color: #8a97b5;
    font-size: .82rem;
}

.student-app--wide .student-week-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    justify-content: flex-start;
}

.student-app--wide .student-week-actions .btn {
    margin-inline-end: 0 !important;
}

@media (max-width: 599px) {
    .student-page__hero {
        margin-block-start: -24px;
        border-radius: 20px;
    }

    .student-card__body {
        padding: .85rem;
    }

    .student-account-card__profile {
        padding: .85rem;
    }

    .student-account-link {
        padding: .7rem .85rem;
    }

    .student-account-link__icon {
        inline-size: 36px;
        block-size: 36px;
    }
}

/* ---------- Admin dashboard: clickable class attendance cards ---------- */
.student-class-attendance-card {
    justify-content: center;
    min-block-size: 92px;
    color: inherit;
    text-decoration: none;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.student-class-attendance-card .student-subject-card__top {
    inline-size: 100%;
    align-items: center;
}

.student-class-attendance-card:hover,
.student-class-attendance-card:focus-visible {
    color: inherit;
    border-color: #1e6bff;
    transform: translateY(-2px);
    box-shadow: 0 12px 26px rgb(20 50 120 / 12%);
}

.student-class-attendance-card__arrow {
    display: inline-flex;
    flex: none;
    margin-inline-start: auto;
    color: #b3c0d8;
}

.student-class-attendance-card__arrow .student-line-icon {
    inline-size: 18px;
    block-size: 18px;
}

.student-class-attendance-card:hover .student-class-attendance-card__arrow,
.student-class-attendance-card:focus-visible .student-class-attendance-card__arrow {
    color: #1e6bff;
}

.student-class-attendance-grid {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

/* ---------- Admin pages: shared header + books table responsiveness ---------- */
.admin-page .student-page__hero {
    margin-block-start: 0;
}

.admin-page__hero {
    margin-block-end: .25rem;
}

.admin-page__hero-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
    flex: none;
}

.books-table {
    inline-size: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: clamp(.74rem, 1.5vw, .86rem);
}

.books-table th,
.books-table td {
    padding: .7rem .55rem;
    vertical-align: middle;
    overflow-wrap: anywhere;
    word-break: normal;
}

.books-table thead th {
    color: #5b6b8f;
    background: #f7faff;
    font-size: clamp(.62rem, 1.4vw, .72rem);
    font-weight: 800;
    white-space: nowrap;
}

.books-table tbody td {
    border-color: #eef3fc;
}

.books-table th:nth-child(1),
.books-table td:nth-child(1) {
    width: 40px;
}

.books-table th:nth-child(2),
.books-table td:nth-child(2) {
    width: 26%;
}

.books-table th:nth-child(3),
.books-table td:nth-child(3) {
    width: 16%;
}

.books-table th:nth-child(4),
.books-table td:nth-child(4) {
    width: 26%;
}

.books-table th:nth-child(5),
.books-table td:nth-child(5) {
    width: 150px;
    white-space: nowrap;
}

.books-table td.fw-bold {
    color: var(--student-ink, #101b4a);
    font-size: clamp(.8rem, 2.2vw, .95rem);
    font-weight: 800;
    white-space: normal;
}

.books-table .row-actions {
    flex-wrap: nowrap;
    gap: 5px;
}

.books-table .action-icon-btn {
    inline-size: 32px;
    block-size: 32px;
}

@media (max-width: 767.98px) {
    .books-table,
    .books-table tbody,
    .books-table tr,
    .books-table td {
        display: block;
        inline-size: 100%;
    }

    .books-table {
        min-width: 0;
        border: 0;
    }

    .books-table thead {
        display: none;
    }

    .books-table tbody {
        display: grid;
        gap: .7rem;
        padding: .75rem;
    }

    .books-table tr.book-row {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: .4rem .6rem;
        padding: .8rem;
        background: #fff;
        border: 1px solid #e3ebfa;
        border-radius: 16px;
        box-shadow: 0 6px 16px rgb(20 50 120 / 6%);
    }

    .books-table td {
        inline-size: auto !important;
        padding: 0 !important;
        border: 0 !important;
    }

    .books-table td.row-index {
        display: none;
    }

    .books-table td::before {
        content: attr(data-label);
        display: block;
        margin-block-end: .15rem;
        color: #8a97b5;
        font-size: .62rem;
        font-weight: 800;
    }

    .books-table td:nth-child(2),
    .books-table td:nth-child(3),
    .books-table td:nth-child(4),
    .books-table td:nth-child(5) {
        grid-column: 1 / -1;
    }

    .books-table td:nth-child(2) {
        order: 1;
        font-size: .95rem;
    }

    .books-table td:nth-child(3) {
        order: 2;
        color: #8a97b5;
        font-size: .76rem;
    }

    .books-table td:nth-child(4) {
        order: 3;
    }

    .books-table td:nth-child(5) {
        order: 4;
        display: flex;
        justify-content: flex-start;
        padding-block-start: .45rem !important;
        border-block-start: 1px dashed #e8effb !important;
    }

    .books-table td:nth-child(2)::before,
    .books-table td:nth-child(3)::before,
    .books-table td:nth-child(5)::before {
        display: none;
    }

    .books-table .row-actions {
        flex-wrap: wrap;
        gap: .35rem;
    }
}

@media (max-width: 767.98px) {
    .books-table td {
        width: 100% !important;
        max-width: 100%;
        text-align: start !important;
        background: transparent !important;
    }

    .books-table td:nth-child(4) .d-flex {
        justify-content: flex-start;
    }
}

/* ---------- Users management table responsiveness ---------- */
.users-table {
    inline-size: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: clamp(.74rem, 1.5vw, .86rem);
}

.users-table th,
.users-table td {
    padding: .7rem .6rem;
    vertical-align: middle;
    overflow-wrap: anywhere;
    word-break: normal;
}

.users-table thead th {
    color: #5b6b8f;
    background: #f7faff;
    font-size: clamp(.62rem, 1.4vw, .72rem);
    font-weight: 800;
    white-space: nowrap;
}

.users-table th:nth-child(1),
.users-table td:nth-child(1) {
    width: 70px;
}

.users-table th:nth-child(2),
.users-table td:nth-child(2) {
    width: 30%;
}

.users-table th:nth-child(3),
.users-table td:nth-child(3) {
    width: 22%;
}

.users-table th:nth-child(4),
.users-table td:nth-child(4) {
    width: 14%;
}

.users-table th:nth-child(5),
.users-table td:nth-child(5) {
    width: 170px;
    white-space: nowrap;
}

.users-table td.fw-bold {
    color: var(--student-ink, #101b4a);
    font-size: clamp(.8rem, 2vw, .92rem);
    font-weight: 800;
    white-space: normal;
}

.users-table td:nth-child(3) code {
    display: inline-block;
    max-inline-size: 100%;
    overflow-wrap: anywhere;
    font-size: clamp(.66rem, 1.8vw, .78rem);
}

.users-table td:nth-child(5) .btn {
    margin-inline-start: 0 !important;
}

.users-table td:nth-child(5) .btn + .btn {
    margin-inline-start: .35rem !important;
}

@media (max-width: 767.98px) {
    .users-table,
    .users-table tbody,
    .users-table tr,
    .users-table td {
        display: block;
        inline-size: 100%;
    }

    .users-table {
        min-width: 0;
        border: 0;
    }

    .users-table thead {
        display: none;
    }

    .users-table tbody {
        display: grid;
        gap: .7rem;
        padding: .75rem;
    }

    .users-table tr.user-row {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: .4rem;
        padding: .8rem;
        background: #fff;
        border: 1px solid #e3ebfa;
        border-radius: 16px;
        box-shadow: 0 6px 16px rgb(20 50 120 / 6%);
    }

    .users-table td {
        width: 100% !important;
        max-width: 100%;
        padding: 0 !important;
        border: 0 !important;
        background: transparent !important;
        text-align: start !important;
    }

    .users-table td::before {
        content: attr(data-label);
        display: block;
        margin-block-end: .15rem;
        color: #8a97b5;
        font-size: .62rem;
        font-weight: 800;
    }

    .users-table td:nth-child(1) {
        order: 1;
    }

    .users-table td:nth-child(2) {
        order: 2;
        font-size: .95rem;
    }

    .users-table td:nth-child(3) {
        order: 3;
    }

    .users-table td:nth-child(4) {
        order: 4;
    }

    .users-table td:nth-child(5) {
        order: 5;
        display: flex;
        flex-wrap: wrap;
        justify-content: flex-start;
        padding-block-start: .5rem !important;
        border-block-start: 1px dashed #e8effb !important;
    }

    .users-table td:nth-child(2)::before,
    .users-table td:nth-child(4)::before,
    .users-table td:nth-child(5)::before {
        display: none;
    }

    .users-table td:nth-child(5) .btn {
        margin-inline-start: 0 !important;
    }
}

/* Books table: responsive typography/columns refinement */
.books-table th,
.books-table td {
    font-size: clamp(.7rem, 1.1vw + .3rem, .95rem) !important;
    padding: .6rem .45rem !important;
}

.books-table th:nth-child(1),
.books-table td:nth-child(1) {
    width: 44px !important;
    white-space: nowrap !important;
}

.books-table th:nth-child(2),
.books-table td:nth-child(2) {
    width: 24% !important;
}

.books-table th:nth-child(3),
.books-table td:nth-child(3) {
    width: 20% !important;
    white-space: normal !important;
}

.books-table th:nth-child(4),
.books-table td:nth-child(4) {
    width: 24% !important;
}

.books-table th:nth-child(5),
.books-table td:nth-child(5) {
    width: 150px !important;
}

.books-table td.fw-bold {
    font-size: clamp(.78rem, 1.3vw + .35rem, .98rem) !important;
}

@media (max-width: 767.98px) {
    .books-table th,
    .books-table td {
        font-size: .86rem !important;
    }

    .books-table td:nth-child(1),
    .books-table td:nth-child(2),
    .books-table td:nth-child(3),
    .books-table td:nth-child(4),
    .books-table td:nth-child(5) {
        width: 100% !important;
    }
}

/* ---------- Global responsive data tables ---------- */
.responsive-table {
    inline-size: 100%;
    min-width: 620px; /* منع انضغاط الأعمدة: تمرير أفقي بدل كسر الكلمات حرفاً بحرف */
    border-collapse: separate;
    border-spacing: 0;
    font-size: clamp(.72rem, 1.05vw + .32rem, .92rem);
}

.responsive-table th,
.responsive-table td {
    padding: .6rem .5rem;
    vertical-align: middle;
    word-break: normal;
    hyphens: none;
}

.responsive-table thead th {
    color: #5b6b8f;
    background: #f7faff;
    font-size: clamp(.62rem, 1.2vw + .28rem, .75rem);
    font-weight: 800;
    white-space: nowrap;
}

.responsive-table td.fw-bold {
    white-space: normal;
}

.responsive-table .row-actions {
    flex-wrap: nowrap;
    gap: 5px;
}

@media screen and (max-width: 767.98px) {
    .responsive-table,
    .responsive-table tbody,
    .responsive-table tr,
    .responsive-table td,
    .responsive-table th {
        display: block;
        inline-size: 100%;
    }

    .responsive-table {
        min-width: 0 !important;
        width: 100% !important;
        inline-size: 100% !important;
        border: 0;
    }

    .responsive-table thead {
        display: none;
    }

    .responsive-table tbody {
        display: grid;
        gap: .7rem;
        padding: .75rem;
    }

    .responsive-table tbody tr {
        display: grid;
        gap: .4rem;
        padding: .8rem;
        background: #fff;
        border: 1px solid #e3ebfa;
        border-radius: 16px;
        box-shadow: 0 6px 16px rgb(20 50 120 / 6%);
    }

    .responsive-table tbody tr.table-light,
    .responsive-table tbody tr.table-secondary,
    .responsive-table tbody tr.table-active {
        background: #f7faff;
    }

    .responsive-table td,
    .responsive-table tbody th {
        inline-size: auto !important;
        max-inline-size: 100%;
        width: auto !important;
        min-width: 0 !important;
        padding: 0 !important;
        border: 0 !important;
        background: transparent !important;
        text-align: start !important;
        white-space: normal !important;
        overflow-wrap: anywhere;
    }

    .responsive-table td::before {
        content: attr(data-label);
        display: block;
        margin-block-end: .15rem;
        color: #8a97b5;
        font-size: .62rem;
        font-weight: 800;
    }

    .responsive-table td:empty,
    .responsive-table td:empty::before,
    .responsive-table td[data-colspan="true"]::before,
    .responsive-table td[colspan]::before {
        display: none;
    }

    .responsive-table td[colspan] {
        text-align: center !important;
    }

    .responsive-table tbody th {
        color: #5b6b8f;
        font-size: .8rem;
        font-weight: 800;
    }

    .responsive-table .row-actions {
        flex-wrap: wrap;
        justify-content: flex-start;
    }
}

@media print {
    .responsive-table {
        display: table !important;
    }

    .responsive-table thead {
        display: table-header-group !important;
    }

    .responsive-table tbody {
        display: table-row-group !important;
    }

    .responsive-table tr {
        display: table-row !important;
    }

    .responsive-table th,
    .responsive-table td {
        display: table-cell !important;
    }

    .responsive-table td::before {
        display: none !important;
    }
}

/* ─── School logo in top mastheads (replaces default brand icon) ─── */
.role-appbar__logo img {
    inline-size: 100%;
    block-size: 100%;
    object-fit: contain;
    border-radius: 10px;
    background: #fff;
    padding: 2px;
}
.student-appbar__logo img {
    inline-size: 100%;
    block-size: 100%;
    object-fit: contain;
    border-radius: 10px;
    background: #fff;
    padding: 2px;
}

/* ─── Bottom nav: fit small phones (prevent page auto zoom-out) ─── */
.ds-bottom-nav {
    max-inline-size: 100vw;
    overflow: hidden;
}
.ds-bottom-nav a {
    min-inline-size: 0;
    min-width: 0;
    padding: 8px 2px;
}
.ds-bottom-nav a span {
    max-inline-size: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
@media (max-width: 420px) {
    .ds-bottom-nav a { font-size: 10.5px; padding: 8px 1px; }
    .ds-bottom-nav a i { font-size: 18px; }
    .ds-nav-emoji { font-size: 17px; }
}

/* ─── Role appbar: stack on phones (user+actions row, brand row) ─── */
@media (max-width: 640px) {
    .role-appbar__top {
        flex-wrap: wrap;
        gap: .5rem .75rem;
    }
    .role-appbar__user {
        order: 1;
        flex: 1 1 auto;
        min-inline-size: 0;
    }
    .role-appbar__actions {
        order: 2;
        flex: 0 0 auto;
        margin-inline-start: auto;
    }
    .role-appbar__brand-wrap {
        order: 3;
        flex: 1 1 100%;
        justify-content: center;
    }
    .role-appbar__meta {
        min-inline-size: 0;
    }
    .role-appbar__greeting bdi,
    .role-appbar__greeting {
        max-inline-size: 150px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* ─── student-quick: active state for toggle cards (filters/groupBy) ─── */
a.student-quick.is-active,
button.student-quick.is-active {
    border-color: var(--c-teal);
    box-shadow: 0 0 0 2px rgb(13 148 136 / 18%), var(--student-shadow);
}
a.student-quick.is-active .student-quick__icon,
button.student-quick.is-active .student-quick__icon {
    outline: 2px solid rgb(13 148 136 / 35%);
    outline-offset: 2px;
}

/* ─── شرائط ترقيم الصفحات: لا تخرج عن إطار البطاقة أبداً ─── */
ul.pagination {
    flex-wrap: wrap;              /* التفاف الأسطر بدل التمدد الأفقي */
    justify-content: center;
    row-gap: .25rem;
    max-width: 100%;
}
ul.pagination .page-link {
    white-space: nowrap;          /* الرقم الواحد لا ينكسر أبداً */
}

