/* ================================================================
   BOARDING SCHOOL ERP — PREMIUM DESIGN SYSTEM
   Modern UI inspired by Tabler/Metronic with glassmorphism
   ================================================================ */

/* ---- IMPORTS & VARIABLES ---- */
:root {
    /* RABS Theme Colors (Royal Blue & Cyan) */
    --primary:       #0052cc;
    --primary-light: #2563eb;
    --primary-dark:  #003999;
    --secondary:     #00aeef;
    --success:       #10b981;
    --warning:       #f59e0b;
    --danger:        #ef4444;
    --info:          #00aeef;
    --cyan:          #00aeef;
    --orange:        #f97316;

    /* Light Mode */
    --bg-body:       #f0f4f9;
    --bg-surface:    #ffffff;
    --bg-surface-2:  #f8fafc;
    --border-color:  #e2e8f0;
    --text-primary:  #0f172a;
    --text-secondary:#5a6578;
    --text-muted:    #94a3b8;

    /* Sidebar RABS Navy Theme */
    --sidebar-bg:    #0a192f;
    --sidebar-width: 262px;
    --sidebar-text:  #94a3b8;
    --sidebar-hover: rgba(0,174,239,0.08);
    --sidebar-active:#0052cc;

    /* Topbar */
    --topbar-height: 64px;
    --topbar-bg:     #ffffff;
    --topbar-border: #e2e8f0;

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

    /* Radius */
    --radius-sm:  8px;
    --radius-md:  12px;
    --radius-lg:  16px;
    --radius-xl:  20px;

    /* Transitions */
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Mode Variables */
[data-bs-theme="dark"] {
    --bg-body:        #0a0f1e;
    --bg-surface:     #111827;
    --bg-surface-2:   #1f2937;
    --border-color:   #1f2937;
    --text-primary:   #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted:     #475569;
    --topbar-bg:      #111827;
    --topbar-border:  #1f2937;
    --sidebar-hover:  rgba(255,255,255,0.04);
}

/* ---- BASE ---- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-size: 0.9rem;
    background: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ================================================================
   SIDEBAR
   ================================================================ */
.sidebar {
    position: sticky;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    border-right: 1px solid rgba(255,255,255,0.05);
    flex-shrink: 0;
}

/* Logo */
.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}
.logo-icon {
    width: 40px; height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--cyan));
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    font-size: 1.1rem;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(79,70,229,0.4);
}
.logo-name {
    display: block;
    color: #f1f5f9;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    line-height: 1.1;
}
.logo-tagline {
    display: block;
    color: #64748b;
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* User Info */
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
    background: rgba(255,255,255,0.02);
}
.sidebar-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
}
.sidebar-user-name {
    display: block;
    color: #e2e8f0;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}
.sidebar-user-role {
    display: block;
    color: var(--primary-light);
    font-size: 0.7rem;
    font-weight: 500;
}

/* Navigation */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
}

.sidebar-menu {
    list-style: none;
    margin: 0;
    padding: 0 10px;
}

.sidebar-item { margin-bottom: 1px; }

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.845rem;
    font-weight: 500;
    transition: var(--transition);
    cursor: pointer;
    user-select: none;
    position: relative;
}
.sidebar-link:hover {
    background: var(--sidebar-hover);
    color: #e2e8f0;
}
.sidebar-link.active,
.sidebar-item.active > .sidebar-link {
    background: rgba(79,70,229,0.15);
    color: var(--primary-light);
}
.sidebar-icon {
    width: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    flex-shrink: 0;
    color: inherit;
}
.sidebar-label { flex: 1; }
.sidebar-arrow {
    font-size: 0.65rem;
    transition: transform 0.2s ease;
    color: #475569;
}
.sidebar-link[aria-expanded="true"] .sidebar-arrow {
    transform: rotate(90deg);
    color: var(--primary-light);
}

/* Submenu */
.sidebar-submenu {
    padding-left: 0;
}
.sidebar-submenu ul {
    list-style: none;
    padding: 4px 0 4px 12px;
    margin: 0;
    border-left: 2px solid rgba(255,255,255,0.06);
    margin-left: 22px;
}
.sidebar-submenu li { margin-bottom: 1px; }
.sidebar-sublink {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-radius: 6px;
    color: #64748b;
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 400;
    transition: var(--transition);
}
.sidebar-sublink:hover, .sidebar-sublink.active {
    background: var(--sidebar-hover);
    color: #e2e8f0;
}
.sidebar-sublink.active {
    color: var(--primary-light);
    font-weight: 500;
}
.sublink-icon { font-size: 0.75rem; width: 16px; text-align: center; }

