/* ============================================================
   EduMaster ERP — Premium Design System
   Inspired by modern SaaS dashboards: soft, clean, spacious
   ============================================================ */
:root {
    /* Primary */
    --primary: #4353FF;
    --primary-light: #6370FF;
    --primary-dark: #3040E0;
    --primary-bg: rgba(67, 83, 255, 0.08);
    --primary-gradient: linear-gradient(135deg, #4353FF 0%, #6C63FF 50%, #8B5CF6 100%);

    /* Sweedu-pages compatibility vars (dark-theme fallbacks → light-theme overrides) */
    --text: #0F172A;
    --heading: #0F172A;
    --accent-text: #4353FF;
    --accent: #4353FF;
    --muted: #6B7280;
    --border: #E5E7EB;
    --input-bg: #F9FAFB;
    --glass-bg: #F3F4F6;
    --table-head: #F9FAFB;
    --card-bg: #FFFFFF;
    --glass-border: #E5E7EB;
    --bg-elevated: #FFFFFF;

    /* Backgrounds */
    --bg-deep: #EEF0F7;
    --bg-surface: #FFFFFF;
    --bg-card: #FFFFFF;
    --bg-card-hover: #FAFBFF;
    --bg-sidebar: #FFFFFF;
    --bg-input: #F4F6FB;
    --bg-badge: #F0F1F5;

    /* Accent */
    --accent: #06B6D4;
    --accent-glow: rgba(6, 182, 212, 0.15);

    /* Semantic */
    --success: #22C55E;
    --success-bg: rgba(34, 197, 94, 0.1);
    --warning: #F59E0B;
    --warning-bg: rgba(245, 158, 11, 0.1);
    --danger: #EF4444;
    --danger-bg: rgba(239, 68, 68, 0.1);
    --info: #3B82F6;
    --info-bg: rgba(59, 130, 246, 0.1);

    /* Text — WCAG AA minimum 4.5:1 on #EEF0F7 bg */
    --text-primary: #0F172A;
    --text-secondary: #374151;
    --text-muted: #6B7280;
    --text-on-primary: #FFFFFF;

    /* Borders */
    --border-glass: #D1D5DB;
    --border-light: #E5E7EB;
    --border-glow: rgba(67, 83, 255, 0.2);

    /* Pastel card tints */
    --pastel-blue: #EFF3FF;
    --pastel-indigo: #EEF0FF;
    --pastel-purple: #F3EEFF;
    --pastel-pink: #FDF2F8;
    --pastel-rose: #FFF1F2;
    --pastel-orange: #FFF7ED;
    --pastel-amber: #FFFBEB;
    --pastel-yellow: #FEFCE8;
    --pastel-green: #ECFDF5;
    --pastel-teal: #F0FDFA;
    --pastel-cyan: #ECFEFF;
    --pastel-sky: #F0F9FF;

    /* Typography */
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-heading: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

    /* Layout */
    --sidebar-width: 260px;
    --sidebar-collapsed: 0px;
    --topnav-height: 68px;
    --page-padding: 28px;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --card-radius: 16px;
    --card-padding: 24px;
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 18px;
    --radius-xl: 24px;

    /* Shadows — tinted, diffused, premium */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.03), 0 1px 2px rgba(0,0,0,0.02);
    --shadow-md: 0 4px 16px rgba(67, 83, 255, 0.04), 0 2px 6px rgba(0,0,0,0.03);
    --shadow-lg: 0 12px 40px rgba(67, 83, 255, 0.06), 0 4px 12px rgba(0,0,0,0.03);
    --shadow-card: 0 1px 4px rgba(0,0,0,0.03), 0 0 0 1px rgba(0,0,0,0.02);
    --shadow-sidebar: 2px 0 16px rgba(0,0,0,0.03);

    /* Transitions — premium cubic-bezier curves */
    --transition-fast: 0.2s cubic-bezier(0.32, 0.72, 0, 1);
    --transition-smooth: 0.4s cubic-bezier(0.32, 0.72, 0, 1);
    --transition-spring: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ============================================================
   Reset & Base
   ============================================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    background: var(--bg-deep);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100dvh;
    overflow-x: hidden;
}

body.sidebar-open {
    overflow: hidden;
    touch-action: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

details:not([open]) > *:not(summary) {
    display: none !important;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: 3px solid var(--primary-bg);
    outline-offset: 2px;
}

/* ============================================================
   Scrollbar
   ============================================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.2); }

/* ============================================================
   Sidebar — White, clean, reference-style
   ============================================================ */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform var(--transition-smooth);
    overflow: hidden;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
}

.logo-img {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    object-fit: contain;
}

.logo-text {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px 12px 8px;
}

.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.08); border-radius: 10px; }
.sidebar-nav::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.15); }

/* Nav items */
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    position: relative;
}

.nav-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    stroke-width: 1.8;
    opacity: 0.7;
}

.nav-item:hover {
    background: var(--bg-input);
    color: var(--text-primary);
}

.nav-item:hover svg { opacity: 1; }

.nav-item.active {
    background: var(--primary);
    color: var(--text-on-primary);
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(67, 83, 255, 0.25);
}

.nav-item.active svg {
    opacity: 1;
    stroke: var(--text-on-primary);
}

.nav-item.active::before { display: none; }

/* Nav groups */
.nav-group {
    display: flex;
    flex-direction: column;
    margin-top: 2px;
}

.nav-group-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
    transition: all var(--transition-fast);
}

.nav-group-header:hover {
    background: var(--bg-input);
    color: var(--text-primary);
}

.nav-group-header svg.group-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.6;
    stroke-width: 1.8;
}

.nav-group-header:hover svg.group-icon { opacity: 1; }

.nav-group-header .group-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-group-arrow {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    transition: transform 0.2s ease;
    opacity: 0.4;
}

.nav-group.open .nav-group-arrow { transform: rotate(90deg); }

.nav-group-items {
    display: none;
    flex-direction: column;
    gap: 1px;
    padding-left: 6px;
    margin-top: 2px;
}

.nav-group.open .nav-group-items { display: flex; }

.nav-sub-item {
    padding: 7px 12px 7px 36px !important;
    font-size: 0.82rem !important;
    border-radius: var(--radius-sm) !important;
    gap: 8px !important;
    font-weight: 400 !important;
}

.nav-sub-item::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--text-muted);
    flex-shrink: 0;
    opacity: 0.5;
}

.nav-sub-item:hover::before { opacity: 1; }

.nav-sub-item.active::before {
    background: var(--text-on-primary);
    opacity: 1;
}

.nav-sub-item svg { display: none; }

.nav-standalone-promoted {
    padding: 9px 16px 9px 20px !important;
}
.nav-standalone-promoted::before {
    display: none !important;
}

/* Sidebar footer */
.sidebar-footer {
    border-top: 1px solid var(--border-light);
    padding: 12px;
    flex-shrink: 0;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: var(--radius-md);
    transition: background var(--transition-fast);
}

.sidebar-user:hover {
    background: var(--bg-input);
}

.sidebar-user:hover::after { display: none; }

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-gradient);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.user-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.user-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role, .role-badge {
    font-size: 0.7rem;
    padding: 1px 8px;
    border-radius: 20px;
    font-weight: 500;
    display: inline-block;
    width: fit-content;
    margin-top: 2px;
    color: white;
}

.sidebar-branding {
    padding: 6px 10px;
    font-size: 0.68rem;
    color: var(--text-muted);
    text-align: center;
}

.sidebar-branding strong { color: var(--text-secondary); font-weight: 600; }

.btn-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 9px;
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-logout svg { width: 16px; height: 16px; }
.btn-logout:hover { background: var(--danger-bg); color: var(--danger); border-color: rgba(239,68,68,0.2); }

/* Sidebar overlay for mobile */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    backdrop-filter: blur(2px);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-smooth);
}

.sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* ============================================================
   Top Navigation — Clean modern header
   ============================================================ */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left var(--transition-smooth);
}

.topnav {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 var(--page-padding);
    height: var(--topnav-height);
    background: var(--bg-deep);
}

.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    padding: 8px;
    background: none;
    border: none;
    cursor: pointer;
    border-radius: var(--radius-sm);
}

.hamburger:hover { background: rgba(0,0,0,0.04); }

.hamburger span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all var(--transition-fast);
}

.topnav-left {
    flex: 1;
    min-width: 0;
}

.page-title {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
    line-height: 1.2;
}

.page-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 400;
    margin-top: 1px;
}

.topnav-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Academic session badge — quick-view of which session's data is showing */
.session-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border-glass);
    border-radius: 40px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary, var(--text-muted));
    white-space: nowrap;
}

