:root {
    /* Corporate Color Palette: Dark Blue, Warm Orange, White, Black */
    --primary: #1e3a5f;
    /* Dark Blue */
    --primary-hover: #15294a;
    /* Darker Blue */
    --accent: #e67e22;
    /* Warm Orange */
    --accent-hover: #d35400;
    /* Darker Orange */
    --bg-gradient: linear-gradient(135deg, #0a1628 0%, #1a2a40 100%);
    --glass-bg: rgba(26, 42, 64, 0.8);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --card-bg: rgba(30, 58, 95, 0.4);
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;

    --sidebar-width: 260px;
    --header-height: 70px;
}

/* ============================================
   LIGHT THEME OVERRIDES
   ============================================ */
[data-theme="light"] {
    --bg-gradient: linear-gradient(135deg, #f0f4f8 0%, #e2e8f0 100%);
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(0, 0, 0, 0.08);
    --text-main: #1e293b;
    --text-muted: #64748b;
    --card-bg: rgba(255, 255, 255, 0.7);
    --primary: #1e3a5f;
    --primary-hover: #15294a;
}

/* Body */
[data-theme="light"] body {
    color: var(--text-main);
}

[data-theme="light"] body::before {
    background: radial-gradient(circle, rgba(79, 70, 229, 0.06) 0%, rgba(0, 0, 0, 0) 70%);
}

/* Top Header */
[data-theme="light"] .top-header {
    background: rgba(255, 255, 255, 0.9) !important;
    border-bottom-color: rgba(0, 0, 0, 0.06);
}

/* Nav Links */
[data-theme="light"] .nav-link:hover {
    color: var(--text-main);
    background: rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .nav-item.active .nav-link {
    background: rgba(230, 126, 34, 0.08);
}

/* User Name */
[data-theme="light"] .user-name {
    color: var(--text-main);
}

/* Stat Cards */
[data-theme="light"] .stat-card {
    background: rgba(255, 255, 255, 0.8);
    border-color: rgba(0, 0, 0, 0.06);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .stat-card:hover {
    border-color: rgba(79, 70, 229, 0.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .stat-info h3 {
    color: var(--text-main);
}

[data-theme="light"] .stat-icon {
    background: rgba(0, 0, 0, 0.04);
}

/* Glass Card */
[data-theme="light"] .glass-card {
    background: rgba(255, 255, 255, 0.85);
    border-color: rgba(0, 0, 0, 0.06);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

/* Content Wrapper scrollbar */
[data-theme="light"] .content-wrapper {
    scrollbar-color: rgba(0, 0, 0, 0.15) transparent;
}

/* Form Controls */
[data-theme="light"] .form-control {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.12);
    color: var(--text-main);
}

[data-theme="light"] .form-control:focus {
    background: rgba(0, 0, 0, 0.02);
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(30, 58, 95, 0.08);
}

[data-theme="light"] .form-control:focus~.form-label,
[data-theme="light"] .form-control:not(:placeholder-shown)~.form-label,
[data-theme="light"] .form-control:-webkit-autofill~.form-label,
[data-theme="light"] .form-group.static-label .form-label {
    background: #f5f7fa;
    color: var(--accent);
}

[data-theme="light"] .form-label span {
    background: #f5f7fa;
}

[data-theme="light"] .form-select {
    background-color: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.12);
    color: var(--text-main);
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231e293b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
}

[data-theme="light"] .form-select:focus {
    background-color: rgba(0, 0, 0, 0.02);
    border-color: var(--primary);
}

[data-theme="light"] .form-select option {
    background-color: #fff;
    color: var(--text-main);
}

/* Buttons */
[data-theme="light"] .btn-secondary {
    background: rgba(0, 0, 0, 0.06);
    color: var(--text-main);
}

[data-theme="light"] .btn-secondary:hover {
    background: rgba(0, 0, 0, 0.1);
    color: var(--text-main);
}

/* Data Tables */
[data-theme="light"] .data-table th {
    border-bottom-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .data-table td {
    border-bottom-color: rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .data-table tbody tr:hover {
    background: rgba(0, 0, 0, 0.03);
}

[data-theme="light"] .action-btn:hover {
    background: rgba(0, 0, 0, 0.06);
}

/* Breadcrumbs */
[data-theme="light"] .breadcrumbs .current {
    color: var(--text-main);
}

/* Avatar */
[data-theme="light"] .avatar {
    border-color: rgba(0, 0, 0, 0.15);
}

/* Flash Messages */
[data-theme="light"] .flash-message {
    background: rgba(255, 255, 255, 0.95) !important;
    color: var(--text-main) !important;
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Loader */
[data-theme="light"] #globalLoader {
    background: rgba(255, 255, 255, 0.9) !important;
}

[data-theme="light"] .loader-spinner {
    border-color: rgba(0, 0, 0, 0.1);
    border-left-color: var(--accent);
}

[data-theme="light"] .loader-text {
    color: var(--text-main) !important;
}

/* -- Theme Toggle Button -- */
.theme-toggle {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
    width: 36px;
    height: 36px;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-main);
    transform: rotate(15deg);
}

[data-theme="light"] .theme-toggle {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .theme-toggle:hover {
    background: rgba(0, 0, 0, 0.1);
}

/* Inline style overrides for light mode — many templates use hardcoded rgba values */
[data-theme="light"] [style*="color: var(--text-muted)"],
[data-theme="light"] [style*="color:var(--text-muted)"] {
    color: var(--text-muted) !important;
}

[data-theme="light"] [style*="rgba(255,255,255,0.05)"],
[data-theme="light"] [style*="rgba(255, 255, 255, 0.05)"] {
    background: rgba(0, 0, 0, 0.03) !important;
}

[data-theme="light"] [style*="border-bottom: 1px solid rgba(255,255,255,0.05)"],
[data-theme="light"] [style*="border-bottom: 1px solid rgba(255, 255, 255, 0.05)"] {
    border-bottom-color: rgba(0, 0, 0, 0.06) !important;
}

[data-theme="light"] [style*="border-bottom: 1px solid rgba(255,255,255,0.02)"],
[data-theme="light"] [style*="border-bottom: 1px solid rgba(255, 255, 255, 0.02)"] {
    border-bottom-color: rgba(0, 0, 0, 0.04) !important;
}

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

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

/* Base Layout for Login (Center) */
body:not(.dashboard-body) {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Background Animation */
body::before {
    content: '';
    position: absolute;
    width: 60vw;
    height: 60vw;
    background: radial-gradient(circle, rgba(79, 70, 229, 0.15) 0%, rgba(0, 0, 0, 0) 70%);
    top: -20%;
    left: -20%;
    border-radius: 50%;
    z-index: -1;
    pointer-events: none;
}

/* Dashboard Grid Layout */
.dashboard-body {
    display: block;
    height: 100vh;
    overflow: hidden;
}

/* Dashboard Layout - Top Nav */
.dashboard-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Top Header Styles */
.top-header {
    height: var(--header-height);
    background: rgba(16, 26, 43, 0.85);
    /* Slightly more opaque */
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
}

.header-logo {
    height: 32px;
    width: auto;
}

/* Top Nav Horizontal */
.top-nav {
    flex: 1;
    display: flex;
    justify-content: center;
}

.nav-list {
    display: flex;
    flex-direction: row;
    /* Horizontal */
    gap: 0.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    text-decoration: none;
    color: var(--text-muted);
    border-radius: 8px;
    /* Softer radius */
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 0.95rem;
    position: relative;
    border-bottom: 2px solid transparent;
}

/* Hover & Active States */
.nav-link:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.nav-item.active .nav-link {
    color: var(--accent);
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 2px solid var(--accent);
    border-radius: 8px 8px 0 0;
    /* Flat bottom for border */
}

.nav-link i {
    width: 18px;
    height: 18px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.btn-logout-icon {
    color: var(--text-muted);
    transition: color 0.2s;
    display: flex;
    align-items: center;
}

.btn-logout-icon:hover {
    color: var(--danger);
}

.breadcrumbs {
    display: flex;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.breadcrumb-sep {
    width: 16px;
    height: 16px;
    margin: 0 0.5rem;
}

.breadcrumbs .current {
    color: white;
    font-weight: 500;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), #ec4899);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

/* Main Content Area */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    width: 100%;
}

/* Content Wrapper */
.content-wrapper {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    width: 100%;
    scroll-behavior: smooth;
}

/* Widgets & Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    border-color: rgba(79, 70, 229, 0.3);
}

.stat-info h3 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    color: white;
}

.stat-info p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    color: var(--primary);
}

/* Glass Card Global (Login & Common) */
.glass-card {
    background: rgba(16, 26, 43, 0.7);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    padding: 3rem;
    width: 100%;
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.6);
}

/* LOGIN OVERLAY - V3 AURORA BREAKOUT */
/* By using position: fixed, we break out of .app-container to ensure 100% viewport coverage */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    /* Deep Void Background */
    background-color: #050b14;
}

/* The Aurora Borealis Effect */
.aurora-bg {
    position: absolute;
    inset: -50%;
    width: 200%;
    height: 200%;
    background:
        radial-gradient(circle at 50% 50%, rgba(76, 29, 149, 0.15), transparent 50%),
        radial-gradient(circle at 100% 0%, rgba(14, 165, 233, 0.15), transparent 50%),
        radial-gradient(circle at 0% 100%, rgba(236, 72, 153, 0.15), transparent 50%);
    filter: blur(80px);
    animation: auroraSpin 20s linear infinite;
    z-index: 0;
}

@keyframes auroraSpin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.aurora-accent {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 60vw;
    height: 60vh;
    background: radial-gradient(ellipse at center, rgba(56, 189, 248, 0.1), transparent 70%);
    transform: translate(-50%, -50%);
    z-index: 0;
    pointer-events: none;
}

/* Obsidian Glass Card */
.obsidian-card {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 400px;
    padding: 3rem 2.5rem;
    background: rgba(10, 10, 10, 0.6);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 50px 100px -20px rgba(0, 0, 0, 0.7);
    animation: obsidianRise 1s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes obsidianRise {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.96);
    }

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

.login-header {
    text-align: center;
    margin-bottom: 3rem;
}

.login-header h1 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: #fff;
    margin-bottom: 0.5rem;
}

.login-header p {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Minimalist Inputs */
.form-group {
    position: relative;
    margin-bottom: 2rem;
}

.form-input-minimal {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 0.75rem 0;
    font-size: 1rem;
    transition: all 0.3s ease;
    border-radius: 0;
}

.form-input-minimal:focus {
    outline: none;
    border-bottom-color: var(--accent);
    box-shadow: 0 1px 0 0 var(--accent);
}

.form-label-minimal {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.5);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 1rem;
}

.form-input-minimal:focus~.form-label-minimal,
.form-input-minimal:not(:placeholder-shown)~.form-label-minimal {
    top: -10px;
    transform: none;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.8);
}

.btn-aurora {
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    color: white;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 1rem;
    box-shadow: 0 10px 20px -5px rgba(234, 88, 12, 0.3);
}

.btn-aurora:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 30px -10px rgba(234, 88, 12, 0.5);
    background: linear-gradient(135deg, #fb923c 0%, #ea580c 100%);
}

/* Form Styles */
.form-group {
    margin-bottom: 1.5rem;
    position: relative;
}

.form-control {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    padding: 1rem 1rem;
    border-radius: 12px;
    color: white;
    font-size: 1rem;
    transition: all 0.3s ease;
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(0, 0, 0, 0.4);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

.form-label {
    position: absolute;
    left: 1rem;
    top: 1rem;
    color: var(--text-muted);
    pointer-events: none;
    transition: all 0.3s ease;
    background: transparent;
    padding: 0 0.25rem;
}

.file-input-label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
}

.form-select {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    padding: 1rem 1rem;
    border-radius: 12px;
    color: white;
    font-size: 1rem;
    transition: all 0.3s ease;
    font-family: inherit;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1em;
}

.form-select:focus {
    outline: none;
    border-color: var(--primary);
    background-color: rgba(0, 0, 0, 0.4);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

.form-select option {
    background-color: #1e3a5f;
    color: white;
}

.form-control:focus~.form-label,
.form-control:focus~.form-label,
.form-control:not(:placeholder-shown)~.form-label,
.form-control:-webkit-autofill~.form-label,
.form-group.static-label .form-label {
    top: -0.75rem;
    left: 0.75rem;
    font-size: 0.875rem;
    color: var(--accent);
    background: #15202B;
    /* Dark background to hide border line */
    padding: 0 4px;
    z-index: 10;
    border-radius: 4px;
}

.form-label span {
    background: #162032;
    padding: 0 5px;
    border-radius: 4px;
}

.btn-primary {
    /* width: 100%;  Removed to allow auto width */
    padding: 1rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    /* Gradient Button */
    background: linear-gradient(135deg, var(--accent) 0%, #d35400 100%);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.btn-primary:after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.1) 0%, transparent 100%);
    opacity: 0;
    transition: opacity 0.3s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -5px rgba(230, 126, 34, 0.4);
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:hover:after {
    opacity: 1;
}

.btn {
    display: inline-block;
    padding: 1rem 2rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    color: white;
}

.form-container {
    max-width: 600px;
    margin: 0 auto;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
}

/* Sections */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 600;
}

.recent-activity {
    margin-top: 2rem;
}

.w-100 {
    width: 100%;
}

/* Data Table */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.data-table th {
    padding: 1rem;
    border-bottom: 1px solid var(--glass-border);
    text-align: left;
    color: var(--text-muted);
    font-weight: 500;
}

.data-table td {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    vertical-align: middle;
}

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

.data-table tbody tr {
    transition: background 0.2s ease;
}

.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

.action-btn {
    padding: 4px;
    border-radius: 6px;
    transition: background 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}