/* ============================================
   EduMaster Design System v2.0
   Modern, Minimalist, Professional
   ============================================ */

/* --- Design Tokens --- */
:root {
    --primary: #4F46E5;
    --primary-hover: #4338CA;
    --primary-light: #EEF2FF;
    --primary-ring: rgba(79, 70, 229, 0.12);
    --success: #10B981;
    --success-light: #D1FAE5;
    --warning: #F59E0B;
    --warning-light: #FEF3C7;
    --error: #EF4444;
    --error-light: #FEE2E2;
    --info: #3B82F6;
    --info-light: #DBEAFE;
    --gray-50: #F8FAFC;
    --gray-100: #F1F5F9;
    --gray-200: #E2E8F0;
    --gray-300: #CBD5E1;
    --gray-400: #94A3B8;
    --gray-500: #64748B;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1E293B;
    --gray-900: #0F172A;
    --white: #FFFFFF;
    --sidebar-bg: #0F172A;
    --sidebar-w: 260px;
    --header-h: 60px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 16px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-xl: 0 8px 24px rgba(0,0,0,0.1);
    --transition: 0.2s ease;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* --- Reset & Base --- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.6;
    color: var(--gray-800);
    background: var(--gray-50);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
code { font-family: 'JetBrains Mono', 'Fira Code', monospace; font-size: 13px; background: var(--gray-100); padding: 2px 6px; border-radius: 4px; }

/* --- Layout: Sidebar + Main --- */
.dashboard-container {
    display: flex;
    min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    color: white;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 50;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, width 0.3s ease;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

.sidebar-header {
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}
.sidebar-logo {
    width: 48px;
    height: 48px;
    background: var(--primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}
.sidebar-logo svg { width: 26px; height: 26px; color: white; }
.sidebar-logo img { width: 100%; height: 100%; object-fit: cover; }
.sidebar-header h2 { font-size: 16px; font-weight: 700; color: white; letter-spacing: -0.3px; }
.sidebar-header p { font-size: 11px; color: var(--gray-400); font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; margin-top: 2px; }

.sidebar-menu {
    list-style: none;
    padding: 12px 0;
    flex: 1;
}
.sidebar-menu li { margin-bottom: 1px; }
.sidebar-menu > li > a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: var(--gray-400);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    transition: all var(--transition);
    border-left: 3px solid transparent;
}
.sidebar-menu > li > a:hover {
    color: white;
    background: rgba(255,255,255,0.04);
    text-decoration: none;
}
.sidebar-menu > li > a.active,
.sidebar-menu > li > a.active:hover {
    color: white;
    background: rgba(79, 70, 229, 0.15);
    border-left-color: var(--primary);
}
.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}
.sidebar-footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    margin-bottom: 10px;
}
.sidebar-footer-links a {
    font-size: 11px;
    color: var(--gray-500);
    text-decoration: none;
    font-weight: 500;
}
.sidebar-footer-links a:hover { color: var(--gray-300); text-decoration: none; }
.sidebar-powered {
    font-size: 11px;
    color: var(--gray-600);
    margin: 0;
}
.sidebar-powered strong { color: var(--gray-500); }

.sidebar-menu .menu-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    opacity: 0.7;
}
.sidebar-menu > li > a.active .menu-icon,
.sidebar-menu > li > a:hover .menu-icon { opacity: 1; }

.sidebar-divider {
    border-top: 1px solid rgba(255,255,255,0.06);
    margin: 8px 16px;
    list-style: none;
}

.sidebar-section-label {
    padding: 16px 20px 6px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--gray-500);
    list-style: none;
}

/* Submenu */
.has-submenu { position: relative; }
.submenu-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}
.submenu-toggle .arrow {
    width: 16px;
    height: 16px;
    transition: transform 0.2s ease;
    opacity: 0.5;
}
.has-submenu.open .arrow { transform: rotate(180deg); opacity: 0.8; }
.submenu {
    list-style: none;
    padding-left: 0;
    margin: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: rgba(0,0,0,0.15);
}
.has-submenu.open .submenu { max-height: 600px; }
.submenu li a {
    display: block;
    padding: 8px 20px 8px 52px;
    font-size: 13px;
    color: var(--gray-400);
    text-decoration: none;
    transition: all var(--transition);
    position: relative;
}
.submenu li a::before {
    content: '';
    position: absolute;
    left: 32px;
    top: 50%;
    transform: translateY(-50%);
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--gray-600);
    transition: background var(--transition);
}
.submenu li a:hover { color: white; background: rgba(255,255,255,0.03); text-decoration: none; }
.submenu li a:hover::before { background: var(--gray-400); }
.submenu li a.active { color: white; font-weight: 600; }
.submenu li a.active::before { background: var(--primary); }
.has-submenu.active .submenu { max-height: 600px; }
.has-submenu.active .arrow { transform: rotate(180deg); }

