/*
  MyGrade School Management System — Dr Sydney Memorial College Brand Theme
  Primary: Magenta Pink (#d6208b) — from the DSMC shield border & title
  Secondary: Plum (#a7468b) — from the DSMC book & banner
  Motto: Education, the Greatest Equaliser
*/

@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700;900&display=swap');

:root {
    --primary: #d6208b;
    --primary-dark: #b0146f;
    --primary-darker: #8a0f57;
    --primary-light: rgba(214, 32, 139, 0.08);
    --primary-soft: #fdf0f7;
    --primary-gradient: linear-gradient(135deg, #e2148d 0%, #b0146f 55%, #4b1040 100%);
    --primary-glow: rgba(214, 32, 139, 0.32);
    --secondary: #a7468b;
    --secondary-light: rgba(167, 70, 139, 0.1);
}

/* ===== Theme Switcher =====
   Single-school build: every theme resolves to the DSMC brand palette;
   'purple' offers a softer plum look drawn from the logo's book/banner. */
.theme-green,
.theme-blue,
.theme-pink {
    --primary: #d6208b;
    --primary-dark: #b0146f;
    --primary-darker: #8a0f57;
    --primary-light: rgba(214, 32, 139, 0.08);
    --primary-soft: #fdf0f7;
    --primary-gradient: linear-gradient(135deg, #e2148d 0%, #b0146f 55%, #4b1040 100%);
    --primary-glow: rgba(214, 32, 139, 0.32);
    --secondary: #a7468b;
    --secondary-light: rgba(167, 70, 139, 0.1);
}
.theme-purple {
    --primary: #a7468b;
    --primary-dark: #8d3a75;
    --primary-darker: #6f2c5c;
    --primary-light: rgba(167, 70, 139, 0.08);
    --primary-soft: #faf1f7;
    --primary-gradient: linear-gradient(135deg, #a7468b 0%, #8d3a75 55%, #3d1533 100%);
    --primary-glow: rgba(167, 70, 139, 0.34);
    --secondary: #d6208b;
    --secondary-light: rgba(214, 32, 139, 0.1);
}

:root {
/* ===== Global ===== */
    --accent: #0f766e;
    --accent-dark: #115e59;
    --accent-light: rgba(15, 118, 110, 0.1);
    --success: #10b981;
    --success-light: rgba(16, 185, 129, 0.1);
    --danger: #ef4444;
    --danger-light: rgba(239, 68, 68, 0.08);
    --info: #0ea5e9;
    --info-light: rgba(14, 165, 233, 0.1);
    --purple: #8b5cf6;
    --purple-light: rgba(139, 92, 246, 0.08);
    --pink: #ec4899;
    --pink-light: rgba(236, 72, 153, 0.08);

    --dark: #2c2c2c;
    --dark-card: #3a3a3a;
    --sidebar-bg: #232323;
    --light: #f5f4f0;
    --surface: #ffffff;
    --surface-alt: #f8f7f4;
    --surface-2: #fcfbf9;
    --gray: #e8e6e0;
    --gray-dark: #9c9690;
    --border: #e6e3dc;
    --border-strong: #d8d4cb;
    --text: #262626;
    --text-muted: #6f6a63;
    --text-soft: #8c8780;
    --white: #ffffff;

    /* Soft, layered "premium" shadows */
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04);
    --shadow: 0 1px 3px rgba(16, 24, 40, 0.05), 0 1px 2px rgba(16, 24, 40, 0.03);
    --shadow-md: 0 6px 18px -6px rgba(16, 24, 40, 0.10), 0 2px 6px -2px rgba(16, 24, 40, 0.05);
    --shadow-lg: 0 16px 40px -12px rgba(16, 24, 40, 0.16), 0 6px 14px -6px rgba(16, 24, 40, 0.07);
    --shadow-xl: 0 28px 64px -18px rgba(23, 33, 70, 0.28), 0 10px 24px -12px rgba(16, 24, 40, 0.12);
    --shadow-primary: 0 10px 24px -8px var(--primary-glow);
    --ring: 0 0 0 4px rgba(214, 32, 139, 0.18);

    --border-radius: 8px;
    --border-radius-sm: 5px;
    --border-radius-lg: 10px;
    --transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    --sidebar-width: 118px;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Roboto', Arial, sans-serif; }

body {
    background-color: var(--light);
    background-image:
        radial-gradient(900px circle at 0% -5%, rgba(214, 32, 139, 0.08), transparent 45%),
        radial-gradient(800px circle at 100% 0%, rgba(44, 44, 44, 0.05), transparent 45%),
        radial-gradient(1000px circle at 50% 120%, rgba(167, 70, 139, 0.05), transparent 50%);
    background-attachment: fixed;
    color: var(--text);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    letter-spacing: -0.006em;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d3dbe6; border-radius: 8px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #b7c2d2; background-clip: padding-box; }

/* AUTHENTICATION */
.auth-wrapper {
    width: 100%; min-height: 100vh; display: flex; justify-content: center; align-items: center;
    background: linear-gradient(135deg, #2c2c2c 0%, #3a3a3a 50%, #2c2c2c 100%);
    position: relative; overflow: hidden;
}
.auth-wrapper::before {
    content: ''; position: absolute; width: 60vw; height: 60vw;
    background: radial-gradient(circle, rgba(214,32,139,0.16) 0%, transparent 70%);
    top: -20vw; right: -20vw;
}
.auth-wrapper::after {
    content: ''; position: absolute; width: 50vw; height: 50vw;
    background: radial-gradient(circle, rgba(167,70,139,0.10) 0%, transparent 70%);
    bottom: -20vw; left: -20vw;
}
.auth-box {
    background: rgba(255,255,255,0.97); backdrop-filter: blur(20px);
    padding: 40px; border-radius: var(--border-radius-lg); box-shadow: var(--shadow-xl);
    width: 100%; max-width: 420px; z-index: 10; text-align: center;
    animation: fadeUp 0.6s ease forwards; border: 1px solid rgba(255,255,255,0.1);
}

@keyframes fadeUp { from { transform: translateY(24px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes slideIn { from { opacity: 0; transform: translateX(-20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

.auth-logo { width: 100px; height: 100px; object-fit: contain; margin-bottom: 20px; border-radius: 50%; background: var(--primary-light); padding: 8px; transition: var(--transition); }
.auth-box h2 { color: var(--dark); margin-bottom: 4px; font-weight: 800; font-size: 1.5rem; }
.auth-box > p { color: var(--text-muted); margin-bottom: 28px; font-size: 0.9rem; }

/* FORMS */
.form-group { margin-bottom: 18px; text-align: left; }
.form-group label { display: block; margin-bottom: 7px; font-weight: 600; font-size: 0.82rem; color: var(--text); letter-spacing: -0.01em; }
.form-control { width: 100%; padding: 11px 14px; border: 1.5px solid var(--border-strong); border-radius: var(--border-radius-sm); font-size: 0.92rem; transition: var(--transition); background: var(--surface-2); color: var(--text); }
.form-control:hover { border-color: #cdd5e2; }
.form-control:focus { border-color: var(--primary); outline: none; background: var(--white); box-shadow: var(--ring); }
.form-control::placeholder { color: var(--text-soft); }
select.form-control { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e"); background-repeat: no-repeat; background-position: right 12px center; background-size: 16px; padding-right: 36px; }
textarea.form-control { resize: vertical; min-height: 80px; }

/* BUTTONS */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 20px; border-radius: var(--border-radius-sm); font-weight: 600; cursor: pointer; transition: var(--transition); border: 1px solid transparent; text-align: center; font-size: 0.9rem; text-decoration: none; line-height: 1.4; letter-spacing: -0.01em; }
.btn:hover { transform: translateY(-1.5px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--primary); color: var(--white); box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--secondary); color: var(--white); box-shadow: var(--shadow-sm); }
.btn-secondary:hover { background: #0284c7; }
.btn-accent { background: var(--accent); color: var(--white); box-shadow: var(--shadow-sm); }
.btn-accent:hover { background: var(--accent-dark); }
.btn-danger { background: #dc2626; color: var(--white); box-shadow: var(--shadow-sm); }
.btn-danger:hover { background: #b91c1c; }
.btn-info { background: var(--info); color: var(--white); box-shadow: var(--shadow-sm); }
.btn-info:hover { background: #0284c7; }
.btn-outline { background: var(--white); border: 1.5px solid var(--border-strong); color: var(--dark); box-shadow: var(--shadow-sm); }
.btn-outline:hover { background: var(--surface-alt); border-color: var(--dark); color: var(--dark); }
.btn-small { padding: 8px 16px; font-size: 0.85rem; }
.btn-xs { padding: 5px 11px; font-size: 0.78rem; border-radius: 8px; }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--primary-light); color: var(--primary); }
.btn-cancel { background: var(--surface-alt); color: var(--text-muted); border-color: var(--border); }
.btn-cancel:hover { background: var(--gray); color: var(--text); }
.btn-neutral { background: var(--surface-alt); color: var(--dark); border-color: var(--border-strong); }
.btn-neutral:hover { background: var(--gray); color: var(--dark); }

/* MESSAGES / ALERTS */
.success-msg, .error-msg, .info-msg, .warning-msg { padding: 13px 16px 13px 15px; border-radius: var(--border-radius-sm); margin-bottom: 20px; font-size: 0.86rem; font-weight: 500; line-height: 1.5; display: flex; align-items: flex-start; gap: 11px; border: 1px solid; border-left-width: 3px; box-shadow: var(--shadow-sm); animation: slideDown 0.3s ease; }
.success-msg i, .error-msg i, .info-msg i, .warning-msg i { font-size: 1rem; margin-top: 1px; flex-shrink: 0; }
.error-msg { background: #fef4f4; color: #b4231e; border-color: #f6d4d2; border-left-color: var(--danger); }
.success-msg {
    background: #f1faf4; color: #11653f; border-color: #cdeedb; border-left-color: var(--success);
    animation: slideDown 0.3s ease, successFadeOut 0.4s ease 3s forwards;
}
@keyframes successFadeOut { to { opacity: 0; visibility: hidden; } }
.info-msg { background: #f0f5ff; color: #1d4ed8; border-color: #d4e2fd; border-left-color: var(--primary); }
.warning-msg { background: #f0fdfa; color: #115e59; border-color: #99f6e4; border-left-color: var(--accent); }

/* SIDEBAR */
/* ===== Sidebar — minimal dark icon-only rail ===== */
.sidebar {
    width: calc(var(--sidebar-width) - 14px);
    background: linear-gradient(135deg, var(--primary-darker), var(--dark));
    background-image:
        radial-gradient(circle at 1px 1px, rgba(255,255,255,0.07) 1px, transparent 1px),
        linear-gradient(135deg, var(--primary-darker), var(--dark));
    background-size: 22px 22px, 100% 100%;
    position: fixed; left: 12px; top: 12px; bottom: 12px; height: auto;
    display: flex; flex-direction: column; align-items: center; z-index: 100;
    transition: transform 0.3s ease; overflow-y: auto; overflow-x: hidden;
    border-radius: 10px;
    box-shadow: 0 26px 55px -20px rgba(0,0,0,0.55);
}
.sidebar::-webkit-scrollbar { width: 0; }

.sidebar-header { padding: 22px 0 14px; display: flex; flex-direction: column; align-items: center; gap: 8px; flex-shrink: 0; }
.sidebar-header img {
    width: 40px; height: 40px; object-fit: contain; border-radius: 50%;
    background: rgba(255,255,255,0.92); padding: 5px;
}
.sidebar-header h3 { display: none; }

.nav-links { padding: 6px 6px; list-style: none; flex-grow: 1; display: flex; flex-direction: column; align-items: stretch; gap: 3px; width: 100%; }
.nav-links li { margin-bottom: 0; }

.nav-section-title { display: none; }

/* icon-over-label rail buttons, always-visible label */
.nav-links a {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    width: 100%; padding: 11px 3px; gap: 6px;
    color: #fff; text-decoration: none;
    border-radius: 8px; transition: all 0.18s ease; position: relative;
}
.nav-links a i { font-size: 1.08rem; color: rgba(255,255,255,0.92); }
.nav-links a:hover { background: rgba(255,255,255,0.10); color: #fff; }

/* active: white rounded square with dark icon + label */
.nav-links a.active { background: #fff; color: var(--dark); box-shadow: 0 10px 22px -10px rgba(0,0,0,0.5); }
.nav-links a.active i, .nav-links a.active .nav-label { color: var(--dark); }
.nav-links a.active .nav-label { font-weight: 700; }

.nav-label {
    font-size: 0.82rem; font-weight: 400; line-height: 1.25; text-align: center;
    color: rgba(255,255,255,0.92); white-space: normal; max-width: 100%; letter-spacing: -0.01em;
}

.logout-link { margin-top: auto; padding: 10px 6px 16px; flex-shrink: 0; }
.logout-link a {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    width: 100%; padding: 11px 3px; gap: 6px; color: #fff; text-decoration: none;
    border-radius: 8px; transition: all 0.18s ease; position: relative;
}
.logout-link a i { font-size: 1.08rem; color: rgba(255,255,255,0.92); }
.logout-link a .nav-label { color: rgba(255,255,255,0.92); }
.logout-link a:hover { background: rgba(248,113,113,0.18); color: #fecaca; }
.sidebar-toggle { display: none; position: fixed; top: 16px; left: 16px; z-index: 200; background: var(--primary-gradient); color: var(--white); border: none; border-radius: 6px; width: 44px; height: 44px; font-size: 1.1rem; cursor: pointer; box-shadow: var(--shadow-lg); align-items: center; justify-content: center; }

/* MAIN CONTENT */
.main-content { flex-grow: 1; min-width: 0; margin-left: var(--sidebar-width); display: flex; flex-direction: column; min-height: 100vh; }

/* ===== Top bar — floating glass command bar (matches the sidebar rail) ===== */
.topbar {
    height: 62px;
    margin: 14px 18px 0;
    border-radius: 10px;
    background: rgba(255,255,255,0.72);
    -webkit-backdrop-filter: saturate(180%) blur(16px);
    backdrop-filter: saturate(180%) blur(16px);
    display: flex; align-items: center; gap: 16px;
    padding: 0 16px 0 22px;
    border: 1px solid rgba(255,255,255,0.7);
    box-shadow: 0 10px 30px -16px rgba(15,23,42,0.30), inset 0 1px 0 rgba(255,255,255,0.6);
    position: sticky; top: 14px; z-index: 90; flex-shrink: 0;
}
.topbar-left { display: flex; align-items: center; min-width: 0; }
.page-title { font-size: 1.02rem; font-weight: 700; color: var(--dark); display: flex; align-items: center; gap: 10px; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.page-title-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--primary-gradient); box-shadow: 0 0 0 4px var(--primary-light); flex-shrink: 0; }

/* search */
.topbar-search { flex: 1; max-width: 420px; margin: 0 auto; position: relative; display: flex; align-items: center; }
.topbar-search i { position: absolute; left: 14px; color: var(--text-muted); font-size: 0.85rem; pointer-events: none; }
.topbar-search input {
    width: 100%; height: 40px; padding: 0 14px 0 38px;
    border: 1.5px solid transparent; border-radius: 999px;
    background: rgba(241,245,249,0.85); color: var(--text);
    font-size: 0.88rem; font-family: inherit; transition: var(--transition);
}
.topbar-search input:focus { outline: none; background: #fff; border-color: var(--primary); box-shadow: var(--ring); }

.topbar-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.topbar-date {
    display: flex; align-items: center; gap: 8px; padding: 8px 14px;
    border-radius: 999px; background: rgba(241,245,249,0.85);
    color: var(--text-muted); font-size: 0.8rem; font-weight: 600; white-space: nowrap;
}
.topbar-date i { color: var(--primary); }

.topbar-chip-wrap { position: relative; }
.topbar-chip {
    width: 42px; height: 42px; border-radius: 50%; border: none; cursor: pointer;
    background: rgba(241,245,249,0.85); color: var(--text); font-size: 1rem;
    display: inline-flex; align-items: center; justify-content: center;
    transition: var(--transition); position: relative;
}
.topbar-chip:hover { background: var(--primary-light); color: var(--primary); }
.topbar-dot-badge {
    position: absolute; top: -2px; right: -2px; min-width: 18px; height: 18px; padding: 0 4px;
    border-radius: 9px; background: var(--danger); color: #fff;
    font-size: 0.66rem; font-weight: 700; display: flex; align-items: center; justify-content: center;
    border: 2px solid #fff;
}

.topbar-user {
    display: flex; align-items: center; gap: 10px; padding: 5px 10px 5px 5px;
    border: none; cursor: pointer; background: rgba(241,245,249,0.85);
    border-radius: 999px; transition: var(--transition); font-family: inherit;
}
.topbar-user:hover { background: var(--primary-light); }
.user-avatar { width: 36px; height: 36px; background: var(--primary-gradient); color: var(--white); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.9rem; box-shadow: 0 4px 12px rgba(37,99,235,0.28); flex-shrink: 0; }
.user-meta { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; }
.user-name { font-weight: 600; color: var(--text); font-size: 0.85rem; }
.user-role { font-size: 0.68rem; color: var(--text-muted); font-weight: 500; }
.user-caret { font-size: 0.7rem; color: var(--text-muted); }

/* dropdown menus */
.topbar-menu {
    display: none; position: absolute; top: calc(100% + 10px); right: 0;
    width: 280px; background: #fff; border: 1px solid var(--border);
    border-radius: 8px; box-shadow: var(--shadow-lg); padding: 8px; z-index: 120;
    animation: slideDown 0.18s ease;
}
.topbar-menu.open { display: block; }
.topbar-menu-head { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-muted); font-weight: 700; padding: 8px 10px; }
.topbar-menu-empty { padding: 18px 10px; text-align: center; color: var(--text-muted); font-size: 0.85rem; }
.topbar-note { display: flex; align-items: flex-start; gap: 10px; padding: 9px 10px; border-radius: 6px; text-decoration: none; color: var(--text); transition: var(--transition); }
.topbar-note:hover { background: var(--surface-alt); }
.topbar-note-pill { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; background: var(--text-muted); flex-shrink: 0; }
.topbar-note-pill.priority-urgent { background: var(--danger); }
.topbar-note-pill.priority-important { background: var(--accent); }
.topbar-note-pill.priority-normal { background: var(--primary); }
.topbar-note-body { display: flex; flex-direction: column; min-width: 0; }
.topbar-note-body strong { font-size: 0.85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-note-body small { font-size: 0.72rem; color: var(--text-muted); }
.topbar-menu-link { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 6px; text-decoration: none; color: var(--text); font-size: 0.86rem; font-weight: 500; transition: var(--transition); }
.topbar-menu-link i { width: 18px; text-align: center; color: var(--text-muted); }
.topbar-menu-link:hover { background: var(--surface-alt); color: var(--primary); }
.topbar-menu-link:hover i { color: var(--primary); }
.topbar-menu-link.danger:hover { background: var(--danger-light); color: var(--danger); }
.topbar-menu-link.danger:hover i { color: var(--danger); }
.topbar-menu-foot { display: block; text-align: center; padding: 10px; margin-top: 4px; border-top: 1px solid var(--border); color: var(--primary); font-size: 0.82rem; font-weight: 600; text-decoration: none; }
.topbar-menu-foot:hover { color: var(--primary-dark); }

.content-wrapper { padding: 24px 32px 40px; flex-grow: 1; min-width: 0; max-width: 1500px; width: 100%; }

/* Plain-language helper text shown under page titles / section heads */
.help-note { display: flex; align-items: flex-start; gap: 12px; background: linear-gradient(135deg, var(--primary-soft), var(--surface-2)); border: 1px solid var(--border); border-left: 3px solid var(--primary); color: #33445f; border-radius: var(--border-radius-sm); padding: 13px 17px; font-size: 0.85rem; line-height: 1.55; margin-bottom: 22px; box-shadow: var(--shadow-sm); }
.help-note i { color: var(--primary); font-size: 1.05rem; margin-top: 1px; flex-shrink: 0; }
.help-note strong { font-weight: 700; color: var(--text); }

/* STAT CARDS — compact, uniform, no per-card gimmicks */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card {
    background: var(--white); padding: 16px 18px;
    border-radius: var(--border-radius-sm); box-shadow: var(--shadow);
    display: flex; align-items: center; gap: 14px;
    transition: var(--transition); position: relative; overflow: hidden;
    animation: fadeUp 0.5s ease forwards;
    border: 1px solid var(--border);
}
.stat-card::after {
    content: ''; position: absolute; left: 0; top: 0; bottom: 0;
    width: 3px; background: var(--primary-gradient); opacity: 0;
    transition: var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--primary-glow); }
.stat-card:hover::after { opacity: 1; }
.stat-icon { width: 40px; height: 40px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 0.95rem; flex-shrink: 0; border: 1px solid rgba(16,24,40,0.06); }
.stat-icon.primary { background: #eef2ff; color: #3949ab; }
.stat-icon.secondary { background: #e8f4fb; color: #0c6e99; }
.stat-icon.accent { background: #f0fdfa; color: #115e59; }
.stat-icon.danger { background: #fdeeee; color: #b3261e; }
.stat-icon.info { background: #e8f4fb; color: #0c6e99; }
.stat-icon.purple { background: #f1edfb; color: #5b3fa3; }
.stat-icon.pink { background: #fbecf2; color: #a02d63; }
.stat-icon.success { background: #e7f5ef; color: #157a51; }
.stat-info { flex: 1; min-width: 0; }
.stat-info h4 { color: var(--text-muted); font-size: 0.7rem; font-weight: 600; margin-bottom: 2px; text-transform: uppercase; letter-spacing: 0.4px; }
.stat-info .h2 { color: var(--dark); font-size: 1.45rem; font-weight: 800; line-height: 1.1; letter-spacing: -0.02em; margin-left: 6px; }
.stat-trend { display: flex; align-items: center; gap: 4px; font-size: 0.72rem; font-weight: 600; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-trend.up { color: var(--success); }
.stat-trend.down { color: var(--danger); }
.stat-trend.neutral { color: var(--text-muted); }

/* PANELS & WIDGETS */
.panel, .widget {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 24px 26px;
    margin-bottom: 24px;
    animation: fadeUp 0.4s ease;
    border: 1px solid var(--border);
}
.panel:hover, .widget:hover { box-shadow: var(--shadow-md); }
.panel-header, .widget-header {
    display: flex; justify-content: space-between; align-items: center;
    margin: -24px -26px 20px; padding: 16px 26px; gap: 10px; flex-wrap: wrap;
    background: linear-gradient(135deg, var(--primary-darker), var(--dark));
    background-image:
        radial-gradient(circle at 1px 1px, rgba(255,255,255,0.07) 1px, transparent 1px),
        linear-gradient(135deg, var(--primary-darker), var(--dark));
    background-size: 22px 22px, 100% 100%;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    color: #fff;
}
.panel-title, .widget-title { font-size: 1.02rem; font-weight: 700; color: #fff !important; display: flex; align-items: center; gap: 11px; letter-spacing: -0.015em; }
.panel-title i, .widget-title i, .panel-header > i, .widget-header > i {
    color: #fff !important; font-size: 1.05rem; width: 34px; height: 34px;
    display: inline-flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.16); border-radius: 6px;
}
.panel-header [style*="--text-muted"], .widget-header [style*="--text-muted"] { color: rgba(255,255,255,0.82) !important; }
.panel-header .btn-ghost, .widget-header .btn-ghost { color: rgba(255,255,255,0.85); }
.panel-header .btn-ghost:hover, .widget-header .btn-ghost:hover { background: rgba(255,255,255,0.16); color: #fff; }

/* TABLES */
.table-responsive { overflow-x: auto; border-radius: var(--border-radius-sm); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; }
table th, table td { padding: 13px 18px; text-align: left; border-bottom: 1px solid var(--border); }
table th { font-weight: 700; color: var(--text-muted); background: var(--surface-alt); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.7px; }
table tbody tr { transition: background 0.15s ease; }
table tbody tr:hover { background: var(--primary-soft); }
table td { font-size: 0.88rem; color: var(--text); }
table tbody tr:last-child td { border-bottom: none; }

/* BADGES */
.badge { padding: 4px 11px; border-radius: 20px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.2px; display: inline-flex; align-items: center; gap: 5px; border: 1px solid transparent; }
.badge-active { background: #e7f8ee; color: #14794a; border-color: #c9eed9; }
.badge-inactive { background: #f1f4f9; color: var(--text-muted); border-color: #e6ebf3; }
.badge-warning { background: #f0fdfa; color: #115e59; border-color: #99f6e4; }
.badge-danger { background: #fdecec; color: #c2342f; border-color: #f8d2d0; }
.badge-info { background: #e6f0ff; color: #1d4ed8; border-color: #cfe0fd; }
.badge-purple { background: #f0ebfe; color: #6d28d9; border-color: #e0d6fb; }
.badge-success { background: #e7f8ee; color: #0c6b43; border-color: #c9eed9; }
.badge-day { background: var(--surface-alt); color: var(--dark); border-color: var(--border-strong); }
.badge-day i { color: var(--dark); }
.action-btns { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* Fee account status column (badge + Pay/Waive/Unwaive stack) */
.fee-status-stack { display: flex; flex-direction: column; gap: 6px; min-width: 130px; margin-left: 16px; }
.fee-status-stack .badge { justify-content: center; padding: 6px 14px; font-size: 0.76rem; border-radius: 999px; }
.fee-status-stack .btn { width: 100%; border-radius: 999px; padding: 8px 14px; font-size: 0.8rem; font-weight: 700; min-height: auto; }
.btn-purple { background: var(--purple, #8b5cf6); color: #fff; }
.btn-purple:hover { background: #7c3aed; }

/* CLASS CELL (class name + boarder-type badge) */
.cell-class { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.cell-class-name { font-weight: 600; color: var(--dark); }
.cell-class .badge { font-size: 0.68rem; padding: 3px 9px; }

/* MODALS */
.modal { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(11,21,38,0.5); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); z-index: 1000; align-items: center; justify-content: center; padding: 20px; }
.modal.active { display: flex; }
.modal-content { background: var(--white); padding: 32px; border-radius: var(--border-radius-lg); width: 100%; max-width: 600px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-xl); border: 1px solid rgba(255,255,255,0.6); animation: fadeUp 0.3s ease; }
.modal-content.wide { max-width: 900px; }
.modal-content h3 { color: var(--dark); font-size: 1.18rem; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 24px; }

/* FORM LAYOUTS */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-grid .full-width { grid-column: span 2; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.img-preview { width: 140px; height: 140px; border: 2px dashed var(--gray); border-radius: 50%; display: flex; align-items: center; justify-content: center; margin-bottom: 14px; overflow: hidden; background: #f8fafc; }
.img-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.filter-bar { display: flex; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; align-items: center; }
.filter-bar form { display: flex; gap: 10px; flex-wrap: wrap; width: 100%; }

/* DASHBOARD CHARTS & WIDGETS */
.dashboard-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 22px; margin-bottom: 22px; }
.chart-container { position: relative; width: 100%; height: 300px; }
.chart-container-sm { height: 220px; }
.chart-container-xs { height: 180px; }

.welcome-banner {
    background: linear-gradient(135deg, var(--primary-darker), var(--dark));
    background-image:
        radial-gradient(circle at 1px 1px, rgba(255,255,255,0.07) 1px, transparent 1px),
        linear-gradient(135deg, var(--primary-darker), var(--dark));
    background-size: 22px 22px, 100% 100%;
    color: white; padding: 26px 32px;
    border-radius: var(--border-radius-sm);
    margin-bottom: 24px; position: relative; overflow: hidden;
    animation: fadeUp 0.5s ease;
    box-shadow: var(--shadow-sm);
    display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap;
}
.welcome-kicker { font-size: 0.72rem; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; opacity: 0.65; margin-bottom: 6px; position: relative; z-index: 1; }
.welcome-banner h2 { margin: 0 0 6px; font-size: 1.35rem; font-weight: 700; letter-spacing: -0.01em; color: #fff; position: relative; z-index: 1; }
.welcome-banner p { margin: 0; opacity: 0.78; font-size: 0.88rem; color: #fff; position: relative; z-index: 1; }
.welcome-meta { display: flex; gap: 22px; margin-top: 16px; font-size: 0.85rem; opacity: 0.95; flex-wrap: wrap; position: relative; z-index: 1; }
.welcome-meta span { display: flex; align-items: center; gap: 6px; }
.welcome-date-card {
    background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.14);
    border-radius: 6px; padding: 12px 22px; text-align: center; flex-shrink: 0;
    position: relative; z-index: 1;
}
.welcome-date-card .day { font-size: 1.9rem; font-weight: 800; line-height: 1; }
.welcome-date-card .month { font-size: 0.78rem; opacity: 0.85; margin-top: 4px; }
.welcome-date-card .weekday { font-size: 0.72rem; opacity: 0.65; margin-top: 2px; }

.quick-actions-label { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase; color: var(--text-muted); margin-bottom: 12px; }
.quick-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 26px; }
.quick-action-btn {
    display: flex; flex-direction: column; align-items: center;
    gap: 12px; padding: 26px 12px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    cursor: pointer; transition: var(--transition);
    text-decoration: none; color: var(--text); font-weight: 600; font-size: 0.84rem;
    position: relative; overflow: hidden;
}
.quick-action-btn i {
    font-size: 1.15rem;
    width: 44px; height: 44px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 10px;
    background: var(--primary-light); color: var(--primary);
    transition: var(--transition);
}
.quick-action-btn:hover { border-color: var(--primary-glow); box-shadow: var(--shadow); }
.quick-action-btn:hover i { background: var(--primary); color: var(--white); }

.progress-bar-container { background: var(--gray); border-radius: 10px; height: 8px; overflow: hidden; margin-top: 6px; }
.progress-bar-fill { height: 100%; border-radius: 10px; transition: width 1.2s cubic-bezier(0.4,0,0.2,1); background: var(--primary-gradient); }

/* ANNOUNCEMENT CARDS */
.announcement-card { padding: 16px 18px; border-radius: var(--border-radius-sm); margin-bottom: 10px; border-left: 4px solid var(--primary); background: #f8fafc; transition: var(--transition); }
.announcement-card:hover { background: #f1f5f9; }
.announcement-card.urgent { border-left-color: var(--danger); background: #fef2f2; }
.announcement-card.important { border-left-color: var(--accent); background: #fffbeb; }
.announcement-card h5 { font-size: 0.92rem; margin-bottom: 4px; color: var(--dark); font-weight: 600; }
.announcement-card p { font-size: 0.85rem; color: var(--text-muted); margin: 0; }
.announcement-card .meta { font-size: 0.75rem; color: var(--text-muted); margin-top: 6px; }

/* ATTENDANCE GRID */
.attendance-grid { display: grid; gap: 0; border: 1px solid var(--gray); border-radius: var(--border-radius-sm); overflow: hidden; font-size: 0.88rem; }
.attendance-grid .cell { padding: 10px 12px; border-bottom: 1px solid #f1f5f9; border-right: 1px solid #f1f5f9; display: flex; align-items: center; }
.attendance-grid .cell:last-child { border-right: none; }
.attendance-grid .header { background: #f8fafc; font-weight: 600; font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; }
.attendance-radio { display: flex; gap: 6px; align-items: center; justify-content: center; width: 100%; }
.attendance-radio input { display: none; }
.attendance-radio label { display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 8px; cursor: pointer; transition: var(--transition); border: 2px solid var(--gray); font-size: 0.72rem; font-weight: 700; }
.attendance-radio input:checked + label.present { background: #dcfce7; border-color: var(--secondary); color: #166534; }
.attendance-radio input:checked + label.absent { background: #fee2e2; border-color: var(--danger); color: var(--danger); }
.attendance-radio input:checked + label.late { background: #f0fdfa; border-color: var(--accent); color: #115e59; }
.attendance-radio input:checked + label.excused { background: #dbeafe; border-color: var(--info); color: #1d4ed8; }

/* TIMETABLE */
.timetable-grid { display: grid; gap: 0; border: 1px solid var(--gray); border-radius: var(--border-radius-sm); overflow: hidden; }
.timetable-cell { padding: 10px; border-bottom: 1px solid #f1f5f9; border-right: 1px solid #f1f5f9; min-height: 60px; font-size: 0.85rem; }
.timetable-cell.header { background: var(--primary-gradient); color: var(--white); font-weight: 600; text-align: center; font-size: 0.82rem; }
.timetable-cell.time-col { background: #f8fafc; font-weight: 600; font-size: 0.8rem; color: var(--text-muted); display: flex; align-items: center; justify-content: center; }
.timetable-slot { background: var(--primary-light); border-radius: 8px; padding: 6px 8px; font-size: 0.82rem; color: var(--primary); font-weight: 500; }
.timetable-slot .teacher-name { font-size: 0.7rem; color: var(--text-muted); font-weight: 400; }

/* FEE CARDS */
.fee-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.fee-card {
    padding: 18px 20px; border-radius: var(--border-radius); border: 1px solid var(--border);
    background: var(--white); display: flex; align-items: center; gap: 14px; text-align: left;
}
.fee-card-icon { width: 42px; height: 42px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 1rem; flex-shrink: 0; }
.fee-card.total .fee-card-icon { background: #eef2ff; color: #3949ab; }
.fee-card.paid .fee-card-icon { background: #e7f5ef; color: #157a51; }
.fee-card.balance .fee-card-icon { background: #fdeeee; color: #b3261e; }
.fee-card.rate .fee-card-icon { background: #f1edfb; color: #5b3fa3; }
.fee-card h4 { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-muted); font-weight: 600; margin-bottom: 4px; }
.fee-card .amount { font-size: 1.3rem; font-weight: 800; color: var(--dark); }

/* GRADE DISPLAY */
.grade-display { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; font-weight: 700; font-size: 0.95rem; }
.grade-a { color: #166534; }
.grade-b { color: #1d4ed8; }
.grade-c { color: #115e59; }
.grade-d { color: #9a3412; }
.grade-f { color: var(--danger); }

/* Grade source badge */
.grade-source-badge {
    display: inline-block;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.3px;
    padding: 2px 5px;
    border-radius: 4px;
    white-space: nowrap;
    line-height: 1.2;
    text-transform: uppercase;
    transition: opacity 0.15s;
}
.grade-source-badge.source-score {
    background: #dbeafe;
    color: #1d4ed8;
}
.grade-source-badge.source-ca-exam {
    background: #dbeafe;
    color: #1d4ed8;
}
.grade-source-badge.source-manual {
    background: #f0fdfa;
    color: #115e59;
}

/* TABS */
.tabs { display: flex; gap: 4px; margin-bottom: 24px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tab-btn { padding: 11px 18px; background: none; border: none; cursor: pointer; font-weight: 600; font-size: 0.88rem; color: var(--text-muted); position: relative; transition: var(--transition); white-space: nowrap; text-decoration: none; display: inline-block; border-radius: 6px 6px 0 0; letter-spacing: -0.01em; }
.tab-btn:hover { color: var(--primary); background: var(--primary-light); }
.tab-btn.active { color: var(--primary); }
.tab-btn.active::after { content: ''; position: absolute; bottom: -1px; left: 10px; right: 10px; height: 3px; background: var(--primary-gradient); border-radius: 3px 3px 0 0; }

/* EMPTY STATE */
.empty-state { text-align: center; padding: 56px 20px; color: var(--text-muted); }
.empty-state i { font-size: 1.6rem; margin-bottom: 16px; color: var(--primary); width: 64px; height: 64px; line-height: 64px; display: inline-block; border-radius: 8px; background: var(--primary-light); opacity: 1; }
.empty-state h4 { margin-bottom: 6px; color: var(--dark); font-weight: 700; font-size: 1.02rem; letter-spacing: -0.01em; }
.empty-state p { font-size: 0.88rem; max-width: 420px; margin: 0 auto; line-height: 1.55; }
.empty-state-cta {
    margin-top: 14px; display: inline-flex; align-items: center; gap: 9px;
    padding: 10px 22px; border-radius: 999px; font-weight: 700;
    letter-spacing: -0.01em; text-decoration: none; border: none;
    box-shadow: var(--shadow-sm);
}
.empty-state-cta i {
    width: 21px; height: 21px; border-radius: 50%; flex-shrink: 0;
    background: rgba(255,255,255,0.22);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 0.68rem;
}

/* LOGIN TABS */
.login-tabs { display: flex; gap: 0; margin-bottom: 24px; border-radius: 10px; overflow: hidden; border: 1.5px solid var(--gray); }
.login-tab { flex: 1; padding: 12px; text-align: center; cursor: pointer; font-weight: 600; font-size: 0.85rem; transition: var(--transition); background: var(--white); color: var(--text-muted); border: none; font-family: 'Roboto', Arial, sans-serif; display: flex; align-items: center; justify-content: center; gap: 8px; }
.login-tab.active { background: var(--primary-gradient); color: white; }
.login-tab:hover:not(.active) { background: var(--primary-light); color: var(--primary-dark); }
.credentials-hint { background: var(--primary-light); border: 1px solid rgba(79,70,229,0.15); border-radius: 8px; padding: 10px 14px; margin-top: 16px; font-size: 0.78rem; color: var(--text-muted); line-height: 1.5; }
.credentials-hint strong { color: var(--primary); }

/* UTILITY */
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; margin-bottom: 5px; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.activity-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid #f1f5f9; }
.activity-item:last-child { border-bottom: none; }
.activity-icon { width: 38px; height: 38px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 0.9rem; flex-shrink: 0; }

/* BULK TRANSFER */
.bulk-transfer-bar { display: none; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; padding: 14px 16px; border: 1px solid var(--primary-light); border-left: 3px solid var(--primary-dark); border-radius: var(--border-radius-sm); background: var(--primary-soft); }
.bulk-transfer-bar.active { display: flex; }
.bulk-transfer-meta { color: var(--primary-darker); font-size: 0.9rem; }
.bulk-transfer-meta strong { color: var(--dark); }
.select-cell { width: 48px; text-align: center; }
.select-cell input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; }

/* REPORT STYLES */
.report-section { background: var(--white); padding: 28px; border-radius: var(--border-radius); box-shadow: var(--shadow); margin-bottom: 28px; }
.report-section h3 { margin-bottom: 20px; color: var(--primary); border-bottom: 2px solid var(--gray); padding-bottom: 10px; display: flex; align-items: center; gap: 10px; }
.report-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.report-card { border: 1px solid var(--gray); border-radius: var(--border-radius); padding: 20px; transition: var(--transition); }
.report-card:hover { box-shadow: var(--shadow); border-color: var(--primary); }
.report-hero { background: var(--primary-gradient); color: white; padding: 32px; border-radius: var(--border-radius); margin-bottom: 28px; position: relative; overflow: hidden; }
.report-hero::before { content: ''; position: absolute; width: 250px; height: 250px; background: rgba(255,255,255,0.06); border-radius: 50%; top: -80px; right: -40px; }
.report-hero h2 { margin: 0 0 8px; font-size: 1.4rem; color: #fff; }
.report-hero p { opacity: 0.9; margin: 0; color: #fff; }
.section-title { font-size: 1.05rem; font-weight: 700; color: var(--dark); margin-bottom: 20px; display: flex; align-items: center; gap: 10px; padding-bottom: 10px; border-bottom: 2px solid var(--gray); }
.section-title i { color: var(--primary); }
.report-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; margin-bottom: 36px; }
.report-card .card-icon { width: 48px; height: 48px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; margin-bottom: 14px; }
.card-icon.gold { background: #f0fdfa; color: #115e59; }
.card-icon.green { background: linear-gradient(135deg, #d1fae5, #a7f3d0); color: #065f46; }
.card-icon.blue { background: linear-gradient(135deg, #dbeafe, #bfdbfe); color: #1d4ed8; }
.card-icon.purple { background: linear-gradient(135deg, #ede9fe, #ddd6fe); color: #6d28d9; }
.card-icon.red { background: linear-gradient(135deg, #fee2e2, #fecaca); color: #991b1b; }
.card-icon.orange { background: linear-gradient(135deg, #ffedd5, #fed7aa); color: #9a3412; }
.report-card h4 { font-size: 1rem; margin-bottom: 6px; color: var(--dark); font-weight: 600; }
.report-card .card-desc { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 16px; line-height: 1.5; }
.export-section { background: #f8fafc; border-radius: var(--border-radius); padding: 28px; margin-bottom: 28px; border: 1px solid var(--gray); }
.export-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.export-btn { display: flex; align-items: center; gap: 10px; padding: 14px 16px; background: var(--white); border: 1px solid var(--gray); border-radius: 6px; cursor: pointer; transition: var(--transition); text-decoration: none; color: var(--dark); font-family: inherit; font-size: 0.85rem; font-weight: 500; }
.export-btn:hover { border-color: var(--primary); box-shadow: 0 4px 12px rgba(79,70,229,0.1); transform: translateY(-1px); }
.export-btn i { width: 32px; height: 32px; border-radius: 5px; display: flex; align-items: center; justify-content: center; font-size: 0.85rem; flex-shrink: 0; }
.export-btn i.csv { background: #dbeafe; color: #1d4ed8; }
.term-report-preview { background: #f0fdf4; border: 1px solid #a7f3d0; border-radius: 6px; padding: 14px; margin-top: 12px; font-size: 0.82rem; color: #065f46; }

/* ===== BOTTOM NAVIGATION (Mobile) ===== */
.bottom-nav {
    display: none; /* hidden on desktop */
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1001;
    background: rgba(255,255,255,0.96);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 20px rgba(15,23,42,0.08);
    padding: 0 env(safe-area-inset-bottom, 0px);
    height: 62px;
    display: none; /* redundant but explicit */
    align-items: center;
    justify-content: space-around;
}
.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 6px 10px;
    min-width: 56px;
    min-height: 48px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    text-decoration: none;
    cursor: pointer;
    font-family: 'Roboto', Arial, sans-serif;
    font-size: 0.6rem;
    font-weight: 500;
    transition: var(--transition);
    border-radius: 8px;
    position: relative;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.bottom-nav-item i {
    font-size: 1.15rem;
    transition: var(--transition);
}
.bottom-nav-item span {
    line-height: 1;
    white-space: nowrap;
}
.bottom-nav-item:active {
    transform: scale(0.92);
}
.bottom-nav-item.active {
    color: var(--primary);
}
.bottom-nav-item.active i {
    text-shadow: 0 0 12px rgba(37,99,235,0.3);
}
.bottom-nav-item.active::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 3px;
    background: var(--primary-gradient);
    border-radius: 0 0 4px 4px;
}
.bottom-nav-more {
    /* No extra styling needed, inherits from .bottom-nav-item */
}

/* Touch-friendly interaction improvements */
.btn, .form-control, select.form-control, a, button, .attendance-radio label,
.nav-links a, .quick-action-btn, .tab-btn, .login-tab, .export-btn,
.bottom-nav-item, .sidebar-toggle, .report-card, .stat-card {
    touch-action: manipulation;
}

/* Ensure content isn't hidden behind bottom nav on mobile */
@media (max-width: 768px) {
    .main-content {
        padding-bottom: 74px; /* space for bottom nav + safe area */
    }
    .content-wrapper {
        padding-bottom: 0;
    }
}

/* RESPONSIVE */
@media (max-width: 1200px) {
    .dashboard-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
}
@media (max-width: 1024px) {
    .settings-grid, .form-grid { grid-template-columns: 1fr; }
    .form-grid .full-width { grid-column: span 1; }
}
@media (max-width: 768px) {
    .sidebar {
        width: 260px; transform: translateX(-100%); position: fixed; left: 0; top: 0; bottom: 0; z-index: 1000;
        border-radius: 0; align-items: stretch;
    }
    .sidebar.show { transform: translateX(0); box-shadow: 5px 0 30px rgba(0,0,0,0.3); }
    .sidebar-header { flex-direction: row; align-items: center; padding: 20px 16px 16px; border-bottom: 1px solid rgba(255,255,255,0.12); }
    .sidebar-header h3 { display: block; font-size: 0.92rem; color: #fff; line-height: 1.25; font-weight: 700; letter-spacing: -0.01em; }
    .nav-links { align-items: stretch; padding: 12px 12px 8px; gap: 6px; }
    .nav-section-title {
        display: block; font-size: 0.6rem; text-transform: uppercase; letter-spacing: 1.6px;
        color: rgba(255,255,255,0.45); padding: 16px 12px 6px; font-weight: 700;
    }
    .nav-links a, .logout-link a {
        flex-direction: row; width: auto; height: auto; justify-content: flex-start; padding: 9px 14px; gap: 11px; border-radius: 12px;
    }
    .nav-links a.active { box-shadow: none; font-weight: 700; }
    .nav-label { font-size: 0.85rem; text-align: left; color: inherit; font-weight: inherit; }
    .logout-link { padding: 12px; border-top: 1px solid rgba(255,255,255,0.12); }
    .sidebar-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 999; backdrop-filter: blur(2px); }
    .sidebar-overlay.show { display: block; }
    .sidebar-toggle { display: flex; position: fixed; top: 14px; left: 14px; z-index: 100; }
    .main-content { margin-left: 0; width: 100%; }
    .topbar { padding: 0 12px 0 60px; height: 58px; margin: 12px 12px 0; gap: 10px; top: 12px; }
    .page-title { font-size: 0.98rem; }
    .topbar-search { display: none; }
    .topbar-date { display: none; }
    .user-meta { display: none; }
    .topbar-user { padding: 4px; }
    .topbar-menu { width: 260px; }
    .content-wrapper { padding: 16px; padding-bottom: 0; }
    .panel, .widget { padding: 18px; }
    .panel-header, .widget-header { margin: -18px -18px 18px; padding: 14px 18px; }
    .stats-grid { grid-template-columns: 1fr; gap: 12px; }
    .quick-actions { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .quick-action-btn { padding: 14px 10px; min-height: 72px; font-size: 0.78rem; }
    .quick-action-btn i { width: 40px; height: 40px; font-size: 1.1rem; }
    table th, table td { padding: 10px 12px; font-size: 0.82rem; }
    .tabs { overflow-x: auto; white-space: nowrap; margin-bottom: 16px; }
    .tabs::-webkit-scrollbar { display: none; }
    .tab-btn { padding: 10px 16px; font-size: 0.85rem; }
    .auth-box { padding: 32px 24px; margin: 16px; }
    .auth-box h2 { font-size: 1.3rem; }
    .welcome-banner { padding: 24px 20px; }
    .welcome-banner h2 { font-size: 1.25rem; }
    .stat-card { padding: 18px 20px; }
    .stat-info .h2 { font-size: 1.4rem; }
    .chart-card { padding: 16px; }
    .dashboard-grid { grid-template-columns: 1fr; gap: 16px; }
    .fee-summary { grid-template-columns: 1fr; }
    .filter-bar form { flex-direction: column; }
    .filter-bar form .form-control { width: 100%; }
    .form-grid { grid-template-columns: 1fr; }
    .bottom-nav { display: flex; }
    .modal-content { padding: 24px; max-width: 100%; margin: 10px; }
    .attendance-radio label { width: 34px; height: 34px; font-size: 0.78rem; }
}

@media (max-width: 480px) {
    .quick-actions { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .quick-action-btn { min-height: 66px; }
    .auth-box { padding: 24px 18px; }
    .content-wrapper { padding: 12px; }
    .topbar { padding: 0 10px 0 56px; height: 54px; margin: 10px 10px 0; top: 10px; }
    .sidebar-toggle { top: 16px; left: 14px; width: 38px; height: 38px; }
    .panel, .widget { padding: 14px; }
    .panel-header, .widget-header { margin: -14px -14px 14px; padding: 12px 14px; }
    table th, table td { padding: 8px 10px; font-size: 0.78rem; }
    .btn { padding: 10px 14px; font-size: 0.85rem; }
    .form-control { padding: 10px 12px; font-size: 16px; /* prevents iOS zoom on focus */ }
    .welcome-banner { padding: 20px 16px; }
    .welcome-banner h2 { font-size: 1.1rem; }
    .welcome-meta { gap: 12px; font-size: 0.8rem; }
    .stat-card { padding: 14px 16px; }
    .bottom-nav { height: 56px; }
    .bottom-nav-item { min-width: 48px; min-height: 44px; font-size: 0.55rem; }
    .bottom-nav-item i { font-size: 1.05rem; }
    .chart-card { padding: 12px; }
    .chart-container { height: 220px; }
    .modal-content { padding: 20px; }
}
@media (max-width: 480px) {
    .quick-actions { grid-template-columns: repeat(2, 1fr); }
    .auth-box { padding: 32px 24px; margin: 16px; }
}

/* ===== Cross-page alignment & polish ===== */
.content-wrapper { margin: 0 auto; }
.panel-header .action-btns { margin-left: auto; }
.panel-title i, .widget-title i, .section-title i { flex-shrink: 0; }
.help-note { animation: fadeUp 0.4s ease; }

/* ============================================================
   ENTERPRISE / SaaS POLISH LAYER  (additive — Stripe/Linear feel)
   ============================================================ */

/* Typography rhythm — consistent hierarchy without forcing sizes
   (inline styles still win, so nothing existing breaks). */
html { font-size: 16px; -webkit-text-size-adjust: 100%; overflow-x: hidden; }
/* Headings inherit colour (dark on light pages, white on coloured banners) */
h1, h2, h3, h4, h5 { letter-spacing: -0.02em; line-height: 1.25; color: inherit; }
h4, h5 { letter-spacing: -0.01em; }
p { line-height: 1.6; }
small { font-size: 0.78rem; }
a { color: var(--primary); }
strong, b { font-weight: 700; }

/* Crisp, branded text selection */
::selection { background: rgba(214,32,139,0.22); color: var(--primary-darker); }

/* Accessible, modern focus ring (keyboard users only) */
a:focus-visible, button:focus-visible, .btn:focus-visible,
.form-control:focus-visible, .tab-btn:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible {
    outline: none;
    box-shadow: var(--ring);
    border-radius: var(--border-radius-sm);
}
.nav-links a:focus-visible, .bottom-nav-item:focus-visible { box-shadow: 0 0 0 3px rgba(255,255,255,0.5); }

/* Buttons: consistent min height, disabled + loading states */
.btn { min-height: 40px; }
.btn-small { min-height: 34px; }
.btn-xs { min-height: 26px; }
.btn:disabled, .btn[disabled] { opacity: 0.55; cursor: not-allowed; transform: none !important; box-shadow: none; }
.btn .spinner { width: 15px; height: 15px; border-width: 2px; }

/* Spinner + inline loading */
.spinner {
    display: inline-block; width: 18px; height: 18px;
    border: 2.5px solid rgba(214,32,139,0.25); border-top-color: var(--primary);
    border-radius: 50%; animation: spin 0.7s linear infinite; vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-overlay {
    position: fixed; inset: 0; z-index: 1200; display: none;
    align-items: center; justify-content: center; flex-direction: column; gap: 14px;
    background: rgba(238,242,249,0.7); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
    color: var(--text-muted); font-size: 0.88rem; font-weight: 600;
}
.loading-overlay.show { display: flex; }
.loading-overlay .spinner { width: 36px; height: 36px; border-width: 4px; }

/* Skeleton shimmer for loading placeholders */
.skeleton {
    background: linear-gradient(100deg, #eef2f7 30%, #f7f9fc 50%, #eef2f7 70%);
    background-size: 200% 100%; animation: shimmer 1.3s ease-in-out infinite;
    border-radius: 8px; min-height: 14px;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Status dot inside a badge (e.g. <span class="badge badge-active"><span class="dot"></span> Active</span>) */
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; display: inline-block; flex-shrink: 0; }

/* Section title consistency across pages */
.section-title { letter-spacing: -0.015em; }

/* Filter bar gets a clean inset surface so controls read as a group */
.filter-bar {
    background: var(--surface-alt); border: 1px solid var(--border);
    border-radius: var(--border-radius); padding: 12px 14px;
}
.filter-bar form { align-items: center; }

/* Tables: roomier, calmer, with a subtle zebra */
.table-responsive { box-shadow: var(--shadow-sm); background: var(--white); }
table tbody tr:nth-child(even) td { background: rgba(247,249,252,0.55); }
table tbody tr:hover td { background: var(--primary-soft); }
/* keep zebra from overriding hover */
table tbody tr:nth-child(even):hover td { background: var(--primary-soft); }

/* Compact icon-only action button (opt-in via .btn.btn-icon) */
.btn-icon { width: 34px; height: 34px; padding: 0; border-radius: 5px; }

/* Cards / panels: smoother entrance + crisp 1px hairline on top for depth */
.stat-card, .panel, .widget { will-change: transform; }

/* Dividers used inline (hr) look hairline-clean */
hr { border: 0; border-top: 1px solid var(--border); }

/* Links inside content get a tasteful underline on hover */
.content-wrapper a:not(.btn):not(.tab-btn):not(.quick-action-btn):not(.export-btn):hover { text-decoration: underline; text-underline-offset: 2px; }

/* Print-cleanliness: never print the chrome */
@media print {
    .sidebar, .topbar, .bottom-nav, .sidebar-toggle, .loading-overlay { display: none !important; }
    .main-content { margin: 0 !important; }
    body { background: #fff !important; }
}

/* Keep action buttons tidy and same height when they wrap */
.action-btns .btn { white-space: nowrap; }

/* Bulk-action bar wraps cleanly on small screens */
@media (max-width: 768px) {
    .panel-header { flex-direction: column; align-items: flex-start; }
    .panel-header .action-btns { margin-left: 0; width: 100%; }
    .panel-header form.action-btns .form-control { flex: 1; }
    .bulk-transfer-bar { flex-direction: column; align-items: stretch; }
    .bulk-transfer-bar .action-btns { width: 100%; }
    .bulk-transfer-bar .action-btns .btn { flex: 1; }
    .help-note { font-size: 0.82rem; padding: 11px 13px; }
    .modal-content { max-height: 88vh; }
    .form-grid { grid-template-columns: 1fr; }
    .form-grid .full-width { grid-column: span 1; }
}
