:root {
    --brand: rgb(100, 102, 233);
    --brand-dark: rgb(79, 81, 203);
    --brand-light: rgba(100, 102, 233, 0.1);
    --ink: #111827;
    --ink-light: #374151;
    --muted: #6B7280;
    --surface: #FFFFFF;
    --surface-alt: #F9FAFB;
    --border: #E5E7EB;
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    
    --sidebar-width: 260px;
    --topbar-height: 64px;
    --radius: 0.5rem;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--ink);
    background-color: var(--surface-alt);
    line-height: 1.5;
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background-color: var(--surface);
    border-right: 1px solid var(--border);
    position: fixed;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
}

.topbar {
    height: var(--topbar-height);
    background-color: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 10;
}

.content-area {
    padding: 2rem;
    flex: 1;
}

/* Sidebar Styling */
.sidebar-header {
    padding: 1.5rem;
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--brand);
    border-bottom: 1px solid var(--border);
}

.sidebar-nav {
    padding: 1rem 0;
    flex: 1;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    color: var(--ink-light);
    text-decoration: none;
    font-weight: 500;
    gap: 0.75rem;
}

.sidebar-nav a:hover, .sidebar-nav a.active {
    background-color: var(--brand-light);
    color: var(--brand);
}

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

/* UI Components */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--brand);
    color: white;
}

.btn-primary:hover {
    background-color: var(--brand-dark);
}

.btn-outline {
    border-color: var(--border);
    background: white;
    color: var(--ink-light);
}

.btn-outline:hover {
    background: var(--surface-alt);
}

.badge {
    display: inline-flex;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success { background: #DCFCE7; color: #166534; }
.badge-warning { background: #FEF3C7; color: #92400E; }
.badge-danger { background: #FEE2E2; color: #991B1B; }
.badge-info { background: #DBEAFE; color: #1E40AF; }

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 0.75rem;
    border-bottom: 2px solid var(--border);
    font-weight: 600;
    color: var(--muted);
}

td {
    padding: 1rem 0.75rem;
    border-bottom: 1px solid var(--border);
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
}

.stat-label {
    color: var(--muted);
    font-size: 0.875rem;
}

.progress-container {
    height: 6px;
    width: 100%;
    background: #eee;
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background-color: var(--brand);
}

/* Notifications */
.notification-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.35rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    color: white;
}

.badge-orange {
    background-color: var(--warning);
}

.badge-red {
    background-color: var(--danger);
}

.pulse-orange {
    animation: pulse-orange 2s infinite;
}

.pulse-red {
    animation: pulse-red 2s infinite;
}

@keyframes pulse-orange {
    0% {
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7);
    }
    70% {
        box-shadow: 0 0 0 8px rgba(245, 158, 11, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0);
    }
}

@keyframes pulse-red {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }
    70% {
        box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

/* Login Page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--surface-alt);
}

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 2rem;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}


/* Fallback: define CSS variables with correct :root to ensure colors/animations work */
:root {
    --brand: rgb(100, 102, 233);
    --brand-dark: rgb(79, 81, 203);
    --brand-light: rgba(100, 102, 233, 0.1);
    --ink: #111827;
    --ink-light: #374151;
    --muted: #6B7280;
    --surface: #FFFFFF;
    --surface-alt: #F9FAFB;
    --border: #E5E7EB;
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;

    --sidebar-width: 260px;
    --topbar-height: 64px;
    --radius: 0.5rem;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}


/* Explicit fallback colors to ensure alert badges are colored even if CSS variables fail */
.notification-badge.badge-orange { background-color: #F59E0B; }
.notification-badge.badge-red { background-color: #EF4444; }
