/* ============================================================
   STUDENT PORTAL STYLES
   ============================================================ */

:root {
    --bg: #f5faf8;
    --card-bg: #ffffff;
    --text-primary: #11221c;
    --text-secondary: #2a4a3c;
    --shadow: 0 4px 18px rgba(0, 0, 0, 0.03);
    --shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.07);
    --spacing: 22px;
    --radius: 18px;
    --border-color: #dcebe4;
    --primary: #258cc9;
    --primary-light: #e6f2fa;
    --success: #1eb372;
    --danger: #ef4444;
    --warning: #f59e0b;
    --accent-warm: #f472b6;
    --accent-purple: #a78bfa;
    --sidebar-width: 260px;
    --header-height: 64px;
    --font: "Mozilla Text", -apple-system, BlinkMacSystemFont, sans-serif;
}

[data-theme="dark"] {
    --bg: #0a120f;
    --card-bg: #111f19;
    --text-primary: #ecf3f0;
    --text-secondary: #c9dad2;
    --shadow: 0 4px 18px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.4);
    --border-color: #20362c;
    --primary: #38bdf8;
    --primary-light: #1a2e3a;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --accent-warm: #f472b6;
    --accent-purple: #a78bfa;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font);
    -webkit-font-smoothing: antialiased;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg);
    transition: background 0.4s ease, color 0.4s ease;
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
}

/* ============================================================
   LOGIN OVERLAY
   ============================================================ */
#loginOverlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    transition: opacity 0.4s ease, visibility 0s linear 0s;
}
#loginOverlay.hidden {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0s linear 0.4s;
}
.login-card {
    max-width: 400px;
    width: 100%;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 40px 32px;
    box-shadow: var(--shadow-hover);
    text-align: center;
}
.login-card .logo-icon {
    width: 170px;
    height: 170px;
    margin: 0 auto 14px;
    margin-bottom: 40px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 5px 5px 10px rgba(37, 140, 201, 0.2);
}
.login-card .logo-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: inherit;
}
.login-card h2 {
    font-size: 22px;
    margin-bottom: 4px;
}
.login-card p.sub {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 24px;
}

/* ===== Logo-click flip: login card <-> APK download card ===== */
.login-flip-container {
    position: relative; z-index: 1;
    width: 100%; max-width: 400px;
    perspective: 1800px;
    transition: height 0.25s ease;
}
.login-flip-inner {
    position: relative; width: 100%; height: 100%;
    transition: transform 0.6s cubic-bezier(.4,0,.2,1);
    transform-style: preserve-3d;
}
.login-flip-container.flipped .login-flip-inner { transform: rotateY(180deg); }
.login-flip-face {
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}
.login-flip-face .login-card { max-width: none; }
.login-flip-front { position: relative; pointer-events: auto; }
.login-flip-back {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    transform: rotateY(180deg);
    -webkit-transform: rotateY(180deg);
    pointer-events: none;
}
.login-flip-container.flipped .login-flip-front { pointer-events: none; }
.login-flip-container.flipped .login-flip-back { pointer-events: auto; }
.logo-icon img { cursor: pointer; }

/* Compact staff/teacher login card — used by the attendance (Xaadirin)
   back face on index.html, and by teacher.html/staff.html's own fallback
   login screens, so every staff-facing login looks the same. The
   student/parent front face keeps the original bigger sizing. */
