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

:root {
    --brand: #0052FF;
    --brand-dark: #0A1E43;
    --brand-light: #EBF2FF;
    --accent-teal: #00F2FE;
    --ink: #0F172A;
    --muted-bg: #F8FAFC;
    --card-border: rgba(15, 23, 42, 0.04);
    --card-shadow: 0 10px 30px -5px rgba(0, 82, 255, 0.03), 0 5px 15px -8px rgba(0, 0, 0, 0.05);
    
    /* Stats Colors */
    --stat-students: #0052FF;
    --stat-students-bg: #EBF2FF;
    --stat-teachers: #0D9488;
    --stat-teachers-bg: #F0FDFA;
    --stat-attendance: #16A34A;
    --stat-attendance-bg: #F0FDF4;
    --stat-fees: #D97706;
    --stat-fees-bg: #FEF3C7;
    --stat-leaves: #DC2626;
    --stat-leaves-bg: #FEF2F2;

    /* Sidebar Redesign System - Light Theme (Premium ERP) */
    --sidebar-bg: #ffffff;
    --sidebar-border: rgba(0, 0, 0, 0.08);
    --sidebar-text-primary: #1e293b;
    --sidebar-text-secondary: #64748b;
    --sidebar-hover-bg: #f8fafc;
    --submenu-bg: #F5F8FF;
    --active-submenu-bg: #0052FF;
    --active-submenu-text: #ffffff;
    --scrollbar-thumb: rgba(0, 0, 0, 0.15);
    --close-btn-filter: none;
    --sidebar-profile-bg: #f8fafc;
    --sidebar-profile-border: rgba(0, 0, 0, 0.05);
}

[data-bs-theme="dark"] {
    --brand: #3B82F6;
    --brand-dark: #020617;
    --brand-light: rgba(59, 130, 246, 0.1);
    --ink: #F8FAFC;
    --muted-bg: #0B0F19;
    --card-border: rgba(255, 255, 255, 0.06);
    --card-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.3);
    
    --stat-students-bg: rgba(0, 82, 255, 0.15);
    --stat-teachers-bg: rgba(13, 148, 136, 0.15);
    --stat-attendance-bg: rgba(22, 163, 74, 0.15);
    --stat-fees-bg: rgba(217, 119, 6, 0.15);
    --stat-leaves-bg: rgba(220, 38, 38, 0.15);

    /* Sidebar Redesign System - Dark Theme */
    --sidebar-bg: #0b0f19;
    --sidebar-border: rgba(255, 255, 255, 0.06);
    --sidebar-text-primary: #f8fafc;
    --sidebar-text-secondary: #94a3b8;
    --sidebar-hover-bg: rgba(255, 255, 255, 0.05);
    --submenu-bg: #111a2e;
    --active-submenu-bg: #3B82F6;
    --active-submenu-text: #ffffff;
    --scrollbar-thumb: rgba(255, 255, 255, 0.15);
    --close-btn-filter: invert(1) grayscale(100%) brightness(200%);
    --sidebar-profile-bg: rgba(255, 255, 255, 0.02);
    --sidebar-profile-border: rgba(255, 255, 255, 0.06);
}

body {
    min-height: 100vh;
    background: var(--muted-bg);
    color: var(--ink);
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
}

[data-bs-theme="dark"] body,
[data-bs-theme="dark"] .content {
    background: var(--muted-bg);
    color: var(--ink);
}

.app-shell {
    display: grid;
    grid-template-columns: 270px 1fr;
    min-height: 100vh;
    transition: grid-template-columns 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Sidebar Styling */
.sidebar {
    background: var(--sidebar-bg);
    color: var(--sidebar-text-primary);
    padding: 20px 16px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    border-right: 1px solid var(--sidebar-border);
    transition: padding 0.3s cubic-bezier(0.4, 0, 0.2, 1), background 0.3s ease;
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) transparent;
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}
.sidebar::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar::-webkit-scrollbar-thumb {
    background-color: var(--scrollbar-thumb);
    border-radius: 10px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--sidebar-text-primary);
    text-decoration: none;
    font-weight: 800;
    font-size: 1.3rem;
    margin-bottom: 24px;
}

