:root {
    /* Premium Palette: Deep Indigo & Slate */
    --primary-color: #4f46e5;
    /* Indigo 600 */
    --primary-hover: #4338ca;
    /* Indigo 700 */
    --primary-light: #e0e7ff;
    /* Indigo 100 */

    --bg-color: #f8fafc;
    /* Slate 50 - Softer background */
    --card-bg: #ffffff;

    --text-color: #0f172a;
    /* Slate 900 - Sharp text */
    --text-muted: #64748b;
    /* Slate 500 */
    --border-color: #e2e8f0;
    /* Slate 200 */

    /* Sidebar - Light Default */
    --sidebar-bg: #ffffff;
    --sidebar-text: #64748b;
    --sidebar-text-hover: #0f172a;
    --sidebar-active-bg: #f1f5f9;
    --sidebar-active-border: #4f46e5;
    --sidebar-border: #e2e8f0;

    /* Status Colors - Refined */
    --danger-color: #ef4444;
    --danger-bg: #fee2e2;
    --success-color: #10b981;
    --success-bg: #d1fae5;
    --warning-color: #f59e0b;
    --warning-bg: #fef3c7;
    --info-color: #3b82f6;
    --info-bg: #dbeafe;

    /* Effects */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Dark Mode Overrides */
body.dark-mode {
    --bg-color: #0f172a;
    /* Slate 900 */
    --card-bg: #1e293b;
    /* Slate 800 */
    --text-color: #f1f5f9;
    /* Slate 100 */
    --text-muted: #94a3b8;
    /* Slate 400 */
    --border-color: #334155;
    /* Slate 700 */

    /* Sidebar - Dark Mode */
    --sidebar-bg: #0f172a;
    --sidebar-text: #94a3b8;
    --sidebar-text-hover: #ffffff;
    --sidebar-active-bg: #1e293b;
    --sidebar-active-border: #6366f1;
    --sidebar-border: #1e293b;

    /* Adjust sidebar for dark mode if needed (monochrome look) */
    --sidebar-bg: #020617;
    /* Slate 950 */
    --sidebar-active-bg: #1e293b;

    /* Input adjustments */
    --input-bg: #1e293b;
    --input-border: #475569;
    /* Slate 600 */
}

/* Input Specifics for Dark Mode */
body.dark-mode .form-control {
    background-color: var(--card-bg);
    /* Or darker */
    border-color: var(--border-color);
    color: var(--text-color);
}

body.dark-mode table {
    background-color: var(--card-bg);
    color: var(--text-color);
}

body.dark-mode th {
    background-color: #0f172a;
    /* Darker header */
    color: var(--text-muted);
    border-bottom-color: var(--border-color);
}

body.dark-mode td {
    color: var(--text-color);
    border-bottom-color: var(--border-color);
}

body.dark-mode tr:hover td {
    background-color: #334155;
    /* Lighter slate for hover */
}


/* Base Setup */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    /* Increased line height */
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    font-size: 0.9375rem;
    /* 15px base size */
    -webkit-font-smoothing: antialiased;
}

/* Sidebar */
.sidebar {
    width: 280px;
    /* Slightly wider */
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
    font-family: 'Inter', sans-serif;
    flex-shrink: 0;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.05);
    /* Soft shadow relative to content */
    border-right: 1px solid var(--sidebar-border);
    z-index: 10;
}

.sidebar a {
    color: var(--sidebar-text);
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.sidebar a:hover {
    color: var(--sidebar-text-hover);
    background: var(--sidebar-active-bg);
}

.sidebar a.active {
    color: #fff;
    background: var(--sidebar-active-bg);
    border-left-color: var(--sidebar-active-border);
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

.main-content {
    flex: 1;
    padding: 2rem 3rem;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 0.75rem;
    letter-spacing: -0.02em;
}

h1 {
    font-size: 1.875rem;
}

h2 {
    font-size: 1.5rem;
}

p {
    margin-bottom: 1rem;
    color: var(--text-muted);
}

a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

a:hover {
    color: var(--primary-hover);
}

/* Premium Cards */
.card {
    background: var(--card-bg);
    border-radius: 16px;
    /* Rounder corners */
    box-shadow: var(--shadow-sm);
    padding: 2rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow-md);
    /* transform: translateY(-1px); */
    /* Optional hover lift */
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #334155;
    font-size: 0.875rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 14px;
    transition: all 0.2s ease;
    background: #fff;
    color: var(--text-color);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    /* Inner input shadow (subtle) */
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
    /* Soft glow focus */
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 6px rgba(79, 70, 229, 0.2);
    /* Colored shadow */
}

.btn:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 12px rgba(79, 70, 229, 0.3);
}

.btn-secondary {
    background: #fff;
    color: #475569;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    background: #f8fafc;
    color: #0f172a;
    box-shadow: var(--shadow-md);
}

.btn-danger {
    background: var(--danger-color);
    box-shadow: 0 4px 6px rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background: #dc2626;
    box-shadow: 0 6px 12px rgba(239, 68, 68, 0.3);
}

/* Tables - Clean & Modern */
.table-container {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    background: #fff;
}

th {
    text-align: left;
    padding: 1rem 1.5rem;
    color: #64748b;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    background: #f8fafc;
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
    color: #334155;
    font-size: 0.95rem;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background-color: #f8fafc;
}

/* Badges - Soft/Pill Style */
.badge {
    display: inline-flex;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.025em;
}

.badge-success {
    background: var(--success-bg);
    color: var(--success-color);
}

.badge-warning {
    background: var(--warning-bg);
    color: var(--warning-color);
}

.badge-danger {
    background: var(--danger-bg);
    color: var(--danger-color);
}

.badge-info {
    background: var(--info-bg);
    color: var(--info-color);
}

.badge-gray {
    background: #f1f5f9;
    color: #64748b;
}

/* Utilities */
.text-right {
    text-align: right;
}

.text-center {
    text-align: center;
}

.flex {
    display: flex;
}

.justify-between {
    justify-content: space-between;
}

.items-center {
    align-items: center;
}

.gap-2 {
    gap: 0.75rem;
}

.mb-4 {
    margin-bottom: 1.5rem;
}

.mt-4 {
    margin-top: 1.5rem;
}

.text-muted {
    color: var(--text-muted);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        position: fixed;
        height: 100vh;
        z-index: 1000;
        transition: transform 0.3s ease;
        width: 260px;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        padding: 1.5rem;
        width: 100%;
    }

    .app-container {
        flex-direction: column;
    }

    /* Overlay for mobile sidebar */
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        display: none;
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .sidebar-overlay.active {
        display: block;
        opacity: 1;
    }

    /* Mobile Toggle Button */
    .mobile-toggle-btn {
        display: flex !important;
        justify-content: center;
        align-items: center;
        position: fixed;
        top: 15px;
        right: 15px;
        z-index: 1001;
        background: var(--primary-color);
        color: white;
        border: none;
        width: 40px;
        height: 40px;
        border-radius: 8px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        cursor: pointer;
        font-size: 1.25rem;
        transition: background 0.2s;
    }

    .mobile-toggle-btn:active {
        transform: scale(0.95);
    }

    /* Adjust tables for mobile */
    .table-container {
        overflow-x: auto;
    }

    /* Adjust cards */
    .card {
        padding: 1.5rem;
    }
}

.mobile-toggle-btn {
    display: none;
    /* Hidden on desktop */
}