/* ============================================
   Haegl CampusOS - MAIN STYLESHEET
   ============================================ */

/* === CSS RESET & BASE STYLES === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Brand & status colors - Refined */
    --primary: #3B82F6;
    --primary-dark: #1E40AF;
    --primary-light: #60A5FA;
    --primary-50: #EFF6FF;
    --primary-100: #DBEAFE;
    --secondary: #0EA5E9;
    --accent: #6366F1;
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --info: #06B6D4;
    --light: #F8FAFC;
    --dark: #0F172A;

    /* Soft tints */
    --success-50: #ECFDF5;
    --warning-50: #FFFBEB;
    --danger-50: #FEF2F2;
    --info-50: #ECFEFF;

    /* Sidebar - Slate dark theme */
    --sidebar-bg: #0F172A;
    --sidebar-bg-2: #1E293B;
    --sidebar-text: #94A3B8;
    --sidebar-text-strong: #E2E8F0;
    --sidebar-active: #3B82F6;
    --sidebar-hover: rgba(59, 130, 246, 0.14);

    /* Surfaces & text */
    --body-bg: #F8FAFC;
    --body-bg-2: #F1F5F9;
    --card-bg: #ffffff;
    --text-primary: #0F172A;
    --text-secondary: #64748B;
    --border-color: #E2E8F0;
    --border-soft: #F1F5F9;

    /* Layered shadows - Refined depth */
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -1px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -2px rgba(15, 23, 42, 0.04);
    --shadow-xl: 0 20px 25px -5px rgba(15, 23, 42, 0.1), 0 8px 10px -6px rgba(15, 23, 42, 0.04);

    /* Layout - Enhanced spacing */
    --sidebar-width: 280px;
    --header-height: 72px;
    --content-padding: 32px;

    /* Radius scale - Smoother */
    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-pill: 999px;

    /* Focus ring */
    --ring: 0 0 0 3px rgba(59, 130, 246, 0.15);

    /* Motion */
    --transition: 0.2s ease;
    --transition-slow: 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: var(--body-bg);
    background-image:
        radial-gradient(1100px 460px at 100% -8%, rgba(59, 130, 246, 0.04), transparent 60%),
        radial-gradient(900px 380px at -8% 0%, rgba(99, 102, 241, 0.03), transparent 55%);
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* === GLOBAL POLISH === */
::selection {
    background: rgba(59, 130, 246, 0.18);
    color: var(--primary-dark);
}

:focus-visible {
    outline: 2px solid var(--primary-light);
    outline-offset: 2px;
    border-radius: 4px;
}

/* App-wide slim scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: #CBD5E1 transparent;
}
*::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
*::-webkit-scrollbar-track {
    background: transparent;
}
*::-webkit-scrollbar-thumb {
    background-color: #CBD5E1;
    border-radius: var(--radius-pill);
    border: 2px solid transparent;
    background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover {
    background-color: #94A3B8;
    background-clip: padding-box;
}

/* === APP CONTAINER === */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* === SIDEBAR === */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, var(--sidebar-bg-2) 0%, var(--sidebar-bg) 60%, #0B1120 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    z-index: 1000;
    transition: transform var(--transition-slow);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.35) transparent;
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: var(--sidebar-bg);
}

.sidebar::-webkit-scrollbar-thumb {
    background-color: rgba(148, 163, 184, 0.35);
    border-radius: 3px;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.15rem 1.35rem 1.05rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: radial-gradient(120% 80% at 0% 0%, rgba(59, 130, 246, 0.15), transparent 60%);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #ffffff;
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.sidebar-logo-img {
    height: 42px;
    width: auto;
    object-fit: contain;
    border-radius: 8px;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.35));
}

.sidebar-logo i {
    font-size: 1.5rem;
    color: var(--primary);
}

.sidebar-close {
    display: none;
    background: none;
    border: none;
    color: var(--sidebar-text);
    cursor: pointer;
    padding: 0.5rem;
    font-size: 1.25rem;
}

.sidebar-nav {
    padding: 1rem 0;
}

.menu-group {
    margin-bottom: 0.5rem;
}

.menu-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.35rem 0.5rem 1.45rem;
    color: var(--sidebar-text);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    cursor: pointer;
    transition: color var(--transition);
    opacity: 0.9;
}

.menu-group-header:hover {
    color: var(--sidebar-text-strong);
    opacity: 1;
}

.group-arrow {
    font-size: 0.7rem;
    transition: transform var(--transition);
}

.menu-group.expanded .group-arrow {
    transform: rotate(180deg);
}

.menu-group-items {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition);
}

.menu-group.expanded .menu-group-items {
    max-height: 1000px;
    background: rgba(59, 130, 246, 0.12);
    border-radius: var(--radius-sm);
    margin: 0 10px;
    padding: 6px 0;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.65rem 1rem 0.65rem 2.6rem;
    color: var(--sidebar-text);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: color var(--transition), background-color var(--transition), box-shadow var(--transition);
    position: relative;
    margin: 3px 12px;
    border-radius: var(--radius-sm);
}

.menu-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%) scaleY(0);
    width: 3px;
    height: 55%;
    background: linear-gradient(180deg, var(--accent), var(--primary));
    border-radius: 0 var(--radius-pill) var(--radius-pill) 0;
    transition: transform var(--transition);
}

.menu-item:hover {
    background-color: var(--sidebar-hover);
    color: #ffffff;
}

.menu-item.active {
    background: rgba(59, 130, 246, 0.25);
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
}

.menu-item.active::before {
    transform: translateY(-50%) scaleY(1);
}

.menu-item.active i {
    color: #ffffff;
}

.menu-item i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
}

.menu-badge {
    margin-left: auto;
    background-color: var(--danger);
    color: #ffffff;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.12rem 0.5rem;
    border-radius: var(--radius-pill);
    min-width: 18px;
    text-align: center;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.06);
}

/* === SIDEBAR OVERLAY (Mobile) === */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

/* === MAIN CONTENT AREA === */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: calc(100% - var(--sidebar-width));
}

/* === HEADER === */
.header {
    position: sticky;
    top: 0;
    height: var(--header-height);
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border-bottom: 1px solid var(--border-soft);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.6rem;
    z-index: 100;
    box-shadow: var(--shadow-sm);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: visible;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    min-width: 0;
}

.hamburger {
    display: none;
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
}

.breadcrumb {
    font-size: 0.875rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.breadcrumb-item {
    color: var(--text-primary);
    font-weight: 500;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

.header-btn {
    position: relative;
    background: none;
    border: none;
    font-size: 1.15rem;
    color: var(--text-secondary);
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    transition: color var(--transition), background-color var(--transition);
}

.header-btn:hover {
    color: var(--primary);
    background-color: var(--primary-50);
}

.notification-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    font-size: 0.65rem;
}

/* === USER DROPDOWN === */
.user-dropdown {
    position: relative;
}

.user-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-md);
    transition: background-color var(--transition);
}

.user-btn:hover {
    background-color: var(--light);
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
    box-shadow: 0 0 0 2px #ffffff, 0 0 0 3px var(--border-color), var(--shadow-sm);
}

.user-info {
    text-align: left;
}

.user-name {
    display: block;
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.user-role {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.dropdown-arrow {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background-color: var(--card-bg);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    padding: 6px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition);
    z-index: 1000;
    overflow: hidden;
}

.dropdown-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.85rem;
    text-decoration: none;
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: background-color var(--transition), color var(--transition);
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    border-radius: var(--radius-md);
}

.dropdown-item:hover {
    background-color: var(--primary-50);
    color: var(--primary-dark);
}

.dropdown-item.text-danger {
    color: var(--danger);
}

.dropdown-item.text-danger:hover {
    background-color: rgba(231, 29, 54, 0.1);
}

.dropdown-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 0.25rem 0;
}

/* === CONTENT AREA === */
.content {
    flex: 1;
    padding: var(--content-padding);
    min-height: calc(100vh - var(--header-height));
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
    overflow-x: hidden;
}

/* === CARD COMPONENT === */
.card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 1.5rem;
    transition: box-shadow var(--transition), transform var(--transition);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.card-header {
    padding: 1.15rem 1.6rem;
    border-bottom: 1px solid var(--border-soft);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.5), transparent);
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-body {
    padding: 1.6rem;
}

.card-footer {
    padding: 1.1rem 1.6rem;
    border-top: 1px solid var(--border-color);
    background-color: var(--light);
}

/* === TABLE STYLES === */
.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    max-width: 100%;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    max-width: 100%;
}

.table thead {
    background-color: var(--light);
}

.table th {
    padding: 0.9rem 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

.table td {
    padding: 0.9rem 1rem;
    border-bottom: 1px solid var(--border-soft);
    color: var(--text-primary);
}

.table tbody tr {
    transition: background-color var(--transition);
}

.table tbody tr.clickable-row {
    cursor: pointer;
}

.table tbody tr:hover {
    background-color: var(--primary-50);
}

.table tbody tr.clickable-row:hover {
    background-color: rgba(var(--primary-rgb, 59 130 246), 0.08);
}

.table tbody tr.clickable-row:active {
    background-color: rgba(var(--primary-rgb, 59 130 246), 0.12);
}

/* Prevent action cells from triggering row click */
.table tbody td.actions-cell {
    pointer-events: auto;
}

.table tbody .action-btn {
    pointer-events: auto;
}

.table-striped tbody tr:nth-child(even) {
    background-color: rgba(0, 0, 0, 0.02);
}

.table-bordered {
    border: 1px solid var(--border-color);
}

.table-bordered th,
.table-bordered td {
    border: 1px solid var(--border-color);
}

/* === FORM STYLES === */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 0.65rem 0.95rem;
    font-size: 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    transition: border-color var(--transition), box-shadow var(--transition), background-color var(--transition);
    background-color: #ffffff;
    color: var(--text-primary);
}

.form-control:hover:not(:disabled):not(:focus) {
    border-color: #CBD5E1;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--ring);
    background-color: #ffffff;
}

.form-control::placeholder {
    color: var(--text-secondary);
}

.form-control:disabled {
    background-color: var(--light);
    cursor: not-allowed;
}

.form-control.is-invalid {
    border-color: var(--danger);
}

.form-control.is-valid {
    border-color: var(--success);
}

.input-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.input-wrapper .form-control {
    padding-left: 2.5rem;
}

.toggle-password {
    position: absolute;
    right: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236c757d' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.875rem center;
    padding-right: 2.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.form-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* === BUTTON STYLES === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    font-size: 0.875rem;
    font-weight: 600;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background-color var(--transition), color var(--transition), box-shadow var(--transition), transform var(--transition), border-color var(--transition);
    text-decoration: none;
    white-space: nowrap;
    user-select: none;
    vertical-align: middle;
}

.btn:focus {
    outline: none;
    box-shadow: var(--ring);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #ffffff;
    box-shadow: 0 4px 12px -2px rgba(59, 130, 246, 0.5);
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    box-shadow: 0 8px 16px -4px rgba(59, 130, 246, 0.6);
    transform: translateY(-2px);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-secondary {
    background-color: var(--text-secondary);
    color: #ffffff;
}

.btn-secondary:hover:not(:disabled) {
    background-color: #475569;
}

.btn-success {
    background-color: var(--success);
    color: #ffffff;
}

.btn-success:hover:not(:disabled) {
    background-color: #059669;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px -2px rgba(16, 185, 129, 0.4);
}

.btn-whatsapp {
    background-color: #25D366;
    color: #ffffff;
}

.btn-whatsapp:hover:not(:disabled) {
    background-color: #128C7E;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px -2px rgba(37, 211, 102, 0.4);
}

.btn-danger {
    background-color: var(--danger);
    color: #ffffff;
}

.btn-danger:hover:not(:disabled) {
    background-color: #c41c32;
}

.btn-warning {
    background-color: var(--warning);
    color: #ffffff;
}

.btn-warning:hover:not(:disabled) {
    background-color: #e68a00;
}

.btn-info {
    background-color: var(--info);
    color: #ffffff;
}

.btn-info:hover:not(:disabled) {
    background-color: #3db5d8;
}

.btn-light {
    background-color: var(--card-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-xs);
}

.btn-light:hover:not(:disabled) {
    background-color: var(--primary-50);
    border-color: var(--primary-100);
    color: var(--primary-dark);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
}

.btn-block {
    width: 100%;
}

/* Action buttons container */
.action-buttons {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

.action-buttons .btn {
    margin: 0;
    min-width: 32px;
    padding: 0.375rem 0.5rem;
}

/* Detail View Styles */
.detail-view {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 150px;
}

.detail-value {
    color: var(--text-primary);
    text-align: right;
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.detail-value .badge {
    margin-right: 4px;
}

.btn-loader i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* === BADGE STYLES === */
.badge {
    display: inline-block;
    padding: 0.3rem 0.6rem;
    font-size: 0.72rem;
    font-weight: 700;
    border-radius: var(--radius-sm);
    line-height: 1.3;
    letter-spacing: 0.02em;
}

.badge-primary { background-color: var(--primary); color: #ffffff; }
.badge-secondary { background-color: var(--text-secondary); color: #ffffff; }
.badge-success { background-color: var(--success); color: #ffffff; }
.badge-danger { background-color: var(--danger); color: #ffffff; }
.badge-warning { background-color: var(--warning); color: #ffffff; }
.badge-info { background-color: var(--info); color: #ffffff; }
.badge-light { background-color: var(--light); color: var(--text-primary); }
.badge-dark { background-color: var(--dark); color: #ffffff; }

/* === PAGINATION === */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    margin-top: 1.5rem;
}

.page-btn {
    min-width: 36px;
    height: 36px;
    padding: 0 0.75rem;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition);
}

.page-btn:hover:not(:disabled) {
    background-color: var(--primary-50);
    border-color: var(--primary-100);
    color: var(--primary-dark);
}

.page-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-color: var(--primary);
    color: #ffffff;
    box-shadow: 0 6px 14px -6px rgba(59, 130, 246, 0.6);
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-dots {
    padding: 0 0.5rem;
    color: var(--text-secondary);
}

.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    border-top: 1px solid var(--border-color);
}

.pagination-ellipsis {
    padding: 0 0.5rem;
    color: var(--text-secondary);
}

.pagination-info {
    margin-left: 0.75rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.pagination-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1.5rem;
    padding: 1rem 0;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pagination-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
    padding: 0 0.5rem;
}

/* === ALERT STYLES === */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
}

.alert-success {
    background-color: #dcfce7;
    border-color: #22C55E;
    color: #166534;
}

.alert-danger {
    background-color: #FEE2E2;
    border-color: #EF4444;
    color: #991B1B;
}

.alert-warning {
    background-color: #fef3c7;
    border-color: #F59E0B;
    color: #92400E;
}

.alert-info {
    background-color: #CFFAFE;
    border-color: #06B6D4;
    color: #155E75;
}

.alert-secondary {
    background-color: #F1F5F9;
    border-color: #94A3B8;
    color: #334155;
}

/* === TOAST NOTIFICATIONS === */
.toast {
    position: fixed;
    top: 1rem;
    right: 1rem;
    min-width: 300px;
    max-width: 400px;
    padding: 1rem 1.25rem;
    background-color: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border-soft);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    transform: translateX(120%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 100000 !important;
}

.toast.toast-show {
    transform: translateX(0);
}

.toast-success { border-left-color: var(--success); }
.toast-danger { border-left-color: var(--danger); }
.toast-warning { border-left-color: var(--warning); }
.toast-info { border-left-color: var(--info); }

.toast-message {
    flex: 1;
    font-size: 0.875rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
}

/* Responsive Toast */
@media (max-width: 768px) {
    .toast {
        min-width: auto;
        max-width: calc(100vw - 2rem);
        left: 1rem;
        right: 1rem;
        top: 0.5rem;
    }
}

@media (max-width: 480px) {
    .toast {
        padding: 0.75rem 1rem;
        font-size: 0.8rem;
    }
    .toast-message {
        font-size: 0.8rem;
    }
}

/* === CONFIRM DIALOG === */
.confirm-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.confirm-box {
    background-color: var(--card-bg);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-xl);
    padding: 1.75rem;
    min-width: 320px;
    max-width: 400px;
    box-shadow: var(--shadow-xl);
}

.confirm-message {
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    text-align: center;
}

.confirm-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* === MODAL === */
.modal {
    position: fixed;
    inset: 0;
    background-color: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1500;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background-color: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    transform: translateY(12px) scale(0.98);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal.active .modal-content {
    transform: translateY(0) scale(1);
}

/* Fix for dropdown options being clipped in modals */
.modal-content select {
    position: relative;
    z-index: 10;
}

/* Ensure dropdown options are visible */
.modal-content select option {
    color: black;
}

.modal-sm { max-width: 400px; }
.modal-lg { max-width: 800px; }
.modal-xl { max-width: 1200px; }

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-soft);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 1.125rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.1rem;
    color: var(--text-secondary);
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    z-index: 10;
    pointer-events: auto;
    transition: background-color var(--transition), color var(--transition);
}

.modal-close:hover {
    color: var(--danger);
    background-color: var(--danger-50);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    pointer-events: auto;
}

.modal-footer button {
    pointer-events: auto;
}

/* === NOTIFICATION DETAIL MODAL === */
.noti-detail-badges {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.noti-detail-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 12px;
    line-height: 1.4;
}

.noti-detail-message {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 20px;
    white-space: pre-wrap;
    word-break: break-word;
}

.noti-detail-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
    font-size: 13px;
    color: #999;
    padding-top: 14px;
    border-top: 1px solid var(--border-color);
}

/* === LOADING SPINNER === */
.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    gap: 1rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-spinner p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* === ERROR CONTAINER === */
.error-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    gap: 1rem;
    text-align: center;
}

.error-icon {
    font-size: 3rem;
}

.error-message {
    color: var(--text-secondary);
    font-size: 0.875rem;
    max-width: 400px;
}

/* === EMPTY STATE === */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    gap: 1rem;
    text-align: center;
}

.empty-state-icon {
    font-size: 3rem;
    color: var(--text-secondary);
    opacity: 0.5;
}

.empty-state-text {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* === STATS CARD === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
    margin-bottom: 2rem;
    align-items: stretch;
    /* Ensure all rows have the same height */
    grid-auto-rows: 1fr;
}

/* Also target stat-card for dashboard compatibility */
.stats-grid .stat-card,
.stats-grid .stats-card {
    min-width: 0; /* Allow cards to shrink */
}

.stats-card {
    background: linear-gradient(135deg, var(--card-bg), var(--light));
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border-left: 4px solid var(--primary);
    /* Ensure all cards have same height */
    min-height: 140px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: var(--transition);
}

.stats-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.stats-card.success { border-left-color: var(--success); }
.stats-card.warning { border-left-color: var(--warning); }
.stats-card.danger { border-left-color: var(--danger); }
.stats-card.info { border-left-color: var(--info); }

.stats-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stats-value {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    margin-bottom: 0.5rem;
}

.stats-change {
    font-size: 0.875rem;
    margin-top: auto;
    padding-top: 0.5rem;
    font-weight: 500;
}

.stats-change.positive { color: var(--success); }
.stats-change.negative { color: var(--danger); }

/* Responsive styles for stats cards */
@media (max-width: 768px) {
    .stats-card {
        min-height: 120px;
        padding: 1.25rem;
    }

    .stats-value {
        font-size: 1.75rem;
    }
}

@media (max-width: 480px) {
    .stats-card {
        min-height: 110px;
        padding: 1rem;
    }

    .stats-value {
        font-size: 1.5rem;
    }

    .stats-label {
        font-size: 0.75rem;
    }
}

/* === SEARCH BAR === */
.search-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.search-input {
    flex: 1;
    position: relative;
}

.search-input input {
    padding-left: 2.5rem;
}

.search-input i {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

/* === FILTER BAR === */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1rem;
    background-color: var(--light);
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.filter-group label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.filter-group select,
.filter-group input {
    padding: 0.5rem;
    font-size: 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
}

/* === TABS === */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.tab {
    padding: 0.75rem 1.25rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition);
}

.tab:hover {
    color: var(--primary);
}

.tab.active {
    color: var(--primary-dark);
    font-weight: 600;
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* === UTILITY CLASSES === */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.text-primary { color: var(--primary); }
.text-secondary { color: var(--text-secondary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-info { color: var(--info); }

.font-weight-bold { font-weight: 600; }
.font-weight-normal { font-weight: 400; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mt-5 { margin-top: 2rem; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mb-5 { margin-bottom: 2rem; }

.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 1rem; }
.p-4 { padding: 1.5rem; }

.d-flex { display: flex; }
.d-none { display: none; }
.d-block { display: block; }

.align-center { align-items: center; }
.align-start { align-items: flex-start; }
.align-end { align-items: flex-end; }

.justify-start { justify-content: flex-start; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.justify-between { justify-content: space-between; }

.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 1rem; }

.w-100 { width: 100%; }
.h-100 { height: 100%; }

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rounded { border-radius: var(--radius-md); }
.shadow { box-shadow: var(--shadow); }
.border { border: 1px solid var(--border-color); }
.border-top { border-top: 1px solid var(--border-color); }
.border-bottom { border-bottom: 1px solid var(--border-color); }

.bg-light { background-color: var(--light); }
.bg-white { background-color: var(--card-bg); }

/* === RESPONSIVE BREAKPOINTS === */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .sidebar-overlay.active {
        display: block;
    }

    .sidebar-close {
        display: block;
    }

    .main-content {
        margin-left: 0;
    }

    .hamburger {
        display: block;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }
}

@media (max-width: 768px) {
    :root {
        --content-padding: 1rem;
    }

    .header {
        padding: 0 1rem;
    }

    .user-info {
        display: none;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
        /* Maintain consistent card heights */
        align-items: stretch;
        grid-auto-rows: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .table-container {
        border-radius: var(--radius-md);
    }

    .modal-content {
        width: 95%;
        margin: 1rem;
    }

    .search-bar {
        flex-direction: column;
    }

    .filter-bar {
        flex-direction: column;
    }

    .filter-group {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }

    .card-body {
        padding: 1rem;
    }

    .pagination {
        flex-wrap: wrap;
    }
}

/* ============================================
   DASHBOARD STYLES
   ============================================ */

/* Dashboard Layouts */
.dashboard-container {
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
    padding: 0.5rem 0;
}

.page-header {
    margin-bottom: 0.5rem;
}

.page-header h1 {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    letter-spacing: -0.025em;
}

.page-header p {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.header-actions {
    display: flex;
    gap: 12px;
}

.stat-card {
    background: linear-gradient(135deg, var(--card-bg) 0%, var(--card-bg) 100%);
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 4px solid transparent;
    position: relative;
    overflow: hidden;
    /* Ensure all cards have the same height */
    min-height: 100px;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, transparent 0%, rgba(255, 255, 255, 0.5) 100%);
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    border-color: var(--border-color);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-card-link {
    cursor: pointer;
    display: block;
    width: 100%;
    text-decoration: none;
    color: inherit;
}

.stat-card-link:hover .stat-card {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

/* Color themes with enhanced borders and backgrounds */
.stat-card.primary {
    border-left-color: var(--primary);
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.03) 0%, var(--card-bg) 100%);
}
.stat-card.primary .stat-card-icon { background: linear-gradient(135deg, var(--primary), #1D4ED8); color: white; }

.stat-card.success {
    border-left-color: var(--success);
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.03) 0%, var(--card-bg) 100%);
}
.stat-card.success .stat-card-icon { background: linear-gradient(135deg, var(--success), #059669); color: white; }

.stat-card.warning {
    border-left-color: var(--warning);
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.03) 0%, var(--card-bg) 100%);
}
.stat-card.warning .stat-card-icon { background: linear-gradient(135deg, var(--warning), #D97706); color: white; }

.stat-card.danger {
    border-left-color: var(--danger);
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.03) 0%, var(--card-bg) 100%);
}
.stat-card.danger .stat-card-icon { background: linear-gradient(135deg, var(--danger), #DC2626); color: white; }

.stat-card.info {
    border-left-color: var(--info);
    background: linear-gradient(135deg, rgba(20, 184, 166, 0.03) 0%, var(--card-bg) 100%);
}
.stat-card.info .stat-card-icon { background: linear-gradient(135deg, var(--info), #0D9488); color: white; }

.stat-card.secondary {
    border-left-color: var(--text-secondary);
    background: linear-gradient(135deg, rgba(100, 116, 139, 0.03) 0%, var(--card-bg) 100%);
}
.stat-card.secondary .stat-card-icon { background: linear-gradient(135deg, var(--text-secondary), #475569); color: white; }

.stat-card-content {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    min-width: 0;
}

.stat-card-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.75px;
    line-height: 1.3;
}

.stat-card-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.15;
}

.stat-card-sub {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    line-height: 1.3;
}

.stat-card-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s ease;
}

.stat-card:hover .stat-card-icon {
    transform: scale(1.08);
}
    position: relative;
    z-index: 1;
}

.bg-primary { background-color: var(--primary); }
.bg-success { background-color: var(--success); }
.bg-warning { background-color: var(--warning); }
.bg-danger  { background-color: var(--danger); }
.bg-info    { background-color: var(--info); }
.bg-secondary { background-color: var(--text-secondary); }

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
    align-items: stretch;
}

.lists-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.25rem;
    align-items: stretch;
}

.chart-card, .list-card {
    background: var(--card-bg);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 22px 24px;
    box-shadow: var(--shadow-sm);
}

.chart-header, .list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.chart-title, .list-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.chart-canvas-container {
    position: relative;
    height: 300px;
    width: 100%;
}

/* Custom List Items inside list-card */
.custom-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 350px;
    overflow-y: auto;
}

.custom-list::-webkit-scrollbar {
    width: 6px;
}

.custom-list::-webkit-scrollbar-track {
    background: var(--light);
    border-radius: 3px;
}

.custom-list::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 3px;
}

.custom-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--body-bg);
    border-radius: 8px;
    font-size: 14px;
    transition: background-color 0.2s ease;
}

.custom-list-item:hover {
    background: #e8eaed;
}

.custom-list-item-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.custom-list-item-title {
    font-weight: 600;
    color: var(--text-primary);
}

.custom-list-item-sub {
    font-size: 12px;
    color: var(--text-secondary);
}

.custom-list-item-right {
    text-align: right;
}

/* Quick Action Buttons for specific dashboards */
.quick-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.btn-action {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    transition: all var(--transition);
    text-decoration: none;
    box-shadow: var(--shadow-xs);
}

.btn-action:hover {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #ffffff;
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 8px 18px -8px rgba(59, 130, 246, 0.5);
}

/* Responsive Dashboard */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
        gap: 16px;
        /* Maintain consistent card heights on mobile */
        align-items: stretch;
        grid-auto-rows: 1fr;
    }

    .charts-grid, .lists-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .stat-card-value {
        font-size: 22px;
    }

    .stat-card {
        padding: 20px;
        /* Ensure consistent height on mobile */
        min-height: 90px;
    }

    .stat-card-icon {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    .chart-card, .list-card {
        padding: 20px;
    }

    .chart-canvas-container {
        height: 250px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
        /* Maintain consistent card heights on small mobile */
        align-items: stretch;
        grid-auto-rows: 1fr;
    }

    .stat-card {
        padding: 16px;
        /* Ensure consistent height on small mobile */
        min-height: 85px;
    }

    .stat-card-value {
        font-size: 20px;
    }

    .stat-card-icon {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }

    .page-header h1 {
        font-size: 1.5rem;
    }
}

