:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: #1e293b;
    /* darker slate */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent: #3b82f6;
    /* blue-500 */
    --accent-hover: #2563eb;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --border: #334155;
    --radius: 0.5rem;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -2px rgb(0 0 0 / 0.05);
    --shadow-glow: 0 0 15px -3px rgba(59, 130, 246, 0.4);
    --shadow-glow-success: 0 0 15px -3px rgba(16, 185, 129, 0.4);
}

.light-mode {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --success: #059669;
    --warning: #d97706;
    --danger: #dc2626;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05);

}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

.sidebar {
    width: 250px;
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    transition: transform 0.3s ease;
}

.main-content {
    flex: 1;
    margin-left: 250px;
    padding: 2rem;
    max-width: 1600px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        z-index: 50;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding: 1rem;
    }
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

h1 {
    font-size: 1.875rem;
}

h2 {
    font-size: 1.5rem;
}

h3 {
    font-size: 1.25rem;
}

p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

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

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

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

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

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

.btn-danger:hover {
    opacity: 0.9;
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--border);
    color: var(--text-primary);
}

.btn-outline:hover {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: var(--text-secondary);
}

.input,
.textarea {
    width: 100%;
    padding: 0.75rem;
    border-radius: var(--radius);
    background-color: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-family: inherit;
    transition: border-color 0.2s;
}

.light-mode .input,
.light-mode .textarea {
    background-color: #ffffff;
}

.input:focus,
.textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* Navigation */
.nav-brand {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 2rem;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    transition: all 0.2s;
    background: transparent;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
}

.nav-link:hover,
.nav-link.active {
    background-color: rgba(59, 130, 246, 0.1);
    color: var(--accent);
}

.nav-link i {
    width: 20px;
    text-align: center;
}

/* Tables */
.table-container {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

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

th {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background-color: rgba(255, 255, 255, 0.02);
}

.light-mode tr:hover td {
    background-color: rgba(0, 0, 0, 0.02);
}

/* Progress Bar */
.progress-bg {
    height: 8px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    overflow: hidden;
    position: relative;
}

.light-mode .progress-bg {
    background-color: rgba(0, 0, 0, 0.1);
}

.progress-fill {
    height: 100%;
    background-color: var(--accent);
    transition: width 0.3s ease;
    border-radius: 999px;
}

.progress-fill.completed {
    background-color: var(--success);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
}

.badge-warning {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
}

.badge-danger {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.badge-info {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

.light-mode .badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: #047857;
}

.light-mode .badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: #b45309;
}

.light-mode .badge-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #b91c1c;
}

.light-mode .badge-info {
    background: rgba(59, 130, 246, 0.1);
    color: #1d4ed8;
}

/* Login Page Specific */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: radial-gradient(circle at top right, #1e293b, #0f172a);
}

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 2.5rem;
}

.light-mode .login-page {
    background: radial-gradient(circle at top right, #f1f5f9, #e2e8f0);
}

.login-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}

/* Config Page */
.code-editor {
    font-family: 'Fira Code', 'Roboto Mono', monospace;
    font-size: 0.875rem;
    background-color: #0d1117;
    color: #e6edf3;
    min-height: 500px;
    line-height: 1.6;
}

.light-mode .code-editor {
    background-color: #ffffff;
    color: #24292f;
    border: 1px solid var(--border);
}

/* Utilities */
.text-center {
    text-align: center;
}