.login-flip-back .login-card, .login-card.compact-login { padding: 40px 30px; }
.login-flip-back .logo-icon, .compact-login .logo-icon {
    width: 88px; height: 88px; margin: 0 auto 16px;
    box-shadow: 0 10px 24px rgba(37, 140, 201, 0.2);
}
.login-flip-back p.sub, .compact-login p.sub { font-size: 13px; margin-bottom: 18px; }
.compact-login h2 { font-size: 18px; margin-bottom: 4px; }
.login-flip-back .field-group, .compact-login .field-group { margin-bottom: 14px; }
.login-flip-back .field-group label, .compact-login .field-group label { font-size: 10.5px; margin-bottom: 5px; }
.login-flip-back .field-group input, .compact-login .field-group input { padding: 10px 13px; font-size: 13px; }
.login-flip-back .login-btn, .compact-login .login-btn { padding: 11px; font-size: 13px; border-radius: 12px; }
.login-flip-back .login-error, .compact-login .login-error { padding: 8px 12px; font-size: 12px; margin-bottom: 12px; }
.apk-meta {
    display: flex; justify-content: center; gap: 18px;
    margin-top: 16px; font-size: 12px; color: var(--text-secondary);
}
.apk-meta i { margin-right: 5px; color: var(--primary); }
.apk-note {
    margin-top: 18px; font-size: 11.5px; color: var(--text-secondary);
    line-height: 1.5; text-align: left;
    background: var(--bg); border: 1px solid var(--border-color); border-radius: 12px;
    padding: 10px 12px;
}
.apk-note i { color: var(--primary); margin-right: 4px; }
.field-group {
    text-align: left;
    margin-bottom: 16px;
}
.field-group label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 5px;
}
.field-group input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    transition: border 0.2s, box-shadow 0.2s;
}
.field-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 140, 201, 0.15);
}

/* Chrome/Edge paint autofilled text using the browser's own default
   font-size instead of ours, and only redraw it correctly once the
   field is focused/blurred. These no-op keyframes fire a detectable
   animationstart event the instant autofill happens, so JS can nudge
   the field into redrawing at the right size right away — see the
   "fixAutofillFontSize" listener in student.js / login.js. */
@keyframes onAutoFillStart { from {} to {} }
input:-webkit-autofill {
    animation-name: onAutoFillStart;
    animation-duration: 0.1s;
}

/* Floating label: sits inside the field like a placeholder, then
   slides up onto the border line once the field is focused or has
   a value typed into it. */
.floating-field { position: relative; }
.login-flip-back .floating-field label,
.compact-login .floating-field label {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    margin: 0;
    padding: 0 4px;
    font-size: 13px;
    font-weight: 400;
    text-transform: none;
    letter-spacing: normal;
    color: var(--text-secondary);
    background: transparent;
    pointer-events: none;
    transition: top 0.15s ease, font-size 0.15s ease, transform 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.floating-field input {
    padding: 10px 14px;
}
.login-flip-back .floating-field input:focus + label,
.login-flip-back .floating-field input:not(:placeholder-shown) + label,
.compact-login .floating-field input:focus + label,
.compact-login .floating-field input:not(:placeholder-shown) + label {
    top: 0;
    transform: translateY(-50%);
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    background: var(--card-bg);
    color: var(--primary);
}
.login-error {
    display: none;
    background: #fdecea;
    color: #b91c1c;
    border: 1px solid #f3c7c5;
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 13px;
    margin-bottom: 16px;
    align-items: center;
    gap: 8px;
}
.login-error.show {
    display: flex;
}
.login-btn {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    transition: background 0.2s;
}
.login-btn:hover {
    background: #1a6fa8;
}
.login-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}


/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    width: var(--sidebar-width);
    background: var(--card-bg);
    border-right: 1px solid var(--border-color);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}
