/* ============================================================
   School Management System - Main CSS
   Font: Plus Jakarta Sans (professional, modern)
   ============================================================ */

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

/* ============================================================
   CSS Variables - Light Theme
   ============================================================ */
:root,
[data-theme="light"] {
    /* Primary Brand */
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --primary-lighter: #dbeafe;

    /* Backgrounds */
    --bg-body: #f1f5f9;
    --bg-sidebar: #ffffff;
    --bg-topbar: #ffffff;
    --bg-card: #ffffff;
    --bg-input: #ffffff;
    --bg-hover: #f8fafc;
    --bg-table-alt: #f8fafc;

    /* Text */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-link: #2563eb;

    /* Borders */
    --border: #e2e8f0;
    --border-focus: #2563eb;

    /* Status Colors */
    --success: #10b981;
    --success-light: #d1fae5;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --info: #3b82f6;
    --info-light: #dbeafe;

    /* Sidebar */
    --sidebar-width: 260px;
    --sidebar-collapsed: 70px;
    --sidebar-text: #475569;
    --sidebar-active-bg: #eff6ff;
    --sidebar-active-text: #2563eb;
    --sidebar-hover-bg: #f8fafc;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-md: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.05);
    --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.08), 0 8px 10px -6px rgba(0,0,0,0.04);

    /* Topbar */
    --topbar-height: 64px;

    /* Transitions */
    --transition: 0.2s ease;
    --transition-slow: 0.35s ease;
}

/* ============================================================
   Dark Theme
   ============================================================ */
[data-theme="dark"] {
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --primary-light: #1e3a5f;
    --primary-lighter: #1e3a5f;

    --bg-body: #0f172a;
    --bg-sidebar: #1e293b;
    --bg-topbar: #1e293b;
    --bg-card: #1e293b;
    --bg-input: #0f172a;
    --bg-hover: #334155;
    --bg-table-alt: #162032;

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-link: #60a5fa;

    --border: #334155;
    --border-focus: #3b82f6;

    --success: #10b981;
    --success-light: #064e3b;
    --danger: #f87171;
    --danger-light: #450a0a;
    --warning: #fbbf24;
    --warning-light: #451a03;
    --info: #60a5fa;
    --info-light: #1e3a5f;

    --sidebar-text: #94a3b8;
    --sidebar-active-bg: #1e3a5f;
    --sidebar-active-text: #60a5fa;
    --sidebar-hover-bg: #334155;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.3);
    --shadow-md: 0 10px 15px -3px rgba(0,0,0,0.35);
    --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.4);
}

/* ============================================================
   Reset & Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; scroll-behavior: smooth; }

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    transition: background var(--transition), color var(--transition);
}

a { color: var(--text-link); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-hover); }

button { cursor: pointer; font-family: inherit; }

input, select, textarea {
    font-family: inherit;
    font-size: 0.875rem;
}

/* ============================================================
   Layout
   ============================================================ */
.sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    overflow: hidden;
    transition: transform var(--transition-slow), width var(--transition-slow), box-shadow var(--transition);
}

.main-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left var(--transition-slow);
}

.topbar {
    position: sticky;
    top: 0;
    height: var(--topbar-height);
    background: var(--bg-topbar);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    z-index: 900;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
}

.page-content {
    flex: 1;
    padding: 1.75rem;
    max-width: 100%;
    overflow-x: hidden;
}

/* ============================================================
   Sidebar Styles
   ============================================================ */