/* Sidebar Footer */
.sidebar-footer {
    padding: 12px 10px;
    border-top: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}
.sidebar-logout {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: #64748b;
    text-decoration: none;
    font-size: 0.845rem;
    font-weight: 500;
    transition: var(--transition);
}
.sidebar-logout:hover {
    background: rgba(239,68,68,0.1);
    color: #ef4444;
}

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

/* ================================================================
   MAIN WRAPPER
   ================================================================ */
.main-wrapper {
    margin-left: 0;
    flex: 1;
    min-width: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.main-wrapper.sidebar-collapsed {
    margin-left: 0;
}

/* ================================================================
   TOPBAR
   ================================================================ */
.topbar {
    height: var(--topbar-height);
    background: var(--topbar-bg);
    border-bottom: 1px solid var(--topbar-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    gap: 16px;
    box-shadow: var(--shadow-sm);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
    min-width: 0;
}
.topbar-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

/* Hamburger */
.sidebar-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 36px; height: 36px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    flex-shrink: 0;
}
.sidebar-toggle:hover { background: var(--bg-surface-2); }
.sidebar-toggle span {
    display: block;
    height: 2px;
    background: var(--text-secondary);
    border-radius: 2px;
    transition: var(--transition);
}
.sidebar-toggle span:first-child { width: 100%; }
.sidebar-toggle span:nth-child(2) { width: 75%; }
.sidebar-toggle span:last-child { width: 50%; }

/* Page title */
.page-title { font-size: 1rem; font-weight: 600; margin: 0; color: var(--text-primary); }

/* Search */
.topbar-search { position: relative; }
.search-input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-surface-2);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 6px 12px;
    transition: var(--transition);
    min-width: 240px;
}
.search-input-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}
.search-icon { color: var(--text-muted); font-size: 0.8rem; flex-shrink: 0; }
.search-input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.85rem;
    width: 100%;
}
.search-input::placeholder { color: var(--text-muted); }
.search-kbd {
    background: var(--border-color);
    color: var(--text-muted);
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    flex-shrink: 0;
    font-family: inherit;
}
.search-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    z-index: 200;
    overflow: hidden;
    max-height: 400px;
    overflow-y: auto;
}
.search-dropdown.show { display: block; }

/* Topbar Buttons */
.topbar-btn {
    width: 36px; height: 36px;
    border-radius: var(--radius-sm);
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    transition: var(--transition);
    position: relative;
}
.topbar-btn:hover {
    background: var(--bg-surface-2);
    color: var(--text-primary);
}

/* Notification badge */
.notif-badge {
    position: absolute;
    top: 4px; right: 4px;
    width: 16px; height: 16px;
    background: var(--danger);
    color: #fff;
    border-radius: 50%;
    font-size: 0.6rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Notification Dropdown */
.notif-dropdown {
    width: 340px !important;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    background: var(--bg-surface);
    overflow: hidden;
}
.notif-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-primary);
}
.notif-mark-all { color: var(--primary); font-size: 0.78rem; cursor: pointer; font-weight: 500; }
.notif-body { max-height: 320px; overflow-y: auto; }
.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}
.notif-item:hover { background: var(--bg-surface-2); }
.notif-item.unread { background: rgba(79,70,229,0.03); }
.notif-icon {
    width: 36px; height: 36px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.8rem;
    flex-shrink: 0;
}
.notif-info { background: rgba(6,182,212,0.1); color: var(--info); }
.notif-success { background: rgba(16,185,129,0.1); color: var(--success); }
.notif-warning { background: rgba(245,158,11,0.1); color: var(--warning); }
.notif-danger { background: rgba(239,68,68,0.1); color: var(--danger); }
.notif-title { font-size: 0.82rem; font-weight: 600; margin: 0 0 2px; color: var(--text-primary); }
.notif-text { font-size: 0.78rem; color: var(--text-secondary); margin: 0 0 4px; }
.notif-time { font-size: 0.72rem; color: var(--text-muted); }
.notif-empty {
    padding: 32px;
    text-align: center;
    color: var(--text-muted);
}
.notif-empty i { font-size: 2rem; margin-bottom: 8px; display: block; }
.notif-empty p { margin: 0; font-size: 0.85rem; }
.notif-footer {
    padding: 10px 16px;
    text-align: center;
    border-top: 1px solid var(--border-color);
}
.notif-footer a { color: var(--primary); font-size: 0.82rem; font-weight: 500; }

