/* =====================================================
   ND International School Dinod - Yellow Theme
   Primary: #F5A623 (Yellow/Gold)
   Supporting: White, Dark Gray, Light Gray
   ===================================================== */

:root {
    /* Brand gold — kept as the school's identity, tuned for a premium feel */
    --primary: #F5A623;
    --primary-dark: #C87F0A;
    --primary-light: #FEF3DA;
    --primary-hover: #E5980F;
    /* Refined slate secondary (was flat blue-gray) */
    --secondary: #1E293B;
    --secondary-dark: #0F172A;
    --secondary-light: #334155;
    --accent: #E67E22;
    --success: #16A34A;
    --info: #0EA5E9;
    --warning: #F59E0B;
    --danger: #EF4444;
    --dark: #0F172A;
    --light: #F8FAFC;
    /* Neutral scale → cool slate tones (more professional than warm grays) */
    --gray-100: #F1F5F9;
    --gray-200: #E2E8F0;
    --gray-300: #CBD5E1;
    --gray-400: #94A3B8;
    --gray-500: #64748B;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1E293B;
    --gray-900: #0F172A;
    --white: #FFFFFF;
    --sidebar-width: 260px;
    --header-height: 62px;
    --body-bg: #F4F6FB;
    --card-bg: #FFFFFF;
    --text-primary: #1E293B;
    --text-secondary: #64748B;
    --border-color: #E9EDF3;
    /* Layered "elevation" shadows for depth without heaviness */
    --shadow: 0 1px 2px rgba(15,23,42,.04), 0 6px 18px rgba(15,23,42,.06);
    --shadow-sm: 0 1px 2px rgba(15,23,42,.06);
    --shadow-lg: 0 12px 34px rgba(15,23,42,.12);
    --radius: 10px;
    --radius-sm: 6px;
    --radius-lg: 14px;
    --transition: all .18s ease;
    --font-sans: 'Inter', 'Segoe UI', Roboto, -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ===== GLOBAL STYLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background-color: var(--body-bg);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: -0.01em;
}

a {
    color: var(--primary-dark);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary);
}

h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    font-weight: 600;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--gray-200);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-400);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-500);
}

/* ===== SIDEBAR ===== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, var(--secondary-dark) 0%, var(--secondary) 100%);
    color: var(--white);
    z-index: 1040;
    overflow-y: auto;
    overflow-x: hidden;
    /* Wheel-scroll works with the cursor anywhere on the sidebar, and the
       scroll stays inside it (never leaks to the page behind). */
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(245,166,35,0.6) transparent;
    transition: var(--transition);
}
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb {
    background: rgba(245,166,35,0.55);
    border-radius: 8px;
}
.sidebar::-webkit-scrollbar-thumb:hover { background: rgba(245,166,35,0.85); }

.sidebar-brand {
    padding: 15px 20px;
    background: rgba(0,0,0,0.15);
    border-bottom: 1px solid rgba(245,166,35,0.3);
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: var(--header-height);
}

.sidebar-brand img {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 2px solid var(--primary);
}

.sidebar-brand h5 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--white);
    line-height: 1.3;
}

.sidebar-brand small {
    font-size: 11px;
    color: var(--primary);
    display: block;
}

.sidebar-nav {
    padding: 10px 0;
}

.sidebar-nav .nav-section {
    padding: 10px 20px 5px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.4);
    font-weight: 600;
}

.sidebar-nav .nav-item {
    padding: 0 10px;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 15px;
    color: rgba(255,255,255,0.75);
    border-radius: var(--radius);
    transition: var(--transition);
    font-size: 13.5px;
    font-weight: 500;
    margin-bottom: 2px;
}

.sidebar-nav .nav-link:hover {
    color: var(--white);
    background: rgba(245,166,35,0.15);
}

.sidebar-nav .nav-link.active {
    color: var(--white);
    background: var(--primary);
    box-shadow: 0 2px 8px rgba(245,166,35,0.4);
}

.sidebar-nav .nav-link i {
    width: 20px;
    text-align: center;
    font-size: 15px;
}

.sidebar-nav .nav-link .submenu-arrow {
    margin-left: auto;
    transition: var(--transition);
    font-size: 12px;
}

.sidebar-nav .nav-link[aria-expanded="true"] .submenu-arrow {
    transform: rotate(90deg);
}

.sidebar-nav .nav-group-toggle {
    cursor: pointer;
}

/* Parent of the currently-open section gets a subtle highlight */
.sidebar-nav .nav-link.active-parent {
    color: var(--white);
    background: rgba(245,166,35,0.12);
}