/* Search box */
.search-box {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border-glass);
    border-radius: 40px;
    min-width: 220px;
    transition: all var(--transition-fast);
}

/* Must out-specify `.topnav-icon { display: flex }` (defined later in this file).
   As a bare `.mobile-search-toggle` this lost the cascade on equal specificity,
   so the mobile-only search toggle rendered on desktop right beside the full
   search box — two controls doing the same job. */
.topnav-icon.mobile-search-toggle {
    display: none;
}

.mobile-tabbar {
    display: none;
}

.search-box:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-bg);
}

.search-box svg {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.search-box input {
    border: none;
    outline: none;
    background: none;
    font-size: 0.85rem;
    color: var(--text-primary);
    width: 100%;
    font-family: var(--font-body);
}

.search-box input::placeholder { color: var(--text-muted); }

/* Search results dropdown */
.search-results-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    max-height: 320px;
    overflow-y: auto;
    z-index: 200;
    display: none;
}

.search-loading, .search-empty {
    padding: 16px;
    text-align: center;
    font-size: 0.83rem;
    color: var(--text-muted);
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background var(--transition-fast);
    border-bottom: 1px solid var(--border-light);
}

.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--bg-input); }

.search-result-icon {
    width: 32px; height: 32px;
    border-radius: 8px;
    background: var(--primary-bg);
    display: flex; align-items: center; justify-content: center;
    color: var(--primary);
    flex-shrink: 0;
}

.search-result-title {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
}

.search-result-type {
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* Notification dropdown */
.notification-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 340px;
    background: var(--bg-surface);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 200;
    display: none;
    max-height: 420px;
    overflow-y: auto;
}

.notif-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-light);
}

.notif-header h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.notif-mark-read {
    font-size: 0.75rem;
    color: var(--primary);
    cursor: pointer;
    background: none;
    border: none;
    font-weight: 500;
}

.notif-item {
    display: flex;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    transition: background var(--transition-fast);
    align-items: flex-start;
}

.notif-item:hover { background: var(--bg-input); }
.notif-item:last-child { border-bottom: none; }

.notif-icon {
    font-size: 1.2rem;
    line-height: 1;
    flex-shrink: 0;
    margin-top: 2px;
}

.notif-title {
    font-size: 0.82rem;
    color: var(--text-primary);
    line-height: 1.4;
}

.notif-time {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 3px;
}

.notif-unread { background: var(--primary-bg); }

.notif-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--primary);
    flex-shrink: 0;
    margin-top: 6px;
}

/* Topnav icon buttons */
.topnav-icon {
    position: relative;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--bg-surface);
    border: 1px solid var(--border-glass);
    cursor: pointer;
    transition: all var(--transition-fast);
    color: var(--text-secondary);
}

.topnav-icon svg {
    width: 18px;
    height: 18px;
}

.topnav-icon:hover {
    background: var(--primary-bg);
    border-color: var(--border-glow);
    color: var(--primary);
}

.notification-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--danger);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-deep);
    animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* ============================================================
   Page Container
   ============================================================ */
.page-container {
    padding: 0 var(--page-padding) var(--page-padding);
    flex: 1;
    /* Every page's content renders inside this single container, and the AI Coach
       launcher (ai-coach.js) is a fixed circle pinned to bottom:28px/right:28px,
       ~90px tall including its own offset — outside normal page flow. Any page
       whose last element (commonly a pagination row) lands in that corner gets
       its controls covered and unclickable. Reserving clearance here, once, covers
       every page regardless of which of the app's several bespoke pagination
       markups it happens to use, instead of patching each one individually.
     */
    padding-bottom: calc(var(--page-padding) + 90px);
}

/* ============================================================
   Global overrides for inline-styled sweedu pages (dark-theme fallbacks)
   These use !important to override hardcoded inline font-size:13px and color
   ============================================================ */
.page-container td {
    color: var(--text-primary) !important;
    font-size: 0.9rem !important;
}

.page-container th {
    color: var(--text-secondary) !important;
    font-size: 0.8rem !important;
    font-weight: 600 !important;
}

.page-container select,
.page-container input[type="text"],
.page-container input[type="search"] {
    color: var(--text-primary) !important;
    background: var(--bg-surface) !important;
    border-color: var(--border-glass) !important;
    font-size: 0.88rem !important;
}

.page-container select option {
    color: var(--text-primary);
    background: var(--bg-surface);
}

/* ============================================================
   Glass Card — Clean white cards
   ============================================================ */
.glass-card {
    background: var(--bg-card);
    border-radius: var(--card-radius);
    padding: var(--card-padding);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-card);
    transition: all var(--transition-fast);
    position: relative;
}

.glass-card::before { display: none; }

.glass-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border-glass);
    transform: translateY(-1px);
}

.glass-card .card-glow { display: none; }