/* ============================================
   MODAL & FORM STYLES
   ============================================ */

/* Modal Overlay & Box */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}
.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}
.modal-box {
    background: var(--card-bg);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    transform: translateY(20px) scale(0.98);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal-overlay.active .modal-box {
    transform: translateY(0) scale(1);
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-soft);
}
.modal-header h3 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.modal-close {
    background: none; border: none; font-size: 22px; cursor: pointer; color: var(--text-secondary);
    width: 34px; height: 34px; border-radius: var(--radius-md);
    display: inline-flex; align-items: center; justify-content: center;
    line-height: 1; transition: background-color var(--transition), color var(--transition);
}
.modal-close:hover { color: var(--danger); background-color: var(--danger-50); }
.modal-body { padding: 24px; }
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Form Grid inside Modals */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.form-grid .full-width {
    grid-column: 1 / -1;
}
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.form-group label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}
.form-group input, .form-group select, .form-group textarea {
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
    font-family: inherit;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: var(--ring);
}
.form-group textarea {
    min-height: 80px;
    resize: vertical;
}
.form-group .error-text {
    color: var(--danger);
    font-size: 12px;
    display: none;
}
.form-group.has-error input,
.form-group.has-error select,
.form-group.has-error textarea {
    border-color: var(--danger);
}
.form-group.has-error .error-text {
    display: block;
}
.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}
.form-check input { width: auto; cursor: pointer; }
.form-check label {
    font-weight: 400;
    cursor: pointer;
    margin: 0;
}

/* Filter Bar */
.filter-bar {
    background: var(--card-bg);
    border: 1px solid var(--border-soft);
    padding: 16px 20px;
    border-radius: var(--radius-lg);
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
    width: 100%;
    box-sizing: border-box;
}
.filter-bar input, .filter-bar select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    min-width: 150px;
    flex: 1;
}
.filter-bar .btn { margin-left: auto; }

/* Page Header Styles */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 22px;
    width: 100%;
    box-sizing: border-box;
    flex-wrap: wrap;
}
.page-header h1 {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

/* User Avatar Small */
.user-avatar-sm {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
}

/* Multi-Step Form */
.step-progress {
    display: flex;
    justify-content: space-between;
    margin-bottom: 30px;
    position: relative;
}
.step-progress::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 40px;
    right: 40px;
    height: 2px;
    background: var(--border-color);
    z-index: 0;
}
.step-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
    width: 120px;
}
.step-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: var(--text-secondary);
    margin-bottom: 8px;
    transition: all 0.3s;
}
.step-item.active .step-circle {
    border-color: var(--primary);
    background: var(--primary);
    color: white;
}
.step-item.completed .step-circle {
    border-color: var(--success);
    background: var(--success);
    color: white;
}
.step-label {
    font-size: 13px;
    color: var(--text-secondary);
    text-align: center;
    font-weight: 500;
}
.step-item.active .step-label { color: var(--primary); }
.step-item.completed .step-label { color: var(--success); }

.step-panel { display: none; }
.step-panel.active { display: block; }

/* Tabs */
.tabs-container { margin-bottom: 24px; }
.tabs-nav {
    display: flex;
    border-bottom: 2px solid var(--border-soft);
    gap: 0;
}
.tab-btn {
    padding: 12px 24px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: color var(--transition), border-color var(--transition);
}
.tab-btn:hover { color: var(--primary); }
.tab-btn.active {
    color: var(--primary-dark);
    font-weight: 600;
    border-bottom-color: var(--primary);
}
.tab-content { display: none; padding: 20px 0; }
.tab-content.active { display: block; }

/* Detail View Grid */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.detail-group {
    background: var(--body-bg);
    padding: 16px;
    border-radius: 8px;
    border-left: 4px solid var(--primary);
}
.detail-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}
.detail-item:last-child { border-bottom: none; }
.detail-label { color: var(--text-secondary); font-weight: 500; }
.detail-value { color: var(--text-primary); font-weight: 600; text-align: right; max-width: 60%; word-wrap: break-word; }
.detail-item.full-width { grid-column: 1 / -1; display: block; }
.detail-item.full-width label { display: block; margin-bottom: 8px; }
.detail-item.full-width .detail-value { text-align: left; max-width: 100%; }
.detail-value.text-area { white-space: pre-wrap; line-height: 1.5; }
.hidden { display: none !important; }

/* Custom File Upload */
.file-upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--body-bg);
}
.file-upload-zone:hover, .file-upload-zone.dragover {
    border-color: var(--primary);
    background: rgba(59, 130, 246, 0.05);
}
.file-upload-zone input[type="file"] { display: none; }
.file-upload-icon { font-size: 32px; color: var(--text-secondary); margin-bottom: 10px; }
.file-upload-text { color: var(--text-secondary); font-size: 14px; }
.file-name-display { margin-top: 10px; font-weight: 600; color: var(--primary); display: none; }

/* Responsive Modal */
@media (max-width: 600px) {
    .form-grid { grid-template-columns: 1fr; }
    .filter-bar { flex-direction: column; align-items: stretch; }
    .filter-bar .btn { margin-left: 0; }
    .modal-box { max-width: 95%; }
    .modal-header, .modal-body, .modal-footer { padding: 16px; }
}

@media (max-width: 768px) {
    .detail-grid { grid-template-columns: 1fr; }
    .step-label { font-size: 11px; }
    .step-progress { padding: 0 10px; }
    .step-item { width: 80px; }
}

/* Timetable Grid */
.timetable-controls {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    align-items: flex-end;
    flex-wrap: wrap;
}
.timetable-controls .form-group {
    flex: 0 0 auto;
    min-width: 140px;
}
.timetable-controls > .form-group:first-child {
    flex: 0 0 auto;
    min-width: auto;
}
#sectionFilters,
#facultyFilters {
    display: flex;
    gap: 12px;
    flex-wrap: nowrap;
    align-items: flex-end;
    flex: 1;
}
#sectionFilters .form-group,
#facultyFilters .form-group {
    flex: 1;
    min-width: 120px;
}

.timetable-grid-wrapper {
    overflow-x: auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    padding: 20px;
}

.timetable-grid {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    min-width: 800px;
}
.timetable-grid th {
    background: var(--primary);
    color: white;
    padding: 12px;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
    border: 1px solid #3451b2;
}
.timetable-grid th:first-child {
    width: 120px;
}
.timetable-grid td {
    border: 1px solid var(--border-color);
    padding: 8px;
    vertical-align: top;
    height: 80px;
    text-align: center;
    transition: background 0.2s;
}
.timetable-grid tr:hover td {
    background: rgba(59, 130, 246, 0.03);
}
.timetable-grid td:first-child {
    background: var(--body-bg);
    font-weight: 600;
    font-size: 13px;
    vertical-align: middle;
    color: var(--text-secondary);
}

.tt-entry {
    background: #eef2ff;
    border-left: 4px solid var(--primary);
    padding: 8px;
    border-radius: 4px;
    margin-bottom: 4px;
    text-align: left;
    font-size: 12px;
    cursor: default;
}
.tt-entry.lab {
    background: #fff3e0;
    border-left-color: var(--warning);
}
.tt-entry.unpublished {
    background: #fff8e1;
    border-left-color: var(--text-secondary);
    opacity: 0.7;
}
.tt-entry.tt-entry-editable {
    cursor: pointer;
    transition: background 0.2s ease, box-shadow 0.2s ease;
}
.tt-entry.tt-entry-editable:hover,
.tt-entry.tt-entry-editable:focus {
    background: #e0e7ff;
    box-shadow: 0 0 0 2px var(--primary);
    outline: none;
}
.tt-subject {
    font-weight: 700;
    color: var(--text-primary);
    display: block;
    margin-bottom: 2px;
}
.tt-faculty {
    color: var(--text-secondary);
    display: block;
}
.tt-room {
    color: var(--info);
    font-size: 11px;
    display: block;
    margin-top: 2px;
}
.tt-empty {
    color: #ccc;
    font-size: 12px;
}
.tt-empty-cell {
    text-align: center;
    vertical-align: middle;
}
.tt-empty.tt-add {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px dashed #cbd5e1;
    color: var(--primary);
    font-size: 12px;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
}
.tt-empty.tt-add:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    transform: scale(1.1);
}

/* ============================================
   ATTENDANCE STYLES
   ============================================ */