/* Collapsible section — hidden until its group is opened (.show) */
.sidebar-nav .submenu {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.sidebar-nav .submenu.show {
    /* Large enough for the longest section (Finance ~20 items) */
    /* Longest section (Finance ~20 items) + the taller proui item styling —
       900px clipped the tail (Reconciliation ke niche wale options hide the) */
    max-height: 2000px;
}

.sidebar-nav .submenu .nav-item {
    padding: 0 10px;
}

.sidebar-nav .submenu .nav-link {
    padding: 8px 15px 8px 42px;
    font-size: 13px;
}

.sidebar-nav .submenu .nav-link.active {
    background: rgba(245,166,35,0.2);
    color: var(--primary);
}

/* Session badge in sidebar */
.sidebar-session {
    margin: 10px 15px;
    padding: 8px 12px;
    background: rgba(245,166,35,0.15);
    border-radius: var(--radius);
    border-left: 3px solid var(--primary);
    font-size: 12px;
}

.sidebar-session .label {
    color: rgba(255,255,255,0.5);
    display: block;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-session .value {
    color: var(--primary);
    font-weight: 600;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: var(--transition);
}

/* ===== HEADER ===== */
.top-header {
    position: sticky;
    top: 0;
    z-index: 1030;
    height: var(--header-height);
    background: var(--white);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 25px;
    box-shadow: var(--shadow-sm);
}

.top-header .header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.top-header .header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.sidebar-toggle {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 5px;
    display: none;
}

.header-search {
    position: relative;
}

.header-search input {
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 6px 15px 6px 35px;
    width: 250px;
    font-size: 13px;
    background: var(--gray-100);
    transition: var(--transition);
}

.header-search input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(245,166,35,0.15);
    background: var(--white);
    outline: none;
}

.header-search i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-500);
    font-size: 13px;
}

.header-icon-btn {
    position: relative;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
}

.header-icon-btn:hover {
    background: var(--gray-100);
    color: var(--primary);
}

.header-icon-btn .badge {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--danger);
    color: white;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--white);
}

.header-user {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: var(--radius);
    transition: var(--transition);
}

.header-user:hover {
    background: var(--gray-100);
}

.header-user img,
.header-user .user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--primary);
    object-fit: cover;
    background: var(--primary-light);
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.header-user .user-info {
    line-height: 1.2;
}

.header-user .user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.header-user .user-role {
    font-size: 11px;
    color: var(--text-secondary);
}

/* Dark mode toggle */
.dark-mode-toggle {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 16px;
    padding: 6px 10px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
}

.dark-mode-toggle:hover {
    background: var(--primary-light);
    color: var(--primary-dark);
    border-color: var(--primary);
}

/* ===== PAGE CONTENT ===== */
.page-content {
    padding: 25px;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.page-header h4 {
    font-size: 22px;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.page-header h4 i {
    color: var(--primary);
}

.page-breadcrumb {
    font-size: 13px;
    color: var(--text-secondary);
}

.page-breadcrumb a {
    color: var(--primary-dark);
}

.page-breadcrumb .separator {
    margin: 0 5px;
}

/* ===== CARDS ===== */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    margin-bottom: 20px;
    border: none;
}

.card:hover {
    box-shadow: var(--shadow);
}

.card-header {
    background: var(--white);
    border-bottom: 1px solid var(--border-color);
    padding: 15px 20px;
    border-radius: var(--radius) var(--radius) 0 0 !important;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h6 {
    margin: 0;
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
}

.card-body {
    padding: 20px;
}

/* Stats cards */
.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    border-left: 4px solid var(--primary);
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: -20px;
    right: -20px;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(245,166,35,0.08);
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin-bottom: 12px;
}

.stat-card .stat-icon.bg-primary-custom {
    background: var(--primary-light);
    color: var(--primary-dark);
}

.stat-card .stat-icon.bg-success-custom {
    background: rgba(39,174,96,0.12);
    color: var(--success);
}

.stat-card .stat-icon.bg-info-custom {
    background: rgba(52,152,219,0.12);
    color: var(--info);
}

.stat-card .stat-icon.bg-danger-custom {
    background: rgba(231,76,60,0.12);
    color: var(--danger);
}

.stat-card .stat-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 4px;
}

.stat-card .stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== BUTTONS ===== */
.btn-primary-custom {
    background-color: var(--primary) !important;
    border-color: var(--primary) !important;
    color: var(--white) !important;
    font-weight: 500;
    border-radius: var(--radius-sm);
    padding: 8px 20px;
    font-size: 13px;
    transition: var(--transition);
}

.btn-primary-custom:hover {
    background-color: var(--primary-dark) !important;
    border-color: var(--primary-dark) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(245,166,35,0.3);
}