/* User Dropdown */
.topbar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    border-radius: var(--radius-md);
    background: transparent;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
}
.topbar-user:hover { background: var(--bg-surface-2); }
.topbar-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    object-fit: cover;
}
.topbar-user-info { text-align: left; line-height: 1.2; }
.topbar-user-name { display: block; font-size: 0.8rem; font-weight: 600; color: var(--text-primary); }
.topbar-user-role { display: block; font-size: 0.7rem; color: var(--text-muted); }

.user-dropdown {
    min-width: 220px;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    background: var(--bg-surface);
    overflow: hidden;
}
.user-dropdown-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: linear-gradient(135deg, rgba(79,70,229,0.05), rgba(6,182,212,0.05));
}
.user-dropdown-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.user-dropdown-name { font-size: 0.85rem; font-weight: 600; margin: 0; color: var(--text-primary); }
.user-dropdown-email { font-size: 0.75rem; color: var(--text-muted); margin: 0; }
.user-dropdown .dropdown-item {
    padding: 9px 16px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: var(--transition);
}
.user-dropdown .dropdown-item:hover { background: var(--bg-surface-2); color: var(--text-primary); }

/* ================================================================
   MAIN CONTENT
   ================================================================ */
.main-content {
    flex: 1;
    padding: 24px;
}

/* Page Header */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
    flex-wrap: wrap;
}
.page-header-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 4px;
    letter-spacing: -0.5px;
}
.page-header-subtitle {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin: 0;
}
.page-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.badge-role {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* ================================================================
   STAT CARDS
   ================================================================ */
.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    cursor: default;
}
.stat-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
    border-color: transparent;
}
.stat-card-body {
    display: flex;
    align-items: center;
    gap: 16px;
}
.stat-card-icon {
    width: 52px; height: 52px;
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}
.stat-icon-blue   { background: rgba(79,70,229,0.1);  color: var(--primary); }
.stat-icon-purple { background: rgba(124,58,237,0.1); color: var(--secondary); }
.stat-icon-green  { background: rgba(16,185,129,0.1); color: var(--success); }
.stat-icon-cyan   { background: rgba(6,182,212,0.1);  color: var(--cyan); }
.stat-icon-orange { background: rgba(249,115,22,0.1); color: var(--orange); }

.stat-card-label {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-muted);
    margin: 0 0 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.stat-card-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0 0 4px;
    letter-spacing: -1px;
    line-height: 1;
}
.stat-card-trend {
    font-size: 0.75rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 4px;
}
.trend-up { color: var(--success); }
.trend-down { color: var(--danger); }
.trend-neutral { color: var(--text-muted); }

/* Gradient Cards */
.stat-card-gradient-blue {
    background: linear-gradient(135deg, #4f46e5, #6d28d9);
    border: none;
}
.stat-card-gradient-green {
    background: linear-gradient(135deg, #059669, #0d9488);
    border: none;
}
.stat-card-gradient-orange {
    background: linear-gradient(135deg, #d97706, #ea580c);
    border: none;
}
.stat-card-gradient-blue .stat-card-body,
.stat-card-gradient-green .stat-card-body,
.stat-card-gradient-orange .stat-card-body {
    align-items: center;
    justify-content: space-between;
}
.stat-card-icon-lg {
    font-size: 2.5rem;
    opacity: 0.2;
    flex-shrink: 0;
}
.text-white-60 { color: rgba(255,255,255,0.7) !important; }

/* ================================================================
   CARD WIDGET (Charts & Tables)
   ================================================================ */
.card-widget {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}
.card-widget:hover { box-shadow: var(--shadow-md); }
.card-widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}
.card-widget-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}
.card-widget-subtitle {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin: 2px 0 0;
}
.card-widget-actions { display: flex; align-items: center; gap: 8px; }
.card-widget-body { padding: 20px; flex: 1; }

/* ================================================================
   QUICK ACCESS
   ================================================================ */
.quick-access-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}
.quick-access-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px 8px;
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 500;
    text-align: center;
    transition: var(--transition);
    border: 1px solid var(--border-color);
    background: var(--bg-surface-2);
}
.quick-access-btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    color: var(--text-primary);
    border-color: transparent;
}
.qa-icon {
    width: 40px; height: 40px;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem;
}
.qa-blue   { background: rgba(79,70,229,0.1);  color: var(--primary); }
.qa-green  { background: rgba(16,185,129,0.1); color: var(--success); }
.qa-purple { background: rgba(124,58,237,0.1); color: var(--secondary); }
.qa-orange { background: rgba(249,115,22,0.1); color: var(--orange); }
.qa-cyan   { background: rgba(6,182,212,0.1);  color: var(--cyan); }
.qa-red    { background: rgba(239,68,68,0.1);  color: var(--danger); }
.qa-yellow { background: rgba(245,158,11,0.1); color: var(--warning); }
.qa-dark   { background: rgba(100,116,139,0.1); color: var(--text-secondary); }