.brand img, .school-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 8px;
    background: var(--sidebar-hover-bg);
    padding: 4px;
    flex-shrink: 0;
}

.brand .sub-brand {
    font-size: 0.68rem;
    font-weight: 400;
    color: var(--sidebar-text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    display: block;
    line-height: 1.2;
}

/* Parent links style */
.sidebar .parent-link,
.sidebar #sidebarNav > a.nav-link,
.offcanvas .parent-link,
.offcanvas #mobileSidebarNav > a.nav-link {
    color: var(--sidebar-text-secondary);
    border-radius: 8px;
    padding: 0 12px;
    height: 48px;
    display: flex;
    gap: 12px;
    align-items: center;
    font-weight: 500;
    font-size: 0.92rem;
    transition: all 0.25s ease;
    text-decoration: none;
}

.sidebar .parent-link:hover,
.sidebar #sidebarNav > a.nav-link:hover,
.offcanvas .parent-link:hover,
.offcanvas #mobileSidebarNav > a.nav-link:hover {
    color: var(--sidebar-text-primary) !important;
    background: var(--sidebar-hover-bg) !important;
}

.sidebar .parent-link.active,
.sidebar #sidebarNav > a.nav-link.active,
.offcanvas .parent-link.active,
.offcanvas #mobileSidebarNav > a.nav-link.active {
    color: var(--sidebar-text-primary) !important;
    font-weight: 600 !important;
}

/* Submenu design */
.sidebar .submenu-list,
.sidebar .sub-submenu-list,
.offcanvas .submenu-list,
.offcanvas .sub-submenu-list {
    background-color: var(--submenu-bg);
    border-radius: 8px;
    padding: 6px;
    margin: 4px 0 8px 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar .submenu-item,
.offcanvas .submenu-item {
    color: var(--sidebar-text-secondary);
    font-size: 0.88rem;
    font-weight: 500;
    padding: 8px 12px 8px 32px !important;
    height: 38px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.sidebar .submenu-item i,
.offcanvas .submenu-item i {
    font-size: 0.95rem;
}

.sidebar .submenu-item:hover,
.offcanvas .submenu-item:hover {
    color: var(--sidebar-text-primary) !important;
    background: var(--sidebar-hover-bg) !important;
}

.sidebar .submenu-item.active,
.offcanvas .submenu-item.active {
    background: var(--active-submenu-bg) !important;
    color: var(--active-submenu-text) !important;
    font-weight: 600 !important;
}

.sidebar .sub-parent-link,
.offcanvas .sub-parent-link {
    color: var(--sidebar-text-secondary);
    font-size: 0.88rem;
    font-weight: 500;
    padding: 8px 12px 8px 32px !important;
    height: 38px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.sidebar .sub-parent-link:hover,
.offcanvas .sub-parent-link:hover {
    color: var(--sidebar-text-primary) !important;
    background: var(--sidebar-hover-bg) !important;
}

.sidebar .sub-parent-link.active,
.offcanvas .sub-parent-link.active {
    color: var(--sidebar-text-primary) !important;
    font-weight: 600 !important;
}

.sidebar .sub-submenu-item,
.offcanvas .sub-submenu-item {
    padding-left: 44px !important;
}

/* Sidebar Profile Section */
.sidebar-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px !important;
    border-radius: 12px;
    background: var(--sidebar-profile-bg);
    border: 1px solid var(--sidebar-profile-border);
    margin: 16px 0;
}
.sidebar-profile-avatar {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border: 2px solid var(--sidebar-border);
    border-radius: 50%;
}
.sidebar-profile-info {
    overflow: hidden;
}
.sidebar-profile .global-principal-name {
    font-size: 0.88rem;
    line-height: 1.2;
    color: var(--sidebar-text-primary) !important;
}
.sidebar-profile-role {
    font-size: 0.72rem;
    color: var(--sidebar-text-secondary) !important;
}
.sidebar-collapsed .sidebar .sidebar-profile {
    justify-content: center !important;
    padding: 8px !important;
}
.sidebar-collapsed .sidebar .sidebar-profile-info {
    display: none !important;
}
.logout-btn {
    text-decoration: none;
}

/* Main Layout */
.main {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    min-height: 76px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 32px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--card-border);
    position: sticky;
    top: 0;
    z-index: 10;
}

[data-bs-theme="dark"] .topbar {
    background: rgba(11, 15, 25, 0.8);
    border-bottom: 1px solid var(--card-border);
}

.topbar-search {
    position: relative;
    max-width: 320px;
    width: 100%;
}

.topbar-search input {
    background: #F1F5F9;
    border: none;
    border-radius: 50px;
    padding: 10px 18px 10px 42px;
    font-size: 0.9rem;
    color: var(--ink);
    width: 100%;
    transition: all 0.2s ease;
}

[data-bs-theme="dark"] .topbar-search input {
    background: #1E293B;
}

.topbar-search input:focus {
    box-shadow: 0 0 0 2px var(--brand);
    background: #fff;
    outline: none;
}

[data-bs-theme="dark"] .topbar-search input:focus {
    background: #0F172A;
}

.topbar-search .bi-search {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #94A3B8;
}

.topbar-avatar {
    width: 38px;
    height: 38px;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid #E2E8F0;
}

[data-bs-theme="dark"] .topbar-avatar {
    border-color: #334155;
}

.school-name {
    font-weight: 800;
    font-size: 1.1rem;
    line-height: 1.2;
}

.content {
    padding: 32px;
    flex-grow: 1;
}

/* Cards & Panels */
.table-panel, .form-panel {
    background: #fff;
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--card-shadow);
}