.sidebar-brand {
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    min-height: var(--header-height);
}
.sidebar-brand .logo-icon {
    width: 40px;
    height: 40px;
    background: #fff;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 18px;
    font-weight: 800;
    box-shadow: 0 4px 12px rgba(37, 140, 201, 0.25);
    overflow: hidden;
    flex-shrink: 0;
}
.sidebar-brand .logo-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.sidebar-brand h1 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}
.sidebar-brand h1 span {
    color: var(--primary);
}
.sidebar-brand .student-badge {
    font-size: 11px;
    background: var(--success);
    color: #fff;
    padding: 2px 10px;
    border-radius: 30px;
    font-weight: 600;
    letter-spacing: 0.3px;
    margin-left: 4px;
}
.sidebar-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 8px 10px 20px;
}
.nav-item .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 10px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: 0.25s ease;
    cursor: pointer;
    position: relative;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.nav-item .nav-link i {
    width: 20px;
    text-align: center;
    font-size: 15px;
    color: var(--text-secondary);
    transition: color 0.2s;
}
.nav-item .nav-link:hover {
    background: rgba(37, 140, 201, 0.07);
    color: var(--text-primary);
}
.nav-item .nav-link:hover i {
    color: var(--primary);
}
.nav-item .nav-link.active {
    background: rgba(37, 140, 201, 0.11);
    color: var(--primary);
    font-weight: 600;
}
.nav-item .nav-link.active i {
    color: var(--primary);
}
.nav-item .nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 24px;
    background: var(--primary);
    border-radius: 0 4px 4px 0;
}
.sidebar-footer {
    padding: 12px 16px;
    font-size: 11px;
    margin-top: 20px;
    color: var(--text-secondary);
    text-align: center;
    flex-shrink: 0;
}
.sidebar-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: var(--spacing);
}
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--card-bg);
    padding: 12px var(--spacing);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: var(--spacing);
    transition: background 0.4s, box-shadow 0.4s;
    border: 1px solid var(--border-color);
}
.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}
.header-left .menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-primary);
    cursor: pointer;
    padding: 4px;
}
.header-left .breadcrumb {
    font-size: 14px;
    color: var(--text-secondary);
}
.header-left .breadcrumb span {
    color: var(--text-primary);
    font-weight: 600;
}

/* ============================================================
   BOTTOM NAV — mobile-only tab bar mirroring the 5 visible
   sidebar tabs (the Somali-labeled hidden-by-design ones are
   left out here too). Shown/hidden by JS on login/logout via
   inline style; suppressed on desktop below regardless of that,
   since desktop keeps the regular sidebar.
   ============================================================ */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 999;
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
}
.bottom-nav .nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    flex: 1;
    position: relative;
    padding: 4px 2px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-secondary);
    text-decoration: none;
    cursor: pointer;
    transition: color 0.15s;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.bottom-nav .nav-link i {
    font-size: 18px;
}
.bottom-nav .nav-link.active {
    color: var(--primary);
}
.bottom-nav .nav-link .badge-count {
    position: absolute;
    top: -2px;
    right: 18%;
    min-width: 15px;
    height: 15px;
    line-height: 15px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    font-size: 9px;
    text-align: center;
}
@media (min-width: 769px) {
    .bottom-nav {
        display: none !important; /* desktop keeps the sidebar */
    }
}
.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 14px;
    color: var(--text-secondary);
}
.header-right .badge-icon {
    position: relative;
    cursor: pointer;
    transition: transform 0.1s;
}
.header-right .badge-icon:active {
    transform: scale(0.9);
}
.header-right .badge-count {
    position: absolute;
    top: -5px;
    right: -6px;
    background: var(--danger);
    color: #fff;
    font-size: 9px;
    border-radius: 50%;
    padding: 2px 5px;
    font-weight: 700;
    min-width: 18px;
    text-align: center;
}
.theme-toggle {
    cursor: pointer;
    font-size: 18px;
    color: var(--text-secondary);
    transition: color 0.2s;
}
.theme-toggle:hover {
    color: var(--primary);
}
.user-profile {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 6px 14px 6px 10px;
    border-radius: 40px;
    transition: background 0.2s;
    font-weight: 500;
    background: var(--primary-light);
    border: 1px solid var(--border-color);
}
.user-profile:hover {
    background: var(--bg);
}
.user-profile .avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
}
.user-profile .avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

/* ============================================================
   PAGE SECTIONS
   ============================================================ */
.page-content {
    flex: 1;
}
.page-section {
    display: none;
}
.page-section.active {
    display: block;
    animation: fadeUp 0.25s ease;
}
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.page-header {
    margin-bottom: 20px;
}
.page-header h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.page-header h2 i {
    color: var(--primary);
}
.page-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* ============================================================
   DASHBOARD
   ============================================================ */
.greeting-banner {
    background: linear-gradient(135deg, var(--primary-light), var(--card-bg));
    border-radius: var(--radius);
    padding: 18px 24px;
    margin-bottom: 22px;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}