/* Attendance Marking Grid */
.att-grid-container {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    overflow-x: auto;
}
.att-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}
.att-table th {
    background: var(--body-bg);
    padding: 12px;
    text-align: left;
    font-size: 13px;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
    position: sticky;
    top: 0;
}
.att-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}
.att-table tr:hover td { background: #fafafa; }

/* Status Toggle Buttons */
.status-btn-group {
    display: flex;
    gap: 6px;
}
.status-btn {
    width: 36px;
    height: 36px;
    border: 2px solid var(--border-color);
    background: white;
    border-radius: 6px;
    font-weight: 700;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.status-btn:hover { transform: scale(1.1); }
.status-btn.active-present { background: #dcfce7; color: #166534; border-color: #22C55E; }
.status-btn.active-absent { background: #FEE2E2; color: #991B1B; border-color: #EF4444; }
.status-btn.active-late { background: #fef3c7; color: #92400E; border-color: #F59E0B; }
.status-btn.active-leave { background: #CFFAFE; color: #155E75; border-color: #06B6D4; }
.status-btn.active-medical_leave { background: #F1F5F9; color: #334155; border-color: #94A3B8; }

/* Attendance Controls */
.att-controls {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: flex-end;
    padding: 20px;
    background: white;
    border-radius: 12px 12px 0 0;
    border-bottom: 1px solid var(--border-color);
}
.att-controls .form-group {
    flex: 1;
    min-width: 180px;
    margin: 0;
}
.att-controls .form-group label {
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}
.att-controls .form-group select,
.att-controls .form-group input {
    margin: 0;
}

/* Summary Progress Bars */
.progress-container {
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}
.progress-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}
.progress-success { background: var(--success); }
.progress-warning { background: var(--warning); }
.progress-danger { background: var(--danger); }

/* Calendar Grid */
.calendar-container {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.calendar-nav {
    background: none;
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
}
.calendar-nav:hover {
    background: var(--body-bg);
}
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: var(--border-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}
.calendar-day-header {
    background: var(--primary);
    color: white;
    padding: 10px;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
}
.calendar-cell {
    background: white;
    padding: 10px;
    min-height: 60px;
    text-align: center;
}
.calendar-date {
    font-weight: bold;
    margin-bottom: 4px;
    color: var(--text-secondary);
    font-size: 14px;
}
.calendar-cell.empty { background: var(--body-bg); }
.cal-status {
    display: inline-block;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    color: white;
    font-size: 12px;
    font-weight: bold;
    line-height: 24px;
}
.cal-present { background: var(--success); }
.cal-absent { background: var(--danger); }
.cal-leave { background: var(--info); }
.cal-late { background: var(--warning); }
.cal-medical_leave { background: #64748B; }

/* Overall Attendance Stat */
.overall-att-stat {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 24px;
    background: white;
    border-radius: 12px;
    margin-bottom: 20px;
}
.att-percentage-large {
    font-size: 48px;
    font-weight: 700;
    line-height: 1;
}
.att-percentage-large.green { color: var(--success); }
.att-percentage-large.yellow { color: var(--warning); }
.att-percentage-large.red { color: var(--danger); }
.att-percentage-label {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 8px;
}

/* Student Search in Attendance */
.student-search-wrapper {
    position: relative;
}
.student-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 0 0 8px 8px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 10;
    display: none;
}
.student-search-results.show { display: block; }
.student-search-result-item {
    padding: 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
}
.student-search-result-item:hover {
    background: var(--body-bg);
}
.student-search-result-item:last-child {
    border-bottom: none;
}

/* ============================================
   ASSIGNMENT STYLES
   ============================================ */

/* Assignment Submission Card */
.submission-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: box-shadow 0.2s;
}
.submission-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.submission-student-info {
    display: flex;
    align-items: center;
    gap: 12px;
}
.submission-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
}
.submission-details h4 { margin: 0 0 4px 0; font-size: 15px; font-weight: 600; }
.submission-meta { font-size: 12px; color: var(--text-secondary); display: flex; gap: 12px; flex-wrap: wrap; }
.submission-actions { display: flex; gap: 8px; align-items: center; }
.marks-display {
    font-size: 18px;
    font-weight: bold;
    color: var(--primary);
    margin-right: 12px;
}

/* Assignment Info Header */
.assignment-info-header {
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    margin-bottom: 24px;
    border-left: 5px solid var(--primary);
}
.assignment-info-header h2 { margin: 0 0 8px 0; font-size: 20px; }
.assignment-info-meta {
    display: flex;
    gap: 24px;
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 12px;
    flex-wrap: wrap;
}
.assignment-info-meta span { display: flex; align-items: center; gap: 6px; }
.assignment-info-meta i { color: var(--primary); }

/* Student Submission View */
.my-submission-box {
    background: #f8f9fa;
    border: 1px dashed var(--border-color);
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    margin-top: 20px;
}
.submitted-file-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    padding: 10px 20px;
    border: 1px solid var(--primary);
    border-radius: 6px;
    margin-top: 10px;
    transition: 0.2s;
}
.submitted-file-link:hover { background: var(--primary); color: white; }
.submission-text-content {
    background: white;
    padding: 16px;
    border-radius: 8px;
    margin: 16px 0;
    text-align: left;
    white-space: pre-wrap;
    word-wrap: break-word;
    border: 1px solid var(--border-color);
}

/* Assignment Type Badges */
.assignment-type-homework { background: #e3f2fd; color: #1976d2; }
.assignment-type-lab { background: #fff3e0; color: #f57c00; }
.assignment-type-project { background: #f3e5f5; color: #7b1fa2; }
.assignment-type-presentation { background: #e8f5e9; color: #388e3c; }
.assignment-type-quiz { background: #fce4ec; color: #c2185b; }
.assignment-type-other { background: #eceff1; color: #455a64; }

/* Late Warning Badge */
.late-warning-badge {
    background: #fef3c7;
    color: #92400E;
    border: 1px solid #F59E0B;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

/* Evaluation Feedback Box */
.feedback-box {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 6px;
    margin-top: 8px;
    font-size: 13px;
    border-left: 3px solid var(--info);
}
.feedback-box:empty { display: none; }

/* Assignment File Download */
.assignment-file-download {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--primary);
    text-decoration: none;
    font-size: 13px;
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    transition: 0.2s;
}
.assignment-file-download:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Row Highlight for Late Submissions */
tr.late-submission-row {
    background: #fffbeb;
}
tr.late-submission-row:hover td {
    background: #fdf6d5;
}

/* ============================================
   EXAMINATION & MARKS ENTRY STYLES
   ============================================ */

/* Marks Entry Grid */
.marks-header-info {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}
.marks-header-info h3 { margin: 0; color: var(--text-primary); }
.marks-meta { display: flex; gap: 24px; font-size: 14px; color: var(--text-secondary); }
.marks-meta strong { color: var(--text-primary); }

.marks-table-wrapper {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    overflow-x: auto;
}
.marks-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 500px;
}
.marks-table th {
    background: var(--body-bg);
    padding: 12px;
    text-align: center;
    border-bottom: 2px solid var(--border-color);
    font-size: 13px;
    color: var(--text-secondary);
}
.marks-table th:first-child, .marks-table td:first-child {
    text-align: left;
    padding-left: 24px;
    position: sticky;
    left: 0;
    background: inherit;
    z-index: 1;
    min-width: 100px;
}
.marks-table th:nth-child(2), .marks-table td:nth-child(2) {
    position: sticky;
    left: 100px;
    background: inherit;
    z-index: 1;
    min-width: 200px;
}
.marks-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    text-align: center;
    vertical-align: middle;
}
.marks-table tr:hover td { background: #fafafa; }
.marks-table tr:hover td:first-child,
.marks-table tr:hover td:nth-child(2) {
    background: #fafafa;
}

.marks-input {
    width: 70px;
    padding: 8px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    text-align: center;
    font-size: 15px;
    font-weight: 600;
    transition: border-color 0.2s;
}
.marks-input:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1); }
.marks-input:disabled { background: var(--body-bg); color: var(--text-secondary); cursor: not-allowed; }
.marks-input.error { border-color: var(--danger); background: #fff5f5; }

.absent-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--danger);
}

/* Hall Ticket Card */
.hall-ticket-card {
    background: white;
    border: 2px solid var(--primary);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
    position: relative;
}
.ht-header {
    text-align: center;
    border-bottom: 2px dashed var(--border-color);
    padding-bottom: 16px;
    margin-bottom: 16px;
}
.ht-header h2 { margin: 0 0 4px 0; color: var(--primary); }
.ht-header p { margin: 0; color: var(--text-secondary); font-size: 14px; }
.ht-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    font-size: 14px;
}
.ht-grid div { display: flex; gap: 8px; }
.ht-grid strong { color: var(--text-secondary); min-width: 120px; }
.ht-ticket-number {
    position: absolute;
    top: 16px;
    right: 16px;
    background: var(--primary);
    color: white;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

/* Seating Grid */
.seating-room {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
}
.seating-room h4 { margin-top: 0; border-bottom: 1px solid var(--border-color); padding-bottom: 8px; }
.seating-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
}
.seat-box {
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 8px;
    text-align: center;
    font-size: 12px;
    background: #f8f9fa;
    transition: all 0.2s;
}
.seat-box:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.seat-box.occupied { background: #eef2ff; border-color: var(--primary); }
.seat-number { font-weight: bold; display: block; margin-bottom: 4px; color: var(--text-secondary); }
.seat-student { color: var(--text-primary); font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Exam Type Badge Styles */
.exam-type-internal { background: #e3f2fd; color: #1976d2; }
.exam-type-external { background: #fff3e0; color: #f57c00; }
.exam-type-practical { background: #f3e5f5; color: #7b1fa2; }
.exam-type-viva { background: #e8f5e9; color: #388e3c; }
.exam-type-assignment { background: #fce4ec; color: #c2185b; }

/* Marks Entry Stats */
.marks-entry-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}
.marks-stat-card {
    background: white;
    padding: 16px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid var(--border-color);
}
.marks-stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
}
.marks-stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ============================================
   GRADE CARD & PROMOTION STYLES
   ============================================ */

/* Grade Card Document View */
.gc-document {
    background: white;
    max-width: 900px;
    margin: 0 auto;
    border: 2px solid #333;
    padding: 40px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    font-family: 'Times New Roman', Times, serif;
    color: #000;
}

.gc-college-header {
    text-align: center;
    border-bottom: 3px double #333;
    padding-bottom: 20px;
    margin-bottom: 20px;
}
.gc-college-header h1 { margin: 0; font-size: 24px; text-transform: uppercase; letter-spacing: 1px; }
.gc-college-header p { margin: 5px 0 0 0; font-size: 14px; color: #555; }
.gc-student-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 24px;
    font-size: 14px;
    border: 1px solid #ddd;
    padding: 15px;
    background: #f9f9f9;
}
.gc-student-info div { display: flex; gap: 10px; }
.gc-student-info strong { min-width: 120px; }

.gc-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 24px;
    font-size: 13px;
}
.gc-table th, .gc-table td {
    border: 1px solid #333;
    padding: 8px;
    text-align: center;
}
.gc-table th { background: #f0f0f0; font-weight: bold; text-transform: uppercase; font-size: 12px; }
.gc-table td:nth-child(2), .gc-table td:nth-child(3) { text-align: left; }
.gc-table tfoot td { font-weight: bold; background: #f9f9f9; }

.gc-result-status {
    text-align: center;
    margin-top: 20px;
    padding: 10px;
    font-weight: bold;
    font-size: 16px;
    border-top: 1px solid #ddd;
}
.gc-result-status.pass { color: #166534; }
.gc-result-status.fail { color: #EF4444; }

/* CGPA Highlight */
.cgpa-highlight-box {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-top: 20px;
    padding: 15px;
    background: #eef2ff;
    border-radius: 8px;
}
.cgpa-item { text-align: center; }
.cgpa-label { font-size: 14px; color: #555; display: block; margin-bottom: 4px; font-family: sans-serif; }
.cgpa-value { font-size: 32px; font-weight: bold; color: var(--primary); display: block; }

/* Promotion Processing */
.promotion-summary-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    border-left: 5px solid var(--primary);
    margin-bottom: 20px;
    display: flex;
    gap: 30px;
}
.promotion-stat { text-align: center; }
.promotion-stat-value { font-size: 24px; font-weight: bold; display: block; }
.promotion-stat-label { font-size: 12px; color: var(--text-secondary); text-transform: uppercase; }
.promo-pass { color: var(--success); }
.promo-fail { color: var(--danger); }
.promo-atkt { color: var(--warning); }

.promotion-status-select {
    padding: 6px 10px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    font-size: 13px;
    font-weight: 600;
}
.promo-select-promoted { background: #dcfce7; color: #166534; }
.promo-select-detained { background: #FEE2E2; color: #991B1B; }
.promo-select-atkt { background: #fef3c7; color: #92400E; }

/* Grade Letter Colors */
.grade-O, .grade-A-plus { color: #166534; font-weight: bold; }
.grade-A { color: #22C55E; font-weight: bold; }
.grade-B-plus { color: #2563EB; font-weight: bold; }
.grade-B { color: #06B6D4; font-weight: bold; }
.grade-C { color: #F59E0B; font-weight: bold; }
.grade-P { color: #64748B; font-weight: bold; }
.grade-F { color: #EF4444; font-weight: bold; }

/* Print Styles - Grade Card (only when printing grade cards) */
@media print {
    /* Page setup for grade card printing */
    @page {
        size: A4;
        margin: 15mm 15mm 15mm 15mm;
    }

    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    body,
    html {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        height: auto !important;
        overflow: visible !important;
    }

    /* Only apply these grade card styles when specifically printing grade cards */
    body:not(.printing-fee-receipt):not(.printing-payslip):not(.printing-hall-ticket) .no-print { display: none !important; }
    body:not(.printing-fee-receipt):not(.printing-payslip):not(.printing-hall-ticket) .sidebar,
    body:not(.printing-fee-receipt):not(.printing-payslip):not(.printing-hall-ticket) .header,
    body:not(.printing-fee-receipt):not(.printing-payslip):not(.printing-hall-ticket) #toastContainer,
    body:not(.printing-fee-receipt):not(.printing-payslip):not(.printing-hall-ticket) #confirmModal { display: none !important; }
    body:not(.printing-fee-receipt):not(.printing-payslip):not(.printing-hall-ticket) .page-header { display: none !important; }
    body:not(.printing-fee-receipt):not(.printing-payslip):not(.printing-hall-ticket) #cgpaBox { display: none !important; }
    body:not(.printing-fee-receipt):not(.printing-payslip):not(.printing-hall-ticket) #noGradeCards { display: none !important; }
    body:not(.printing-fee-receipt):not(.printing-payslip):not(.printing-hall-ticket) #managementView { display: none !important; }
    body:not(.printing-fee-receipt):not(.printing-payslip):not(.printing-hall-ticket) #actionButtons { display: none !important; }
    body:not(.printing-fee-receipt):not(.printing-payslip):not(.printing-hall-ticket) #summaryStats { display: none !important; }
    body:not(.printing-fee-receipt):not(.printing-payslip):not(.printing-hall-ticket) #studentsCard { display: none !important; }
    body:not(.printing-fee-receipt):not(.printing-payslip):not(.printing-hall-ticket) #selectedStudentGradeCard { display: none !important; }
    body:not(.printing-fee-receipt):not(.printing-payslip):not(.printing-hall-ticket) .app-container { display: block !important; }
    body:not(.printing-fee-receipt):not(.printing-payslip):not(.printing-hall-ticket) .main-content { margin: 0 !important; }
    body:not(.printing-fee-receipt):not(.printing-payslip):not(.printing-hall-ticket) .content { padding: 0 !important; }
    body:not(.printing-fee-receipt):not(.printing-payslip):not(.printing-hall-ticket) #studentView { display: block !important; }
    body:not(.printing-fee-receipt):not(.printing-payslip):not(.printing-hall-ticket) #gradeCardsContainer { display: block !important; }
    body:not(.printing-fee-receipt):not(.printing-payslip):not(.printing-hall-ticket) .gc-document {
        border: 2px solid #333 !important;
        box-shadow: none !important;
        padding: 10mm !important;
        margin: 0 !important;
        display: block !important;
        page-break-after: always;
        page-break-inside: avoid !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        overflow: visible !important;
    }
    body:not(.printing-fee-receipt):not(.printing-payslip):not(.printing-hall-ticket) .gc-document:last-child { page-break-after: avoid; }

    /* Ensure grade card content fits within page */
    body:not(.printing-fee-receipt):not(.printing-payslip):not(.printing-hall-ticket) .gc-document * {
        overflow: visible !important;
        box-sizing: border-box !important;
    }

    body:not(.printing-fee-receipt):not(.printing-payslip):not(.printing-hall-ticket) .gc-table {
        width: 100% !important;
        max-width: 100% !important;
        table-layout: auto !important;
        font-size: 10pt !important;
        page-break-inside: avoid !important;
    }

    body:not(.printing-fee-receipt):not(.printing-payslip):not(.printing-hall-ticket) .gc-table th,
    body:not(.printing-fee-receipt):not(.printing-payslip):not(.printing-hall-ticket) .gc-table td {
        padding: 4px !important;
        font-size: 9pt !important;
        word-wrap: break-word !important;
        overflow: visible !important;
    }

    body:not(.printing-fee-receipt):not(.printing-payslip):not(.printing-hall-ticket) .gc-student-info {
        font-size: 10pt !important;
        padding: 8px !important;
    }

    /* Print from modal - modal styling */
    body.printing-grade-card-modal > *:not(#gradeCardModal) { display: none !important; }

    body.printing-grade-card-modal #gradeCardModal {
        position: static !important;
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        box-shadow: none !important;
        background: white !important;
        left: 0 !important;
        top: 0 !important;
    }
    body.printing-grade-card-modal #gradeCardModal .modal-content {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        box-shadow: none !important;
        background: white !important;
    }
    body.printing-grade-card-modal #gradeCardModal .modal-header,
    body.printing-grade-card-modal #gradeCardModal .modal-footer { display: none !important; }
    body.printing-grade-card-modal #gradeCardModal .modal-body {
        padding: 10mm !important;
    }
    body.printing-grade-card-modal #gradeCardModal .gc-document {
        border: 2px solid #333 !important;
        box-shadow: none !important;
        padding: 8mm !important;
        margin: 0 !important;
        page-break-inside: avoid !important;
        page-break-after: avoid !important;
        width: 100% !important;
        max-width: 100% !important;
        background: white !important;
        box-sizing: border-box !important;
        overflow: visible !important;
    }
    body.printing-grade-card-modal #gradeCardModal .gc-document * {
        overflow: visible !important;
        box-sizing: border-box !important;
    }
    body.printing-grade-card-modal #gradeCardModal .gc-table {
        width: 100% !important;
        max-width: 100% !important;
        table-layout: auto !important;
        font-size: 8pt !important;
        page-break-inside: avoid !important;
    }
    body.printing-grade-card-modal #gradeCardModal .gc-table th,
    body.printing-grade-card-modal #gradeCardModal .gc-table td {
        padding: 4px !important;
        font-size: 7pt !important;
        word-wrap: break-word !important;
        overflow: visible !important;
    }

    /* Print container styling - only for grade cards */
    body:not(.printing-fee-receipt):not(.printing-payslip):not(.printing-hall-ticket) #print-container {
        display: block !important;
        position: static !important;
        width: 100% !important;
        padding: 10px !important;
        background: white !important;
    }

    /* Print from student view (not modal) */
    body.printing-grade-card-student {
        margin: 0 !important;
        padding: 0 !important;
    }
    body.printing-grade-card-student #gradeCardsContainer {
        display: block !important;
        width: 100% !important;
    }
    body.printing-grade-card-student #gradeCardsContainer .loading-spinner,
    body.printing-grade-card-student #gradeCardsContainer .error-container,
    body.printing-grade-card-student #noGradeCards {
        display: none !important;
    }
    body.printing-grade-card-student #cgpaBox {
        display: none !important;
    }
    body.printing-grade-card-student .gc-document {
        page-break-inside: avoid !important;
        page-break-after: always !important;
        overflow: visible !important;
    }
    body.printing-grade-card-student .gc-document:last-child {
        page-break-after: avoid !important;
    }

    /* Print Hall Ticket details from modal */
    body.printing-hall-ticket > *:not(#viewModal) { display: none !important; }

    body.printing-hall-ticket #viewModal {
        position: static !important;
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        box-shadow: none !important;
        background: white !important;
        left: 0 !important;
        top: 0 !important;
    }
    body.printing-hall-ticket #viewModal .modal-content {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        box-shadow: none !important;
        background: white !important;
    }
    body.printing-hall-ticket #viewModal .modal-header,
    body.printing-hall-ticket #viewModal .modal-footer { display: none !important; }
    body.printing-hall-ticket #viewModal .modal-body {
        padding: 0 !important;
    }
    body.printing-hall-ticket #viewModal .hall-ticket-card {
        border: 2px solid var(--primary) !important;
        box-shadow: none !important;
        margin: 0 !important;
        border-radius: 12px !important;
        page-break-inside: avoid;
        width: 100% !important;
        background: white !important;
    }
}

/* ============================================
   FEE MANAGEMENT STYLES
   ============================================ */

/* Fee Summary Cards */
.finance-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}
.finance-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border-top: 4px solid var(--primary);
}
.finance-card.danger { border-top-color: var(--danger); }
.finance-card.success { border-top-color: var(--success); }
.finance-card.warning { border-top-color: var(--warning); }
.finance-card-value { font-size: 28px; font-weight: 700; margin: 10px 0 5px 0; }
.finance-card-label { font-size: 14px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; }

/* Receipt Document */
.receipt-document {
    background: white;
    max-width: 800px;
    margin: 0 auto;
    border: 1px solid #ccc;
    padding: 40px;
    font-family: 'Courier New', Courier, monospace;
    color: #000;
    position: relative;
}
.receipt-header { text-align: center; border-bottom: 2px dashed #333; padding-bottom: 15px; margin-bottom: 20px; }
.receipt-header h2 { margin: 0; font-size: 22px; text-transform: uppercase; }
.receipt-details { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; font-size: 14px; margin-bottom: 20px; }
.receipt-table { width: 100%; border-collapse: collapse; margin-bottom: 20px; font-size: 14px; }
.receipt-table th, .receipt-table td { border: 1px solid #000; padding: 8px; text-align: left; }
.receipt-table th { background: #f0f0f0; text-align: center; }
.receipt-table td.right, .receipt-table th.right { text-align: right; }
.receipt-total-row td { font-weight: bold; background: #f9f9f9; }
.receipt-footer { margin-top: 30px; display: flex; justify-content: space-between; font-size: 12px; color: #555; }
.receipt-stamp { text-align: right; margin-top: 40px; font-weight: bold; border-top: 1px dotted #000; display: inline-block; padding-top: 5px; }

/* Receipt Copies Container */
.receipt-copies-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* Ensure modal content scrolls for receipt copies */
#receiptModal .modal-content {
    overflow-y: auto;
}

#receiptModal .receipt-wrapper {
    overflow-y: visible;
}

/* Fee Breakdown Table */
.fee-breakdown-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}
.fee-breakdown-item:last-child { border-bottom: none; font-weight: bold; font-size: 16px; color: var(--primary); }
.fee-breakdown-item-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.concession-info {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
}
.concession-info i {
    font-size: 12px;
}
.text-line-through {
    text-decoration: line-through;
    opacity: 0.7;
}
.ml-2 {
    margin-left: 8px;
}
.fee-status-paid { color: var(--success); text-decoration: line-through; opacity: 0.7; }

/* Receipt Print Styles - Removed - using comprehensive print styles below */

/* Fee Type Badge Colors */
.fee-type-tuition { background: #e3f2fd; color: #1976d2; }
.fee-type-exam { background: #fff3e0; color: #f57c00; }
.fee-type-library { background: #f3e5f5; color: #7b1fa2; }
.fee-type-lab { background: #e8f5e9; color: #388e3c; }
.fee-type-hostel { background: #fce4ec; color: #c2185b; }
.fee-type-transport { background: #e0f2f1; color: #00695c; }
.fee-type-other { background: #eceff1; color: #455a64; }

/* Payment Status Indicators */
.payment-status-pending { color: var(--danger); font-weight: 600; }
.payment-status-partial { color: var(--warning); font-weight: 600; }
.payment-status-paid { color: var(--success); font-weight: 600; }

/* Student Fee Summary Card */
.student-fee-summary {
    background: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.student-fee-summary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}
.student-fee-summary-title {
    font-size: 18px;
    font-weight: 600;
}
.student-fee-breakdown {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.fee-breakdown-section h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
    color: var(--text-secondary);
    text-transform: uppercase;
}

/* ============================================
   HR & PAYROLL STYLES
   ============================================ */

/* Payslip Document View */
.payslip-document {
    background: white;
    max-width: 800px;
    margin: 0 auto;
    border: 2px solid #333;
    padding: 40px;
    font-family: 'Arial', sans-serif;
    color: #000;
    position: relative;
}
.payslip-company-header {
    text-align: center;
    border-bottom: 3px double #333;
    padding-bottom: 15px;
    margin-bottom: 20px;
}
.payslip-company-header h1 { margin: 0; font-size: 24px; text-transform: uppercase; letter-spacing: 1px; }
.payslip-company-header h2 { margin: 5px 0 0 0; font-size: 18px; color: #555; font-weight: normal; }
.payslip-title { text-align: center; font-size: 20px; font-weight: bold; margin-bottom: 20px; text-decoration: underline; }
.payslip-emp-info { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; font-size: 13px; margin-bottom: 20px; border: 1px solid #ccc; padding: 12px; background: #f9f9f9; }
.payslip-table { width: 100%; border-collapse: collapse; margin-bottom: 20px; font-size: 13px; }
.payslip-table th, .payslip-table td { border: 1px solid #333; padding: 8px; }
.payslip-table th { background: #E2E8F0; text-align: center; }
.payslip-table td.right { text-align: right; }
.payslip-table tfoot td { font-weight: bold; background: #f0f0f0; }
.payslip-net-pay { text-align: right; font-size: 18px; font-weight: bold; margin-top: 10px; padding: 10px; border: 2px solid #000; }
.payslip-footer { display: flex; justify-content: space-between; margin-top: 50px; font-size: 12px; }
.payslip-signature { text-align: center; width: 200px; }
.payslip-signature hr { border: 1px solid #000; margin-top: 40px; }

/* Payroll Action Bar */
.payroll-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    align-items: center;
    flex-wrap: wrap;
    width: 100%;
    box-sizing: border-box;
}
.payroll-actions .form-group { margin-bottom: 0; min-width: 120px; flex: 1; }

/* Dynamic Salary Component Row */
.component-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 40px;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
}
.component-row .remove-row {
    background: var(--danger);
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
}
.add-component-btn {
    background: none;
    border: 1px dashed var(--primary);
    color: var(--primary);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    width: 100%;
    margin-top: 10px;
    font-weight: 600;
}
.add-component-btn:hover { background: rgba(59, 130, 246, 0.05); }

/* Leave Balance Display */
.leave-balance-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}
.leave-balance-card {
    background: white;
    padding: 16px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid var(--border-color);
}
.leave-balance-card .balance-value { font-size: 24px; font-weight: bold; color: var(--primary); }
.leave-balance-card .balance-label { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }

/* My Leaves - Leave Balance Grid */
.leave-balance-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.balance-card {
    padding: 16px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid var(--border-color);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.balance-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.balance-card .balance-label {
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 4px;
}

.balance-card .balance-value {
    font-size: 28px;
    font-weight: 700;
    line-height: 1;
}

.balance-card .balance-sub {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.balance-footer {
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

/* Leave Balance Card Colors */
.casual-leave-card {
            background: linear-gradient(135deg, #2563EB 0%, #06B6D4 100%);
    color: white;
}
.casual-leave-card .balance-label { color: rgba(255, 255, 255, 0.9); }
.casual-leave-card .balance-sub { color: rgba(255, 255, 255, 0.7); }

.sick-leave-card {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}
.sick-leave-card .balance-label { color: rgba(255, 255, 255, 0.9); }
.sick-leave-card .balance-sub { color: rgba(255, 255, 255, 0.7); }

.earned-leave-card {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
}
.earned-leave-card .balance-label { color: rgba(255, 255, 255, 0.9); }
.earned-leave-card .balance-sub { color: rgba(255, 255, 255, 0.7); }

.medical-leave-card {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    color: white;
}
.medical-leave-card .balance-label { color: rgba(255, 255, 255, 0.9); }
.medical-leave-card .balance-sub { color: rgba(255, 255, 255, 0.7); }

/* Employee Photo Preview */
.employee-photo-preview {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--border-color);
    margin-top: 10px;
}

/* Payroll Status Indicators */
.payroll-status-draft { color: var(--text-secondary); }
.payroll-status-processed { color: var(--info); }
.payroll-status-paid { color: var(--success); font-weight: bold; }

/* Salary Calculation Preview */
.salary-calc-preview {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 6px;
    margin-top: 12px;
    font-size: 14px;
}
.salary-calc-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
}
.salary-calc-row.total {
    border-top: 1px solid var(--border-color);
    margin-top: 8px;
    padding-top: 8px;
    font-weight: bold;
}

/* Payslip Print Styles - Only apply when specifically printing payslip */
@media print {
    body.printing-payslip > *:not(.app-container),
    body.printing-payslip .app-container > *:not(.main-content),
    body.printing-payslip .main-content > *:not(.content),
    body.printing-payslip .content > *:not(.payslip-wrapper) {
        display: none !important;
    }

    body.printing-payslip .payslip-wrapper {
        display: block !important;
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
    }

    body.printing-payslip .payslip-document {
        border: none !important;
        box-shadow: none !important;
        max-width: 100% !important;
        padding: 20px !important;
    }

    body.printing-payslip {
        margin: 0 !important;
        padding: 0 !important;
        background: white !important;
    }

    body.printing-payslip .app-container,
    body.printing-payslip .main-content,
    body.printing-payslip .content {
        display: block !important;
        margin: 0 !important;
        padding: 0 !important;
    }
}

/* ============================================
   NOTIFICATIONS STYLES
   ============================================ */

.notification-item {
        display: flex;
        gap: 16px;
        padding: 16px 20px;
        border-bottom: 1px solid var(--border-color);
        cursor: pointer;
        transition: background 0.2s;
        position: relative;
    }
    .notification-item:hover { background: #f8f9fa; }
    .notification-item.unread {
        background: #eef2ff;
        border-left: 4px solid var(--primary);
    }
    .notification-item.unread:hover { background: #e0e7ff; }
    .noti-icon {
        width: 40px;
        height: 40px;
        border-radius: 50%;
        background: var(--body-bg);
        display: flex;
        align-items: center;
        justify-content: center;
        color: var(--text-secondary);
        flex-shrink: 0;
    }
    .notification-item.unread .noti-icon { background: var(--primary); color: white; }
    .noti-content { flex: 1; }
    .noti-title { font-weight: 600; margin-bottom: 4px; color: var(--text-primary); }
    .noti-message { font-size: 14px; color: var(--text-secondary); margin-bottom: 4px; }
    .noti-meta { font-size: 12px; color: #999; display: flex; gap: 16px; }
    .noti-actions {
        display: flex;
        align-items: center;
        gap: 8px;
    }
    .noti-download {
        color: var(--primary);
        text-decoration: none;
        padding: 4px 8px;
        border: 1px solid var(--primary);
        border-radius: 4px;
        font-size: 12px;
        transition: all 0.2s;
    }
    .noti-download:hover {
        background: var(--primary);
        color: white;
    }
    .notification-empty {
        text-align: center;
        padding: 60px 20px;
        color: var(--text-secondary);
    }
    .notification-empty i {
        font-size: 48px;
        margin-bottom: 16px;
        opacity: 0.5;
    }

    /* ============================================
       AUDIT LOG STYLES
       ============================================ */

    .audit-timeline {
        position: relative;
        padding-left: 30px;
        max-width: 800px;
        margin: 0 auto;
    }
    .audit-timeline::before {
        content: '';
        position: absolute;
        left: 8px;
        top: 0;
        bottom: 0;
        width: 2px;
        background: var(--border-color);
    }
    .audit-item {
        position: relative;
        margin-bottom: 24px;
        background: white;
        padding: 16px;
        border-radius: 8px;
        box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    }
    .audit-item::before {
        content: '';
        position: absolute;
        left: -26px;
        top: 20px;
        width: 12px;
        height: 12px;
        border-radius: 50%;
        background: var(--primary);
        border: 2px solid white;
        box-shadow: 0 0 0 2px var(--primary);
    }
    .audit-item.create::before { background: var(--success); box-shadow: 0 0 0 2px var(--success); }
    .audit-item.delete::before { background: var(--danger); box-shadow: 0 0 0 2px var(--danger); }
    .audit-item.update::before { background: var(--warning); box-shadow: 0 0 0 2px var(--warning); }
    .audit-item.login::before { background: var(--info); box-shadow: 0 0 0 2px var(--info); }
    .audit-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 8px;
        flex-wrap: wrap;
        gap: 8px;
    }
    .audit-user {
        font-weight: 600;
        color: var(--text-primary);
    }
    .audit-action {
        font-size: 11px;
        padding: 3px 8px;
        border-radius: 4px;
        background: #eef2ff;
        color: var(--primary);
        font-weight: 600;
        text-transform: uppercase;
    }
    .audit-action.create { background: #dcfce7; color: #166534; }
    .audit-action.delete { background: #FEE2E2; color: #991B1B; }
    .audit-action.update { background: #fef3c7; color: #92400E; }
    .audit-action.login { background: #CFFAFE; color: #155E75; }
    .audit-action.logout { background: #F1F5F9; color: #334155; }
    .audit-desc {
        font-size: 14px;
        color: var(--text-secondary);
        margin-bottom: 8px;
    }
    .audit-footer {
        font-size: 12px;
        color: #999;
        display: flex;
        gap: 20px;
        flex-wrap: wrap;
    }
    .audit-footer span {
        display: flex;
        align-items: center;
        gap: 4px;
    }

    /* ============================================
       PROFILE PAGE STYLES
       ============================================ */

    .profile-header {
        display: flex;
        align-items: center;
        gap: 30px;
        background: white;
        padding: 30px;
        border-radius: 12px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.06);
        margin-bottom: 24px;
    }
    .profile-avatar {
        width: 120px;
        height: 120px;
        border-radius: 50%;
        background: linear-gradient(135deg, var(--primary), var(--primary-dark));
        color: white;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 48px;
        font-weight: bold;
        flex-shrink: 0;
    }
    .profile-info h2 {
        margin: 0 0 4px 0;
        font-size: 24px;
        color: var(--text-primary);
    }
    .profile-info p {
        margin: 0;
        color: var(--text-secondary);
    }
    .profile-email {
        font-size: 14px;
        margin-top: 4px;
    }
    .profile-role {
        display: inline-block;
        margin-top: 12px;
        padding: 4px 12px;
        background: var(--primary);
        color: white;
        border-radius: 20px;
        font-size: 13px;
        font-weight: 500;
    }
    .profile-quick-links {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 16px;
        margin-top: 24px;
    }
    .quick-link-card {
        background: white;
        padding: 16px 20px;
        border-radius: 8px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.06);
        display: flex;
        align-items: center;
        gap: 12px;
        text-decoration: none;
        color: var(--text-primary);
        transition: all 0.2s;
        border: 1px solid var(--border-color);
    }
    .quick-link-card:hover {
        border-color: var(--primary);
        box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
        transform: translateY(-2px);
    }
    .quick-link-icon {
        width: 40px;
        height: 40px;
        border-radius: 8px;
        background: var(--body-bg);
        display: flex;
        align-items: center;
        justify-content: center;
        color: var(--primary);
        font-size: 18px;
    }
    .quick-link-text {
        font-weight: 500;
    }

    /* ============================================
       GLOBAL LOADER
       ============================================ */

    #global-loader {
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(255,255,255,0.95);
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 9999;
        transition: opacity 0.3s;
    }
    #global-loader.hidden {
        opacity: 0;
        pointer-events: none;
    }
    .loader-spinner {
        width: 50px;
        height: 50px;
        border: 4px solid var(--border-color);
        border-top-color: var(--primary);
        border-right-color: var(--primary);
        border-radius: 50%;
        animation: spin 0.8s linear infinite;
    }

    /* ============================================
       ACCESS DENIED PAGE
       ============================================ */

    .access-denied-container {
        text-align: center;
        padding: 80px 20px;
        background: white;
        border-radius: 12px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.06);
        max-width: 500px;
        margin: 40px auto;
    }
    .access-denied-icon {
        font-size: 72px;
        margin-bottom: 20px;
    }
    .access-denied-container h2 {
        margin: 0 0 10px 0;
        color: var(--text-primary);
    }
    .access-denied-container p {
        margin: 0;
        color: var(--text-secondary);
    }


/* === CONSOLIDATED SURFACE POLISH (Refined Blue) ===
   Normalize depth + radius on commonly-used white panels so the whole
   app reads as one system. Only box-shadow + border-radius are set here;
   per-component accent borders (top/left) are intentionally preserved. */
.finance-card,
.student-fee-summary,
.payroll-actions,
.marks-header-info,
.marks-table-wrapper,
.timetable-grid-wrapper,
.att-grid-container,
.calendar-container,
.overall-att-stat,
.assignment-info-header,
.profile-header,
.access-denied-container,
.audit-item,
.leave-balance-card,
.balance-card,
.marks-stat-card,
.submission-card,
.quick-link-card {
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

/* ============================================
   PRINT STYLES - FEE RECEIPT
   ============================================ */

@media print {
    /* Print Fee Receipt from modal - HIGHEST PRIORITY */
    html.printing-fee-receipt body,
    html.printing-fee-receipt,
    body.printing-fee-receipt {
        margin: 0 !important;
        padding: 0 !important;
        background: white !important;
    }

    /* CRITICAL: Hide EVERYTHING first */
    html.printing-fee-receipt *,
    body.printing-fee-receipt * {
        display: none !important;
    }

    /* Then show ONLY the receipt modal and all its descendants */
    html.printing-fee-receipt #receiptModal,
    html.printing-fee-receipt #receiptModal *,
    body.printing-fee-receipt #receiptModal,
    body.printing-fee-receipt #receiptModal * {
        display: block !important;
    }

    /* Fix table display properties */
    html.printing-fee-receipt #receiptModal table,
    body.printing-fee-receipt #receiptModal table {
        display: table !important;
    }

    html.printing-fee-receipt #receiptModal thead,
    body.printing-fee-receipt #receiptModal thead {
        display: table-header-group !important;
    }

    html.printing-fee-receipt #receiptModal tbody,
    body.printing-fee-receipt #receiptModal tbody {
        display: table-row-group !important;
    }

    html.printing-fee-receipt #receiptModal tr,
    body.printing-fee-receipt #receiptModal tr {
        display: table-row !important;
    }

    html.printing-fee-receipt #receiptModal td,
    html.printing-fee-receipt #receiptModal th,
    body.printing-fee-receipt #receiptModal td,
    body.printing-fee-receipt #receiptModal th {
        display: table-cell !important;
    }

    /* Hide modal header and footer */
    html.printing-fee-receipt #receiptModal .modal-header,
    html.printing-fee-receipt #receiptModal .modal-footer,
    body.printing-fee-receipt #receiptModal .modal-header,
    body.printing-fee-receipt #receiptModal .modal-footer {
        display: none !important;
    }

    /* Position and style the receipt modal */
    html.printing-fee-receipt #receiptModal,
    body.printing-fee-receipt #receiptModal {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        background: white !important;
        z-index: 999999 !important;
        opacity: 1 !important;
        visibility: visible !important;
    }

    /* Style modal content */
    html.printing-fee-receipt #receiptModal .modal-content,
    body.printing-fee-receipt #receiptModal .modal-content {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        max-height: none !important;
        margin: 0 !important;
        padding: 0 !important;
        box-shadow: none !important;
        background: white !important;
        border: none !important;
        border-radius: 0 !important;
        overflow: visible !important;
    }

    /* Hide modal header and footer */
    html.printing-fee-receipt #receiptModal .modal-header,
    html.printing-fee-receipt #receiptModal .modal-footer,
    body.printing-fee-receipt #receiptModal .modal-header,
    body.printing-fee-receipt #receiptModal .modal-footer {
        display: none !important;
    }

    /* Style modal body */
    html.printing-fee-receipt #receiptModal .modal-body,
    body.printing-fee-receipt #receiptModal .modal-body {
        display: block !important;
        padding: 20px !important;
        width: 100% !important;
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
    }

    /* Style receipt wrapper */
    html.printing-fee-receipt #receiptModal .receipt-wrapper,
    body.printing-fee-receipt #receiptModal .receipt-wrapper {
        display: block !important;
        width: 100% !important;
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
    }

    /* Style receipt document */
    html.printing-fee-receipt #receiptModal .receipt-document,
    body.printing-fee-receipt #receiptModal .receipt-document {
        display: block !important;
        border: none !important;
        box-shadow: none !important;
        padding: 20px !important;
        margin: 0 0 20px 0 !important;
        page-break-inside: avoid !important;
        page-break-after: always !important;
        break-after: page !important;
        width: 100% !important;
        background: white !important;
        min-height: 90vh !important;
    }

    html.printing-fee-receipt #receiptModal .receipt-document:last-child,
    body.printing-fee-receipt #receiptModal .receipt-document:last-child {
        page-break-after: auto !important;
        break-after: auto !important;
        margin-bottom: 0 !important;
    }

    /* Style copies container */
    html.printing-fee-receipt #receiptModal .receipt-copies-container,
    body.printing-fee-receipt #receiptModal .receipt-copies-container {
        display: block !important;
        width: 100% !important;
        height: auto !important;
        overflow: visible !important;
    }

    html.printing-fee-receipt #receiptModal .receipt-copies-container > *,
    body.printing-fee-receipt #receiptModal .receipt-copies-container > * {
        display: block !important;
        visibility: visible !important;
    }

    html.printing-fee-receipt #receiptModal .modal-content {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        max-height: none !important;
        margin: 0 auto !important;
        padding: 0 !important;
        box-shadow: none !important;
        background: white !important;
        border: none !important;
        border-radius: 0 !important;
        overflow: visible !important;
    }

    /* Hide modal header and footer */
    html.printing-fee-receipt #receiptModal .modal-header,
    html.printing-fee-receipt #receiptModal .modal-footer {
        display: none !important;
    }

    html.printing-fee-receipt #receiptModal .modal-body {
        display: block !important;
        padding: 0 !important;
        width: 100% !important;
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
    }

    html.printing-fee-receipt #receiptModal .receipt-wrapper {
        display: block !important;
        width: 100% !important;
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
    }

    html.printing-fee-receipt #receiptModal .receipt-document {
        display: block !important;
        border: none !important;
        box-shadow: none !important;
        padding: 20px !important;
        margin: 0 0 20px 0 !important;
        page-break-inside: avoid !important;
        page-break-after: always !important;
        break-after: page !important;
        width: 100% !important;
        background: white !important;
        min-height: 90vh !important;
    }

    html.printing-fee-receipt #receiptModal .receipt-document:last-child {
        page-break-after: auto !important;
        break-after: auto !important;
        margin-bottom: 0 !important;
    }

    html.printing-fee-receipt #receiptModal .receipt-copies-container {
        display: block !important;
        width: 100% !important;
        height: auto !important;
        overflow: visible !important;
    }

    html.printing-fee-receipt #receiptModal .receipt-copies-container > *,
    body.printing-fee-receipt #receiptModal .receipt-copies-container > * {
        display: block !important;
        visibility: visible !important;
    }

    /* Page setup for A4 */
    @page {
        margin: 12mm 15mm 12mm 15mm;
        size: A4 portrait;
    }

    /* Receipt header styling */
    html.printing-fee-receipt #receiptModal .receipt-header h2,
    body.printing-fee-receipt #receiptModal .receipt-header h2 {
        font-size: 16pt !important;
        color: black !important;
        text-align: center !important;
        margin: 0 0 5px 0 !important;
        font-weight: bold !important;
    }

    html.printing-fee-receipt #receiptModal .receipt-header p,
    body.printing-fee-receipt #receiptModal .receipt-header p {
        font-size: 11pt !important;
        color: black !important;
        text-align: center !important;
        margin: 0 0 15px 0 !important;
    }

    /* Receipt details styling */
    html.printing-fee-receipt #receiptModal .receipt-details,
    body.printing-fee-receipt #receiptModal .receipt-details {
        font-size: 11pt !important;
        color: black !important;
        margin: 15px 0 !important;
        line-height: 1.6 !important;
    }

    html.printing-fee-receipt #receiptModal .receipt-details div,
    body.printing-fee-receipt #receiptModal .receipt-details div {
        color: black !important;
        padding: 4px 0 !important;
    }

    html.printing-fee-receipt #receiptModal .receipt-details strong,
    body.printing-fee-receipt #receiptModal .receipt-details strong {
        font-weight: bold !important;
        color: black !important;
    }

    /* Receipt table styling */
    html.printing-fee-receipt #receiptModal .receipt-table,
    body.printing-fee-receipt #receiptModal .receipt-table {
        width: 100% !important;
        border-collapse: collapse !important;
        margin: 15px 0 !important;
        font-size: 10pt !important;
    }

    html.printing-fee-receipt #receiptModal .receipt-table th,
    body.printing-fee-receipt #receiptModal .receipt-table th {
        background: #f5f5f5 !important;
        color: black !important;
        font-size: 10pt !important;
        padding: 8px !important;
        border: 1px solid #000 !important;
        text-align: left !important;
        font-weight: bold !important;
    }

    html.printing-fee-receipt #receiptModal .receipt-table td,
    body.printing-fee-receipt #receiptModal .receipt-table td {
        color: black !important;
        font-size: 10pt !important;
        padding: 8px !important;
        border: 1px solid #000 !important;
        vertical-align: middle !important;
    }

    html.printing-fee-receipt #receiptModal .receipt-table .right,
    body.printing-fee-receipt #receiptModal .receipt-table .right {
        text-align: right !important;
    }

    html.printing-fee-receipt #receiptModal .receipt-table td strong,
    body.printing-fee-receipt #receiptModal .receipt-table td strong {
        font-weight: bold !important;
        color: black !important;
    }

    html.printing-fee-receipt #receiptModal .receipt-total-row,
    body.printing-fee-receipt #receiptModal .receipt-total-row {
        background: #f5f5f5 !important;
        font-weight: bold !important;
    }

    html.printing-fee-receipt #receiptModal .receipt-total-row td,
    body.printing-fee-receipt #receiptModal .receipt-total-row td {
        font-weight: bold !important;
    }

    /* Receipt footer styling */
    html.printing-fee-receipt #receiptModal .receipt-footer,
    body.printing-fee-receipt #receiptModal .receipt-footer {
        margin-top: 25px !important;
        padding-top: 15px !important;
        border-top: 1px solid #000 !important;
        font-size: 9pt !important;
    }

    html.printing-fee-receipt #receiptModal .receipt-footer p,
    body.printing-fee-receipt #receiptModal .receipt-footer p {
        color: black !important;
        font-size: 9pt !important;
        margin: 2px 0 !important;
    }

    html.printing-fee-receipt #receiptModal .receipt-stamp,
    body.printing-fee-receipt #receiptModal .receipt-stamp {
        text-align: right !important;
        margin-top: 35px !important;
    }

    html.printing-fee-receipt #receiptModal .receipt-stamp p,
    body.printing-fee-receipt #receiptModal .receipt-stamp p {
        color: black !important;
        font-weight: bold !important;
    }

    /* Ensure all text is black */
    html.printing-fee-receipt #receiptModal *,
    body.printing-fee-receipt #receiptModal * {
        color: black !important;
        text-shadow: none !important;
    }

    /* Hide elements with no-print class */
    html.printing-fee-receipt #receiptModal .no-print,
    body.printing-fee-receipt #receiptModal .no-print {
        display: none !important;
    }

    /* Force display of all receipt content */
    html.printing-fee-receipt #receiptModal .receipt-document > *,
    body.printing-fee-receipt #receiptModal .receipt-document > * {
        display: block !important;
        visibility: visible !important;
    }

    /* Ensure table display properties */
    html.printing-fee-receipt #receiptModal table,
    body.printing-fee-receipt #receiptModal table {
        display: table !important;
        visibility: visible !important;
    }

    html.printing-fee-receipt #receiptModal thead,
    body.printing-fee-receipt #receiptModal thead {
        display: table-header-group !important;
        visibility: visible !important;
    }

    html.printing-fee-receipt #receiptModal tbody,
    body.printing-fee-receipt #receiptModal tbody {
        display: table-row-group !important;
        visibility: visible !important;
    }

    html.printing-fee-receipt #receiptModal tr,
    body.printing-fee-receipt #receiptModal tr {
        display: table-row !important;
        visibility: visible !important;
    }

    html.printing-fee-receipt #receiptModal td,
    html.printing-fee-receipt #receiptModal th,
    body.printing-fee-receipt #receiptModal td,
    body.printing-fee-receipt #receiptModal th {
        display: table-cell !important;
        visibility: visible !important;
    }

    @page {
        margin: 15mm;
        size: A4;
    }

    html.printing-fee-receipt #receiptModal .receipt-header h2 {
        font-size: 18pt !important;
        color: black !important;
        text-align: center !important;
    }

    html.printing-fee-receipt #receiptModal .receipt-header p {
        font-size: 12pt !important;
        color: black !important;
        text-align: center !important;
    }

    html.printing-fee-receipt #receiptModal .receipt-details {
        font-size: 11pt !important;
        color: black !important;
        margin: 15px 0 !important;
    }

    html.printing-fee-receipt #receiptModal .receipt-details div {
        color: black !important;
        padding: 5px 0 !important;
    }

    html.printing-fee-receipt #receiptModal .receipt-table {
        width: 100% !important;
        border-collapse: collapse !important;
        margin: 15px 0 !important;
    }

    html.printing-fee-receipt #receiptModal .receipt-table th {
        background: #f0f0f0 !important;
        color: black !important;
        font-size: 11pt !important;
        padding: 8px !important;
        border: 1px solid #000 !important;
    }

    html.printing-fee-receipt #receiptModal .receipt-table td {
        color: black !important;
        font-size: 10pt !important;
        padding: 8px !important;
        border: 1px solid #000 !important;
    }

    html.printing-fee-receipt #receiptModal .receipt-table .right {
        text-align: right !important;
    }

    html.printing-fee-receipt #receiptModal .receipt-total-row {
        background: #f0f0f0 !important;
        font-weight: bold !important;
    }

    html.printing-fee-receipt #receiptModal .receipt-footer {
        margin-top: 30px !important;
        padding-top: 20px !important;
        border-top: 1px solid #000 !important;
    }

    html.printing-fee-receipt #receiptModal .receipt-footer p {
        color: black !important;
        font-size: 9pt !important;
    }

    html.printing-fee-receipt #receiptModal .receipt-stamp {
        text-align: right !important;
        margin-top: 40px !important;
    }

    html.printing-fee-receipt #receiptModal .receipt-stamp p {
        color: black !important;
    }

    /* Also support body class only for backward compatibility */
    body.printing-fee-receipt:not(:has(html.printing-fee-receipt)) #receiptModal {
        display: block !important;
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        background: white !important;
    }

    body.printing-fee-receipt:not(:has(html.printing-fee-receipt)) .app-container > *:not(.main-content),
    body.printing-fee-receipt:not(:has(html.printing-fee-receipt)) .main-content > *:not(.content),
    body.printing-fee-receipt:not(:has(html.printing-fee-receipt)) .content > *:not(#receiptModal) {
        display: none !important;
    }
}