[data-bs-theme="dark"] .table-panel, 
[data-bs-theme="dark"] .form-panel,
[data-bs-theme="dark"] .card {
    background: #151F32;
    border-color: var(--card-border);
    box-shadow: var(--card-shadow);
}

.card {
    border: 1px solid var(--card-border);
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    background: #fff;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Premium Dashboard UI Elements */
.welcome-banner {
    background: linear-gradient(135deg, #0052FF 0%, #00A3FF 100%);
    border-radius: 20px;
    padding: 28px 32px;
    color: #fff;
    position: relative;
    overflow: hidden;
    margin-bottom: 24px;
}

.welcome-banner::before {
    content: '';
    position: absolute;
    right: -10%;
    top: -20%;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    pointer-events: none;
}

.welcome-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.2);
    object-fit: cover;
}

/* Highlights Cards */
.highlight-card {
    padding: 20px;
}

.highlight-icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    margin-bottom: 12px;
}

/* Card Icons Pastel Colors */
.highlight-card[data-type="students"] .highlight-icon-wrapper {
    background: var(--stat-students-bg);
    color: var(--stat-students);
}
.highlight-card[data-type="teachers"] .highlight-icon-wrapper {
    background: var(--stat-teachers-bg);
    color: var(--stat-teachers);
}
.highlight-card[data-type="attendance"] .highlight-icon-wrapper {
    background: var(--stat-attendance-bg);
    color: var(--stat-attendance);
}
.highlight-card[data-type="fees"] .highlight-icon-wrapper {
    background: var(--stat-fees-bg);
    color: var(--stat-fees);
}
.highlight-card[data-type="leaves"] .highlight-icon-wrapper {
    background: var(--stat-leaves-bg);
    color: var(--stat-leaves);
}

.highlight-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
}

.highlight-card .growth-tag {
    font-size: 0.8rem;
    font-weight: 600;
}

.growth-up {
    color: #16A34A;
}

.growth-down {
    color: #DC2626;
}

/* Quick Access Cards Grid */
.quick-access-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 16px;
}

.quick-access-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px 12px;
    text-align: center;
    text-decoration: none;
    color: var(--ink);
    border-radius: 16px;
    background: #fff;
    border: 1px solid var(--card-border);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02);
}