.greeting-banner h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}
.greeting-banner h3 i {
    color: var(--warning);
    margin-right: 8px;
}
.greeting-banner p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 2px;
}
.greeting-banner .emoji-big {
    font-size: 40px;
    line-height: 1;
}
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: var(--spacing);
}
.kpi-card {
    background: var(--card-bg);
    padding: 14px 16px;
    border-radius: 14px;
    box-shadow: var(--shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.4s;
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
    cursor: pointer;
}
.kpi-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary);
    opacity: 0.3;
}
.kpi-card:nth-child(2)::after {
    background: var(--success);
}
.kpi-card:nth-child(3)::after {
    background: var(--accent-warm);
}
.kpi-card:nth-child(4)::after {
    background: var(--accent-purple);
}
.kpi-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}
.kpi-title {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}
.kpi-value {
    font-size: 21px;
    font-weight: 700;
    margin: 2px 0 1px 0;
    letter-spacing: -0.02em;
    overflow-wrap: break-word;
}
.kpi-sub {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}
.kpi-sub i {
    font-size: 12px;
}
.trend-up {
    color: var(--success);
}
.trend-down {
    color: var(--danger);
}
.trend-warn {
    color: var(--warning);
}
.chart-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing);
    margin-bottom: var(--spacing);
}
.chart-card {
    background: var(--card-bg);
    padding: var(--spacing);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    transition: background 0.4s, box-shadow 0.4s;
}
.chart-card h4 {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.chart-card h4 i {
    color: var(--primary);
}
.chart-equal {
    height: 260px;
}
.chart-equal canvas {
    height: 90% !important;
    width: 100% !important;
}
/* ============================================================
   DASHBOARD QUICK LINKS
   ============================================================ */
.quick-links-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 18px;
    transition: background 0.4s, box-shadow 0.4s;
}
.quick-link-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s ease;
}
.quick-link-row:last-child {
    border-bottom: none;
}
.quick-link-row:hover {
    background: var(--bg);
}
.quick-link-icon {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
}
.quick-link-icon-fees {
    background: var(--primary-light);
    color: var(--primary);
}
.quick-link-icon-att {
    background: rgba(30, 179, 114, 0.14);
    color: var(--success);
}
.quick-link-icon-grades {
    background: rgba(167, 139, 250, 0.16);
    color: var(--accent-purple);
}
.quick-link-icon-timetable {
    background: rgba(0, 0, 0, 0.14);

}
.quick-link-label {
    flex: 1;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.3px;
    color: var(--text-primary);
}
.quick-link-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}
.quick-link-arrow {
    color: var(--text-secondary);
    font-size: 13px;
    opacity: 0.7;
}

/* ============================================================
   DASHBOARD NEWS
   ============================================================ */
.news-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 18px;
    transition: background 0.4s, box-shadow 0.4s;
}
.news-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg);
}
.news-badge {
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 0.5px;
    padding: 6px 14px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.news-link {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.news-link:hover {
    text-decoration: underline;
}
.news-item {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
}
.news-item:last-child {
    border-bottom: none;
}
.news-item-head {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 5px;
}
.news-item-icon {
    font-size: 15px;
}
.news-item-title {
    font-weight: 700;
    font-size: 14px;
    color: var(--text-primary);
}
.news-item-date {
    font-size: 12px;
    color: var(--text-secondary);
    margin-left: auto;
    white-space: nowrap;
}
.news-item-excerpt {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
}


.bottom-grid-1col {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--spacing);
}
.info-card {
    background: var(--card-bg);
    padding: var(--spacing);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    transition: background 0.4s, box-shadow 0.4s;
}
.info-card h4 {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}
.info-card h4 i {
    color: var(--primary);
}
.rank-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.rank-list li {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}
.rank-list li:last-child {
    border-bottom: none;
}
.rank-highlight {
    color: var(--primary);
    font-weight: 600;
}
.rank-list li i {
    margin-right: 8px;
    color: var(--warning);
}

/* ============================================================
   GRADES TABS
   ============================================================ */
.exam-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.exam-tabs .tab-btn {
    padding: 6px 18px;
    border: none;
    background: transparent;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: 0.25s;
    font-family: inherit;
    border-radius: 8px 8px 0 0;
}
.exam-tabs .tab-btn:hover {
    color: var(--text-primary);
    background: var(--bg);
}
.exam-tabs .tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}
.exam-content {
    display: none;
    padding-top: 8px;
    animation: fadeUp 0.3s ease;
}
.exam-content.active {
    display: block;
}