/* Stat cards — colored left accent + subtle tinted top glow */
.glass-card.stat-card:nth-child(1) { border-left: 3px solid var(--primary); }
.glass-card.stat-card:nth-child(2) { border-left: 3px solid var(--success); }
.glass-card.stat-card:nth-child(3) { border-left: 3px solid var(--accent); }
.glass-card.stat-card:nth-child(4) { border-left: 3px solid var(--warning); }
.glass-card.stat-card:nth-child(5) { border-left: 3px solid #8B5CF6; }
.glass-card.stat-card:nth-child(6) { border-left: 3px solid #EC4899; }
.glass-card.stat-card:nth-child(7) { border-left: 3px solid #14B8A6; }
.glass-card.stat-card:nth-child(8) { border-left: 3px solid #F97316; }

/* ============================================================
   Stagger-in Animation
   ============================================================ */
.stagger-in {
    opacity: 0;
    transform: translateY(12px);
    animation: staggerIn 0.4s ease forwards;
}

@keyframes staggerIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.gravity-fall { opacity: 0; transform: translateY(12px); animation: staggerIn 0.4s ease forwards; }
.gravity-particles { display: none; }
.gravity-particle { display: none; }

/* ============================================================
   Dashboard Grids
   ============================================================ */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.dashboard-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.dashboard-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

/* ============================================================
   Stat Cards (Top Row)
   ============================================================ */
.stat-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stat-card .stat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Same defect the dashboard KPI tiles had: the glyph and its badge were the same
   hue, the badge only 8-10% opaque, measuring a 1.0 contrast ratio — the icon was
   effectively invisible and every card read as one flat grey block. A white glyph on
   a saturated gradient lifts this to roughly 5-8:1 and gives each stat its own
   identity. Used by the Exams, Markscard and Transport stat cards among others. */
.stat-card .stat-icon {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #FFFFFF;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.stat-card .stat-icon svg {
    width: 22px;
    height: 22px;
    stroke-width: 2.1;
}

.stat-icon.indigo { background: linear-gradient(145deg, #6366F1, #4338CA); color: #FFFFFF; }
.stat-icon.cyan   { background: linear-gradient(145deg, #06B6D4, #0E7490); color: #FFFFFF; }
.stat-icon.green  { background: linear-gradient(145deg, #22C55E, #15803D); color: #FFFFFF; }
.stat-icon.amber  { background: linear-gradient(145deg, #F59E0B, #B45309); color: #FFFFFF; }

.stat-badge {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 20px;
    /* holds a trend icon + label since the raw ↑/↓ text glyph was replaced */
    display: inline-flex;
    align-items: center;
    gap: 4px;
    line-height: 1;
}

.stat-badge svg {
    width: 13px;
    height: 13px;
    flex: 0 0 auto;
}

.stat-badge.up { background: var(--success-bg); color: var(--success); }
.stat-badge.down { background: var(--danger-bg); color: var(--danger); }

.stat-value {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
    letter-spacing: -0.5px;
}

.stat-label {
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.stat-trend {
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* ============================================================
   Chart Cards
   ============================================================ */
.chart-card { min-height: 280px; }

.chart-card .card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.chart-card .card-subtitle {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.chart-container {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Donut Chart */
.donut-chart {
    display: flex;
    align-items: center;
    gap: 32px;
    padding: 12px 0;
}

.donut-svg {
    width: 140px;
    height: 140px;
    flex-shrink: 0;
}

.donut-segment {
    fill: none;
    stroke-width: 20;
    stroke-linecap: round;
    transition: opacity 0.2s;
}

.donut-center-text {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 700;
    fill: var(--text-primary);
    text-anchor: middle;
    dominant-baseline: central;
}

.donut-legend {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Ring Chart */
.ring-chart-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.ring-svg {
    width: 100px;
    height: 100px;
    transform: rotate(-90deg);
}

.ring-bg {
    fill: none;
    stroke: var(--border-light);
    stroke-width: 8;
}

.ring-progress {
    fill: none;
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s ease;
}

.ring-center {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.ring-value {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.ring-label {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Bar Chart */
.bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    padding: 16px 0;
    height: 200px;
    border-bottom: 1px solid var(--border-light);
}

.bar-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    height: 100%;
    justify-content: flex-end;
}

.bar-wrapper {
    width: 100%;
    max-width: 40px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    height: 100%;
}

.bar {
    width: 100%;
    background: var(--primary);
    border-radius: 6px 6px 2px 2px;
    min-height: 4px;
    transition: all var(--transition-smooth);
    position: relative;
}

.bar:hover {
    opacity: 0.85;
    transform: scaleY(1.02);
    transform-origin: bottom;
}

.bar-label {
    font-size: 0.68rem;
    color: var(--text-muted);
    text-align: center;
    white-space: nowrap;
}

.bar-value-label {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: center;
}

/* ============================================================
   Timetable
   ============================================================ */
.timetable-grid {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.82rem;
}

.timetable-grid th {
    background: var(--bg-input);
    padding: 10px 14px;
    font-weight: 600;
    font-size: 0.78rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    text-align: left;
    border-bottom: 1px solid var(--border-glass);
}

.timetable-grid td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: top;
}

.timetable-grid tr:hover td { background: var(--bg-input); }

.tt-subject {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.82rem;
}

.tt-time {
    color: var(--text-muted);
    font-size: 0.72rem;
}

/* ============================================================
   Exam Schedule List
   ============================================================ */
.exam-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.exam-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.exam-item:hover {
    border-color: var(--border-glass);
    box-shadow: var(--shadow-sm);
}

.exam-date-badge {
    width: 52px;
    min-height: 52px;
    border-radius: var(--radius-md);
    background: var(--primary-bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.exam-date-day {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
}

.exam-date-month {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.exam-info {
    flex: 1;
    min-width: 0;
}

.exam-subject {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text-primary);
    margin-bottom: 3px;
}

.exam-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.exam-class-badge {
    padding: 4px 10px;
    border-radius: 20px;
    background: var(--bg-input);
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* ============================================================
   LMS
   ============================================================ */
.lms-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
}

.lms-stat-item {
    padding: 14px;
    border-radius: var(--radius-md);
    background: var(--bg-input);
    text-align: center;
}

.lms-stat-value {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
}

.lms-stat-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.live-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    background: var(--danger-bg);
    color: var(--danger);
    font-size: 0.72rem;
    font-weight: 600;
}

.live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--danger);
    animation: livePulse 1.5s ease-in-out infinite;
}

@keyframes livePulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

/* ============================================================
   Module Pages — Common
   ============================================================ */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header h2 {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
    line-height: 1.4;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 6px rgba(67, 83, 255, 0.2);
}

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: 0 4px 12px rgba(67, 83, 255, 0.3);
    transform: translateY(-1px);
}

.btn-glow { animation: none; }
@keyframes btnGlow { to { box-shadow: none; } }

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
}

.btn-outline:hover {
    background: var(--bg-input);
    border-color: var(--text-muted);
    color: var(--text-primary);
}

.btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.btn-danger, .btn[style*="danger"], .btn[style*="red"] {
    background: var(--danger);
    color: white;
}

.btn-success {
    background: var(--success);
    color: white;
}

/* ============================================================
   Form Controls
   ============================================================ */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-input, .form-select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.88rem;
    color: var(--text-primary);
    background: var(--bg-surface);
    transition: all var(--transition-fast);
    outline: none;
}

.form-input:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-bg);
}

.form-input::placeholder { color: var(--text-muted); }

.form-select option { padding: 8px; }

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

/* ============================================================
   Progress Stepper
   ============================================================ */
.stepper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 28px;
}

.stepper-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    position: relative;
}

.stepper-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-input);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 600;
    border: 2px solid var(--border-glass);
    transition: all var(--transition-fast);
}

.stepper-step.active .stepper-circle {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(67, 83, 255, 0.25);
}

.stepper-step.completed .stepper-circle {
    background: var(--success);
    color: white;
    border-color: var(--success);
}

.stepper-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
    font-weight: 500;
}

.stepper-step.active .stepper-label {
    color: var(--primary);
    font-weight: 600;
}

.stepper-line {
    width: 48px;
    height: 2px;
    background: var(--border-glass);
    margin: 0 8px;
    margin-bottom: 20px;
    border-radius: 2px;
}

.stepper-line.completed {
    background: var(--success);
}

/* ============================================================
   Data Tables — Clean, spacious
   ============================================================ */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.85rem;
}

.data-table thead th {
    background: var(--bg-input);
    padding: 11px 16px;
    font-weight: 600;
    font-size: 0.78rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    text-align: left;
    border-bottom: 1px solid var(--border-glass);
    white-space: nowrap;
}

.data-table thead th:first-child { border-radius: var(--radius-sm) 0 0 0; }
.data-table thead th:last-child { border-radius: 0 var(--radius-sm) 0 0; }

.data-table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
    vertical-align: middle;
}

.data-table tbody tr {
    transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
    background: var(--bg-input);
}

.data-table tbody tr:last-child td { border-bottom: none; }

/* Status badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
}

.status-badge.approved, .status-badge.active, .status-badge.paid, .status-badge.present, .status-badge.completed {
    background: var(--success-bg);
    color: var(--success);
}

.status-badge.pending, .status-badge.partial {
    background: var(--warning-bg);
    color: var(--warning);
}

.status-badge.rejected, .status-badge.inactive, .status-badge.unpaid, .status-badge.absent, .status-badge.failed, .status-badge.expired {
    background: var(--danger-bg);
    color: var(--danger);
}

/* ============================================================
   Attendance Grid
   ============================================================ */
.attendance-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
}

.attendance-cell {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
    cursor: pointer;
    transition: all var(--transition-fast);
    background: var(--bg-surface);
}

.attendance-cell.present {
    background: var(--success-bg);
    border-color: rgba(34, 197, 94, 0.2);
}

.attendance-cell.absent {
    background: var(--danger-bg);
    border-color: rgba(239, 68, 68, 0.2);
}

.attendance-cell.late {
    background: var(--warning-bg);
    border-color: rgba(245, 158, 11, 0.2);
}

.attendance-cell .cell-roll {
    font-weight: 500;
    font-size: 0.82rem;
    color: var(--text-primary);
}

.attendance-cell .cell-status {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
}

/* Class selector tabs */
.class-tabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.class-tab {
    padding: 7px 16px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--border-glass);
    background: var(--bg-surface);
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.class-tab:hover {
    background: var(--bg-input);
    border-color: var(--text-muted);
}

.class-tab.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 2px 6px rgba(67, 83, 255, 0.2);
}

/* ============================================================
   Report Card
   ============================================================ */
.report-card {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    padding: 32px;
    border: 1px solid var(--border-light);
    max-width: 800px;
    margin: 0 auto;
}

.report-header {
    text-align: center;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-light);
}

.report-school {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.report-subtitle {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.report-student-info {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
    margin-bottom: 24px;
}

.report-student-info dt { color: var(--text-muted); font-size: 0.78rem; }
.report-student-info dd { font-weight: 500; color: var(--text-primary); font-size: 0.88rem; margin-bottom: 8px; }

.grade-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.grade-table th {
    background: var(--bg-input);
    padding: 10px 14px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.grade-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.85rem;
}

.grade-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 24px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 700;
}

.grade-badge.grade-a-plus { background: var(--success-bg); color: var(--success); }
.grade-badge.grade-a { background: #DCFCE7; color: #16A34A; }
.grade-badge.grade-b-plus { background: var(--info-bg); color: var(--info); }
.grade-badge.grade-b { background: var(--warning-bg); color: var(--warning); }

/* ============================================================
   LMS Page
   ============================================================ */
.live-class-card {
    display: flex;
    gap: 14px;
    padding: 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.live-class-card:hover { box-shadow: var(--shadow-sm); border-color: var(--border-glass); }

.live-thumbnail {
    width: 80px;
    height: 60px;
    border-radius: var(--radius-sm);
    background: var(--primary-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.live-thumbnail svg { width: 24px; height: 24px; color: var(--primary); }

.live-class-info { flex: 1; min-width: 0; }

.live-class-title {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text-primary);
    margin-bottom: 3px;
}

.live-class-teacher {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.assignment-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.assignment-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.assignment-item,
.assignment-info {
    min-width: 0;
}

.assignment-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: var(--primary-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.assignment-icon svg { width: 16px; height: 16px; color: var(--primary); }

.assignment-info { flex: 1; }

.assignment-title {
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.assignment-due {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--border-light);
    border-radius: 6px;
    overflow: hidden;
    margin-top: 8px;
}

.progress-fill {
    height: 100%;
    border-radius: 6px;
    background: var(--primary);
    transition: width 0.8s ease;
}

/* ============================================================
   Photo Upload
   ============================================================ */
.photo-upload {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 2px dashed var(--border-glass);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    color: var(--text-muted);
    background: var(--bg-input);
}

.photo-upload:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-bg);
}

.photo-upload svg { width: 24px; height: 24px; margin-bottom: 4px; }
.photo-upload span { font-size: 0.68rem; }

/* ============================================================
   Fee Module
   ============================================================ */
.fee-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.fee-summary-item {
    padding: 16px;
    border-radius: var(--radius-md);
    background: var(--bg-input);
    text-align: center;
}

.fee-amount {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.fee-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ============================================================
   Section Title
   ============================================================ */
.section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-light);
}

.section-title .title-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    flex-shrink: 0;
}

/* ============================================================
   Subscription Overlay
   ============================================================ */
.subscription-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.subscription-card {
    background: var(--bg-surface);
    border-radius: var(--radius-xl);
    padding: 40px;
    max-width: 420px;
    width: 100%;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.sub-icon { font-size: 3rem; margin-bottom: 12px; }
.sub-title { font-size: 1.3rem; font-weight: 700; color: var(--text-primary); margin-bottom: 8px; }
.sub-message { font-size: 0.88rem; color: var(--text-secondary); margin-bottom: 20px; line-height: 1.5; }
.sub-price { margin-bottom: 20px; }
.price-amount { font-size: 2rem; font-weight: 800; color: var(--primary); }
.price-period { font-size: 0.9rem; color: var(--text-muted); }
.sub-pay-btn { width: 100%; padding: 14px; font-size: 1rem; margin-bottom: 10px; }
.sub-logout-btn { width: 100%; padding: 12px; }
.sub-contact { font-size: 0.78rem; color: var(--text-muted); margin-top: 16px; }

/* ============================================================
   Modal overlay base
   ============================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    backdrop-filter: blur(3px);
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-card, .modal-content {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    padding: 28px;
    max-width: 600px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.25s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border-light);
}

.modal-header h3, .modal-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--bg-input);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.modal-close:hover { background: var(--danger-bg); color: var(--danger); }

/* ============================================================
   Toast
   ============================================================ */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    border: 1px solid var(--border-glass);
    box-shadow: var(--shadow-md);
    font-size: 0.85rem;
    font-weight: 650;
    color: var(--text-primary);
    animation: toastIn 0.3s ease;
    max-width: 360px;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.warning { border-left: 3px solid var(--warning); }
.toast.info { border-left: 3px solid var(--info); }

.toast-icon {
    width: 28px;
    height: 28px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.toast.success .toast-icon { color: var(--success); background: var(--success-bg); }
.toast.error .toast-icon { color: var(--danger); background: var(--danger-bg); }
.toast.warning .toast-icon { color: var(--warning); background: var(--warning-bg); }
.toast.info .toast-icon { color: var(--info); background: var(--info-bg); }

.toast-message {
    min-width: 0;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ============================================================
   Tab bar (shared component from crm-pages.js)
   ============================================================ */
.tab-bar {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 20px;
    overflow-x: auto;
    flex-wrap: nowrap;
}

.tab-btn {
    padding: 10px 18px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    transition: all var(--transition-fast);
    margin-bottom: -1px;
}

.tab-btn:hover { color: var(--text-primary); }

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

/* ============================================================
   Trial badge
   ============================================================ */
#trial-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 20px;
    background: var(--warning-bg);
    color: var(--warning);
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

/* ============================================================
   Kanban board (CRM)
   ============================================================ */
.kanban-board {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 12px;
}

.kanban-column {
    min-width: 260px;
    flex: 1;
    background: var(--bg-input);
    border-radius: var(--radius-md);
    padding: 12px;
}

.kanban-column-header {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding: 8px 8px 12px;
}

.kanban-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.kanban-card:hover { box-shadow: var(--shadow-sm); border-color: var(--border-glass); }

/* ============================================================
   Empty state
   ============================================================ */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}

.empty-state svg {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
    opacity: 0.4;
}

.empty-state h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.empty-state p {
    font-size: 0.85rem;
    max-width: 340px;
    margin: 0 auto;
}

/* ============================================================
   Loading skeleton
   ============================================================ */
.skeleton {
    background: linear-gradient(90deg, var(--bg-input) 25%, var(--border-light) 50%, var(--bg-input) 75%);
    background-size: 200% 100%;
    animation: skeleton 1.5s ease infinite;
    border-radius: var(--radius-sm);
}

@keyframes skeleton {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1200px) {
    :root {
        --sidebar-width: 240px;
        --page-padding: 20px;
    }
    .dashboard-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}

@media (max-width: 1180px) {
    html {
        font-size: 15px;
    }

    body {
        background:
            radial-gradient(circle at top left, rgba(67, 83, 255, 0.10), transparent 34vw),
            linear-gradient(180deg, #F7F8FC 0%, #EEF2F8 100%);
    }

    body::before {
        content: '';
        position: fixed;
        inset: 0;
        pointer-events: none;
        z-index: -1;
        background-image:
            linear-gradient(rgba(15, 23, 42, 0.025) 1px, transparent 1px),
            linear-gradient(90deg, rgba(15, 23, 42, 0.025) 1px, transparent 1px);
        background-size: 22px 22px;
        mask-image: linear-gradient(to bottom, rgba(0,0,0,0.5), transparent 56%);
    }

    .sidebar {
        width: min(88vw, 320px);
        height: 100dvh;
        transform: translateX(-100%);
        box-shadow: none;
        padding-bottom: var(--safe-bottom);
        border-radius: 0 26px 26px 0;
        border-right: 1px solid rgba(148, 163, 184, 0.32);
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 18px 0 50px rgba(15, 23, 42, 0.16);
    }

    .sidebar-logo {
        padding: calc(18px + var(--safe-top)) 18px 16px;
        border-bottom: 0;
    }

    .sidebar-nav {
        padding: 10px 10px 12px;
    }

    .nav-item,
    .nav-group-header,
    .nav-sub-item {
        min-height: 46px;
        border-radius: 15px;
    }

    .sidebar-overlay {
        background: rgba(15, 23, 42, 0.42);
        backdrop-filter: blur(6px);
    }

    .main-content {
        margin-left: 0;
        min-width: 0;
        min-height: 100dvh;
    }

    .hamburger {
        display: flex;
        min-width: 42px;
        min-height: 42px;
        align-items: center;
        justify-content: center;
        background: rgba(255, 255, 255, 0.82);
        border: 1px solid rgba(226, 232, 240, 0.9);
        box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
    }

    .hamburger[aria-expanded="true"] span:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }

    .hamburger[aria-expanded="true"] span:nth-child(2) {
        opacity: 0;
    }

    .hamburger[aria-expanded="true"] span:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }

    .topnav {
        min-height: calc(68px + var(--safe-top));
        height: auto;
        padding: calc(8px + var(--safe-top)) calc(14px + var(--safe-right)) 10px calc(14px + var(--safe-left));
        gap: 12px;
        background: rgba(247, 248, 252, 0.82);
        backdrop-filter: blur(18px) saturate(1.18);
        border-bottom: 0;
    }

    .topnav-left {
        min-width: 0;
        flex: 1 1 auto;
    }

    .topnav-right {
        gap: 6px;
    }

    .page-container {
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
        padding: 12px calc(14px + var(--safe-right)) calc(112px + var(--safe-bottom)) calc(14px + var(--safe-left));
    }

    .page-title {
        font-size: 1.3rem;
        line-height: 1.08;
        letter-spacing: -0.045em;
        max-width: 54vw;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .page-subtitle {
        display: none;
    }

    body .page-container .breadcrumb {
        flex-wrap: wrap;
        gap: 4px 8px;
        margin-bottom: 14px;
    }

    body .page-container .breadcrumb a {
        display: inline-flex;
        align-items: center;
        min-height: 44px;
        padding: 0 2px;
    }

    .topnav-icon.mobile-search-toggle {
        display: flex;
    }

    .topnav-icon {
        border-radius: 15px;
        background: rgba(255, 255, 255, 0.82);
        border: 1px solid rgba(226, 232, 240, 0.9);
        box-shadow: 0 8px 20px rgba(15, 23, 42, 0.045);
    }

    #btn-settings {
        display: none;
    }

    .mobile-tabbar {
        position: fixed;
        left: calc(10px + var(--safe-left));
        right: calc(10px + var(--safe-right));
        bottom: calc(8px + var(--safe-bottom));
        z-index: 1200;
        display: none;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 4px;
        min-height: 70px;
        padding: 7px;
        border: 1px solid rgba(226, 232, 240, 0.82);
        border-radius: 24px;
        background: rgba(255, 255, 255, 0.92);
        box-shadow: 0 18px 50px rgba(15, 23, 42, 0.18), inset 0 1px 0 rgba(255,255,255,0.88);
        backdrop-filter: blur(20px) saturate(1.35);
    }

    body.app-shell-ready .mobile-tabbar {
        display: grid;
    }

    body:has(.main-content[style*="display:none"]) .mobile-tabbar,
    body:has(.main-content[style*="display: none"]) .mobile-tabbar {
        display: none;
    }

    .mobile-tabbar-item {
        appearance: none;
        border: 0;
        background: transparent;
        color: #64748B;
        min-width: 0;
        min-height: 56px;
        border-radius: 18px;
        display: inline-flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        font-size: 0.68rem;
        font-weight: 750;
        letter-spacing: -0.01em;
        transition: transform var(--transition-fast), background var(--transition-fast), color var(--transition-fast);
    }

    /* updateMobileTabbar() (app.js) sets the native `hidden` attribute to hide
       tabs a role can't access (e.g. "Students" for a student/parent login) —
       without this, the class's own `display: inline-flex` above wins over the
       browser's default `[hidden] { display: none }` UA rule and the button
       stays visible (tappable, but bounces to Dashboard via the page guard). */
    .mobile-tabbar-item[hidden] {
        display: none;
    }

    .mobile-tabbar-item svg {
        width: 21px;
        height: 21px;
        stroke-width: 2.25;
    }

    .mobile-tabbar-item:active {
        transform: scale(0.95);
    }

    .mobile-tabbar-item.active {
        color: var(--primary);
        background: var(--primary-bg);
    }

    .mobile-tabbar-fab {
        color: #FFFFFF;
        background: linear-gradient(135deg, #3344F4 0%, #6572FF 100%);
        box-shadow: 0 10px 24px rgba(67, 83, 255, 0.24);
    }

    .mobile-tabbar-fab.active {
        color: #FFFFFF;
        background: linear-gradient(135deg, #2433D9 0%, #5867FF 100%);
    }

    .search-box {
        min-width: 0;
        display: none;
    }

    .topnav.search-open .search-box {
        position: fixed;
        top: calc(62px + var(--safe-top));
        left: calc(12px + var(--safe-left));
        right: calc(12px + var(--safe-right));
        z-index: 180;
        display: flex;
        width: auto;
        min-width: 0;
        min-height: 48px;
        padding: 12px 14px;
        border-radius: 16px;
        box-shadow: var(--shadow-lg);
    }

    .topnav.search-open .search-box input {
        display: block;
        width: 100%;
        min-width: 0;
        min-height: 44px;
        font-size: 16px;
    }

    .topnav.search-open .search-results-dropdown {
        max-height: min(55dvh, 360px);
    }

    .session-badge { display: none !important; }
    .dashboard-grid { grid-template-columns: 1fr 1fr; gap: 12px; }

    .dashboard-grid-2, .dashboard-grid-3 {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .glass-card {
        border-radius: 22px;
        padding: 18px;
        background: rgba(255, 255, 255, 0.94);
        border: 1px solid rgba(226, 232, 240, 0.88);
        box-shadow: 0 12px 32px rgba(15, 23, 42, 0.065);
        backdrop-filter: blur(12px);
    }

    .card-glow {
        display: none;
    }

    .section-title {
        font-size: 0.94rem !important;
        letter-spacing: -0.02em;
        text-transform: none !important;
    }

    .stat-value { font-size: 1.4rem; }

    .page-header {
        align-items: flex-start;
        gap: 10px;
    }

    .page-header > * {
        max-width: 100%;
    }

    .form-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .page-container .form-row {
        width: 100%;
        max-width: 100%;
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    .form-group {
        margin-bottom: 13px;
    }

    .form-label {
        margin-bottom: 7px;
        font-size: 0.78rem;
        letter-spacing: 0.01em;
        color: #475569;
    }

    .form-input,
    .form-select,
    .page-container input,
    .page-container select,
    .page-container textarea {
        min-height: 48px;
        font-size: 16px !important;
        border-radius: 16px;
        background: #F8FAFC;
        border-color: #E2E8F0;
        box-shadow: inset 0 1px 0 rgba(255,255,255,0.8);
    }

    .page-container input[type="checkbox"],
    .page-container input[type="radio"] {
        appearance: none;
        -webkit-appearance: none;
        display: inline-grid;
        place-content: center;
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
        min-height: 44px !important;
        margin: 0 !important;
        flex: 0 0 auto;
        border: 1.5px solid #CBD5E1;
        background: #FFFFFF;
        box-shadow: inset 0 1px 0 rgba(255,255,255,0.9), 0 4px 12px rgba(15, 23, 42, 0.06);
        cursor: pointer;
        transition: background var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
    }

    .page-container input[type="checkbox"] {
        border-radius: 14px;
    }

    .page-container input[type="radio"] {
        border-radius: 999px;
    }

    .page-container input[type="checkbox"]::before,
    .page-container input[type="radio"]::before {
        content: '';
        transform: scale(0);
        transition: transform var(--transition-fast);
    }

    .page-container input[type="checkbox"]::before {
        width: 18px;
        height: 18px;
        background: #FFFFFF;
        clip-path: polygon(14% 48%, 0 64%, 38% 100%, 100% 18%, 82% 4%, 35% 66%);
    }

    .page-container input[type="radio"]::before {
        width: 14px;
        height: 14px;
        border-radius: 999px;
        background: #FFFFFF;
    }

    .page-container input[type="checkbox"]:checked,
    .page-container input[type="radio"]:checked {
        border-color: var(--primary);
        background: var(--primary);
        box-shadow: 0 8px 18px rgba(67, 83, 255, 0.20);
    }

    .page-container input[type="checkbox"]:checked::before,
    .page-container input[type="radio"]:checked::before {
        transform: scale(1);
    }

    .page-container input[type="checkbox"]:active,
    .page-container input[type="radio"]:active {
        transform: scale(0.96);
    }

    .btn,
    .topnav-icon,
    .modal-close {
        min-height: 46px;
    }

    .btn {
        min-width: 44px;
        padding: 11px 15px;
        border-radius: 16px;
        font-size: 0.9rem !important;
        white-space: normal;
        text-align: center;
        box-shadow: none;
    }

    .btn:active,
    .topnav-icon:active {
        transform: scale(0.97);
    }

    .page-container .btn-sm,
    .page-container .btn-approve,
    .page-container .btn-reject,
    .page-container .btn-delete,
    .page-container .nb-card-menu {
        min-width: 44px;
        min-height: 44px;
        padding: 8px 10px;
        font-size: 0.86rem !important;
    }

    .page-container .tab-bar,
    .page-container .module-tabs {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        max-width: 100%;
        max-height: min(42dvh, 340px);
        padding: 8px;
        border: 1px solid rgba(226, 232, 240, 0.9);
        border-radius: 20px;
        background: rgba(255, 255, 255, 0.92);
        overflow-x: hidden;
        overflow-y: auto;
        flex-wrap: wrap !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .page-container .tab-bar::-webkit-scrollbar,
    .page-container .module-tabs::-webkit-scrollbar {
        display: none;
    }

    .page-container .tab-btn,
    .page-container .module-tab {
        width: 100%;
        min-width: 0;
        min-height: 46px;
        padding: 10px 14px;
        border-radius: 999px;
        border: 1px solid #E2E8F0;
        background: #FFFFFF;
        font-size: 0.9rem !important;
        justify-content: center;
        text-align: center;
        white-space: normal;
    }

    .page-container .tab-bar > *:last-child:nth-child(odd),
    .page-container .module-tabs > *:last-child:nth-child(odd) {
        grid-column: 1 / -1;
    }

    .page-container .tab-btn.active,
    .page-container .module-tab.active {
        color: #FFFFFF;
        background: var(--primary);
        border-color: var(--primary);
        box-shadow: 0 8px 18px rgba(67, 83, 255, 0.18);
    }

    .page-container [style*="width:"] {
        max-width: 100% !important;
    }

    .page-container [style*="min-width"] {
        min-width: 0 !important;
    }

    .page-container .glass-card,
    .page-container .stagger-in {
        max-width: 100%;
        min-width: 0;
    }

    .page-container > .glass-card:only-child,
    .page-container > .glass-card:first-child:last-child {
        margin-bottom: 8px;
    }

    .page-container .glass-card > [style*="justify-content:space-between"],
    .page-container .glass-card > [style*="justify-content: space-between"] {
        gap: 12px !important;
    }

    .page-container .glass-card > [style*="justify-content:space-between"] > .section-title,
    .page-container .glass-card > [style*="justify-content: space-between"] > .section-title {
        flex: 1 1 100%;
    }

    .page-container [style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }

    .page-container [style*="display:flex"],
    .page-container [style*="display: flex"] {
        flex-wrap: wrap;
    }

    .page-container table {
        display: block;
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .mobile-table-frame {
        width: 100%;
        max-width: 100%;
        overflow: visible !important;
    }

    .mobile-enhanced-page table.mobile-card-table:not(.timetable-grid):not(.grade-table) {
        display: block;
        min-width: 0 !important;
        width: 100% !important;
        border-collapse: separate;
        border-spacing: 0;
        overflow: visible;
        background: transparent;
    }

    .mobile-enhanced-page table.mobile-card-table:not(.timetable-grid):not(.grade-table) thead {
        display: none;
    }

    .mobile-enhanced-page table.mobile-card-table:not(.timetable-grid):not(.grade-table) tbody {
        display: grid;
        gap: 12px;
        width: 100%;
    }

    .mobile-enhanced-page table.mobile-card-table:not(.timetable-grid):not(.grade-table) tr {
        position: relative;
        display: block;
        width: 100%;
        padding: 10px 12px;
        border: 1px solid rgba(226, 232, 240, 0.92);
        border-radius: 20px;
        background: rgba(255, 255, 255, 0.96);
        box-shadow: 0 10px 26px rgba(15, 23, 42, 0.06);
        overflow: hidden;
    }

    .mobile-enhanced-page table.mobile-card-table:not(.timetable-grid):not(.grade-table) tr::before {
        content: '#' attr(data-mobile-row-number);
        display: inline-flex;
        align-items: center;
        min-height: 24px;
        margin-bottom: 5px;
        padding: 3px 9px;
        border-radius: 999px;
        background: var(--primary-bg);
        color: var(--primary);
        font-size: 0.68rem;
        font-weight: 800;
        letter-spacing: 0.02em;
    }

    .mobile-enhanced-page table.mobile-card-table:not(.timetable-grid):not(.grade-table) td {
        display: grid;
        grid-template-columns: minmax(96px, 38%) minmax(0, 1fr);
        gap: 10px;
        align-items: start;
        width: 100% !important;
        min-width: 0 !important;
        padding: 10px 0 !important;
        border: 0;
        border-bottom: 1px solid rgba(226, 232, 240, 0.72);
        background: transparent !important;
        color: #0F172A;
        font-size: 0.86rem;
        line-height: 1.45;
        text-align: right;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .mobile-enhanced-page table.mobile-card-table:not(.timetable-grid):not(.grade-table) td::before {
        content: attr(data-label);
        color: #64748B;
        font-size: 0.72rem;
        font-weight: 800;
        line-height: 1.35;
        text-align: left;
        text-transform: none;
        letter-spacing: 0.01em;
    }

    .mobile-enhanced-page table.mobile-card-table:not(.timetable-grid):not(.grade-table) td:last-child {
        border-bottom: 0;
    }

    .mobile-enhanced-page table.mobile-card-table:not(.timetable-grid):not(.grade-table) td.mobile-card-primary-cell {
        grid-template-columns: 1fr;
        text-align: left;
        padding-top: 4px !important;
    }

    .mobile-enhanced-page table.mobile-card-table:not(.timetable-grid):not(.grade-table) td.mobile-card-primary-cell::before {
        display: none;
    }

    .mobile-enhanced-page table.mobile-card-table:not(.timetable-grid):not(.grade-table) td.mobile-card-primary-cell {
        font-size: 0.98rem;
        font-weight: 800;
        letter-spacing: -0.02em;
    }

    .mobile-enhanced-page table.mobile-card-table:not(.timetable-grid):not(.grade-table) td.mobile-action-cell {
        display: flex;
        flex-wrap: wrap;
        justify-content: flex-end;
        gap: 8px;
        text-align: right;
    }

    .mobile-enhanced-page table.mobile-card-table:not(.timetable-grid):not(.grade-table) td.mobile-action-cell::before {
        flex: 1 1 100%;
        text-align: left;
    }

    .mobile-enhanced-page table.mobile-card-table:not(.timetable-grid):not(.grade-table) td:has(input[type="checkbox"]),
    .mobile-enhanced-page table.mobile-card-table:not(.timetable-grid):not(.grade-table) td:has(input[type="radio"]) {
        align-items: center;
    }

    .mobile-enhanced-page table.mobile-card-table:not(.timetable-grid):not(.grade-table) td:has(input[type="checkbox"])::before,
    .mobile-enhanced-page table.mobile-card-table:not(.timetable-grid):not(.grade-table) td:has(input[type="radio"])::before {
        align-self: center;
    }

    .mobile-enhanced-page table.mobile-card-table:not(.timetable-grid):not(.grade-table) td:empty::after {
        content: '—';
        color: #94A3B8;
    }

    .data-table,
    .timetable-grid,
    .grade-table {
        min-width: 680px;
        font-size: 0.8rem;
    }

    .page-container #tt-table.timetable-grid {
        min-width: 0 !important;
        width: 100% !important;
        max-width: 100%;
        overflow: visible;
        border-spacing: 0;
        background: transparent;
    }

    .page-container #tt-table.timetable-grid[style*="display: table"] {
        display: block !important;
    }

    .page-container #tt-table.timetable-grid thead {
        display: none;
    }

    .page-container #tt-table.timetable-grid tbody {
        display: grid;
        gap: 12px;
        width: 100%;
    }

    .page-container #tt-table.timetable-grid tr {
        display: block;
        width: 100%;
        padding: 12px;
        border: 1px solid rgba(226, 232, 240, 0.92);
        border-radius: 20px;
        background: rgba(255, 255, 255, 0.96);
        box-shadow: 0 10px 26px rgba(15, 23, 42, 0.06);
        overflow: hidden;
    }

    .page-container #tt-table.timetable-grid td {
        display: grid;
        grid-template-columns: minmax(72px, 30%) minmax(0, 1fr);
        gap: 10px;
        align-items: start;
        width: 100% !important;
        min-width: 0 !important;
        padding: 10px 0 !important;
        border: 0;
        border-bottom: 1px solid rgba(226, 232, 240, 0.72);
        background: transparent !important;
        color: #0F172A;
        text-align: right;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .page-container #tt-table.timetable-grid td::before {
        color: #64748B;
        font-size: 0.72rem;
        font-weight: 800;
        line-height: 1.35;
        text-align: left;
    }

    .page-container #tt-table.timetable-grid td:nth-child(1)::before { content: 'Period'; }
    .page-container #tt-table.timetable-grid td:nth-child(2)::before { content: 'Monday'; }
    .page-container #tt-table.timetable-grid td:nth-child(3)::before { content: 'Tuesday'; }
    .page-container #tt-table.timetable-grid td:nth-child(4)::before { content: 'Wednesday'; }
    .page-container #tt-table.timetable-grid td:nth-child(5)::before { content: 'Thursday'; }
    .page-container #tt-table.timetable-grid td:nth-child(6)::before { content: 'Friday'; }

    .page-container #tt-table.timetable-grid td:first-child {
        grid-template-columns: 1fr;
        padding: 10px 12px !important;
        margin-bottom: 4px;
        border-bottom: 0;
        border-radius: 15px;
        background: var(--primary-bg) !important;
        text-align: left;
    }

    .page-container #tt-table.timetable-grid td:first-child::before {
        display: block;
        margin-bottom: 2px;
    }

    .page-container #tt-table.timetable-grid td:last-child {
        border-bottom: 0;
    }

    .page-container #tt-table.timetable-grid .tt-time {
        color: var(--primary);
        font-size: 0.9rem;
        font-weight: 850;
    }

    .page-container #tt-table.timetable-grid .tt-subject {
        font-size: 0.9rem;
        font-weight: 750;
    }

    .page-container #tt-table.timetable-grid .tt-cell-select {
        width: 100%;
        min-width: 0 !important;
        min-height: 44px;
        padding: 8px 10px !important;
        font-size: 16px !important;
    }

    .data-table thead th,
    .data-table tbody td {
        padding: 9px 10px;
    }

    .page-container table:not(.data-table):not(.timetable-grid):not(.grade-table) {
        min-width: 600px;
    }

    .tab-bar {
        margin-left: -14px;
        margin-right: -14px;
        padding: 0 14px;
        scrollbar-width: none;
    }

    .tab-bar::-webkit-scrollbar {
        display: none;
    }

    .page-container > div[style*="overflow-x:auto"],
    .page-container > div[style*="overflow-x: auto"] {
        max-width: 100%;
        -webkit-overflow-scrolling: touch;
    }

    .page-container .repeat-entry,
    .page-container [class*="entry-row"],
    .page-container [class*="form-card"] {
        border-radius: 18px !important;
        background: #FFFFFF;
        border-color: #E2E8F0 !important;
    }

    .page-container label[style*="display:flex"],
    .page-container label[style*="display: flex"] {
        min-height: 44px;
        align-items: center !important;
    }

    .mobile-enhanced-page .mobile-action-row {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 10px !important;
        padding: 8px;
        border-radius: 22px;
        background:
            linear-gradient(180deg, rgba(255,255,255,0.96), rgba(248,250,252,0.93));
        border: 1px solid rgba(203, 213, 225, 0.82);
        box-shadow: inset 0 1px 0 rgba(255,255,255,0.86), 0 10px 26px rgba(15, 23, 42, 0.055);
        overflow: visible !important;
        contain: inline-size;
    }

    .mobile-enhanced-page .mobile-action-row::-webkit-scrollbar {
        display: none;
    }

    .mobile-enhanced-page .mobile-action-row .mobile-action-row {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        flex: 1 1 100% !important;
        gap: 8px !important;
        padding: 0 !important;
        border: 0;
        background: transparent;
        box-shadow: none;
        overflow: visible !important;
        contain: inline-size;
    }

    .mobile-enhanced-page .mobile-action-row .mobile-action-row > .btn,
    .mobile-enhanced-page .mobile-action-row .mobile-action-row > button,
    .mobile-enhanced-page .mobile-action-row .mobile-action-row > a.btn,
    .mobile-enhanced-page .mobile-action-row .mobile-action-row > label {
        width: 100% !important;
        min-width: 0 !important;
        padding-left: 8px !important;
        padding-right: 8px !important;
    }

    .mobile-enhanced-page .mobile-action-row > .btn,
    .mobile-enhanced-page .mobile-action-row > button,
    .mobile-enhanced-page .mobile-action-row > a.btn,
    .mobile-enhanced-page .mobile-action-row > label {
        flex: 1 1 auto;
        min-width: 48px;
        min-height: 48px;
        border-radius: 16px;
        white-space: normal;
        touch-action: manipulation;
    }

    .mobile-enhanced-page .mobile-action-row.mobile-has-primary-action {
        align-items: center !important;
    }

    .mobile-enhanced-page .mobile-primary-cta {
        border-radius: 16px !important;
        font-weight: 800 !important;
        letter-spacing: -0.01em;
        box-shadow: 0 10px 24px rgba(67, 83, 255, 0.18);
    }

    .mobile-enhanced-page .mobile-icon-action {
        flex: 0 0 48px !important;
        min-width: 48px !important;
        min-height: 48px !important;
        border-radius: 16px !important;
        box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
        transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
    }

    .mobile-enhanced-page .mobile-icon-action:active {
        transform: scale(0.97);
    }

    .mobile-enhanced-page .mobile-icon-action.mobile-labeled-icon-action {
        flex: 0 0 auto !important;
        min-width: 74px !important;
        min-height: 60px !important;
        padding: 8px 9px 7px !important;
        display: inline-flex !important;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        line-height: 1.12;
    }

    .mobile-enhanced-page .mobile-icon-action.mobile-labeled-icon-action::after {
        content: attr(data-mobile-label);
        display: block;
        max-width: 86px;
        overflow: hidden;
        text-overflow: initial;
        white-space: normal;
        overflow-wrap: anywhere;
        text-align: center;
        color: #475569;
        font-size: 0.68rem;
        font-weight: 850;
        letter-spacing: -0.01em;
    }

    .mobile-enhanced-page .mobile-icon-action.mobile-danger-action {
        color: var(--danger) !important;
        background: linear-gradient(180deg, #FFFFFF, rgba(254, 242, 242, 0.96)) !important;
        border-color: rgba(239, 68, 68, 0.24) !important;
    }

    .mobile-enhanced-page .mobile-icon-action.mobile-danger-action::after {
        color: #DC2626;
    }

    .mobile-enhanced-page .mobile-form-stack {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    .mobile-enhanced-page .mobile-field-card {
        margin-bottom: 12px;
    }

    .mobile-enhanced-page .mobile-required-field .form-label::after,
    .mobile-enhanced-page .mobile-required-field > label::after {
        content: ' required';
        margin-left: 6px;
        color: var(--primary);
        font-size: 0.68rem;
        font-weight: 800;
    }

    .mobile-enhanced-page .mobile-file-input {
        padding: 10px !important;
        min-height: 54px !important;
        background:
            linear-gradient(180deg, rgba(255,255,255,0.96), rgba(248,250,252,0.98)) !important;
        border-style: dashed !important;
    }

    .mobile-enhanced-page .mobile-app-card {
        isolation: isolate;
    }

    .mobile-enhanced-page .mobile-fluid-box {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
    }

    .mobile-enhanced-page .mobile-grid-stack {
        max-width: 100%;
        min-width: 0;
    }

    .mobile-enhanced-page .mobile-empty-copy {
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 96px;
        padding: 18px;
        border: 1px dashed #CBD5E1;
        border-radius: 18px;
        background: rgba(248, 250, 252, 0.86);
        color: #64748B !important;
        text-align: center;
        font-weight: 700;
    }

    .mobile-enhanced-page .status-badge,
    .mobile-enhanced-page [class*="badge"] {
        min-height: 28px;
        display: inline-flex;
        align-items: center;
        border-radius: 999px;
        font-weight: 800;
    }

    .slist-actions {
        width: 100%;
    }

    .dashboard-grid.slist-stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 10px !important;
    }

    .slist-stat-pill {
        min-height: 82px;
        padding: 12px 10px !important;
        display: flex;
        align-items: center;
        justify-content: center;
        line-height: 1.35;
        overflow-wrap: anywhere;
    }

    .slist-card-scroll {
        overflow-x: visible !important;
    }

    .slist-student-card {
        overflow: hidden;
    }

    .slist-student-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    .slist-student-section {
        min-width: 0;
        padding-bottom: 12px;
        border-bottom: 1px solid var(--border-light);
        overflow-wrap: anywhere;
    }

    .slist-student-section:last-child {
        padding-bottom: 0;
        border-bottom: none;
    }

    .slist-card-head {
        align-items: flex-start !important;
    }

    .slist-student-actions .btn-sm {
        min-height: 44px;
    }

    .fees-student-details-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }

    .fees-prev-paid-panel {
        min-width: 0;
        width: 100%;
    }

    .fees-prev-paid-scroll,
    #fc-grid-wrap {
        max-width: 100%;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    .fees-prev-paid-scroll .data-table {
        min-width: 520px;
    }

    .kanban-board { flex-direction: column; }
    .kanban-column { min-width: 100%; }

    .modal-overlay {
        align-items: flex-end;
        padding: 0;
        background: rgba(15, 23, 42, 0.45);
        backdrop-filter: blur(8px);
    }

    .modal-card,
    .modal-content {
        width: 100%;
        max-width: 100%;
        max-height: min(94dvh, 780px);
        border-radius: 28px 28px 0 0;
        padding: 18px;
        padding-bottom: calc(22px + var(--safe-bottom));
        box-shadow: 0 -20px 60px rgba(15, 23, 42, 0.22);
        animation: mobileSheetIn 0.28s cubic-bezier(0.32, 0.72, 0, 1);
    }

    .modal-card::before,
    .modal-content::before {
        content: '';
        display: block;
        width: 42px;
        height: 5px;
        margin: -4px auto 14px;
        border-radius: 999px;
        background: #CBD5E1;
    }

    .modal-header {
        position: sticky;
        top: -18px;
        z-index: 2;
        margin: -2px -18px 16px;
        padding: 2px 18px 14px;
        background: rgba(255,255,255,0.96);
        backdrop-filter: blur(12px);
    }

    @keyframes mobileSheetIn {
        from { opacity: 0; transform: translateY(24px); }
        to { opacity: 1; transform: translateY(0); }
    }

    .admission-wizard-card {
        padding: 0 !important;
        background: transparent;
        border: 0;
        box-shadow: none;
        backdrop-filter: none;
    }

    .admission-wizard-header {
        position: sticky;
        top: calc(68px + var(--safe-top));
        z-index: 30;
        margin: -2px 0 12px !important;
        padding: 14px 14px 12px;
        border-radius: 22px;
        background: rgba(255,255,255,0.94);
        border: 1px solid rgba(226, 232, 240, 0.9);
        box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
        backdrop-filter: blur(16px);
    }

    .admission-wizard-header .section-title {
        font-size: 1.05rem !important;
    }

    .admission-wizard-meta {
        display: block;
        margin-top: 4px;
        font-size: 0.75rem !important;
    }

    .admission-wizard-card #aw-tabs {
        position: sticky;
        top: calc(143px + var(--safe-top));
        z-index: 25;
        margin: 0 -14px 12px;
        padding: 2px 14px 10px;
        background: linear-gradient(180deg, rgba(247,248,252,0.98), rgba(247,248,252,0.86));
        backdrop-filter: blur(14px);
    }

    .admission-wizard-form {
        margin-top: 0 !important;
        padding-bottom: 88px;
    }

    .aw-tab-panel {
        padding: 16px;
        border: 1px solid rgba(226, 232, 240, 0.9);
        border-radius: 24px;
        background: rgba(255,255,255,0.96);
        box-shadow: 0 10px 28px rgba(15, 23, 42, 0.055);
    }

    .aw-tab-panel .section-title {
        margin-top: 8px;
        margin-bottom: 14px;
        padding-left: 10px;
        border-left: 4px solid var(--primary);
    }

    .admission-wizard-actions {
        position: fixed !important;
        left: calc(10px + var(--safe-left));
        right: calc(10px + var(--safe-right));
        bottom: calc(86px + var(--safe-bottom));
        z-index: 1100;
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 8px !important;
        margin: 0 !important;
        padding: 10px !important;
        border: 1px solid rgba(226, 232, 240, 0.92) !important;
        border-radius: 22px;
        background: rgba(255,255,255,0.95);
        box-shadow: 0 16px 42px rgba(15, 23, 42, 0.16);
        backdrop-filter: blur(18px);
    }

    .admission-wizard-actions .btn {
        width: 100%;
        min-height: 48px;
    }

    .admission-wizard-actions #btn-aw-reset {
        grid-column: 1 / -1;
        min-height: 42px;
    }

    .notification-dropdown {
        position: fixed;
        top: calc(62px + var(--safe-top));
        left: calc(12px + var(--safe-left));
        right: calc(12px + var(--safe-right));
        width: auto;
        max-height: min(70dvh, 440px);
    }

    .notif-mark-read {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        padding: 0 8px;
        border-radius: 12px;
    }

    .toast-container {
        top: auto;
        right: calc(12px + var(--safe-right));
        bottom: calc(164px + var(--safe-bottom));
        left: calc(12px + var(--safe-left));
    }

    .toast {
        max-width: none;
        width: 100%;
    }
}