/* ============================================
   PRINT & EXPORT BUTTONS
   ============================================ */

.print-export-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-print-export {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    border: 1.5px solid;
}

.btn-print-export:hover {
    opacity: 0.85;
    transform: scale(1.02);
}

.btn-print-export:active {
    transform: scale(0.98);
}

.btn-print {
    background: transparent;
    border-color: var(--dark);
    color: var(--dark);
}

.btn-print:hover {
    background: rgba(26, 26, 46, 0.05);
}

.btn-export {
    background: var(--dark);
    border-color: var(--dark);
    color: white;
}

.btn-export:hover {
    background: rgba(26, 26, 46, 0.9);
}

.btn-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Mobile responsive - show icons only */
@media (max-width: 640px) {
    .btn-print-export span {
        display: none;
    }
    .btn-print-export {
        padding: 8px;
        min-width: 36px;
    }
}

/* ============================================
   GLOBAL PRINT MEDIA QUERY
   ============================================ */

@media print {
    /* Setup */
    @page {
        size: A4;
        margin: 15mm;
    }

    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    body,
    html {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        height: auto !important;
        overflow: visible !important;
        background: white !important;
    }

    /* Reset layout to prevent blank first page */
    body > * {
        position: static !important;
    }

    .app-container {
        display: block !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        height: auto !important;
        overflow: visible !important;
        position: static !important;
        float: none !important;
    }

    .main-content {
        margin-left: 0 !important;
        margin-right: 0 !important;
        margin-top: 0 !important;
        width: 100% !important;
        padding: 0 !important;
        position: static !important;
        float: none !important;
        clear: both !important;
        min-height: auto !important;  /* Override 100vh min-height */
        height: auto !important;
    }

    /* Completely remove sidebar and related elements */
    .sidebar, aside, .sidebar-overlay {
        display: none !important;
        width: 0 !important;
        height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        position: absolute !important;
        left: -9999px !important;
        visibility: hidden !important;
        float: none !important;
    }

    /* Ensure content starts immediately */
    .content, main {
        margin-top: 0 !important;
        padding-top: 0 !important;
    }

    /* Hide navigation and UI elements */
    nav, header, footer, aside, .sidebar, .navbar, .no-print,
    .sidebar-overlay, .header, .hamburger, .notification-btn,
    .user-dropdown, .modal, .modal-overlay, .toast-container,
    #toastContainer, #confirmModal, .filter-bar, .search-bar,
    .pagination, .print-export-group, .page-header, .page-header-actions,
    .filter-container, .filters, select[id*="Filter"], select[id*="filter"],
    button[id*="Filter"], button[id*="filter"], .filter-btn {
        display: none !important;
    }

    /* Hide action buttons but keep data visible */
    .btn, .action-btn, .add-btn, .edit-btn, .delete-btn, .view-btn {
        display: none !important;
    }

    /* Make content full width and visible */
    .app-container, .main-content, .content, main {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        display: block !important;
        position: static !important;
    }

    /* Ensure app-container doesn't cause blank page */
    .app-container {
        display: block !important;
        width: 100% !important;
        height: auto !important;
        overflow: visible !important;
    }

    /* Ensure sidebar doesn't take up space when hidden */
    .sidebar, aside {
        display: none !important;
        width: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Ensure all containers are visible */
    .dashboard-container, .stats-grid, .charts-grid, .lists-grid,
    .table-container, .card, .panel, .section {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        overflow: visible !important;
    }

    /* Stats cards - display all */
    .stats-grid, .finance-summary-grid, .charts-grid {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 16px !important;
        page-break-inside: avoid;
    }

    @media (max-width: 210mm) {
        .stats-grid, .finance-summary-grid, .charts-grid {
            grid-template-columns: repeat(2, 1fr) !important;
        }
    }

    .stats-card, .finance-card {
        border: 1px solid #000 !important;
        background: white !important;
        padding: 12px !important;
        margin-bottom: 10px !important;
        page-break-inside: avoid;
        display: block !important;
    }

    .stats-card-value, .finance-card-value {
        font-size: 14pt !important;
        font-weight: bold !important;
        color: black !important;
    }

    .stats-card-label, .finance-card-label {
        font-size: 9pt !important;
        color: black !important;
    }

    /* Tables - show all columns */
    table {
        width: 100% !important;
        border-collapse: collapse !important;
        page-break-inside: auto;
        font-size: 9pt !important;
    }

    table tr {
        page-break-inside: avoid;
    }

    table th, table td {
        border: 1px solid #000 !important;
        padding: 6px 8px !important;
        color: black !important;
        page-break-inside: avoid;
    }

    table th {
        font-weight: bold !important;
        background: #f0f0f0 !important;
    }

    /* Show all table columns - don't hide last column */
    table th, table td {
        display: table-cell !important;
    }

    /* Cards and sections */
    .card, .panel, .section {
        border: 1px solid #000 !important;
        background: white !important;
        margin-bottom: 16px !important;
        page-break-inside: avoid;
    }

    .card-header {
        border-bottom: 2px solid #000 !important;
        padding: 10px !important;
    }

    .card-body {
        padding: 10px !important;
    }

    /* Page headers */
    .page-header {
        margin-bottom: 20px !important;
        border-bottom: 2px solid #000 !important;
        padding-bottom: 10px !important;
    }

    .page-header h1 {
        font-size: 16pt !important;
        color: black !important;
    }

    /* Text colors */
    .text-secondary, .text-muted, .text-primary, .text-success,
    .text-danger, .text-warning, .text-info {
        color: black !important;
    }

    /* Badges */
    .badge {
        border: 1px solid #000 !important;
        background: white !important;
        color: black !important;
        padding: 2px 6px !important;
    }

    /* Links - show as text */
    a {
        color: black !important;
        text-decoration: none !important;
    }

    a[href^="http"]::after {
        content: " (" attr(href) ")";
        font-size: 8pt;
    }

    /* Show charts in print */
    canvas {
        display: block !important;
        max-width: 100% !important;
        height: auto !important;
        page-break-inside: avoid;
    }

    /* Show converted canvas images in print */
    img[data-original-canvas="true"] {
        display: block !important;
        max-width: 100% !important;
        height: auto !important;
        page-break-inside: avoid;
    }

    .chart-canvas-container {
        display: block !important;
        height: 300px !important;
        page-break-inside: avoid;
    }

    /* Hide empty elements */
    :empty {
        display: none !important;
    }

    /* Ensure page breaks don't occur in middle of content */
    .stats-card, .card, .finance-card, table, .list-item {
        page-break-inside: avoid;
    }

    /* FEE RECEIPT PRINT OVERRIDES - Must come after general print rules */
    /* CRITICAL: These rules override the general .modal hiding rule above */
    html.printing-fee-receipt #receiptModal,
    body.printing-fee-receipt #receiptModal {
        display: block !important;
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: auto !important;
        background: white !important;
        z-index: 999999 !important;
    }

    html.printing-fee-receipt #receiptModal .modal-content,
    body.printing-fee-receipt #receiptModal .modal-content {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        max-height: none !important;
        margin: 0 !important;
        padding: 0 !important;
        box-shadow: none !important;
        background: white !important;
        border: none !important;
        border-radius: 0 !important;
        overflow: visible !important;
    }

    html.printing-fee-receipt #receiptModal .modal-body,
    body.printing-fee-receipt #receiptModal .modal-body {
        display: block !important;
        width: 100% !important;
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
        padding: 20px !important;
    }

    html.printing-fee-receipt #receiptModal .receipt-copies-container,
    html.printing-fee-receipt #receiptModal .receipt-document,
    html.printing-fee-receipt #receiptModal .receipt-header,
    html.printing-fee-receipt #receiptModal .receipt-details,
    html.printing-fee-receipt #receiptModal .receipt-table,
    html.printing-fee-receipt #receiptModal .receipt-footer,
    body.printing-fee-receipt #receiptModal .receipt-copies-container,
    body.printing-fee-receipt #receiptModal .receipt-document,
    body.printing-fee-receipt #receiptModal .receipt-header,
    body.printing-fee-receipt #receiptModal .receipt-details,
    body.printing-fee-receipt #receiptModal .receipt-table,
    body.printing-fee-receipt #receiptModal .receipt-footer {
        display: block !important;
        visibility: visible !important;
        width: 100% !important;
    }

    html.printing-fee-receipt #receiptModal table,
    html.printing-fee-receipt #receiptModal thead,
    html.printing-fee-receipt #receiptModal tbody,
    html.printing-fee-receipt #receiptModal tr,
    html.printing-fee-receipt #receiptModal td,
    html.printing-fee-receipt #receiptModal th,
    body.printing-fee-receipt #receiptModal table,
    body.printing-fee-receipt #receiptModal thead,
    body.printing-fee-receipt #receiptModal tbody,
    body.printing-fee-receipt #receiptModal tr,
    body.printing-fee-receipt #receiptModal td,
    body.printing-fee-receipt #receiptModal th {
        display: table-cell !important;
        visibility: visible !important;
    }

    html.printing-fee-receipt #receiptModal table,
    body.printing-fee-receipt #receiptModal table {
        display: table !important;
    }

    html.printing-fee-receipt #receiptModal thead,
    body.printing-fee-receipt #receiptModal thead {
        display: table-header-group !important;
    }

    html.printing-fee-receipt #receiptModal tbody,
    body.printing-fee-receipt #receiptModal tbody {
        display: table-row-group !important;
    }

    html.printing-fee-receipt #receiptModal tr,
    body.printing-fee-receipt #receiptModal tr {
        display: table-row !important;
    }

    html.printing-fee-receipt #receiptModal .modal-header,
    html.printing-fee-receipt #receiptModal .modal-footer,
    body.printing-fee-receipt #receiptModal .modal-header,
    body.printing-fee-receipt #receiptModal .modal-footer {
        display: none !important;
    }
}

