:root {
    --bg-main: #f8fafc; /* Very light gray background */
    --bg-card: #ffffff;
    --bg-sidebar: #ffffff;
    
    --text-main: #1e293b;
    --text-muted: #64748b;
    
    --primary: #2563eb; /* Royal blue */
    --primary-hover: #1d4ed8;
    --secondary: #3b82f6; 
    
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;

    --border: #e2e8f0;
    --card-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

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

body {
    font-family: 'K2D', sans-serif !important;
    background-color: var(--bg-main) !important;
    color: var(--text-main) !important;
    min-height: 100vh;
    overflow-x: hidden;
}

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

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
}

/* Sidebar Brand (Blue Header) */
.sidebar-brand {
    background: var(--primary) !important;
    padding: 20px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    color: white !important;
    height: 80px;
}

.brand-icon {
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
    margin-right: 15px;
}

.sidebar-brand-text {
    display: flex;
    flex-direction: column;
}

.sidebar-brand h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
    color: white !important;
}

.sidebar-brand p {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.8) !important;
    margin: 0;
}

.sidebar-nav {
    list-style: none;
    padding: 20px 0;
    overflow-y: auto;
    flex: 1;
}

.nav-title {
    padding: 10px 24px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-top: 10px;
}

.nav-item {
    margin-bottom: 5px;
}

.nav-item a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    margin: 0 12px;
    color: var(--text-muted) !important;
    text-decoration: none;
    transition: all 0.2s ease;
    border-radius: 8px;
    font-weight: 500;
    border: none !important;
}

.nav-item a i {
    width: 24px;
    font-size: 1.1rem;
    margin-right: 10px;
    text-align: center;
}

.nav-item a:hover {
    color: var(--primary) !important;
    background: #f1f5f9 !important;
}

.nav-item.active a {
    color: white !important;
    background: var(--primary) !important;
    box-shadow: 0 4px 6px rgba(37, 99, 235, 0.2);
}

.nav-item.active a i {
    color: white !important;
}

/* Logout Button */
.logout-container {
    padding: 15px 24px;
    border-top: 1px solid var(--border);
}

.logout-container a {
    display: flex;
    align-items: center;
    color: var(--danger) !important;
    text-decoration: none;
    font-weight: 500;
    padding: 10px 0;
}

.logout-container a i {
    margin-right: 10px;
    font-size: 1.2rem;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-main) !important;
}

/* Top Header */
.top-header {
    height: 80px;
    padding: 0 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #ffffff !important;
    border-bottom: 1px solid var(--border) !important;
    z-index: 10;
}

.header-left {
    display: flex;
    flex-direction: column;
}

.header-left h1 {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-main) !important;
}

.header-left p {
    font-size: 0.85rem;
    color: var(--text-muted) !important;
    margin: 0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.status-online {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--success) !important;
    font-size: 0.9rem;
    font-weight: 500;
}

.status-dot {
    width: 8px;
    height: 8px;
    background-color: var(--success) !important;
    border-radius: 50%;
}

.refresh-btn {
    color: var(--text-muted) !important;
    cursor: pointer;
    font-size: 1.1rem;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info {
    display: flex;
    flex-direction: column;
    text-align: right;
}

.user-info strong {
    font-size: 0.95rem;
    color: var(--text-main) !important;
}

.user-info span {
    font-size: 0.8rem;
    color: var(--text-muted) !important;
}

.user-avatar {
    width: 42px;
    height: 42px;
    background: var(--primary) !important;
    color: white !important;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

/* Content Wrapper */
.content-wrapper {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    background: var(--bg-main) !important;
}

/* Glass Card -> Flat Card */
.glass-card, .stat-card {
    background: var(--bg-card) !important;
    border: 1px solid var(--border) !important;
    border-radius: 8px !important;
    box-shadow: var(--card-shadow) !important;
    transition: box-shadow 0.3s ease;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    color: var(--text-main) !important;
}

/* Dashboard Elements */
.dashboard-header {
    display: flex;
    justify-content: flex-end; /* Push buttons to the right */
    align-items: center;
    margin-bottom: 20px;
}

.dashboard-header > div:not(.header-actions) {
    display: none !important; /* Hide duplicate titles in content area, now in top-header */
}

/* Buttons */
.btn {
    font-family: 'K2D', sans-serif;
    font-weight: 500;
    border-radius: 8px;
    padding: 8px 16px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    border: none;
}

.btn-primary {
    background: var(--primary) !important;
    color: white !important;
    box-shadow: none !important;
}

.btn-primary:hover {
    background: var(--primary-hover) !important;
    color: white !important;
}

.btn-secondary {
    background: #f1f5f9 !important;
    color: var(--text-main) !important;
    border: 1px solid var(--border) !important;
}

/* Forms override */
.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted) !important;
    margin-bottom: 5px;
    display: block;
}

.form-control {
    background: #fff !important;
    border: 1px solid var(--border) !important;
    border-radius: 8px !important;
    padding: 10px 15px;
    color: var(--text-main) !important;
}

.form-control:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.15) !important;
}

/* Tables */
.table {
    width: 100%;
    margin-bottom: 0;
    color: var(--text-main) !important;
}

.table thead th, .modern-table th {
    background: #f8fafc !important;
    color: var(--text-muted) !important;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 12px 15px !important;
    border-bottom: 1px solid var(--border) !important;
    border-top: none !important;
}

.table tbody td, .modern-table td {
    padding: 15px !important;
    vertical-align: middle;
    border-bottom: 1px solid var(--border) !important;
    font-size: 0.95rem;
    color: var(--text-main) !important;
}

.table tbody tr:hover, .modern-table tbody tr:hover {
    background-color: #f8fafc !important;
}

/* Badges / Statuses */
.status-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    display: inline-block;
}

.status-danger {
    background: rgba(239, 68, 68, 0.1) !important;
    color: var(--danger) !important;
}

.status-success {
    background: rgba(16, 185, 129, 0.1) !important;
    color: var(--success) !important;
}

/* Stats Card Specific */
.stat-card {
    border-left: 4px solid var(--primary) !important;
}
.stat-details h3 {
    color: var(--text-main) !important;
}

/* Override old inline styles dynamically */
[style*="background: rgba(15, 23, 42"] { background: #ffffff !important; }
[style*="background: rgba(16, 185, 129"] { background: rgba(16, 185, 129, 0.05) !important; }
[style*="background: rgba(239, 68, 68"] { background: rgba(239, 68, 68, 0.05) !important; }
[style*="background: rgba(245, 158, 11"] { background: rgba(245, 158, 11, 0.05) !important; }
[style*="border: 1px solid var(--border)"] { border: 1px solid #e2e8f0 !important; }
[style*="color: var(--text-muted)"] { color: #64748b !important; }
[style*="color: var(--text-main)"] { color: #1e293b !important; }
[style*="color: var(--primary-light)"] { color: #2563eb !important; }