@media (max-width: 480px) {
    :root { --page-padding: 14px; --card-padding: 16px; --card-radius: 12px; }
    .dashboard-grid { grid-template-columns: 1fr; }
    .dashboard-grid.slist-stats-grid { grid-template-columns: 1fr 1fr !important; }
    .page-title { font-size: 1.05rem; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .page-header .btn,
    .page-header button,
    .page-header a.btn {
        width: 100%;
    }
    .slist-actions > .btn,
    .slist-actions > button {
        flex: 1 1 calc(50% - 8px);
    }
    .slist-actions > label,
    .slist-actions > #btn-slist-delete-selected {
        flex-basis: 100%;
    }
    .topnav-right { gap: 4px; }
    .topnav-icon { width: 40px; height: 40px; }
    .logo-text { font-size: 1.12rem; }
    .attendance-grid { grid-template-columns: 1fr; }
    .stepper {
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 8px;
    }
    .stepper-line {
        width: 32px;
        min-width: 32px;
    }
}

@media (max-width: 380px) {
    .topnav {
        gap: 6px;
    }

    .page-title {
        font-size: 0.98rem;
    }

    .topnav-icon,
    .hamburger {
        width: 38px;
        min-width: 38px;
        height: 38px;
        min-height: 38px;
    }

    .page-container {
        padding-left: calc(10px + var(--safe-left));
        padding-right: calc(10px + var(--safe-right));
    }

    .glass-card {
        padding: 14px;
    }

    .dashboard-grid.slist-stats-grid {
        grid-template-columns: 1fr 1fr !important;
    }

    .slist-stat-pill {
        min-height: 78px;
        font-size: 0.9rem;
    }
}