/* === SEARCH SUGGESTIONS === */
.search-suggestions {
    position: fixed !important;
    background: #ffffff !important;
    border: 1px solid #E2E8F0 !important;
    border-radius: 0 0 6px 6px !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12) !important;
    max-height: 300px !important;
    overflow-y: auto !important;
    z-index: 99999 !important;
    display: none !important;
    min-width: 300px !important;
    max-width: 600px !important;
}

.search-suggestions::-webkit-scrollbar {
    width: 6px;
}

.search-suggestions::-webkit-scrollbar-track {
    background: var(--light);
}

.search-suggestions::-webkit-scrollbar-thumb {
    background-color: var(--sidebar-active);
    border-radius: 3px;
}

.suggestion-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: background-color var(--transition);
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background-color: var(--sidebar-hover);
}

.suggestion-name {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.suggestion-details {
    display: flex;
    gap: 12px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.suggestion-roll {
    background-color: var(--light);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-weight: 500;
}

.suggestion-program {
    color: var(--primary);
}


/* === SEARCH SUGGESTIONS === */
.search-suggestions {
    position: fixed !important;
    background: #ffffff !important;
    border: 1px solid #E2E8F0 !important;
    border-radius: 0 0 6px 6px !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12) !important;
    max-height: 300px !important;
    overflow-y: auto !important;
    z-index: 99999 !important;
    display: none !important;
    min-width: 300px !important;
    max-width: 600px !important;
}

.search-suggestions::-webkit-scrollbar {
    width: 6px;
}

.search-suggestions::-webkit-scrollbar-track {
    background: var(--light);
}

.search-suggestions::-webkit-scrollbar-thumb {
    background-color: var(--sidebar-active);
    border-radius: 3px;
}

.suggestion-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: background-color var(--transition);
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background-color: var(--sidebar-hover);
}

.suggestion-name {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.suggestion-item {
    display: block !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.suggestion-details {
    display: flex !important;
    gap: 12px !important;
    font-size: 0.875rem !important;
    color: #64748B !important;
}

.suggestion-roll {
    background-color: #f8f9fa !important;
    padding: 2px 8px !important;
    border-radius: 4px !important;
    font-weight: 500 !important;
}

.suggestion-program {
    color: #2563EB !important;
}

/* Search wrapper for proper positioning */
.search-wrapper {
    position: relative !important;
    flex: 1 !important;
    width: 100% !important;
}

/* Force search suggestions to be visible */
#searchSuggestions {
    position: fixed !important;
    display: none !important;
    visibility: visible !important;
    opacity: 1 !important;
    z-index: 99999 !important;
    background: #ffffff !important;
    border: 2px solid #2563EB !important;
    border-radius: 8px !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3) !important;
    max-height: 400px !important;
    overflow-y: auto !important;
    padding: 8px 0 !important;
    min-width: 300px !important;
    max-width: 600px !important;
}

#searchSuggestions .suggestion-item {
    display: block !important;
    width: 100% !important;
    padding: 16px 20px !important;
    margin: 0 !important;
    background: #ffffff !important;
    border-bottom: 1px solid #E2E8F0 !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
}

#searchSuggestions .suggestion-item:hover {
    background: #f0f4ff !important;
    border-left: 4px solid #2563EB !important;
    padding-left: 16px !important;
}

#searchSuggestions .suggestion-item:last-child {
    border-bottom: none !important;
}

#searchSuggestions .suggestion-name {
    display: block !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    color: #0F172A !important;
    margin-bottom: 6px !important;
}

#searchSuggestions .suggestion-details {
    display: flex !important;
    gap: 12px !important;
    align-items: center !important;
}

#searchSuggestions .suggestion-roll {
    display: inline-block !important;
    background: #2563EB !important;
    color: #ffffff !important;
    padding: 4px 12px !important;
    border-radius: 20px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
}

#searchSuggestions .suggestion-program {
    display: inline-block !important;
    color: #14B8A6 !important;
    font-size: 14px !important;
    font-weight: 500 !important;
}