/* --- Main Header / Top Bar --- */
.main-header {
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    padding: 0 24px;
    height: var(--header-h);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 40;
    margin-left: var(--sidebar-w);
}
.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}
.menu-toggle {
    display: none;
    background: none;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    padding: 6px;
    cursor: pointer;
    color: var(--gray-600);
    transition: all var(--transition);
}
.menu-toggle:hover { background: var(--gray-100); color: var(--gray-800); }
.menu-toggle svg { width: 20px; height: 20px; display: block; }
.header-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}
.header-logo img { width: 32px; height: 32px; border-radius: 8px; }
.header-logo span { font-size: 16px; font-weight: 700; color: var(--gray-900); letter-spacing: -0.3px; }
.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}
.header-search {
    position: relative;
}
.header-search input {
    padding: 8px 12px 8px 36px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    width: 240px;
    font-size: 13px;
    font-family: var(--font);
    color: var(--gray-800);
    background: var(--gray-50);
    transition: all var(--transition);
    outline: none;
}
.header-search input:focus { border-color: var(--primary); background: var(--white); box-shadow: 0 0 0 3px var(--primary-ring); }
.header-search input::placeholder { color: var(--gray-400); }
.header-search svg {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--gray-400);
    pointer-events: none;
}

/* Header buttons (notifications, user) */
.header-icon-btn {
    position: relative;
    background: none;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 8px;
    cursor: pointer;
    color: var(--gray-500);
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}
.header-icon-btn:hover { background: var(--gray-100); color: var(--gray-700); border-color: var(--gray-200); }
.header-icon-btn svg { width: 20px; height: 20px; }
.notification-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 16px;
    height: 16px;
    background: var(--error);
    color: white;
    border-radius: 50%;
    font-size: 10px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--white);
}

/* User button */
.user-btn {
    background: none;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: 5px 12px 5px 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all var(--transition);
}
.user-btn:hover { background: var(--gray-50); border-color: var(--gray-300); }
.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
}
.user-btn img { width: 32px; height: 32px; border-radius: 8px; object-fit: cover; }
.user-btn .user-info { text-align: left; }
.user-btn .user-name { font-size: 13px; font-weight: 600; color: var(--gray-800); display: block; line-height: 1.2; }
.user-btn .user-role { font-size: 11px; color: var(--gray-500); display: block; }

/* Dropdowns */
.dropdown-wrapper { position: relative; }
.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    display: none;
    min-width: 280px;
    z-index: 100;
    overflow: hidden;
}
.dropdown-menu.show { display: block; animation: fadeIn 0.15s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
.dropdown-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.dropdown-header h3 { font-size: 14px; font-weight: 600; color: var(--gray-900); }
.dropdown-header a { font-size: 12px; color: var(--primary); font-weight: 500; }
.dropdown-body { max-height: 320px; overflow-y: auto; }
.dropdown-footer {
    padding: 10px 16px;
    border-top: 1px solid var(--gray-100);
    text-align: center;
}
.dropdown-footer a { font-size: 13px; color: var(--primary); font-weight: 500; }

/* Notification items */
.notification-item {
    display: block;
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-50);
    transition: background var(--transition);
    text-decoration: none;
}
.notification-item:hover { background: var(--gray-50); text-decoration: none; }
.notification-item.unread { background: var(--primary-light); }
.notification-item.unread:hover { background: #E0E7FF; }
.notification-title { font-size: 13px; font-weight: 600; color: var(--gray-800); margin-bottom: 2px; }
.notification-message { font-size: 12px; color: var(--gray-500); line-height: 1.4; }
.notification-time { font-size: 11px; color: var(--gray-400); margin-top: 4px; }
.notification-empty { padding: 32px 16px; text-align: center; color: var(--gray-400); font-size: 13px; }

/* User dropdown */
.user-dropdown a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: var(--gray-700);
    font-size: 13px;
    font-weight: 500;
    transition: background var(--transition);
    text-decoration: none;
}
.user-dropdown a:hover { background: var(--gray-50); text-decoration: none; }
.user-dropdown a svg { width: 16px; height: 16px; color: var(--gray-400); }
.user-dropdown hr { margin: 4px 0; border: none; border-top: 1px solid var(--gray-100); }
.user-dropdown .logout-form { margin: 0; }
.user-dropdown .logout-link {
    width: 100%;
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--font);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--error);
    transition: background var(--transition);
}
.user-dropdown .logout-link:hover { background: var(--error-light); }
.user-dropdown .logout-link svg { color: var(--error); }

