/* ==========================================================================
   IQRA COLLEGE & SCHOOL SYSTEM SANDHILIANWALI - RESPONSIVE STYLESHEET
   ========================================================================== */

/* --- 1. CSS Reset & Base Layout --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body, button, input, select, textarea {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

:root {
    --primary-color: #1a365d;
    --primary-light: #2b6cb0;
    --primary-dark: #0f233d;
    --gold-accent: #d97706;
    --gold-light: #f59e0b;
    --bg-page: #f5f6fa;
    --bg-card: #ffffff;
    --text-main: #2d3748;
    --text-muted: #718096;
    --text-light: #e2e8f0;
    --border-color: #e2e8f0;
    --sidebar-width: 240px;
    --header-height: 60px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.12);
}

html, body {
    width: 100%;
    min-height: 100vh;
    background-color: var(--bg-page);
    color: var(--text-main);
    overflow-x: hidden;
}

body {
    display: flex;
    flex-direction: row;
    position: relative;
}

body.mobile-nav-open {
    overflow: hidden;
}

/* --- 2. Mobile Backdrop Overlay --- */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: 9998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.sidebar-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

/* --- 3. Left Sidebar --- */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--primary-color);
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding-top: 15px;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    height: 100vh;
    z-index: 900;
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 2px 0 10px rgba(0,0,0,0.06);
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 16px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 8px;
}

.sidebar-brand-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.sidebar-brand-info img {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid var(--gold-accent);
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.sidebar-brand-name {
    font-size: 13.5px;
    font-weight: 800;
    color: #ffffff;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-brand-campus {
    font-size: 9.5px;
    font-weight: 700;
    color: var(--gold-accent);
    letter-spacing: 0.8px;
}

/* Close button is hidden on desktop by default */
.sidebar-close-btn {
    display: none;
    background: rgba(255, 255, 255, 0.12);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 15px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s ease;
}

.sidebar-close-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.nav-menu {
    list-style: none;
    padding-left: 12px;
    padding-right: 8px;
    overflow-y: auto;
    max-height: calc(100vh - 120px);
    -webkit-overflow-scrolling: touch;
}

.nav-item {
    padding: 11px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13.5px;
    cursor: pointer;
    color: var(--text-light);
    margin-bottom: 4px;
    border-radius: 8px 0 0 8px;
    transition: background 0.18s ease, color 0.18s ease, padding-left 0.18s ease;
    user-select: none;
}

.nav-item i {
    width: 18px;
    text-align: center;
    font-size: 15px;
    flex-shrink: 0;
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.08);
    color: white;
    padding-left: 19px;
}

.nav-item.active {
    background-color: var(--bg-page);
    color: var(--primary-color);
    font-weight: 700;
    border-radius: 25px 0 0 25px;
}

.sidebar-illustration {
    padding: 20px;
    text-align: center;
}

/* --- 4. Main Content Area --- */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 20px 28px;
    width: calc(100% - var(--sidebar-width));
    min-width: 0;
    overflow-y: auto;
    min-height: 100vh;
}

/* --- 5. Top Header --- */
.top-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 20px;
    margin-bottom: 22px;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 12px;
    z-index: 850;
}

.logo-text {
    font-size: 22px;
    font-weight: 800;
    color: var(--primary-color);
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.menu-toggle-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: white;
    color: var(--primary-color);
    font-size: 17px;
    cursor: pointer;
    transition: 0.15s ease;
    flex-shrink: 0;
}

.menu-toggle-btn:hover {
    background: #edf2f7;
    border-color: #cbd5e0;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: #f8fafc;
    color: var(--text-muted);
    cursor: pointer;
    transition: 0.15s ease;
    font-size: 14px;
}

.header-action-btn:hover {
    background: #edf2f7;
    color: var(--primary-color);
    border-color: #cbd5e0;
}

/* --- 6. View Sections --- */
.view-section {
    display: none;
    animation: fadeIn 0.18s ease-in-out;
}

.view-section.active-view {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- 7. Unified LMS Design System & Dashboard View Components --- */
.lms-page-header,
.dash-hero-container {
    background: linear-gradient(135deg, #1a365d 0%, #1e4273 100%);
    border-radius: var(--radius-lg);
    padding: 24px 28px;
    color: #ffffff;
    margin-bottom: 22px;
    box-shadow: 0 8px 24px rgba(26, 54, 93, 0.15);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 18px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    position: relative;
    overflow: hidden;
}

.lms-page-header::after,
.dash-hero-container::after {
    content: '';
    position: absolute;
    right: -40px;
    top: -40px;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(217, 119, 6, 0.14) 0%, transparent 70%);
    pointer-events: none;
}

.lms-header-info,
.dash-hero-info {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
}

.lms-header-title,
.lms-page-header h1,
.dash-hero-info h1 {
    font-size: 22px;
    font-weight: 800;
    margin: 0 0 6px;
    color: #ffffff !important;
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.2px;
}

.lms-header-title i,
.lms-page-header h1 i {
    color: var(--gold-accent) !important;
}

.lms-header-subtitle,
.lms-page-header p,
.dash-hero-info p {
    font-size: 13px;
    color: #cbd5e1 !important;
    margin: 0 0 10px;
    line-height: 1.4;
}

.lms-tag-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(217, 119, 6, 0.22);
    color: #fde68a;
    border: 1px solid rgba(217, 119, 6, 0.45);
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    width: fit-content;
    margin-bottom: 6px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.lms-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
}