/* Fix parent container overflow issues */
.card-body {
    overflow: visible !important;
}

.d-flex {
    overflow: visible !important;
}

.search-wrapper {
    overflow: visible !important;
}

/* Ensure suggestions are not clipped */
.search-wrapper * {
    overflow: visible !important;
}

/* ============================================
   PRINT STYLES - Show only necessary data
   ============================================ */
@media print {
    /* Hide sidebar */
    .sidebar,
    #sidebar,
    [class*="sidebar"],
    aside {
        display: none !important;
    }

    /* Hide top navigation and header */
    .top-bar,
    .navbar,
    .page-header,
    .main-header,
    header {
        display: none !important;
    }

    /* Hide print/export buttons */
    .print-export-group,
    .btn-print-export,
    .btn-print,
    .btn-export {
        display: none !important;
    }

    /* Hide all action buttons */
    button,
    .btn,
    .action-btn,
    .btn-primary,
    .btn-secondary,
    .btn-danger,
    .btn-success,
    .btn-warning,
    .btn-sm,
    button[onclick],
    a.btn {
        display: none !important;
    }

    /* Keep only specific buttons that should print (like in receipts) */
    .receipt-wrapper button,
    .printing-fee-receipt button {
        display: none !important;
    }

    /* Hide search forms and inputs */
    .search-wrapper,
    .search-container,
    input[type="search"],
    input[type="text"],
    .form-control,
    .search-suggestions {
        display: none !important;
    }

    /* Hide filters and pagination */
    .pagination,
    .page-selector,
    .filter-container,
    .filters,
    .filter-bar,
    select[id*="Filter"],
    select[id*="filter"],
    button[id*="Filter"],
    button[id*="filter"],
    .filter-btn,
    .page-header,
    .page-header-actions {
        display: none !important;
    }

    /* Hide modals and dialogs */
    .modal,
    .dialog,
    .overlay {
        display: none !important;
    }

    /* Hide toast notifications */
    .toast,
    .notification,
    .alert {
        display: none !important;
    }

    /* Hide action columns in tables */
    table th:last-child,
    table td:last-child {
        display: none !important;
    }

    /* Hide empty states */
    .empty-state,
    .no-data {
        display: none !important;
    }

    /* Hide footer */
    footer,
    .footer {
        display: none !important;
    }

    /* Reset body and main content for print */
    body {
        margin: 0 !important;
        padding: 0 !important;
        font-size: 12pt !important;
        line-height: 1.4 !important;
        background: white !important;
        color: black !important;
    }

    /* Ensure main content is visible */
    main,
    .main-content,
    .content,
    .content-area,
    #app,
    .app-container {
        display: block !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Remove content padding */
    .content > *,
    .main-content > * {
        padding-top: 0 !important;
    }

    /* Show page title in print - add before main content */
    main::before,
    .main-content::before {
        content: attr(data-print-title) !important;
        display: none !important;  /* Hide print title to prevent blank space */
    }

    /* Card styling for print */
    .card {
        border: none !important;
        box-shadow: none !important;
        margin: 0 !important;
        padding: 0 !important;
        page-break-inside: avoid !important;
    }

    .card-body {
        padding: 0 !important;
        margin: 0 !important;
    }

    .card-header {
        background: #f5f5f5 !important;
        border-bottom: 1px solid #ddd !important;
    }

    /* Table styling for print */
    .table {
        width: 100% !important;
        border-collapse: collapse !important;
    }

    .table th,
    .table td {
        border: 1px solid #ddd !important;
        padding: 8px !important;
        text-align: left !important;
    }

    .table thead {
        background: #f5f5f5 !important;
    }

    /* Finance cards styling */
    .finance-card {
        border: 1px solid #ddd !important;
        padding: 10px !important;
        margin: 5px !important;
        display: inline-block !important;
    }

    /* Hide elements with .no-print class */
    .no-print {
        display: none !important;
    }

    /* Page breaks */
    .page-break {
        page-break-before: always !important;
    }

    .avoid-page-break {
        page-break-inside: avoid !important;
    }

    /* Ensure links are not underlined in print */
    a {
        text-decoration: none !important;
        color: inherit !important;
    }

    /* Hide input checkboxes and radio buttons that are just for display */
    input[type="checkbox"],
    input[type="radio"] {
        display: none !important;
    }

    /* Badge styling for print - convert to text with borders */
    .badge {
        border: 1px solid #000 !important;
        padding: 2px 6px !important;
        font-size: 10pt !important;
    }

    .badge-success {
        background: white !important;
        color: black !important;
        border-color: #000 !important;
    }

    .badge-danger {
        background: white !important;
        color: black !important;
        border-color: #000 !important;
    }

    .badge-warning {
        background: white !important;
        color: black !important;
        border-color: #000 !important;
    }

    .badge-info,
    .badge-primary {
        background: white !important;
        color: black !important;
        border-color: #000 !important;
    }

    /* Status badges - show as text */
    .badge-success::before {
        content: "✓ ";
    }

    .badge-danger::before {
        content: "✗ ";
    }

    /* Code/inline code styling */
    code,
    .code {
        border: 1px solid #ccc !important;
        padding: 2px 4px !important;
        font-family: 'Courier New', monospace !important;
        background: white !important;
    }

    /* Form labels - show as text */
    label {
        font-weight: bold !important;
    }

    /* Hide form controls but show their values */
    select,
    textarea {
        border: 1px solid #ddd !important;
        background: white !important;
    }

    /* Chart containers - show placeholder or alt text */
    canvas {
        max-width: 100% !important;
        height: auto !important;
    }

    /* Images - ensure proper sizing */
    img {
        max-width: 100% !important;
        height: auto !important;
    }

    /* Progress bars - show as text */
    .progress,
    .progress-bar {
        border: 1px solid #ddd !important;
    }

    /* Tabs - show only active tab content */
    .tab-nav,
    .tab-buttons {
        display: none !important;
    }

    .tab-content,
    .tab-pane {
        display: block !important;
    }

    /* Accordions - expand all */
    .accordion-collapse,
    .collapse {
        display: block !important;
        height: auto !important;
    }

    .accordion-toggle,
    [data-toggle="collapse"] {
        display: none !important;
    }

    /* Dropdowns - show as expanded lists */
    .dropdown-menu {
        position: static !important;
        display: block !important;
        border: 1px solid #ddd !important;
        box-shadow: none !important;
    }

    .dropdown-toggle::after {
        display: none !important;
    }

    /* ============================================
       ENHANCED TABLE PRINT STYLES
       Ensure all table data prints correctly
       ============================================ */

    /* Force table to show all content */
    .table-container {
        overflow: visible !important;
        max-height: none !important;
    }

    /* Ensure table headers repeat on each page */
    thead {
        display: table-header-group !important;
    }

    /* Ensure table body flows across pages */
    tbody {
        display: table-row-group !important;
    }

    /* Prevent row breaks inside cells */
    .table td,
    .table th {
        page-break-inside: avoid !important;
        overflow: visible !important;
        max-height: none !important;
    }

    /* Allow page breaks between rows */
    .table tr {
        page-break-after: auto !important;
        page-break-before: auto !important;
        page-break-inside: avoid !important;
    }

    /* Hide pagination and filter controls during print */
    .pagination,
    .pagination-container,
    .pagination-wrapper,
    .filter-bar,
    .bulk-actions-bar,
    .checkbox-column,
    .js-admin-only,
    .action-buttons,
    .no-print {
        display: none !important;
    }

    /* Show only the main content during print */
    .page-header {
        margin-bottom: 1rem !important;
    }

    .page-header button,
    .header-actions {
        display: none !important;
    }

    /* Ensure table takes full width */
    .table {
        width: 100% !important;
        max-width: 100% !important;
        table-layout: fixed !important;
        font-size: 10pt !important;
    }

    /* Hide checkbox and actions columns */
    .table th:nth-child(1),
    .table td:nth-child(1),
    .table th:nth-child(9),
    .table td:nth-child(9) {
        display: none !important;
    }

    /* Add page title for print */
    @page {
        size: A4 landscape;
        margin: 1cm;
    }
}

/* Special case: printing fee receipts - only works when body has the class */
/* This is handled by JavaScript adding the class before print */

@media print {
    /* When printing fee receipt, hide everything except the modal */
    body.printing-fee-receipt > *:not(.modal) {
        display: none !important;
    }

    body.printing-fee-receipt .modal {
        position: static !important;
        width: 100% !important;
        height: auto !important;
        background: white !important;
        border: none !important;
        box-shadow: none !important;
    }

    body.printing-fee-receipt .modal-content {
        box-shadow: none !important;
        border: none !important;
    }

    body.printing-fee-receipt .modal-header,
    body.printing-fee-receipt .modal-footer {
        display: none !important;
    }

    body.printing-fee-receipt .receipt-wrapper {
        position: static !important;
        width: 100% !important;
    }

    /* Enquiry page - hide form, show only list */
    body #enquiryForm,
    body #formAlert,
    body #successAlert {
        display: none !important;
    }

    /* Hide the entire card padding/margins when printing enquiry list */
    body .card-body {
        padding: 0 !important;
    }

    /* Show enquiry list when printing */
    body #enquiryListSection {
        display: block !important;
        margin-top: 0 !important;
        margin-bottom: 0 !important;
    }

    /* Hide search box in enquiry list when printing */
    body #enquiryListSection .search-box {
        display: none !important;
    }

    body #enquiryListSection .section-header {
        display: none !important;
    }

    /* Reset card for print */
    body .card {
        box-shadow: none !important;
        border: none !important;
        margin: 0 !important;
    }

    /* Dashboard print fix - remove blank first page */
    body .dashboard-container {
        padding: 0 !important;
        margin: 0 !important;
    }

    body .stats-grid,
    body .charts-grid,
    body .lists-grid {
        margin: 0 !important;
        padding: 10px 0 !important;
    }

    /* Ensure stats cards don't cause page breaks */
    body .stats-card {
        page-break-inside: avoid;
        margin: 5px 0 !important;
    }

    /* Force dashboard content to start from top with no space */
    body .dashboard-container {
        gap: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    body .dashboard-container > * {
        margin-top: 0 !important;
        margin-bottom: 5px !important;
        padding-top: 0 !important;
    }

    /* Stats grid and charts grid specific fixes */
    body .stats-grid,
    body .charts-grid {
        gap: 5px !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    body .stat-card,
    body .chart-card {
        margin: 0 !important;
        padding: 5px !important;
    }

    /* Lists grid */
    body .lists-grid {
        margin: 0 !important;
        padding: 0 !important;
    }

    body .lists-grid > * {
        margin-top: 0 !important;
    }

    /* Hide empty containers */
    body #stats-container:empty,
    body #charts-container:empty,
    body #lists-container:empty {
        display: none !important;
    }

    /* Ensure no extra space from hidden elements */
    body .page-header {
        margin-bottom: 0 !important;
    }
}

/* ============================================
   MODAL SECTION CARDS & COMPONENTS
   ============================================ */

/* Section Card for Modal Organization */
.section-card {
    background: var(--body-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
    overflow: hidden;
}

.section-card:last-child {
    margin-bottom: 0;
}

.section-card-header {
    background: linear-gradient(180deg, var(--primary-50), transparent);
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-soft);
}

.section-card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary-dark);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.section-card-title i {
    font-size: 16px;
    color: var(--primary);
}

.section-card-body {
    padding: 18px;
}

/* Amount Cards Grid */
.amount-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.amount-card {
    background: var(--card-bg);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    padding: 16px;
    text-align: center;
    transition: all var(--transition);
}

.amount-card:hover {
    border-color: var(--primary-100);
    box-shadow: var(--shadow);
}

.amount-card.highlight {
    background: linear-gradient(135deg, var(--primary-50), #fff);
    border-color: var(--primary);
    box-shadow: 0 4px 12px -2px rgba(59, 130, 246, 0.2);
}

.amount-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.amount-value {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.amount-value-primary {
    color: var(--primary);
}

.amount-input-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.amount-prefix {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-secondary);
}

.amount-input {
    width: 80px !important;
    padding: 8px !important;
    text-align: center;
    font-size: 18px !important;
    font-weight: 600 !important;
}

/* Summary Table */
.summary-table {
    background: var(--card-bg);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border-soft);
    font-size: 14px;
}

.summary-row:last-child,
.summary-row-divider {
    border-bottom: none;
}

.summary-negative {
    color: var(--danger);
}

.summary-row-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0;
}

.summary-row-total {
    background: var(--primary-50);
    font-weight: 600;
}

.summary-highlight {
    color: var(--primary);
    font-size: 16px;
}

/* Responsive for amount grid */
@media (max-width: 600px) {
    .amount-grid {
        grid-template-columns: 1fr;
    }
}

/* Checkbox Label Enhancement */
.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
}

/* === FEE COMPONENTS TABLE STYLES === */
.table-fee-components {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    font-size: 14px;
}

.table-fee-components thead {
    background: var(--body-bg-2);
    border-bottom: 2px solid var(--border-color);
}

.table-fee-components thead th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table-fee-components thead th.text-end {
    text-align: right;
}

.table-fee-components tbody {
    background: white;
}

.table-fee-components tbody tr {
    border-bottom: 1px solid var(--border-soft);
    transition: background-color 0.2s ease;
}

.table-fee-components tbody tr:hover {
    background: var(--body-bg);
}

.table-fee-components tbody tr:last-child {
    border-bottom: none;
}

.table-fee-components tbody td {
    padding: 14px 16px;
    vertical-align: middle;
}

.table-fee-components tbody td.text-end {
    text-align: right;
}

.table-fee-components .amount-original {
    color: var(--text-secondary);
}

.table-fee-components .amount-final {
    color: var(--primary);
}

.table-fee-components .form-control-sm {
    padding: 6px 10px;
    font-size: 13px;
    border-radius: 6px;
}

.table-fee-components .form-control-sm:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.table-fee-components input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
}

.table-fee-components .font-weight-bold {
    font-weight: 600;
}

/* Responsive table */
@media (max-width: 768px) {
    .table-fee-components {
        font-size: 13px;
    }

    .table-fee-components thead th,
    .table-fee-components tbody td {
        padding: 10px 12px;
    }
}

/* Disabled input styling for fee components */
.table-fee-components .form-control-sm:disabled {
    background-color: var(--body-bg);
    color: var(--text-secondary);
    cursor: not-allowed;
    opacity: 0.6;
}

/* ============================================
   COMPREHENSIVE RESPONSIVE STYLES
   ============================================ */

/* === LARGE DESKTOP (1440px+) === */
@media (min-width: 1440px) {
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.5rem;
    }

    .stats-card {
        min-height: 160px;
    }

    .table-container {
        overflow-x: visible;
    }

    .modal-xl {
        max-width: 1400px;
    }
}

/* === LAPTOP (1024px) === */
@media (max-width: 1024px) {
    /* Sidebar becomes collapsible */
    .sidebar {
        width: 260px;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .sidebar-overlay {
        display: block;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }

    .sidebar-overlay.active {
        opacity: 1;
        pointer-events: auto;
    }

    .main-content {
        margin-left: 0;
    }

    .hamburger {
        display: flex !important;
    }

    /* Stats grid - 3 per row (same as desktop) */
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1rem;
        margin-bottom: 1.5rem;
    }

    .stats-card {
        min-height: 130px;
        padding: 1.25rem;
    }

    .stats-value {
        font-size: 2rem;
    }

    /* Card adjustments */
    .card {
        margin-bottom: 1rem;
    }

    .card-header {
        padding: 1rem 0;
        margin-bottom: 1rem;
    }

    /* Table adjustments */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table th,
    .table td {
        padding: 0.75rem 0.625rem;
        font-size: 0.875rem;
    }

    /* Form adjustments */
    .form-row {
        flex-wrap: wrap;
    }

    .form-row .form-group {
        flex: 1 1 calc(50% - 0.5rem);
        min-width: 200px;
    }

    /* Modal adjustments */
    .modal-content {
        width: 90%;
        max-height: 85vh;
    }

    .modal-lg {
        max-width: 750px;
    }

    .modal-xl {
        max-width: 950px;
    }

    /* Header adjustments */
    .header {
        padding: 0.75rem 1rem;
    }

    .breadcrumb {
        font-size: 0.875rem;
    }

    /* Filter bar */
    .filter-bar {
        padding: 0.875rem;
    }

    .filter-group {
        flex: 1 1 calc(33.333% - 0.667rem);
        min-width: 180px;
    }

    /* Button adjustments */
    .action-buttons {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    /* Pagination */
    .page-btn {
        padding: 0.5rem 0.75rem;
        min-width: 36px;
        font-size: 0.875rem;
    }
}

/* === TABLET (768px) === */
@media (max-width: 768px) {
    /* Root adjustments */
    :root {
        --content-padding: 1rem;
        --header-height: 56px;
    }

    /* Main layout */
    .main-content {
        padding: var(--content-padding);
    }

    .content {
        padding: 0;
    }

    /* Header */
    .header {
        height: var(--header-height);
        padding: 0.5rem 1rem;
    }

    .header-left {
        gap: 0.75rem;
    }

    .breadcrumb {
        display: none;
    }

    .header-right {
        gap: 0.5rem;
    }

    .header-btn {
        padding: 0.5rem;
        font-size: 1.125rem;
    }

    .user-info {
        display: none;
    }

    /* Sidebar */
    .sidebar {
        width: 260px;
        z-index: 1200;
    }

    .sidebar-overlay {
        display: block;
    }

    /* Stats grid - 2 per row */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
        margin-bottom: 1.25rem;
    }

    .stats-card {
        min-height: 120px;
        padding: 1rem;
    }

    .stats-value {
        font-size: 1.75rem;
    }

    .stats-label {
        font-size: 0.8125rem;
    }

    /* Cards */
    .card {
        border-radius: var(--radius-md);
        padding: 1rem;
        margin-bottom: 1rem;
    }

    .card-header {
        padding: 0.875rem 0;
        margin-bottom: 0.875rem;
        flex-wrap: wrap;
    }

    .card-title {
        font-size: 1.125rem;
    }

    .card-body {
        padding: 0;
    }

    .card-footer {
        padding: 0.875rem 0;
        flex-wrap: wrap;
    }

    /* Tables */
    .table-container {
        border-radius: var(--radius-md);
        margin: 0 -1rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table {
        font-size: 0.875rem;
    }

    .table th {
        padding: 0.625rem 0.5rem;
        font-size: 0.75rem;
    }

    .table td {
        padding: 0.625rem 0.5rem;
    }

    /* Hide less important columns on small screens */
    .table-responsive-cols th:nth-child(n+5),
    .table-responsive-cols td:nth-child(n+5) {
        display: none;
    }

    /* Forms */
    .form-group {
        margin-bottom: 0.875rem;
    }

    .form-group label {
        font-size: 0.875rem;
        margin-bottom: 0.375rem;
    }

    .form-control {
        padding: 0.625rem 0.875rem;
        font-size: 0.875rem;
    }

    .form-row {
        flex-direction: column;
        gap: 0.875rem;
    }

    .form-row .form-group {
        flex: 1 1 100%;
    }

    /* Buttons */
    .btn {
        padding: 0.625rem 0.875rem;
        font-size: 0.875rem;
    }

    .btn-sm {
        padding: 0.5rem 0.625rem;
        font-size: 0.75rem;
    }

    .btn-lg {
        padding: 0.75rem 1rem;
        font-size: 1rem;
    }

    .action-buttons {
        flex-direction: column;
        gap: 0.5rem;
    }

    .action-buttons .btn {
        width: 100%;
    }

    /* Badges */
    .badge {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }

    /* Modals */
    .modal-content {
        width: 92%;
        max-height: 90vh;
        margin: 0.5rem;
        border-radius: var(--radius-lg);
    }

    .modal-header {
        padding: 0.875rem 1rem;
    }

    .modal-title {
        font-size: 1rem;
    }

    .modal-body {
        padding: 1rem;
    }

    .modal-footer {
        padding: 0.875rem 1rem;
        flex-direction: column;
        gap: 0.5rem;
    }

    .modal-footer .btn {
        width: 100%;
    }

    /* Alerts */
    .alert {
        padding: 0.875rem 1rem;
        font-size: 0.875rem;
    }

    /* Toast notifications */
    .toast {
        min-width: auto;
        max-width: calc(100vw - 2rem);
        left: 1rem;
        right: 1rem;
        top: 0.5rem;
    }

    /* Search bar */
    .search-bar {
        flex-direction: column;
        gap: 0.75rem;
        margin-bottom: 1rem;
    }

    .search-input {
        flex: 1 1 100%;
    }

    .search-input input {
        padding: 0.625rem 0.75rem 0.625rem 2.25rem;
        font-size: 0.875rem;
    }

    /* Filter bar */
    .filter-bar {
        padding: 0.75rem;
        gap: 0.5rem;
    }

    .filter-group {
        flex: 1 1 calc(50% - 0.25rem);
        min-width: calc(50% - 0.25rem);
    }

    .filter-group label {
        font-size: 0.75rem;
    }

    /* Pagination */
    .pagination-container {
        flex-direction: column;
        gap: 0.75rem;
        align-items: center;
    }

    .pagination {
        gap: 0.25rem;
    }

    .pagination-info {
        font-size: 0.8125rem;
    }

    /* Detail views */
    .detail-view {
        padding: 1rem;
    }

    .detail-row {
        flex-direction: column;
        padding: 0.75rem 0;
        gap: 0.25rem;
    }

    .detail-label {
        font-size: 0.8125rem;
        min-width: auto;
        margin-bottom: 0.25rem;
    }

    .detail-value {
        font-size: 0.875rem;
    }

    /* Charts and graphs */
    .charts-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .chart-container {
        height: 250px;
    }

    /* Lists */
    .lists-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .list-item {
        padding: 0.875rem;
    }
}

/* === MOBILE (480px) === */
@media (max-width: 480px) {
    /* Root adjustments */
    :root {
        --content-padding: 0.875rem;
        --header-height: 52px;
    }

    /* Header */
    .header {
        padding: 0.5rem 0.875rem;
        height: var(--header-height);
    }

    .header-left {
        gap: 0.5rem;
    }

    .header-btn {
        padding: 0.375rem;
        font-size: 1rem;
    }

    .user-avatar {
        width: 32px;
        height: 32px;
    }

    /* Main content */
    .main-content {
        padding: var(--content-padding);
    }

    .page-header {
        margin-bottom: 1rem;
    }

    .page-header h1 {
        font-size: 1.25rem;
    }

    /* Stats grid - 1 per row */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 0.625rem;
        margin-bottom: 1rem;
    }

    .stats-card {
        min-height: 100px;
        padding: 0.875rem;
    }

    .stats-value {
        font-size: 1.625rem;
    }

    .stats-label {
        font-size: 0.75rem;
    }

    .stats-change {
        font-size: 0.8125rem;
    }

    /* Cards */
    .card {
        padding: 0.875rem;
        border-radius: var(--radius-sm);
        margin-bottom: 0.875rem;
    }

    .card-header {
        padding: 0.75rem 0;
        margin-bottom: 0.75rem;
    }

    .card-title {
        font-size: 1rem;
    }

    /* Tables */
    .table-container {
        margin: 0 -0.875rem;
    }

    .table {
        font-size: 0.8125rem;
    }

    .table th {
        padding: 0.5rem 0.375rem;
        font-size: 0.6875rem;
    }

    .table td {
        padding: 0.5rem 0.375rem;
    }

    /* Forms */
    .form-group {
        margin-bottom: 0.75rem;
    }

    .form-control {
        padding: 0.5rem 0.75rem;
        font-size: 0.8125rem;
    }

    select.form-control {
        padding-right: 2rem;
    }

    /* Buttons */
    .btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.8125rem;
    }

    .btn-sm {
        padding: 0.375rem 0.625rem;
        font-size: 0.75rem;
    }

    /* Badges */
    .badge {
        padding: 0.1875rem 0.375rem;
        font-size: 0.6875rem;
    }

    /* Modals */
    .modal-content {
        width: 95%;
        max-height: 92vh;
        margin: 0.25rem;
    }

    .modal-header {
        padding: 0.75rem;
    }

    .modal-title {
        font-size: 0.9375rem;
    }

    .modal-close {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }

    .modal-body {
        padding: 0.875rem;
    }

    .modal-footer {
        padding: 0.75rem;
    }

    /* Filter bar */
    .filter-bar {
        padding: 0.625rem;
        gap: 0.5rem;
    }

    .filter-group {
        flex: 1 1 100%;
        min-width: 100%;
    }

    .filter-group select,
    .filter-group input {
        font-size: 0.8125rem;
        padding: 0.5rem 0.625rem;
    }

    /* Search */
    .search-input input {
        padding: 0.5rem 0.75rem 0.5rem 2.125rem;
        font-size: 0.8125rem;
    }

    .search-input i {
        left: 0.75rem;
        font-size: 0.875rem;
    }

    /* Pagination */
    .page-btn {
        padding: 0.375rem 0.5rem;
        min-width: 28px;
        font-size: 0.8125rem;
    }

    .page-dots {
        font-size: 0.8125rem;
    }

    /* Detail view */
    .detail-view {
        padding: 0.875rem;
    }

    .detail-row {
        padding: 0.625rem 0;
    }

    /* Confirm dialog */
    .confirm-box {
        min-width: 280px;
        padding: 1.25rem;
    }

    /* Loading spinner */
    .spinner {
        width: 32px;
        height: 32px;
        border-width: 3px;
    }

    /* Charts */
    .chart-container {
        height: 200px;
        padding: 0.75rem;
    }

    /* Lists */
    .list-item {
        padding: 0.75rem;
        font-size: 0.875rem;
    }
}

