:root {
    /* Brand Colors */
    --primary-color: #0078d4; /* Microsoft Blue */
    --primary-hover: #0063b1;
    --secondary-color: #005a9e;
    --aqua-blue: #00a4ef;
    --light-aqua: #e6f7ff;
    --glass-aqua-1: #0b1021;
    --glass-aqua-2: #0b3a67;
    --glass-aqua-3: #00a4ef;
    --glass-aqua-4: #7c3aed;
    
    /* Modern UI Colors */
    --bg-light: #f8f9fa;
    --bg-white: #ffffff;
    --text-color: #2c3e50;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    
    /* Gradients */
    --bg-gradient: linear-gradient(135deg, #0078d4 0%, #00a4ef 100%);
    --card-gradient: linear-gradient(145deg, #ffffff, #f8f9fa);
    
    /* Glassmorphism & Effects */
    --glass-bg: rgba(255, 255, 255, 0.95);
    --glass-border: rgba(255, 255, 255, 0.4);
    --backdrop-blur: blur(10px);
    
    /* Dimensions & Spacing */
    --border-radius: 16px;
    --border-radius-sm: 8px;
    --border-radius-lg: 24px;
    
    /* Shadows - Soft & Layered */
    --shadow-sm: 0 2px 4px rgba(148, 163, 184, 0.1);
    --shadow-md: 0 8px 16px -4px rgba(148, 163, 184, 0.1);
    --shadow-lg: 0 20px 25px -5px rgba(148, 163, 184, 0.1), 0 10px 10px -5px rgba(148, 163, 184, 0.04);
    --shadow-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06);
    
    /* Transitions */
    --transition-base: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-light);
    height: 100vh;
    overflow-x: hidden;
    color: var(--text-color);
    -webkit-font-smoothing: antialiased;
}