.dash-hero-badges {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.dash-pill-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 600;
    color: #f1f5f9;
}

.dash-pill-badge.live {
    background: rgba(34, 197, 94, 0.2);
    border-color: rgba(34, 197, 94, 0.4);
    color: #86efac;
}

.dash-pill-badge.live::before {
    content: '';
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 8px #22c55e;
}

.dash-actions-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* Universal Button Architecture (.lms-btn & .dash-quick-btn) */
.lms-btn,
.dash-quick-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 18px;
    font-size: 13px;
    font-weight: 700;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    text-decoration: none;
    line-height: 1.4;
    user-select: none;
}

.lms-btn:hover,
.dash-quick-btn:hover {
    transform: translateY(-2px);
}

.lms-btn-primary {
    background: var(--primary-color);
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(26, 54, 93, 0.25);
}

.lms-btn-primary:hover {
    background: #152c4d;
    box-shadow: 0 4px 14px rgba(26, 54, 93, 0.35);
    color: #ffffff;
}

.lms-btn-gold,
.dash-quick-btn.primary {
    background: var(--gold-accent);
    border-color: #f59e0b;
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(217, 119, 6, 0.3);
}

.lms-btn-gold:hover,
.dash-quick-btn.primary:hover {
    background: #b45309;
    border-color: #b45309;
    box-shadow: 0 4px 14px rgba(217, 119, 6, 0.4);
    color: #ffffff;
}

.lms-btn-success {
    background: #16a34a;
    border-color: #16a34a;
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(22, 163, 74, 0.25);
}

.lms-btn-success:hover {
    background: #15803d;
    border-color: #15803d;
    box-shadow: 0 4px 14px rgba(22, 163, 74, 0.35);
    color: #ffffff;
}

.lms-btn-danger {
    background: #dc2626;
    border-color: #dc2626;
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(220, 38, 38, 0.25);
}

.lms-btn-danger:hover {
    background: #b91c1c;
    border-color: #b91c1c;
    box-shadow: 0 4px 14px rgba(220, 38, 38, 0.35);
    color: #ffffff;
}

.lms-btn-secondary {
    background: #ffffff;
    color: #475569;
    border-color: #cbd5e1;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.lms-btn-secondary:hover {
    background: #f8fafc;
    border-color: #94a3b8;
    color: #1e293b;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
}

.lms-btn-glass,
.dash-quick-btn {
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #ffffff;
    backdrop-filter: blur(6px);
}

.lms-btn-glass:hover,
.dash-quick-btn:hover {
    background: #ffffff;
    color: var(--primary-color);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}

.lms-btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* Universal Sub-Tab Navigation Bar (.lms-tabs & .academic-tabs) */
.lms-tabs,
.academic-tabs {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 22px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: var(--shadow-sm);
    scrollbar-width: none;
}

.lms-tabs::-webkit-scrollbar,
.academic-tabs::-webkit-scrollbar {
    display: none;
}

.lms-tab-btn,
.academic-tab {
    border: none !important;
    background: transparent !important;
    color: #64748b !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    padding: 10px 18px !important;
    border-radius: var(--radius-sm) !important;
    cursor: pointer;
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    flex-shrink: 0;
    text-decoration: none;
    line-height: 1.4;
    user-select: none;
}

.lms-tab-btn:hover,
.academic-tab:hover {
    background: #f1f5f9 !important;
    color: var(--text-main) !important;
}

.lms-tab-btn.active,
.academic-tab.active {
    background: var(--primary-color) !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    box-shadow: 0 2px 8px rgba(26, 54, 93, 0.25) !important;
}

.lms-tab-btn.active i,
.academic-tab.active i {
    color: #f59e0b !important;
}

.lms-tab-badge {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    background: #edf2f7;
    color: #4a5568;
    transition: all 0.15s ease;
}

.lms-tab-btn.active .lms-tab-badge,
.academic-tab.active .lms-tab-badge {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

/* Executive KPI Grid */
.dash-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 22px;
}

.dash-kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.dash-kpi-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: #cbd5e1;
}