/* ============================================================
   TABLES & CARDS
   ============================================================ */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    overflow: hidden;
    margin-bottom: 18px;
    box-shadow: var(--shadow);
}
.card-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
    background: var(--bg);
}
.card-header i {
    color: var(--primary);
    margin-right: 8px;
}
.card-body {
    padding: 14px 20px;
}
.table-wrap {
    overflow-x: auto;
    max-width: 100%;
}
.table-wrap th,
.table-wrap td {
    overflow-wrap: break-word;
    word-break: break-word;
}
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
table th {
    text-align: left;
    padding: 10px 12px;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-bottom: 2px solid var(--border-color);
    background: var(--bg);
    white-space: nowrap;
}
table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    vertical-align: middle;
}
table tbody tr:hover {
    background: var(--bg);
}
.badge {
    display: inline-block;
    padding: 2px 12px;
    border-radius: 30px;
    font-size: 12px;
    font-weight: 600;
}
.badge-success {
    background: rgba(30, 179, 114, 0.15);
    color: var(--success);
}
.badge-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}
.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}
.badge-primary {
    background: rgba(37, 140, 201, 0.15);
    color: var(--primary);
}
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 20px;
    border-radius: 40px;
    font-weight: 600;
    font-size: 13px;
    border: none;
    cursor: pointer;
    transition: all 0.25s ease;
    font-family: inherit;
    white-space: nowrap;
    word-break: normal;
}
.btn-primary {
    background: var(--primary);
    color: #fff;
}
.btn-primary:hover {
    background: #1a6fa8;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 140, 201, 0.25);
}
.btn-primary:disabled {
    background: #b0b8c1;
    color: #f1f2f4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.7;
}
.btn-primary:disabled:hover {
    background: #b0b8c1;
    transform: none;
    box-shadow: none;
}
.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}
.btn-outline:hover {
    background: var(--bg);
    border-color: var(--text-secondary);
}
.btn-danger {
    background: var(--danger);
    color: #fff;
}
.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-2px);
}
.btn-sm {
    padding: 4px 10px;
    font-size: 11px;
}

/* ============================================================
   MODAL
   ============================================================ */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.45);
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
}
.modal-content {
    background: var(--card-bg);
    padding: 32px;
    border-radius: var(--radius);
    width: 90%;
    max-width: 560px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-hover);
    position: relative;
    animation: fadeIn 0.3s ease;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}
.close {
    position: absolute;
    top: 14px;
    right: 18px;
    color: var(--text-secondary);
    font-size: 28px;
    cursor: pointer;
    transition: color 0.2s;
}
.close:hover {
    color: var(--text-primary);
}
.modal-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.modal-title i {
    color: var(--primary);
}
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}
.form-group {
    margin-bottom: 16px;
}
.form-group label {
    display: block;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
    margin-bottom: 4px;
}
.form-group .form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    transition: 0.2s;
    background: var(--card-bg);
    color: var(--text-primary);
}
.form-group .form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 140, 201, 0.12);
}
.form-group textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

/* ============================================================
   PROFILE
   ============================================================ */
.profile-grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: var(--spacing);
}
.profile-grid .card {
    margin-bottom: 0;
}

/* ============================================================
   TIMETABLE
   ============================================================ */