/* --- Dashboard Main --- */
.dashboard-main {
    flex: 1;
    min-width: 0; /* allow this flex item to shrink instead of overflowing the page when children (e.g. wide tables) are wider than available space */
    margin-left: var(--sidebar-w);
    padding: 24px;
    min-height: 100vh;
}

/* --- Breadcrumbs --- */
.breadcrumbs {
    padding: 12px 24px;
    margin-left: var(--sidebar-w);
    font-size: 13px;
    color: var(--gray-500);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    background: var(--gray-50);
}
.breadcrumbs a { color: var(--gray-500); font-weight: 500; text-decoration: none; }
.breadcrumbs a:hover { color: var(--primary); text-decoration: none; }
.breadcrumbs .bc-sep { margin: 0 8px; color: var(--gray-300); font-size: 11px; }
.breadcrumbs .bc-current { color: var(--gray-800); font-weight: 600; }

/* --- Page Header --- */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
    gap: 16px;
}
.page-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-900);
    letter-spacing: -0.5px;
    line-height: 1.3;
}
.page-header p {
    font-size: 14px;
    color: var(--gray-500);
    margin-top: 4px;
}
.header-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* --- Stats Grid --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--white);
    padding: 20px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: all var(--transition);
}
.stat-card:hover {
    border-color: var(--gray-300);
    box-shadow: var(--shadow-md);
}
.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 20px;
}
.stat-icon svg { width: 22px; height: 22px; }
.stat-icon-primary { background: var(--primary-light); color: var(--primary); }
.stat-icon-success { background: var(--success-light); color: var(--success); }
.stat-icon-warning { background: var(--warning-light); color: var(--warning); }
.stat-icon-info { background: var(--info-light); color: var(--info); }
.stat-icon-error { background: var(--error-light); color: var(--error); }
.stat-content h3 { font-size: 12px; font-weight: 600; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.stat-value { font-size: 20px; font-weight: 700; color: var(--gray-900); line-height: 1.2; }
.stat-card.stat-primary .stat-value { color: var(--primary); }
.stat-card.stat-success .stat-value { color: var(--success); }
.stat-card.stat-warning .stat-value { color: var(--warning); }
.stat-card.stat-info .stat-value { color: var(--info); }
.stat-change { font-size: 12px; margin-top: 4px; font-weight: 500; }
.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--error); }

/* --- Dashboard Grid --- */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

/* --- Cards --- */
.dashboard-card, .form-card, .table-card, .quick-actions, .filter-section {
    background: var(--white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
}
.dashboard-card { overflow: hidden; }
.dashboard-card h2, .table-card h2, .quick-actions h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-900);
    letter-spacing: -0.2px;
}
.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.card-header h2 { font-size: 15px; font-weight: 600; }
.card-body { padding: 20px; overflow-x: auto; }

.table-card { padding: 20px; margin-bottom: 16px; overflow-x: auto; }
.table-card h2 { margin-bottom: 16px; }
.form-card { padding: 24px 28px; margin-bottom: 16px; max-width: 1100px; }
.quick-actions { padding: 20px; margin-bottom: 16px; }
.quick-actions h2 { margin-bottom: 16px; }
.filter-section { padding: 16px 20px; margin-bottom: 16px; }

/* --- Data Tables --- */
/* No blanket min-width here: a fixed floor makes narrow 2-3 column tables
   (e.g. inside a half-width card in a 2-column dashboard grid) overflow their
   own card. Tables size to their natural content instead; .table-card's
   overflow-x: auto is the safety net for genuinely wide/many-column tables. */
.data-table { width: 100%; border-collapse: collapse; }
.data-table thead th {
    padding: 10px 14px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--gray-200);
    background: var(--gray-50);
    position: sticky;
    top: 0;
    z-index: 1;
    /* Long labels (e.g. "Payment Terms", "Purchase Orders") wrap onto a second
       line instead of overflowing into the next header cell when the column
       is narrow. */
    white-space: normal;
    min-width: 90px;
}
/* Values that must not break mid-token (phone numbers, codes) - apply this
   class to a <td> so hyphens/slashes don't force an awkward multi-line wrap
   that squeezes neighboring columns. */