.btn-outline-primary-custom {
    border-color: var(--primary) !important;
    color: var(--primary) !important;
    font-weight: 500;
    border-radius: var(--radius-sm);
    padding: 8px 20px;
    font-size: 13px;
}

.btn-outline-primary-custom:hover {
    background-color: var(--primary) !important;
    color: var(--white) !important;
}

.btn-secondary-custom {
    background-color: var(--secondary) !important;
    border-color: var(--secondary) !important;
    color: var(--white) !important;
    font-weight: 500;
    border-radius: var(--radius-sm);
}

.btn-secondary-custom:hover {
    background-color: var(--secondary-dark) !important;
    border-color: var(--secondary-dark) !important;
}

.btn-success-custom {
    background-color: var(--success) !important;
    border-color: var(--success) !important;
}

.btn-danger-custom {
    background-color: var(--danger) !important;
    border-color: var(--danger) !important;
}

.btn-info-custom {
    background-color: var(--info) !important;
    border-color: var(--info) !important;
    color: var(--white) !important;
}

/* ===== TABLES ===== */
.table-custom {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
}

.table-custom thead th {
    background: var(--gray-100);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 15px;
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

.table-custom tbody td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
    vertical-align: middle;
}

.table-custom tbody tr:hover {
    background: rgba(245,166,35,0.04);
}

.table-custom .action-btns {
    display: flex;
    gap: 5px;
    flex-wrap: nowrap;
}

.table-custom .action-btns .btn {
    padding: 4px 8px;
    font-size: 12px;
}

/* ===== FORMS ===== */
.form-control,
.form-select {
    border-color: var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 13px;
    padding: 8px 12px;
    transition: var(--transition);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(245,166,35,0.15);
}

.form-label {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.input-group-text {
    background-color: var(--gray-100);
    border-color: var(--border-color);
    font-size: 13px;
}

/* ===== BADGES ===== */
.badge-primary-custom {
    background-color: rgba(245,166,35,0.15);
    color: var(--primary-dark);
    font-weight: 600;
    font-size: 11px;
    padding: 5px 10px;
    border-radius: 20px;
}

.badge-success-custom {
    background-color: rgba(39,174,96,0.12);
    color: var(--success);
    font-weight: 600;
    font-size: 11px;
    padding: 5px 10px;
    border-radius: 20px;
}

.badge-danger-custom {
    background-color: rgba(231,76,60,0.12);
    color: var(--danger);
    font-weight: 600;
    font-size: 11px;
    padding: 5px 10px;
    border-radius: 20px;
}

.badge-info-custom {
    background-color: rgba(52,152,219,0.12);
    color: var(--info);
    font-weight: 600;
    font-size: 11px;
    padding: 5px 10px;
    border-radius: 20px;
}

.badge-warning-custom {
    background-color: rgba(243,156,18,0.12);
    color: var(--warning);
    font-weight: 600;
    font-size: 11px;
    padding: 5px 10px;
    border-radius: 20px;
}

.badge-secondary-custom {
    background-color: rgba(108,117,125,0.12);
    color: var(--gray-600);
    font-weight: 600;
    font-size: 11px;
    padding: 5px 10px;
    border-radius: 20px;
}

/* ===== ALERTS / FLASH MESSAGES ===== */
.alert {
    border-radius: var(--radius);
    font-size: 13px;
    border: none;
    padding: 12px 20px;
}

.alert-success {
    background: rgba(39,174,96,0.1);
    color: var(--success);
    border-left: 4px solid var(--success);
}

.alert-danger {
    background: rgba(231,76,60,0.1);
    color: var(--danger);
    border-left: 4px solid var(--danger);
}

.alert-warning {
    background: rgba(243,156,18,0.1);
    color: var(--warning);
    border-left: 4px solid var(--warning);
}

.alert-info {
    background: rgba(52,152,219,0.1);
    color: var(--info);
    border-left: 4px solid var(--info);
}

/* ===== PAGINATION ===== */
.pagination .page-link {
    color: var(--text-primary);
    border-color: var(--border-color);
    font-size: 13px;
    padding: 6px 12px;
}

.pagination .page-item.active .page-link {
    background-color: var(--primary);
    border-color: var(--primary);
    color: var(--white);
}

.pagination .page-link:hover {
    background-color: var(--primary-light);
    color: var(--primary-dark);
}

/* ===== LOGIN PAGE ===== */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--secondary-dark) 0%, var(--secondary) 50%, var(--primary-dark) 100%);
    position: relative;
    overflow: hidden;
}

.login-wrapper::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(245,166,35,0.08) 0%, transparent 50%);
    animation: pulse 4s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.login-card {
    width: 420px;
    max-width: 95%;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    position: relative;
    z-index: 1;
    overflow: hidden;
}