/* ============================================================
   Notice Board — visual redesign only (scoped to .nb- prefix so
   nothing outside the Notice Board page is affected)
   ============================================================ */
.nb-hero {
    position: relative;
    overflow: hidden;
    border-radius: 20px;
    padding: 36px 40px;
    margin-bottom: 24px;
    min-height: 220px;
    display: flex;
    align-items: center;
    background: linear-gradient(110deg, #C9BBFF 0%, #A9B8FF 45%, #7DA1FF 100%);
}

.nb-hero-shape {
    position: absolute;
    border-radius: 50%;
    background: rgba(255,255,255,0.16);
    pointer-events: none;
}
.nb-hero-shape.nb-shape-1 { width: 260px; height: 260px; top: -90px; left: 220px; }
.nb-hero-shape.nb-shape-2 { width: 160px; height: 160px; bottom: -60px; left: 60px; background: rgba(255,255,255,0.1); }
.nb-hero-shape.nb-shape-3 { width: 90px; height: 90px; top: 20px; right: 90px; background: rgba(255,255,255,0.14); }

.nb-hero-content { position: relative; z-index: 1; max-width: 560px; }
.nb-hero-title {
    font-family: var(--font-heading);
    font-size: 1.7rem;
    font-weight: 800;
    color: #1B1F3B;
    margin: 0 0 10px;
    line-height: 1.2;
}
.nb-hero-desc {
    font-size: 0.95rem;
    color: #333A63;
    line-height: 1.5;
    margin: 0 0 20px;
    opacity: 0.85;
}
.nb-hero .btn-primary {
    background: #FFFFFF;
    color: var(--primary);
    box-shadow: 0 6px 18px rgba(27, 31, 59, 0.18);
}
.nb-hero .btn-primary:hover {
    background: #FFFFFF;
    color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 8px 22px rgba(27, 31, 59, 0.22);
}
.nb-hero .btn-primary svg { stroke: currentColor; }

.nb-hero-art {
    position: relative;
    z-index: 1;
    margin-left: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    opacity: 0.9;
}
.nb-hero-art svg { display: block; }

.nb-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.nb-card {
    position: relative;
    background: var(--bg-card);
    border: 1px solid #E8EBF2;
    border-left: 4px solid var(--nb-accent, var(--primary));
    border-radius: 16px;
    padding: 22px 22px 18px;
    box-shadow: 0 8px 24px rgba(16, 24, 40, 0.06);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
.nb-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(16, 24, 40, 0.09);
}

.nb-card-top {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 10px;
}
.nb-card-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--nb-accent-bg, var(--primary-bg));
    color: var(--nb-accent, var(--primary));
}
.nb-card-title-wrap { flex: 1; min-width: 0; }
.nb-card-title {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 4px;
    word-break: break-word;
}
.nb-badge {
    display: inline-block;
    flex-shrink: 0;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: var(--nb-accent, var(--primary));
    background: var(--nb-accent-bg, var(--primary-bg));
}
.nb-badge-normal { color: #079669; background: #E8F8F2; }
.nb-badge-high { color: #F97316; background: #FFF1E5; }
.nb-badge-urgent { color: #DC2626; background: #FEE2E2; }

.nb-card-normal { --nb-accent: #079669; --nb-accent-bg: #E8F8F2; }
.nb-card-high { --nb-accent: #F97316; --nb-accent-bg: #FFF1E5; }
.nb-card-urgent { --nb-accent: #DC2626; --nb-accent-bg: #FEE2E2; }

.nb-sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

.nb-card-desc {
    font-size: 0.87rem;
    color: var(--text-secondary);
    line-height: 1.55;
    margin: 0 0 16px;
}

.nb-card-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 0.78rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-light);
    padding-top: 12px;
}
.nb-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--primary-gradient);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.nb-meta-dot { color: var(--border-glass); }
.nb-meta-spacer { flex: 1; }
.nb-card-menu {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background var(--transition-fast), color var(--transition-fast);
}
.nb-card-menu:hover { background: var(--danger-bg); color: var(--danger); }
.nb-card-menu svg { width: 15px; height: 15px; }

.nb-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}

@media (max-width: 1180px) {
    .nb-grid { grid-template-columns: 1fr; }
    .nb-hero-art { display: none; }
}
@media (max-width: 768px) {
    .nb-hero { padding: 28px 24px; min-height: 0; }
    .nb-hero-title { font-size: 1.35rem; }
}
@media (max-width: 480px) {
    .nb-hero { border-radius: 16px; padding: 22px 18px; }
    .nb-card { padding: 18px; }
}