.timetable-grid {
    display: grid;
    grid-template-columns: 80px 1fr 1fr 1fr 1fr 1fr;
    gap: 6px;
    font-size: 13px;
}
.timetable-grid .tt-cell {
    padding: 10px 8px;
    border-radius: 8px;
    background: var(--bg);
    border: 1px solid var(--border-color);
    text-align: center;
    font-weight: 500;
}
.timetable-grid .tt-header {
    font-weight: 600;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.timetable-grid .tt-subject {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
    font-size: 12px;
}
.timetable-grid .tt-free {
    color: var(--text-secondary);
    font-weight: 400;
    font-size: 12px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 992px) {
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 768px) {
    .sidebar {
        display: none !important; /* bottom nav replaces it on mobile */
    }
    .header-left .menu-toggle {
        display: none !important; /* nothing left to toggle */
    }
    .main-content {
        margin-left: 0;
        padding: 14px 14px 84px; /* extra bottom room for the fixed bottom nav */
    }
    .header-left .breadcrumb {
        font-size: 12px;
    }
    .header-right .badge-icon span {
        display: none;
    }
    .chart-grid {
        grid-template-columns: 1fr;
    }
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .kpi-card {
        padding: 12px 14px;
    }
    .kpi-value {
        font-size: 18px;
    }
    .chart-equal {
        height: 220px;
    }
    .modal-footer {
        flex-direction: column-reverse;
    }
    .btn {
        width: 100%;
    }
    .card-header {
        flex-wrap: wrap;
        row-gap: 8px;
    }
    .header-right .user-profile .username {
        display: none;
    }
    .exam-tabs .tab-btn {
        font-size: 12px;
        padding: 4px 12px;
    }
    .timetable-grid {
        min-width: 480px;
    }
    .profile-grid {
        grid-template-columns: 1fr;
    }
    .profile-grid .card {
        margin-bottom: 18px;
    }
    .shillingyet {
        display: none;
    }
}
@media (max-width: 600px) {
    #section-fees .kpi-grid {
        grid-template-columns: 1fr;
    }
    /* The fee table has 5 columns and real content (dates, reasons, notes) —
       no amount of horizontal scrolling reads well that narrow. Below 600px
       it restacks into one label/value block per row instead. */
    #section-fees .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    #section-fees .card-header button {
        width: 100%;
        justify-content: center;
    }
    #section-fees .table-wrap table,
    #section-fees .table-wrap thead,
    #section-fees .table-wrap tbody,
    #section-fees .table-wrap tr,
    #section-fees .table-wrap td {
        display: block;
        width: 100%;
    }
    #section-fees .table-wrap thead {
        display: none;
    }
    #section-fees .table-wrap tr {
        border: 1px solid var(--border-color);
        border-radius: 10px;
        margin-bottom: 10px;
        padding: 4px 12px;
    }
    #section-fees .table-wrap td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
        padding: 8px 0;
        border-bottom: 1px solid var(--border-color);
        text-align: right;
    }
    #section-fees .table-wrap td:last-child {
        border-bottom: none;
    }
    #section-fees .table-wrap td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 12px;
        color: var(--text-secondary);
        text-align: left;
    }
    .timetable-grid {
        grid-template-columns: 60px 1fr 1fr 1fr 1fr 1fr;
        font-size: 11px;
    }
    .timetable-grid .tt-cell {
        padding: 6px 4px;
    }
    .shillingyet {
        display: none;
    }
}
/* Evaluation stars — shared by teacher.html evaluation modal */
.star-input { display: flex; gap: 4px; font-size: 20px; }
.star-input i { color: var(--border-color); cursor: pointer; transition: color 0.15s, transform 0.15s; }
.star-input i:hover { transform: scale(1.15); }
.star-input i.filled { color: #f5a623; }
.stars-display { color: #f5a623; letter-spacing: 2px; }
.stars-display .empty { color: var(--border-color); }

/* ============================================================
   BIRTHDAY MODE — a warm, gold-accented touch for the day,
   not a redesign. Applied to <body> only when it's the logged-in
   student's birthday; scoped entirely under body.birthday-mode
   so nothing changes on a normal day.
   ============================================================ */
body.birthday-mode .card,
body.birthday-mode .kpi-card {
    border-color: #fde68a;
    box-shadow: 0 8px 18px -8px rgba(251, 191, 36, 0.18);
}
body.birthday-mode .card-header i,
body.birthday-mode .page-header h2 i {
    color: #f59e0b;
}
body.birthday-mode .page-header h2 {
    border-bottom: 2px dashed #fde68a;
    padding-bottom: 12px;
    display: inline-block;
}

body.birthday-mode .avatar,
body.birthday-mode #profileAvatar {
    background: linear-gradient(135deg, #fbbf24, #f59e0b) !important;
    border: 3px solid #fde68a;
    box-shadow: 0 10px 25px -5px rgba(251, 191, 36, 0.4);
    color: #0b1e1a !important;
}

body.birthday-mode .sidebar {
    border-right: 2px solid #fde68a;
}
body.birthday-mode .header {
    border-bottom: 2px solid #fbbf24;
}

/* The birthday greeting banner itself — the one place that gets a
   proper celebratory treatment, echoing the reference "spa card". */
.greeting-banner.is-birthday {
    background: linear-gradient(145deg, #0b1e1a, #0f2c24);
    border: 1px solid #fde68a;
    position: relative;
    overflow: hidden;
}
.greeting-banner.is-birthday::after {
    content: '🎂';
    position: absolute;
    bottom: -18px;
    right: 6px;
    font-size: 70px;
    opacity: 0.12;
    transform: rotate(-10deg);
    pointer-events: none;
}
.greeting-banner.is-birthday h3 {
    color: #ffffff !important;
}
.greeting-banner.is-birthday h3 i {
    color: #fbbf24;
    margin-right: 6px;
}
.greeting-banner.is-birthday p {
    color: #a7b9b1 !important;
}
.birthday-pill {
    background: #fbbf24;
    color: #0b1e1a;
    padding: 4px 14px;
    border-radius: 40px;
    font-size: 12px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    box-shadow: 0 4px 12px rgba(251, 191, 36, 0.25);
}
.greeting-banner.is-birthday .emoji-big {
    font-size: 40px;
    animation: bday-cake-float 3s ease-in-out infinite;
}
@keyframes bday-cake-float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-6px) rotate(4deg); }
}