/* Dark Mode */
.dark-mode {
    --bg-light: #0f172a;
    --text-color: #e5e7eb;
    --text-muted: #9ca3af;
    --glass-bg: rgba(17, 24, 39, 0.8);
    --glass-border: rgba(255, 255, 255, 0.08);
}
.dark-mode body { background: var(--bg-light); color: var(--text-color); }
.dark-mode .navbar { background: #111827 !important; color: var(--text-color); }
.dark-mode .navbar .nav-link, .dark-mode .navbar-brand, .dark-mode .text-muted { color: var(--text-color) !important; }
.dark-mode .card { background: #111827; color: var(--text-color); border-color: #1f2937; }
.dark-mode .table thead th { background-color: #1f2937; color: #e5e7eb; border-bottom-color: #374151; }
.dark-mode .table td, .dark-mode .table th { border-top-color: #374151; color: #ffffff !important; }
.dark-mode .table { color: #ffffff; }
.dark-mode .text-dark { color: #ffffff !important; }
.dark-mode h1, .dark-mode h2, .dark-mode h3, .dark-mode h4, .dark-mode h5, .dark-mode h6,
.dark-mode p, .dark-mode label, .dark-mode span, .dark-mode .stat-label, .dark-mode .stat-sub { color: #e5e7eb; }
.dark-mode .table a, .dark-mode .table strong, .dark-mode .table b { color: #ffffff; }
.dark-mode .btn, 
.dark-mode .btn-sm, 
.dark-mode .btn-outline-secondary, 
.dark-mode .btn-warning, 
.dark-mode .btn-danger, 
.dark-mode .btn-outline-danger, 
.dark-mode .btn-primary { color: #ffffff !important; }
.dark-mode .btn-outline-secondary, .dark-mode .btn-outline-danger { border-color: #374151; }
.dark-mode button { color: #ffffff !important; border-color: #374151 !important; }
.dark-mode [style*="color: black"] { color: #ffffff !important; }
.dark-mode .form-control, .dark-mode .form-select { background: #111827; color: var(--text-color); border-color: #374151; }
.dark-mode .form-control:focus, .dark-mode .form-select:focus { box-shadow: 0 0 0 3px rgba(0, 164, 239, 0.15); }
.dark-mode .badge.bg-warning { color: #111827 !important; }

.dark-mode .sidebar { background: #0b1220; border-right: 1px solid #1f2937; }
.dark-mode .sidebar-header { color: #e5e7eb; }
.dark-mode .sidebar-menu a { color: #cbd5e1; border-color: transparent; }
.dark-mode .sidebar-menu a:hover { background-color: rgba(0, 120, 212, 0.08); color: var(--primary-color); }
.dark-mode .sidebar-menu a.active { background: linear-gradient(180deg, #0b3a67 0%, #1e3a8a 100%); color: #fff; }

.dark-mode .top-bar { background-color: rgba(10, 15, 26, 0.9); border-bottom: 1px solid #1f2937; }
.dark-mode .top-bar h3 { color: #e5e7eb; }

.dark-mode .hero-card { background: linear-gradient(180deg, #0d1324 0%, #0b1021 100%); border-color: #1f2937; box-shadow: 0 10px 30px rgba(2, 6, 23, 0.4); }
.dark-mode .hero-badge { background: #1e293b; color: #93c5fd; }
.dark-mode .hero-badge i { color: #93c5fd; }
.dark-mode .hero-title { color: #ffffff; }
.dark-mode .hero-sub { color: #e5e7eb; }

.dark-mode .card { background: rgba(17, 24, 39, 0.9); border-color: #1f2937; }
.dark-mode .action-tile { background: #111827; border-color: #1f2937; color: #e5e7eb; }
.dark-mode .action-tile:hover { border-color: var(--primary-color); color: var(--primary-color); }
.dark-mode .action-tile i { color: var(--primary-color); }
.dark-mode .card h1, 
.dark-mode .card h2, 
.dark-mode .card h3, 
.dark-mode .card h4, 
.dark-mode .card h5, 
.dark-mode .card h6 { color: #ffffff; }

.dark-mode .card.stat-card { 
    background:
      radial-gradient(900px circle at 15% 0%, rgba(59, 130, 246, 0.18), transparent),
      radial-gradient(900px circle at 85% 60%, rgba(244, 114, 182, 0.14), transparent),
      linear-gradient(180deg, #0f172a 0%, #0b1021 100%);
    border: 1px solid #1f2937;
}
.dark-mode .accent-primary { border-left-color: #3b82f6; }
.dark-mode .accent-success { border-left-color: #10b981; }
.dark-mode .accent-warning { border-left-color: #f59e0b; }
.dark-mode .accent-danger { border-left-color: #ef4444; }
.dark-mode .accent-primary .icon-pill { background: rgba(59, 130, 246, 0.15); color: #93c5fd; }
.dark-mode .accent-success .icon-pill { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.dark-mode .accent-warning .icon-pill { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.dark-mode .accent-danger .icon-pill { background: rgba(239, 68, 68, 0.15); color: #fca5a5; }

.dark-mode .table-responsive { border-color: #1f2937; }
.dark-mode .table { background: #0b1021; border-color: #1f2937; }
.dark-mode .table-striped tbody tr:nth-child(even) { background: #0f172a; }
.dark-mode .table-hover tbody tr:hover { background: #121826; }

img, video {
    max-width: 100%;
    height: auto;
    display: block;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* Global Responsive Adjustments */
* {
    box-sizing: border-box;
}

/* Auth Pages */
body.auth-page {
    background: var(--bg-gradient);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    overflow: hidden;
}

.login-container {
    background: #ffffff;
    border: none;
    border-radius: 10px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.2);
    text-align: center;
    position: relative;
    z-index: 2;
    animation: fadeIn 0.8s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.logo {
    width: 80px;
    margin-bottom: 20px;
}

h2 {
    color: var(--primary-color);
    margin-bottom: 10px;
    margin-top: 0;
}

p.subtitle {
    color: var(--text-muted);
    margin-bottom: 30px;
    font-size: 0.9em;
}

/* Standard Form Styles (Dashboard) */
.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #444;
    font-weight: 600;
    font-size: 0.95em;
}

.form-control {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    font-size: 15px;
    transition: all 0.3s ease;
    background: #fff;
    height: 45px; /* Fixed height for consistency */
}

.form-control:focus {
    border-color: var(--aqua-blue);
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 164, 239, 0.15);
}

textarea.form-control {
    height: auto;
    min-height: 100px;
}

/* Responsive Form Grid (Mobile-first)
   Base: single column on small screens for better readability.
   Tablet/Desktop: enhance with multiple columns using min-width media queries. */
.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr; /* Mobile-first: single column */
    gap: 20px;
}

.form-grid-1-2 {
    display: grid;
    grid-template-columns: 1fr; /* Mobile-first: single column */
    gap: 20px;
}

/* Tablet breakpoint: ≥768px */
@media (min-width: 768px) {
    .form-grid-2 { grid-template-columns: 1fr 1fr; }
    .form-grid-1-2 { grid-template-columns: 1fr 2fr; }
}

/* Desktop breakpoint: ≥1024px */
@media (min-width: 1024px) {
    .content-area { padding: 30px; }
}

/* Large screens: tweak spacing for wide layouts without breaking mobile-first base */
@media (min-width: 1280px) {
    .form-grid-2, .form-grid-1-2 { gap: 20px; }
    .content-area { padding: 30px; }
}

/* Floating Label Form Styles (Login Page) */
.form-group.floating-label {
    position: relative;
    margin-bottom: 25px;
}

.form-group.floating-label .input-icon {
    position: absolute;
    top: 50%;
    left: 15px;
    transform: translateY(-50%);
    color: #888;
    font-size: 18px;
    z-index: 1;
    transition: color 0.3s ease;
}

.form-group.floating-label .form-control:focus ~ .input-icon {
    color: var(--primary-color);
}

.form-group.floating-label .form-control {
    padding: 12px 12px 12px 45px; /* Increased left padding for icon */
    height: 50px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #f9f9f9;
    font-size: 16px;
    transition: all 0.3s ease;
    width: 100%; /* Ensure full width */
}

.form-group.floating-label .form-control:focus {
    background: #fff;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(0, 120, 212, 0.1);
}

.form-group.floating-label label {
    position: absolute;
    top: 50%;
    left: 45px; /* Align with text start */
    transform: translateY(-50%);
    background: transparent;
    padding: 0 4px;
    color: #888;
    font-size: 15px;
    font-weight: normal;
    transition: all 0.2s ease;
    pointer-events: none;
    margin: 0;
    line-height: 1; /* Fix vertical alignment */
}

.form-group.floating-label .form-control:focus ~ label,
.form-group.floating-label .form-control:not(:placeholder-shown) ~ label {
    top: 0;
    left: 15px; /* Move label to top left, slightly indented */
    font-size: 12px;
    color: var(--primary-color);
    background: #fff;
    padding: 0 6px;
    font-weight: 600;
    z-index: 2; /* Ensure label sits on top of border */
}


.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 14px 20px;
    width: 100%;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 120, 212, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 120, 212, 0.4);
}

.btn-auto {
    width: auto !important;
    display: inline-block;
    padding: 10px 20px;
}

/* Small screens: make action buttons fluid to reduce tap precision requirements */
@media (max-width: 768px) {
    .btn-auto { 
        width: 100% !important; 
        display: block; 
    }
}

/* Fixed Table Styles - Aligned Headers and Content */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--border-radius);
    border: 1px solid #e5e7eb;
    margin-bottom: 1rem;
}

.table-responsive table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
    table-layout: auto;
}
/* When tables are stacked for mobile, remove fixed min-width to avoid horizontal scroll */
.table-responsive table.stacked,
.table-responsive .table.stacked {
    min-width: 0;
    width: 100%;
    table-layout: fixed;
}

.table {
    width: 100%;
    max-width: 100%;
    margin-bottom: 1rem;
    background-color: transparent;
}

.table th,
.table td {
    padding: 0.75rem;
    vertical-align: top;
    border-top: 1px solid #dee2e6;
    text-align: left;
    word-break: break-word;
}

/* Ensure header and content alignment */
.table thead th {
    vertical-align: bottom;
    border-bottom: 2px solid #dee2e6;
    background-color: #f8f9fa;
    font-weight: 600;
    color: #374151;
    position: relative;
}

/* Column width consistency - adjust based on your needs */
.table th:nth-child(1),
.table td:nth-child(1) { min-width: 50px; }
.table th:nth-child(2),
.table td:nth-child(2) { min-width: 150px; }
.table th:nth-child(3),
.table td:nth-child(3) { min-width: 200px; }
.table th:nth-child(4),
.table td:nth-child(4) { min-width: 150px; }
.table th:nth-child(5),
.table td:nth-child(5) { min-width: 120px; }
.table th:nth-child(6),
.table td:nth-child(6) { min-width: 150px; }

/* Last column for actions - flexible width */
.table th:last-child,
.table td:last-child { 
    min-width: 100px;
    width: auto;
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(0, 0, 0, 0.02);
}

.table-hover tbody tr:hover {
    background-color: #f8f9fa;
}

/* Table cell alignment helpers */
.table.text-center th,
.table.text-center td {
    text-align: center;
}

.table.text-right th,
.table.text-right td {
    text-align: right;
}

.footer-text {
    margin-top: 30px;
    color: #888;
    font-size: 0.85em;
    line-height: 1.6;
    border-top: 1px solid #eee;
    padding-top: 20px;
}

/* Background Animation */
.bg-bubbles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    padding: 0;
    margin: 0;
}

.bg-bubbles li {
    position: absolute;
    list-style: none;
    display: block;
    width: 40px;
    height: 40px;
    background-color: rgba(255, 255, 255, 0.15);
    bottom: -150px;
    animation: square 25s infinite;
    transition-timing-function: linear;
}

.bg-bubbles li:nth-child(1) { left: 10%; }
.bg-bubbles li:nth-child(2) { left: 20%; width: 80px; height: 80px; animation-delay: 2s; }
.bg-bubbles li:nth-child(3) { left: 25%; animation-delay: 4s; }
.bg-bubbles li:nth-child(4) { left: 40%; width: 60px; height: 60px; animation-delay: 0s; animation-duration: 18s; }
.bg-bubbles li:nth-child(5) { left: 70%; }
.bg-bubbles li:nth-child(6) { left: 80%; width: 120px; height: 120px; animation-delay: 3s; background-color: rgba(255, 255, 255, 0.2); }
.bg-bubbles li:nth-child(7) { left: 32%; width: 160px; height: 160px; animation-delay: 7s; }
.bg-bubbles li:nth-child(8) { left: 55%; width: 20px; height: 20px; animation-delay: 15s; animation-duration: 40s; }
.bg-bubbles li:nth-child(9) { left: 25%; width: 10px; height: 10px; animation-delay: 2s; animation-duration: 40s; background-color: rgba(255, 255, 255, 0.3); }
.bg-bubbles li:nth-child(10) { left: 90%; width: 160px; height: 160px; animation-delay: 11s; }

@keyframes square {
    0% { transform: translateY(0); }
    100% { transform: translateY(-1000px) rotate(600deg); }
}

/* Dashboard Layout */
.dashboard-container {
    display: flex;
    min-height: 100vh;
    width: 100vw;
    background-color: var(--bg-light);
    overflow: visible;
    position: relative;
}

.sidebar {
    width: 280px;
    background-color: var(--bg-white);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 20;
    transition: var(--transition-smooth);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    flex-shrink: 0;
}

.sidebar-header {
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid var(--border-color);
    font-weight: 800;
    font-size: 1.4em;
    color: var(--primary-color);
    letter-spacing: -0.5px;
}

.sidebar-menu {
    flex: 1;
    padding: 20px 0;
    overflow-y: auto;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    margin: 4px 16px;
    color: var(--text-muted);
    text-decoration: none;
    transition: var(--transition-base);
    font-weight: 600;
    border-radius: 12px;
}

.sidebar-menu a i {
    width: 24px;
    margin-right: 12px;
    text-align: center;
    font-size: 1.1em;
    transition: var(--transition-base);
}

.sidebar-menu a:hover {
    background-color: rgba(0, 120, 212, 0.05);
    color: var(--primary-color);
    transform: translateX(5px);
}

.sidebar-menu a.active {
    background-color: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-md);
}

.sidebar-menu a.active i {
    color: white;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100vh;
    overflow-y: auto;
    position: relative;
    background: var(--bg-light);
}

.top-bar {
    height: 80px;
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    box-shadow: var(--shadow-sm);
    z-index: 10;
    position: sticky;
    top: 0;
}

.hero-card {
    background: linear-gradient(135deg, #ffffff 0%, #f7fbff 100%);
    border: 1px solid #e6eef6;
    border-radius: 24px;
    padding: 28px;
    box-shadow: 0 10px 30px rgba(16, 24, 40, 0.06);
}
.hero-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.02em;
    margin: 0 0 6px 0;
}
.hero-sub {
    color: #475569;
    font-size: 0.95rem;
}
.hero-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 16px;
}
.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 9999px;
    background: #eef6ff;
    color: #1e40af;
    font-weight: 700;
    font-size: 0.85rem;
}
.hero-badge i { color: #1e40af; }

.content-area {
    flex: 1;
    padding: 30px;
    overflow-y: visible;
    /* Prevent horizontal scroll in the main content area;
       table wrappers handle their own horizontal scrolling */
    overflow-x: hidden;
    width: 100%;
    max-width: none;
    margin: 0;
}

/* Modern Card Styles */
.card {
    background: var(--bg-white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    margin-bottom: 30px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    width: 100%;
    transition: var(--transition-base);
    position: relative;
    overflow: hidden;
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    opacity: 0;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: rgba(0, 120, 212, 0.1);
}

.cards-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 30px;
}
/* Removed single-row override to restore original grid */

.card.stat-card {
    width: auto;
    flex: 0 0 260px;
    max-width: 300px;
}

/* Mobile: single column cards and fluid actions */
@media (max-width: 768px) {
    .cards-grid { gap: 12px; }
    .action-tile { width: 100%; }
    .card { padding: 14px; }
    .top-bar h3 { font-size: 1rem; text-align: center; margin: 0 auto; }
    .dashboard-container { height: auto; min-height: 100vh; }
    .icon-pill { width: 36px; height: 36px; font-size: 0.95em; }
    .stat-card .stat-value { font-size: 1.6em; }
    .stat-card .stat-label { font-size: 0.85em; }
    .card.stat-card { flex: 1 1 100%; max-width: none; }
    /* Make buttons fluid on small screens, unless explicitly set otherwise */
    .btn, .btn-primary, .btn-warning, .btn-danger, .btn-outline-secondary, .btn-outline-danger {
        width: 100%;
        display: block;
    }
}

/* Tablet: two columns in card grid */
@media (min-width: 768px) and (max-width: 1023px) {
    .card.stat-card { flex: 1 1 calc(50% - 20px); max-width: 320px; }
}

/* Stat Cards */
.card.stat-card {
    border-top: none !important;
    background: var(--card-gradient);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border: 1px solid #eef2f7;
    box-shadow: 0 10px 30px rgba(16, 24, 40, 0.06);
    border-radius: 20px;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    position: relative;
    overflow: hidden;
    --accent-1: rgba(0, 120, 212, 0.12);
    --accent-2: rgba(124, 58, 237, 0.10);
    will-change: transform, box-shadow;
}
.card.stat-card::before {
    content: "";
    position: absolute;
    inset: -1px;
    background:
      linear-gradient(135deg, var(--accent-1) 0%, rgba(255,255,255,0) 30%, var(--accent-2) 60%, rgba(255,255,255,0) 100%);
    background-size: 200% 200%;
    pointer-events: none;
    z-index: 0;
}
.card.stat-card::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 40%;
    background: linear-gradient(180deg, rgba(255,255,255,0.6), rgba(255,255,255,0));
    z-index: 0;
}
.card.stat-card:hover::before {
    animation: gradientFloat 3s ease-in-out infinite;
}
.card.stat-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 40px rgba(16, 24, 40, 0.12);
}

@keyframes gradientFloat {
    0% { background-position: 0% 0%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 0%; }
}

/* Accent Gradients for Stat Cards */
.card.accent-primary { 
    background: linear-gradient(180deg, #ffffff 0%, #f5fbff 100%);
    border-left: 4px solid var(--primary-color);
    --accent-1: rgba(0, 120, 212, 0.12);
    --accent-2: rgba(30, 64, 175, 0.10);
}
.card.accent-success { 
    background: linear-gradient(180deg, #ffffff 0%, #f0fdf4 100%);
    border-left: 4px solid #10b981;
    --accent-1: rgba(16, 185, 129, 0.12);
    --accent-2: rgba(14, 159, 110, 0.10);
}
.card.accent-warning { 
    background: linear-gradient(180deg, #ffffff 0%, #fffbeb 100%);
    border-left: 4px solid #f59e0b;
    --accent-1: rgba(245, 158, 11, 0.12);
    --accent-2: rgba(236, 72, 153, 0.10);
}
.card.accent-danger { 
    background: linear-gradient(180deg, #ffffff 0%, #fef2f2 100%);
    border-left: 4px solid #ef4444;
    --accent-1: rgba(239, 68, 68, 0.12);
    --accent-2: rgba(99, 102, 241, 0.10);
}
.card.accent-primary:hover { box-shadow: 0 16px 40px rgba(0, 120, 212, 0.18); }
.card.accent-success:hover { box-shadow: 0 16px 40px rgba(16, 185, 129, 0.18); }
.card.accent-warning:hover { box-shadow: 0 16px 40px rgba(245, 158, 11, 0.18); }
.card.accent-danger:hover { box-shadow: 0 16px 40px rgba(239, 68, 68, 0.18); }

.stat-card .stat-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
    position: relative;
    z-index: 1;
}

.stat-card .stat-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.9em;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.icon-pill {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1em;
    transition: var(--transition-base);
    box-shadow: var(--shadow-sm);
    position: relative;
    z-index: 1;
}
.card.stat-card:hover .icon-pill { transform: scale(1.12) rotate(8deg); box-shadow: 0 8px 24px rgba(0,0,0,0.08); }

.accent-primary .icon-pill { background: rgba(0, 120, 212, 0.1); color: var(--primary-color); }
.accent-success .icon-pill { background: rgba(16, 185, 129, 0.1); color: #10b981; }
.accent-warning .icon-pill { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }
.accent-danger .icon-pill { background: rgba(239, 68, 68, 0.1); color: #ef4444; }

.stat-card:hover .icon-pill {
    transform: scale(1.05) rotate(3deg);
}

.stat-card .stat-value {
    font-size: 2.2em;
    font-weight: 800;
    color: var(--text-color);
    line-height: 1.2;
    margin-bottom: 2px;
    background: linear-gradient(45deg, var(--text-color), #4b5563);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    position: relative;
    z-index: 1;
}
.card.stat-card:hover .stat-value { animation: textFlow 2.5s ease-in-out infinite; }
@keyframes textFlow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.stat-card .stat-sub {
    font-size: 0.8em;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 5px;
    position: relative;
    z-index: 1;
}

/* Animations */
@keyframes slideUp {
    from { 
        opacity: 0; 
        transform: translateY(30px) scale(0.98); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0) scale(1); 
    }
}

/* Stagger Animations */
.cards-grid .card:nth-child(1) { animation-delay: 0.1s; }
.cards-grid .card:nth-child(2) { animation-delay: 0.2s; }
.cards-grid .card:nth-child(3) { animation-delay: 0.3s; }
.cards-grid .card:nth-child(4) { animation-delay: 0.4s; }

/* Quick Actions Tile Update */
.action-tile {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 20px;
    min-width: 120px;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    background: var(--bg-white);
    color: var(--text-color);
    font-weight: 600;
    text-decoration: none;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-base);
}

.action-tile i {
    font-size: 1.8em;
    color: var(--primary-color);
    transition: var(--transition-base);
}

.action-tile:hover {
    border-color: var(--primary-color);
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.action-tile:hover i {
    transform: scale(1.2);
}

.quick-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.action-tile {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
    color: #111827;
    font-weight: 600;
    text-decoration: none;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}
.action-tile i {
    color: var(--primary-color);
}
.action-tile:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-1px);
}

.right-tools {
    display: flex;
    align-items: center;
    gap: 10px;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.2px;
}
.bg-success { background-color: #def7ec; color: #03543f; }
.bg-danger { background-color: #fde8e8; color: #9b2c2c; }
.bg-warning { background-color: #fff3c4; color: #854d0e; }
.text-dark { color: #1f2937; }

.table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.table th {
    background: #f9fafb;
    text-align: left;
    padding: 12px 14px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.3px;
    color: #6b7280;
    border-bottom: 1px solid #e5e7eb;
}
.table td {
    padding: 12px 14px;
    border-bottom: 1px solid #f3f4f6;
    font-size: 14px;
    color: #111827;
    vertical-align: middle;
}
.table-striped tbody tr:nth-child(even) { background: #fcfcfd; }
.table-hover tbody tr:hover { background: #f5f7fa; }
.table-sm th, .table-sm td { padding: 8px 10px; }
.align-middle { vertical-align: middle; }
.text-nowrap { white-space: nowrap; }

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 12px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #fff;
    color: #374151;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}
.btn:hover { background: #f9fafb; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12px; }
.btn-danger { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.btn-danger:hover { background: #fecaca; }
.btn-warning { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.btn-warning:hover { background: #fde68a; }
.btn-outline-secondary { background: transparent; color: #4b5563; }
.btn-outline-secondary:hover { background: #f3f4f6; }
.btn-outline-danger { background: transparent; color: #b91c1c; border-color: #fecaca; }
.btn-outline-danger:hover { background: #fee2e2; }
.btn-primary { background: var(--primary-color); color: #fff; border-color: var(--primary-color); }
.btn-primary:hover { background: var(--secondary-color); }

.form-select {
    width: 100%;
    height: 34px;
    padding: 6px 10px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #fff;
    font-size: 13px;
    color: #111827;
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, #9ca3af 50%), linear-gradient(135deg, #9ca3af 50%, transparent 50%);
    background-position: calc(100% - 18px) calc(50% - 3px), calc(100% - 12px) calc(50% - 3px);
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
}

.mobile-menu-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 32px;
    padding: 0 10px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #fff;
    color: #374151;
    font-size: 12px;
    font-weight: 600;
}

.monitor-cards .card { border-top: 3px solid var(--primary-color); }
.monitor-cards .card .text-muted { color: #6b7280; }

.d-none { display: none !important; }
.d-block { display: block !important; }
.d-sm-none { display: block !important; }
.d-sm-block { display: none !important; }
@media (min-width: 576px) {
    .d-sm-none { display: none !important; }
    .d-sm-block { display: block !important; }
}

/* Exam Interface Styles (New Modern UI) */
.exam-layout {
    display: flex;
    height: 100vh;
    background-color: #f0f2f5;
    font-family: 'Segoe UI', sans-serif;
}

.exam-sidebar {
    width: 320px;
    background: #fff;
    border-right: 1px solid #ddd;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
    flex-shrink: 0;
}

.candidate-profile {
    padding: 30px 20px;
    text-align: center;
    border-bottom: 1px solid #f0f0f0;
}

.candidate-profile i {
    color: var(--primary-color);
    font-size: 3em;
    margin-bottom: 10px;
}

.candidate-profile h3 {
    margin: 10px 0 5px;
    font-size: 1.1em;
    color: var(--primary-color);
}

.matric-badge {
    background: #eee;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    color: #666;
    display: inline-block;
}

.question-grid-container {
    padding: 20px;
    flex: 1;
}

.question-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
}

.grid-btn {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.9em;
    cursor: pointer;
    transition: all 0.2s;
    background: #fff;
    color: #555;
    font-weight: 600;
}

.grid-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.grid-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 4px 10px rgba(0, 120, 212, 0.3);
}

.grid-btn.answered {
    background: #e6f4ea;
    border-color: #28a745;
    color: #28a745;
}
.grid-btn.answered.active {
    background: #28a745;
    color: white;
}

.calculator-section {
    padding: 20px;
    border-top: 1px solid #eee;
    background: #fcfcfc;
}

.exam-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.exam-header {
    background: #fff;
    padding: 15px 30px;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.timer-badge {
    background: #ffebeb;
    color: #d93025;
    padding: 8px 20px;
    border-radius: 8px;
    font-weight: bold;
    font-size: 1.2em;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid #fad2cf;
}

.question-container {
    flex: 1;
    padding: 40px;
    overflow-y: auto;
    width: 100%;
    max-width: none;
    margin: 0;
}

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.marks-badge {
    background: var(--light-aqua);
    color: var(--primary-color);
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 600;
}

.question-text {
    font-size: 1.25em;
    line-height: 1.6;
    margin-bottom: 30px;
    color: #222;
}

.option-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 15px 20px;
    margin-bottom: 15px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 15px;
}

.option-card:hover {
    background: #f8f9fa;
    border-color: #ccc;
}

.option-card.selected {
    border-color: var(--primary-color);
    background: var(--light-aqua);
    box-shadow: 0 0 0 1px var(--primary-color);
}

.option-letter {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: #6c757d;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    flex-shrink: 0;
}

.option-card.selected .option-letter {
    background: var(--primary-color);
}

.nav-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.btn-nav {
    padding: 10px 25px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid #ddd;
    background: #fff;
    transition: all 0.2s;
}

.btn-nav:hover {
    background: #f0f0f0;
}

.btn-nav.primary {
    background: var(--primary-color);
    color: white;
    border: none;
}

.btn-nav.primary:hover {
    background: var(--secondary-color);
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    color: var(--primary-color);
    margin-right: 15px;
}

/* Calculator Styles */
.calc-display {
    width: 100%;
    margin-bottom: 10px;
    padding: 10px;
    font-size: 1.2em;
    text-align: right;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
}
.calc-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}
.calc-btn {
    padding: 10px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    color: #555;
}
.calc-btn:hover { background: #f0f0f0; }
.calc-btn.op { background: #f8f9fa; color: var(--primary-color); }
.calc-btn.eq { background: #28a745; color: white; border-color: #28a745; grid-column: span 4; }
.calc-btn.clear { background: #dc3545; color: white; border-color: #dc3545; }

/* Responsive Media Queries */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -280px;
        height: 100%;
        box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    }
    .sidebar.open {
        transform: translateX(280px);
        left: 0;
    }
    .top-bar {
        padding: 0 15px;
    }
    .mobile-menu-btn {
        display: block !important;
    }
    .exam-layout {
        flex-direction: column;
    }
    .exam-sidebar {
        width: 100%;
        height: auto;
        max-height: 200px;
        border-right: none;
        border-bottom: 1px solid #ddd;
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
    }
    .candidate-profile {
        width: 200px;
        flex-shrink: 0;
        border-bottom: none;
        border-right: 1px solid #eee;
    }
    .question-grid {
        display: flex;
        gap: 10px;
        padding-bottom: 10px;
    }
    .grid-btn {
        width: 40px;
        height: 40px;
        flex-shrink: 0;
    }
    .calculator-section {
        display: block; /* Show calc on mobile, stacking it */
        margin-top: 20px;
    }
    .exam-main {
        height: auto;
        flex: 1;
    }
    .content-area {
        padding: 15px;
    }
    .card {
        padding: 15px;
    }
    
    /* Mobile table adjustments */
    .table-responsive {
        border: 1px solid #ddd;
        border-radius: 6px;
    }
    
    .table-responsive table {
        min-width: 600px;
    }
    
    .table th,
    .table td {
        padding: 0.5rem;
        font-size: 0.9em;
    }
    
    /* Adjust column widths for mobile */
    .table th:nth-child(1),
    .table td:nth-child(1) { min-width: 40px; }
    .table th:nth-child(2),
    .table td:nth-child(2) { min-width: 100px; }
    .table th:nth-child(3),
    .table td:nth-child(3) { min-width: 150px; }
    .table th:nth-child(4),
    .table td:nth-child(4) { min-width: 100px; }
    .table th:nth-child(5),
    .table td:nth-child(5) { min-width: 80px; }
    .table th:nth-child(6),
    .table td:nth-child(6) { min-width: 100px; }
    
    .login-container {
        width: 90%;
        padding: 30px 20px;
    }
    .mobile-only {
        display: inline !important;
    }
    .desktop-only {
        display: none !important;
    }
}

/* Responsive Sidebar and Menu for Narrow Desktop */
@media (max-width: 1280px) {
    .sidebar {
        position: fixed;
        left: -280px;
        height: 100%;
        box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    }
    .sidebar.open {
        transform: translateX(280px);
        left: 0;
        z-index: 100;
    }
    .mobile-menu-btn {
        display: block !important;
    }
    .top-bar {
        padding: 0 15px;
    }
    .top-bar h3 { margin: 0 auto; text-align: center; }
    .content-area {
        padding: 20px;
    }
    .card {
        padding: 18px;
    }
    .table-responsive table {
        min-width: 600px;
    }
}

/* Global Responsive Tables (works for any table, with or without .table class) */
table.stacked thead, .table.stacked thead { display: none; }
table.stacked tbody tr, .table.stacked tbody tr { display: block; border: 1px solid #eee; border-radius: 8px; margin-bottom: 12px; padding: 6px; }
table.stacked tbody td, .table.stacked tbody td { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; }
table.stacked tbody td::before, .table.stacked tbody td::before { content: attr(data-label); color: #666; font-weight: 600; margin-right: 12px; }
table.stacked .btn, .table.stacked .btn { width: 100%; }

/* Responsive Breakpoints (Mobile-first)
   - Base: mobile (≤767px)
   - Tablet: ≥768px
   - Desktop: ≥1024px
   These media queries progressively enhance layout while keeping small screens usable. */

/* Exam Layout Responsiveness */
@media (max-width: 992px) {
    .question-grid { grid-template-columns: repeat(4, 1fr); }
    .question-container { max-width: 900px; padding: 30px; }
}
@media (max-width: 768px) {
    .exam-layout { flex-direction: column; }
    .exam-sidebar { width: 100%; order: 2; }
    .exam-main { order: 1; }
    .question-grid { grid-template-columns: repeat(3, 1fr); }
    .question-container { max-width: 100%; padding: 20px; }
    .nav-buttons { flex-direction: column; gap: 10px; }
    .timer-badge { font-size: 1em; padding: 6px 12px; }
}