.nowrap { white-space: nowrap; }
.data-table td {
    padding: 10px 14px;
    font-size: 13px;
    color: var(--gray-700);
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
}
.data-table tbody tr { transition: background 0.1s; }
/* Pin the last column (typically row actions/buttons) so it stays reachable
   even when a wide table needs to scroll horizontally within its card -
   otherwise action buttons can end up scrolled out of view with no obvious
   affordance telling the user to scroll for them. */
.data-table th:last-child,
.data-table td:last-child {
    position: sticky;
    right: 0;
    background: var(--white);
    box-shadow: -6px 0 8px -6px rgba(0, 0, 0, 0.15);
}
.data-table thead th:last-child {
    background: var(--gray-50);
    z-index: 2;
}
.data-table tbody tr:hover { background: var(--gray-50); }
.data-table tbody tr:last-child td { border-bottom: none; }

.table-container {
    background: var(--white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
    overflow-x: auto;
    margin-bottom: 16px;
}
.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    flex-wrap: wrap;
    gap: 10px;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 18px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    font-family: var(--font);
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition);
    text-align: center;
    white-space: nowrap;
    line-height: 1.4;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); box-shadow: 0 2px 8px rgba(79,70,229,0.3); }
.btn-secondary { background: var(--gray-100); color: var(--gray-700); border: 1px solid var(--gray-200); }
.btn-secondary:hover { background: var(--gray-200); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #059669; }
.btn-warning { background: var(--warning); color: white; }
.btn-warning:hover { background: #D97706; }
.btn-error { background: var(--error); color: white; }
.btn-error:hover { background: #DC2626; }
.btn-info { background: var(--info); color: white; }
.btn-info:hover { background: #2563EB; }
.btn-outline { background: transparent; color: var(--primary); border: 1px solid var(--primary); }
.btn-outline:hover { background: var(--primary-light); }
.btn-ghost { background: transparent; color: var(--gray-600); }
.btn-ghost:hover { background: var(--gray-100); }
.btn-block { width: 100%; display: flex; }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 5px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }

.action-buttons { display: flex; flex-wrap: wrap; gap: 8px; }

/* --- Forms --- */
.form-group { margin-bottom: 13px; }
.form-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--gray-700);
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-family: var(--font);
    color: var(--gray-800);
    background: var(--white);
    transition: all var(--transition);
    outline: none;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-ring);
}
.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--gray-400); }
.form-group textarea { resize: vertical; min-height: 60px; }
.form-group select { cursor: pointer; }

.form-section { margin-bottom: 18px; }
.form-section h2 {
    font-size: 15px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--gray-200);
}
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 260px));
    gap: 12px;
    margin-bottom: 12px;
}
.form-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--gray-100);
}
.filter-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    gap: 8px;
    font-size: 14px;
}
.checkbox-label input { width: auto; accent-color: var(--primary); }