/* ============================================================
   SHILIN — golden highlight for the top-tier currency in My Wallet
   ============================================================ */
.shilin-tile {
    background: linear-gradient(145deg, #fff9e6, #fff3c4);
    border: 1px solid #f5cd47;
    box-shadow: 0 6px 16px -6px rgba(245, 190, 40, 0.4);
    position: relative;
    overflow: hidden;
}
[data-theme="dark"] .shilin-tile {
    background: linear-gradient(145deg, #3a2e0a, #2b2205);
    border: 1px solid #a87c1a;
}
.shilin-value {
    font-size: 24px;
    font-weight: 800;
    background: linear-gradient(90deg, #b8860b, #ffd700, #b8860b);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: shilin-shine 3s linear infinite;
}

/* Wallet currency converter — single select + Convert button */
#walletConvertSelect {
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    background: var(--card-bg);
    color: var(--text-primary);
    transition: 0.2s;
    cursor: pointer;
}
#walletConvertSelect:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 140, 201, 0.12);
}
#walletConvertSelect:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}
#walletConvertBtn {
    padding: 10px 20px;
    white-space: nowrap;
}
#walletConvertBtn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

@keyframes shilin-shine {
    0% { background-position: 0% center; }
    100% { background-position: 200% center; }
}

/* Attendance-not-marked-yet glow (header icon, staff/teacher portals) */
@keyframes attendanceGlowPulse {
    0%, 100% { text-shadow: 0 0 4px rgba(220, 38, 38, 0.5); }
    50% { text-shadow: 0 0 12px rgba(220, 38, 38, 1), 0 0 18px rgba(220, 38, 38, 0.6); }
}
.attendance-glow {
    animation: attendanceGlowPulse 1.5s ease-in-out infinite;
}

/* ============================================================
   TOAST NOTIFICATIONS (shared: student/teacher/staff portals)
   ============================================================ */
.toast-stack { position: fixed; bottom: 28px; right: 28px; display: flex; flex-direction: column; gap: 10px; z-index: 10000; }
.toast {
    background: var(--card-bg); border: 1px solid var(--border); border-left: 4px solid var(--primary);
    border-radius: 14px; padding: 14px 20px; box-shadow: var(--shadow-hover); font-size: 13px; color: var(--text);
    min-width: 240px; animation: toastIn 0.3s ease; display: flex; align-items: center; gap: 10px;
}
.toast.error { border-left-color: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: translateX(0); } }
@media (max-width: 768px) {
    .toast-stack { right: 14px; bottom: 14px; left: 14px; }
    .toast { min-width: 0; }
}