.login-card .login-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 30px;
    text-align: center;
    color: var(--white);
}

.login-card .login-header img {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: 3px solid rgba(255,255,255,0.5);
    margin-bottom: 15px;
    background: rgba(255,255,255,0.2);
    padding: 5px;
}

.login-card .login-header h4 {
    color: var(--white);
    font-weight: 700;
    margin-bottom: 5px;
}

.login-card .login-header p {
    opacity: 0.9;
    font-size: 13px;
    margin: 0;
}

.login-card .login-body {
    padding: 30px;
}

.login-card .form-group {
    margin-bottom: 20px;
}

.login-card .form-control {
    padding: 12px 15px;
    font-size: 14px;
    border-radius: var(--radius);
}

.login-card .btn-login {
    width: 100%;
    padding: 12px;
    font-size: 15px;
    font-weight: 600;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border: none;
    color: var(--white);
    border-radius: var(--radius);
    transition: var(--transition);
}

.login-card .btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(245,166,35,0.4);
}

.login-card .login-footer {
    text-align: center;
    padding: 15px 30px 25px;
    font-size: 12px;
    color: var(--text-secondary);
}

/* ===== FOOTER ===== */
.main-footer {
    padding: 15px 25px;
    background: var(--white);
    border-top: 1px solid var(--border-color);
    text-align: center;
    font-size: 12px;
    color: var(--text-secondary);
}

/* ===== AVATAR ===== */
.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary-dark);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.avatar-sm {
    width: 28px;
    height: 28px;
    font-size: 11px;
}

.avatar-lg {
    width: 48px;
    height: 48px;
    font-size: 18px;
}

/* ===== MODAL ===== */
.modal-content {
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

.modal-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--white);
    border-radius: var(--radius) var(--radius) 0 0;
}

.modal-header .btn-close {
    filter: brightness(0) invert(1);
}

/* ===== PRINT STYLES ===== */
@media print {
    /* Normal A4, aur browser ka apna header/footer (URL + date/time) print pe nahi
       aata (@page margin 0 => wo jagah hi na do). Hashiya .page-content padding se.
       (Ashish, 2026-08-04) */
    @page { size: A4 portrait; margin: 0 !important; }

    /* Content page se bahar na jaye — kuch bhi horizontal overflow na kare, tables
       page ki chaudai me hi rahein/wrap karein. */
    html, body { width: 100% !important; max-width: 100% !important; overflow-x: hidden !important; }
    .page-content, .card, .card-body, .table-responsive { overflow: visible !important; max-width: 100% !important; }
    table { max-width: 100% !important; width: 100% !important; }
    td, th { word-wrap: break-word !important; overflow-wrap: anywhere !important; }
    img { max-width: 100% !important; height: auto !important; }

    .sidebar,
    .top-header,
    .main-footer,
    .no-print,
    .btn {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
    }

    .page-content {
        padding: 12mm 10mm !important;   /* @page margin ab 0 hai, isliye yahan hashiya do */
    }

    .card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }

    body {
        background: white;
    }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .sidebar-toggle {
        display: block;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 1035;
    }

    .sidebar-overlay.show {
        display: block;
    }

    /* ===== Mobile top bar (whenever the sidebar is a hamburger) =====
       Some phone WebViews lay the page out at ~980px, so these must trigger
       at the same 991px breakpoint as the hamburger — not only at 767px —
       otherwise the search box keeps the top bar wider than the screen and
       the whole page scrolls sideways. */
    .header-search { display: none !important; }

    .top-header { padding: 0 8px; gap: 6px; }
    .top-header .header-left { gap: 4px; min-width: 0; flex: 1 1 auto; overflow: hidden; }
    .top-header .header-right { gap: 2px; flex: 0 0 auto; }

    .sidebar-toggle,
    .header-icon-btn,
    .dark-mode-toggle,
    #globalBackBtn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        padding: 0 !important;
        margin: 0 !important;
        border-radius: 8px;
        font-size: 18px;
    }
    .sidebar-toggle { font-size: 20px; }

    #globalBackBtn span { display: none; }
    .header-user .fa-chevron-down { display: none; }
    .header-user { padding: 4px; gap: 6px; }

    /* Safety net: never let the page scroll sideways on small/WebView layouts.
       overflow-x: clip hides horizontal overflow without breaking the sticky
       top bar (unlike overflow-x: hidden, which can). */
    html, body { overflow-x: clip; max-width: 100%; }
    .main-content, .page-content { max-width: 100%; overflow-x: clip; }
}