.sidebar-header {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 68px;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon { flex-shrink: 0; }

.logo-text {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.logo-name {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.logo-sub {
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.sidebar-close {
    display: none;
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 4px;
    border-radius: 6px;
}

.sidebar-user {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-avatar {
    width: 38px; height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

.user-info { overflow: hidden; }
.user-name { font-size: 0.8rem; font-weight: 600; color: var(--text-primary); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.user-role {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 1px 8px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-admin { background: var(--primary-lighter); color: var(--primary); }
.badge-teacher { background: var(--success-light); color: var(--success); }
.badge-student { background: var(--warning-light); color: var(--warning); }

.sidebar-nav {
    flex: 1;
    padding: 0.75rem 0.75rem;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.nav-item-wrapper { margin-bottom: 2px; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.6rem 0.85rem;
    border-radius: 10px;
    color: var(--sidebar-text);
    font-size: 0.845rem;
    font-weight: 500;
    transition: all var(--transition);
    text-decoration: none;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
}

.nav-item:hover {
    background: var(--sidebar-hover-bg);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
    font-weight: 600;
}

.nav-item.active .nav-icon { color: var(--sidebar-active-text); }

.nav-icon {
    display: flex;
    align-items: center;
    width: 20px;
    flex-shrink: 0;
    color: var(--text-muted);
    transition: color var(--transition);
}

.nav-label { flex: 1; white-space: nowrap; }

.nav-arrow {
    margin-left: auto;
    transition: transform var(--transition);
    color: var(--text-muted);
}

.nav-item-wrapper.open .nav-arrow { transform: rotate(90deg); }

.submenu {
    display: none;
    padding: 0.25rem 0 0.25rem 2.5rem;
}

.nav-item-wrapper.open .submenu { display: block; }

.submenu-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.75rem;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    transition: all var(--transition);
    margin-bottom: 1px;
}

.submenu-item:hover { background: var(--sidebar-hover-bg); color: var(--text-primary); }
.submenu-item.active { color: var(--primary); background: var(--primary-light); }

.sidebar-footer {
    padding: 0.75rem;
    border-top: 1px solid var(--border);
}

.logout-btn { color: var(--danger) !important; }
.logout-btn:hover { background: var(--danger-light) !important; }

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    backdrop-filter: blur(2px);
}

/* ============================================================
   Topbar
   ============================================================ */
.topbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 6px;
    border-radius: 8px;
    transition: all var(--transition);
}

.menu-toggle:hover { background: var(--bg-hover); }

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.breadcrumb-current { color: var(--text-primary); font-weight: 600; }

.topbar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.topbar-search {
    position: relative;
    display: flex;
    align-items: center;
}

.topbar-search i {
    position: absolute;
    left: 10px;
    color: var(--text-muted);
    pointer-events: none;
}

.topbar-search input {
    background: var(--bg-body);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 7px 12px 7px 34px;
    font-size: 0.82rem;
    color: var(--text-primary);
    width: 200px;
    transition: all var(--transition);
    outline: none;
}

.topbar-search input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.08);
    width: 240px;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 7px;
    border-radius: 9px;
    transition: all var(--transition);
    position: relative;
    display: flex;
    align-items: center;
}

.icon-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

.theme-toggle {
    background: var(--bg-body);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 7px;
    border-radius: 9px;
    transition: all var(--transition);
    display: flex;
    align-items: center;
}

.theme-toggle:hover { background: var(--bg-hover); }

[data-theme="light"] .icon-dark { display: none; }
[data-theme="dark"] .icon-light { display: none; }

.notif-badge {
    position: absolute;
    top: 2px; right: 2px;
    background: var(--danger);
    color: white;
    font-size: 0.6rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
}

/* Dropdowns */
.notification-wrapper, .profile-wrapper { position: relative; }

.dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    min-width: 240px;
    z-index: 1100;
    overflow: hidden;
    animation: dropdownIn 0.18s ease;
}

.dropdown-menu.show { display: block; }

@keyframes dropdownIn {
    from { opacity: 0; transform: translateY(-6px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.dropdown-header {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.dropdown-header small { color: var(--text-muted); font-weight: 400; }

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.65rem 1rem;
    color: var(--text-secondary);
    font-size: 0.83rem;
    transition: background var(--transition);
}

.dropdown-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.dropdown-item.text-danger { color: var(--danger); }
.dropdown-item.text-danger:hover { background: var(--danger-light); }

.dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }

.dropdown-footer {
    display: block;
    text-align: center;
    padding: 0.65rem 1rem;
    font-size: 0.8rem;
    color: var(--primary);
    font-weight: 500;
    border-top: 1px solid var(--border);
}

.notif-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.notif-dot.blue { background: var(--primary); }
.notif-dot.red { background: var(--danger); }

.notif-title { font-size: 0.82rem; font-weight: 500; color: var(--text-primary); }
.notif-time { font-size: 0.73rem; color: var(--text-muted); }

.profile-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 5px 10px 5px 5px;
    color: var(--text-primary);
    font-size: 0.82rem;
    font-weight: 500;
    transition: all var(--transition);
}

.profile-btn:hover { background: var(--bg-hover); }

.profile-avatar {
    width: 30px; height: 30px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    color: white;
    font-size: 0.68rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-name { max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============================================================
   Cards
   ============================================================ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition);
    overflow: hidden;
}

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

.card-header {
    padding: 1.1rem 1.4rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.card-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-body { padding: 1.4rem; }
.card-footer {
    padding: 0.9rem 1.4rem;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Stat Cards */
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.4rem;
    display: flex;
    align-items: center;
    gap: 1.1rem;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.stat-card::after {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 80px; height: 80px;
    border-radius: 50%;
    transform: translate(20px, -20px);
    opacity: 0.07;
}

.stat-icon {
    width: 52px; height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.4rem;
}

.stat-info { flex: 1; }
.stat-value { font-size: 1.75rem; font-weight: 800; color: var(--text-primary); line-height: 1; }
.stat-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 3px; font-weight: 500; }
.stat-change { font-size: 0.75rem; font-weight: 600; margin-top: 4px; }
.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }

.stat-blue .stat-icon { background: var(--primary-light); color: var(--primary); }
.stat-green .stat-icon { background: var(--success-light); color: var(--success); }
.stat-orange .stat-icon { background: var(--warning-light); color: var(--warning); }
.stat-purple .stat-icon { background: #f3e8ff; color: #7c3aed; }
.stat-red .stat-icon { background: var(--danger-light); color: var(--danger); }

/* ============================================================
   Tables
   ============================================================ */
.table-wrapper {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--border);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.855rem;
}

thead th {
    background: var(--bg-body);
    padding: 0.85rem 1rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

tbody td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
    vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }

tbody tr:hover { background: var(--bg-hover); }

tbody tr:nth-child(even) { background: var(--bg-table-alt); }
tbody tr:nth-child(even):hover { background: var(--bg-hover); }

.td-name { font-weight: 600; color: var(--text-primary); }

/* ============================================================
   Badges
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: capitalize;
}

.badge-success { background: var(--success-light); color: var(--success); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-info { background: var(--info-light); color: var(--info); }
.badge-secondary { background: var(--bg-body); color: var(--text-secondary); border: 1px solid var(--border); }
.badge-primary { background: var(--primary-lighter); color: var(--primary); }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: 10px;
    font-size: 0.845rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    text-decoration: none;
    line-height: 1.4;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); color: white; box-shadow: 0 4px 12px rgba(37,99,235,0.35); }

.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #059669; color: white; box-shadow: 0 4px 12px rgba(16,185,129,0.35); }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; color: white; }

.btn-warning { background: var(--warning); color: white; }
.btn-warning:hover { background: #d97706; color: white; }

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--border);
    color: var(--text-secondary);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

.btn-sm { padding: 5px 12px; font-size: 0.78rem; border-radius: 8px; }
.btn-lg { padding: 11px 26px; font-size: 0.95rem; }
.btn-icon { padding: 8px; }
.btn-icon-sm { padding: 5px; border-radius: 8px; }

/* Action buttons in tables */
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.btn-action {
    padding: 5px 10px;
    border-radius: 8px;
    font-size: 0.76rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    text-decoration: none;
}

.btn-edit { background: var(--info-light); color: var(--info); }
.btn-edit:hover { background: var(--info); color: white; }
.btn-delete { background: var(--danger-light); color: var(--danger); }
.btn-delete:hover { background: var(--danger); color: white; }
.btn-view { background: var(--success-light); color: var(--success); }
.btn-view:hover { background: var(--success); color: white; }
.btn-print { background: var(--warning-light); color: var(--warning); }
.btn-print:hover { background: var(--warning); color: white; }

/* ============================================================
   Forms
   ============================================================ */
.form-group {
    margin-bottom: 1.1rem;
}

.form-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.form-label span.required { color: var(--danger); margin-left: 2px; }

.form-control {
    width: 100%;
    padding: 9px 12px;
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: all var(--transition);
    outline: none;
    line-height: 1.5;
}

.form-control:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.08);
}

.form-control::placeholder { color: var(--text-muted); }

select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 90px; }

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.form-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: 0.75rem; color: var(--danger); margin-top: 4px; }