[data-bs-theme="dark"] .quick-access-tile {
    background: #151F32;
}

.quick-access-tile:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 20px -5px rgba(0, 82, 255, 0.08);
    border-color: rgba(0, 82, 255, 0.2);
    color: var(--brand);
}

.quick-access-icon-bg {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    margin-bottom: 10px;
    transition: all 0.3s ease;
}

/* Pastel grids colors */
.tile-blue { background: #EBF2FF; color: #0052FF; }
.tile-orange { background: #FFF7ED; color: #EA580C; }
.tile-cyan { background: #ECFEFF; color: #0891B2; }
.tile-emerald { background: #ECFDF5; color: #059669; }
.tile-indigo { background: #EEF2FF; color: #4F46E5; }
.tile-rose { background: #FFF1F2; color: #E11D48; }
.tile-purple { background: #FAF5FF; color: #9333EA; }
.tile-pink { background: #FDF2F8; color: #DB2777; }
.tile-amber { background: #FEF3C7; color: #D97706; }
.tile-lime { background: #F7FEE7; color: #4D7C0F; }
.tile-violet { background: #F5F3FF; color: #7C3AED; }
.tile-slate { background: #F1F5F9; color: #475569; }

[data-bs-theme="dark"] .quick-access-icon-bg {
    filter: brightness(0.9);
}

.quick-access-tile span {
    font-size: 0.78rem;
    font-weight: 600;
}

/* Charts Card Container */
.chart-container-card {
    height: 220px;
    position: relative;
    width: 100%;
}

/* Mobile Bottom Navigation */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-top: 1px solid rgba(15, 23, 42, 0.08);
    z-index: 999;
    align-items: center;
    justify-content: space-around;
    padding-bottom: env(safe-area-inset-bottom);
}

[data-bs-theme="dark"] .mobile-bottom-nav {
    background: rgba(11, 15, 25, 0.9);
    border-top-color: rgba(255, 255, 255, 0.08);
}

.mobile-nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #64748B;
    text-decoration: none;
    font-size: 0.72rem;
    font-weight: 500;
    flex-grow: 1;
}

.mobile-nav-link i {
    font-size: 1.25rem;
    margin-bottom: 2px;
}

.mobile-nav-link.active {
    color: var(--brand);
}

/* Existing Logic Preserved (Class management admin/classes.php) */
.class-table .class-detail-row > td {
    background: rgba(0, 82, 255, 0.03);
    border-top: 0;
}

.class-fee-panel {
    border: 1px solid rgba(0, 82, 255, 0.12);
    border-radius: 12px;
    padding: 18px;
    background: rgba(255, 255, 255, 0.6);
}

[data-bs-theme="dark"] .class-table .class-detail-row > td {
    background: rgba(59, 130, 246, 0.06);
}

[data-bs-theme="dark"] .class-fee-panel {
    background: rgba(15, 23, 42, 0.4);
    border-color: rgba(255, 255, 255, 0.1);
}

.receipt {
    max-width: 820px;
    margin: 24px auto;
    background: #fff;
    color: #111827;
    padding: 28px;
    border: 1px solid #d1d5db;
}

.profile-photo {
    width: 94px;
    height: 94px;
    object-fit: cover;
    border-radius: 12px;
    border: 3px solid #fff;
    box-shadow: 0 8px 24px rgba(0,0,0,.1);
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: linear-gradient(135deg, rgba(10, 30, 67, 0.95), rgba(0, 82, 255, 0.88)), url('https://images.unsplash.com/photo-1580582932707-520aed937b7b?auto=format&fit=crop&w=1600&q=80') center/cover;
}

.login-card {
    width: min(440px, 100%);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.96);
    padding: 40px 32px;
    box-shadow: 0 24px 70px rgba(0,0,0,0.18);
}

[data-bs-theme="dark"] .login-card {
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Sidebar chevron animation */
.sidebar .parent-link[aria-expanded="true"] .dropdown-caret,
.offcanvas .parent-link[aria-expanded="true"] .dropdown-caret,
.sidebar .sub-parent-link[aria-expanded="true"] .dropdown-caret,
.offcanvas .sub-parent-link[aria-expanded="true"] .dropdown-caret {
    transform: rotate(90deg);
}

/* Chevron caret styling */
.dropdown-caret {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.72rem !important;
}

/* Bootstrap collapse animation speed control */
.collapsing {
    transition: height 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* Theme toggle adjustments */
#themeToggle {
    border-radius: 50%;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

/* Responsive Overrides */
@media (max-width: 991px) {
    .app-shell {
        grid-template-columns: 1fr;
    }
    .sidebar {
        display: none;
    }
    .topbar {
        padding: 12px 20px;
    }
    .content {
        padding: 20px;
        padding-bottom: 84px; /* bottom navigation spacing */
    }
    .mobile-bottom-nav {
        display: flex;
    }
}

@media print {
    .no-print, .topbar, .sidebar, .offcanvas, .mobile-bottom-nav { display: none !important; }
    body { background: #fff; }
    .receipt { border: 0; margin: 0; max-width: none; }
}

/* Collapsed Sidebar overrides */
.sidebar-collapsed .app-shell {
    grid-template-columns: 78px 1fr;
}

.sidebar-collapsed .sidebar {
    padding: 24px 12px;
}

.sidebar-collapsed .sidebar .brand {
    justify-content: center;
    gap: 0;
}

.sidebar-collapsed .sidebar .brand div {
    opacity: 0;
    max-width: 0;
    padding: 0 !important;
    margin: 0 !important;
}

/* Transitions for brand elements and sidebar text to support smooth collapse */
.sidebar .brand div,
.sidebar .nav-link span:not(.d-flex),
.sidebar .nav-link .dropdown-caret {
    transition: opacity 0.2s ease, max-width 0.3s ease;
    max-width: 200px;
    opacity: 1;
    overflow: hidden;
    white-space: nowrap;
}

.sidebar-collapsed .sidebar .nav-link span:not(.d-flex),
.sidebar-collapsed .sidebar .nav-link .dropdown-caret {
    opacity: 0;
    max-width: 0;
    padding: 0 !important;
    margin: 0 !important;
    pointer-events: none;
}

.sidebar-collapsed .sidebar .nav-link {
    justify-content: center;
    padding: 10px 0;
}

.sidebar-collapsed .sidebar .nav-link span.d-flex {
    justify-content: center;
    gap: 0 !important;
}

.sidebar-collapsed .sidebar .nav-item .collapse {
    display: none !important;
}

/* Collapsed Sidebar Custom CSS Tooltips */
.sidebar-collapsed .sidebar .nav-link {
    position: relative;
}

.sidebar-collapsed .sidebar .nav-link::after {
    content: attr(data-bs-title);
    position: absolute;
    left: 80px;
    top: 50%;
    transform: translateY(-50%) translateX(-10px);
    background: #0f172a;
    color: #fff;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 1050;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.sidebar-collapsed .sidebar .nav-link::before {
    content: '';
    position: absolute;
    left: 74px;
    top: 50%;
    transform: translateY(-50%) translateX(-10px);
    border-width: 5px 6px 5px 0;
    border-style: solid;
    border-color: transparent #0f172a transparent transparent;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 1050;
}

.sidebar-collapsed .sidebar .nav-link:hover::after,
.sidebar-collapsed .sidebar .nav-link:hover::before {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

/* Header Story Logo */
.header-story-logo-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease;
    vertical-align: middle;
}

.header-story-logo-wrapper:hover {
    transform: scale(1.05);
}

.header-story-logo-ring {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    padding: 2.5px;
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-story-logo-wrapper.no-stories .header-story-logo-ring {
    background: transparent;
    padding: 0;
}

.header-story-logo-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    background: #fff;
    border: 2px solid #fff;
}

.header-story-logo-wrapper.no-stories .header-story-logo-img {
    border: none;
    border-radius: 8px;
    object-fit: contain;
    background: transparent;
}

.header-story-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #e11d48;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 10px;
    border: 2px solid #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    line-height: 1.1;
}

[data-bs-theme="dark"] .header-story-badge {
    border-color: #151F32;
}

/* Sidebar Profile Section */
.sidebar-profile {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.2s ease;
}
.sidebar-collapsed .sidebar .sidebar-profile {
    justify-content: center !important;
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
}
.sidebar-profile-info {
    transition: opacity 0.2s ease;
}
.sidebar-collapsed .sidebar .sidebar-profile-info {
    display: none !important;
}

/* Brand Header UI Fixes */
.sidebar, .offcanvas {
    width: 270px !important;
}
@media (min-width: 992px) {
    .sidebar-collapsed .sidebar {
        width: 78px !important;
    }
    .app-shell {
        grid-template-columns: 270px 1fr !important;
    }
    .sidebar-collapsed .app-shell {
        grid-template-columns: 78px 1fr !important;
    }
}
.brand {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    overflow: hidden !important;
}
.brand img, .school-logo {
    width: 40px !important;
    height: 40px !important;
    object-fit: contain !important;
    border-radius: 8px !important;
    background: var(--sidebar-hover-bg) !important;
    padding: 4px !important;
    flex-shrink: 0 !important;
}
.brand-text-wrapper {
    white-space: nowrap !important;
    text-overflow: ellipsis !important;
    overflow: hidden !important;
    max-width: 160px !important;
}
.school-short-name {
    font-size: 1.1rem !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
    display: block !important;
    color: var(--sidebar-text-primary) !important;
}
.school-tagline, .brand .sub-brand {
    font-size: 0.68rem !important;
    font-weight: 400 !important;
    color: var(--sidebar-text-secondary) !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
    display: block !important;
    line-height: 1.2 !important;
}
.offcanvas {
    background: var(--sidebar-bg) !important;
    color: var(--sidebar-text-primary) !important;
    border-right: 1px solid var(--sidebar-border) !important;
}
.offcanvas .offcanvas-header {
    border-bottom-color: var(--sidebar-border) !important;
}
.offcanvas .btn-close {
    filter: var(--close-btn-filter) !important;
}

/* Mobile Responsive Overrides */
html, body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

* {
    box-sizing: border-box;
}

@media (max-width: 991px) {
    .app-shell {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .main {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
    }
    
    .content {
        width: 100% !important;
        max-width: 100% !important;
        padding: 10px 14px !important;
    }
    
    .welcome-banner {
        width: 100% !important;
        min-height: auto;
        padding: 16px 20px !important;
    }
    
    .welcome-avatar {
        width: 60px !important;
        height: 60px !important;
    }
    
    .highlight-card {
        width: 100% !important;
    }
    
    .topbar {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 10px 14px !important;
        flex-wrap: nowrap !important;
        gap: 8px !important;
    }
    
    .topbar-search {
        display: none !important;
    }
    
    .lang-selector-panel {
        margin-right: 4px !important;
        padding-right: 4px !important;
    }
    
    .topbar .ms-auto {
        margin-left: auto !important;
        gap: 8px !important;
    }
    
    .container,
    .container-fluid {
        padding-left: 14px !important;
        padding-right: 14px !important;
        max-width: 100% !important;
    }/* Disable pointer-events on hidden backdrops or overlays */
.modal-backdrop:not(.show),
.offcanvas-backdrop:not(.show),
.sidebar-overlay:not(.show),
.hidden-overlay,
.loader,
.loading-overlay,
.preloader {
    pointer-events: none !important;
    display: none !important;
}

/* Ensure action icons are responsive and clickable on mobile */
.actions button,
.actions a,
.actions-column button,
.actions-column a,
.action-btn {
    pointer-events: auto !important;
    touch-action: manipulation !important;
    cursor: pointer !important;
    z-index: 50 !important;
    position: relative !important;
}

/* Ensure hamburger button is visible and clickable on mobile */
[data-bs-toggle="offcanvas"],
.topbar .d-lg-none,
#mobileHamburgerBtn {
    z-index: 9999 !important;
    pointer-events: auto !important;
}

/* Prevent layout wrappers on mobile from blocking pointer hits */
@media (max-width: 768px) {
    .student-table,
    .action-row,
    .header,
    .table-responsive {
        transform: none !important;
        filter: none !important;
        overflow: visible !important;
    }
}
}

/* Mobile Sidebar & Overlay Fixes */
@media (max-width: 768px) {
    .offcanvas,
    .mobile-sidebar,
    .sidebar {
        background: var(--sidebar-bg) !important;
        opacity: 1 !important;
        z-index: 1055 !important;
        width: 270px !important;
        max-width: 270px !important;
    }

    .sidebar *,
    .offcanvas * {
        filter: none;
    }

    .offcanvas-backdrop,
    .sidebar-overlay {
        background: rgba(0, 0, 0, 0.4) !important;
        opacity: 1 !important;
        backdrop-filter: none !important;
        z-index: 1050 !important;
    }

    .offcanvas.show ~ .main,
    .offcanvas.show ~ .main-content,
    .sidebar.open ~ .main,
    .sidebar.open ~ .main-content {
        filter: none !important;
        opacity: 1 !important;
    }

    .main,
    .main-content {
        background: var(--muted-bg) !important;
        position: relative;
        z-index: 1;
    }

    .sidebar .parent-link,
    .offcanvas .parent-link {
        color: var(--sidebar-text-secondary) !important;
        opacity: 1 !important;
        font-weight: 500 !important;
        background: transparent !important;
    }

    .sidebar .parent-link.active,
    .offcanvas .parent-link.active {
        color: var(--sidebar-text-primary) !important;
        font-weight: 600 !important;
    }

    .sidebar .submenu-list,
    .offcanvas .submenu-list,
    .sidebar .sub-submenu-list,
    .offcanvas .sub-submenu-list {
        background-color: var(--submenu-bg) !important;
    }

    .sidebar .submenu-item,
    .offcanvas .submenu-item {
        color: var(--sidebar-text-secondary) !important;
        font-weight: 500 !important;
    }

    .sidebar .submenu-item.active,
    .offcanvas .submenu-item.active {
        background: var(--active-submenu-bg) !important;
        color: var(--active-submenu-text) !important;
        font-weight: 600 !important;
    }

    .sidebar .menu-icon,
    .offcanvas .menu-icon {
        opacity: 1 !important;
        color: inherit !important;
    }

    body.sidebar-open {
        overflow: hidden;
    }

    body:not(.sidebar-open) {
        overflow: auto;
    }
}


/* Mobile Responsive Fixes - Admin/Principal Dashboard */
@media (max-width: 991px) {
    html, body {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    .app-shell,
    .main,
    .main-content,
    .dashboard-wrapper,
    .content-wrapper,
    .page-content,
    .content {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 14px !important;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%) !important;
        position: fixed !important;
        display: none !important;
    }

    .main,
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }

    .dashboard-grid {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 14px;
    }

    .welcome-card,
    .welcome-banner {
        width: 100% !important;
        min-height: auto !important;
    }

    .stats-card,
    .highlight-card,
    .card {
        width: 100% !important;
    }

    .topbar {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 10px 14px !important;
        flex-wrap: nowrap !important;
        gap: 8px !important;
    }

    .header-right,
    .topbar .ms-auto {
        margin-left: auto !important;
    }

    .container,
    .container-fluid {
        padding-left: 14px !important;
        padding-right: 14px !important;
        max-width: 100% !important;
    }

    * {
        box-sizing: border-box !important;
    }
}

/* Profile View Modal Fixes */
.profile-modal {
    position: fixed !important;
    inset: 0 !important;
    display: none;
    align-items: center !important;
    justify-content: center !important;
    padding: 12px !important;
    z-index: 99999 !important;
}

.profile-modal.show {
    display: flex !important;
}

/* Modal Dialog */
.profile-modal .modal-dialog {
    margin: auto !important;
    max-width: 100% !important;
    width: auto !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 2 !important;
    height: auto !important;
}

.overlay {
    position: absolute !important;
    inset: 0 !important;
    background: rgba(0, 0, 0, 0.45) !important;
    backdrop-filter: blur(4px) !important;
    z-index: 1 !important;
}

.profile-card {
    width: min(960px, 96vw) !important;
    height: auto !important;
    max-height: 92dvh !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    border-radius: 28px !important;
    background: #fff !important;
    z-index: 2 !important;
    border: none !important;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.25) !important;
}

.profile-header {
    flex: 0 0 auto !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 5 !important;
    padding: 18px 22px !important;
    background: var(--bg-card, #ffffff) !important;
    border-bottom: 1px solid var(--border-color, rgba(0, 0, 0, 0.08)) !important;
}

.profile-body {
    flex: 1 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding: 22px !important;
    -webkit-overflow-scrolling: touch !important;
    background: var(--bg-card, #ffffff) !important;
}

/* Ensure no inner layout height constraints, absolute positions, overflow hidden, or negative margins */
.profile-modal .modal-body .row,
.profile-modal .modal-body .row > div {
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    position: relative !important;
    margin: 0 !important;
}

.profile-tabs {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 10px !important;
    position: sticky !important;
    top: 0 !important;
    background: #fff !important;
    z-index: 4 !important;
    padding-bottom: 14px !important;
    border-bottom: 1px solid var(--border-color, rgba(0, 0, 0, 0.05)) !important;
    margin-bottom: 20px !important;
}

.profile-tabs .nav-item {
    margin: 0 !important;
}

.profile-tabs .nav-link {
    min-height: 46px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    white-space: nowrap !important;
}

.profile-modal .tab-content {
    overflow: visible !important;
    height: auto !important;
    min-height: 0 !important;
    flex: none !important;
    padding: 0 !important;
}

.profile-section {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)) !important;
    gap: 18px !important;
    position: relative !important;
}

.profile-section > div {
    width: auto !important;
    max-width: 100% !important;
    flex: none !important;
    position: relative !important;
}

.profile-footer {
    position: sticky !important;
    bottom: 0 !important;
    background: #fff !important;
    display: flex !important;
    gap: 12px !important;
    padding: 16px !important;
    flex-wrap: wrap !important;
    border-top: 1px solid var(--border-color, rgba(0, 0, 0, 0.08)) !important;
    z-index: 5 !important;
}

.profile-footer form {
    flex: 1 !important;
    display: flex !important;
    margin: 0 !important;
}

.profile-footer button,
.profile-footer a,
.profile-footer form button {
    flex: 1 !important;
    min-height: 52px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* MOBILE STYLING OVERRIDES */
@media (max-width: 768px) {
    .profile-card {
        width: 96vw !important;
        max-height: 88dvh !important;
    }
    
    .profile-tabs > li {
        width: calc(50% - 5px) !important;
        flex: 1 1 calc(50% - 5px) !important;
    }
    
    .profile-tabs .nav-link {
        width: 100% !important;
        text-align: center !important;
    }
    
    .profile-footer {
        flex-direction: column !important;
        align-items: stretch !important;
    }
    
    .profile-footer form {
        width: 100% !important;
    }
    
    .profile-footer button,
    .profile-footer a,
    .profile-footer form button {
        width: 100% !important;
    }
}

.actions-column {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 8px !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
}

.actions button,
.actions a,
.actions-column button,
.actions-column a,
.action-btn {
    pointer-events: auto !important;
    visibility: visible !important;
    opacity: 1 !important;
    touch-action: manipulation;
}

.action-btn {
    flex: 0 0 auto !important;
    min-width: 40px !important;
    min-height: 40px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

@media (max-width: 768px) {
    .actions,
    .actions-column {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
    }
}