.dash-kpi-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.dash-kpi-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dash-kpi-icon-wrap {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.dash-kpi-icon-wrap.blue {
    background: #ebf8ff;
    color: #2b6cb0;
}

.dash-kpi-icon-wrap.gold {
    background: #fef3c7;
    color: #d97706;
}

.dash-kpi-icon-wrap.green {
    background: #f0fdf4;
    color: #16a34a;
}

.dash-kpi-icon-wrap.purple {
    background: #faf5ff;
    color: #7c3aed;
}

.dash-kpi-val {
    font-size: 26px;
    font-weight: 800;
    color: var(--primary-color);
    line-height: 1.1;
    margin-bottom: 8px;
}

.dash-kpi-meta {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

/* Operational 2-Column Summary Grid */
.dash-summary-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 22px;
}

.dash-summary-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
}

.dash-summary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f1f5f9;
}

.dash-summary-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.dash-tag-pill {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 12px;
    background: #f1f5f9;
    color: #475569;
}

.dash-progress-track {
    width: 100%;
    height: 9px;
    background: #edf2f7;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
    margin: 8px 0 14px;
}

.dash-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #16a34a, #22c55e);
    border-radius: 6px;
    transition: width 0.5s ease-in-out;
}

.dash-progress-track.multi-segment {
    display: flex;
}

.dash-progress-track.multi-segment > div {
    height: 100%;
    transition: width 0.5s ease-in-out;
}

.dash-metrics-triple {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    background: #f8fafc;
    border: 1px solid #edf2f7;
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 16px;
}

.dash-metric-col {
    text-align: center;
}

.dash-metric-col:not(:last-child) {
    border-right: 1px solid #e2e8f0;
}

.dash-metric-col h4 {
    font-size: 15px;
    font-weight: 800;
    color: var(--primary-color);
    margin: 0 0 3px;
}

.dash-metric-col p {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    margin: 0;
}

.dash-legend-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: #475569;
    padding: 6px 0;
    border-bottom: 1px dashed #f1f5f9;
}

.dash-legend-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-weight: 600;
}

.dash-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.dash-card-footer-btns {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-top: auto;
    padding-top: 14px;
}

.dash-text-btn {
    background: none;
    border: none;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--primary-light);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.15s ease, color 0.15s ease;
}

.dash-text-btn:hover {
    background: #ebf8ff;
    color: #1a365d;
}

/* Fallback & Legacy Grid Compatibility */
.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 14px;
    margin-bottom: 22px;
}

.action-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px 12px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 85px;
}

.action-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: #cbd5e0;
}

.action-card i {
    font-size: 24px;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.action-card .gold-icon {
    color: var(--gold-accent);
}

.action-card p {
    font-size: 12px;
    font-weight: 600;
    color: #4a5568;
    line-height: 1.3;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.18s ease;
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
}

.stat-card i {
    font-size: 34px;
    color: var(--gold-accent);
    margin-bottom: 8px;
    display: inline-block;
}

.stat-card h2 {
    font-size: 24px;
    color: var(--primary-color);
    font-weight: 700;
    line-height: 1.2;
}

.stat-card p {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-top: 4px;
    letter-spacing: 0.4px;
}

.bottom-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.panel-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    max-width: 100%;
    min-width: 0;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
    border-bottom: 1px solid #edf2f7;
    padding-bottom: 12px;
}

.panel-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* --- 8. Universal Table Responsiveness --- */
.table-responsive,
.academic-table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-top: 10px;
    margin-bottom: 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: white;
}

.table-responsive::-webkit-scrollbar,
.academic-table-wrap::-webkit-scrollbar {
    height: 7px;
}

.table-responsive::-webkit-scrollbar-thumb,
.academic-table-wrap::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb:hover,
.academic-table-wrap::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
    margin-top: 0;
}

.data-table th {
    background-color: #f7fafc;
    color: #4a5568;
    padding: 12px 14px;
    border-bottom: 2px solid var(--border-color);
    font-weight: 700;
    white-space: nowrap;
}

.data-table td {
    padding: 12px 14px;
    border-bottom: 1px solid #edf2f7;
    color: #2d3748;
    vertical-align: middle;
    white-space: nowrap;
}

.data-table tbody tr:hover {
    background-color: #f8fafc;
}

.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: capitalize;
}