/* === SMALL MOBILE (360px) === */
@media (max-width: 360px) {
    :root {
        --content-padding: 0.75rem;
    }

    .header {
        padding: 0.5rem 0.75rem;
    }

    .stats-grid {
        gap: 0.5rem;
    }

    .stats-card {
        padding: 0.75rem;
        min-height: 95px;
    }

    .stats-value {
        font-size: 1.5rem;
    }

    .card {
        padding: 0.75rem;
    }

    .btn {
        padding: 0.5rem 0.625rem;
        font-size: 0.75rem;
    }

    .form-control {
        padding: 0.5rem 0.625rem;
        font-size: 0.75rem;
    }

    .table th,
    .table td {
        padding: 0.5rem 0.25rem;
        font-size: 0.75rem;
    }

    .badge {
        font-size: 0.625rem;
    }
}

/* === LANDSCAPE MOBILE === */
@media (max-width: 768px) and (orientation: landscape) {
    .header {
        height: 48px;
    }

    .stats-card {
        min-height: 100px;
        padding: 0.875rem;
    }

    .stats-value {
        font-size: 1.5rem;
    }

    .card-header {
        padding: 0.75rem 0;
    }

    .modal-content {
        max-height: 95vh;
    }

    .chart-container {
        height: 200px;
    }
}

/* === TOUCH DEVICE OPTIMIZATIONS === */
@media (hover: none) and (pointer: coarse) {
    .btn:hover {
        transform: none;
    }

    .card:hover {
        transform: none;
    }

    .stats-card:hover {
        transform: none;
    }

    .menu-item:hover {
        background: transparent;
    }

    .menu-item:active {
        background: var(--sidebar-hover);
    }
}

/* ============================================
   ENHANCED MOBILE RESPONSIVE STYLES
   ============================================ */

/* === DASHBOARD PAGE MOBILE STYLES === */
@media (max-width: 768px) {
    /* Dashboard Container */
    .dashboard-container {
        gap: 1rem;
    }

    /* Page Header for Dashboard */
    .page-header {
        flex-wrap: wrap;
        gap: 12px;
        margin-bottom: 1rem;
    }

    .page-header h1 {
        font-size: 1.5rem;
    }

    .page-header p {
        font-size: 0.8rem;
    }

    /* Stats Grid - Enhanced */
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 0.75rem;
        margin-bottom: 1rem;
    }

    .stat-card {
        padding: 1rem;
        min-height: 100px;
        border-radius: var(--radius-md);
    }

    .stat-card-content {
        gap: 4px;
    }

    .stat-card-label {
        font-size: 0.7rem;
        letter-spacing: 0.5px;
    }

    .stat-card-value {
        font-size: 1.75rem;
        line-height: 1.1;
    }

    .stat-card-sub {
        font-size: 0.7rem;
    }

    .stat-card-icon {
        width: 40px;
        height: 40px;
        font-size: 18px;
        border-radius: var(--radius-sm);
    }

    /* Charts Grid - Enhanced */
    .charts-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        margin-bottom: 1.5rem;
    }

    .chart-card {
        padding: 1rem;
        border-radius: var(--radius-md);
        overflow: visible;
    }

    .chart-header {
        margin-bottom: 0.75rem;
        flex-wrap: wrap;
        gap: 8px;
    }

    .chart-title {
        font-size: 1rem;
    }

    .chart-canvas-container {
        height: 220px;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        width: 100%;
        scrollbar-width: thin;
        scrollbar-color: #CBD5E1 transparent;
    }

    .chart-canvas-container::-webkit-scrollbar {
        height: 6px;
    }

    .chart-canvas-container::-webkit-scrollbar-track {
        background: transparent;
    }

    .chart-canvas-container::-webkit-scrollbar-thumb {
        background-color: #CBD5E1;
        border-radius: var(--radius-pill);
        border: 2px solid transparent;
        background-clip: padding-box;
    }

    .chart-canvas-container::-webkit-scrollbar-thumb:hover {
        background-color: #94A3B8;
        background-clip: padding-box;
    }

    .chart-canvas-container canvas {
        min-width: 100%;
        max-width: none;
        min-height: 220px;
    }

    /* Lists Grid - Enhanced */
    .lists-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .list-card {
        padding: 1rem;
        border-radius: var(--radius-md);
    }

    .list-header {
        margin-bottom: 0.75rem;
    }

    .list-title {
        font-size: 1rem;
    }

    .custom-list {
        max-height: 280px;
        gap: 8px;
    }

    .custom-list-item {
        padding: 0.75rem;
        font-size: 0.85rem;
        border-radius: var(--radius-sm);
    }

    .custom-list-item-left {
        gap: 2px;
    }

    .custom-list-item-title {
        font-size: 0.85rem;
    }

    .custom-list-item-sub {
        font-size: 0.7rem;
    }
}

@media (max-width: 480px) {
    /* Stats Grid - Small Mobile */
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }

    .stat-card {
        padding: 0.875rem;
        min-height: 90px;
    }

    .stat-card-value {
        font-size: 1.5rem;
    }

    .stat-card-icon {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }

    /* Charts - Small Mobile */
    .chart-card {
        padding: 0.875rem;
        overflow: visible;
    }

    .chart-canvas-container {
        height: 200px;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        width: 100%;
    }

    .chart-canvas-container canvas {
        min-width: 100%;
        max-width: none;
        min-height: 200px;
    }

    /* === DASHBOARD CHARTS SCROLLBAR FIX === */
    .chart-canvas-container {
        scrollbar-width: thin;
        scrollbar-color: #CBD5E1 transparent;
    }

    .chart-canvas-container::-webkit-scrollbar {
        height: 6px;
    }

    .chart-canvas-container::-webkit-scrollbar-track {
        background: transparent;
    }

    .chart-canvas-container::-webkit-scrollbar-thumb {
        background-color: #CBD5E1;
        border-radius: var(--radius-pill);
        border: 2px solid transparent;
        background-clip: padding-box;
    }

    .chart-canvas-container::-webkit-scrollbar-thumb:hover {
        background-color: #94A3B8;
        background-clip: padding-box;
    }

    /* Lists - Small Mobile */
    .list-card {
        padding: 0.875rem;
    }

    .custom-list-item {
        padding: 0.625rem;
        font-size: 0.8rem;
    }
}

/* === STUDENT DETAIL PAGE MOBILE STYLES === */
@media (max-width: 768px) {
    /* Student Detail Page Header */
    #studentDetailContent .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    #studentDetailContent .page-header > div:first-child {
        width: 100%;
    }

    #studentDetailContent .page-header > div:last-child {
        width: 100%;
        flex-wrap: wrap;
    }

    #studentDetailContent .page-header h1 {
        font-size: 1.5rem;
    }

    #studentDetailContent .page-header p {
        font-size: 0.8rem;
    }

    /* Page Header Buttons */
    #studentDetailContent .page-header .btn {
        flex: 1;
        min-width: 0;
        padding: 0.625rem 0.75rem;
        font-size: 0.8rem;
    }

    #studentDetailContent .page-header .btn span {
        display: none;
    }

    #studentDetailContent .page-header .btn i {
        margin: 0;
    }

    /* Tabs Container */
    .tabs-container {
        margin-bottom: 1rem;
    }

    .tabs-nav {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        border-bottom-width: 1px;
    }

    .tabs-nav::-webkit-scrollbar {
        display: none;
    }

    .tab-btn {
        padding: 0.75rem 1rem;
        font-size: 0.85rem;
        white-space: nowrap;
        flex-shrink: 0;
    }

    /* Detail Grid */
    .detail-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .detail-group {
        padding: 1rem;
        border-radius: var(--radius-md);
    }

    .detail-group h4,
    .detail-group h5 {
        font-size: 1rem;
        margin-bottom: 0.75rem;
    }

    .detail-item {
        padding: 0.625rem 0;
        font-size: 0.875rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .detail-item:not(.full-width) {
        flex-direction: column;
        align-items: flex-start;
    }

    .detail-label {
        font-size: 0.75rem;
        min-width: auto;
        margin-bottom: 2px;
    }

    .detail-value {
        font-size: 0.875rem;
        text-align: left;
        max-width: 100%;
        word-break: break-word;
    }

    .detail-item.full-width .detail-value {
        text-align: left;
    }

    /* Tables in Tabs */
    .table-container {
        border-radius: var(--radius-md);
        margin: 0 -1rem;
        width: calc(100% + 2rem);
    }

    .table {
        font-size: 0.8rem;
    }

    .table th {
        padding: 0.625rem 0.5rem;
        font-size: 0.7rem;
        white-space: nowrap;
    }

    .table td {
        padding: 0.625rem 0.5rem;
        font-size: 0.8rem;
    }

    /* Documents Table Specific */
    #documentsTableBody .table td:nth-child(3),
    #documentsTableBody .table th:nth-child(3),
    #documentsTableBody .table td:nth-child(4),
    #documentsTableBody .table th:nth-child(4) {
        display: none;
    }

    /* Subject Registrations Table */
    #subjectsList .table td:nth-child(3),
    #subjectsList .table th:nth-child(3) {
        display: none;
    }

    /* Upload Button */
    #uploadDocBtn {
        width: 100%;
        justify-content: center;
    }

    /* Modal for Upload */
    .modal-box {
        width: 95%;
        max-height: 90vh;
        margin: 1rem;
    }

    .modal-header {
        padding: 1rem;
        flex-wrap: wrap;
        gap: 8px;
    }

    .modal-header h3 {
        font-size: 1.1rem;
    }

    .modal-close {
        width: 32px;
        height: 32px;
        font-size: 1.1rem;
    }

    .modal-body {
        padding: 1rem;
    }

    .modal-footer {
        padding: 0.75rem 1rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .modal-footer .btn {
        flex: 1;
        min-width: 0;
    }

    /* File Upload Zone */
    .file-upload-zone {
        padding: 1.5rem 1rem;
    }

    .file-upload-icon {
        font-size: 24px;
    }

    .file-upload-text {
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    /* Student Detail - Extra Small Mobile */
    #studentDetailContent .page-header h1 {
        font-size: 1.25rem;
    }

    .tab-btn {
        padding: 0.625rem 0.875rem;
        font-size: 0.8rem;
    }

    .detail-group {
        padding: 0.875rem;
    }

    .detail-item {
        padding: 0.5rem 0;
        font-size: 0.8rem;
    }

    .detail-label {
        font-size: 0.7rem;
    }

    .detail-value {
        font-size: 0.8rem;
    }

    /* Tables - Extra Small Mobile */
    .table {
        font-size: 0.75rem;
    }

    .table th {
        padding: 0.5rem 0.375rem;
        font-size: 0.65rem;
    }

    .table td {
        padding: 0.5rem 0.375rem;
        font-size: 0.75rem;
    }

    /* Hide more columns on very small screens */
    #documentsTableBody .table td:nth-child(2),
    #documentsTableBody .table th:nth-child(2) {
        max-width: 100px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* Buttons in tables */
    .table .btn {
        padding: 0.375rem 0.5rem;
        font-size: 0.75rem;
    }

    .table .btn-sm {
        padding: 0.25rem 0.375rem;
        font-size: 0.7rem;
    }

    /* Print/Export Buttons on Small Mobile */
    .print-export-group {
        flex-wrap: wrap;
        gap: 4px;
    }

    .btn-print-export {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }
}

/* === GENERAL PAGE HEADER MOBILE STYLES === */
@media (max-width: 768px) {
    .page-header {
        flex-wrap: wrap;
        gap: 12px;
    }

    .page-header h1 {
        font-size: 1.5rem;
    }

    .page-header-actions,
    .header-actions {
        flex-wrap: wrap;
        width: 100%;
    }

    .page-header-actions .btn,
    .header-actions .btn {
        flex: 1;
        min-width: 0;
        justify-content: center;
    }

    .page-header-actions .btn span,
    .header-actions .btn span {
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .page-header h1 {
        font-size: 1.25rem;
    }

    .page-header-actions .btn,
    .header-actions .btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }

    .page-header-actions .btn span,
    .header-actions .btn span {
        font-size: 0.75rem;
    }

    .page-header-actions .btn i,
    .header-actions .btn i {
        font-size: 0.9rem;
    }
}

/* === CARD GRID MOBILE STYLES (适用于各种卡片布局) === */
@media (max-width: 768px) {
    .finance-summary-grid,
    .leave-balance-grid,
    .marks-entry-stats {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 0.75rem;
    }

    .finance-card,
    .leave-balance-card,
    .balance-card,
    .marks-stat-card {
        padding: 1rem;
    }

    .finance-card-value,
    .balance-card .balance-value,
    .marks-stat-value {
        font-size: 1.5rem;
    }

    .finance-card-label,
    .balance-label,
    .marks-stat-label {
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .finance-summary-grid,
    .leave-balance-grid,
    .marks-entry-stats {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }

    .finance-card,
    .leave-balance-card,
    .balance-card,
    .marks-stat-card {
        padding: 0.875rem;
    }

    .finance-card-value,
    .balance-card .balance-value,
    .marks-stat-value {
        font-size: 1.25rem;
    }
}

/* === TABLE RESPONSIVE ENHANCEMENTS === */
@media (max-width: 768px) {
    /* Enable horizontal scroll for tables */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: var(--radius-md);
    }

    /* Sticky first column for wide tables */
    .table th:first-child,
    .table td:first-child {
        position: sticky;
        left: 0;
        background: inherit;
        z-index: 1;
        min-width: 120px;
        box-shadow: 2px 0 0 var(--border-color);
    }

    /* Responsive table with horizontal scroll indicator */
    .table-container::after {
        content: '';
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        width: 20px;
        background: linear-gradient(to right, transparent, rgba(0,0,0,0.05));
        pointer-events: none;
    }

    .table-container {
        position: relative;
    }
}

/* === MODAL MOBILE ENHANCEMENTS === */
@media (max-width: 768px) {
    .modal-overlay.active .sidebar {
        transform: translateX(-100%);
    }

    .modal-content {
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        max-height: 90vh;
        margin: 0 auto;
    }

    /* Full screen modal on small mobile */
    @media (max-width: 480px) {
        .modal-content {
            max-height: 95vh;
            border-radius: var(--radius-lg) var(--radius-lg) 0 0;
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            margin: 0;
            width: 100%;
            max-width: 100%;
        }

        .modal-header {
            padding: 1rem;
            border-bottom: 1px solid var(--border-color);
            position: sticky;
            top: 0;
            background: var(--card-bg);
            z-index: 10;
        }

        .modal-footer {
            padding: 1rem;
            border-top: 1px solid var(--border-color);
            position: sticky;
            bottom: 0;
            background: var(--card-bg);
            z-index: 10;
        }
    }
}

/* === PRINT/EXPORT BUTTONS MOBILE === */
@media (max-width: 640px) {
    .print-export-group .btn-print-export span {
        display: none;
    }

    .btn-print-export {
        padding: 0.5rem;
        min-width: 36px;
    }

    .btn-print-export i {
        margin: 0;
    }
}