.form-control.is-invalid { border-color: var(--danger); }
.form-control.is-valid { border-color: var(--success); }

/* ============================================================
   Alerts
   ============================================================ */
.alert {
    padding: 0.875rem 1.1rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-size: 0.855rem;
    margin-bottom: 1.25rem;
    position: relative;
}

.alert button {
    margin-left: auto;
    background: none;
    border: none;
    opacity: 0.6;
    cursor: pointer;
    display: flex;
    align-items: center;
    color: inherit;
}

.alert-success { background: var(--success-light); color: #065f46; border: 1px solid rgba(16,185,129,0.2); }
.alert-danger { background: var(--danger-light); color: #991b1b; border: 1px solid rgba(239,68,68,0.2); }
.alert-warning { background: var(--warning-light); color: #92400e; border: 1px solid rgba(245,158,11,0.2); }
.alert-info { background: var(--info-light); color: #1e3a5f; border: 1px solid rgba(59,130,246,0.2); }

[data-theme="dark"] .alert-success { color: #6ee7b7; }
[data-theme="dark"] .alert-danger { color: #fca5a5; }
[data-theme="dark"] .alert-warning { color: #fde68a; }
[data-theme="dark"] .alert-info { color: #93c5fd; }

/* ============================================================
   Page Header
   ============================================================ */
.page-header {
    margin-bottom: 1.75rem;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.page-title {
    font-size: 1.45rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
}

.page-subtitle {
    font-size: 0.83rem;
    color: var(--text-muted);
    margin-top: 3px;
}

.page-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }

/* ============================================================
   Grid Layouts
   ============================================================ */
.grid { display: grid; gap: 1.25rem; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

/* ============================================================
   Modal
   ============================================================ */
.modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 1200;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    backdrop-filter: blur(3px);
}

.modal-backdrop.show { display: flex; }

.modal {
    background: var(--bg-card);
    border-radius: 20px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.22s ease;
}

.modal-lg { max-width: 800px; }
.modal-sm { max-width: 420px; }

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.93) translateY(16px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    padding: 1.4rem 1.6rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
}

.modal-title { font-size: 1.05rem; font-weight: 700; color: var(--text-primary); }

.modal-close {
    background: var(--bg-body);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 5px;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: all var(--transition);
}

.modal-close:hover { background: var(--danger-light); color: var(--danger); border-color: transparent; }

.modal-body { padding: 1.4rem 1.6rem; }
.modal-footer {
    padding: 1rem 1.6rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 0.65rem;
}

/* ============================================================
   Progress Bar
   ============================================================ */
.progress {
    background: var(--bg-body);
    border-radius: 10px;
    height: 8px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    border-radius: 10px;
    background: var(--primary);
    transition: width 0.6s ease;
}

.progress-bar.green { background: var(--success); }
.progress-bar.orange { background: var(--warning); }
.progress-bar.red { background: var(--danger); }

/* ============================================================
   Avatar
   ============================================================ */
.avatar {
    width: 36px; height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    color: white;
    font-size: 0.72rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.avatar-sm { width: 28px; height: 28px; font-size: 0.62rem; border-radius: 8px; }
.avatar-lg { width: 52px; height: 52px; font-size: 1rem; border-radius: 14px; }

/* ============================================================
   Empty State
   ============================================================ */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-muted);
}

.empty-state-icon { font-size: 3rem; margin-bottom: 1rem; opacity: 0.3; }
.empty-state h3 { font-size: 1rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 0.5rem; }
.empty-state p { font-size: 0.83rem; }

/* ============================================================
   Search & Filter Bar
   ============================================================ */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.search-input-wrapper {
    position: relative;
    flex: 1;
    min-width: 200px;
}

.search-input-wrapper i {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.search-input-wrapper input {
    width: 100%;
    padding: 9px 12px 9px 36px;
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-size: 0.855rem;
    color: var(--text-primary);
    outline: none;
    transition: all var(--transition);
}

.search-input-wrapper input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.08);
}

/* ============================================================
   Pagination
   ============================================================ */
.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.page-link {
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    background: var(--bg-card);
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.page-link:hover { border-color: var(--primary); color: var(--primary); }
.page-link.active { background: var(--primary); color: white; border-color: var(--primary); }
.page-link.disabled { opacity: 0.4; cursor: not-allowed; }

/* ============================================================
   Login Page
   ============================================================ */
.login-page {
    min-height: 100vh;
    background: var(--bg-body);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    width: 500px; height: 500px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(37,99,235,0.08), rgba(124,58,237,0.06));
    top: -200px; right: -200px;
    pointer-events: none;
}

.login-page::after {
    content: '';
    position: absolute;
    width: 400px; height: 400px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(16,185,129,0.05), rgba(37,99,235,0.04));
    bottom: -150px; left: -150px;
    pointer-events: none;
}

.login-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    max-width: 900px;
    width: 100%;
    background: var(--bg-card);
    border-radius: 24px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    border: 1px solid var(--border);
    position: relative;
    z-index: 1;
}

.login-promo {
    background: linear-gradient(135deg, #1e40af, #2563eb, #3b82f6);
    padding: 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.login-promo::before {
    content: '';
    position: absolute;
    width: 300px; height: 300px;
    border-radius: 50%;
    background: rgba(255,255,255,0.06);
    bottom: -100px; right: -80px;
}

.login-promo::after {
    content: '';
    position: absolute;
    width: 200px; height: 200px;
    border-radius: 50%;
    background: rgba(255,255,255,0.04);
    top: -60px; left: -60px;
}

.login-promo-content { position: relative; z-index: 1; }

.promo-logo {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin-bottom: 2.5rem;
}

.promo-logo-icon {
    width: 46px; height: 46px;
    background: rgba(255,255,255,0.15);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.promo-logo-text { color: white; font-weight: 700; font-size: 1.15rem; }
.promo-logo-sub { color: rgba(255,255,255,0.7); font-size: 0.75rem; }

.promo-heading { font-size: 1.9rem; font-weight: 800; color: white; line-height: 1.25; margin-bottom: 1rem; }
.promo-desc { color: rgba(255,255,255,0.75); font-size: 0.88rem; line-height: 1.7; margin-bottom: 2rem; }

.promo-features { list-style: none; display: flex; flex-direction: column; gap: 0.75rem; }
.promo-features li {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    color: rgba(255,255,255,0.85);
    font-size: 0.855rem;
}

.promo-features li::before {
    content: '✓';
    width: 20px; height: 20px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    flex-shrink: 0;
}

.login-form-side { padding: 2.5rem; display: flex; flex-direction: column; justify-content: center; }

.login-title { font-size: 1.5rem; font-weight: 800; color: var(--text-primary); margin-bottom: 0.4rem; }
.login-subtitle { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 2rem; }

.demo-accounts {
    background: var(--bg-body);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    font-size: 0.78rem;
}

.demo-accounts h4 { font-size: 0.78rem; font-weight: 700; color: var(--text-secondary); margin-bottom: 0.6rem; text-transform: uppercase; letter-spacing: 0.5px; }

.demo-account-item {
    display: flex;
    justify-content: space-between;
    padding: 0.35rem 0;
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
}

.demo-account-item:last-child { border-bottom: none; }
.demo-account-item strong { color: var(--text-secondary); }

/* ============================================================
   Profile / Info Cards
   ============================================================ */
.info-table td {
    padding: 0.55rem 0;
    font-size: 0.855rem;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

.info-table td:first-child {
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
    padding-right: 1rem;
    width: 40%;
}

.info-table tr:last-child td { border-bottom: none; }

/* ============================================================
   Tabs
   ============================================================ */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 1.5rem; }

.tab-btn {
    padding: 0.6rem 1.1rem;
    font-size: 0.845rem;
    font-weight: 600;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all var(--transition);
    border-radius: 8px 8px 0 0;
}

.tab-btn:hover { color: var(--text-primary); background: var(--bg-hover); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ============================================================
   Loading / Spinner
   ============================================================ */
.spinner {
    display: inline-block;
    width: 20px; height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   Print Styles
   ============================================================ */
@media print {
    .sidebar, .topbar, .page-actions, .actions, .btn, .filter-bar, .pagination { display: none !important; }
    .main-wrapper { margin-left: 0 !important; }
    .page-content { padding: 0 !important; }
    .card { box-shadow: none !important; border: 1px solid #ccc !important; }
}

/* ============================================================
   Utility Classes
   ============================================================ */
.text-primary-color { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.p-0 { padding: 0 !important; }
.w-100 { width: 100%; }
.float-right { float: right; }
.clearfix::after { content: ''; display: table; clear: both; }