@media (max-width: 767.98px) {
    .page-content {
        padding: 15px;
    }

    .page-header {
        margin-bottom: 15px;
    }

    .page-header h4 {
        font-size: 18px;
    }

    .stat-card {
        padding: 15px;
    }

    .stat-card .stat-value {
        font-size: 22px;
    }

    .header-search {
        display: none;
    }

    .table-responsive {
        font-size: 12px;
    }

    /* Page headers: let title + action buttons stack instead of overflowing */
    .page-header {
        flex-wrap: wrap;
        gap: 10px;
    }

    /* ===== Mobile top bar: clean, tap-friendly, never overflows ===== */
    .top-header { padding: 0 8px; gap: 6px; }
    .top-header .header-left { gap: 4px; min-width: 0; flex: 1 1 auto; overflow: hidden; }
    .top-header .header-right { gap: 2px; flex: 0 0 auto; }

    /* Every control an even 40x40 tap target, centered icon */
    .sidebar-toggle,
    .header-icon-btn,
    .dark-mode-toggle,
    #globalBackBtn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        padding: 0 !important;
        margin: 0 !important;
        border-radius: 8px;
        font-size: 18px;
    }
    .sidebar-toggle { font-size: 20px; }

    /* Drop the extra labels/carets that only crowd a phone bar */
    #globalBackBtn span { display: none; }
    .header-user .fa-chevron-down { display: none; }
    .header-user { padding: 4px; gap: 6px; }

    /* Comfortable card padding */
    .card-body { padding: 15px; }

    /* Modals fit small screens */
    .modal-dialog { margin: 10px; }

    /* Avoid oversized zoom-on-focus for inputs on iOS while staying legible */
    .form-control, .form-select { font-size: 14px; }
}

/* Extra-small phones */
@media (max-width: 575.98px) {
    :root { --header-height: 56px; }

    .page-content { padding: 12px; }
    .page-header h4 { font-size: 16px; }
    .stat-card .stat-value { font-size: 20px; }
    .btn, .btn-sm { font-size: 12.5px; }

    /* Action group under the page title spans full width */
    .page-header > .d-flex,
    .page-header .btn { flex: 1 1 auto; }

    /* Give the off-canvas drawer a little breathing room */
    .sidebar { width: 84%; max-width: 300px; }

    /* Hide the secondary user text, keep the avatar */
    .top-header .user-info { display: none !important; }
}

/* Long, scrollable tables everywhere: ensure horizontal scroll instead of breaking layout */
.table-responsive { -webkit-overflow-scrolling: touch; }

/* ===== UTILITY CLASSES ===== */
.text-primary-custom { color: var(--primary) !important; }
.text-secondary-custom { color: var(--secondary) !important; }
.bg-primary-custom { background-color: var(--primary) !important; }
.bg-primary-light-custom { background-color: var(--primary-light) !important; }
.border-primary-custom { border-color: var(--primary) !important; }
.fw-semibold { font-weight: 600 !important; }

/* Tab custom */
.nav-tabs-custom .nav-link {
    color: var(--text-secondary);
    font-weight: 500;
    border: none;
    padding: 10px 20px;
}

.nav-tabs-custom .nav-link.active {
    color: var(--primary-dark);
    border-bottom: 3px solid var(--primary);
    background: transparent;
}

.nav-tabs-custom .nav-link:hover {
    color: var(--primary);
}

/* Chart container */
.chart-container {
    position: relative;
    height: 300px;
}

/* Student photo */
.student-photo {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-light);
}

/* Dropdown */
.dropdown-menu {
    border: none;
    box-shadow: var(--shadow);
    border-radius: var(--radius);
    font-size: 13px;
}

.dropdown-item:hover {
    background: var(--primary-light);
    color: var(--primary-dark);
}

/* Timeline */
.timeline-item {
    position: relative;
    padding-left: 30px;
    margin-bottom: 20px;
    border-left: 2px solid var(--border-color);
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 5px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid var(--white);
}

/* Quick action buttons */
.quick-actions .btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 15px;
    border-radius: var(--radius);
    transition: var(--transition);
    font-size: 12px;
    font-weight: 500;
    min-width: 90px;
}

.quick-actions .btn i {
    font-size: 20px;
}

.quick-actions .btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

/* Fee receipt print layout */
.receipt-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 30px;
    border: 2px solid var(--primary);
    border-radius: var(--radius);
}

.receipt-header {
    text-align: center;
    padding-bottom: 15px;
    border-bottom: 2px dashed var(--border-color);
    margin-bottom: 20px;
}

.receipt-body table {
    width: 100%;
}

.receipt-body td {
    padding: 5px 10px;
    font-size: 13px;
}

.receipt-footer {
    margin-top: 30px;
    padding-top: 15px;
    border-top: 2px dashed var(--border-color);
    display: flex;
    justify-content: space-between;
}