.mt-4 {
    margin-top: 1rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.flex {
    display: flex;
}

.justify-between {
    justify-content: space-between;
}

.items-center {
    align-items: center;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-4 {
    gap: 1rem;
}

.grid {
    display: grid;
}

.grid-cols-3 {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* SVG Icons helpers */
/* SVG Icons helpers */
.icon {
    width: 1.25rem;
    height: 1.25rem;
}

.hidden {
    display: none !important;
}

/* --- PATCH: Additional Utility Classes for Dashboard Layout --- */

/* Flexbox & Layout */
.flex-col {
    flex-direction: column;
}

.flex-row {
    flex-direction: row;
}

.flex-1 {
    flex: 1 1 0%;
}

.flex-none {
    flex: none;
}

.h-full {
    height: 100%;
}

.w-full {
    width: 100%;
}

.h-auto {
    height: auto;
}

.relative {
    position: relative;
}

.absolute {
    position: absolute;
}

.sticky {
    position: sticky;
}

.top-0 {
    top: 0;
}

.z-10 {
    z-index: 10;
}

.overflow-hidden {
    overflow: hidden;
}

.overflow-auto {
    overflow: auto;
}

/* Typography */
.text-xs {
    font-size: 0.75rem;
    line-height: 1rem;
}

.text-sm {
    font-size: 0.875rem;
    line-height: 1.25rem;
}

.text-xl {
    font-size: 1.25rem;
    line-height: 1.75rem;
}

.text-2xl {
    font-size: 1.5rem;
    line-height: 2rem;
}

.font-bold {
    font-weight: 700;
}

.font-medium {
    font-weight: 500;
}

.font-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.uppercase {
    text-transform: uppercase;
}

.tracking-wider {
    letter-spacing: 0.05em;
}

.text-right {
    text-align: right;
}

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Borders & Spacing */
.border-b {
    border-bottom: 1px solid var(--border);
}

.border-b-2 {
    border-bottom-width: 2px;
    border-bottom-style: solid;
}

.border-transparent {
    border-color: transparent;
}

.border-accent {
    border-color: var(--accent);
}

.rounded-full {
    border-radius: 9999px;
}

.px-2 {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

.px-3 {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}

.px-4 {
    padding-left: 1rem;
    padding-right: 1rem;
}

.px-6 {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

.py-0\.5 {
    padding-top: 0.125rem;
    padding-bottom: 0.125rem;
}

.py-1 {
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
}

.py-2 {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.py-3 {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}

.ml-2 {
    margin-left: 0.5rem;
}

.mb-1 {
    margin-bottom: 0.25rem;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-6 {
    margin-bottom: 1.5rem;
}

/* Colors & Backgrounds */
.text-accent {
    color: var(--accent);
}

.text-success {
    color: var(--success);
}

.text-secondary {
    color: var(--text-secondary);
}

.text-text {
    color: var(--text-primary);
}

.bg-accent {
    background-color: var(--accent);
}

.bg-secondary {
    background-color: var(--bg-secondary);
}

.bg-surface {
    background-color: var(--bg-card);
}

.hover\:shadow-xl:hover {
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

.transition-all {
    transition-property: all;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
}

.transition-colors {
    transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
}

.cursor-pointer {
    cursor: pointer;
}

.opacity-50 {
    opacity: 0.5;
}

/* --- Responsive Utilities (Tailwind-like) --- */
@media (min-width: 768px) {
    .md\:flex-row {
        flex-direction: row;
    }

    .md\:flex-col {
        flex-direction: column;
    }

    .md\:items-center {
        align-items: center;
    }

    .md\:items-start {
        align-items: flex-start;
    }

    .md\:justify-between {
        justify-content: space-between;
    }

    .md\:justify-start {
        justify-content: flex-start;
    }

    .md\:gap-4 {
        gap: 1rem;
    }

    .md\:mb-0 {
        margin-bottom: 0;
    }
}

/* --- Premium Components (Extracted from index.html) --- */

/* Glassmorphism */
.glass-container {
    background-color: rgba(30, 41, 59, 0.7);
    /* Fallback/Dark tint */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), inset 0 1px 1px 0 rgba(255, 255, 255, 0.05);
}

.light-mode .glass-container {
    background-color: rgba(255, 255, 255, 0.7);
    border-color: rgba(0, 0, 0, 0.05);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), inset 0 1px 1px 0 rgba(255, 255, 255, 0.5);
}

/* Tabs */
.tab-btn {
    position: relative;
    background: transparent;
    border: none;
    outline: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    overflow: hidden;
}

.tab-btn-bg,
.tab-btn-border {
    position: absolute;
    inset: 0;
    opacity: 0;
    border-radius: var(--radius);
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.tab-btn-bg {
    background-color: rgba(59, 130, 246, 0.1);
    /* Default accent tint */
}

.tab-btn-border {
    border: 1px solid rgba(59, 130, 246, 0.2);
    box-shadow: var(--shadow-glow);
}

.tab-btn.active .tab-btn-bg,
.tab-btn.active .tab-btn-border {
    opacity: 1;
}

/* Tab Colors Customization */
.tab-btn[data-theme="success"] .tab-btn-bg {
    background-color: rgba(16, 185, 129, 0.1);
}

.tab-btn[data-theme="success"] .tab-btn-border {
    border-color: rgba(16, 185, 129, 0.2);
    box-shadow: var(--shadow-glow-success);
}

.tab-btn[data-theme="neutral"] .tab-btn-bg {
    background-color: rgba(148, 163, 184, 0.1);
}

.tab-btn[data-theme="neutral"] .tab-btn-border {
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: none;
}

.light-mode .tab-btn[data-theme="neutral"] .tab-btn-border {
    border-color: rgba(0, 0, 0, 0.1);
}


/* Filters */
.filter-chip {
    position: relative;
    overflow: hidden;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.75rem;
    font-weight: 500;
}

.filter-chip .active-bg {
    position: absolute;
    inset: 0;
    background-color: var(--accent);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 0;
}

.filter-chip.active {
    color: white !important;
}

.filter-chip.active .active-bg {
    opacity: 1;
}

.filter-chip:not(.active):hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.light-mode .filter-chip:not(.active):hover {
    background-color: rgba(0, 0, 0, 0.05);
}

/* Soft Badges */
.badge-soft {
    font-size: 0.75rem;
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
    font-weight: 600;
}

.badge-accent-soft {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent);
}

.badge-success-soft {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.badge-warning-soft {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.badge-danger-soft {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.badge-secondary-soft {
    background: rgba(148, 163, 184, 0.2);
    color: var(--text-secondary);
}

/* Dashboard Specifics */
.stat-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    min-width: 160px;
    box-shadow: var(--shadow);
}

.stat-icon-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    font-size: 1.25rem;
}

.stat-icon-wrapper.accent {
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent);
}

.stat-icon-wrapper.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.stat-icon-wrapper.warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeIn 0.3s ease-out forwards;
}