/* ================================================================
   ACTIVITY LIST
   ================================================================ */
.activity-list { }
.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}
.activity-item:hover { background: var(--bg-surface-2); }
.activity-item:last-child { border-bottom: none; }
.activity-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}
.activity-text {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin: 0 0 4px;
    line-height: 1.4;
}
.activity-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ================================================================
   REMINDER ITEMS
   ================================================================ */
.reminder-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    font-size: 0.82rem;
    border-left: 3px solid;
}
.reminder-item i { font-size: 1.1rem; flex-shrink: 0; }
.reminder-item p { margin: 0 0 2px; font-weight: 500; }
.reminder-link { font-size: 0.78rem; text-decoration: none; }
.reminder-warning {
    background: rgba(245,158,11,0.08);
    border-color: var(--warning);
    color: var(--text-primary);
}
.reminder-warning i { color: var(--warning); }
.reminder-warning .reminder-link { color: var(--warning); }
.reminder-info {
    background: rgba(6,182,212,0.08);
    border-color: var(--info);
}
.reminder-info i { color: var(--info); }
.reminder-info .reminder-link { color: var(--info); }
.reminder-danger {
    background: rgba(239,68,68,0.08);
    border-color: var(--danger);
}
.reminder-danger i { color: var(--danger); }
.reminder-danger .reminder-link { color: var(--danger); }
.reminder-success {
    background: rgba(16,185,129,0.08);
    border-color: var(--success);
}
.reminder-success i { color: var(--success); }

/* ================================================================
   TABLES
   ================================================================ */
.table {
    color: var(--text-primary);
    font-size: 0.875rem;
    --bs-table-striped-bg: transparent;
}
.table thead th {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border-color);
    padding: 10px 14px;
    background: var(--bg-surface-2);
    white-space: nowrap;
}
.table tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}
.table tbody tr:hover { background: var(--bg-surface-2); }

/* DataTables */
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
    background: var(--bg-surface-2) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    border-radius: var(--radius-sm) !important;
    padding: 6px 10px !important;
}
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate { font-size: 0.82rem; }
.dataTables_wrapper .paginate_button {
    border-radius: var(--radius-sm) !important;
    font-size: 0.82rem !important;
}

/* ================================================================
   FORMS
   ================================================================ */
.form-control, .form-select {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    padding: 0.6rem 0.875rem;
    transition: var(--transition);
}
.form-control:focus, .form-select:focus {
    background: var(--bg-surface);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
    color: var(--text-primary);
}
.form-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 5px;
}
.form-text { font-size: 0.78rem; color: var(--text-muted); }
.invalid-feedback { font-size: 0.78rem; }

/* ================================================================
   BUTTONS
   ================================================================ */
.btn {
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border: none;
    box-shadow: 0 4px 12px rgba(79,70,229,0.25);
}
.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    box-shadow: 0 6px 16px rgba(79,70,229,0.35);
}

.btn-success {
    background: linear-gradient(135deg, #059669, var(--success));
    border: none;
}
.btn-danger {
    background: linear-gradient(135deg, #dc2626, var(--danger));
    border: none;
}

.btn-ghost {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}
.btn-ghost:hover { background: var(--bg-surface-2); color: var(--text-primary); }

/* ================================================================
   MODALS
   ================================================================ */
.modal-content {
    border: none;
    border-radius: var(--radius-xl);
    background: var(--bg-surface);
    box-shadow: var(--shadow-xl);
}
.modal-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-color);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    background: linear-gradient(135deg, rgba(79,70,229,0.04), rgba(6,182,212,0.04));
}
.modal-title { font-weight: 700; font-size: 1rem; color: var(--text-primary); }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border-color); }