/* --- Alerts --- */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    font-size: 13px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    line-height: 1.5;
    animation: slideDown 0.25s ease;
}
.alert svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
.alert-success { background: #ECFDF5; color: #065F46; border: 1px solid #A7F3D0; }
.alert-error { background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; }
.alert-warning { background: #FFFBEB; color: #92400E; border: 1px solid #FDE68A; }
.alert-info { background: #EFF6FF; color: #1E40AF; border: 1px solid #BFDBFE; }

/* --- Badges --- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.2px;
}
.badge-active, .badge-success { background: #ECFDF5; color: #065F46; }
.badge-inactive, .badge-error { background: #FEF2F2; color: #991B1B; }
.badge-draft, .badge-warning { background: #FFFBEB; color: #92400E; }
.badge-published, .badge-info { background: #EFF6FF; color: #1E40AF; }
.badge-primary { background: var(--primary-light); color: var(--primary); }

/* --- Pagination --- */
.pagination {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin: 20px 0;
    flex-wrap: wrap;
}
.pagination a, .pagination span {
    padding: 7px 12px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all var(--transition);
}
.pagination a { background: var(--white); color: var(--gray-600); border: 1px solid var(--gray-200); }
.pagination a:hover { background: var(--primary); color: white; border-color: var(--primary); text-decoration: none; }
.pagination .current { background: var(--primary); color: white; font-weight: 600; border: 1px solid var(--primary); }

/* --- Misc Components --- */
/* --- Utility --- */
.text-muted { color: var(--gray-500); }

/* --- Avatars & Photos --- */
.student-photo-thumb { width: 36px; height: 36px; border-radius: 8px; object-fit: cover; }
.avatar-placeholder {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 12px;
    letter-spacing: -0.5px;
    flex-shrink: 0;
}
.parent-avatar-wrap {
    width: 56px;
    height: 56px;
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--gray-200);
}
.parent-avatar-img { width: 100%; height: 100%; object-fit: cover; }
.parent-avatar-initials {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 700;
    font-size: 18px;
    letter-spacing: -0.5px;
}
.stats-summary {
    background: var(--white);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    display: flex;
    gap: 24px;
    border: 1px solid var(--gray-200);
    font-size: 13px;
}
.stats-summary span { color: var(--gray-500); }
.stats-summary strong { color: var(--gray-800); }

/* Info list (used in dashboard cards) */
.info-list { display: flex; flex-direction: column; gap: 12px; padding: 16px 20px; }
.info-item { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.info-label { color: var(--gray-500); font-weight: 500; }
.info-value { color: var(--gray-800); font-weight: 600; }

/* Role stats */
.role-stats { padding: 16px 20px; display: flex; flex-direction: column; gap: 8px; }
.role-stat-item { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; font-size: 13px; }
.role-name { color: var(--gray-600); }
.role-count { font-weight: 600; color: var(--gray-800); background: var(--gray-100); padding: 2px 10px; border-radius: 12px; font-size: 12px; }

/* Loading spinner */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2.5px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Brief highlight flash when a live-polled stat value updates in place */
.stat-updated { animation: statFlash 0.9s ease; }
@keyframes statFlash {
    0% { background-color: rgba(79, 70, 229, 0.18); border-radius: 4px; }
    100% { background-color: transparent; }
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--gray-400);
}
.empty-state .icon { font-size: 40px; margin-bottom: 12px; opacity: 0.5; }
.empty-state .icon svg { width: 40px; height: 40px; stroke: var(--gray-400); margin: 0 auto; }
.empty-state h3 { color: var(--gray-700); font-size: 16px; margin-bottom: 6px; }
.empty-state p { font-size: 13px; color: var(--gray-500); }

/* KPI Grid (used in analytics dashboards) */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.kpi { background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius-lg); padding: 16px; border-left: 3px solid var(--primary); }
.kpi h4 { font-size: 11px; font-weight: 600; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.kpi .kpi-value { font-size: 20px; font-weight: 700; color: var(--gray-900); }

/* Chart containers */
.cr { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 16px; margin-bottom: 24px; }
.cb { background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius-lg); padding: 20px; }
.cb h3 { font-size: 15px; font-weight: 600; color: var(--gray-900); margin-bottom: 16px; }

/* --- Print --- */
/* Pairs with .print-full: some list tables show a shortened preview on screen
   (e.g. "...") to keep rows compact, but a printed/paper copy has no click-through
   to see the rest. .print-full holds the untruncated text, hidden on screen and
   swapped in for its .truncated-preview sibling when actually printed. */
.print-full { display: none; }
@media print {
    .sidebar, .main-header, .breadcrumbs, .filter-section, .pagination, .btn, .header-actions, .quick-actions { display: none !important; }
    .dashboard-main { margin-left: 0 !important; padding: 0 !important; }
    .dashboard-card, .table-card, .form-card { border: 1px solid #ddd !important; box-shadow: none !important; break-inside: avoid; }
    .data-table th { background: #f0f0f0 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    body { background: white; }
    .print-full { display: inline; }
    .truncated-preview { display: none; }
}

/* --- Responsive --- */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        position: fixed;
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.4);
        z-index: 45;
    }
    .sidebar-overlay.show { display: block; }
    .main-header { margin-left: 0; }
    .breadcrumbs { margin-left: 0; }
    .dashboard-main { margin-left: 0; }
    .menu-toggle { display: flex; }
    .header-search input { width: 180px; }
}
@media (max-width: 768px) {
    .dashboard-grid, .stats-grid, .cr { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .header-search { display: none; }
    .dashboard-main { padding: 16px; }
    .user-btn .user-info { display: none; }
}

/* --- Modal --- */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    overflow-y: auto;
    animation: fadeIn 0.2s ease;
}
.modal-content {
    background: #fff;
    margin: 40px auto;
    padding: 32px;
    border-radius: 16px;
    max-width: 600px;
    width: 90%;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    animation: slideDown 0.3s ease;
}
.modal-content h2 {
    margin: 0 0 24px;
    font-size: 20px;
    font-weight: 700;
    color: var(--gray-900);
}
.modal .close {
    position: absolute;
    top: 16px;
    right: 20px;
    font-size: 28px;
    font-weight: 700;
    color: var(--gray-400);
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
    background: none;
    border: none;
}
.modal .close:hover {
    color: var(--gray-900);
}
.item-row {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}