/* ID Card */
.id-card {
    width: 320px;
    border: 2px solid var(--primary);
    border-radius: var(--radius);
    overflow: hidden;
}

.id-card-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    text-align: center;
    padding: 10px;
}

.id-card-body {
    padding: 15px;
    text-align: center;
}

.id-card-body img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid var(--primary);
    object-fit: cover;
    margin-bottom: 10px;
}

.id-card-body table {
    text-align: left;
    font-size: 12px;
    width: 100%;
}

.id-card-body table td {
    padding: 3px 5px;
}

.id-card-footer {
    background: var(--secondary);
    color: white;
    text-align: center;
    padding: 8px;
    font-size: 10px;
}

/* ═══════════════════════════════════════════════════════════════
   PROFESSIONAL POLISH (2026-07-19) — refined design system.
   Placed last so it enhances existing components via the cascade,
   using the tokens above; no HTML/structure changes needed.
   ═══════════════════════════════════════════════════════════════ */

/* Headings: tighter, more confident */
h1,h2,h3,h4,h5,h6 { font-weight: 700; letter-spacing: -0.02em; color: var(--text-primary); }

/* Cards — crisp border + soft elevation, gentle hover lift */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: box-shadow .2s ease, transform .2s ease;
}
.card:hover { box-shadow: var(--shadow); }
.card .card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    padding: 14px 18px;
    letter-spacing: -0.01em;
}
.card .card-body { padding: 18px; }

/* Buttons — balanced padding, medium weight, subtle motion */
.btn {
    border-radius: var(--radius);
    font-weight: 600;
    letter-spacing: -0.01em;
    padding: 8px 16px;
    transition: var(--transition);
    box-shadow: none;
}
.btn-sm { padding: 5px 12px; border-radius: var(--radius-sm); }
.btn:active { transform: translateY(1px); }
.btn-primary, .btn-primary-custom {
    background: var(--primary);
    border-color: var(--primary);
    color: #3d2c05;
    box-shadow: 0 2px 8px rgba(245,166,35,.30);
}
.btn-primary:hover, .btn-primary-custom:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    color: #3d2c05;
    box-shadow: 0 4px 14px rgba(245,166,35,.38);
}
.btn-outline-secondary { border-color: var(--gray-300); color: var(--gray-700); }
.btn-outline-secondary:hover { background: var(--gray-100); color: var(--gray-900); border-color: var(--gray-400); }