/* ================================================================
   BADGES
   ================================================================ */
.badge { font-size: 0.72rem; font-weight: 600; border-radius: 6px; padding: 3px 8px; }

.bg-primary-subtle { background: rgba(79,70,229,0.1) !important; }
.text-primary { color: var(--primary) !important; }
.bg-success-subtle { background: rgba(16,185,129,0.1) !important; }
.text-success { color: var(--success) !important; }
.bg-danger-subtle { background: rgba(239,68,68,0.1) !important; }
.text-danger { color: var(--danger) !important; }
.bg-warning-subtle { background: rgba(245,158,11,0.1) !important; }
.text-warning { color: var(--warning) !important; }

/* ================================================================
   ALERTS (Flash)
   ================================================================ */
.alert-flash {
    border-radius: var(--radius-md);
    border: none;
    font-size: 0.875rem;
    margin-bottom: 16px;
}

/* ================================================================
   FOOTER
   ================================================================ */
.app-footer {
    background: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    padding: 14px 24px;
    font-size: 0.8rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* ================================================================
   LOADING OVERLAY
   ================================================================ */
.loading-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}
.loading-overlay.show { display: flex; }
.loading-spinner { text-align: center; }
.spinner-ring {
    width: 48px; height: 48px;
    border: 4px solid rgba(255,255,255,0.1);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ================================================================
   BREADCRUMB
   ================================================================ */
.breadcrumb {
    font-size: 0.8rem;
    margin: 0;
}
.breadcrumb-item + .breadcrumb-item::before {
    content: '›';
    color: var(--text-muted);
}
.breadcrumb-item a { color: var(--primary); text-decoration: none; }
.breadcrumb-item.active { color: var(--text-muted); }

/* ================================================================
   DATATABLES CARD WRAP
   ================================================================ */
.dt-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.dt-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 12px;
    background: var(--bg-surface-2);
}
.dt-card-title { font-weight: 700; font-size: 0.95rem; margin: 0; }
.dt-card-body { padding: 0; }

/* ================================================================
   SCROLLBAR STYLING
   ================================================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 991.98px) {
    .sidebar {
        position: fixed;
        transform: translateX(-100%);
    }
    .sidebar.sidebar-open {
        transform: translateX(0);
        box-shadow: var(--shadow-xl);
    }
    .main-wrapper {
        margin-left: 0 !important;
    }
    .main-content { padding: 16px; }
    .topbar { padding: 0 16px; }
    .quick-access-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 575.98px) {
    .stat-card-value { font-size: 1.4rem; }
    .quick-access-grid { grid-template-columns: repeat(4, 1fr); gap: 6px; }
    .quick-access-btn { padding: 10px 4px; font-size: 0.65rem; }
    .qa-icon { width: 32px; height: 32px; font-size: 0.85rem; }
    .page-header { flex-direction: column; }
}

/* ================================================================
   ANIMATIONS
   ================================================================ */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}
.stat-card { animation: fadeIn 0.3s ease forwards; }
.card-widget { animation: fadeIn 0.4s ease forwards; }

/* ================================================================
   PRINT STYLES
   ================================================================ */
@media print {
    .sidebar, .topbar, .app-footer, .btn, .loading-overlay { display: none !important; }
    .main-wrapper { margin-left: 0 !important; }
    body { background: white !important; color: black !important; }
    .card-widget, .stat-card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
        break-inside: avoid;
    }
}

/* ================================================================
   UTILITY OVERRIDES
   ================================================================ */
.text-muted { color: var(--text-muted) !important; }
.border { border-color: var(--border-color) !important; }
.bg-white, .bg-light { background: var(--bg-surface) !important; }
.card { background: var(--bg-surface); border-color: var(--border-color); border-radius: var(--radius-lg); }
.card-body { padding: 20px; }
.dropdown-menu {
    border-color: var(--border-color);
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
}
.dropdown-item { color: var(--text-secondary); font-size: 0.875rem; }
.dropdown-item:hover { background: var(--bg-surface-2); color: var(--text-primary); }

/* SweetAlert2 dark mode */
[data-bs-theme="dark"] .swal2-popup {
    background: #1e293b;
    color: #f1f5f9;
}
[data-bs-theme="dark"] .swal2-title { color: #f1f5f9; }
[data-bs-theme="dark"] .swal2-html-container { color: #94a3b8; }