.badge-success, .badge-present, .badge-paid, .badge-active { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.badge-pending, .badge-leave, .badge-late, .badge-partial { background: #fef3c7; color: #b45309; border: 1px solid #fde68a; }
.badge-danger, .badge-absent, .badge-unpaid, .badge-defaulter { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.badge-info, .badge-advance { background: #e0f2fe; color: #0369a1; border: 1px solid #bae6fd; }

/* Universal Modal Styling */
#globalModal {
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.lms-modal-shell {
    background: #ffffff;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
}

.lms-modal-header {
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    padding: 18px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.lms-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 800;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.lms-modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: #edf2f7;
    color: #64748b;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
}

.lms-modal-close:hover {
    background: #fee2e2;
    color: #dc2626;
}

.lms-modal-body {
    padding: 24px;
    overflow-y: auto;
}

.lms-modal-footer {
    padding: 16px 24px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* --- 9. Calendar & Notice Board --- */
.calendar-months {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    font-size: 11px;
    margin-bottom: 12px;
    padding-bottom: 4px;
}

.month-tag {
    padding: 5px 10px;
    border-radius: 4px;
    background: #edf2f7;
    cursor: pointer;
    font-weight: 600;
    white-space: nowrap;
    transition: all 0.15s ease;
    user-select: none;
}

.month-tag:hover {
    background: #e2e8f0;
}

.month-tag.active {
    background: var(--primary-color);
    color: white;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    color: #718096;
    margin-bottom: 6px;
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
    text-align: center;
    font-size: 12px;
}

.day-cell {
    padding: 8px 3px;
    background: #f8fafc;
    border: 1px solid #edf2f7;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    min-height: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    user-select: none;
}

.day-cell:hover {
    background: #ebf8ff;
    border-color: #bee3f8;
    color: #2b6cb0;
}

.day-cell.today {
    border: 2px solid #2b6cb0;
    font-weight: 800;
    color: #2b6cb0;
    background: #f0f7ff;
}

.day-cell.selected {
    background: #1a365d !important;
    color: white !important;
    border-color: #1a365d !important;
}

.day-cell.empty-day {
    background: transparent;
    border-color: transparent;
    cursor: default;
    pointer-events: none;
}

.day-cell.has-event {
    font-weight: 700;
}

.day-cell .event-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #d97706;
    margin-top: 2px;
}

.day-cell.selected .event-dot {
    background: #fef08a;
}

.day-cell.event-blue { background: var(--primary-color); color: white; }
.day-cell.event-gold { background: var(--gold-accent); color: white; }

.notice-item {
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    border-left: 4px solid transparent;
}

.notice-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

.notice-yellow { background-color: #fef3c7; color: #92400e; border-left-color: #d97706; }
.notice-blue { background-color: #e0e7ff; color: #3730a3; border-left-color: #4f46e5; }
.notice-green { background-color: #dcfce7; color: #166534; border-left-color: #16a34a; }
.notice-purple { background-color: #f3e8ff; color: #6b21a8; border-left-color: #9333ea; }

.notice-badge {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    background: rgba(255,255,255,0.75);
    margin-left: 6px;
    text-transform: uppercase;
}

.notice-action-btn {
    border: none;
    background: transparent;
    cursor: pointer;
    color: inherit;
    opacity: 0.65;
    padding: 3px 5px;
    font-size: 13px;
    transition: opacity 0.15s ease;
}

.notice-action-btn:hover {
    opacity: 1;
}

.notice-action-btn.delete-btn:hover {
    color: #c53030;
}

/* --- 10. Staff Management UI --- */
.staff-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.staff-filters {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px;
    margin-bottom: 16px;
}

.staff-filters label {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid #cbd5e0;
    border-radius: var(--radius-sm);
    padding: 0 10px;
    color: var(--text-muted);
    background: white;
}

.staff-filters input, .staff-filters select {
    border: 0;
    outline: 0;
    padding: 8px;
    color: #2d3748;
    background: transparent;
    font-size: 13.5px;
}

.staff-filters select {
    border: 1px solid #cbd5e0;
    border-radius: var(--radius-sm);
    background: white;
}

.staff-action-button, .staff-submit {
    border: 0;
    border-radius: var(--radius-sm);
    padding: 10px 15px;
    background: var(--primary-color);
    color: white;
    font-weight: 700;
    cursor: pointer;
    font-size: 13.5px;
    transition: 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.staff-action-button:hover, .staff-submit:hover {
    background: var(--primary-light);
}

.staff-action-button.secondary { background: var(--primary-light); }
.staff-action-button.gold { background: var(--gold-accent); }
.staff-submit { margin-top: 18px; width: 100%; justify-content: center; }

.staff-icon-button {
    border: 1px solid var(--border-color);
    background: white;
    color: var(--primary-light);
    border-radius: 5px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: 0.15s ease;
}

.staff-icon-button:hover { background: #edf2f7; }
.staff-icon-button.danger { color: #c53030; }
.staff-icon-button.danger:hover { background: #fed7d7; }

.staff-table { width: 100%; margin-top: 0; }

/* --- Staff Cards Grid & Action Dropdowns (Approach 2) --- */
.staff-view-switcher {
    display: inline-flex;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    overflow: hidden;
    padding: 2px;
}
.staff-view-btn {
    border: none;
    background: transparent;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 700;
    color: #64748b;
    cursor: pointer;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s ease;
}
.staff-view-btn.active {
    background: #1e3a8a;
    color: #ffffff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.staff-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 18px;
    margin-top: 4px;
}
.staff-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
    position: relative;
}
.staff-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    border-color: #cbd5e1;
}
.staff-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 12px;
}
.staff-card-avatar {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 18px;
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(0,0,0,0.12);
    overflow: hidden;
    flex-shrink: 0;
}
.staff-card-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.staff-card-name {
    font-size: 16px;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.staff-card-role {
    font-size: 12px;
    font-weight: 700;
    color: #2563eb;
    display: flex;
    align-items: center;
    gap: 5px;
}
.staff-card-dept {
    font-size: 12px;
    color: #64748b;
    margin-top: 3px;
}
.staff-card-details {
    background: #f8fafc;
    border: 1px solid #edf2f7;
    border-radius: 8px;
    padding: 12px;
    margin: 14px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 12.5px;
}
.staff-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.staff-detail-label {
    color: #64748b;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}
.staff-detail-val {
    font-weight: 700;
    color: #1e293b;
}
.staff-badge-incharge {
    background: #e0f2fe;
    color: #0369a1;
    border: 1px solid #bae6fd;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
}
.staff-card-footer {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid #f1f5f9;
    position: relative;
}
.btn-card-profile {
    flex: 1;
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background 0.15s;
}
.btn-card-profile:hover {
    background: #1d4ed8;
    color: #ffffff;
}
.btn-card-pay {
    flex: 1;
    background: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background 0.15s;
}
.btn-card-pay:hover {
    background: #16a34a;
    color: #ffffff;
}
.btn-card-wa {
    background: #25d366;
    color: #ffffff;
    width: 34px;
    height: 34px;
    border-radius: 6px;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 2px 4px rgba(37,211,102,0.25);
    flex-shrink: 0;
}
.btn-card-more {
    background: #ffffff;
    color: #64748b;
    width: 34px;
    height: 34px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    flex-shrink: 0;
}
.btn-card-more:hover {
    background: #f1f5f9;
    color: #0f172a;
}
.staff-dropdown-menu {
    position: absolute;
    right: 0;
    bottom: 42px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    width: 190px;
    z-index: 100;
    padding: 6px 0;
    display: none;
}
.staff-dropdown-menu.show {
    display: block;
}
.staff-dropdown-item {
    padding: 8px 14px;
    font-size: 12.5px;
    font-weight: 600;
    color: #334155;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
}
.staff-dropdown-item:hover {
    background: #f8fafc;
    color: #1e3a8a;
}
.staff-dropdown-item.danger {
    color: #dc2626;
}
.staff-dropdown-item.danger:hover {
    background: #fef2f2;
}
.staff-dropdown-divider {
    height: 1px;
    background: #e2e8f0;
    margin: 4px 0;
}

/* Staff Modal Components */
.staff-class-chips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 8px;
    max-height: 220px;
    overflow-y: auto;
    padding: 8px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}
.staff-class-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #334155;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}
.staff-class-chip:hover {
    border-color: #0891b2;
    background: #f0fdfa;
}
.staff-class-chip.selected {
    background: #e0f2fe;
    border-color: #0284c7;
    color: #0369a1;
    font-weight: 700;
}
.staff-class-chip input[type="checkbox"] {
    cursor: pointer;
    accent-color: #0284c7;
}

.staff-quick-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}
.staff-quick-chip {
    padding: 4px 10px;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 14px;
    font-size: 11.5px;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    transition: all 0.15s ease;
}
.staff-quick-chip:hover {
    background: #e2e8f0;
    color: #0f172a;
    border-color: #94a3b8;
}

.staff-kpi-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px 14px;
    text-align: center;
    flex: 1;
}
.staff-kpi-card .kpi-label {
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}
.staff-kpi-card .kpi-val {
    font-size: 17px;
    font-weight: 800;
    color: #0f172a;
}

.academic-shell { color: #2d3748; }

.academic-hero {
    background: linear-gradient(135deg, #1a365d 0%, #1e4273 100%);
    border-radius: var(--radius-lg);
    padding: 24px 28px;
    color: #ffffff;
    margin-bottom: 22px;
    box-shadow: 0 8px 24px rgba(26, 54, 93, 0.15);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 18px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    position: relative;
    overflow: hidden;
}

.academic-hero::after {
    content: '';
    position: absolute;
    right: -40px;
    top: -40px;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(217, 119, 6, 0.14) 0%, transparent 70%);
    pointer-events: none;
}

.academic-hero h1 {
    font-size: 22px;
    font-weight: 800;
    margin: 0 0 6px;
    color: #ffffff !important;
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.2px;
}

.academic-hero h1 i {
    color: var(--gold-accent) !important;
}

.academic-hero p {
    font-size: 13px;
    color: #cbd5e1 !important;
    margin: 0;
    line-height: 1.4;
}

.academic-section-heading p {
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.4;
    margin: 2px 0 0;
}

.academic-hero .academic-button {
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #ffffff;
    backdrop-filter: blur(6px);
}

.academic-hero .academic-button:hover {
    background: #ffffff;
    color: var(--primary-color);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
    transform: translateY(-2px);
}

.academic-hero .academic-button.secondary {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: #f1f5f9;
}

.academic-hero .academic-button.secondary:hover {
    background: rgba(255, 255, 255, 0.22);
    color: #ffffff;
}

.academic-hero .academic-button.gold,
.academic-hero .academic-button.primary {
    background: var(--gold-accent);
    border-color: #f59e0b;
    color: #ffffff;
}

.academic-hero .academic-button.gold:hover,
.academic-hero .academic-button.primary:hover {
    background: #b45309;
    color: #ffffff;
}

.academic-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}

.academic-summary .stat-card,
.exam-stat-grid > div {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 16px;
}

.academic-summary .stat-card:hover,
.exam-stat-grid > div:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: #cbd5e1;
}

.academic-summary .stat-card i,
.exam-stat-grid > div i {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin: 0;
    background: #ebf8ff;
    color: var(--primary-light);
    flex-shrink: 0;
}

.academic-summary .stat-card h2,
.exam-stat-grid > div h2 {
    font-size: 24px;
    font-weight: 800;
    color: var(--primary-color);
    line-height: 1.1;
    margin-bottom: 3px;
}

.academic-summary .stat-card p,
.exam-stat-grid > div p {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
}

.academic-toolbar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 16px;
}

.academic-search {
    min-width: 220px;
    flex: 1;
    position: relative;
}

.academic-search i {
    position: absolute;
    left: 12px;
    top: 11px;
    color: #a0aec0;
}

.academic-search input,
.academic-toolbar select,
.academic-form input,
.academic-form select,
.academic-form textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #cbd5e0;
    border-radius: var(--radius-sm);
    color: #2d3748;
    background: white;
    outline: 0;
    font-size: 14px;
}

.academic-search input { padding-left: 34px; }
.academic-toolbar select { width: auto; min-width: 150px; }

.academic-button {
    border: 0;
    border-radius: var(--radius-sm);
    padding: 10px 16px;
    background: var(--primary-light);
    color: white;
    font-weight: 700;
    font-size: 13.5px;
    cursor: pointer;
    white-space: nowrap;
    transition: 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.academic-button:hover { background: #2c5282; }
.academic-button.secondary { background: #edf2f7; color: #4a5568; }
.academic-button.secondary:hover { background: #e2e8f0; }

.academic-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 18px;
}

.academic-summary .stat-card {
    text-align: left;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.academic-summary .stat-card i { font-size: 24px; margin: 0; color: var(--primary-light); }
.academic-summary .stat-card h2 { font-size: 22px; }

.academic-table { min-width: 800px; margin-top: 0; }
.academic-table td:first-child { font-weight: 700; color: var(--primary-color); }

.academic-section-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.academic-section-heading h2 { color: var(--primary-color); font-size: 20px; margin-bottom: 4px; }

.academic-empty {
    text-align: center;
    padding: 40px 16px !important;
    color: var(--text-muted) !important;
}

.academic-empty i {
    display: block;
    font-size: 32px;
    color: #cbd5e0;
    margin-bottom: 10px;
}

/* --- 12. Examination & Results --- */
.exam-shell .academic-toolbar {
    background: #fff;
    border: 1px solid var(--border-color);
    padding: 14px;
    border-radius: var(--radius-sm);
}

.exam-stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 20px;
}

.exam-stat-grid .stat-card { text-align: left; padding: 16px; }
.exam-stat-grid i { color: var(--primary-light); font-size: 24px; margin-bottom: 6px; }

.exam-status {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 5px;
    font-size: 11px;
    font-weight: 700;
    background: #edf2f7;
    color: #4a5568;
}

.exam-status.published, .exam-status.approved { background: #c6f6d5; color: #22543d; }
.exam-status.submitted { background: #bee3f8; color: #2a4365; }
.exam-status.returned { background: #feebc8; color: #744210; }

/* --- 13. Student Profile Responsive Grid Classes --- */
.student-profile-search-form {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 15px;
    align-items: end;
}

.student-profile-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 20px;
    align-items: start;
}

.profile-form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 14px;
}

.profile-form-grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 14px;
    margin-bottom: 14px;
}

/* --- 14. Fee Ledger Responsive Grids --- */
.fee-ledger-header {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    font-size: 13px;
}

.fee-ledger-stats {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    margin-bottom: 15px;
    text-align: center;
}

/* --- 15. Timetable Grid --- */
.timetable-grid {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 6px;
    border: 1px solid var(--border-color);
}

.timetable-grid table {
    min-width: 950px;
    width: 100%;
    border-collapse: separate;
    border-spacing: 5px;
}

.timetable-grid th, .timetable-grid td {
    min-width: 125px;
    padding: 6px;
    vertical-align: top;
}

.timetable-grid th {
    background: #f7fafc;
    color: var(--primary-color);
    font-size: 12px;
    font-weight: 700;
    text-align: center;
    border-radius: 6px;
    padding: 10px 6px;
}

.timetable-grid th .slot-period { display: block; font-size: 13px; font-weight: 800; color: var(--primary-light); }
.timetable-grid th .slot-time { display: block; font-size: 11px; font-weight: 600; color: var(--text-muted); margin-top: 2px; }
.timetable-grid th.break-header { background: #fef3c7; color: #92400e; }
.timetable-grid th.break-header .slot-period { color: #b45309; }

.timetable-grid td.day-col {
    min-width: 105px;
    max-width: 115px;
    background: #edf2f7;
    color: var(--primary-color);
    font-weight: 700;
    font-size: 13px;
    text-align: center;
    vertical-align: middle;
    border-radius: 6px;
    padding: 8px;
}

.timetable-grid td.day-col .day-sub { display: block; font-size: 10px; font-weight: 600; color: var(--text-muted); margin-top: 2px; }
.timetable-grid td.break-cell {
    background: #fffbeb;
    border: 1px dashed #fcd34d;
    border-radius: 6px;
    text-align: center;
    vertical-align: middle;
    color: #b45309;
    font-weight: 700;
    font-size: 12px;
}

.timetable-grid td.break-cell i { display: block; font-size: 16px; margin-bottom: 4px; }
.timetable-grid td.empty-slot {
    background: #f8fafc;
    border: 1px dashed #cbd5e0;
    border-radius: 6px;
    min-height: 85px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
    vertical-align: middle;
}

.timetable-grid td.empty-slot:hover { background: #ebf8ff; border-color: #3182ce; }
.timetable-grid td.empty-slot .add-slot-btn { font-size: 11px; color: #a0aec0; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 6px; }
.timetable-grid td.empty-slot:hover .add-slot-btn { color: var(--primary-light); font-weight: 700; }

.timetable-cell {
    position: relative;
    border-radius: 6px;
    padding: 10px 8px;
    background: #ebf8ff;
    border-left: 4px solid #3182ce;
    cursor: pointer;
    transition: all 0.15s ease;
    min-height: 85px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.timetable-cell:hover { transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0,0,0,0.08); background: #e6fffa; border-left-color: #319795; }
.timetable-cell strong, .timetable-cell span { display: block; }
.timetable-cell strong.subject-title { color: var(--primary-color); font-size: 13px; font-weight: 700; word-break: break-word; }
.timetable-cell .teacher-name { color: var(--primary-light); font-size: 11px; font-weight: 600; margin-top: 4px; display: flex; align-items: center; gap: 4px; }
.timetable-cell .cell-meta { font-size: 10px; color: var(--text-muted); margin-top: 4px; }
.timetable-cell .cell-actions { position: absolute; top: 4px; right: 4px; display: none; gap: 2px; }
.timetable-cell:hover .cell-actions { display: flex; }
.timetable-cell .cell-action-btn { background: rgba(255,255,255,0.9); border: none; border-radius: 3px; padding: 3px 5px; font-size: 10px; cursor: pointer; color: #4a5568; }
.timetable-cell .cell-action-btn:hover { background: #fee2e2; color: #dc2626; }
.timetable-grid td.off-slot { background: #f1f5f9; border-radius: 6px; text-align: center; vertical-align: middle; color: #94a3b8; font-size: 11px; font-weight: 600; }

/* --- 16. Modals & Forms (Universal Dialog Engine) --- */
#globalModal {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(15, 23, 42, 0.65) !important;
    backdrop-filter: blur(3px) !important;
    -webkit-backdrop-filter: blur(3px) !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    z-index: 10002 !important;
    padding: 16px !important;
    overflow-y: auto !important;
}

#globalModal > div,
.academic-modal {
    max-width: min(650px, calc(100vw - 24px)) !important;
    width: 100% !important;
    max-height: calc(100vh - 32px) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    border-radius: var(--radius-md) !important;
    box-sizing: border-box !important;
    box-shadow: var(--shadow-lg) !important;
}

.academic-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 13px;
}

.academic-form .full { grid-column: 1 / -1; }
.academic-form label { display: block; font-size: 12px; font-weight: 700; color: #4a5568; margin-bottom: 5px; }
.academic-form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* Auth Gate */
.auth-gate {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: #f5f6fa;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-gate[hidden] { display: none; }

/* ==========================================================================
   MEDIA QUERIES - RESPONSIVE BREAKPOINTS
   ========================================================================== */

/* --- Tablet / Large Devices (max-width: 1200px) --- */
@media (max-width: 1200px) {
    .quick-actions-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* --- Tablet Devices (max-width: 992px) --- */
@media (max-width: 992px) {
    /* Mobile Drawer Sidebar Navigation */
    .sidebar-backdrop {
        display: block;
    }

    .sidebar {
        width: 270px;
        max-width: 84vw;
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        height: 100vh;
        z-index: 9999;
        transform: translateX(-100%);
        box-shadow: none;
        padding-top: 0;
    }

    .sidebar.sidebar-open {
        transform: translateX(0);
        box-shadow: 0 0 35px rgba(0, 0, 0, 0.45);
    }

    .sidebar-header {
        padding: 18px 18px 14px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.12);
        margin-bottom: 10px;
    }

    .sidebar-close-btn {
        display: flex;
        background: rgba(255, 255, 255, 0.12);
        border: none;
        color: white;
        width: 34px;
        height: 34px;
        border-radius: 50%;
        font-size: 16px;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: 0.18s ease;
    }

    .sidebar-close-btn:hover {
        background: rgba(255, 255, 255, 0.25);
    }

    .sidebar-illustration {
        display: none;
    }

    .nav-menu {
        max-height: calc(100vh - 85px);
        padding-left: 8px;
        padding-right: 8px;
    }

    .nav-item {
        padding: 12px 16px;
        border-radius: 8px;
    }

    .nav-item:hover, .nav-item.active {
        border-radius: 8px;
    }

    /* Main Content Adjustments */
    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 16px 20px;
    }

    /* Header adjustments */
    .top-header {
        position: sticky;
        top: 8px;
        margin-bottom: 18px;
        padding: 10px 16px;
    }

    .menu-toggle-btn {
        display: inline-flex;
    }

    /* Grids & Cards */
    .dash-hero-container {
        padding: 20px;
    }

    .dash-kpi-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
    }

    .dash-summary-row {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .quick-actions-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 12px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
    }

    .bottom-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .academic-summary {
        grid-template-columns: repeat(2, 1fr);
    }

    .exam-stat-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .student-profile-layout {
        grid-template-columns: 1fr;
    }
}

/* --- Phablet / Small Tablet (max-width: 768px) --- */
@media (max-width: 768px) {
    .main-content {
        padding: 14px 16px;
    }

    .logo-text {
        font-size: 20px;
    }

    .quick-actions-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }

    .action-card {
        padding: 12px 8px;
        min-height: 75px;
    }

    .action-card i {
        font-size: 22px;
        margin-bottom: 6px;
    }

    .action-card p {
        font-size: 11px;
    }

    .academic-hero,
    .academic-section-heading {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .academic-toolbar select {
        flex: 1;
    }

    .staff-toolbar {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
    }

    .staff-filters span {
        margin-left: 0 !important;
    }

    .student-profile-search-form {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .student-profile-search-form button {
        width: 100%;
        justify-content: center;
    }

    .profile-form-grid-3 {
        grid-template-columns: 1fr;
    }

    .panel-card {
        padding: 16px 14px;
        border-radius: var(--radius-sm);
    }

    .panel-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}

/* --- Mobile Phone (max-width: 576px) --- */
@media (max-width: 576px) {
    .main-content {
        padding: 10px 12px;
    }

    .top-header {
        padding: 8px 12px;
        margin-bottom: 14px;
        top: 6px;
    }

    .logo-text {
        font-size: 18px;
    }

    .lms-page-header,
    .academic-hero,
    .dash-hero-container {
        padding: 16px;
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
    }

    .dash-actions-bar {
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 4px;
    }

    .dash-kpi-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .dash-metrics-triple {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .dash-metric-col:not(:last-child) {
        border-right: none;
        border-bottom: 1px solid #e2e8f0;
        padding-bottom: 8px;
    }

    .quick-actions-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .action-card {
        padding: 12px 6px;
        min-height: 72px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .stat-card {
        padding: 14px 12px;
        display: flex;
        align-items: center;
        gap: 14px;
        text-align: left;
    }

    .stat-card i {
        font-size: 28px;
        margin-bottom: 0;
    }

    .stat-card h2 {
        font-size: 20px;
    }

    .academic-summary {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .exam-stat-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .academic-form {
        grid-template-columns: 1fr;
    }

    .academic-form .full {
        grid-column: auto;
    }

    .profile-form-grid-2 {
        grid-template-columns: 1fr;
    }

    .fee-ledger-header,
    .fee-ledger-stats {
        grid-template-columns: 1fr !important;
    }

    /* Modal Form Rows Stacking */
    #globalModal form div[style*="display:flex"]:not(.modal-actions):not(.academic-form-actions):not([style*="justify-content: flex-end"]):not([style*="justify-content:flex-end"]):not([style*="justify-content:space-between"]):not([style*="justify-content: space-between"]) {
        flex-direction: column !important;
        gap: 8px !important;
    }

    #globalModal form div[style*="display:flex"] > div {
        width: 100% !important;
    }

    .academic-form-actions {
        flex-direction: column-reverse;
    }

    .academic-form-actions button,
    .academic-button {
        width: 100%;
        justify-content: center;
    }

    .academic-search {
        min-width: 100%;
    }

    .calendar-days {
        gap: 4px;
        font-size: 10px;
    }

    .day-cell {
        padding: 6px 2px;
    }

    .notice-item {
        padding: 12px;
    }

    .notice-item h4 {
        font-size: 13.5px;
    }

    .notice-item p {
        font-size: 11.5px;
    }
}

/* --- Extra Small Devices (max-width: 360px) --- */
@media (max-width: 360px) {
    .quick-actions-grid {
        grid-template-columns: 1fr;
    }
}

/* --- Official Print Stylesheet --- */
@media print {
    body {
        background: #fff !important;
        color: #000 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    .sidebar, .top-header, .academic-tabs, .action-buttons, .no-print, #globalModal {
        display: none !important;
    }
    .main-content {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
    }
}