/* Tables — airy, quiet header, clean row hover */
.table { color: var(--text-primary); }
.table > thead th, .table-light > tr > th, thead.table-light th {
    background: var(--gray-100);
    color: var(--gray-600);
    font-weight: 600;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: .04em;
    border-bottom: 1px solid var(--border-color);
    padding: 11px 12px;
    white-space: nowrap;
}
.table > tbody > tr { transition: background .12s ease; }
.table-hover > tbody > tr:hover > * { background: #F8FAFF; }
.table > :not(caption) > * > * { border-bottom-color: var(--border-color); }

/* Badges — pill, softer */
.badge { font-weight: 600; letter-spacing: .01em; padding: .4em .7em; border-radius: 20px; }

/* Form controls — refined focus ring in brand gold */
.form-control, .form-select {
    border-radius: var(--radius);
    border: 1px solid var(--gray-300);
    padding: 9px 12px;
    color: var(--text-primary);
    transition: border-color .15s ease, box-shadow .15s ease;
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(245,166,35,.18);
}
.form-label { font-weight: 600; font-size: 13px; color: var(--gray-700); margin-bottom: 5px; }

/* Page header — clearer hierarchy */
.page-header { margin-bottom: 22px; }
.page-header h4 { font-weight: 700; letter-spacing: -0.02em; }

/* Stat cards — premium, accent bar, hover lift */
.stat-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: transform .2s ease, box-shadow .2s ease;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.stat-card .stat-value { font-weight: 800; letter-spacing: -0.03em; color: var(--text-primary); }
.stat-card .stat-label { color: var(--text-secondary); font-weight: 500; }

/* ===== SIDEBAR — DARK SLATE + GOLD (global-standard, user approved) =====
   Structure/dropdowns UNTOUCHED — look only. */
.sidebar {
    background: linear-gradient(180deg, #0F172A 0%, #16203A 55%, #1E293B 100%) !important;
    color: #CBD5E1 !important;
    border-right: 1px solid rgba(255,255,255,.06);
}
.sidebar-brand {
    background: rgba(255,255,255,.04) !important;
    border-bottom: 1px solid rgba(255,255,255,.08) !important;
}
.sidebar-brand h5 { color: #F8FAFC !important; }
.sidebar-brand small { color: #94A3B8 !important; }
.sidebar-nav .nav-section { color: #64748B !important; letter-spacing: .08em; }
.sidebar-nav .nav-link {
    border-radius: 12px;
    margin: 3px 10px;
    color: #CBD5E1 !important;
    transition: all .2s ease;
}
.sidebar-nav .nav-link:hover {
    background: rgba(255,255,255,.07);
    color: #FFFFFF !important;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}
/* Active = glowing GOLD pill (brand color pops on the dark slate) */
.sidebar-nav .nav-link.active {
    background: linear-gradient(135deg, #F7B733 0%, #E0921A 100%);
    color: #241800 !important;
    font-weight: 700;
    box-shadow: 0 0 18px rgba(245,166,35,.45), 0 8px 20px rgba(245,166,35,.28);
    transform: translateX(2px);
}
.sidebar-nav .nav-link.active i,
.sidebar-nav .nav-link.active span { color: #241800 !important; }
.sidebar-nav .nav-link.active-parent { color: #FBBF24 !important; }
.sidebar-nav .nav-link.active-parent i { color: #FBBF24 !important; }
/* Icon chips — subtle dark square, gold icon */
.sidebar-nav .nav-link > i:first-child {
    width: 30px; height: 30px; line-height: 30px; text-align: center;
    border-radius: 9px; background: rgba(255,255,255,.06); color: #F5A623; margin-right: 4px;
    transition: all .2s ease;
}
.sidebar-nav .nav-link:hover > i:first-child { background: rgba(255,255,255,.12); color: #FBBF24; }
.sidebar-nav .nav-link.active > i:first-child { background: rgba(0,0,0,.16); color: #241800; }
/* Submenu (dropdown) items — darker inset, gold active, structure intact */
.sidebar-nav .submenu { background: rgba(0,0,0,.22); border-radius: 12px; margin: 2px 10px; }
.sidebar-nav .submenu .nav-link { margin: 2px 6px; font-size: 13px; color: #B6C2D1 !important; }
.sidebar-nav .submenu .nav-link.active { color: #241800 !important; background: linear-gradient(135deg,#F7B733,#E0921A); box-shadow: 0 4px 14px rgba(245,166,35,.3); }
.sidebar-session {
    background: rgba(255,255,255,.05) !important;
    border-left: 3px solid #F5A623 !important;
    border-radius: 10px;
}
.sidebar-session .label { color: #94A3B8 !important; }
.sidebar-session .value { color: #F8FAFC !important; }
.sidebar-nav .submenu-arrow { color: #94A3B8 !important; }

/* Dropdowns / modals — softer, elevated */
.dropdown-menu { border: 1px solid var(--border-color); border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.modal-content { border: none; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }

/* Alerts — flat, modern */
.alert { border: 1px solid transparent; border-radius: var(--radius); font-size: 13.5px; }

/* ============================================================
   MODERN DASHBOARD 2050 — tie content to the sky-blue sidebar
   (visual only; no data/logic touched)
   ============================================================ */

/* Clean neutral light wash behind the content (pairs with the dark slate sidebar) */
body { background: linear-gradient(180deg, #EEF1F7 0%, #F4F6FB 340px) !important; }

/* Stat cards — glassy, floating, with a sky top-accent bar */
.stat-card {
    background: rgba(255,255,255,0.92) !important;
    backdrop-filter: blur(6px);
    border-radius: 16px !important;
    border-left: none !important;
    border: 1px solid rgba(15,23,42,0.07) !important;
    box-shadow: 0 6px 22px rgba(15,23,42,0.07), 0 1px 3px rgba(15,23,42,0.05) !important;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, #F7B733, #E0921A);
    opacity: 0.9;
}
.stat-card:hover {
    transform: translateY(-5px) !important;
    box-shadow: 0 16px 38px rgba(15,23,42,0.13), 0 2px 6px rgba(15,23,42,0.06) !important;
    border-color: rgba(245,166,35,0.35) !important;
}

/* Icon chips — vibrant gradients + colored glow (the big visible change) */
.stat-card .stat-icon {
    width: 52px; height: 52px;
    border-radius: 14px !important;
    color: #fff !important;
    font-size: 22px;
    box-shadow: 0 8px 18px rgba(0,0,0,0.14);
}
.stat-card .stat-icon.bg-primary-custom {
    background: linear-gradient(135deg, #F7B733 0%, #E0921A 100%) !important;
    color: #fff !important; box-shadow: 0 8px 20px rgba(245,166,35,0.42);
}
.stat-card .stat-icon.bg-success-custom {
    background: linear-gradient(135deg, #34D399 0%, #059669 100%) !important;
    color: #fff !important; box-shadow: 0 8px 20px rgba(5,150,105,0.38);
}
.stat-card .stat-icon.bg-info-custom {
    background: linear-gradient(135deg, #38BDF8 0%, #0284C7 100%) !important;
    color: #fff !important; box-shadow: 0 8px 20px rgba(2,132,199,0.40);
}
.stat-card .stat-icon.bg-danger-custom {
    background: linear-gradient(135deg, #FB7185 0%, #E11D48 100%) !important;
    color: #fff !important; box-shadow: 0 8px 20px rgba(225,29,72,0.36);
}
/* the warning/outstanding & expense icons use an inline rgba(243,156,18) tint */
.stat-card .stat-icon[style*="243,156,18"] {
    background: linear-gradient(135deg, #FBBF24 0%, #F59E0B 100%) !important;
    color: #fff !important; box-shadow: 0 8px 20px rgba(245,158,11,0.42);
}

/* Bigger, punchier stat numbers */
.stat-card .stat-value { font-size: 29px !important; font-weight: 800 !important; letter-spacing: -0.5px; }
.stat-card .stat-label { color: #64748B; }

/* Section cards (charts / lists) — match the softer, floating look */
.card { border-radius: 16px; border: 1px solid rgba(15,23,42,0.06); box-shadow: 0 4px 18px rgba(15,23,42,0.06); }
.card .card-header { background: rgba(248,250,252,0.7); border-bottom: 1px solid rgba(15,23,42,0.07); border-radius: 16px 16px 0 0; }

/* ============================================================
   CONSISTENCY PASS (2026-07-19) — one brand across the whole ERP.
   CSS-only; no view/logic changes. Fixes stray bootstrap defaults.
   ============================================================ */

/* 1) BUTTONS — stray bootstrap-blue .btn-primary (40 places) → brand gold,
      same look as .btn-primary-custom */
.btn-primary {
    background-color: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #fff !important;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}
.btn-primary:hover, .btn-primary:focus, .btn-primary:active,
.btn-primary.active, .btn-primary:first-child:active {
    background-color: var(--primary-dark) !important;
    border-color: var(--primary-dark) !important;
    color: #fff !important;
}
.btn-primary:focus, .btn-primary.focus { box-shadow: 0 0 0 3px rgba(245,166,35,.25) !important; }
.btn-primary:disabled, .btn-primary.disabled {
    background-color: #F8CE85 !important; border-color: #F8CE85 !important; color: #fff !important;
}
/* outline-primary (44 places) → gold outline */
.btn-outline-primary {
    color: var(--primary-dark) !important;
    border-color: var(--primary) !important;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}
.btn-outline-primary:hover, .btn-outline-primary:focus, .btn-outline-primary:active,
.btn-outline-primary.active {
    background-color: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #fff !important;
}
.btn-outline-primary:focus { box-shadow: 0 0 0 3px rgba(245,166,35,.25) !important; }

/* 2) STATUS BADGES — solid bootstrap badges → soft tint pills, one rule everywhere:
      green = Paid/OK, amber = Partial/Waiting, red = Due/Overdue,
      blue = info, slate = neutral, gold = brand counts */
.badge.bg-success   { background-color: #DCFCE7 !important; color: #14532D !important; }
.badge.bg-warning   { background-color: #FEF3C7 !important; color: #92400E !important; }
.badge.bg-danger    { background-color: #FEE2E2 !important; color: #991B1B !important; }
.badge.bg-info      { background-color: #E0F2FE !important; color: #075985 !important; }
.badge.bg-primary   { background-color: #FCEFCF !important; color: #7A4B06 !important; }
.badge.bg-secondary { background-color: #E2E8F0 !important; color: #334155 !important; }
.badge.bg-light     { background-color: #F1F5F9 !important; color: #475569 !important; border: 1px solid #E2E8F0; }
.badge.bg-dark      { background-color: #1E293B !important; color: #F8FAFC !important; }

/* 3) TABLES — same feel on every list page */
.table-hover > tbody > tr:hover > * { background: #FFF9ED; }
.table > tbody > td, .table > tbody > th { vertical-align: middle; }
.table thead th { white-space: nowrap; }

/* 4) FORMS — gold everywhere an input responds */
textarea.form-control:focus { border-color: var(--primary) !important; box-shadow: 0 0 0 3px rgba(245,166,35,.18) !important; }
.form-check-input:checked {
    background-color: var(--primary) !important;
    border-color: var(--primary) !important;
}
.form-check-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(245,166,35,.18);
}
.form-label { font-weight: 600; font-size: 13px; margin-bottom: 6px; color: var(--text-primary); }
.input-group-text { background: #F8FAFC; border-color: var(--border-color); color: var(--text-secondary); }