/* === BADGE MOBILE STYLES === */
@media (max-width: 480px) {
    .badge {
        font-size: 0.65rem;
        padding: 0.25rem 0.5rem;
    }
}

/* === FORM RESPONSIVE ENHANCEMENTS === */
@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .form-options {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    /* Modal form grid */
    .form-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

/* === QUICK ACTIONS MOBILE === */
@media (max-width: 768px) {
    .quick-actions {
        flex-direction: column;
        gap: 8px;
    }

    .quick-actions .btn-action {
        width: 100%;
        justify-content: center;
    }
}

/* === TIMETABLE RESPONSIVE === */
@media (max-width: 768px) {
    .timetable-controls {
        flex-direction: column;
        gap: 12px;
    }

    .timetable-controls .form-group {
        min-width: 100%;
    }

    #sectionFilters,
    #facultyFilters {
        flex-direction: column;
    }

    #sectionFilters .form-group,
    #facultyFilters .form-group {
        min-width: 100%;
    }
}

/* === ATTENDANCE MARKING MOBILE === */
@media (max-width: 768px) {
    .att-controls {
        flex-direction: column;
        gap: 12px;
        padding: 1rem;
    }

    .att-controls .form-group {
        min-width: 100%;
    }

    .status-btn-group {
        gap: 4px;
    }

    .status-btn {
        width: 32px;
        height: 32px;
        font-size: 0.7rem;
    }

    .absent-checkbox {
        width: 18px;
        height: 18px;
    }
}

/* === SUBJECT REGISTRATIONS TABLE MOBILE === */
@media (max-width: 768px) {
    #subjectsList .table {
        font-size: 0.8rem;
    }

    #subjectsList .table th,
    #subjectsList .table td {
        padding: 0.5rem;
    }
}

@media (max-width: 480px) {
    #subjectsList .table {
        font-size: 0.75rem;
    }

    #subjectsList .table th,
    #subjectsList .table td {
        padding: 0.4rem 0.375rem;
    }

    #subjectsList .badge {
        font-size: 0.6rem;
        padding: 0.2rem 0.4rem;
    }
}

/* === SIDEBAR MOBILE ENHANCEMENTS === */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .sidebar.active {
        transform: translateX(0);
        box-shadow: 0 0 50px rgba(0, 0, 0, 0.3);
    }

    .sidebar-overlay {
        display: none;
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .sidebar-overlay.active {
        display: block;
        opacity: 1;
    }

    /* Prevent body scroll when sidebar is open */
    body.sidebar-open {
        overflow: hidden;
    }
}

@media (max-width: 480px) {
    .sidebar {
        width: 85%;
        max-width: 300px;
    }

    .sidebar-header {
        padding: 1rem;
    }

    .sidebar-logo-img {
        height: 36px;
    }

    .menu-item {
        padding: 0.75rem 1rem 0.75rem 2.25rem;
        font-size: 0.85rem;
    }

    .menu-badge {
        font-size: 0.6rem;
        padding: 0.1rem 0.4rem;
        min-width: 16px;
    }
}

/* === HEADER MOBILE ENHANCEMENTS === */
@media (max-width: 768px) {
    .header {
        height: 56px;
        padding: 0 1rem;
    }

    .hamburger {
        padding: 0.5rem;
        font-size: 1.1rem;
    }

    .breadcrumb {
        font-size: 0.8rem;
    }

    .header-btn {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }

    .notification-badge {
        top: 2px;
        right: 2px;
        font-size: 0.6rem;
        min-width: 14px;
        height: 14px;
        line-height: 14px;
    }

    .user-avatar {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
    }

    .user-name {
        font-size: 0.8rem;
    }

    .user-role {
        font-size: 0.7rem;
    }

    .dropdown-arrow {
        font-size: 0.65rem;
    }

    .dropdown-menu {
        min-width: 180px;
        right: -8px;
    }

    .dropdown-item {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .header {
        height: 52px;
        padding: 0 0.75rem;
    }

    .hamburger {
        padding: 0.4rem;
        font-size: 1rem;
    }

    .breadcrumb {
        font-size: 0.75rem;
    }

    .header-btn {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
    }

    .user-dropdown {
        margin-left: 0.25rem;
    }

    .user-avatar {
        width: 30px;
        height: 30px;
    }
}

/* === CONTENT AREA MOBILE === */
@media (max-width: 768px) {
    .content {
        padding: 1rem;
    }

    .main-content {
        margin-left: 0;
    }
}

@media (max-width: 480px) {
    .content {
        padding: 0.75rem;
    }
}

/* === TOAST NOTIFICATIONS MOBILE === */
@media (max-width: 480px) {
    .toast {
        left: 0.5rem;
        right: 0.5rem;
        top: 0.5rem;
        min-width: auto;
        max-width: none;
        padding: 0.75rem;
        font-size: 0.8rem;
    }

    .toast-close {
        font-size: 1rem;
        padding: 0;
        width: 24px;
        height: 24px;
    }
}

/* === SEARCH BAR MOBILE === */
@media (max-width: 768px) {
    .search-bar {
        flex-direction: column;
        gap: 0.75rem;
    }

    .search-input {
        width: 100%;
    }
}

/* === FILTER BAR MOBILE === */
@media (max-width: 768px) {
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
        padding: 0.75rem;
    }

    .filter-group {
        width: 100%;
    }

    .filter-group label {
        font-size: 0.7rem;
        margin-bottom: 0.35rem;
    }

    .filter-group select,
    .filter-group input {
        width: 100%;
        padding: 0.5rem;
        font-size: 0.85rem;
    }

    .filter-bar .btn {
        width: 100%;
        margin-left: 0;
    }
}

/* === PAGINATION MOBILE === */
@media (max-width: 480px) {
    .pagination {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.2rem;
    }

    .page-btn {
        padding: 0.3rem 0.5rem;
        min-width: 28px;
        font-size: 0.75rem;
    }

    .pagination-info {
        font-size: 0.75rem;
        margin-left: 0.5rem;
    }
}

/* === EMPTY STATE MOBILE === */
@media (max-width: 768px) {
    .empty-state,
    .error-container {
        padding: 2rem 1rem;
    }

    .empty-state-icon,
    .error-icon {
        font-size: 2rem;
    }

    .empty-state-text,
    .error-message {
        font-size: 0.85rem;
    }
}

/* === LOADING SPINNER MOBILE === */
@media (max-width: 768px) {
    .loading-spinner {
        padding: 2rem 1rem;
        gap: 0.75rem;
    }

    .spinner {
        width: 32px;
        height: 32px;
        border-width: 3px;
    }

    .loading-spinner p {
        font-size: 0.85rem;
    }
}

/* === ALERT MOBILE === */
@media (max-width: 480px) {
    .alert {
        padding: 0.6rem 0.75rem;
        font-size: 0.8rem;
        gap: 0.5rem;
    }

    .alert i {
        font-size: 0.9rem;
    }
}

/* === ACTION BUTTONS IN TABLES MOBILE === */
@media (max-width: 768px) {
    .action-buttons {
        gap: 4px;
    }

    .action-buttons .btn {
        padding: 0.3rem 0.4rem;
        font-size: 0.75rem;
    }

    .action-buttons .btn i {
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .action-buttons {
        gap: 3px;
    }

    .action-buttons .btn {
        padding: 0.25rem 0.35rem;
        font-size: 0.7rem;
    }

    .action-buttons .btn i {
        font-size: 0.75rem;
    }
}

/* ============================================
   COMPREHENSIVE CARD RESPONSIVE FIXES
   ============================================ */

/* === STAT CARD RESPONSIVE === */
@media (max-width: 1024px) {
    .stat-card {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        padding: 1.25rem;
        min-height: 100px;
    }

    .stat-card-content {
        flex: 1;
        min-width: 0;
    }

    .stat-card-icon {
        flex-shrink: 0;
    }
}

@media (max-width: 768px) {
    .stat-card {
        padding: 1rem;
        min-height: 95px;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .stat-card-content {
        gap: 4px;
    }

    .stat-card-label {
        font-size: 0.7rem;
    }

    .stat-card-value {
        font-size: 1.75rem;
    }

    .stat-card-sub {
        font-size: 0.7rem;
    }

    .stat-card-icon {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    .stat-card {
        padding: 0.875rem;
        min-height: 85px;
        gap: 12px;
    }

    .stat-card-value {
        font-size: 1.5rem;
    }

    .stat-card-icon {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
}

/* === CHART CARD RESPONSIVE === */
@media (max-width: 1024px) {
    .chart-card {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        padding: 1.25rem;
    }

    .chart-canvas-container {
        width: 100%;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 768px) {
    .chart-card {
        padding: 1rem;
        border-radius: var(--radius-md);
    }

    .chart-header {
        flex-wrap: wrap;
        gap: 8px;
        margin-bottom: 0.75rem;
    }

    .chart-title {
        font-size: 1rem;
    }

    .chart-canvas-container {
        height: 220px;
        padding: 0;
        overflow: visible;
        width: 100%;
        position: relative;
    }

    .chart-canvas-container canvas {
        width: 100% !important;
        height: 100% !important;
        max-width: 100% !important;
        max-height: 100% !important;
    }
}

@media (max-width: 480px) {
    .chart-card {
        padding: 0.875rem;
    }

    .chart-title {
        font-size: 0.9rem;
    }

    .chart-canvas-container {
        height: 200px;
        overflow: visible;
        width: 100%;
        position: relative;
    }

    .chart-canvas-container canvas {
        width: 100% !important;
        height: 100% !important;
        max-width: 100% !important;
        max-height: 100% !important;
    }
}

/* === LIST CARD RESPONSIVE === */
@media (max-width: 1024px) {
    .list-card {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        padding: 1.25rem;
    }

    .custom-list {
        max-height: 300px;
    }
}

@media (max-width: 768px) {
    .list-card {
        padding: 1rem;
        border-radius: var(--radius-md);
    }

    .list-header {
        flex-wrap: wrap;
        gap: 8px;
        margin-bottom: 0.75rem;
    }

    .list-title {
        font-size: 1rem;
    }

    .custom-list {
        max-height: 280px;
        gap: 8px;
    }

    .custom-list-item {
        padding: 0.75rem;
        font-size: 0.85rem;
        border-radius: var(--radius-sm);
        flex-wrap: wrap;
    }

    .custom-list-item-left {
        flex: 1;
        min-width: 0;
    }

    .custom-list-item-title {
        font-size: 0.85rem;
    }

    .custom-list-item-sub {
        font-size: 0.7rem;
    }

    .custom-list-item-right {
        text-align: right;
        flex-shrink: 0;
    }
}

@media (max-width: 480px) {
    .list-card {
        padding: 0.875rem;
    }

    .list-title {
        font-size: 0.9rem;
    }

    .custom-list {
        max-height: 250px;
        gap: 6px;
    }

    .custom-list-item {
        padding: 0.625rem;
        font-size: 0.8rem;
    }

    .custom-list-item-title {
        font-size: 0.8rem;
    }

    .custom-list-item-sub {
        font-size: 0.65rem;
    }
}

/* === GENERAL CARD RESPONSIVE === */
@media (max-width: 768px) {
    .card {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        border-radius: var(--radius-md);
        margin-bottom: 1rem;
    }

    .card-header {
        padding: 1rem;
        flex-wrap: wrap;
        gap: 8px;
    }

    .card-title {
        font-size: 1rem;
    }

    .card-body {
        padding: 1rem;
    }

    .card-footer {
        padding: 0.875rem 1rem;
        flex-wrap: wrap;
        gap: 8px;
    }
}

@media (max-width: 480px) {
    .card {
        border-radius: var(--radius-sm);
        margin-bottom: 0.875rem;
    }

    .card-header {
        padding: 0.875rem;
    }

    .card-title {
        font-size: 0.9rem;
    }

    .card-body {
        padding: 0.875rem;
    }

    .card-footer {
        padding: 0.75rem 0.875rem;
    }
}

/* === STATS CARD (Alternative Style) RESPONSIVE === */
@media (max-width: 1024px) {
    .stats-card {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        min-height: 140px;
    }
}

@media (max-width: 768px) {
    .stats-card {
        padding: 1.25rem;
        min-height: 120px;
    }

    .stats-value {
        font-size: 1.75rem;
    }

    .stats-label {
        font-size: 0.8rem;
    }

    .stats-change {
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .stats-card {
        padding: 1rem;
        min-height: 110px;
    }

    .stats-value {
        font-size: 1.5rem;
    }

    .stats-label {
        font-size: 0.75rem;
    }

    .stats-change {
        font-size: 0.75rem;
    }
}

/* === DASHBOARD CONTAINER RESPONSIVE === */
@media (max-width: 1024px) {
    .dashboard-container {
        gap: 1.5rem;
        padding: 0.25rem 0;
    }
}

@media (max-width: 768px) {
    .dashboard-container {
        gap: 1rem;
        padding: 0;
    }

    .stats-container,
    .charts-container,
    .lists-container {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
}

@media (max-width: 480px) {
    .dashboard-container {
        gap: 0.875rem;
    }
}

/* === STATS GRID RESPONSIVE === */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
        gap: 1rem;
        align-items: stretch;
    }

    .stats-grid .stat-card,
    .stats-grid .stats-card {
        min-width: 0;
    }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
}

/* === CHARTS GRID RESPONSIVE === */
@media (max-width: 1024px) {
    .charts-grid {
        grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
        gap: 1rem;
    }
}

@media (max-width: 768px) {
    .charts-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    .charts-grid {
        gap: 0.75rem;
    }
}

/* === LISTS GRID RESPONSIVE === */
@media (max-width: 1024px) {
    .lists-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 1rem;
    }
}

@media (max-width: 768px) {
    .lists-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    .lists-grid {
        gap: 0.75rem;
    }
}

/* === CARD GRIDS (Finance, HR, etc.) RESPONSIVE === */
@media (max-width: 768px) {
    .finance-summary-grid,
    .leave-balance-grid,
    .marks-entry-stats {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 0.75rem;
    }

    .finance-card,
    .leave-balance-card,
    .balance-card,
    .marks-stat-card {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        padding: 1rem;
    }

    .finance-card-value,
    .balance-card .balance-value,
    .marks-stat-value {
        font-size: 1.5rem;
    }

    .finance-card-label,
    .balance-label,
    .marks-stat-label {
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .finance-summary-grid,
    .leave-balance-grid,
    .marks-entry-stats {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }

    .finance-card,
    .leave-balance-card,
    .balance-card,
    .marks-stat-card {
        padding: 0.875rem;
    }

    .finance-card-value,
    .balance-card .balance-value,
    .marks-stat-value {
        font-size: 1.25rem;
    }
}

/* === TABLE IN CARD RESPONSIVE === */
@media (max-width: 768px) {
    .card .table-container {
        margin: 0 -1rem;
        width: calc(100% + 2rem);
        border-radius: 0;
    }

    .card .table {
        font-size: 0.8rem;
    }

    .card .table th {
        padding: 0.625rem 0.5rem;
        font-size: 0.7rem;
    }

    .card .table td {
        padding: 0.625rem 0.5rem;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .card .table-container {
        margin: 0 -0.875rem;
        width: calc(100% + 1.75rem);
    }

    .card .table {
        font-size: 0.75rem;
    }

    .card .table th {
        padding: 0.5rem 0.375rem;
        font-size: 0.65rem;
    }

    .card .table td {
        padding: 0.5rem 0.375rem;
        font-size: 0.75rem;
    }
}

/* === SUBMISSION CARD RESPONSIVE === */
@media (max-width: 768px) {
    .submission-card {
        padding: 1rem;
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .submission-student-info {
        width: 100%;
    }

    .submission-avatar {
        width: 36px;
        height: 36px;
        font-size: 0.85rem;
    }

    .submission-details h4 {
        font-size: 0.9rem;
    }

    .submission-meta {
        font-size: 0.75rem;
        gap: 8px;
    }

    .submission-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .marks-display {
        font-size: 1.25rem;
        margin-right: 0.5rem;
    }
}

/* === ASSIGNMENT INFO HEADER RESPONSIVE === */
@media (max-width: 768px) {
    .assignment-info-header {
        padding: 1.25rem;
        border-radius: var(--radius-md);
    }

    .assignment-info-header h2 {
        font-size: 1.1rem;
    }

    .assignment-info-meta {
        flex-direction: column;
        gap: 0.5rem;
        font-size: 0.8rem;
    }

    .assignment-info-meta span {
        font-size: 0.8rem;
    }
}

/* === PROMOTION SUMMARY CARD RESPONSIVE === */
@media (max-width: 768px) {
    .promotion-summary-card {
        padding: 1rem;
        flex-direction: column;
        gap: 1rem;
        border-radius: var(--radius-md);
    }

    .promotion-stat {
        padding: 0.75rem;
    }

    .promotion-stat-value {
        font-size: 1.5rem;
    }

    .promotion-stat-label {
        font-size: 0.7rem;
    }
}

/* ============================================
   STUDENT TOP NAVBAR LAYOUT
   Only applies to body.topnav-layout (student role menu).
   All desktop rules are scoped to min-width: 1025px so the
   existing mobile sidebar drawer behavior is untouched.
   ============================================ */
.app-navbar {
    display: none;
}

@media (min-width: 1025px) {
    body.topnav-layout .sidebar {
        display: none !important;
    }

    body.topnav-layout .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }

    body.topnav-layout #breadcrumb {
        display: none !important;
    }

    body.topnav-layout .header-left {
        gap: 0.75rem;
    }

    body.topnav-layout .navbar-brand {
        display: flex;
        align-items: center;
        flex-shrink: 0;
        text-decoration: none;
        margin-right: 0.75rem;
    }

    body.topnav-layout .app-navbar {
        display: flex;
        align-items: center;
        gap: 0.4rem;
    }
}

/* Brand */
.navbar-brand {
    display: none;
    align-items: center;
    flex-shrink: 0;
    text-decoration: none;
    margin-right: 0.5rem;
}

.navbar-brand-img {
    height: 38px;
    width: auto;
    object-fit: contain;
    border-radius: 8px;
}

/* Nav container */
.app-navbar-nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Direct (top-level) links */
.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.8rem;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    transition: color var(--transition), background-color var(--transition);
}

.nav-link:hover {
    color: var(--primary);
    background-color: var(--primary-50);
}

.nav-link.active {
    color: var(--primary);
    background-color: var(--primary-100);
    font-weight: 600;
}

/* Grouped dropdown */
.nav-dropdown {
    position: relative;
}

.nav-drop-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.8rem;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    font-family: inherit;
    white-space: nowrap;
    transition: color var(--transition), background-color var(--transition);
}

.nav-drop-btn:hover,
.nav-dropdown:focus-within .nav-drop-btn,
.nav-dropdown.open .nav-drop-btn {
    color: var(--primary);
    background-color: var(--primary-50);
}

.nav-drop-btn.active {
    color: var(--primary);
    font-weight: 600;
}

.nav-drop-btn .drop-arrow {
    font-size: 0.7rem;
    transition: transform var(--transition);
}

.nav-dropdown.open .nav-drop-btn .drop-arrow {
    transform: rotate(180deg);
}

.nav-drop-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 230px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 0.4rem;
    z-index: 1100;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity var(--transition), transform var(--transition), visibility var(--transition);
}

.nav-dropdown:hover .nav-drop-menu,
.nav-dropdown:focus-within .nav-drop-menu,
.nav-dropdown.open .nav-drop-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.nav-drop-menu .menu-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.75rem;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    margin: 2px 0;
    transition: background-color var(--transition), color var(--transition);
}

.nav-drop-menu .menu-item::before {
    display: none;
}

.nav-drop-menu .menu-item:hover {
    background-color: var(--primary-50);
    color: var(--primary);
}

.nav-drop-menu .menu-item.active {
    background-color: var(--primary-100);
    color: var(--primary);
    font-weight: 600;
}

.nav-drop-menu .menu-item i {
    width: 18px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.nav-drop-menu .menu-item.active i {
    color: var(--primary);
}

/* On small screens the top navbar is hidden and the existing
   hamburger + slide-in drawer (sidebar) is used instead. */
@media (max-width: 1024px) {
    body.topnav-layout .app-navbar {
        display: none !important;
    }
}
}
